blob: c113b2fa7c6b793b84bb740a603104bfdb7ad6b8 [file] [log] [blame]
Darren Tucker391de5c2007-04-29 14:49:21 +10001# $Id: configure.ac,v 1.378 2007/04/29 04:49:21 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 Tucker391de5c2007-04-29 14:49:21 +100018AC_REVISION($Revision: 1.378 $)
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 \
208 pty.h \
209 readpassphrase.h \
210 rpc/types.h \
211 security/pam_appl.h \
212 sha2.h \
213 shadow.h \
214 stddef.h \
215 stdint.h \
216 string.h \
217 strings.h \
218 sys/audit.h \
219 sys/bitypes.h \
220 sys/bsdtty.h \
221 sys/cdefs.h \
222 sys/dir.h \
223 sys/mman.h \
224 sys/ndir.h \
225 sys/prctl.h \
226 sys/pstat.h \
227 sys/select.h \
228 sys/stat.h \
229 sys/stream.h \
230 sys/stropts.h \
231 sys/strtio.h \
232 sys/sysmacros.h \
233 sys/time.h \
234 sys/timers.h \
235 sys/un.h \
236 time.h \
237 tmpdir.h \
238 ttyent.h \
239 unistd.h \
240 usersec.h \
241 util.h \
242 utime.h \
243 utmp.h \
244 utmpx.h \
245 vis.h \
246)
247
248# lastlog.h requires sys/time.h to be included first on Solaris
249AC_CHECK_HEADERS(lastlog.h, [], [], [
250#ifdef HAVE_SYS_TIME_H
251# include <sys/time.h>
252#endif
253])
254
255# sys/ptms.h requires sys/stream.h to be included first on Solaris
256AC_CHECK_HEADERS(sys/ptms.h, [], [], [
257#ifdef HAVE_SYS_STREAM_H
258# include <sys/stream.h>
259#endif
260])
261
262# login_cap.h requires sys/types.h on NetBSD
263AC_CHECK_HEADERS(login_cap.h, [], [], [
264#include <sys/types.h>
265])
266
Damien Miller1b06dc32006-08-31 03:24:41 +1000267# Messages for features tested for in target-specific section
268SIA_MSG="no"
269SPC_MSG="no"
270
Damien Millera22ba012000-03-02 23:09:20 +1100271# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100272case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100273*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000274 # Some versions of VAC won't allow macro redefinitions at
275 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
276 # particularly with older versions of vac or xlc.
277 # It also throws errors about null macro argments, but these are
278 # not fatal.
279 AC_MSG_CHECKING(if compiler allows macro redefinitions)
280 AC_COMPILE_IFELSE(
281 [AC_LANG_SOURCE([[
282#define testmacro foo
283#define testmacro bar
284int main(void) { exit(0); }
285 ]])],
286 [ AC_MSG_RESULT(yes) ],
287 [ AC_MSG_RESULT(no)
288 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
289 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
290 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
291 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
292 ]
293 )
294
Damien Millera8e06ce2003-11-21 23:48:55 +1100295 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000296 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800297 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100298 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000299 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000300 if test "$GCC" = "yes"; then
301 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
302 else
303 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
304 fi
305 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000306 if (test -z "$blibflags"); then
307 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
308 AC_TRY_LINK([], [], [blibflags=$tryflags])
309 fi
310 done
311 if (test -z "$blibflags"); then
312 AC_MSG_RESULT(not found)
313 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
314 else
315 AC_MSG_RESULT($blibflags)
316 fi
317 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000318 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700319 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
320 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700321 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000322 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700323 LIBS="$LIBS -ls"
324 ])
325 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100326 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100327 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100328 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000329 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100330 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000331 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
332 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000333 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000334 [(void)loginfailed("user","host","tty",0);],
335 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700336 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
337 [Define if your AIX loginfailed() function
338 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000339 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000340 )],
341 [],
342 [#include <usersec.h>]
343 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000344 AC_CHECK_FUNCS(setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000345 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000346 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000347 [],
348 [ #include <limits.h>
349 #include <fcntl.h> ]
350 )
Darren Tucker691d5232005-02-15 21:45:57 +1100351 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700352 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
353 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
354 [Define if your platform breaks doing a seteuid before a setuid])
355 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
356 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000357 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700358 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
359 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
360 [Some systems need a utmpx entry for /bin/login to work])
361 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
362 [Define to a Set Process Title type if your system is
363 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100364 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
365 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000366 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100367 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100368*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100369 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100370 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700371 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
372 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
373 AC_DEFINE(DISABLE_SHADOW, 1,
374 [Define if you want to disable shadow passwords])
375 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
376 [Define if your system choked on IP TOS setting])
377 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
378 [Define if X11 doesn't support AF_UNIX sockets on that system])
379 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
380 [Define if the concept of ports only accessible to
381 superusers isn't known])
382 AC_DEFINE(DISABLE_FD_PASSING, 1,
383 [Define if your platform needs to skip post auth
384 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100385 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000386*-*-dgux*)
387 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100388 AC_DEFINE(SETEUID_BREAKS_SETUID)
389 AC_DEFINE(BROKEN_SETREUID)
390 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000391 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000392*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000393 AC_MSG_CHECKING(if we have working getaddrinfo)
394 AC_TRY_RUN([#include <mach-o/dyld.h>
395main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
396 exit(0);
397 else
398 exit(1);
399}], [AC_MSG_RESULT(working)],
400 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700401 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700402 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700406 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
407 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000408 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
409 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
410 [Use tunnel device compatibility to OpenBSD])
411 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
412 [Prepend the address family to IP tunnel traffic])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000413 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000414*-*-dragonfly*)
415 SSHDLIBS="$SSHDLIBS -lcrypt"
416 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000417*-*-hpux*)
418 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000419 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100420 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000421 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700422 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
423 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000424 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700425 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
426 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000427 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000428 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700429 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000430 AC_CHECK_LIB(xnet, t_error, ,
431 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
432
433 # next, we define all of the options specific to major releases
434 case "$host" in
435 *-*-hpux10*)
436 if test -z "$GCC"; then
437 CFLAGS="$CFLAGS -Ae"
438 fi
439 ;;
440 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700441 AC_DEFINE(PAM_SUN_CODEBASE, 1,
442 [Define if you are using Solaris-derived PAM which
443 passes pam_messages to the conversation function
444 with an extra level of indirection])
445 AC_DEFINE(DISABLE_UTMP, 1,
446 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000447 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
448 check_for_hpux_broken_getaddrinfo=1
449 check_for_conflicting_getspnam=1
450 ;;
451 esac
452
453 # lastly, we define options specific to minor releases
454 case "$host" in
455 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700456 AC_DEFINE(HAVE_SECUREWARE, 1,
457 [Define if you have SecureWare-based
458 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000459 disable_ptmx_check=yes
460 LIBS="$LIBS -lsecpw"
461 ;;
462 esac
Damien Miller1bead332000-04-30 00:47:29 +1000463 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100464*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100465 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700466 AC_DEFINE(BROKEN_INET_NTOA, 1,
467 [Define if you system's inet_ntoa is busted
468 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000469 AC_DEFINE(SETEUID_BREAKS_SETUID)
470 AC_DEFINE(BROKEN_SETREUID)
471 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700472 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
473 [Define if you shouldn't strip 'tty' from your
474 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000475 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100476 ;;
477*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100478 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700479 AC_DEFINE(WITH_IRIX_ARRAY, 1,
480 [Define if you have/want arrays
481 (cluster-wide session managment, not C arrays)])
482 AC_DEFINE(WITH_IRIX_PROJECT, 1,
483 [Define if you want IRIX project management])
484 AC_DEFINE(WITH_IRIX_AUDIT, 1,
485 [Define if you want IRIX audit trails])
486 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
487 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000488 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000489 AC_DEFINE(SETEUID_BREAKS_SETUID)
490 AC_DEFINE(BROKEN_SETREUID)
491 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700492 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000493 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000494 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100495 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100496*-*-linux*)
497 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100498 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000499 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700500 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
501 AC_DEFINE(PAM_TTY_KLUDGE, 1,
502 [Work around problematic Linux PAM modules handling of PAM_TTY])
503 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
504 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000505 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700506 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
507 [Define to whatever link() returns for "not supported"
508 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100509 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700510 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100511 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000512 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000513 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700514 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
515 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000516 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000517 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100518 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100519 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100520 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100521 AC_DEFINE(SSH_TUN_LINUX, 1,
522 [Open tunnel devices the Linux tun/tap way])
523 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
524 [Use tunnel device compatibility to OpenBSD])
525 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
526 [Prepend the address family to IP tunnel traffic])
527 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100528 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000529mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100530 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000531 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000532 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100533*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000534 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800535 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800536 need_dash_r=1
537 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100538 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
539 AC_CHECK_HEADER([net/if_tap.h], ,
540 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
541 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
542 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100543 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100544*-*-freebsd*)
545 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000546 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100547 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
548 AC_CHECK_HEADER([net/if_tap.h], ,
549 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100550 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000551*-*-bsdi*)
552 AC_DEFINE(SETEUID_BREAKS_SETUID)
553 AC_DEFINE(BROKEN_SETREUID)
554 AC_DEFINE(BROKEN_SETREGID)
555 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000556*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000557 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100558 conf_utmp_location=/etc/utmp
559 conf_wtmp_location=/usr/adm/wtmp
560 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700561 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000562 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000563 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700564 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000565 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000566*-*-openbsd*)
567 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000568 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100569 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000570 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
571 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000572 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100573*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800574 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800575 need_dash_r=1
576 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100577 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000578 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700579 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
580 [Some versions of /bin/login need the TERM supplied
581 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000582 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700583 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
584 [Define if pam_chauthtok wants real uid set
585 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000586 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000587 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700588 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
589 [Define if sshd somehow reacquires a controlling TTY
590 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000591 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
592 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000593 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000594 # hardwire lastlog location (can't detect it on some versions)
595 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000596 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
597 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
598 if test "$sol2ver" -ge 8; then
599 AC_MSG_RESULT(yes)
600 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700601 AC_DEFINE(DISABLE_WTMP, 1,
602 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000603 else
604 AC_MSG_RESULT(no)
605 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000606 AC_ARG_WITH(solaris-contracts,
607 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
608 [
609 AC_CHECK_LIB(contract, ct_tmpl_activate,
610 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
611 [Define if you have Solaris process contracts])
612 SSHDLIBS="$SSHDLIBS -lcontract"
613 AC_SUBST(SSHDLIBS)
614 SPC_MSG="yes" ], )
615 ],
616 )
Damien Miller75b1d102000-01-07 14:01:41 +1100617 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000618*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000619 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000620 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100621 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000622 conf_utmp_location=/etc/utmp
623 conf_wtmp_location=/var/adm/wtmp
624 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000625 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000626 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000627*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700628 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000629 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000630 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000631 AC_DEFINE(SETEUID_BREAKS_SETUID)
632 AC_DEFINE(BROKEN_SETREUID)
633 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000634 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000635*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700636 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000637 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100638 # -lresolv needs to be at the end of LIBS or DNS lookups break
639 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100640 IPADDR_IN_DISPLAY=yes
641 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000642 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000643 AC_DEFINE(SETEUID_BREAKS_SETUID)
644 AC_DEFINE(BROKEN_SETREUID)
645 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000646 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000647 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700648 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
649 # Attention: always take care to bind libsocket and libnsl before libc,
650 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000651 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800652# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100653*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100654 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700655 AC_DEFINE(SETEUID_BREAKS_SETUID)
656 AC_DEFINE(BROKEN_SETREUID)
657 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700658 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800659 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100660 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800661# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100662*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700663 check_for_libcrypt_later=1
664 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100665 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700666 AC_DEFINE(SETEUID_BREAKS_SETUID)
667 AC_DEFINE(BROKEN_SETREUID)
668 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700669 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700670 case "$host" in
671 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
672 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700673 AC_DEFINE(BROKEN_LIBIAF, 1,
674 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700675 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700676 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800677 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
678 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700679 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100680 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100681*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100682 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800683# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100684*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800685 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100686 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800687# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100688*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800689 if test -z "$GCC"; then
690 CFLAGS="$CFLAGS -belf"
691 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100692 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000693 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100694 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000695 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000696 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700697 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700698 AC_DEFINE(SETEUID_BREAKS_SETUID)
699 AC_DEFINE(BROKEN_SETREUID)
700 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700701 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700702 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700703 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100704 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700705 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700706 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000707 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000708*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700709 AC_DEFINE(NO_SSH_LASTLOG, 1,
710 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100711 AC_DEFINE(SETEUID_BREAKS_SETUID)
712 AC_DEFINE(BROKEN_SETREUID)
713 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000714 AC_DEFINE(USE_PIPES)
715 AC_DEFINE(DISABLE_FD_PASSING)
716 LDFLAGS="$LDFLAGS"
717 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
718 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000719 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000720*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100721 AC_DEFINE(SETEUID_BREAKS_SETUID)
722 AC_DEFINE(BROKEN_SETREUID)
723 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000724 AC_DEFINE(WITH_ABBREV_NO_TTY)
725 AC_DEFINE(USE_PIPES)
726 AC_DEFINE(DISABLE_FD_PASSING)
727 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100728 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000729 MANTYPE=cat
730 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000731*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100732 AC_DEFINE(SETEUID_BREAKS_SETUID)
733 AC_DEFINE(BROKEN_SETREUID)
734 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000735 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700736 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700737 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000738 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
739 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
740 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700741 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000742*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000743 AC_MSG_CHECKING(for Digital Unix SIA)
744 no_osfsia=""
745 AC_ARG_WITH(osfsia,
746 [ --with-osfsia Enable Digital Unix SIA],
747 [
748 if test "x$withval" = "xno" ; then
749 AC_MSG_RESULT(disabled)
750 no_osfsia=1
751 fi
752 ],
753 )
754 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000755 if test -f /etc/sia/matrix.conf; then
756 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700757 AC_DEFINE(HAVE_OSF_SIA, 1,
758 [Define if you have Digital Unix Security
759 Integration Architecture])
760 AC_DEFINE(DISABLE_LOGIN, 1,
761 [Define if you don't want to use your
762 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000763 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000764 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000765 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000766 else
767 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700768 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
769 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000770 fi
771 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000772 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700773 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000774 AC_DEFINE(BROKEN_SETREUID)
775 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000776 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000777
Tim Rice70335a62006-02-04 17:42:58 -0800778*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000779 AC_DEFINE(USE_PIPES)
780 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700781 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
782 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
783 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800784 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100785 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Rice2f993462006-02-11 18:37:48 -0800786 enable_etc_default_login=no # has incompatible /etc/default/login
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000787 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000788
789*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700790 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
791 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100792 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700793 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
794 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000795
796*-*-lynxos)
797 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700798 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000799 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
800 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100801esac
802
Darren Tucker6eb93042003-06-29 21:30:41 +1000803AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000804AC_RUN_IFELSE(
805 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000806#include <stdio.h>
807int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000808 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000809 [ AC_MSG_RESULT(yes) ],
810 [
811 AC_MSG_RESULT(no)
812 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000813 ],
814 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000815)
816
Darren Tucker0c9653f2005-05-28 15:58:14 +1000817dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100818# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700819AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
820AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000821
Tim Rice1e1ef642003-09-11 22:19:31 -0700822dnl IRIX and Solaris 2.5.1 have dirname() in libgen
823AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
824 AC_CHECK_LIB(gen, dirname,[
825 AC_CACHE_CHECK([for broken dirname],
826 ac_cv_have_broken_dirname, [
827 save_LIBS="$LIBS"
828 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000829 AC_RUN_IFELSE(
830 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700831#include <libgen.h>
832#include <string.h>
833
834int main(int argc, char **argv) {
835 char *s, buf[32];
836
837 strncpy(buf,"/etc", 32);
838 s = dirname(buf);
839 if (!s || strncmp(s, "/", 32) != 0) {
840 exit(1);
841 } else {
842 exit(0);
843 }
844}
Darren Tucker314d89e2005-10-17 23:29:23 +1000845 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700846 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000847 [ ac_cv_have_broken_dirname="yes" ],
848 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700849 )
850 LIBS="$save_LIBS"
851 ])
852 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
853 LIBS="$LIBS -lgen"
854 AC_DEFINE(HAVE_DIRNAME)
855 AC_CHECK_HEADERS(libgen.h)
856 fi
857 ])
858])
859
860AC_CHECK_FUNC(getspnam, ,
861 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700862AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
863 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700864
Tim Rice13aae5e2001-10-21 17:53:58 -0700865dnl zlib is required
866AC_ARG_WITH(zlib,
867 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100868 [ if test "x$withval" = "xno" ; then
869 AC_MSG_ERROR([*** zlib is required ***])
870 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700871 if test -d "$withval/lib"; then
872 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700873 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700874 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700875 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700876 fi
877 else
878 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700879 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700880 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700881 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700882 fi
883 fi
884 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700885 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700886 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700887 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700888 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100889 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700890)
891
Tim Ricefcb62202004-01-23 18:35:16 -0800892AC_CHECK_LIB(z, deflate, ,
893 [
894 saved_CPPFLAGS="$CPPFLAGS"
895 saved_LDFLAGS="$LDFLAGS"
896 save_LIBS="$LIBS"
897 dnl Check default zlib install dir
898 if test -n "${need_dash_r}"; then
899 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
900 else
901 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
902 fi
903 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
904 LIBS="$LIBS -lz"
905 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
906 [
907 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
908 ]
909 )
910 ]
911)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100912AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100913
914AC_ARG_WITH(zlib-version-check,
915 [ --without-zlib-version-check Disable zlib version check],
916 [ if test "x$withval" = "xno" ; then
917 zlib_check_nonfatal=1
918 fi
919 ]
920)
921
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000922AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000923AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000924#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100925#include <zlib.h>
926int main()
927{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000928 int a=0, b=0, c=0, d=0, n, v;
929 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
930 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100931 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000932 v = a*1000000 + b*10000 + c*100 + d;
933 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
934
935 /* 1.1.4 is OK */
936 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100937 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000938
Darren Tucker41097ed2005-07-25 15:24:21 +1000939 /* 1.2.3 and up are OK */
940 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000941 exit(0);
942
Darren Tucker2dcd2392004-01-23 17:13:33 +1100943 exit(2);
944}
Darren Tucker623d92f2004-09-12 22:36:15 +1000945 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000946 AC_MSG_RESULT(no),
947 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100948 if test -z "$zlib_check_nonfatal" ; then
949 AC_MSG_ERROR([*** zlib too old - check config.log ***
950Your reported zlib version has known security problems. It's possible your
951vendor has fixed these problems without changing the version number. If you
952are sure this is the case, you can disable the check by running
953"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000954If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000955See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100956 else
957 AC_MSG_WARN([zlib version may have security problems])
958 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000959 ],
960 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100961)
Damien Miller6f9c3372000-10-25 10:06:04 +1100962
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000963dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100964AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000965 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
966)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100967AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700968 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
969 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000970)
Damien Millerab18c411999-11-11 10:40:23 +1100971
Tim Ricee589a292001-11-03 11:09:32 -0800972dnl Checks for libutil functions
973AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700974AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
975 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800976AC_CHECK_FUNCS(logout updwtmp logwtmp)
977
Ben Lindstrom8697e082001-02-24 21:41:10 +0000978AC_FUNC_STRFTIME
979
Damien Miller3c027682001-03-14 11:39:45 +1100980# Check for ALTDIRFUNC glob() extension
981AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
982AC_EGREP_CPP(FOUNDIT,
983 [
984 #include <glob.h>
985 #ifdef GLOB_ALTDIRFUNC
986 FOUNDIT
987 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100988 ],
Damien Miller3c027682001-03-14 11:39:45 +1100989 [
Tim Rice7df8d392005-09-19 09:33:39 -0700990 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
991 [Define if your system glob() function has
992 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100993 AC_MSG_RESULT(yes)
994 ],
995 [
996 AC_MSG_RESULT(no)
997 ]
998)
Damien Millerab18c411999-11-11 10:40:23 +1100999
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001000# Check for g.gl_matchc glob() extension
1001AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001002AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001003 [ #include <glob.h> ],
1004 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001005 [
Tim Rice7df8d392005-09-19 09:33:39 -07001006 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1007 [Define if your system glob() function has
1008 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001009 AC_MSG_RESULT(yes)
1010 ],
1011 [
1012 AC_MSG_RESULT(no)
1013 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001014)
1015
Darren Tucker096faec2006-09-01 20:29:10 +10001016AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1017
Damien Miller18bb4732001-03-28 14:35:30 +10001018AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001019AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001020 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001021#include <sys/types.h>
1022#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001023int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001024 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001025 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001026 [
1027 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001028 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001029 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001030 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001031 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001032 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001033 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1034 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001035 ]
1036)
1037
Damien Miller36f49652004-08-15 18:40:59 +10001038AC_MSG_CHECKING([for /proc/pid/fd directory])
1039if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001040 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001041 AC_MSG_RESULT(yes)
1042else
1043 AC_MSG_RESULT(no)
1044fi
1045
Damien Millerc547bf12001-02-16 10:18:12 +11001046# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001047SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001048AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001049 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001050 [
1051 if test "x$withval" != "xno" ; then
1052
1053 if test "x$withval" != "xyes" ; then
1054 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1055 LDFLAGS="$LDFLAGS -L${withval}/lib"
1056 fi
1057
Tim Rice7df8d392005-09-19 09:33:39 -07001058 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001059 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001060 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001061
Tim Rice4cec93f2002-02-26 08:40:48 -08001062 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001063 AC_LINK_IFELSE(
1064 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001065#include <stdio.h>
1066#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001067int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001068 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001069 [AC_MSG_RESULT(yes)],
1070 [
1071 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001072 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1073 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001074 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1075 AC_TRY_COMPILE(
1076 [#include <stdio.h>
1077 #include <skey.h>],
1078 [(void)skeychallenge(NULL,"name","",0);],
1079 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001080 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1081 [Define if your skeychallenge()
1082 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001083 [AC_MSG_RESULT(no)]
1084 )
Damien Millerc547bf12001-02-16 10:18:12 +11001085 fi
1086 ]
1087)
1088
1089# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001090TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001091AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001092 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001093 [
1094 if test "x$withval" != "xno" ; then
1095 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001096 saved_LDFLAGS="$LDFLAGS"
1097 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001098 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001099 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001100 if test -d "${withval}/lib"; then
1101 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001102 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001103 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001104 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001105 fi
1106 else
1107 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001108 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001109 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001110 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001111 fi
1112 fi
1113 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001114 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001115 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001116 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001117 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001118 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001119 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001120 AC_MSG_CHECKING(for libwrap)
1121 AC_TRY_LINK(
1122 [
Damien Miller0ac45002004-04-14 20:14:26 +10001123#include <sys/types.h>
1124#include <sys/socket.h>
1125#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001126#include <tcpd.h>
1127 int deny_severity = 0, allow_severity = 0;
1128 ],
1129 [hosts_access(0);],
1130 [
1131 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001132 AC_DEFINE(LIBWRAP, 1,
1133 [Define if you want
1134 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001135 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001136 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001137 ],
1138 [
1139 AC_MSG_ERROR([*** libwrap missing])
1140 ]
1141 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001142 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001143 fi
1144 ]
1145)
1146
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001147# Check whether user wants libedit support
1148LIBEDIT_MSG="no"
1149AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001150 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001151 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001152 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001153 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1154 if test -n "${need_dash_r}"; then
1155 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1156 else
1157 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1158 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001159 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001160 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001161 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001162 LIBEDIT="-ledit -lcurses"
1163 LIBEDIT_MSG="yes"
1164 AC_SUBST(LIBEDIT)
1165 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001166 [ AC_MSG_ERROR(libedit not found) ],
1167 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001168 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001169 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001170 AC_COMPILE_IFELSE(
1171 [AC_LANG_SOURCE([[
1172#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001173int main(void)
1174{
1175 int i = H_SETSIZE;
1176 el_init("", NULL, NULL, NULL);
1177 exit(0);
1178}
Tim Ricec1819c82005-08-15 17:48:40 -07001179 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001180 [ AC_MSG_RESULT(yes) ],
1181 [ AC_MSG_RESULT(no)
1182 AC_MSG_ERROR(libedit version is not compatible) ]
1183 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001184 fi ]
1185)
1186
Darren Tuckerd9f88912005-02-20 21:01:48 +11001187AUDIT_MODULE=none
1188AC_ARG_WITH(audit,
1189 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1190 [
1191 AC_MSG_CHECKING(for supported audit module)
1192 case "$withval" in
1193 bsm)
1194 AC_MSG_RESULT(bsm)
1195 AUDIT_MODULE=bsm
1196 dnl Checks for headers, libs and functions
1197 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001198 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1199 [
1200#ifdef HAVE_TIME_H
1201# include <time.h>
1202#endif
1203 ]
1204)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001205 AC_CHECK_LIB(bsm, getaudit, [],
1206 [AC_MSG_ERROR(BSM enabled and required library not found)])
1207 AC_CHECK_FUNCS(getaudit, [],
1208 [AC_MSG_ERROR(BSM enabled and required function not found)])
1209 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001210 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001211 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001212 ;;
1213 debug)
1214 AUDIT_MODULE=debug
1215 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001216 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001217 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001218 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001219 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001220 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001221 *)
1222 AC_MSG_ERROR([Unknown audit module $withval])
1223 ;;
1224 esac ]
1225)
1226
Damien Millerfe1f1432003-02-24 15:45:42 +11001227dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001228AC_CHECK_FUNCS( \
1229 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001230 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001231 b64_ntop \
1232 __b64_ntop \
1233 b64_pton \
1234 __b64_pton \
1235 bcopy \
1236 bindresvport_sa \
1237 clock \
1238 closefrom \
1239 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001240 fchmod \
1241 fchown \
1242 freeaddrinfo \
1243 futimes \
1244 getaddrinfo \
1245 getcwd \
1246 getgrouplist \
1247 getnameinfo \
1248 getopt \
1249 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001250 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001251 _getpty \
1252 getrlimit \
1253 getttyent \
1254 glob \
1255 inet_aton \
1256 inet_ntoa \
1257 inet_ntop \
1258 innetgr \
1259 login_getcapbool \
1260 md5_crypt \
1261 memmove \
1262 mkdtemp \
1263 mmap \
1264 ngetaddrinfo \
1265 nsleep \
1266 ogetaddrinfo \
1267 openlog_r \
1268 openpty \
1269 prctl \
1270 pstat \
1271 readpassphrase \
1272 realpath \
1273 recvmsg \
1274 rresvport_af \
1275 sendmsg \
1276 setdtablesize \
1277 setegid \
1278 setenv \
1279 seteuid \
1280 setgroups \
1281 setlogin \
1282 setpcred \
1283 setproctitle \
1284 setregid \
1285 setreuid \
1286 setrlimit \
1287 setsid \
1288 setvbuf \
1289 sigaction \
1290 sigvec \
1291 snprintf \
1292 socketpair \
1293 strdup \
1294 strerror \
1295 strlcat \
1296 strlcpy \
1297 strmode \
1298 strnvis \
1299 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001300 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001301 strtoul \
1302 sysconf \
1303 tcgetpgrp \
1304 truncate \
1305 unsetenv \
1306 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001307 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001308 vhangup \
1309 vsnprintf \
1310 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001311)
Tim Rice13aae5e2001-10-21 17:53:58 -07001312
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001313# IRIX has a const char return value for gai_strerror()
1314AC_CHECK_FUNCS(gai_strerror,[
1315 AC_DEFINE(HAVE_GAI_STRERROR)
1316 AC_TRY_COMPILE([
1317#include <sys/types.h>
1318#include <sys/socket.h>
1319#include <netdb.h>
1320
1321const char *gai_strerror(int);],[
1322char *str;
1323
1324str = gai_strerror(0);],[
1325 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1326 [Define if gai_strerror() returns const char *])])])
1327
Tim Rice7df8d392005-09-19 09:33:39 -07001328AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1329 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001330
Darren Tuckerf1159b52003-07-07 19:44:01 +10001331dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001332AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001333AC_CHECK_DECL(strsep,
1334 [AC_CHECK_FUNCS(strsep)],
1335 [],
1336 [
1337#ifdef HAVE_STRING_H
1338# include <string.h>
1339#endif
1340 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001341
Darren Tuckerb2427c82003-09-10 15:22:44 +10001342dnl tcsendbreak might be a macro
1343AC_CHECK_DECL(tcsendbreak,
1344 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001345 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001346 [#include <termios.h>]
1347)
1348
Darren Tucker5bb14002004-04-23 18:53:10 +10001349AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1350
Darren Tucker128a0892006-07-12 19:02:56 +10001351AC_CHECK_DECLS(SHUT_RD, , ,
1352 [
1353#include <sys/types.h>
1354#include <sys/socket.h>
1355 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001356
1357AC_CHECK_DECLS(O_NONBLOCK, , ,
1358 [
1359#include <sys/types.h>
1360#ifdef HAVE_SYS_STAT_H
1361# include <sys/stat.h>
1362#endif
1363#ifdef HAVE_FCNTL_H
1364# include <fcntl.h>
1365#endif
1366 ])
1367
Darren Tuckered0b5922006-09-03 22:44:49 +10001368AC_CHECK_DECLS(writev, , , [
1369#include <sys/types.h>
1370#include <sys/uio.h>
1371#include <unistd.h>
1372 ])
1373
Darren Tucker6d862a52007-04-29 14:39:02 +10001374AC_CHECK_DECLS(MAXSYMLINKS, , , [
1375#include <sys/param.h>
1376 ])
1377
Darren Tucker2a6b0292003-12-31 14:59:17 +11001378AC_CHECK_FUNCS(setresuid, [
1379 dnl Some platorms have setresuid that isn't implemented, test for this
1380 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001381 AC_RUN_IFELSE(
1382 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001383#include <stdlib.h>
1384#include <errno.h>
1385int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001386 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001387 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001388 [AC_DEFINE(BROKEN_SETRESUID, 1,
1389 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001390 AC_MSG_RESULT(not implemented)],
1391 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001392 )
1393])
Darren Tuckere937be32003-12-17 18:53:26 +11001394
Darren Tucker2a6b0292003-12-31 14:59:17 +11001395AC_CHECK_FUNCS(setresgid, [
1396 dnl Some platorms have setresgid that isn't implemented, test for this
1397 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001398 AC_RUN_IFELSE(
1399 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001400#include <stdlib.h>
1401#include <errno.h>
1402int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001403 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001404 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001405 [AC_DEFINE(BROKEN_SETRESGID, 1,
1406 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001407 AC_MSG_RESULT(not implemented)],
1408 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001409 )
1410])
Darren Tuckere937be32003-12-17 18:53:26 +11001411
Damien Millerad833b32000-08-23 10:46:23 +10001412dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001413AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001414dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001415AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001416AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001417dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001418AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001419AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001420
Damien Millera8e06ce2003-11-21 23:48:55 +11001421AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001422 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1423 [AC_CHECK_LIB(bsd, daemon,
1424 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001425)
1426
Damien Millera8e06ce2003-11-21 23:48:55 +11001427AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001428 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1429 [Define if your libraries define getpagesize()])],
1430 [AC_CHECK_LIB(ucb, getpagesize,
1431 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001432)
1433
Damien Millercb170cb2000-07-01 16:52:55 +10001434# Check for broken snprintf
1435if test "x$ac_cv_func_snprintf" = "xyes" ; then
1436 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001437 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001438 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001439#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001440int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001441 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001442 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001443 [
1444 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001445 AC_DEFINE(BROKEN_SNPRINTF, 1,
1446 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001447 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001448 ],
1449 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001450 )
1451fi
1452
Damien Miller57f39152005-11-24 19:58:19 +11001453# If we don't have a working asprintf, then we strongly depend on vsnprintf
1454# returning the right thing on overflow: the number of characters it tried to
1455# create (as per SUSv3)
1456if test "x$ac_cv_func_asprintf" != "xyes" && \
1457 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1458 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1459 AC_RUN_IFELSE(
1460 [AC_LANG_SOURCE([[
1461#include <sys/types.h>
1462#include <stdio.h>
1463#include <stdarg.h>
1464
1465int x_snprintf(char *str,size_t count,const char *fmt,...)
1466{
1467 size_t ret; va_list ap;
1468 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1469 return ret;
1470}
1471int main(void)
1472{
1473 char x[1];
1474 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1475} ]])],
1476 [AC_MSG_RESULT(yes)],
1477 [
1478 AC_MSG_RESULT(no)
1479 AC_DEFINE(BROKEN_SNPRINTF, 1,
1480 [Define if your snprintf is busted])
1481 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1482 ],
1483 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1484 )
1485fi
1486
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001487# On systems where [v]snprintf is broken, but is declared in stdio,
1488# check that the fmt argument is const char * or just char *.
1489# This is only useful for when BROKEN_SNPRINTF
1490AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1491AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1492 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1493 int main(void) { snprintf(0, 0, 0); }
1494 ]])],
1495 [AC_MSG_RESULT(yes)
1496 AC_DEFINE(SNPRINTF_CONST, [const],
1497 [Define as const if snprintf() can declare const char *fmt])],
1498 [AC_MSG_RESULT(no)
1499 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1500
Damien Millerb4097182004-05-23 14:09:40 +10001501# Check for missing getpeereid (or equiv) support
1502NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001503if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001504 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1505 AC_TRY_COMPILE(
1506 [#include <sys/types.h>
1507 #include <sys/socket.h>],
1508 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001509 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001510 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001511 ],
Damien Millerb4097182004-05-23 14:09:40 +10001512 [AC_MSG_RESULT(no)
1513 NO_PEERCHECK=1]
1514 )
1515fi
1516
Damien Millere8328192003-01-07 15:18:32 +11001517dnl see whether mkstemp() requires XXXXXX
1518if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1519AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001520AC_RUN_IFELSE(
1521 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001522#include <stdlib.h>
1523main() { char template[]="conftest.mkstemp-test";
1524if (mkstemp(template) == -1)
1525 exit(1);
1526unlink(template); exit(0);
1527}
Darren Tucker314d89e2005-10-17 23:29:23 +10001528 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001529 [
1530 AC_MSG_RESULT(no)
1531 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001532 [
Damien Millere8328192003-01-07 15:18:32 +11001533 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001534 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001535 ],
1536 [
1537 AC_MSG_RESULT(yes)
1538 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001539 ]
Damien Millere8328192003-01-07 15:18:32 +11001540)
1541fi
1542
Darren Tucker70a3d552003-08-21 17:58:29 +10001543dnl make sure that openpty does not reacquire controlling terminal
1544if test ! -z "$check_for_openpty_ctty_bug"; then
1545 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001546 AC_RUN_IFELSE(
1547 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001548#include <stdio.h>
1549#include <sys/fcntl.h>
1550#include <sys/types.h>
1551#include <sys/wait.h>
1552
1553int
1554main()
1555{
1556 pid_t pid;
1557 int fd, ptyfd, ttyfd, status;
1558
1559 pid = fork();
1560 if (pid < 0) { /* failed */
1561 exit(1);
1562 } else if (pid > 0) { /* parent */
1563 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001564 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001565 exit(WEXITSTATUS(status));
1566 else
1567 exit(2);
1568 } else { /* child */
1569 close(0); close(1); close(2);
1570 setsid();
1571 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1572 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1573 if (fd >= 0)
1574 exit(3); /* Acquired ctty: broken */
1575 else
1576 exit(0); /* Did not acquire ctty: OK */
1577 }
1578}
Darren Tucker314d89e2005-10-17 23:29:23 +10001579 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001580 [
1581 AC_MSG_RESULT(yes)
1582 ],
1583 [
1584 AC_MSG_RESULT(no)
1585 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001586 ],
1587 [
1588 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001589 ]
1590 )
1591fi
1592
Tim Rice8bb561b2005-03-17 16:23:19 -08001593if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1594 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001595 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001596 AC_RUN_IFELSE(
1597 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001598#include <stdio.h>
1599#include <sys/socket.h>
1600#include <netdb.h>
1601#include <errno.h>
1602#include <netinet/in.h>
1603
1604#define TEST_PORT "2222"
1605
1606int
1607main(void)
1608{
1609 int err, sock;
1610 struct addrinfo *gai_ai, *ai, hints;
1611 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1612
1613 memset(&hints, 0, sizeof(hints));
1614 hints.ai_family = PF_UNSPEC;
1615 hints.ai_socktype = SOCK_STREAM;
1616 hints.ai_flags = AI_PASSIVE;
1617
1618 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1619 if (err != 0) {
1620 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1621 exit(1);
1622 }
1623
1624 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1625 if (ai->ai_family != AF_INET6)
1626 continue;
1627
1628 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1629 sizeof(ntop), strport, sizeof(strport),
1630 NI_NUMERICHOST|NI_NUMERICSERV);
1631
1632 if (err != 0) {
1633 if (err == EAI_SYSTEM)
1634 perror("getnameinfo EAI_SYSTEM");
1635 else
1636 fprintf(stderr, "getnameinfo failed: %s\n",
1637 gai_strerror(err));
1638 exit(2);
1639 }
1640
1641 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1642 if (sock < 0)
1643 perror("socket");
1644 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1645 if (errno == EBADF)
1646 exit(3);
1647 }
1648 }
1649 exit(0);
1650}
Darren Tucker314d89e2005-10-17 23:29:23 +10001651 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001652 [
1653 AC_MSG_RESULT(yes)
1654 ],
1655 [
1656 AC_MSG_RESULT(no)
1657 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001658 ],
1659 [
1660 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001661 ]
1662 )
1663fi
1664
Tim Rice8bb561b2005-03-17 16:23:19 -08001665if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1666 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001667 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001668 AC_RUN_IFELSE(
1669 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001670#include <stdio.h>
1671#include <sys/socket.h>
1672#include <netdb.h>
1673#include <errno.h>
1674#include <netinet/in.h>
1675
1676#define TEST_PORT "2222"
1677
1678int
1679main(void)
1680{
1681 int err, sock;
1682 struct addrinfo *gai_ai, *ai, hints;
1683 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1684
1685 memset(&hints, 0, sizeof(hints));
1686 hints.ai_family = PF_UNSPEC;
1687 hints.ai_socktype = SOCK_STREAM;
1688 hints.ai_flags = AI_PASSIVE;
1689
1690 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1691 if (err != 0) {
1692 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1693 exit(1);
1694 }
1695
1696 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1697 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1698 continue;
1699
1700 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1701 sizeof(ntop), strport, sizeof(strport),
1702 NI_NUMERICHOST|NI_NUMERICSERV);
1703
1704 if (ai->ai_family == AF_INET && err != 0) {
1705 perror("getnameinfo");
1706 exit(2);
1707 }
1708 }
1709 exit(0);
1710}
Darren Tucker314d89e2005-10-17 23:29:23 +10001711 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001712 [
1713 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001714 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1715 [Define if you have a getaddrinfo that fails
1716 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001717 ],
1718 [
1719 AC_MSG_RESULT(no)
1720 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001721 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001722 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001723 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001724 ]
1725 )
1726fi
1727
Darren Tuckera56f1912004-11-02 20:30:54 +11001728if test "x$check_for_conflicting_getspnam" = "x1"; then
1729 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1730 AC_COMPILE_IFELSE(
1731 [
1732#include <shadow.h>
1733int main(void) {exit(0);}
1734 ],
1735 [
1736 AC_MSG_RESULT(no)
1737 ],
1738 [
1739 AC_MSG_RESULT(yes)
1740 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1741 [Conflicting defs for getspnam])
1742 ]
1743 )
1744fi
1745
Damien Miller606f8802000-09-16 15:39:56 +11001746AC_FUNC_GETPGRP
1747
Tim Riceaef73712002-05-11 13:17:42 -07001748# Search for OpenSSL
1749saved_CPPFLAGS="$CPPFLAGS"
1750saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001751AC_ARG_WITH(ssl-dir,
1752 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1753 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001754 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001755 case "$withval" in
1756 # Relative paths
1757 ./*|../*) withval="`pwd`/$withval"
1758 esac
Tim Riceaef73712002-05-11 13:17:42 -07001759 if test -d "$withval/lib"; then
1760 if test -n "${need_dash_r}"; then
1761 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1762 else
1763 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1764 fi
1765 else
1766 if test -n "${need_dash_r}"; then
1767 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1768 else
1769 LDFLAGS="-L${withval} ${LDFLAGS}"
1770 fi
1771 fi
1772 if test -d "$withval/include"; then
1773 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1774 else
1775 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1776 fi
Damien Millera22ba012000-03-02 23:09:20 +11001777 fi
1778 ]
1779)
Tim Rice3d5352e2004-02-12 09:27:21 -08001780LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001781AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1782 [Define if your ssl headers are included
1783 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001784 [
Tim Riceaef73712002-05-11 13:17:42 -07001785 dnl Check default openssl install dir
1786 if test -n "${need_dash_r}"; then
1787 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001788 else
Tim Riceaef73712002-05-11 13:17:42 -07001789 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001790 fi
Tim Riceaef73712002-05-11 13:17:42 -07001791 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1792 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1793 [
1794 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1795 ]
1796 )
1797 ]
1798)
1799
Tim Riced730b782002-08-13 18:52:10 -07001800# Determine OpenSSL header version
1801AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001802AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001803 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001804#include <stdio.h>
1805#include <string.h>
1806#include <openssl/opensslv.h>
1807#define DATA "conftest.sslincver"
1808int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001809 FILE *fd;
1810 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001811
Damien Millera8e06ce2003-11-21 23:48:55 +11001812 fd = fopen(DATA,"w");
1813 if(fd == NULL)
1814 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001815
1816 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1817 exit(1);
1818
1819 exit(0);
1820}
Darren Tucker623d92f2004-09-12 22:36:15 +10001821 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001822 [
1823 ssl_header_ver=`cat conftest.sslincver`
1824 AC_MSG_RESULT($ssl_header_ver)
1825 ],
1826 [
1827 AC_MSG_RESULT(not found)
1828 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001829 ],
1830 [
1831 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001832 ]
1833)
1834
1835# Determine OpenSSL library version
1836AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001837AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001838 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001839#include <stdio.h>
1840#include <string.h>
1841#include <openssl/opensslv.h>
1842#include <openssl/crypto.h>
1843#define DATA "conftest.ssllibver"
1844int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001845 FILE *fd;
1846 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001847
Damien Millera8e06ce2003-11-21 23:48:55 +11001848 fd = fopen(DATA,"w");
1849 if(fd == NULL)
1850 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001851
1852 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1853 exit(1);
1854
1855 exit(0);
1856}
Darren Tucker623d92f2004-09-12 22:36:15 +10001857 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001858 [
1859 ssl_library_ver=`cat conftest.ssllibver`
1860 AC_MSG_RESULT($ssl_library_ver)
1861 ],
1862 [
1863 AC_MSG_RESULT(not found)
1864 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001865 ],
1866 [
1867 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001868 ]
1869)
Damien Millera22ba012000-03-02 23:09:20 +11001870
Damien Miller9975e482007-03-05 11:51:27 +11001871AC_ARG_WITH(openssl-header-check,
1872 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1873 [ if test "x$withval" = "xno" ; then
1874 openssl_check_nonfatal=1
1875 fi
1876 ]
1877)
1878
Damien Millerec932372002-01-22 22:16:03 +11001879# Sanity check OpenSSL headers
1880AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001881AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001882 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001883#include <string.h>
1884#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001885int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001886 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001887 [
1888 AC_MSG_RESULT(yes)
1889 ],
1890 [
1891 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001892 if test "x$openssl_check_nonfatal" = "x"; then
1893 AC_MSG_ERROR([Your OpenSSL headers do not match your
1894library. Check config.log for details.
1895If you are sure your installation is consistent, you can disable the check
1896by running "./configure --without-openssl-header-check".
1897Also see contrib/findssl.sh for help identifying header/library mismatches.
1898])
1899 else
1900 AC_MSG_WARN([Your OpenSSL headers do not match your
1901library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001902Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001903 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001904 ],
1905 [
1906 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001907 ]
1908)
1909
Darren Tucker639bbe82006-08-20 20:17:53 +10001910AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1911AC_LINK_IFELSE(
1912 [AC_LANG_SOURCE([[
1913#include <openssl/evp.h>
1914int main(void) { SSLeay_add_all_algorithms(); }
1915 ]])],
1916 [
1917 AC_MSG_RESULT(yes)
1918 ],
1919 [
1920 AC_MSG_RESULT(no)
1921 saved_LIBS="$LIBS"
1922 LIBS="$LIBS -ldl"
1923 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1924 AC_LINK_IFELSE(
1925 [AC_LANG_SOURCE([[
1926#include <openssl/evp.h>
1927int main(void) { SSLeay_add_all_algorithms(); }
1928 ]])],
1929 [
1930 AC_MSG_RESULT(yes)
1931 ],
1932 [
1933 AC_MSG_RESULT(no)
1934 LIBS="$saved_LIBS"
1935 ]
1936 )
1937 ]
1938)
1939
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001940AC_ARG_WITH(ssl-engine,
1941 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
1942 [ if test "x$withval" != "xno" ; then
1943 AC_MSG_CHECKING(for OpenSSL ENGINE support)
1944 AC_TRY_COMPILE(
1945 [ #include <openssl/engine.h>],
1946 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10001947ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001948 ],
1949 [ AC_MSG_RESULT(yes)
1950 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
1951 [Enable OpenSSL engine support])
1952 ],
1953 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
1954 )
1955 fi ]
1956)
1957
Darren Tucker129d0bb2005-12-19 17:40:40 +11001958# Check for OpenSSL without EVP_aes_{192,256}_cbc
1959AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10001960AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11001961 [AC_LANG_SOURCE([[
1962#include <string.h>
1963#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001964int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11001965 ]])],
1966 [
1967 AC_MSG_RESULT(no)
1968 ],
1969 [
1970 AC_MSG_RESULT(yes)
1971 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1972 [libcrypto is missing AES 192 and 256 bit functions])
1973 ]
1974)
1975
Tim Rice3d5352e2004-02-12 09:27:21 -08001976# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1977# because the system crypt() is more featureful.
1978if test "x$check_for_libcrypt_before" = "x1"; then
1979 AC_CHECK_LIB(crypt, crypt)
1980fi
1981
Damien Millera8e06ce2003-11-21 23:48:55 +11001982# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001983# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001984if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001985 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001986fi
1987
Damien Milleraf87af12006-03-15 13:02:28 +11001988# Search for SHA256 support in libc and/or OpenSSL
1989AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
1990
Tim Rice99203ec2007-03-26 09:35:28 -07001991saved_LIBS="$LIBS"
1992AC_CHECK_LIB(iaf, ia_openinfo, [
1993 LIBS="$LIBS -liaf"
1994 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"])
1995])
1996LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11001997
1998### Configure cryptographic random number support
1999
2000# Check wheter OpenSSL seeds itself
2001AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002002AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002003 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002004#include <string.h>
2005#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002006int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002007 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002008 [
2009 OPENSSL_SEEDS_ITSELF=yes
2010 AC_MSG_RESULT(yes)
2011 ],
2012 [
2013 AC_MSG_RESULT(no)
2014 # Default to use of the rand helper if OpenSSL doesn't
2015 # seed itself
2016 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002017 ],
2018 [
2019 AC_MSG_WARN([cross compiling: assuming yes])
2020 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002021 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002022 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002023 ]
2024)
2025
Darren Tucker3e6bde42006-08-20 20:03:50 +10002026# Check for PAM libs
2027PAM_MSG="no"
2028AC_ARG_WITH(pam,
2029 [ --with-pam Enable PAM support ],
2030 [
2031 if test "x$withval" != "xno" ; then
2032 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2033 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2034 AC_MSG_ERROR([PAM headers not found])
2035 fi
2036
2037 saved_LIBS="$LIBS"
2038 AC_CHECK_LIB(dl, dlopen, , )
2039 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2040 AC_CHECK_FUNCS(pam_getenvlist)
2041 AC_CHECK_FUNCS(pam_putenv)
2042 LIBS="$saved_LIBS"
2043
2044 PAM_MSG="yes"
2045
Darren Tucker20e9f972007-03-25 18:26:01 +10002046 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002047 AC_DEFINE(USE_PAM, 1,
2048 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002049
Darren Tucker3e6bde42006-08-20 20:03:50 +10002050 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002051 case "$LIBS" in
2052 *-ldl*)
2053 # libdl already in LIBS
2054 ;;
2055 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002056 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002057 ;;
2058 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002059 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002060 fi
2061 ]
2062)
2063
2064# Check for older PAM
2065if test "x$PAM_MSG" = "xyes" ; then
2066 # Check PAM strerror arguments (old PAM)
2067 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2068 AC_TRY_COMPILE(
2069 [
2070#include <stdlib.h>
2071#if defined(HAVE_SECURITY_PAM_APPL_H)
2072#include <security/pam_appl.h>
2073#elif defined (HAVE_PAM_PAM_APPL_H)
2074#include <pam/pam_appl.h>
2075#endif
2076 ],
2077 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2078 [AC_MSG_RESULT(no)],
2079 [
2080 AC_DEFINE(HAVE_OLD_PAM, 1,
2081 [Define if you have an old version of PAM
2082 which takes only one argument to pam_strerror])
2083 AC_MSG_RESULT(yes)
2084 PAM_MSG="yes (old library)"
2085 ]
2086 )
2087fi
Damien Miller6c21c512002-01-22 21:57:53 +11002088
2089# Do we want to force the use of the rand helper?
2090AC_ARG_WITH(rand-helper,
2091 [ --with-rand-helper Use subprocess to gather strong randomness ],
2092 [
2093 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002094 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002095 # the previous test showed it to be unseeded.
2096 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2097 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2098 OPENSSL_SEEDS_ITSELF=yes
2099 USE_RAND_HELPER=""
2100 fi
2101 else
2102 USE_RAND_HELPER=yes
2103 fi
2104 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002105)
Damien Miller6c21c512002-01-22 21:57:53 +11002106
2107# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002108if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002109 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002110 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2111 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002112 RAND_MSG="OpenSSL internal ONLY"
2113 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002114elif test ! -z "$USE_RAND_HELPER" ; then
2115 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002116 RAND_MSG="ssh-rand-helper"
2117 INSTALL_SSH_RAND_HELPER="yes"
2118fi
2119AC_SUBST(INSTALL_SSH_RAND_HELPER)
2120
2121### Configuration of ssh-rand-helper
2122
2123# PRNGD TCP socket
2124AC_ARG_WITH(prngd-port,
2125 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2126 [
Damien Millere996d722002-01-23 11:20:59 +11002127 case "$withval" in
2128 no)
2129 withval=""
2130 ;;
2131 [[0-9]]*)
2132 ;;
2133 *)
2134 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2135 ;;
2136 esac
2137 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002138 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002139 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2140 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002141 fi
2142 ]
2143)
2144
2145# PRNGD Unix domain socket
2146AC_ARG_WITH(prngd-socket,
2147 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2148 [
Damien Millere996d722002-01-23 11:20:59 +11002149 case "$withval" in
2150 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002151 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002152 ;;
2153 no)
2154 withval=""
2155 ;;
2156 /*)
2157 ;;
2158 *)
2159 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2160 ;;
2161 esac
2162
2163 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002164 if test ! -z "$PRNGD_PORT" ; then
2165 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2166 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002167 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002168 AC_MSG_WARN(Entropy socket is not readable)
2169 fi
2170 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002171 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2172 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002173 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002174 ],
2175 [
2176 # Check for existing socket only if we don't have a random device already
2177 if test "$USE_RAND_HELPER" = yes ; then
2178 AC_MSG_CHECKING(for PRNGD/EGD socket)
2179 # Insert other locations here
2180 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2181 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2182 PRNGD_SOCKET="$sock"
2183 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2184 break;
2185 fi
2186 done
2187 if test ! -z "$PRNGD_SOCKET" ; then
2188 AC_MSG_RESULT($PRNGD_SOCKET)
2189 else
2190 AC_MSG_RESULT(not found)
2191 fi
2192 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002193 ]
2194)
2195
2196# Change default command timeout for hashing entropy source
2197entropy_timeout=200
2198AC_ARG_WITH(entropy-timeout,
2199 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2200 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002201 if test -n "$withval" && test "x$withval" != "xno" && \
2202 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002203 entropy_timeout=$withval
2204 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002205 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002206)
Tim Rice7df8d392005-09-19 09:33:39 -07002207AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2208 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002209
Damien Millerd3f6ad22002-06-25 10:24:47 +10002210SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002211AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002212 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002213 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002214 if test -n "$withval" && test "x$withval" != "xno" && \
2215 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002216 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002217 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002218 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002219)
Tim Rice7df8d392005-09-19 09:33:39 -07002220AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2221 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002222AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002223
Tim Rice88f2ab52002-03-17 12:17:34 -08002224# We do this little dance with the search path to insure
2225# that programs that we select for use by installed programs
2226# (which may be run by the super-user) come from trusted
2227# locations before they come from the user's private area.
2228# This should help avoid accidentally configuring some
2229# random version of a program in someone's personal bin.
2230
2231OPATH=$PATH
2232PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002233test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002234test -d /sbin && PATH=$PATH:/sbin
2235test -d /usr/sbin && PATH=$PATH:/usr/sbin
2236PATH=$PATH:/etc:$OPATH
2237
Damien Millera8e06ce2003-11-21 23:48:55 +11002238# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002239OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2240OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2241OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2242OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2243OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2244OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2245OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2246OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2247OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2248OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2249OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2250OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2251OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2252OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2253OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2254OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002255# restore PATH
2256PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002257
2258# Where does ssh-rand-helper get its randomness from?
2259INSTALL_SSH_PRNG_CMDS=""
2260if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2261 if test ! -z "$PRNGD_PORT" ; then
2262 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2263 elif test ! -z "$PRNGD_SOCKET" ; then
2264 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2265 else
2266 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2267 RAND_HELPER_CMDHASH=yes
2268 INSTALL_SSH_PRNG_CMDS="yes"
2269 fi
2270fi
2271AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2272
2273
Ben Lindstromb5628642000-10-18 00:02:25 +00002274# Cheap hack to ensure NEWS-OS libraries are arranged right.
2275if test ! -z "$SONY" ; then
2276 LIBS="$LIBS -liberty";
2277fi
2278
Damien Miller57f39152005-11-24 19:58:19 +11002279# Check for long long datatypes
2280AC_CHECK_TYPES([long long, unsigned long long, long double])
2281
2282# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002283AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002284AC_CHECK_SIZEOF(short int, 2)
2285AC_CHECK_SIZEOF(int, 4)
2286AC_CHECK_SIZEOF(long int, 4)
2287AC_CHECK_SIZEOF(long long int, 8)
2288
Damien Millerfa2bb692002-04-23 23:22:25 +10002289# Sanity check long long for some platforms (AIX)
2290if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2291 ac_cv_sizeof_long_long_int=0
2292fi
2293
Darren Tucker537f1ed2005-10-25 18:38:33 +10002294# compute LLONG_MIN and LLONG_MAX if we don't know them.
2295if test -z "$have_llong_max"; then
2296 AC_MSG_CHECKING([for max value of long long])
2297 AC_RUN_IFELSE(
2298 [AC_LANG_SOURCE([[
2299#include <stdio.h>
2300/* Why is this so damn hard? */
2301#ifdef __GNUC__
2302# undef __GNUC__
2303#endif
2304#define __USE_ISOC99
2305#include <limits.h>
2306#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002307#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2308
2309/*
2310 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2311 * we do this the hard way.
2312 */
2313static int
2314fprint_ll(FILE *f, long long n)
2315{
2316 unsigned int i;
2317 int l[sizeof(long long) * 8];
2318
2319 if (n < 0)
2320 if (fprintf(f, "-") < 0)
2321 return -1;
2322 for (i = 0; n != 0; i++) {
2323 l[i] = my_abs(n % 10);
2324 n /= 10;
2325 }
2326 do {
2327 if (fprintf(f, "%d", l[--i]) < 0)
2328 return -1;
2329 } while (i != 0);
2330 if (fprintf(f, " ") < 0)
2331 return -1;
2332 return 0;
2333}
2334
Darren Tucker537f1ed2005-10-25 18:38:33 +10002335int main(void) {
2336 FILE *f;
2337 long long i, llmin, llmax = 0;
2338
2339 if((f = fopen(DATA,"w")) == NULL)
2340 exit(1);
2341
2342#if defined(LLONG_MIN) && defined(LLONG_MAX)
2343 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2344 llmin = LLONG_MIN;
2345 llmax = LLONG_MAX;
2346#else
2347 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2348 /* This will work on one's complement and two's complement */
2349 for (i = 1; i > llmax; i <<= 1, i++)
2350 llmax = i;
2351 llmin = llmax + 1LL; /* wrap */
2352#endif
2353
2354 /* Sanity check */
2355 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002356 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2357 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002358 fprintf(f, "unknown unknown\n");
2359 exit(2);
2360 }
2361
Darren Tuckerd1450db2006-03-13 19:06:51 +11002362 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002363 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002364 if (fprint_ll(f, llmax) < 0)
2365 exit(4);
2366 if (fclose(f) < 0)
2367 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002368 exit(0);
2369}
2370 ]])],
2371 [
2372 llong_min=`$AWK '{print $1}' conftest.llminmax`
2373 llong_max=`$AWK '{print $2}' conftest.llminmax`
2374
Darren Tucker537f1ed2005-10-25 18:38:33 +10002375 AC_MSG_RESULT($llong_max)
2376 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2377 [max value of long long calculated by configure])
2378 AC_MSG_CHECKING([for min value of long long])
2379 AC_MSG_RESULT($llong_min)
2380 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2381 [min value of long long calculated by configure])
2382 ],
2383 [
2384 AC_MSG_RESULT(not found)
2385 ],
2386 [
2387 AC_MSG_WARN([cross compiling: not checking])
2388 ]
2389 )
2390fi
2391
2392
Damien Millera22ba012000-03-02 23:09:20 +11002393# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002394AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2395 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002396 [ #include <sys/types.h> ],
2397 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002398 [ ac_cv_have_u_int="yes" ],
2399 [ ac_cv_have_u_int="no" ]
2400 )
2401])
2402if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002403 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002404 have_u_int=1
2405fi
2406
Damien Miller61e50f12000-05-08 20:49:37 +10002407AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2408 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002409 [ #include <sys/types.h> ],
2410 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002411 [ ac_cv_have_intxx_t="yes" ],
2412 [ ac_cv_have_intxx_t="no" ]
2413 )
2414])
2415if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002416 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002417 have_intxx_t=1
2418fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002419
2420if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002421 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002422then
2423 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2424 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002425 [ #include <stdint.h> ],
2426 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002427 [
2428 AC_DEFINE(HAVE_INTXX_T)
2429 AC_MSG_RESULT(yes)
2430 ],
2431 [ AC_MSG_RESULT(no) ]
2432 )
2433fi
2434
Damien Miller578783e2000-09-23 14:12:24 +11002435AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2436 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002437 [
2438#include <sys/types.h>
2439#ifdef HAVE_STDINT_H
2440# include <stdint.h>
2441#endif
2442#include <sys/socket.h>
2443#ifdef HAVE_SYS_BITYPES_H
2444# include <sys/bitypes.h>
2445#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002446 ],
2447 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002448 [ ac_cv_have_int64_t="yes" ],
2449 [ ac_cv_have_int64_t="no" ]
2450 )
2451])
2452if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002453 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002454fi
2455
Damien Miller61e50f12000-05-08 20:49:37 +10002456AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2457 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002458 [ #include <sys/types.h> ],
2459 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002460 [ ac_cv_have_u_intxx_t="yes" ],
2461 [ ac_cv_have_u_intxx_t="no" ]
2462 )
2463])
2464if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002465 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002466 have_u_intxx_t=1
2467fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002468
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002469if test -z "$have_u_intxx_t" ; then
2470 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2471 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002472 [ #include <sys/socket.h> ],
2473 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002474 [
2475 AC_DEFINE(HAVE_U_INTXX_T)
2476 AC_MSG_RESULT(yes)
2477 ],
2478 [ AC_MSG_RESULT(no) ]
2479 )
2480fi
2481
Damien Miller578783e2000-09-23 14:12:24 +11002482AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2483 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002484 [ #include <sys/types.h> ],
2485 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002486 [ ac_cv_have_u_int64_t="yes" ],
2487 [ ac_cv_have_u_int64_t="no" ]
2488 )
2489])
2490if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002491 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002492 have_u_int64_t=1
2493fi
2494
Tim Rice4cec93f2002-02-26 08:40:48 -08002495if test -z "$have_u_int64_t" ; then
2496 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2497 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002498 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002499 [ u_int64_t a; a = 1],
2500 [
2501 AC_DEFINE(HAVE_U_INT64_T)
2502 AC_MSG_RESULT(yes)
2503 ],
2504 [ AC_MSG_RESULT(no) ]
2505 )
2506fi
2507
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002508if test -z "$have_u_intxx_t" ; then
2509 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2510 AC_TRY_COMPILE(
2511 [
2512#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002513 ],
2514 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002515 [ ac_cv_have_uintxx_t="yes" ],
2516 [ ac_cv_have_uintxx_t="no" ]
2517 )
2518 ])
2519 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002520 AC_DEFINE(HAVE_UINTXX_T, 1,
2521 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002522 fi
2523fi
2524
2525if test -z "$have_uintxx_t" ; then
2526 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2527 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002528 [ #include <stdint.h> ],
2529 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002530 [
2531 AC_DEFINE(HAVE_UINTXX_T)
2532 AC_MSG_RESULT(yes)
2533 ],
2534 [ AC_MSG_RESULT(no) ]
2535 )
2536fi
2537
Damien Milleredb82922000-06-20 13:25:52 +10002538if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002539 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002540then
2541 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2542 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002543 [
2544#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002545 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002546 [
Damien Miller70494d12000-04-03 15:57:06 +10002547 int8_t a; int16_t b; int32_t c;
2548 u_int8_t e; u_int16_t f; u_int32_t g;
2549 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002550 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002551 [
2552 AC_DEFINE(HAVE_U_INTXX_T)
2553 AC_DEFINE(HAVE_INTXX_T)
2554 AC_MSG_RESULT(yes)
2555 ],
2556 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002557 )
Damien Millerb29ea912000-01-15 14:12:03 +11002558fi
2559
Damien Miller58be7382001-09-15 21:31:54 +10002560
2561AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2562 AC_TRY_COMPILE(
2563 [
2564#include <sys/types.h>
2565 ],
2566 [ u_char foo; foo = 125; ],
2567 [ ac_cv_have_u_char="yes" ],
2568 [ ac_cv_have_u_char="no" ]
2569 )
2570])
2571if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002572 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002573fi
2574
Tim Rice13aae5e2001-10-21 17:53:58 -07002575TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002576
Tim Rice200a5c02002-02-26 22:12:34 -08002577AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002578
Damien Miller848b9932005-02-24 12:12:34 +11002579AC_CHECK_TYPES(in_addr_t,,,
2580[#include <sys/types.h>
2581#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002582
Damien Miller61e50f12000-05-08 20:49:37 +10002583AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2584 AC_TRY_COMPILE(
2585 [
2586#include <sys/types.h>
2587 ],
2588 [ size_t foo; foo = 1235; ],
2589 [ ac_cv_have_size_t="yes" ],
2590 [ ac_cv_have_size_t="no" ]
2591 )
2592])
2593if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002594 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002595fi
Damien Miller95058511999-12-29 10:36:45 +11002596
Damien Miller615f9392000-05-17 22:53:33 +10002597AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2598 AC_TRY_COMPILE(
2599 [
2600#include <sys/types.h>
2601 ],
2602 [ ssize_t foo; foo = 1235; ],
2603 [ ac_cv_have_ssize_t="yes" ],
2604 [ ac_cv_have_ssize_t="no" ]
2605 )
2606])
2607if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002608 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002609fi
2610
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002611AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2612 AC_TRY_COMPILE(
2613 [
2614#include <time.h>
2615 ],
2616 [ clock_t foo; foo = 1235; ],
2617 [ ac_cv_have_clock_t="yes" ],
2618 [ ac_cv_have_clock_t="no" ]
2619 )
2620])
2621if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002622 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002623fi
2624
Damien Millerb54b40e2000-06-23 08:23:34 +10002625AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2626 AC_TRY_COMPILE(
2627 [
2628#include <sys/types.h>
2629#include <sys/socket.h>
2630 ],
2631 [ sa_family_t foo; foo = 1235; ],
2632 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002633 [ AC_TRY_COMPILE(
2634 [
2635#include <sys/types.h>
2636#include <sys/socket.h>
2637#include <netinet/in.h>
2638 ],
2639 [ sa_family_t foo; foo = 1235; ],
2640 [ ac_cv_have_sa_family_t="yes" ],
2641
Damien Millerb54b40e2000-06-23 08:23:34 +10002642 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002643 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002644 )
2645])
2646if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002647 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2648 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002649fi
2650
Damien Miller0f91b4e2000-06-18 15:43:25 +10002651AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2652 AC_TRY_COMPILE(
2653 [
2654#include <sys/types.h>
2655 ],
2656 [ pid_t foo; foo = 1235; ],
2657 [ ac_cv_have_pid_t="yes" ],
2658 [ ac_cv_have_pid_t="no" ]
2659 )
2660])
2661if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002662 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002663fi
2664
2665AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2666 AC_TRY_COMPILE(
2667 [
2668#include <sys/types.h>
2669 ],
2670 [ mode_t foo; foo = 1235; ],
2671 [ ac_cv_have_mode_t="yes" ],
2672 [ ac_cv_have_mode_t="no" ]
2673 )
2674])
2675if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002676 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002677fi
2678
Damien Miller61e50f12000-05-08 20:49:37 +10002679
2680AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2681 AC_TRY_COMPILE(
2682 [
Damien Miller81171112000-04-23 11:14:01 +10002683#include <sys/types.h>
2684#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002685 ],
2686 [ struct sockaddr_storage s; ],
2687 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2688 [ ac_cv_have_struct_sockaddr_storage="no" ]
2689 )
2690])
2691if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002692 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2693 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002694fi
Damien Miller34132e52000-01-14 15:45:46 +11002695
Damien Miller61e50f12000-05-08 20:49:37 +10002696AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2697 AC_TRY_COMPILE(
2698 [
Damien Miller7b22d652000-06-18 14:07:04 +10002699#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002700#include <netinet/in.h>
2701 ],
2702 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2703 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2704 [ ac_cv_have_struct_sockaddr_in6="no" ]
2705 )
2706])
2707if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002708 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2709 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002710fi
Damien Miller34132e52000-01-14 15:45:46 +11002711
Damien Miller61e50f12000-05-08 20:49:37 +10002712AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2713 AC_TRY_COMPILE(
2714 [
Damien Miller7b22d652000-06-18 14:07:04 +10002715#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002716#include <netinet/in.h>
2717 ],
2718 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2719 [ ac_cv_have_struct_in6_addr="yes" ],
2720 [ ac_cv_have_struct_in6_addr="no" ]
2721 )
2722])
2723if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002724 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2725 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002726fi
Damien Miller34132e52000-01-14 15:45:46 +11002727
Damien Miller61e50f12000-05-08 20:49:37 +10002728AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2729 AC_TRY_COMPILE(
2730 [
Damien Miller81171112000-04-23 11:14:01 +10002731#include <sys/types.h>
2732#include <sys/socket.h>
2733#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002734 ],
2735 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2736 [ ac_cv_have_struct_addrinfo="yes" ],
2737 [ ac_cv_have_struct_addrinfo="no" ]
2738 )
2739])
2740if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002741 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2742 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002743fi
2744
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002745AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2746 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002747 [ #include <sys/time.h> ],
2748 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002749 [ ac_cv_have_struct_timeval="yes" ],
2750 [ ac_cv_have_struct_timeval="no" ]
2751 )
2752])
2753if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002754 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002755 have_struct_timeval=1
2756fi
2757
Tim Rice4e4dc562003-03-18 10:21:40 -08002758AC_CHECK_TYPES(struct timespec)
2759
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002760# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002761if test "x$ac_cv_have_int64_t" = "xno" && \
2762 test "x$ac_cv_sizeof_long_int" != "x8" && \
2763 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002764 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2765 echo "an alternative compiler (I.E., GCC) before continuing."
2766 echo ""
2767 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002768else
2769dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002770 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002771 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002772#include <stdio.h>
2773#include <string.h>
2774#ifdef HAVE_SNPRINTF
2775main()
2776{
2777 char buf[50];
2778 char expected_out[50];
2779 int mazsize = 50 ;
2780#if (SIZEOF_LONG_INT == 8)
2781 long int num = 0x7fffffffffffffff;
2782#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002783 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002784#endif
2785 strcpy(expected_out, "9223372036854775807");
2786 snprintf(buf, mazsize, "%lld", num);
2787 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002788 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002789 exit(0);
2790}
2791#else
2792main() { exit(0); }
2793#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002794 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002795 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002796 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002797fi
2798
Damien Miller78315eb2000-09-29 23:01:36 +11002799dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002800OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2801OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2802OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2803OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2804OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002805OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002806OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2807OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002808OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002809OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2810OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2811OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2812OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002813OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2814OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2815OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2816OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002817
2818AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002819AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2820 [Define if we don't have struct __res_state in resolv.h])],
2821[
2822#include <stdio.h>
2823#if HAVE_SYS_TYPES_H
2824# include <sys/types.h>
2825#endif
2826#include <netinet/in.h>
2827#include <arpa/nameser.h>
2828#include <resolv.h>
2829])
andre2ff7b5d2000-06-03 14:57:40 +00002830
Damien Miller61e50f12000-05-08 20:49:37 +10002831AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2832 ac_cv_have_ss_family_in_struct_ss, [
2833 AC_TRY_COMPILE(
2834 [
Damien Miller81171112000-04-23 11:14:01 +10002835#include <sys/types.h>
2836#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002837 ],
2838 [ struct sockaddr_storage s; s.ss_family = 1; ],
2839 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2840 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2841 )
2842])
2843if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002844 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002845fi
2846
Damien Miller61e50f12000-05-08 20:49:37 +10002847AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2848 ac_cv_have___ss_family_in_struct_ss, [
2849 AC_TRY_COMPILE(
2850 [
Damien Miller81171112000-04-23 11:14:01 +10002851#include <sys/types.h>
2852#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002853 ],
2854 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2855 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2856 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2857 )
2858])
2859if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002860 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2861 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002862fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002863
Damien Millerad833b32000-08-23 10:46:23 +10002864AC_CACHE_CHECK([for pw_class field in struct passwd],
2865 ac_cv_have_pw_class_in_struct_passwd, [
2866 AC_TRY_COMPILE(
2867 [
Damien Millerad833b32000-08-23 10:46:23 +10002868#include <pwd.h>
2869 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002870 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002871 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2872 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2873 )
2874])
2875if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002876 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2877 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002878fi
2879
Kevin Steves82456952001-06-22 21:14:18 +00002880AC_CACHE_CHECK([for pw_expire field in struct passwd],
2881 ac_cv_have_pw_expire_in_struct_passwd, [
2882 AC_TRY_COMPILE(
2883 [
2884#include <pwd.h>
2885 ],
2886 [ struct passwd p; p.pw_expire = 0; ],
2887 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2888 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2889 )
2890])
2891if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002892 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2893 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002894fi
2895
2896AC_CACHE_CHECK([for pw_change field in struct passwd],
2897 ac_cv_have_pw_change_in_struct_passwd, [
2898 AC_TRY_COMPILE(
2899 [
2900#include <pwd.h>
2901 ],
2902 [ struct passwd p; p.pw_change = 0; ],
2903 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2904 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2905 )
2906])
2907if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002908 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2909 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002910fi
Damien Miller61e50f12000-05-08 20:49:37 +10002911
Tim Rice28bbb0c2002-05-27 17:37:32 -07002912dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002913AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2914 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002915 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002916 [
Tim Riceae49fe62002-04-12 10:26:21 -07002917#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002918#include <sys/socket.h>
2919#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002920int main() {
2921#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002922#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002923exit(1);
2924#endif
2925struct msghdr m;
2926m.msg_accrights = 0;
2927exit(0);
2928}
Kevin Steves939c9db2002-03-22 17:23:25 +00002929 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002930 [ ac_cv_have_accrights_in_msghdr="yes" ],
2931 [ ac_cv_have_accrights_in_msghdr="no" ]
2932 )
2933])
2934if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002935 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2936 [Define if your system uses access rights style
2937 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002938fi
2939
Kevin Stevesa44e0352002-04-07 16:18:03 +00002940AC_CACHE_CHECK([for msg_control field in struct msghdr],
2941 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002942 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002943 [
Tim Riceae49fe62002-04-12 10:26:21 -07002944#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002945#include <sys/socket.h>
2946#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002947int main() {
2948#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002949#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002950exit(1);
2951#endif
2952struct msghdr m;
2953m.msg_control = 0;
2954exit(0);
2955}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002956 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002957 [ ac_cv_have_control_in_msghdr="yes" ],
2958 [ ac_cv_have_control_in_msghdr="no" ]
2959 )
2960])
2961if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002962 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2963 [Define if your system uses ancillary data style
2964 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002965fi
2966
Damien Miller61e50f12000-05-08 20:49:37 +10002967AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002968 AC_TRY_LINK([],
2969 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002970 [ ac_cv_libc_defines___progname="yes" ],
2971 [ ac_cv_libc_defines___progname="no" ]
2972 )
2973])
2974if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002975 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002976fi
2977
Kevin Steves4846f4a2002-03-22 18:19:53 +00002978AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2979 AC_TRY_LINK([
2980#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002981],
2982 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002983 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2984 [ ac_cv_cc_implements___FUNCTION__="no" ]
2985 )
2986])
2987if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002988 AC_DEFINE(HAVE___FUNCTION__, 1,
2989 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002990fi
2991
2992AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2993 AC_TRY_LINK([
2994#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002995],
2996 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002997 [ ac_cv_cc_implements___func__="yes" ],
2998 [ ac_cv_cc_implements___func__="no" ]
2999 )
3000])
3001if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003002 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003003fi
3004
Damien Miller57f39152005-11-24 19:58:19 +11003005AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3006 AC_TRY_LINK(
3007 [#include <stdarg.h>
3008 va_list x,y;],
3009 [va_copy(x,y);],
3010 [ ac_cv_have_va_copy="yes" ],
3011 [ ac_cv_have_va_copy="no" ]
3012 )
3013])
3014if test "x$ac_cv_have_va_copy" = "xyes" ; then
3015 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3016fi
3017
3018AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3019 AC_TRY_LINK(
3020 [#include <stdarg.h>
3021 va_list x,y;],
3022 [__va_copy(x,y);],
3023 [ ac_cv_have___va_copy="yes" ],
3024 [ ac_cv_have___va_copy="no" ]
3025 )
3026])
3027if test "x$ac_cv_have___va_copy" = "xyes" ; then
3028 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3029fi
3030
Damien Miller4f8e6692001-07-14 13:22:53 +10003031AC_CACHE_CHECK([whether getopt has optreset support],
3032 ac_cv_have_getopt_optreset, [
3033 AC_TRY_LINK(
3034 [
3035#include <getopt.h>
3036 ],
3037 [ extern int optreset; optreset = 0; ],
3038 [ ac_cv_have_getopt_optreset="yes" ],
3039 [ ac_cv_have_getopt_optreset="no" ]
3040 )
3041])
3042if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003043 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3044 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003045fi
Damien Millera22ba012000-03-02 23:09:20 +11003046
Damien Millerecbb26d2000-07-15 14:59:14 +10003047AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003048 AC_TRY_LINK([],
3049 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003050 [ ac_cv_libc_defines_sys_errlist="yes" ],
3051 [ ac_cv_libc_defines_sys_errlist="no" ]
3052 )
3053])
3054if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003055 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3056 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003057fi
3058
3059
Damien Miller11fa2cc2000-08-16 10:35:58 +10003060AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003061 AC_TRY_LINK([],
3062 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003063 [ ac_cv_libc_defines_sys_nerr="yes" ],
3064 [ ac_cv_libc_defines_sys_nerr="no" ]
3065 )
3066])
3067if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003068 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003069fi
3070
Damien Millera8e06ce2003-11-21 23:48:55 +11003071SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003072# Check whether user wants sectok support
3073AC_ARG_WITH(sectok,
3074 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003075 [
3076 if test "x$withval" != "xno" ; then
3077 if test "x$withval" != "xyes" ; then
3078 CPPFLAGS="$CPPFLAGS -I${withval}"
3079 LDFLAGS="$LDFLAGS -L${withval}"
3080 if test ! -z "$need_dash_r" ; then
3081 LDFLAGS="$LDFLAGS -R${withval}"
3082 fi
3083 if test ! -z "$blibpath" ; then
3084 blibpath="$blibpath:${withval}"
3085 fi
3086 fi
3087 AC_CHECK_HEADERS(sectok.h)
3088 if test "$ac_cv_header_sectok_h" != yes; then
3089 AC_MSG_ERROR(Can't find sectok.h)
3090 fi
3091 AC_CHECK_LIB(sectok, sectok_open)
3092 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3093 AC_MSG_ERROR(Can't find libsectok)
3094 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003095 AC_DEFINE(SMARTCARD, 1,
3096 [Define if you want smartcard support])
3097 AC_DEFINE(USE_SECTOK, 1,
3098 [Define if you want smartcard support
3099 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003100 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003101 fi
3102 ]
3103)
3104
3105# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003106OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003107AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003108 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003109 [
3110 if test "x$withval" != "xno" ; then
3111 if test "x$withval" != "xyes" ; then
3112 OPENSC_CONFIG=$withval/bin/opensc-config
3113 else
3114 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3115 fi
3116 if test "$OPENSC_CONFIG" != "no"; then
3117 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3118 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3119 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003120 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003121 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003122 AC_DEFINE(USE_OPENSC, 1,
3123 [Define if you want smartcard support
3124 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003125 SCARD_MSG="yes, using OpenSC"
3126 fi
3127 fi
3128 ]
3129)
Damien Miller85de5802001-09-18 14:01:11 +10003130
Darren Tucker5f88d342003-10-15 16:57:57 +10003131# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003132AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003133 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3134 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003135 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003136 # Needed by our getrrsetbyname()
3137 AC_SEARCH_LIBS(res_query, resolv)
3138 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003139 AC_MSG_CHECKING(if res_query will link)
3140 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3141 [AC_MSG_RESULT(no)
3142 saved_LIBS="$LIBS"
3143 LIBS="$LIBS -lresolv"
3144 AC_MSG_CHECKING(for res_query in -lresolv)
3145 AC_LINK_IFELSE([
3146#include <resolv.h>
3147int main()
3148{
3149 res_query (0, 0, 0, 0, 0);
3150 return 0;
3151}
3152 ],
3153 [LIBS="$LIBS -lresolv"
3154 AC_MSG_RESULT(yes)],
3155 [LIBS="$saved_LIBS"
3156 AC_MSG_RESULT(no)])
3157 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003158 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003159 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003160 [#include <sys/types.h>
3161 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003162 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003163 [AC_DEFINE(HAVE_HEADER_AD, 1,
3164 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003165 [#include <arpa/nameser.h>])
3166 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003167
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003168AC_MSG_CHECKING(if struct __res_state _res is an extern)
3169AC_LINK_IFELSE([
3170#include <stdio.h>
3171#if HAVE_SYS_TYPES_H
3172# include <sys/types.h>
3173#endif
3174#include <netinet/in.h>
3175#include <arpa/nameser.h>
3176#include <resolv.h>
3177extern struct __res_state _res;
3178int main() { return 0; }
3179 ],
3180 [AC_MSG_RESULT(yes)
3181 AC_DEFINE(HAVE__RES_EXTERN, 1,
3182 [Define if you have struct __res_state _res as an extern])
3183 ],
3184 [ AC_MSG_RESULT(no) ]
3185)
3186
Damien Miller73b42d22006-04-22 21:26:08 +10003187# Check whether user wants SELinux support
3188SELINUX_MSG="no"
3189LIBSELINUX=""
3190AC_ARG_WITH(selinux,
3191 [ --with-selinux Enable SELinux support],
3192 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003193 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003194 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3195 SELINUX_MSG="yes"
3196 AC_CHECK_HEADER([selinux/selinux.h], ,
3197 AC_MSG_ERROR(SELinux support requires selinux.h header))
3198 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3199 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003200 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003201 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003202 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003203 fi ]
3204)
Damien Miller73b42d22006-04-22 21:26:08 +10003205
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003206# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003207KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003208AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003209 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003210 [ if test "x$withval" != "xno" ; then
3211 if test "x$withval" = "xyes" ; then
3212 KRB5ROOT="/usr/local"
3213 else
3214 KRB5ROOT=${withval}
3215 fi
3216
Tim Rice7df8d392005-09-19 09:33:39 -07003217 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003218 KRB5_MSG="yes"
3219
3220 AC_MSG_CHECKING(for krb5-config)
3221 if test -x $KRB5ROOT/bin/krb5-config ; then
3222 KRB5CONF=$KRB5ROOT/bin/krb5-config
3223 AC_MSG_RESULT($KRB5CONF)
3224
3225 AC_MSG_CHECKING(for gssapi support)
3226 if $KRB5CONF | grep gssapi >/dev/null ; then
3227 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003228 AC_DEFINE(GSSAPI, 1,
3229 [Define this if you want GSSAPI
3230 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003231 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003232 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003233 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003234 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003235 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003236 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3237 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003238 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003239 AC_MSG_CHECKING(whether we are using Heimdal)
3240 AC_TRY_COMPILE([ #include <krb5.h> ],
3241 [ char *tmp = heimdal_version; ],
3242 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003243 AC_DEFINE(HEIMDAL, 1,
3244 [Define this if you are using the
3245 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003246 AC_MSG_RESULT(no)
3247 )
3248 else
3249 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003250 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003251 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003252 AC_MSG_CHECKING(whether we are using Heimdal)
3253 AC_TRY_COMPILE([ #include <krb5.h> ],
3254 [ char *tmp = heimdal_version; ],
3255 [ AC_MSG_RESULT(yes)
3256 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003257 K5LIBS="-lkrb5 -ldes"
3258 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003259 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003260 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003261 ],
3262 [ AC_MSG_RESULT(no)
3263 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3264 ]
3265 )
Damien Miller200d0a72003-06-30 19:21:36 +10003266 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003267
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003268 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3269 [ AC_DEFINE(GSSAPI)
3270 K5LIBS="-lgssapi $K5LIBS" ],
3271 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3272 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003273 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003274 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3275 $K5LIBS)
3276 ],
3277 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003278
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003279 AC_CHECK_HEADER(gssapi.h, ,
3280 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003281 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003282 AC_CHECK_HEADERS(gssapi.h, ,
3283 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003284 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003285 ]
3286 )
3287
3288 oldCPP="$CPPFLAGS"
3289 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3290 AC_CHECK_HEADER(gssapi_krb5.h, ,
3291 [ CPPFLAGS="$oldCPP" ])
3292
Damien Millera8e06ce2003-11-21 23:48:55 +11003293 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003294 if test ! -z "$need_dash_r" ; then
3295 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3296 fi
3297 if test ! -z "$blibpath" ; then
3298 blibpath="$blibpath:${KRB5ROOT}/lib"
3299 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003300
3301 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3302 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3303 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3304
3305 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003306 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3307 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003308 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003309 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003310)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003311
Damien Millera22ba012000-03-02 23:09:20 +11003312# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003313
Damien Millerf58c6722002-05-13 13:15:42 +10003314PRIVSEP_PATH=/var/empty
3315AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003316 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003317 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003318 if test -n "$withval" && test "x$withval" != "xno" && \
3319 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003320 PRIVSEP_PATH=$withval
3321 fi
3322 ]
3323)
3324AC_SUBST(PRIVSEP_PATH)
3325
Damien Millera22ba012000-03-02 23:09:20 +11003326AC_ARG_WITH(xauth,
3327 [ --with-xauth=PATH Specify path to xauth program ],
3328 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003329 if test -n "$withval" && test "x$withval" != "xno" && \
3330 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003331 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003332 fi
3333 ],
3334 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003335 TestPath="$PATH"
3336 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3337 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3338 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3339 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3340 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003341 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003342 xauth_path="/usr/openwin/bin/xauth"
3343 fi
3344 ]
3345)
3346
Damien Miller7d901272003-01-13 16:55:22 +11003347STRIP_OPT=-s
3348AC_ARG_ENABLE(strip,
3349 [ --disable-strip Disable calling strip(1) on install],
3350 [
3351 if test "x$enableval" = "xno" ; then
3352 STRIP_OPT=
3353 fi
3354 ]
3355)
3356AC_SUBST(STRIP_OPT)
3357
Damien Millera19cf472000-11-29 13:28:50 +11003358if test -z "$xauth_path" ; then
3359 XAUTH_PATH="undefined"
3360 AC_SUBST(XAUTH_PATH)
3361else
Tim Rice7df8d392005-09-19 09:33:39 -07003362 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3363 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003364 XAUTH_PATH=$xauth_path
3365 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003366fi
Damien Millera22ba012000-03-02 23:09:20 +11003367
3368# Check for mail directory (last resort if we cannot get it from headers)
3369if test ! -z "$MAIL" ; then
3370 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003371 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3372 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003373fi
3374
Darren Tucker623d92f2004-09-12 22:36:15 +10003375if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003376 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3377 disable_ptmx_check=yes
3378fi
Damien Millera22ba012000-03-02 23:09:20 +11003379if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003380 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003381 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003382 [
Tim Rice7df8d392005-09-19 09:33:39 -07003383 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3384 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003385 have_dev_ptmx=1
3386 ]
3387 )
3388 fi
Damien Millera22ba012000-03-02 23:09:20 +11003389fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003390
Darren Tucker623d92f2004-09-12 22:36:15 +10003391if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003392 AC_CHECK_FILE("/dev/ptc",
3393 [
Tim Rice7df8d392005-09-19 09:33:39 -07003394 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3395 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003396 have_dev_ptc=1
3397 ]
3398 )
3399else
3400 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3401fi
Damien Miller204ad072000-03-02 23:56:12 +11003402
Damien Millera22ba012000-03-02 23:09:20 +11003403# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003404AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003405 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003406 [
Damien Miller897741e2001-04-16 10:41:46 +10003407 case "$withval" in
3408 man|cat|doc)
3409 MANTYPE=$withval
3410 ;;
3411 *)
3412 AC_MSG_ERROR(invalid man type: $withval)
3413 ;;
3414 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003415 ]
3416)
Ben Lindstrombc709922001-04-18 18:04:21 +00003417if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003418 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3419 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003420 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3421 MANTYPE=doc
3422 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3423 MANTYPE=man
3424 else
3425 MANTYPE=cat
3426 fi
3427fi
Damien Miller670a4b82000-01-22 13:53:11 +11003428AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003429if test "$MANTYPE" = "doc"; then
3430 mansubdir=man;
3431else
3432 mansubdir=$MANTYPE;
3433fi
3434AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003435
Damien Millera22ba012000-03-02 23:09:20 +11003436# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003437MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003438AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003439 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003440 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003441 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003442 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3443 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003444 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003445 fi
3446 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003447)
3448
Damien Millera22ba012000-03-02 23:09:20 +11003449# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003450AC_ARG_WITH(shadow,
3451 [ --without-shadow Disable shadow password support],
3452 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003453 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003454 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003455 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003456 fi
3457 ]
3458)
3459
Damien Miller1f335fb2000-06-26 11:31:33 +10003460if test -z "$disable_shadow" ; then
3461 AC_MSG_CHECKING([if the systems has expire shadow information])
3462 AC_TRY_COMPILE(
3463 [
3464#include <sys/types.h>
3465#include <shadow.h>
3466 struct spwd sp;
3467 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3468 [ sp_expire_available=yes ], []
3469 )
3470
3471 if test "x$sp_expire_available" = "xyes" ; then
3472 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003473 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3474 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003475 else
3476 AC_MSG_RESULT(no)
3477 fi
3478fi
3479
Damien Millera22ba012000-03-02 23:09:20 +11003480# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003481if test ! -z "$IPADDR_IN_DISPLAY" ; then
3482 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003483 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3484 [Define if you need to use IP address
3485 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003486else
Damien Millera8e06ce2003-11-21 23:48:55 +11003487 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003488 AC_ARG_WITH(ipaddr-display,
3489 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3490 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003491 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003492 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003493 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003494 fi
3495 ]
3496 )
3497fi
Damien Miller76112de1999-12-21 11:18:08 +11003498
Darren Tuckere1a790d2003-09-16 11:52:19 +10003499# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003500AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003501 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003502 [ if test "x$enableval" = "xno"; then
3503 AC_MSG_NOTICE([/etc/default/login handling disabled])
3504 etc_default_login=no
3505 else
3506 etc_default_login=yes
3507 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003508 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3509 then
3510 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3511 etc_default_login=no
3512 else
3513 etc_default_login=yes
3514 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003515)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003516
Darren Tucker2f9573d2005-02-10 22:28:54 +11003517if test "x$etc_default_login" != "xno"; then
3518 AC_CHECK_FILE("/etc/default/login",
3519 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003520 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003521 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3522 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003523 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003524fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003525
Tim Rice43a1c132002-04-17 21:19:14 -07003526dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003527if test $ac_cv_func_login_getcapbool = "yes" && \
3528 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003529 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003530fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003531
Damien Millera22ba012000-03-02 23:09:20 +11003532# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003533SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003534AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003535 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003536 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003537 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003538 AC_MSG_WARN([
3539--with-default-path=PATH has no effect on this system.
3540Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003541 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003542 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003543 AC_MSG_WARN([
3544--with-default-path=PATH will only be used if PATH is not defined in
3545$external_path_file .])
3546 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003547 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003548 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003549 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003550 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003551 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3552 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003553 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003554 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003555 AC_MSG_WARN([
3556If PATH is defined in $external_path_file, ensure the path to scp is included,
3557otherwise scp will not work.])
3558 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003559 AC_RUN_IFELSE(
3560 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003561/* find out what STDPATH is */
3562#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003563#ifdef HAVE_PATHS_H
3564# include <paths.h>
3565#endif
3566#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003567# ifdef _PATH_USERPATH /* Irix */
3568# define _PATH_STDPATH _PATH_USERPATH
3569# else
3570# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3571# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003572#endif
3573#include <sys/types.h>
3574#include <sys/stat.h>
3575#include <fcntl.h>
3576#define DATA "conftest.stdpath"
3577
3578main()
3579{
3580 FILE *fd;
3581 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003582
Tim Rice59ea0a02001-03-10 13:50:45 -08003583 fd = fopen(DATA,"w");
3584 if(fd == NULL)
3585 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003586
Tim Rice59ea0a02001-03-10 13:50:45 -08003587 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3588 exit(1);
3589
3590 exit(0);
3591}
Darren Tucker314d89e2005-10-17 23:29:23 +10003592 ]])],
3593 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003594 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3595 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3596 )
3597# make sure $bindir is in USER_PATH so scp will work
3598 t_bindir=`eval echo ${bindir}`
3599 case $t_bindir in
3600 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3601 esac
3602 case $t_bindir in
3603 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3604 esac
3605 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3606 if test $? -ne 0 ; then
3607 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3608 if test $? -ne 0 ; then
3609 user_path=$user_path:$t_bindir
3610 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3611 fi
3612 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003613 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003614)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003615if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003616 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003617 AC_SUBST(user_path)
3618fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003619
Damien Millera18bbd32002-05-13 10:48:57 +10003620# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003621AC_ARG_WITH(superuser-path,
3622 [ --with-superuser-path= Specify different path for super-user],
3623 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003624 if test -n "$withval" && test "x$withval" != "xno" && \
3625 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003626 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3627 [Define if you want a different $PATH
3628 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003629 superuser_path=$withval
3630 fi
3631 ]
3632)
3633
3634
Damien Miller61e50f12000-05-08 20:49:37 +10003635AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003636IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003637AC_ARG_WITH(4in6,
3638 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3639 [
3640 if test "x$withval" != "xno" ; then
3641 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003642 AC_DEFINE(IPV4_IN_IPV6, 1,
3643 [Detect IPv4 in IPv6 mapped addresses
3644 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003645 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003646 else
3647 AC_MSG_RESULT(no)
3648 fi
3649 ],[
3650 if test "x$inet6_default_4in6" = "xyes"; then
3651 AC_MSG_RESULT([yes (default)])
3652 AC_DEFINE(IPV4_IN_IPV6)
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 (default)])
3656 fi
3657 ]
3658)
3659
Damien Miller60396b02001-02-18 17:01:00 +11003660# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003661BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003662AC_ARG_WITH(bsd-auth,
3663 [ --with-bsd-auth Enable BSD auth support],
3664 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003665 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003666 AC_DEFINE(BSD_AUTH, 1,
3667 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003668 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003669 fi
3670 ]
3671)
3672
Damien Millera22ba012000-03-02 23:09:20 +11003673# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003674piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003675# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003676if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003677 piddir=`eval echo ${sysconfdir}`
3678 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003679 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003680 esac
3681fi
3682
Tim Rice88f2ab52002-03-17 12:17:34 -08003683AC_ARG_WITH(pid-dir,
3684 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3685 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003686 if test -n "$withval" && test "x$withval" != "xno" && \
3687 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003688 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003689 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003690 AC_MSG_WARN([** no $piddir directory on this system **])
3691 fi
3692 fi
3693 ]
3694)
3695
Tim Rice7df8d392005-09-19 09:33:39 -07003696AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003697AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003698
andre2ff7b5d2000-06-03 14:57:40 +00003699dnl allow user to disable some login recording features
3700AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003701 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003702 [
3703 if test "x$enableval" = "xno" ; then
3704 AC_DEFINE(DISABLE_LASTLOG)
3705 fi
3706 ]
andre2ff7b5d2000-06-03 14:57:40 +00003707)
3708AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003709 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003710 [
3711 if test "x$enableval" = "xno" ; then
3712 AC_DEFINE(DISABLE_UTMP)
3713 fi
3714 ]
andre2ff7b5d2000-06-03 14:57:40 +00003715)
3716AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003717 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003718 [
3719 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003720 AC_DEFINE(DISABLE_UTMPX, 1,
3721 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003722 fi
3723 ]
andre2ff7b5d2000-06-03 14:57:40 +00003724)
3725AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003726 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003727 [
3728 if test "x$enableval" = "xno" ; then
3729 AC_DEFINE(DISABLE_WTMP)
3730 fi
3731 ]
andre2ff7b5d2000-06-03 14:57:40 +00003732)
3733AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003734 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003735 [
3736 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003737 AC_DEFINE(DISABLE_WTMPX, 1,
3738 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003739 fi
3740 ]
andre2ff7b5d2000-06-03 14:57:40 +00003741)
3742AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003743 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003744 [
3745 if test "x$enableval" = "xno" ; then
3746 AC_DEFINE(DISABLE_LOGIN)
3747 fi
3748 ]
andre2ff7b5d2000-06-03 14:57:40 +00003749)
3750AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003751 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003752 [
3753 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003754 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3755 [Define if you don't want to use pututline()
3756 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003757 fi
3758 ]
andre2ff7b5d2000-06-03 14:57:40 +00003759)
3760AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003761 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003762 [
3763 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003764 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3765 [Define if you don't want to use pututxline()
3766 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003767 fi
3768 ]
andre2ff7b5d2000-06-03 14:57:40 +00003769)
3770AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003771 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003772 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003773 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003774 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003775 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003776 conf_lastlog_location=$withval
3777 fi
3778 ]
3779)
andre2ff7b5d2000-06-03 14:57:40 +00003780
3781dnl lastlog, [uw]tmpx? detection
3782dnl NOTE: set the paths in the platform section to avoid the
3783dnl need for command-line parameters
3784dnl lastlog and [uw]tmp are subject to a file search if all else fails
3785
3786dnl lastlog detection
3787dnl NOTE: the code itself will detect if lastlog is a directory
3788AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3789AC_TRY_COMPILE([
3790#include <sys/types.h>
3791#include <utmp.h>
3792#ifdef HAVE_LASTLOG_H
3793# include <lastlog.h>
3794#endif
Damien Miller2994e082000-06-04 15:51:47 +10003795#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003796# include <paths.h>
3797#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003798#ifdef HAVE_LOGIN_H
3799# include <login.h>
3800#endif
andre2ff7b5d2000-06-03 14:57:40 +00003801 ],
3802 [ char *lastlog = LASTLOG_FILE; ],
3803 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003804 [
3805 AC_MSG_RESULT(no)
3806 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3807 AC_TRY_COMPILE([
3808#include <sys/types.h>
3809#include <utmp.h>
3810#ifdef HAVE_LASTLOG_H
3811# include <lastlog.h>
3812#endif
3813#ifdef HAVE_PATHS_H
3814# include <paths.h>
3815#endif
3816 ],
3817 [ char *lastlog = _PATH_LASTLOG; ],
3818 [ AC_MSG_RESULT(yes) ],
3819 [
andree441aa32000-06-12 22:34:38 +00003820 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003821 system_lastlog_path=no
3822 ])
3823 ]
andre2ff7b5d2000-06-03 14:57:40 +00003824)
Damien Miller2994e082000-06-04 15:51:47 +10003825
andre2ff7b5d2000-06-03 14:57:40 +00003826if test -z "$conf_lastlog_location"; then
3827 if test x"$system_lastlog_path" = x"no" ; then
3828 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003829 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003830 conf_lastlog_location=$f
3831 fi
3832 done
3833 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003834 AC_MSG_WARN([** Cannot find lastlog **])
3835 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003836 fi
3837 fi
3838fi
3839
3840if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003841 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3842 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003843fi
andre2ff7b5d2000-06-03 14:57:40 +00003844
3845dnl utmp detection
3846AC_MSG_CHECKING([if your system defines UTMP_FILE])
3847AC_TRY_COMPILE([
3848#include <sys/types.h>
3849#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003850#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003851# include <paths.h>
3852#endif
3853 ],
3854 [ char *utmp = UTMP_FILE; ],
3855 [ AC_MSG_RESULT(yes) ],
3856 [ AC_MSG_RESULT(no)
3857 system_utmp_path=no ]
3858)
3859if test -z "$conf_utmp_location"; then
3860 if test x"$system_utmp_path" = x"no" ; then
3861 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3862 if test -f $f ; then
3863 conf_utmp_location=$f
3864 fi
3865 done
3866 if test -z "$conf_utmp_location"; then
3867 AC_DEFINE(DISABLE_UTMP)
3868 fi
3869 fi
3870fi
3871if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003872 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3873 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003874fi
andre2ff7b5d2000-06-03 14:57:40 +00003875
3876dnl wtmp detection
3877AC_MSG_CHECKING([if your system defines WTMP_FILE])
3878AC_TRY_COMPILE([
3879#include <sys/types.h>
3880#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003881#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003882# include <paths.h>
3883#endif
3884 ],
3885 [ char *wtmp = WTMP_FILE; ],
3886 [ AC_MSG_RESULT(yes) ],
3887 [ AC_MSG_RESULT(no)
3888 system_wtmp_path=no ]
3889)
3890if test -z "$conf_wtmp_location"; then
3891 if test x"$system_wtmp_path" = x"no" ; then
3892 for f in /usr/adm/wtmp /var/log/wtmp; do
3893 if test -f $f ; then
3894 conf_wtmp_location=$f
3895 fi
3896 done
3897 if test -z "$conf_wtmp_location"; then
3898 AC_DEFINE(DISABLE_WTMP)
3899 fi
3900 fi
3901fi
3902if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003903 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3904 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003905fi
andre2ff7b5d2000-06-03 14:57:40 +00003906
3907
3908dnl utmpx detection - I don't know any system so perverse as to require
3909dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3910dnl there, though.
3911AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3912AC_TRY_COMPILE([
3913#include <sys/types.h>
3914#include <utmp.h>
3915#ifdef HAVE_UTMPX_H
3916#include <utmpx.h>
3917#endif
Damien Miller2994e082000-06-04 15:51:47 +10003918#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003919# include <paths.h>
3920#endif
3921 ],
3922 [ char *utmpx = UTMPX_FILE; ],
3923 [ AC_MSG_RESULT(yes) ],
3924 [ AC_MSG_RESULT(no)
3925 system_utmpx_path=no ]
3926)
3927if test -z "$conf_utmpx_location"; then
3928 if test x"$system_utmpx_path" = x"no" ; then
3929 AC_DEFINE(DISABLE_UTMPX)
3930 fi
3931else
Tim Rice7df8d392005-09-19 09:33:39 -07003932 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3933 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003934fi
andre2ff7b5d2000-06-03 14:57:40 +00003935
3936dnl wtmpx detection
3937AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3938AC_TRY_COMPILE([
3939#include <sys/types.h>
3940#include <utmp.h>
3941#ifdef HAVE_UTMPX_H
3942#include <utmpx.h>
3943#endif
Damien Miller2994e082000-06-04 15:51:47 +10003944#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003945# include <paths.h>
3946#endif
3947 ],
3948 [ char *wtmpx = WTMPX_FILE; ],
3949 [ AC_MSG_RESULT(yes) ],
3950 [ AC_MSG_RESULT(no)
3951 system_wtmpx_path=no ]
3952)
3953if test -z "$conf_wtmpx_location"; then
3954 if test x"$system_wtmpx_path" = x"no" ; then
3955 AC_DEFINE(DISABLE_WTMPX)
3956 fi
3957else
Tim Rice7df8d392005-09-19 09:33:39 -07003958 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3959 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003960fi
andre2ff7b5d2000-06-03 14:57:40 +00003961
Damien Miller4018c192000-04-30 09:30:44 +10003962
Damien Miller29ea30d2000-03-17 10:54:15 +11003963if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003964 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3965 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003966fi
3967
Darren Tucker7da23cb2005-08-03 00:20:15 +10003968dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3969dnl Add now.
3970CFLAGS="$CFLAGS $werror_flags"
3971
Damien Millerbac2d8a2000-09-05 16:13:06 +11003972AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10003973AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
3974 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
3975 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003976AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003977
Damien Miller7b22d652000-06-18 14:07:04 +10003978# Print summary of options
3979
Damien Miller7b22d652000-06-18 14:07:04 +10003980# Someone please show me a better way :)
3981A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3982B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3983C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3984D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003985E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003986F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003987G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003988H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3989I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3990J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003991
3992echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003993echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003994echo " User binaries: $B"
3995echo " System binaries: $C"
3996echo " Configuration files: $D"
3997echo " Askpass program: $E"
3998echo " Manual pages: $F"
3999echo " PID file: $G"
4000echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004001if test "x$external_path_file" = "x/etc/login.conf" ; then
4002echo " At runtime, sshd will use the path defined in $external_path_file"
4003echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004004else
Damien Millerf58c6722002-05-13 13:15:42 +10004005echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004006 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004007echo " (If PATH is set in $external_path_file it will be used instead. If"
4008echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4009 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004010fi
Damien Millera18bbd32002-05-13 10:48:57 +10004011if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004012echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004013fi
Damien Millerf58c6722002-05-13 13:15:42 +10004014echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004015echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004016echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004017echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004018echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004019echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004020echo " S/KEY support: $SKEY_MSG"
4021echo " TCP Wrappers support: $TCPW_MSG"
4022echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004023echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004024echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004025echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004026echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4027echo " BSD Auth support: $BSD_AUTH_MSG"
4028echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004029if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004030echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004031fi
4032
Damien Miller7b22d652000-06-18 14:07:04 +10004033echo ""
4034
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004035echo " Host: ${host}"
4036echo " Compiler: ${CC}"
4037echo " Compiler flags: ${CFLAGS}"
4038echo "Preprocessor flags: ${CPPFLAGS}"
4039echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004040echo " Libraries: ${LIBS}"
4041if test ! -z "${SSHDLIBS}"; then
4042echo " +for sshd: ${SSHDLIBS}"
4043fi
Damien Miller7b22d652000-06-18 14:07:04 +10004044
4045echo ""
4046
Tim Rice6f1f7582004-05-30 21:38:51 -07004047if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004048 echo "SVR4 style packages are supported with \"make package\""
4049 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004050fi
4051
Damien Miller82cf0ce2000-12-20 13:34:48 +11004052if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004053 echo "PAM is enabled. You may need to install a PAM control file "
4054 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004055 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004056 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004057 echo ""
4058fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004059
Damien Miller6c21c512002-01-22 21:57:53 +11004060if test ! -z "$RAND_HELPER_CMDHASH" ; then
4061 echo "WARNING: you are using the builtin random number collection "
4062 echo "service. Please read WARNING.RNG and request that your OS "
4063 echo "vendor includes kernel-based random number collection in "
4064 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004065 echo ""
4066fi
Damien Miller60396b02001-02-18 17:01:00 +11004067
Damien Millerb4097182004-05-23 14:09:40 +10004068if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004069 echo "WARNING: the operating system that you are using does not"
4070 echo "appear to support getpeereid(), getpeerucred() or the"
4071 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4072 echo "enforce security checks to prevent unauthorised connections to"
4073 echo "ssh-agent. Their absence increases the risk that a malicious"
4074 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004075 echo ""
4076fi
4077
Darren Tuckerd9f88912005-02-20 21:01:48 +11004078if test "$AUDIT_MODULE" = "bsm" ; then
4079 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4080 echo "See the Solaris section in README.platform for details."
4081fi