blob: 51dea41c146353e43f0fa006f5f71f6ac9fde9cc [file] [log] [blame]
Tim Rice90f42b02011-06-02 18:17:49 -07001# $Id: configure.ac,v 1.475 2011/06/03 01:17:49 tim 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
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Tim Rice90f42b02011-06-02 18:17:49 -070018AC_REVISION($Revision: 1.475 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Tim Rice648f8762011-01-26 12:38:57 -080020AC_LANG([C])
Damien Miller7f6ea021999-10-28 13:25:17 +100021
Tim Rice648f8762011-01-26 12:38:57 -080022AC_CONFIG_HEADER([config.h])
Damien Miller856799b2000-03-15 21:18:10 +110023AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110024AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110025AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100026
Damien Millera22ba012000-03-02 23:09:20 +110027# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100028AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110029AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100030AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110031AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080032AC_PROG_EGREP
Tim Rice648f8762011-01-26 12:38:57 -080033AC_PATH_PROG([AR], [ar])
34AC_PATH_PROG([CAT], [cat])
35AC_PATH_PROG([KILL], [kill])
36AC_PATH_PROGS([PERL], [perl5 perl])
37AC_PATH_PROG([SED], [sed])
38AC_SUBST([PERL])
39AC_PATH_PROG([ENT], [ent])
40AC_SUBST([ENT])
41AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
42AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
43AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
44AC_PATH_PROG([SH], [sh])
45AC_PATH_PROG([GROFF], [groff])
46AC_PATH_PROG([NROFF], [nroff])
47AC_PATH_PROG([MANDOC], [mandoc])
48AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110049
Damien Miller30a69e72011-01-04 08:16:27 +110050dnl select manpage formatter
51if test "x$MANDOC" != "x" ; then
52 MANFMT="$MANDOC"
53elif test "x$NROFF" != "x" ; then
54 MANFMT="$NROFF -mandoc"
55elif test "x$GROFF" != "x" ; then
56 MANFMT="$GROFF -mandoc -Tascii"
57else
58 AC_MSG_WARN([no manpage formatted found])
59 MANFMT="false"
60fi
Tim Rice648f8762011-01-26 12:38:57 -080061AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110062
Tim Rice6f1f7582004-05-30 21:38:51 -070063dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080064AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070065 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080066AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070067 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080068AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110069if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080070 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110071else
Tim Rice648f8762011-01-26 12:38:57 -080072 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110073fi
Tim Rice6f1f7582004-05-30 21:38:51 -070074
Damien Millere8bb4502001-09-25 16:39:35 +100075# System features
76AC_SYS_LARGEFILE
77
Damien Miller3f62aba2000-11-29 11:56:35 +110078if test -z "$AR" ; then
79 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
80fi
81
Damien Millerad833b32000-08-23 10:46:23 +100082# Use LOGIN_PROGRAM from environment if possible
83if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice648f8762011-01-26 12:38:57 -080084 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM"],
Tim Rice7df8d392005-09-19 09:33:39 -070085 [If your header files don't define LOGIN_PROGRAM,
86 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100087else
88 # Search for login
Tim Rice648f8762011-01-26 12:38:57 -080089 AC_PATH_PROG([LOGIN_PROGRAM_FALLBACK], [login])
Damien Millerad833b32000-08-23 10:46:23 +100090 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
Tim Rice648f8762011-01-26 12:38:57 -080091 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM_FALLBACK"])
Damien Millerad833b32000-08-23 10:46:23 +100092 fi
93fi
94
Tim Rice648f8762011-01-26 12:38:57 -080095AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +110096if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -080097 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -070098 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110099fi
100
Damien Miller166bd442000-03-16 10:48:25 +1100101if test -z "$LD" ; then
102 LD=$CC
103fi
Tim Rice648f8762011-01-26 12:38:57 -0800104AC_SUBST([LD])
Tim Riceeae17cc2005-03-17 16:52:20 -0800105
Damien Miller166bd442000-03-16 10:48:25 +1100106AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +1000107
Tim Rice648f8762011-01-26 12:38:57 -0800108AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
Darren Tucker67b37032005-06-03 17:58:31 +1000109
Darren Tuckerb7918af2008-03-09 11:34:23 +1100110use_stack_protector=1
Tim Rice648f8762011-01-26 12:38:57 -0800111AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100112 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100113 if test "x$withval" = "xno"; then
114 use_stack_protector=0
115 fi ])
116
Damien Miller134d02a2011-01-12 16:00:37 +1100117
Damien Millera8e06ce2003-11-21 23:48:55 +1100118if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Millerb1763622011-05-20 11:45:25 +1000119 OSSH_CHECK_CFLAG_COMPILE([-Wall])
120 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
121 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
122 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
123 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
124 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
125 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
126 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Tim Rice648f8762011-01-26 12:38:57 -0800127 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100128 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700129 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000130 1.*) no_attrib_nonnull=1 ;;
131 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000132 no_attrib_nonnull=1
133 ;;
134 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100135 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700136 esac
Tim Rice648f8762011-01-26 12:38:57 -0800137 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000138
Tim Rice648f8762011-01-26 12:38:57 -0800139 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000140 saved_CFLAGS="$CFLAGS"
141 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800142 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
143 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
144 [ AC_MSG_RESULT([yes]) ],
145 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000146 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800147 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000148
Darren Tuckerb7918af2008-03-09 11:34:23 +1100149 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100150 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100151 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100152 if test "x$use_stack_protector" = "x1"; then
153 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800154 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100155 saved_CFLAGS="$CFLAGS"
156 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100157 CFLAGS="$CFLAGS $t -Werror"
158 LDFLAGS="$LDFLAGS $t -Werror"
159 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800160 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
161 [[
162 char x[256];
163 snprintf(x, sizeof(x), "XXX");
164 ]])],
165 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100166 CFLAGS="$saved_CFLAGS $t"
167 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800168 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100169 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800170 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
171 [[
172 char x[256];
173 snprintf(x, sizeof(x), "XXX");
174 ]])],
175 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100176 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800177 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100178 [ AC_MSG_WARN([cross compiling: cannot test])
179 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100180 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100181 ],
Tim Rice648f8762011-01-26 12:38:57 -0800182 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100183 )
184 CFLAGS="$saved_CFLAGS"
185 LDFLAGS="$saved_LDFLAGS"
186 done
187 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100188
Darren Tucker67b37032005-06-03 17:58:31 +1000189 if test -z "$have_llong_max"; then
190 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
191 unset ac_cv_have_decl_LLONG_MAX
192 saved_CFLAGS="$CFLAGS"
193 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800194 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000195 [have_llong_max=1],
196 [CFLAGS="$saved_CFLAGS"],
197 [#include <limits.h>]
198 )
199 fi
Damien Miller166bd442000-03-16 10:48:25 +1100200fi
201
Darren Tucker391de5c2007-04-29 14:49:21 +1000202if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800203 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000204fi
205
Tim Rice648f8762011-01-26 12:38:57 -0800206AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800207 [ --without-rpath Disable auto-added -R linker paths],
208 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800209 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800210 need_dash_r=""
211 fi
212 if test "x$withval" = "xyes" ; then
213 need_dash_r=1
214 fi
215 ]
216)
217
Tim Rice1cfab232006-10-03 09:34:35 -0700218# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800219AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700220 [ --with-cflags Specify additional flags to pass to compiler],
221 [
222 if test -n "$withval" && test "x$withval" != "xno" && \
223 test "x${withval}" != "xyes"; then
224 CFLAGS="$CFLAGS $withval"
225 fi
226 ]
227)
Tim Rice648f8762011-01-26 12:38:57 -0800228AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700229 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
230 [
231 if test -n "$withval" && test "x$withval" != "xno" && \
232 test "x${withval}" != "xyes"; then
233 CPPFLAGS="$CPPFLAGS $withval"
234 fi
235 ]
236)
Tim Rice648f8762011-01-26 12:38:57 -0800237AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700238 [ --with-ldflags Specify additional flags to pass to linker],
239 [
240 if test -n "$withval" && test "x$withval" != "xno" && \
241 test "x${withval}" != "xyes"; then
242 LDFLAGS="$LDFLAGS $withval"
243 fi
244 ]
245)
Tim Rice648f8762011-01-26 12:38:57 -0800246AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700247 [ --with-libs Specify additional libraries to link with],
248 [
249 if test -n "$withval" && test "x$withval" != "xno" && \
250 test "x${withval}" != "xyes"; then
251 LIBS="$LIBS $withval"
252 fi
253 ]
254)
Tim Rice648f8762011-01-26 12:38:57 -0800255AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700256 [ --with-Werror Build main code with -Werror],
257 [
258 if test -n "$withval" && test "x$withval" != "xno"; then
259 werror_flags="-Werror"
260 if test "x${withval}" != "xyes"; then
261 werror_flags="$withval"
262 fi
263 fi
264 ]
265)
266
Tim Rice648f8762011-01-26 12:38:57 -0800267AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700268 bstring.h \
269 crypt.h \
270 crypto/sha2.h \
271 dirent.h \
272 endian.h \
273 features.h \
274 fcntl.h \
275 floatingpoint.h \
276 getopt.h \
277 glob.h \
278 ia.h \
279 iaf.h \
280 limits.h \
281 login.h \
282 maillock.h \
283 ndir.h \
284 net/if_tun.h \
285 netdb.h \
286 netgroup.h \
287 pam/pam_appl.h \
288 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000289 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700290 pty.h \
291 readpassphrase.h \
292 rpc/types.h \
293 security/pam_appl.h \
294 sha2.h \
295 shadow.h \
296 stddef.h \
297 stdint.h \
298 string.h \
299 strings.h \
300 sys/audit.h \
301 sys/bitypes.h \
302 sys/bsdtty.h \
303 sys/cdefs.h \
304 sys/dir.h \
305 sys/mman.h \
306 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000307 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700308 sys/prctl.h \
309 sys/pstat.h \
310 sys/select.h \
311 sys/stat.h \
312 sys/stream.h \
313 sys/stropts.h \
314 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000315 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700316 sys/sysmacros.h \
317 sys/time.h \
318 sys/timers.h \
319 sys/un.h \
320 time.h \
321 tmpdir.h \
322 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700323 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700324 unistd.h \
325 usersec.h \
326 util.h \
327 utime.h \
328 utmp.h \
329 utmpx.h \
330 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800331])
Tim Rice1cfab232006-10-03 09:34:35 -0700332
333# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800334AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700335#ifdef HAVE_SYS_TIME_H
336# include <sys/time.h>
337#endif
338])
339
340# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800341AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700342#ifdef HAVE_SYS_STREAM_H
343# include <sys/stream.h>
344#endif
345])
346
347# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800348AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700349#include <sys/types.h>
350])
351
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000352# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800353AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000354#include <sys/param.h>
355])
356
Damien Miller1b06dc32006-08-31 03:24:41 +1000357# Messages for features tested for in target-specific section
358SIA_MSG="no"
359SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100360SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000361
Damien Millera22ba012000-03-02 23:09:20 +1100362# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100363case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100364*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000365 # Some versions of VAC won't allow macro redefinitions at
366 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
367 # particularly with older versions of vac or xlc.
368 # It also throws errors about null macro argments, but these are
369 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800370 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000371 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800372 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000373#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800374#define testmacro bar]],
375 [[ exit(0); ]])],
376 [ AC_MSG_RESULT([yes]) ],
377 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000378 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
379 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
380 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
381 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
382 ]
383 )
384
Damien Millera8e06ce2003-11-21 23:48:55 +1100385 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000386 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800387 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100388 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000389 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000390 if test "$GCC" = "yes"; then
391 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
392 else
393 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
394 fi
395 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000396 if (test -z "$blibflags"); then
397 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800398 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
399 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000400 fi
401 done
402 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800403 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000404 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
405 else
Tim Rice648f8762011-01-26 12:38:57 -0800406 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000407 fi
408 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000409 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800410 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700411 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800412 [AC_CHECK_LIB([s], [authenticate],
413 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700414 LIBS="$LIBS -ls"
415 ])
416 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100417 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100418 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100419 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000420 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800421 AC_CHECK_DECLS([loginfailed],
422 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
424 [[ (void)loginfailed("user","host","tty",0); ]])],
425 [AC_MSG_RESULT([yes])
426 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
427 [Define if your AIX loginfailed() function
428 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
429 ])],
430 [],
431 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000432 )
Tim Rice648f8762011-01-26 12:38:57 -0800433 AC_CHECK_FUNCS([getgrset setauthdb])
434 AC_CHECK_DECL([F_CLOSEM],
435 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000436 [],
437 [ #include <limits.h>
438 #include <fcntl.h> ]
439 )
Darren Tucker691d5232005-02-15 21:45:57 +1100440 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800441 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
442 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700443 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800444 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
445 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000446 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800447 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
448 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700449 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800450 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700451 [Define to a Set Process Title type if your system is
452 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800453 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100454 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800455 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100456 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100457*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100458 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100459 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800460 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
461 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
462 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700463 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800464 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700465 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800466 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700467 [Define if the concept of ports only accessible to
468 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800469 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700470 [Define if your platform needs to skip post auth
471 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800472 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
473 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100474 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000475*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800476 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700477 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800478 AC_DEFINE([SETEUID_BREAKS_SETUID])
479 AC_DEFINE([BROKEN_SETREUID])
480 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000481 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000482*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800483 AC_MSG_CHECKING([if we have working getaddrinfo])
484 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000485main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
486 exit(0);
487 else
488 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800489}
490 ]])],
491 [AC_MSG_RESULT([working])],
492 [AC_MSG_RESULT([buggy])
493 AC_DEFINE([BROKEN_GETADDRINFO], [1],
494 [getaddrinfo is broken (if present)])
495 ],
496 [AC_MSG_RESULT([assume it is working])])
497 AC_DEFINE([SETEUID_BREAKS_SETUID])
498 AC_DEFINE([BROKEN_SETREUID])
499 AC_DEFINE([BROKEN_SETREGID])
500 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
501 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700502 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800503 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
504 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000505 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800506 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000507 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800508 m4_pattern_allow([AU_IPv])
509 AC_CHECK_DECL([AU_IPv4], [],
510 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100511 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800512 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100513 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100514 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000515 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000516*-*-dragonfly*)
517 SSHDLIBS="$SSHDLIBS -lcrypt"
518 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100519*-*-haiku*)
520 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800521 AC_CHECK_LIB([network], [socket])
522 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100523 MANTYPE=man
524 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000525*-*-hpux*)
526 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000527 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100528 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800529 AC_DEFINE([USE_PIPES])
530 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700531 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800532 AC_DEFINE([LOGIN_NEEDS_UTMPX])
533 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700534 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800535 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Tim Rice90f42b02011-06-02 18:17:49 -0700536 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700537 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800538 AC_CHECK_LIB([xnet], [t_error], ,
539 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000540
541 # next, we define all of the options specific to major releases
542 case "$host" in
543 *-*-hpux10*)
544 if test -z "$GCC"; then
545 CFLAGS="$CFLAGS -Ae"
546 fi
547 ;;
548 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800549 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700550 [Define if you are using Solaris-derived PAM which
551 passes pam_messages to the conversation function
552 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800553 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700554 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800555 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000556 check_for_hpux_broken_getaddrinfo=1
557 check_for_conflicting_getspnam=1
558 ;;
559 esac
560
561 # lastly, we define options specific to minor releases
562 case "$host" in
563 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800564 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700565 [Define if you have SecureWare-based
566 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000567 disable_ptmx_check=yes
568 LIBS="$LIBS -lsecpw"
569 ;;
570 esac
Damien Miller1bead332000-04-30 00:47:29 +1000571 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100572*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100573 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800574 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700575 [Define if you system's inet_ntoa is busted
576 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800577 AC_DEFINE([SETEUID_BREAKS_SETUID])
578 AC_DEFINE([BROKEN_SETREUID])
579 AC_DEFINE([BROKEN_SETREGID])
580 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700581 [Define if you shouldn't strip 'tty' from your
582 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800583 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100584 ;;
585*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100586 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800587 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700588 [Define if you have/want arrays
589 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700591 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800592 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700593 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800594 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700595 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800596 AC_DEFINE([BROKEN_INET_NTOA])
597 AC_DEFINE([SETEUID_BREAKS_SETUID])
598 AC_DEFINE([BROKEN_SETREUID])
599 AC_DEFINE([BROKEN_SETREGID])
600 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
601 AC_DEFINE([WITH_ABBREV_NO_TTY])
602 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100603 ;;
Damien Miller90551722009-02-16 15:37:03 +1100604*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
605 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800606 AC_DEFINE([PAM_TTY_KLUDGE])
607 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
608 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
609 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
610 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100611 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100612*-*-linux*)
613 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100614 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000615 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800616 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700617 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800618 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700619 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800620 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
621 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700622 [Define to whatever link() returns for "not supported"
623 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800624 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
625 AC_DEFINE([USE_BTMP])
626 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100627 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000628 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000629 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800630 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700631 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000632 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000633 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100634 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800635 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100636 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800637 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100638 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800639 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100640 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800641 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100642 [Prepend the address family to IP tunnel traffic])
643 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100644 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000645mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800646 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000647 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000648 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100649*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000650 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800651 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800652 need_dash_r=1
653 fi
Tim Rice648f8762011-01-26 12:38:57 -0800654 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100655 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800656 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
657 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100658 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100659 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100660*-*-freebsd*)
661 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800662 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
663 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100664 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
666 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100667 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000668*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800669 AC_DEFINE([SETEUID_BREAKS_SETUID])
670 AC_DEFINE([BROKEN_SETREUID])
671 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000672 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000673*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000674 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100675 conf_utmp_location=/etc/utmp
676 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700677 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800678 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
679 AC_DEFINE([BROKEN_REALPATH])
680 AC_DEFINE([USE_PIPES])
681 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000682 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000683*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800684 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
685 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
686 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
687 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000688 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000689 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100690*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800691 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800692 need_dash_r=1
693 fi
Tim Rice648f8762011-01-26 12:38:57 -0800694 AC_DEFINE([PAM_SUN_CODEBASE])
695 AC_DEFINE([LOGIN_NEEDS_UTMPX])
696 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700697 [Some versions of /bin/login need the TERM supplied
698 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800699 AC_DEFINE([PAM_TTY_KLUDGE])
700 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700701 [Define if pam_chauthtok wants real uid set
702 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800703 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000704 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800705 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700706 [Define if sshd somehow reacquires a controlling TTY
707 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800708 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000709 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800710 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000711 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000712 # hardwire lastlog location (can't detect it on some versions)
713 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800714 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000715 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
716 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_MSG_RESULT([yes])
718 AC_DEFINE([DISABLE_UTMP])
719 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700720 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000721 else
Tim Rice648f8762011-01-26 12:38:57 -0800722 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000723 fi
Tim Rice648f8762011-01-26 12:38:57 -0800724 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000725 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
726 [
Tim Rice648f8762011-01-26 12:38:57 -0800727 AC_CHECK_LIB([contract], [ct_tmpl_activate],
728 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000729 [Define if you have Solaris process contracts])
730 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000731 SPC_MSG="yes" ], )
732 ],
733 )
Tim Rice648f8762011-01-26 12:38:57 -0800734 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100735 [ --with-solaris-projects Enable Solaris projects (experimental)],
736 [
Tim Rice648f8762011-01-26 12:38:57 -0800737 AC_CHECK_LIB([project], [setproject],
738 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100739 [Define if you have Solaris projects])
740 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100741 SP_MSG="yes" ], )
742 ],
743 )
Damien Miller75b1d102000-01-07 14:01:41 +1100744 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000745*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000746 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800747 AC_CHECK_FUNCS([getpwanam])
748 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000749 conf_utmp_location=/etc/utmp
750 conf_wtmp_location=/var/adm/wtmp
751 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800752 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000753 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000754*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700755 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800756 AC_DEFINE([USE_PIPES])
757 AC_DEFINE([SSHD_ACQUIRES_CTTY])
758 AC_DEFINE([SETEUID_BREAKS_SETUID])
759 AC_DEFINE([BROKEN_SETREUID])
760 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000761 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000762*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700763 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100765 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800766 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100767 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([USE_PIPES])
769 AC_DEFINE([IP_TOS_IS_BROKEN])
770 AC_DEFINE([SETEUID_BREAKS_SETUID])
771 AC_DEFINE([BROKEN_SETREUID])
772 AC_DEFINE([BROKEN_SETREGID])
773 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000774 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700775 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
776 # Attention: always take care to bind libsocket and libnsl before libc,
777 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000778 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800779# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100780*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800781 AC_DEFINE([USE_PIPES])
782 AC_DEFINE([SETEUID_BREAKS_SETUID])
783 AC_DEFINE([BROKEN_SETREUID])
784 AC_DEFINE([BROKEN_SETREGID])
785 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
786 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100787 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800788# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100789*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800790 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800791 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
792 AC_DEFINE([USE_PIPES])
793 AC_DEFINE([SETEUID_BREAKS_SETUID])
794 AC_DEFINE([BROKEN_GETADDRINFO])
795 AC_DEFINE([BROKEN_SETREUID])
796 AC_DEFINE([BROKEN_SETREGID])
797 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700798 case "$host" in
799 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700800 maildir=/var/spool/mail
Tim Rice4dbacff2005-06-01 20:09:28 -0700801 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800802 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700803 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800804 AC_DEFINE([BROKEN_UPDWTMPX])
805 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
806 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
807 AC_DEFINE([HAVE_SECUREWARE])
808 AC_DEFINE([DISABLE_SHADOW])
809 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700810 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800811 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800812 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800813 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700814 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100815 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100816*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100817 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800818# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100819*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800820 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100821 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800822# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100823*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800824 if test -z "$GCC"; then
825 CFLAGS="$CFLAGS -belf"
826 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100827 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000828 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800829 AC_DEFINE([USE_PIPES])
830 AC_DEFINE([HAVE_SECUREWARE])
831 AC_DEFINE([DISABLE_SHADOW])
832 AC_DEFINE([DISABLE_FD_PASSING])
833 AC_DEFINE([SETEUID_BREAKS_SETUID])
834 AC_DEFINE([BROKEN_GETADDRINFO])
835 AC_DEFINE([BROKEN_SETREUID])
836 AC_DEFINE([BROKEN_SETREGID])
837 AC_DEFINE([WITH_ABBREV_NO_TTY])
838 AC_DEFINE([BROKEN_UPDWTMPX])
839 AC_DEFINE([PASSWD_NEEDS_USERNAME])
840 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700841 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700842 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000843 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000844*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800845 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700846 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800847 AC_DEFINE([SETEUID_BREAKS_SETUID])
848 AC_DEFINE([BROKEN_SETREUID])
849 AC_DEFINE([BROKEN_SETREGID])
850 AC_DEFINE([USE_PIPES])
851 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000852 LDFLAGS="$LDFLAGS"
853 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
854 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000855 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000856*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800857 AC_DEFINE([SETEUID_BREAKS_SETUID])
858 AC_DEFINE([BROKEN_SETREUID])
859 AC_DEFINE([BROKEN_SETREGID])
860 AC_DEFINE([WITH_ABBREV_NO_TTY])
861 AC_DEFINE([USE_PIPES])
862 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000863 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100864 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000865 MANTYPE=cat
866 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000867*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800868 AC_DEFINE([SETEUID_BREAKS_SETUID])
869 AC_DEFINE([BROKEN_SETREUID])
870 AC_DEFINE([BROKEN_SETREGID])
871 AC_DEFINE([USE_PIPES])
872 AC_DEFINE([DISABLE_FD_PASSING])
873 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000874 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
875 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
876 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700877 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000878*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800879 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000880 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800881 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000882 [ --with-osfsia Enable Digital Unix SIA],
883 [
884 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800885 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000886 no_osfsia=1
887 fi
888 ],
889 )
890 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000891 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800892 AC_MSG_RESULT([yes])
893 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700894 [Define if you have Digital Unix Security
895 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800896 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700897 [Define if you don't want to use your
898 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800899 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000900 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000901 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000902 else
Tim Rice648f8762011-01-26 12:38:57 -0800903 AC_MSG_RESULT([no])
904 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700905 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000906 fi
907 fi
Tim Rice648f8762011-01-26 12:38:57 -0800908 AC_DEFINE([BROKEN_GETADDRINFO])
909 AC_DEFINE([SETEUID_BREAKS_SETUID])
910 AC_DEFINE([BROKEN_SETREUID])
911 AC_DEFINE([BROKEN_SETREGID])
912 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000913 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000914
Tim Rice70335a62006-02-04 17:42:58 -0800915*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800916 AC_DEFINE([USE_PIPES])
917 AC_DEFINE([NO_X11_UNIX_SOCKETS])
918 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
919 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
920 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
921 AC_DEFINE([DISABLE_LASTLOG])
922 AC_DEFINE([SSHD_ACQUIRES_CTTY])
923 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800924 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000925 case "$host" in
926 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800927 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000928 ;;
929 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000930 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000931
932*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800933 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
934 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
935 AC_DEFINE([NEED_SETPGRP])
936 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700937 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000938
939*-*-lynxos)
940 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -0800941 AC_DEFINE([MISSING_HOWMANY])
942 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000943 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100944esac
945
Tim Rice648f8762011-01-26 12:38:57 -0800946AC_MSG_CHECKING([compiler and flags for sanity])
947AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
948 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +1000949 [
Tim Rice648f8762011-01-26 12:38:57 -0800950 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +1000951 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000952 ],
953 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000954)
955
Darren Tucker0c9653f2005-05-28 15:58:14 +1000956dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100957# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -0800958AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
959AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000960
Tim Rice1e1ef642003-09-11 22:19:31 -0700961dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -0800962AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
963 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -0700964 AC_CACHE_CHECK([for broken dirname],
965 ac_cv_have_broken_dirname, [
966 save_LIBS="$LIBS"
967 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000968 AC_RUN_IFELSE(
969 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700970#include <libgen.h>
971#include <string.h>
972
973int main(int argc, char **argv) {
974 char *s, buf[32];
975
976 strncpy(buf,"/etc", 32);
977 s = dirname(buf);
978 if (!s || strncmp(s, "/", 32) != 0) {
979 exit(1);
980 } else {
981 exit(0);
982 }
983}
Darren Tucker314d89e2005-10-17 23:29:23 +1000984 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700985 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000986 [ ac_cv_have_broken_dirname="yes" ],
987 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700988 )
989 LIBS="$save_LIBS"
990 ])
991 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
992 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -0800993 AC_DEFINE([HAVE_DIRNAME])
994 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -0700995 fi
996 ])
997])
998
Tim Rice648f8762011-01-26 12:38:57 -0800999AC_CHECK_FUNC([getspnam], ,
1000 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1001AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1002 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001003
Tim Rice13aae5e2001-10-21 17:53:58 -07001004dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001005AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001006 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001007 [ if test "x$withval" = "xno" ; then
1008 AC_MSG_ERROR([*** zlib is required ***])
1009 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001010 if test -d "$withval/lib"; then
1011 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001012 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001013 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001014 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001015 fi
1016 else
1017 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001018 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001019 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001020 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001021 fi
1022 fi
1023 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001024 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001025 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001026 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001027 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001028 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001029)
1030
Tim Rice648f8762011-01-26 12:38:57 -08001031AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1032AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001033 [
1034 saved_CPPFLAGS="$CPPFLAGS"
1035 saved_LDFLAGS="$LDFLAGS"
1036 save_LIBS="$LIBS"
1037 dnl Check default zlib install dir
1038 if test -n "${need_dash_r}"; then
1039 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1040 else
1041 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1042 fi
1043 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1044 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001045 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001046 [
1047 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1048 ]
1049 )
1050 ]
1051)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001052
Tim Rice648f8762011-01-26 12:38:57 -08001053AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001054 [ --without-zlib-version-check Disable zlib version check],
1055 [ if test "x$withval" = "xno" ; then
1056 zlib_check_nonfatal=1
1057 fi
1058 ]
1059)
1060
Tim Rice648f8762011-01-26 12:38:57 -08001061AC_MSG_CHECKING([for possibly buggy zlib])
1062AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001063#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001064#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001065 ]],
1066 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001067 int a=0, b=0, c=0, d=0, n, v;
1068 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1069 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001070 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001071 v = a*1000000 + b*10000 + c*100 + d;
1072 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1073
1074 /* 1.1.4 is OK */
1075 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001076 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001077
Darren Tucker41097ed2005-07-25 15:24:21 +10001078 /* 1.2.3 and up are OK */
1079 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001080 exit(0);
1081
Darren Tucker2dcd2392004-01-23 17:13:33 +11001082 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001083 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001084 AC_MSG_RESULT([no]),
1085 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001086 if test -z "$zlib_check_nonfatal" ; then
1087 AC_MSG_ERROR([*** zlib too old - check config.log ***
1088Your reported zlib version has known security problems. It's possible your
1089vendor has fixed these problems without changing the version number. If you
1090are sure this is the case, you can disable the check by running
1091"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001092If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001093See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001094 else
1095 AC_MSG_WARN([zlib version may have security problems])
1096 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001097 ],
1098 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001099)
Damien Miller6f9c3372000-10-25 10:06:04 +11001100
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001101dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001102AC_CHECK_FUNC([strcasecmp],
1103 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001104)
Tim Rice648f8762011-01-26 12:38:57 -08001105AC_CHECK_FUNCS([utimes],
1106 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001107 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001108)
Damien Millerab18c411999-11-11 10:40:23 +11001109
Tim Ricee589a292001-11-03 11:09:32 -08001110dnl Checks for libutil functions
Tim Rice648f8762011-01-26 12:38:57 -08001111AC_CHECK_HEADERS([libutil.h])
1112AC_SEARCH_LIBS([login], [util bsd], [AC_DEFINE([HAVE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001113 [Define if your libraries define login()])])
Tim Rice648f8762011-01-26 12:38:57 -08001114AC_CHECK_FUNCS([fmt_scaled logout updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001115
Ben Lindstrom8697e082001-02-24 21:41:10 +00001116AC_FUNC_STRFTIME
1117
Damien Miller3c027682001-03-14 11:39:45 +11001118# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001119AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1120AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001121 [
1122 #include <glob.h>
1123 #ifdef GLOB_ALTDIRFUNC
1124 FOUNDIT
1125 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001126 ],
Damien Miller3c027682001-03-14 11:39:45 +11001127 [
Tim Rice648f8762011-01-26 12:38:57 -08001128 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001129 [Define if your system glob() function has
1130 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001131 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001132 ],
1133 [
Tim Rice648f8762011-01-26 12:38:57 -08001134 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001135 ]
1136)
Damien Millerab18c411999-11-11 10:40:23 +11001137
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001138# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001139AC_MSG_CHECKING([for gl_matchc field in glob_t])
1140AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1141 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001142 [
Tim Rice648f8762011-01-26 12:38:57 -08001143 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001144 [Define if your system glob() function has
1145 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001146 AC_MSG_RESULT([yes])
1147 ], [
1148 AC_MSG_RESULT([no])
1149])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001150
Damien Millera6e121a2010-10-07 21:39:17 +11001151# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001152AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1153AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001154#ifndef GLOB_KEEPSTAT
1155#error "glob does not support GLOB_KEEPSTAT extension"
1156#endif
1157glob_t g;
1158g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001159]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001160 [
Tim Rice648f8762011-01-26 12:38:57 -08001161 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001162 [Define if your system glob() function has
1163 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001164 AC_MSG_RESULT([yes])
1165 ], [
1166 AC_MSG_RESULT([no])
1167
1168])
Damien Millera6e121a2010-10-07 21:39:17 +11001169
Tim Rice648f8762011-01-26 12:38:57 -08001170AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001171
Damien Miller18bb4732001-03-28 14:35:30 +10001172AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001173AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001174 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001175#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001176#include <dirent.h>]],
1177 [[
1178 struct dirent d;
1179 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001180 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001181 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001182 [
Tim Rice648f8762011-01-26 12:38:57 -08001183 AC_MSG_RESULT([no])
1184 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001185 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001186 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001187 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001188 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001189 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001190 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001191 ]
1192)
1193
Damien Miller36f49652004-08-15 18:40:59 +10001194AC_MSG_CHECKING([for /proc/pid/fd directory])
1195if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001196 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1197 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001198else
Tim Rice648f8762011-01-26 12:38:57 -08001199 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001200fi
1201
Damien Millerc547bf12001-02-16 10:18:12 +11001202# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001203SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001204AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001205 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001206 [
1207 if test "x$withval" != "xno" ; then
1208
1209 if test "x$withval" != "xyes" ; then
1210 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1211 LDFLAGS="$LDFLAGS -L${withval}/lib"
1212 fi
1213
Tim Rice648f8762011-01-26 12:38:57 -08001214 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001215 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001216 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001217
Tim Rice4cec93f2002-02-26 08:40:48 -08001218 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001219 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001220 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001221#include <stdio.h>
1222#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001223 ]], [[
1224 char *ff = skey_keyinfo(""); ff="";
1225 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001226 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001227 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001228 [
Tim Rice648f8762011-01-26 12:38:57 -08001229 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001230 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1231 ])
Tim Rice648f8762011-01-26 12:38:57 -08001232 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1233 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1234#include <stdio.h>
1235#include <skey.h>
1236 ]], [[
1237 (void)skeychallenge(NULL,"name","",0);
1238 ]])],
1239 [
1240 AC_MSG_RESULT([yes])
1241 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001242 [Define if your skeychallenge()
1243 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001244 [
1245 AC_MSG_RESULT([no])
1246 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001247 fi
1248 ]
1249)
1250
1251# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001252TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001253AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001254 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001255 [
1256 if test "x$withval" != "xno" ; then
1257 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001258 saved_LDFLAGS="$LDFLAGS"
1259 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001260 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001261 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001262 if test -d "${withval}/lib"; then
1263 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001264 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001265 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001266 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001267 fi
1268 else
1269 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001270 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001271 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001272 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001273 fi
1274 fi
1275 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001276 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001277 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001278 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001279 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001280 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001281 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001282 AC_MSG_CHECKING([for libwrap])
1283 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001284#include <sys/types.h>
1285#include <sys/socket.h>
1286#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001287#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001288int deny_severity = 0, allow_severity = 0;
1289 ]], [[
1290 hosts_access(0);
1291 ]])], [
1292 AC_MSG_RESULT([yes])
1293 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001294 [Define if you want
1295 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001296 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001297 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001298 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001299 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001300
1301 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001302 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001303 fi
1304 ]
1305)
1306
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001307# Check whether user wants libedit support
1308LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001309AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001310 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001311 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001312 if test "x$withval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001313 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001314 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001315 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001316 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001317 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001318 use_pkgconfig_for_libedit=yes
1319 else
Tim Rice648f8762011-01-26 12:38:57 -08001320 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001321 fi
1322 fi
1323 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001324 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1325 if test -n "${need_dash_r}"; then
1326 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1327 else
1328 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1329 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001330 fi
Damien Miller1f789802010-10-11 22:35:22 +11001331 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001332 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1333 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1334 else
1335 LIBEDIT="-ledit -lcurses"
1336 fi
1337 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001338 AC_CHECK_LIB([edit], [el_init],
1339 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001340 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001341 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001342 ],
Tim Rice648f8762011-01-26 12:38:57 -08001343 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001344 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001345 )
Tim Rice648f8762011-01-26 12:38:57 -08001346 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001347 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001348 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1349 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001350 int i = H_SETSIZE;
1351 el_init("", NULL, NULL, NULL);
1352 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001353 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001354 [ AC_MSG_RESULT([yes]) ],
1355 [ AC_MSG_RESULT([no])
1356 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001357 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001358 fi ]
1359)
1360
Darren Tuckerd9f88912005-02-20 21:01:48 +11001361AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001362AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001363 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001364 [
Tim Rice648f8762011-01-26 12:38:57 -08001365 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001366 case "$withval" in
1367 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001368 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001369 AUDIT_MODULE=bsm
1370 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001371 AC_CHECK_HEADERS([bsm/audit.h], [],
1372 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001373 [
1374#ifdef HAVE_TIME_H
1375# include <time.h>
1376#endif
1377 ]
1378)
Tim Rice648f8762011-01-26 12:38:57 -08001379 AC_CHECK_LIB([bsm], [getaudit], [],
1380 [AC_MSG_ERROR([BSM enabled and required library not found])])
1381 AC_CHECK_FUNCS([getaudit], [],
1382 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001383 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001384 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1385 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001386 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001387 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001388 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001389 AUDIT_MODULE=linux
1390 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001391 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001392 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001393 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001394 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001395 debug)
1396 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001397 AC_MSG_RESULT([debug])
1398 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001399 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001400 no)
Tim Rice648f8762011-01-26 12:38:57 -08001401 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001402 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001403 *)
1404 AC_MSG_ERROR([Unknown audit module $withval])
1405 ;;
1406 esac ]
1407)
1408
Damien Millerfe1f1432003-02-24 15:45:42 +11001409dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001410AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001411 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001412 arc4random_buf \
1413 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001414 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001415 b64_ntop \
1416 __b64_ntop \
1417 b64_pton \
1418 __b64_pton \
1419 bcopy \
1420 bindresvport_sa \
1421 clock \
1422 closefrom \
1423 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001424 fchmod \
1425 fchown \
1426 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001427 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001428 futimes \
1429 getaddrinfo \
1430 getcwd \
1431 getgrouplist \
1432 getnameinfo \
1433 getopt \
1434 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001435 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001436 _getpty \
1437 getrlimit \
1438 getttyent \
1439 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001440 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001441 inet_aton \
1442 inet_ntoa \
1443 inet_ntop \
1444 innetgr \
1445 login_getcapbool \
1446 md5_crypt \
1447 memmove \
1448 mkdtemp \
1449 mmap \
1450 ngetaddrinfo \
1451 nsleep \
1452 ogetaddrinfo \
1453 openlog_r \
1454 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001455 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001456 prctl \
1457 pstat \
1458 readpassphrase \
1459 realpath \
1460 recvmsg \
1461 rresvport_af \
1462 sendmsg \
1463 setdtablesize \
1464 setegid \
1465 setenv \
1466 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001467 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001468 setgroups \
1469 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001470 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001471 setpcred \
1472 setproctitle \
1473 setregid \
1474 setreuid \
1475 setrlimit \
1476 setsid \
1477 setvbuf \
1478 sigaction \
1479 sigvec \
1480 snprintf \
1481 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001482 statfs \
1483 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001484 strdup \
1485 strerror \
1486 strlcat \
1487 strlcpy \
1488 strmode \
1489 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001490 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001491 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001492 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001493 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001494 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001495 sysconf \
1496 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001497 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001498 truncate \
1499 unsetenv \
1500 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001501 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001502 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001503 vhangup \
1504 vsnprintf \
1505 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001506])
Tim Rice13aae5e2001-10-21 17:53:58 -07001507
Tim Ricec7a8af02010-11-08 14:26:23 -08001508AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001509 [AC_LANG_PROGRAM(
1510 [[ #include <ctype.h> ]],
1511 [[ return (isblank('a')); ]])],
1512 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001513])
1514
Damien Millerb3c9f782010-02-12 10:11:34 +11001515# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001516AC_SEARCH_LIBS([dlopen], [dl],
1517 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001518)
1519
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001520# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001521AC_CHECK_FUNCS([gai_strerror], [
1522 AC_DEFINE([HAVE_GAI_STRERROR])
1523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001524#include <sys/types.h>
1525#include <sys/socket.h>
1526#include <netdb.h>
1527
Tim Rice648f8762011-01-26 12:38:57 -08001528const char *gai_strerror(int);
1529 ]], [[
1530 char *str;
1531 str = gai_strerror(0);
1532 ]])], [
1533 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1534 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001535
Tim Rice648f8762011-01-26 12:38:57 -08001536AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1537 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001538
Darren Tuckerf1159b52003-07-07 19:44:01 +10001539dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001540AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1541AC_CHECK_DECL([strsep],
1542 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001543 [],
1544 [
1545#ifdef HAVE_STRING_H
1546# include <string.h>
1547#endif
1548 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001549
Darren Tuckerb2427c82003-09-10 15:22:44 +10001550dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001551AC_CHECK_DECL([tcsendbreak],
1552 [AC_DEFINE([HAVE_TCSENDBREAK])],
1553 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001554 [#include <termios.h>]
1555)
1556
Tim Rice648f8762011-01-26 12:38:57 -08001557AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001558
Tim Rice648f8762011-01-26 12:38:57 -08001559AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001560 [
1561#include <sys/types.h>
1562#include <sys/socket.h>
1563 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001564
Tim Rice648f8762011-01-26 12:38:57 -08001565AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001566 [
1567#include <sys/types.h>
1568#ifdef HAVE_SYS_STAT_H
1569# include <sys/stat.h>
1570#endif
1571#ifdef HAVE_FCNTL_H
1572# include <fcntl.h>
1573#endif
1574 ])
1575
Tim Rice648f8762011-01-26 12:38:57 -08001576AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001577#include <sys/types.h>
1578#include <sys/uio.h>
1579#include <unistd.h>
1580 ])
1581
Tim Rice648f8762011-01-26 12:38:57 -08001582AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001583#include <sys/param.h>
1584 ])
1585
Tim Rice648f8762011-01-26 12:38:57 -08001586AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001587#include <stddef.h>
1588 ])
1589
Tim Rice648f8762011-01-26 12:38:57 -08001590AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001591 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001592 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001593 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001594 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001595#include <stdlib.h>
1596#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001597 ]], [[
1598 errno=0;
1599 setresuid(0,0,0);
1600 if (errno==ENOSYS)
1601 exit(1);
1602 else
1603 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001604 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001605 [AC_MSG_RESULT([yes])],
1606 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001607 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001608 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001609 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001610 )
1611])
Darren Tuckere937be32003-12-17 18:53:26 +11001612
Tim Rice648f8762011-01-26 12:38:57 -08001613AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001614 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001615 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001616 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001617 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001618#include <stdlib.h>
1619#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001620 ]], [[
1621 errno=0;
1622 setresgid(0,0,0);
1623 if (errno==ENOSYS)
1624 exit(1);
1625 else
1626 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001627 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001628 [AC_MSG_RESULT([yes])],
1629 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001630 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001631 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001632 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001633 )
1634])
Darren Tuckere937be32003-12-17 18:53:26 +11001635
Damien Millerad833b32000-08-23 10:46:23 +10001636dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001637AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001638dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001639AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1640AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001641dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001642AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1643AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001644dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001645AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001646
Tim Rice648f8762011-01-26 12:38:57 -08001647AC_CHECK_FUNC([daemon],
1648 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1649 [AC_CHECK_LIB([bsd], [daemon],
1650 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001651)
1652
Tim Rice648f8762011-01-26 12:38:57 -08001653AC_CHECK_FUNC([getpagesize],
1654 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001655 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001656 [AC_CHECK_LIB([ucb], [getpagesize],
1657 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001658)
1659
Damien Millercb170cb2000-07-01 16:52:55 +10001660# Check for broken snprintf
1661if test "x$ac_cv_func_snprintf" = "xyes" ; then
1662 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001663 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001664 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1665 [[
1666 char b[5];
1667 snprintf(b,5,"123456789");
1668 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001669 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001670 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001671 [
Tim Rice648f8762011-01-26 12:38:57 -08001672 AC_MSG_RESULT([no])
1673 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001674 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001675 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001676 ],
1677 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001678 )
1679fi
1680
Damien Miller57f39152005-11-24 19:58:19 +11001681# If we don't have a working asprintf, then we strongly depend on vsnprintf
1682# returning the right thing on overflow: the number of characters it tried to
1683# create (as per SUSv3)
1684if test "x$ac_cv_func_asprintf" != "xyes" && \
1685 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1686 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1687 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001688 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001689#include <sys/types.h>
1690#include <stdio.h>
1691#include <stdarg.h>
1692
1693int x_snprintf(char *str,size_t count,const char *fmt,...)
1694{
1695 size_t ret; va_list ap;
1696 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1697 return ret;
1698}
Tim Rice648f8762011-01-26 12:38:57 -08001699 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001700 char x[1];
1701 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001702 ]])],
1703 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001704 [
Tim Rice648f8762011-01-26 12:38:57 -08001705 AC_MSG_RESULT([no])
1706 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001707 [Define if your snprintf is busted])
1708 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1709 ],
1710 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1711 )
1712fi
1713
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001714# On systems where [v]snprintf is broken, but is declared in stdio,
1715# check that the fmt argument is const char * or just char *.
1716# This is only useful for when BROKEN_SNPRINTF
1717AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001718AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1719#include <stdio.h>
1720int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1721 ]], [[
1722 snprintf(0, 0, 0);
1723 ]])],
1724 [AC_MSG_RESULT([yes])
1725 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001726 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001727 [AC_MSG_RESULT([no])
1728 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001729
Damien Millerb4097182004-05-23 14:09:40 +10001730# Check for missing getpeereid (or equiv) support
1731NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001732if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001733 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001734 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1735#include <sys/types.h>
1736#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1737 [ AC_MSG_RESULT([yes])
1738 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1739 ], [AC_MSG_RESULT([no])
1740 NO_PEERCHECK=1
1741 ])
Damien Millerb4097182004-05-23 14:09:40 +10001742fi
1743
Damien Millere8328192003-01-07 15:18:32 +11001744dnl see whether mkstemp() requires XXXXXX
1745if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1746AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001747AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001748 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001749#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001750 ]], [[
1751 char template[]="conftest.mkstemp-test";
1752 if (mkstemp(template) == -1)
1753 exit(1);
1754 unlink(template);
1755 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001756 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001757 [
Tim Rice648f8762011-01-26 12:38:57 -08001758 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001759 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001760 [
Tim Rice648f8762011-01-26 12:38:57 -08001761 AC_MSG_RESULT([yes])
1762 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001763 ],
1764 [
Tim Rice648f8762011-01-26 12:38:57 -08001765 AC_MSG_RESULT([yes])
1766 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001767 ]
Damien Millere8328192003-01-07 15:18:32 +11001768)
1769fi
1770
Darren Tucker70a3d552003-08-21 17:58:29 +10001771dnl make sure that openpty does not reacquire controlling terminal
1772if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001773 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001774 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001775 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001776#include <stdio.h>
1777#include <sys/fcntl.h>
1778#include <sys/types.h>
1779#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001780 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001781 pid_t pid;
1782 int fd, ptyfd, ttyfd, status;
1783
1784 pid = fork();
1785 if (pid < 0) { /* failed */
1786 exit(1);
1787 } else if (pid > 0) { /* parent */
1788 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001789 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001790 exit(WEXITSTATUS(status));
1791 else
1792 exit(2);
1793 } else { /* child */
1794 close(0); close(1); close(2);
1795 setsid();
1796 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1797 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1798 if (fd >= 0)
1799 exit(3); /* Acquired ctty: broken */
1800 else
1801 exit(0); /* Did not acquire ctty: OK */
1802 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001803 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001804 [
Tim Rice648f8762011-01-26 12:38:57 -08001805 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001806 ],
1807 [
Tim Rice648f8762011-01-26 12:38:57 -08001808 AC_MSG_RESULT([no])
1809 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001810 ],
1811 [
Tim Rice648f8762011-01-26 12:38:57 -08001812 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001813 ]
1814 )
1815fi
1816
Tim Rice8bb561b2005-03-17 16:23:19 -08001817if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1818 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001819 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001820 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001821 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001822#include <stdio.h>
1823#include <sys/socket.h>
1824#include <netdb.h>
1825#include <errno.h>
1826#include <netinet/in.h>
1827
1828#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001829 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001830 int err, sock;
1831 struct addrinfo *gai_ai, *ai, hints;
1832 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1833
1834 memset(&hints, 0, sizeof(hints));
1835 hints.ai_family = PF_UNSPEC;
1836 hints.ai_socktype = SOCK_STREAM;
1837 hints.ai_flags = AI_PASSIVE;
1838
1839 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1840 if (err != 0) {
1841 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1842 exit(1);
1843 }
1844
1845 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1846 if (ai->ai_family != AF_INET6)
1847 continue;
1848
1849 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1850 sizeof(ntop), strport, sizeof(strport),
1851 NI_NUMERICHOST|NI_NUMERICSERV);
1852
1853 if (err != 0) {
1854 if (err == EAI_SYSTEM)
1855 perror("getnameinfo EAI_SYSTEM");
1856 else
1857 fprintf(stderr, "getnameinfo failed: %s\n",
1858 gai_strerror(err));
1859 exit(2);
1860 }
1861
1862 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1863 if (sock < 0)
1864 perror("socket");
1865 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1866 if (errno == EBADF)
1867 exit(3);
1868 }
1869 }
1870 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001871 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001872 [
Tim Rice648f8762011-01-26 12:38:57 -08001873 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001874 ],
1875 [
Tim Rice648f8762011-01-26 12:38:57 -08001876 AC_MSG_RESULT([no])
1877 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001878 ],
1879 [
Tim Rice648f8762011-01-26 12:38:57 -08001880 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001881 ]
1882 )
1883fi
1884
Tim Rice8bb561b2005-03-17 16:23:19 -08001885if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1886 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001887 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001888 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001889 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11001890#include <stdio.h>
1891#include <sys/socket.h>
1892#include <netdb.h>
1893#include <errno.h>
1894#include <netinet/in.h>
1895
1896#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001897 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11001898 int err, sock;
1899 struct addrinfo *gai_ai, *ai, hints;
1900 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1901
1902 memset(&hints, 0, sizeof(hints));
1903 hints.ai_family = PF_UNSPEC;
1904 hints.ai_socktype = SOCK_STREAM;
1905 hints.ai_flags = AI_PASSIVE;
1906
1907 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1908 if (err != 0) {
1909 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1910 exit(1);
1911 }
1912
1913 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1914 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1915 continue;
1916
1917 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1918 sizeof(ntop), strport, sizeof(strport),
1919 NI_NUMERICHOST|NI_NUMERICSERV);
1920
1921 if (ai->ai_family == AF_INET && err != 0) {
1922 perror("getnameinfo");
1923 exit(2);
1924 }
1925 }
1926 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001927 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001928 [
Tim Rice648f8762011-01-26 12:38:57 -08001929 AC_MSG_RESULT([yes])
1930 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001931 [Define if you have a getaddrinfo that fails
1932 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001933 ],
1934 [
Tim Rice648f8762011-01-26 12:38:57 -08001935 AC_MSG_RESULT([no])
1936 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001937 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001938 [
Tim Rice648f8762011-01-26 12:38:57 -08001939 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11001940 ]
1941 )
1942fi
1943
Darren Tuckera56f1912004-11-02 20:30:54 +11001944if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001945 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
1946 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
1947 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11001948 [
Tim Rice648f8762011-01-26 12:38:57 -08001949 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11001950 ],
1951 [
Tim Rice648f8762011-01-26 12:38:57 -08001952 AC_MSG_RESULT([yes])
1953 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11001954 [Conflicting defs for getspnam])
1955 ]
1956 )
1957fi
1958
Damien Miller606f8802000-09-16 15:39:56 +11001959AC_FUNC_GETPGRP
1960
Tim Riceaef73712002-05-11 13:17:42 -07001961# Search for OpenSSL
1962saved_CPPFLAGS="$CPPFLAGS"
1963saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08001964AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11001965 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1966 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001967 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001968 case "$withval" in
1969 # Relative paths
1970 ./*|../*) withval="`pwd`/$withval"
1971 esac
Tim Riceaef73712002-05-11 13:17:42 -07001972 if test -d "$withval/lib"; then
1973 if test -n "${need_dash_r}"; then
1974 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1975 else
1976 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1977 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10001978 elif test -d "$withval/lib64"; then
1979 if test -n "${need_dash_r}"; then
1980 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
1981 else
1982 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
1983 fi
Tim Riceaef73712002-05-11 13:17:42 -07001984 else
1985 if test -n "${need_dash_r}"; then
1986 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1987 else
1988 LDFLAGS="-L${withval} ${LDFLAGS}"
1989 fi
1990 fi
1991 if test -d "$withval/include"; then
1992 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1993 else
1994 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1995 fi
Damien Millera22ba012000-03-02 23:09:20 +11001996 fi
1997 ]
1998)
Tim Rice3d5352e2004-02-12 09:27:21 -08001999LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002000AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002001 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002002 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002003 [
Tim Riceaef73712002-05-11 13:17:42 -07002004 dnl Check default openssl install dir
2005 if test -n "${need_dash_r}"; then
2006 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002007 else
Tim Riceaef73712002-05-11 13:17:42 -07002008 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002009 fi
Tim Riceaef73712002-05-11 13:17:42 -07002010 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002011 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002012 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2013 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002014 [
2015 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2016 ]
2017 )
2018 ]
2019)
2020
Tim Riced730b782002-08-13 18:52:10 -07002021# Determine OpenSSL header version
2022AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002023AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002024 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002025#include <stdio.h>
2026#include <string.h>
2027#include <openssl/opensslv.h>
2028#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002029 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002030 FILE *fd;
2031 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002032
Damien Millera8e06ce2003-11-21 23:48:55 +11002033 fd = fopen(DATA,"w");
2034 if(fd == NULL)
2035 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002036
2037 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2038 exit(1);
2039
2040 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002041 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002042 [
2043 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002044 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002045 ],
2046 [
Tim Rice648f8762011-01-26 12:38:57 -08002047 AC_MSG_RESULT([not found])
2048 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002049 ],
2050 [
2051 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002052 ]
2053)
2054
2055# Determine OpenSSL library version
2056AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002057AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002058 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002059#include <stdio.h>
2060#include <string.h>
2061#include <openssl/opensslv.h>
2062#include <openssl/crypto.h>
2063#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002064 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002065 FILE *fd;
2066 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002067
Damien Millera8e06ce2003-11-21 23:48:55 +11002068 fd = fopen(DATA,"w");
2069 if(fd == NULL)
2070 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002071
2072 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2073 exit(1);
2074
2075 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002076 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002077 [
2078 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002079 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002080 ],
2081 [
Tim Rice648f8762011-01-26 12:38:57 -08002082 AC_MSG_RESULT([not found])
2083 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002084 ],
2085 [
2086 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002087 ]
2088)
Damien Millera22ba012000-03-02 23:09:20 +11002089
Tim Rice648f8762011-01-26 12:38:57 -08002090AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002091 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2092 [ if test "x$withval" = "xno" ; then
2093 openssl_check_nonfatal=1
2094 fi
2095 ]
2096)
2097
Damien Millerec932372002-01-22 22:16:03 +11002098# Sanity check OpenSSL headers
2099AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002100AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002101 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002102#include <string.h>
2103#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002104 ]], [[
2105 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002106 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002107 [
Tim Rice648f8762011-01-26 12:38:57 -08002108 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002109 ],
2110 [
Tim Rice648f8762011-01-26 12:38:57 -08002111 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002112 if test "x$openssl_check_nonfatal" = "x"; then
2113 AC_MSG_ERROR([Your OpenSSL headers do not match your
2114library. Check config.log for details.
2115If you are sure your installation is consistent, you can disable the check
2116by running "./configure --without-openssl-header-check".
2117Also see contrib/findssl.sh for help identifying header/library mismatches.
2118])
2119 else
2120 AC_MSG_WARN([Your OpenSSL headers do not match your
2121library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002122Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002123 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002124 ],
2125 [
2126 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002127 ]
2128)
2129
Darren Tucker639bbe82006-08-20 20:17:53 +10002130AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2131AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002132 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2133 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002134 [
Tim Rice648f8762011-01-26 12:38:57 -08002135 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002136 ],
2137 [
Tim Rice648f8762011-01-26 12:38:57 -08002138 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002139 saved_LIBS="$LIBS"
2140 LIBS="$LIBS -ldl"
2141 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2142 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002143 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2144 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002145 [
Tim Rice648f8762011-01-26 12:38:57 -08002146 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002147 ],
2148 [
Tim Rice648f8762011-01-26 12:38:57 -08002149 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002150 LIBS="$saved_LIBS"
2151 ]
2152 )
2153 ]
2154)
2155
Tim Rice648f8762011-01-26 12:38:57 -08002156AC_CHECK_FUNCS([RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex RSA_get_default_method])
Darren Tuckerebdef762010-12-04 23:20:50 +11002157
Tim Rice648f8762011-01-26 12:38:57 -08002158AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002159 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2160 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002161 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2162 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2163#include <openssl/engine.h>
2164 ]], [[
2165 ENGINE_load_builtin_engines();
2166 ENGINE_register_all_complete();
2167 ]])],
2168 [ AC_MSG_RESULT([yes])
2169 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002170 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002171 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2172 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002173 fi ]
2174)
2175
Darren Tucker129d0bb2005-12-19 17:40:40 +11002176# Check for OpenSSL without EVP_aes_{192,256}_cbc
2177AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002178AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002179 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002180#include <string.h>
2181#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002182 ]], [[
2183 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002184 ]])],
2185 [
Tim Rice648f8762011-01-26 12:38:57 -08002186 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002187 ],
2188 [
Tim Rice648f8762011-01-26 12:38:57 -08002189 AC_MSG_RESULT([yes])
2190 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002191 [libcrypto is missing AES 192 and 256 bit functions])
2192 ]
2193)
2194
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002195AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2196AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002197 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002198#include <string.h>
2199#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002200 ]], [[
2201 if(EVP_DigestUpdate(NULL, NULL,0))
2202 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002203 ]])],
2204 [
Tim Rice648f8762011-01-26 12:38:57 -08002205 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002206 ],
2207 [
Tim Rice648f8762011-01-26 12:38:57 -08002208 AC_MSG_RESULT([no])
2209 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002210 [Define if EVP_DigestUpdate returns void])
2211 ]
2212)
2213
Tim Rice3d5352e2004-02-12 09:27:21 -08002214# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2215# because the system crypt() is more featureful.
2216if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002217 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002218fi
2219
Damien Millera8e06ce2003-11-21 23:48:55 +11002220# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002221# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002222if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002223 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002224fi
2225
Damien Milleraf87af12006-03-15 13:02:28 +11002226# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002227AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002228 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002229AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002230
Damien Miller6af914a2010-09-10 11:39:26 +10002231# Check complete ECC support in OpenSSL
2232AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2233AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002234 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002235#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002236#include <openssl/ecdh.h>
2237#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002238#include <openssl/evp.h>
2239#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002240#include <openssl/opensslv.h>
2241#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2242# error "OpenSSL < 0.9.8g has unreliable ECC code"
2243#endif
Tim Rice648f8762011-01-26 12:38:57 -08002244 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002245 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2246 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002247 ]])],
2248 [
Tim Rice648f8762011-01-26 12:38:57 -08002249 AC_MSG_RESULT([yes])
2250 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002251 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002252 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002253 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002254 ],
2255 [
Tim Rice648f8762011-01-26 12:38:57 -08002256 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002257 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002258 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002259 ]
2260)
Tim Rice648f8762011-01-26 12:38:57 -08002261AC_SUBST([TEST_SSH_ECC])
2262AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002263
Tim Rice99203ec2007-03-26 09:35:28 -07002264saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002265AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002266 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002267 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2268 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002269 [Define if system has libiaf that supports set_id])
2270 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002271])
2272LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002273
2274### Configure cryptographic random number support
2275
2276# Check wheter OpenSSL seeds itself
2277AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002278AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002279 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002280#include <string.h>
2281#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002282 ]], [[
2283 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002284 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002285 [
2286 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002287 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002288 ],
2289 [
Tim Rice648f8762011-01-26 12:38:57 -08002290 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002291 ],
2292 [
2293 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002294 # This is safe, since we will fatal() at runtime if
2295 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002296 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002297 ]
2298)
2299
Damien Millerf22019b2011-05-05 13:48:37 +10002300# PRNGD TCP socket
2301AC_ARG_WITH([prngd-port],
2302 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2303 [
2304 case "$withval" in
2305 no)
2306 withval=""
2307 ;;
2308 [[0-9]]*)
2309 ;;
2310 *)
2311 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2312 ;;
2313 esac
2314 if test ! -z "$withval" ; then
2315 PRNGD_PORT="$withval"
2316 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2317 [Port number of PRNGD/EGD random number socket])
2318 fi
2319 ]
2320)
2321
2322# PRNGD Unix domain socket
2323AC_ARG_WITH([prngd-socket],
2324 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2325 [
2326 case "$withval" in
2327 yes)
2328 withval="/var/run/egd-pool"
2329 ;;
2330 no)
2331 withval=""
2332 ;;
2333 /*)
2334 ;;
2335 *)
2336 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2337 ;;
2338 esac
2339
2340 if test ! -z "$withval" ; then
2341 if test ! -z "$PRNGD_PORT" ; then
2342 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2343 fi
2344 if test ! -r "$withval" ; then
2345 AC_MSG_WARN([Entropy socket is not readable])
2346 fi
2347 PRNGD_SOCKET="$withval"
2348 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2349 [Location of PRNGD/EGD random number socket])
2350 fi
2351 ],
2352 [
2353 # Check for existing socket only if we don't have a random device already
2354 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2355 AC_MSG_CHECKING([for PRNGD/EGD socket])
2356 # Insert other locations here
2357 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2358 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2359 PRNGD_SOCKET="$sock"
2360 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2361 break;
2362 fi
2363 done
2364 if test ! -z "$PRNGD_SOCKET" ; then
2365 AC_MSG_RESULT([$PRNGD_SOCKET])
2366 else
2367 AC_MSG_RESULT([not found])
2368 fi
2369 fi
2370 ]
2371)
2372
2373# Which randomness source do we use?
2374if test ! -z "$PRNGD_PORT" ; then
2375 RAND_MSG="PRNGd port $PRNGD_PORT"
2376elif test ! -z "$PRNGD_SOCKET" ; then
2377 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2378elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2379 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2380 [Define if you want OpenSSL's internally seeded PRNG only])
2381 RAND_MSG="OpenSSL internal ONLY"
2382else
2383 AC_MSG_ERROR([OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options])
2384fi
2385
Darren Tucker3e6bde42006-08-20 20:03:50 +10002386# Check for PAM libs
2387PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002388AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002389 [ --with-pam Enable PAM support ],
2390 [
2391 if test "x$withval" != "xno" ; then
2392 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2393 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2394 AC_MSG_ERROR([PAM headers not found])
2395 fi
2396
2397 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002398 AC_CHECK_LIB([dl], [dlopen], , )
2399 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2400 AC_CHECK_FUNCS([pam_getenvlist])
2401 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002402 LIBS="$saved_LIBS"
2403
2404 PAM_MSG="yes"
2405
Darren Tucker20e9f972007-03-25 18:26:01 +10002406 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002407 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002408 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002409
Darren Tucker3e6bde42006-08-20 20:03:50 +10002410 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002411 case "$LIBS" in
2412 *-ldl*)
2413 # libdl already in LIBS
2414 ;;
2415 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002416 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002417 ;;
2418 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002419 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002420 fi
2421 ]
2422)
2423
2424# Check for older PAM
2425if test "x$PAM_MSG" = "xyes" ; then
2426 # Check PAM strerror arguments (old PAM)
2427 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002428 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002429#include <stdlib.h>
2430#if defined(HAVE_SECURITY_PAM_APPL_H)
2431#include <security/pam_appl.h>
2432#elif defined (HAVE_PAM_PAM_APPL_H)
2433#include <pam/pam_appl.h>
2434#endif
Tim Rice648f8762011-01-26 12:38:57 -08002435 ]], [[
2436(void)pam_strerror((pam_handle_t *)NULL, -1);
2437 ]])], [AC_MSG_RESULT([no])], [
2438 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002439 [Define if you have an old version of PAM
2440 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002441 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002442 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002443
2444 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002445fi
Damien Miller6c21c512002-01-22 21:57:53 +11002446
Damien Millerd3f6ad22002-06-25 10:24:47 +10002447SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002448AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002449 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002450 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002451 if test -n "$withval" && test "x$withval" != "xno" && \
2452 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002453 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002454 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002455 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002456)
Tim Rice648f8762011-01-26 12:38:57 -08002457AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002458 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002459AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002460
Ben Lindstromb5628642000-10-18 00:02:25 +00002461# Cheap hack to ensure NEWS-OS libraries are arranged right.
2462if test ! -z "$SONY" ; then
2463 LIBS="$LIBS -liberty";
2464fi
2465
Damien Miller57f39152005-11-24 19:58:19 +11002466# Check for long long datatypes
2467AC_CHECK_TYPES([long long, unsigned long long, long double])
2468
2469# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002470AC_CHECK_SIZEOF([char], [1])
2471AC_CHECK_SIZEOF([short int], [2])
2472AC_CHECK_SIZEOF([int], [4])
2473AC_CHECK_SIZEOF([long int], [4])
2474AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002475
Damien Millerfa2bb692002-04-23 23:22:25 +10002476# Sanity check long long for some platforms (AIX)
2477if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2478 ac_cv_sizeof_long_long_int=0
2479fi
2480
Darren Tucker537f1ed2005-10-25 18:38:33 +10002481# compute LLONG_MIN and LLONG_MAX if we don't know them.
2482if test -z "$have_llong_max"; then
2483 AC_MSG_CHECKING([for max value of long long])
2484 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002485 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002486#include <stdio.h>
2487/* Why is this so damn hard? */
2488#ifdef __GNUC__
2489# undef __GNUC__
2490#endif
2491#define __USE_ISOC99
2492#include <limits.h>
2493#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002494#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2495
2496/*
2497 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2498 * we do this the hard way.
2499 */
2500static int
2501fprint_ll(FILE *f, long long n)
2502{
2503 unsigned int i;
2504 int l[sizeof(long long) * 8];
2505
2506 if (n < 0)
2507 if (fprintf(f, "-") < 0)
2508 return -1;
2509 for (i = 0; n != 0; i++) {
2510 l[i] = my_abs(n % 10);
2511 n /= 10;
2512 }
2513 do {
2514 if (fprintf(f, "%d", l[--i]) < 0)
2515 return -1;
2516 } while (i != 0);
2517 if (fprintf(f, " ") < 0)
2518 return -1;
2519 return 0;
2520}
Tim Rice648f8762011-01-26 12:38:57 -08002521 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002522 FILE *f;
2523 long long i, llmin, llmax = 0;
2524
2525 if((f = fopen(DATA,"w")) == NULL)
2526 exit(1);
2527
2528#if defined(LLONG_MIN) && defined(LLONG_MAX)
2529 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2530 llmin = LLONG_MIN;
2531 llmax = LLONG_MAX;
2532#else
2533 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2534 /* This will work on one's complement and two's complement */
2535 for (i = 1; i > llmax; i <<= 1, i++)
2536 llmax = i;
2537 llmin = llmax + 1LL; /* wrap */
2538#endif
2539
2540 /* Sanity check */
2541 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002542 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2543 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002544 fprintf(f, "unknown unknown\n");
2545 exit(2);
2546 }
2547
Darren Tuckerd1450db2006-03-13 19:06:51 +11002548 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002549 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002550 if (fprint_ll(f, llmax) < 0)
2551 exit(4);
2552 if (fclose(f) < 0)
2553 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002554 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002555 ]])],
2556 [
2557 llong_min=`$AWK '{print $1}' conftest.llminmax`
2558 llong_max=`$AWK '{print $2}' conftest.llminmax`
2559
Tim Rice648f8762011-01-26 12:38:57 -08002560 AC_MSG_RESULT([$llong_max])
2561 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002562 [max value of long long calculated by configure])
2563 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002564 AC_MSG_RESULT([$llong_min])
2565 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002566 [min value of long long calculated by configure])
2567 ],
2568 [
Tim Rice648f8762011-01-26 12:38:57 -08002569 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002570 ],
2571 [
2572 AC_MSG_WARN([cross compiling: not checking])
2573 ]
2574 )
2575fi
2576
2577
Damien Millera22ba012000-03-02 23:09:20 +11002578# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002579AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2581 [[ u_int a; a = 1;]])],
2582 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2583 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002584])
2585if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002586 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002587 have_u_int=1
2588fi
2589
Damien Miller61e50f12000-05-08 20:49:37 +10002590AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002591 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2592 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2593 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2594 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002595])
2596if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002597 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002598 have_intxx_t=1
2599fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002600
2601if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002602 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002603then
2604 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002605 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2606 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002607 [
Tim Rice648f8762011-01-26 12:38:57 -08002608 AC_DEFINE([HAVE_INTXX_T])
2609 AC_MSG_RESULT([yes])
2610 ], [ AC_MSG_RESULT([no])
2611 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002612fi
2613
Damien Miller578783e2000-09-23 14:12:24 +11002614AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002615 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002616#include <sys/types.h>
2617#ifdef HAVE_STDINT_H
2618# include <stdint.h>
2619#endif
2620#include <sys/socket.h>
2621#ifdef HAVE_SYS_BITYPES_H
2622# include <sys/bitypes.h>
2623#endif
Tim Rice648f8762011-01-26 12:38:57 -08002624 ]], [[
2625int64_t a; a = 1;
2626 ]])],
2627 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2628 ])
Damien Miller578783e2000-09-23 14:12:24 +11002629])
2630if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002631 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002632fi
2633
Damien Miller61e50f12000-05-08 20:49:37 +10002634AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2636 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2637 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2638 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002639])
2640if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002641 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002642 have_u_intxx_t=1
2643fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002644
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002645if test -z "$have_u_intxx_t" ; then
2646 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002647 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2648 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002649 [
Tim Rice648f8762011-01-26 12:38:57 -08002650 AC_DEFINE([HAVE_U_INTXX_T])
2651 AC_MSG_RESULT([yes])
2652 ], [ AC_MSG_RESULT([no])
2653 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002654fi
2655
Damien Miller578783e2000-09-23 14:12:24 +11002656AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002657 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2658 [[ u_int64_t a; a = 1;]])],
2659 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2660 ])
Damien Miller578783e2000-09-23 14:12:24 +11002661])
2662if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002663 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002664 have_u_int64_t=1
2665fi
2666
Tim Rice4cec93f2002-02-26 08:40:48 -08002667if test -z "$have_u_int64_t" ; then
2668 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002669 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2670 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002671 [
Tim Rice648f8762011-01-26 12:38:57 -08002672 AC_DEFINE([HAVE_U_INT64_T])
2673 AC_MSG_RESULT([yes])
2674 ], [ AC_MSG_RESULT([no])
2675 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002676fi
2677
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002678if test -z "$have_u_intxx_t" ; then
2679 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002680 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002681#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002682 ]], [[
2683 uint8_t a;
2684 uint16_t b;
2685 uint32_t c;
2686 a = b = c = 1;
2687 ]])],
2688 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2689 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002690 ])
2691 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002692 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002693 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002694 fi
2695fi
2696
2697if test -z "$have_uintxx_t" ; then
2698 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002699 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2700 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002701 [
Tim Rice648f8762011-01-26 12:38:57 -08002702 AC_DEFINE([HAVE_UINTXX_T])
2703 AC_MSG_RESULT([yes])
2704 ], [ AC_MSG_RESULT([no])
2705 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002706fi
2707
Damien Milleredb82922000-06-20 13:25:52 +10002708if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002709 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002710then
2711 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002712 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002713#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002714 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002715 int8_t a; int16_t b; int32_t c;
2716 u_int8_t e; u_int16_t f; u_int32_t g;
2717 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002718 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002719 [
Tim Rice648f8762011-01-26 12:38:57 -08002720 AC_DEFINE([HAVE_U_INTXX_T])
2721 AC_DEFINE([HAVE_INTXX_T])
2722 AC_MSG_RESULT([yes])
2723 ], [AC_MSG_RESULT([no])
2724 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002725fi
2726
Damien Miller58be7382001-09-15 21:31:54 +10002727
2728AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002729 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2730 [[ u_char foo; foo = 125; ]])],
2731 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2732 ])
Damien Miller58be7382001-09-15 21:31:54 +10002733])
2734if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002735 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002736fi
2737
Tim Rice13aae5e2001-10-21 17:53:58 -07002738TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002739
Tim Rice648f8762011-01-26 12:38:57 -08002740AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2741AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002742#include <sys/types.h>
2743#ifdef HAVE_SYS_BITYPES_H
2744#include <sys/bitypes.h>
2745#endif
2746#ifdef HAVE_SYS_STATFS_H
2747#include <sys/statfs.h>
2748#endif
2749#ifdef HAVE_SYS_STATVFS_H
2750#include <sys/statvfs.h>
2751#endif
2752])
Tim Rice4cec93f2002-02-26 08:40:48 -08002753
Tim Rice648f8762011-01-26 12:38:57 -08002754AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002755[#include <sys/types.h>
2756#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002757
Damien Miller61e50f12000-05-08 20:49:37 +10002758AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002759 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2760 [[ size_t foo; foo = 1235; ]])],
2761 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2762 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002763])
2764if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002765 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002766fi
Damien Miller95058511999-12-29 10:36:45 +11002767
Damien Miller615f9392000-05-17 22:53:33 +10002768AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002769 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2770 [[ ssize_t foo; foo = 1235; ]])],
2771 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2772 ])
Damien Miller615f9392000-05-17 22:53:33 +10002773])
2774if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002775 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002776fi
2777
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002778AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2780 [[ clock_t foo; foo = 1235; ]])],
2781 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2782 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002783])
2784if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002785 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002786fi
2787
Damien Millerb54b40e2000-06-23 08:23:34 +10002788AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002789 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002790#include <sys/types.h>
2791#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002792 ]], [[ sa_family_t foo; foo = 1235; ]])],
2793 [ ac_cv_have_sa_family_t="yes" ],
2794 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002795#include <sys/types.h>
2796#include <sys/socket.h>
2797#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002798 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002799 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002800 [ ac_cv_have_sa_family_t="no" ]
2801 )
Tim Rice648f8762011-01-26 12:38:57 -08002802 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002803])
2804if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002805 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002806 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002807fi
2808
Damien Miller0f91b4e2000-06-18 15:43:25 +10002809AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002810 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2811 [[ pid_t foo; foo = 1235; ]])],
2812 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2813 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002814])
2815if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002816 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002817fi
2818
2819AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002820 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2821 [[ mode_t foo; foo = 1235; ]])],
2822 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2823 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002824])
2825if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002826 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002827fi
2828
Damien Miller61e50f12000-05-08 20:49:37 +10002829
2830AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002831 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002832#include <sys/types.h>
2833#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002834 ]], [[ struct sockaddr_storage s; ]])],
2835 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2836 [ ac_cv_have_struct_sockaddr_storage="no"
2837 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002838])
2839if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002840 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002841 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002842fi
Damien Miller34132e52000-01-14 15:45:46 +11002843
Damien Miller61e50f12000-05-08 20:49:37 +10002844AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002845 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002846#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002847#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002848 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2849 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2850 [ ac_cv_have_struct_sockaddr_in6="no"
2851 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002852])
2853if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002854 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002855 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002856fi
Damien Miller34132e52000-01-14 15:45:46 +11002857
Damien Miller61e50f12000-05-08 20:49:37 +10002858AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002859 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002860#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002861#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002862 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2863 [ ac_cv_have_struct_in6_addr="yes" ],
2864 [ ac_cv_have_struct_in6_addr="no"
2865 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002866])
2867if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002868 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002869 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002870
2871dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002872 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002873 [
2874#ifdef HAVE_SYS_TYPES_H
2875#include <sys/types.h>
2876#endif
2877#include <netinet/in.h>
2878 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002879fi
Damien Miller34132e52000-01-14 15:45:46 +11002880
Damien Miller61e50f12000-05-08 20:49:37 +10002881AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002882 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002883#include <sys/types.h>
2884#include <sys/socket.h>
2885#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002886 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2887 [ ac_cv_have_struct_addrinfo="yes" ],
2888 [ ac_cv_have_struct_addrinfo="no"
2889 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002890])
2891if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002892 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002893 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002894fi
2895
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002896AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002897 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2898 [[ struct timeval tv; tv.tv_sec = 1;]])],
2899 [ ac_cv_have_struct_timeval="yes" ],
2900 [ ac_cv_have_struct_timeval="no"
2901 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002902])
2903if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002904 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002905 have_struct_timeval=1
2906fi
2907
Tim Rice648f8762011-01-26 12:38:57 -08002908AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08002909
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002910# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002911if test "x$ac_cv_have_int64_t" = "xno" && \
2912 test "x$ac_cv_sizeof_long_int" != "x8" && \
2913 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002914 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2915 echo "an alternative compiler (I.E., GCC) before continuing."
2916 echo ""
2917 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002918else
2919dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002920 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002921 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002922#include <stdio.h>
2923#include <string.h>
2924#ifdef HAVE_SNPRINTF
2925main()
2926{
2927 char buf[50];
2928 char expected_out[50];
2929 int mazsize = 50 ;
2930#if (SIZEOF_LONG_INT == 8)
2931 long int num = 0x7fffffffffffffff;
2932#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002933 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002934#endif
2935 strcpy(expected_out, "9223372036854775807");
2936 snprintf(buf, mazsize, "%lld", num);
2937 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002938 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002939 exit(0);
2940}
2941#else
2942main() { exit(0); }
2943#endif
Tim Rice648f8762011-01-26 12:38:57 -08002944 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002945 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002946 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002947fi
2948
Damien Miller78315eb2000-09-29 23:01:36 +11002949dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08002950OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
2951OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
2952OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
2953OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
2954OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
2955OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
2956OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
2957OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
2958OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
2959OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
2960OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
2961OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
2962OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
2963OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
2964OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
2965OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
2966OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07002967
2968AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08002969AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11002970 [Define if we don't have struct __res_state in resolv.h])],
2971[
2972#include <stdio.h>
2973#if HAVE_SYS_TYPES_H
2974# include <sys/types.h>
2975#endif
2976#include <netinet/in.h>
2977#include <arpa/nameser.h>
2978#include <resolv.h>
2979])
andre2ff7b5d2000-06-03 14:57:40 +00002980
Damien Miller61e50f12000-05-08 20:49:37 +10002981AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2982 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002983 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002984#include <sys/types.h>
2985#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002986 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
2987 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2988 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10002989])
2990if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002991 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002992fi
2993
Damien Miller61e50f12000-05-08 20:49:37 +10002994AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2995 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002996 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002997#include <sys/types.h>
2998#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002999 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3000 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3001 [ ac_cv_have___ss_family_in_struct_ss="no"
3002 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003003])
3004if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003005 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003006 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003007fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003008
Damien Millerad833b32000-08-23 10:46:23 +10003009AC_CACHE_CHECK([for pw_class field in struct passwd],
3010 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003011 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3012 [[ struct passwd p; p.pw_class = 0; ]])],
3013 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3014 [ ac_cv_have_pw_class_in_struct_passwd="no"
3015 ])
Damien Millerad833b32000-08-23 10:46:23 +10003016])
3017if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003018 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003019 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003020fi
3021
Kevin Steves82456952001-06-22 21:14:18 +00003022AC_CACHE_CHECK([for pw_expire field in struct passwd],
3023 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003024 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3025 [[ struct passwd p; p.pw_expire = 0; ]])],
3026 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3027 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3028 ])
Kevin Steves82456952001-06-22 21:14:18 +00003029])
3030if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003031 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003032 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003033fi
3034
3035AC_CACHE_CHECK([for pw_change field in struct passwd],
3036 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003037 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3038 [[ struct passwd p; p.pw_change = 0; ]])],
3039 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3040 [ ac_cv_have_pw_change_in_struct_passwd="no"
3041 ])
Kevin Steves82456952001-06-22 21:14:18 +00003042])
3043if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003044 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003045 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003046fi
Damien Miller61e50f12000-05-08 20:49:37 +10003047
Tim Rice28bbb0c2002-05-27 17:37:32 -07003048dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003049AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3050 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003051 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003052#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003053#include <sys/socket.h>
3054#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003055 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003056#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003057#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003058exit(1);
3059#endif
3060struct msghdr m;
3061m.msg_accrights = 0;
3062exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003063 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003064 [ ac_cv_have_accrights_in_msghdr="yes" ],
3065 [ ac_cv_have_accrights_in_msghdr="no" ]
3066 )
3067])
3068if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003069 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003070 [Define if your system uses access rights style
3071 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003072fi
3073
Tim Rice648f8762011-01-26 12:38:57 -08003074AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3075AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003076#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003077#include <sys/stat.h>
3078#ifdef HAVE_SYS_TIME_H
3079# include <sys/time.h>
3080#endif
3081#ifdef HAVE_SYS_MOUNT_H
3082#include <sys/mount.h>
3083#endif
3084#ifdef HAVE_SYS_STATVFS_H
3085#include <sys/statvfs.h>
3086#endif
Tim Rice648f8762011-01-26 12:38:57 -08003087 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3088 [ AC_MSG_RESULT([yes]) ],
3089 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003090
Tim Rice648f8762011-01-26 12:38:57 -08003091 AC_MSG_CHECKING([if fsid_t has member val])
3092 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003093#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003094#include <sys/statvfs.h>
3095 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3096 [ AC_MSG_RESULT([yes])
3097 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3098 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003099
Tim Rice648f8762011-01-26 12:38:57 -08003100 AC_MSG_CHECKING([if f_fsid has member __val])
3101 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003102#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003103#include <sys/statvfs.h>
3104 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3105 [ AC_MSG_RESULT([yes])
3106 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3107 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003108])
Darren Tucker77001382008-06-09 06:17:53 +10003109
Kevin Stevesa44e0352002-04-07 16:18:03 +00003110AC_CACHE_CHECK([for msg_control field in struct msghdr],
3111 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003112 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003113#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003114#include <sys/socket.h>
3115#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003116 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003117#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003118#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003119exit(1);
3120#endif
3121struct msghdr m;
3122m.msg_control = 0;
3123exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003124 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003125 [ ac_cv_have_control_in_msghdr="yes" ],
3126 [ ac_cv_have_control_in_msghdr="no" ]
3127 )
3128])
3129if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003130 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003131 [Define if your system uses ancillary data style
3132 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003133fi
3134
Damien Miller61e50f12000-05-08 20:49:37 +10003135AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003136 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3137 [[ extern char *__progname; printf("%s", __progname); ]])],
3138 [ ac_cv_libc_defines___progname="yes" ],
3139 [ ac_cv_libc_defines___progname="no"
3140 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003141])
3142if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003143 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003144fi
3145
Kevin Steves4846f4a2002-03-22 18:19:53 +00003146AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003147 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3148 [[ printf("%s", __FUNCTION__); ]])],
3149 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3150 [ ac_cv_cc_implements___FUNCTION__="no"
3151 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003152])
3153if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003154 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003155 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003156fi
3157
3158AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003159 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3160 [[ printf("%s", __func__); ]])],
3161 [ ac_cv_cc_implements___func__="yes" ],
3162 [ ac_cv_cc_implements___func__="no"
3163 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003164])
3165if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003166 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003167fi
3168
Damien Miller57f39152005-11-24 19:58:19 +11003169AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003170 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3171#include <stdarg.h>
3172va_list x,y;
3173 ]], [[ va_copy(x,y); ]])],
3174 [ ac_cv_have_va_copy="yes" ],
3175 [ ac_cv_have_va_copy="no"
3176 ])
Damien Miller57f39152005-11-24 19:58:19 +11003177])
3178if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003179 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003180fi
3181
3182AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003183 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3184#include <stdarg.h>
3185va_list x,y;
3186 ]], [[ __va_copy(x,y); ]])],
3187 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3188 ])
Damien Miller57f39152005-11-24 19:58:19 +11003189])
3190if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003191 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003192fi
3193
Damien Miller4f8e6692001-07-14 13:22:53 +10003194AC_CACHE_CHECK([whether getopt has optreset support],
3195 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003196 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3197 [[ extern int optreset; optreset = 0; ]])],
3198 [ ac_cv_have_getopt_optreset="yes" ],
3199 [ ac_cv_have_getopt_optreset="no"
3200 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003201])
3202if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003203 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003204 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003205fi
Damien Millera22ba012000-03-02 23:09:20 +11003206
Damien Millerecbb26d2000-07-15 14:59:14 +10003207AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003208 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3209[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3210 [ ac_cv_libc_defines_sys_errlist="yes" ],
3211 [ ac_cv_libc_defines_sys_errlist="no"
3212 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003213])
3214if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003215 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003216 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003217fi
3218
3219
Damien Miller11fa2cc2000-08-16 10:35:58 +10003220AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003221 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3222[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3223 [ ac_cv_libc_defines_sys_nerr="yes" ],
3224 [ ac_cv_libc_defines_sys_nerr="no"
3225 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003226])
3227if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003228 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003229fi
3230
Darren Tucker5f88d342003-10-15 16:57:57 +10003231# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003232AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3233 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003234 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003235 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003236 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003237 AC_SEARCH_LIBS([res_query], [resolv])
3238 AC_SEARCH_LIBS([dn_expand], [resolv])
3239 AC_MSG_CHECKING([if res_query will link])
3240 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003241#include <sys/types.h>
3242#include <netinet/in.h>
3243#include <arpa/nameser.h>
3244#include <netdb.h>
3245#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003246 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003247 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003248 ]])],
3249 AC_MSG_RESULT([yes]),
3250 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003251 saved_LIBS="$LIBS"
3252 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003253 AC_MSG_CHECKING([for res_query in -lresolv])
3254 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003255#include <sys/types.h>
3256#include <netinet/in.h>
3257#include <arpa/nameser.h>
3258#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003259#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003260 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003261 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003262 ]])],
3263 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003264 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003265 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003266 ])
Tim Rice648f8762011-01-26 12:38:57 -08003267 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003268 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003269 [#include <sys/types.h>
3270 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003271 AC_CHECK_MEMBER([HEADER.ad],
3272 [AC_DEFINE([HAVE_HEADER_AD], [1],
3273 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003274 [#include <arpa/nameser.h>])
3275 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003276
Tim Rice648f8762011-01-26 12:38:57 -08003277AC_MSG_CHECKING([if struct __res_state _res is an extern])
3278AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003279#include <stdio.h>
3280#if HAVE_SYS_TYPES_H
3281# include <sys/types.h>
3282#endif
3283#include <netinet/in.h>
3284#include <arpa/nameser.h>
3285#include <resolv.h>
3286extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003287 ]], [[ ]])],
3288 [AC_MSG_RESULT([yes])
3289 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003290 [Define if you have struct __res_state _res as an extern])
3291 ],
Tim Rice648f8762011-01-26 12:38:57 -08003292 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003293)
3294
Damien Miller73b42d22006-04-22 21:26:08 +10003295# Check whether user wants SELinux support
3296SELINUX_MSG="no"
3297LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003298AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003299 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003300 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003301 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003302 AC_DEFINE([WITH_SELINUX], [1],
3303 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003304 SELINUX_MSG="yes"
3305 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003306 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3307 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003308 [ LIBSELINUX="-lselinux"
3309 LIBS="$LIBS -lselinux"
3310 ],
Tim Rice648f8762011-01-26 12:38:57 -08003311 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003312 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003313 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003314 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003315 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003316 fi ]
3317)
Tim Rice648f8762011-01-26 12:38:57 -08003318AC_SUBST([SSHLIBS])
3319AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003320
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003321# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003322KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003323AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003324 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003325 [ if test "x$withval" != "xno" ; then
3326 if test "x$withval" = "xyes" ; then
3327 KRB5ROOT="/usr/local"
3328 else
3329 KRB5ROOT=${withval}
3330 fi
3331
Tim Rice648f8762011-01-26 12:38:57 -08003332 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003333 KRB5_MSG="yes"
3334
Tim Rice648f8762011-01-26 12:38:57 -08003335 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003336 [$KRB5ROOT/bin/krb5-config],
3337 [$KRB5ROOT/bin:$PATH])
3338 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003339
Tim Rice648f8762011-01-26 12:38:57 -08003340 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003341 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003342 AC_MSG_RESULT([yes])
3343 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003344 [Define this if you want GSSAPI
3345 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003346 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003347 else
Tim Rice648f8762011-01-26 12:38:57 -08003348 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003349 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003350 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003351 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3352 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003353 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003354 AC_MSG_CHECKING([whether we are using Heimdal])
3355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3356 ]], [[ char *tmp = heimdal_version; ]])],
3357 [ AC_MSG_RESULT([yes])
3358 AC_DEFINE([HEIMDAL], [1],
3359 [Define this if you are using the Heimdal
3360 version of Kerberos V5]) ],
3361 [AC_MSG_RESULT([no])
3362 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003363 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003364 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003365 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003366 AC_MSG_CHECKING([whether we are using Heimdal])
3367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3368 ]], [[ char *tmp = heimdal_version; ]])],
3369 [ AC_MSG_RESULT([yes])
3370 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003371 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003372 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003373 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003374 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003375 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003376 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003377 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003378 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003379
3380 ])
3381 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003382
Tim Rice648f8762011-01-26 12:38:57 -08003383 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3384 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003385 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003386 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3387 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003388 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003389 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3390 $K5LIBS)
3391 ],
3392 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003393
Tim Rice648f8762011-01-26 12:38:57 -08003394 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003395 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003396 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003397 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003398 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003399 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003400 ]
3401 )
3402
3403 oldCPP="$CPPFLAGS"
3404 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003406 [ CPPFLAGS="$oldCPP" ])
3407
Damien Millera8e06ce2003-11-21 23:48:55 +11003408 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003409 if test ! -z "$need_dash_r" ; then
3410 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3411 fi
3412 if test ! -z "$blibpath" ; then
3413 blibpath="$blibpath:${KRB5ROOT}/lib"
3414 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003415
Tim Rice648f8762011-01-26 12:38:57 -08003416 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3417 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3418 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003419
3420 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003421 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3422 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003423 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003424 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003425)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003426
Damien Millera22ba012000-03-02 23:09:20 +11003427# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003428
Damien Millerf58c6722002-05-13 13:15:42 +10003429PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003430AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003431 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003432 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003433 if test -n "$withval" && test "x$withval" != "xno" && \
3434 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003435 PRIVSEP_PATH=$withval
3436 fi
3437 ]
3438)
Tim Rice648f8762011-01-26 12:38:57 -08003439AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003440
Tim Rice648f8762011-01-26 12:38:57 -08003441AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003442 [ --with-xauth=PATH Specify path to xauth program ],
3443 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003444 if test -n "$withval" && test "x$withval" != "xno" && \
3445 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003446 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003447 fi
3448 ],
3449 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003450 TestPath="$PATH"
3451 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3452 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3453 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3454 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003455 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003456 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003457 xauth_path="/usr/openwin/bin/xauth"
3458 fi
3459 ]
3460)
3461
Damien Miller7d901272003-01-13 16:55:22 +11003462STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003463AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003464 [ --disable-strip Disable calling strip(1) on install],
3465 [
3466 if test "x$enableval" = "xno" ; then
3467 STRIP_OPT=
3468 fi
3469 ]
3470)
Tim Rice648f8762011-01-26 12:38:57 -08003471AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003472
Damien Millera19cf472000-11-29 13:28:50 +11003473if test -z "$xauth_path" ; then
3474 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003475 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003476else
Tim Rice648f8762011-01-26 12:38:57 -08003477 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003478 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003479 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003480 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003481fi
Damien Millera22ba012000-03-02 23:09:20 +11003482
Tim Rice90f42b02011-06-02 18:17:49 -07003483dnl # --with-maildir=/path/to/mail gets top priority.
3484dnl # if maildir is set in the platform case statement above we use that.
3485dnl # Otherwise we run a program to get the dir from system headers.
3486dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3487dnl # If we find _PATH_MAILDIR we do nothing because that is what
3488dnl # session.c expects anyway. Otherwise we set to the value found
3489dnl # stripping any trailing slash. If for some strage reason our program
3490dnl # does not find what it needs, we default to /var/spool/mail.
3491# Check for mail directory
3492AC_ARG_WITH([maildir],
3493 [ --with-maildir=/path/to/mail Specify your system mail directory],
3494 [
3495 if test "X$withval" != X && test "x$withval" != xno && \
3496 test "x${withval}" != xyes; then
3497 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3498 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3499 fi
3500 ],[
3501 if test "X$maildir" != "X"; then
3502 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3503 else
3504 AC_MSG_CHECKING([Discovering system mail directory])
3505 AC_RUN_IFELSE(
3506 [AC_LANG_PROGRAM([[
3507#include <stdio.h>
3508#include <string.h>
3509#ifdef HAVE_PATHS_H
3510#include <paths.h>
3511#endif
3512#ifdef HAVE_MAILLOCK_H
3513#include <maillock.h>
3514#endif
3515#define DATA "conftest.maildir"
3516 ]], [[
3517 FILE *fd;
3518 int rc;
3519
3520 fd = fopen(DATA,"w");
3521 if(fd == NULL)
3522 exit(1);
3523
3524#if defined (_PATH_MAILDIR)
3525 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3526 exit(1);
3527#elif defined (MAILDIR)
3528 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3529 exit(1);
3530#elif defined (_PATH_MAIL)
3531 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3532 exit(1);
3533#else
3534 exit (2);
3535#endif
3536
3537 exit(0);
3538 ]])],
3539 [
3540 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3541 maildir=`awk -F: '{print $2}' conftest.maildir \
3542 | sed 's|/$||'`
3543 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3544 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3545 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3546 fi
3547 ],
3548 [
3549 if test "X$ac_status" = "X2";then
3550# our test program didn't find it. Default to /var/spool/mail
3551 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3552 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3553 else
3554 AC_MSG_RESULT([*** not found ***])
3555 fi
3556 ],
3557 [
3558 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3559 ]
3560 )
3561 fi
3562 ]
3563) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003564
Darren Tucker623d92f2004-09-12 22:36:15 +10003565if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003566 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3567 disable_ptmx_check=yes
3568fi
Damien Millera22ba012000-03-02 23:09:20 +11003569if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003570 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003571 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003572 [
Tim Rice648f8762011-01-26 12:38:57 -08003573 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003574 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003575 have_dev_ptmx=1
3576 ]
3577 )
3578 fi
Damien Millera22ba012000-03-02 23:09:20 +11003579fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003580
Darren Tucker623d92f2004-09-12 22:36:15 +10003581if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003582 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003583 [
Tim Rice648f8762011-01-26 12:38:57 -08003584 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003585 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003586 have_dev_ptc=1
3587 ]
3588 )
3589else
3590 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3591fi
Damien Miller204ad072000-03-02 23:56:12 +11003592
Damien Millera22ba012000-03-02 23:09:20 +11003593# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003594AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003595 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003596 [
Damien Miller897741e2001-04-16 10:41:46 +10003597 case "$withval" in
3598 man|cat|doc)
3599 MANTYPE=$withval
3600 ;;
3601 *)
Tim Rice648f8762011-01-26 12:38:57 -08003602 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003603 ;;
3604 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003605 ]
3606)
Ben Lindstrombc709922001-04-18 18:04:21 +00003607if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003608 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003609 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003610 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3611 MANTYPE=doc
3612 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3613 MANTYPE=man
3614 else
3615 MANTYPE=cat
3616 fi
3617fi
Tim Rice648f8762011-01-26 12:38:57 -08003618AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003619if test "$MANTYPE" = "doc"; then
3620 mansubdir=man;
3621else
3622 mansubdir=$MANTYPE;
3623fi
Tim Rice648f8762011-01-26 12:38:57 -08003624AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003625
Damien Millera22ba012000-03-02 23:09:20 +11003626# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003627MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003628AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003629 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003630 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003631 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003632 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003633 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003634 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003635 fi
3636 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003637)
3638
Damien Millera22ba012000-03-02 23:09:20 +11003639# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003640AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003641 [ --without-shadow Disable shadow password support],
3642 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003643 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003644 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003645 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003646 fi
3647 ]
3648)
3649
Damien Miller1f335fb2000-06-26 11:31:33 +10003650if test -z "$disable_shadow" ; then
3651 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003652 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003653#include <sys/types.h>
3654#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003655struct spwd sp;
3656 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3657 [ sp_expire_available=yes ], [
3658 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003659
3660 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003661 AC_MSG_RESULT([yes])
3662 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003663 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003664 else
Tim Rice648f8762011-01-26 12:38:57 -08003665 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003666 fi
3667fi
3668
Damien Millera22ba012000-03-02 23:09:20 +11003669# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003670if test ! -z "$IPADDR_IN_DISPLAY" ; then
3671 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003672 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003673 [Define if you need to use IP address
3674 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003675else
Damien Millera8e06ce2003-11-21 23:48:55 +11003676 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003677 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003678 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3679 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003680 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003681 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003682 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003683 fi
3684 ]
3685 )
3686fi
Damien Miller76112de1999-12-21 11:18:08 +11003687
Darren Tuckere1a790d2003-09-16 11:52:19 +10003688# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003689AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003690 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003691 [ if test "x$enableval" = "xno"; then
3692 AC_MSG_NOTICE([/etc/default/login handling disabled])
3693 etc_default_login=no
3694 else
3695 etc_default_login=yes
3696 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003697 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3698 then
3699 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3700 etc_default_login=no
3701 else
3702 etc_default_login=yes
3703 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003704)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003705
Darren Tucker2f9573d2005-02-10 22:28:54 +11003706if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003707 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003708 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003709 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003710 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003711 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003712 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003713fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003714
Tim Rice43a1c132002-04-17 21:19:14 -07003715dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003716if test $ac_cv_func_login_getcapbool = "yes" && \
3717 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003718 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003719fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003720
Damien Millera22ba012000-03-02 23:09:20 +11003721# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003722SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003723AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003724 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003725 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003726 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003727 AC_MSG_WARN([
3728--with-default-path=PATH has no effect on this system.
3729Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003730 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003731 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003732 AC_MSG_WARN([
3733--with-default-path=PATH will only be used if PATH is not defined in
3734$external_path_file .])
3735 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003736 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003737 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003738 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003739 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003740 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3741 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003742 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003743 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003744 AC_MSG_WARN([
3745If PATH is defined in $external_path_file, ensure the path to scp is included,
3746otherwise scp will not work.])
3747 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003748 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003749 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003750/* find out what STDPATH is */
3751#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003752#ifdef HAVE_PATHS_H
3753# include <paths.h>
3754#endif
3755#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003756# ifdef _PATH_USERPATH /* Irix */
3757# define _PATH_STDPATH _PATH_USERPATH
3758# else
3759# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3760# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003761#endif
3762#include <sys/types.h>
3763#include <sys/stat.h>
3764#include <fcntl.h>
3765#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003766 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003767 FILE *fd;
3768 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003769
Tim Rice59ea0a02001-03-10 13:50:45 -08003770 fd = fopen(DATA,"w");
3771 if(fd == NULL)
3772 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003773
Tim Rice59ea0a02001-03-10 13:50:45 -08003774 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3775 exit(1);
3776
3777 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003778 ]])],
3779 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003780 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3781 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3782 )
3783# make sure $bindir is in USER_PATH so scp will work
3784 t_bindir=`eval echo ${bindir}`
3785 case $t_bindir in
3786 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3787 esac
3788 case $t_bindir in
3789 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3790 esac
3791 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3792 if test $? -ne 0 ; then
3793 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3794 if test $? -ne 0 ; then
3795 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003796 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003797 fi
3798 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003799 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003800)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003801if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003802 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3803 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003804fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003805
Damien Millera18bbd32002-05-13 10:48:57 +10003806# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003807AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003808 [ --with-superuser-path= Specify different path for super-user],
3809 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003810 if test -n "$withval" && test "x$withval" != "xno" && \
3811 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003812 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003813 [Define if you want a different $PATH
3814 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003815 superuser_path=$withval
3816 fi
3817 ]
3818)
3819
3820
Damien Miller61e50f12000-05-08 20:49:37 +10003821AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003822IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003823AC_ARG_WITH(4in6,
3824 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3825 [
3826 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003827 AC_MSG_RESULT([yes])
3828 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003829 [Detect IPv4 in IPv6 mapped addresses
3830 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003831 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003832 else
Tim Rice648f8762011-01-26 12:38:57 -08003833 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003834 fi
Tim Rice648f8762011-01-26 12:38:57 -08003835 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003836 if test "x$inet6_default_4in6" = "xyes"; then
3837 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003838 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003839 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003840 else
3841 AC_MSG_RESULT([no (default)])
3842 fi
3843 ]
3844)
3845
Damien Miller60396b02001-02-18 17:01:00 +11003846# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003847BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003848AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003849 [ --with-bsd-auth Enable BSD auth support],
3850 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003851 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003852 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003853 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003854 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003855 fi
3856 ]
3857)
3858
Damien Millera22ba012000-03-02 23:09:20 +11003859# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003860piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003861# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003862if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003863 piddir=`eval echo ${sysconfdir}`
3864 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003865 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003866 esac
3867fi
3868
Tim Rice648f8762011-01-26 12:38:57 -08003869AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003870 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3871 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003872 if test -n "$withval" && test "x$withval" != "xno" && \
3873 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003874 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003875 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003876 AC_MSG_WARN([** no $piddir directory on this system **])
3877 fi
3878 fi
3879 ]
3880)
3881
Tim Rice648f8762011-01-26 12:38:57 -08003882AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3883 [Specify location of ssh.pid])
3884AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003885
andre2ff7b5d2000-06-03 14:57:40 +00003886dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003887AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003888 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003889 [
3890 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003891 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003892 fi
3893 ]
andre2ff7b5d2000-06-03 14:57:40 +00003894)
Tim Rice648f8762011-01-26 12:38:57 -08003895AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003896 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003897 [
3898 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003899 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003900 fi
3901 ]
andre2ff7b5d2000-06-03 14:57:40 +00003902)
Tim Rice648f8762011-01-26 12:38:57 -08003903AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00003904 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003905 [
3906 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003907 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003908 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003909 fi
3910 ]
andre2ff7b5d2000-06-03 14:57:40 +00003911)
Tim Rice648f8762011-01-26 12:38:57 -08003912AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00003913 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003914 [
3915 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003916 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003917 fi
3918 ]
andre2ff7b5d2000-06-03 14:57:40 +00003919)
Tim Rice648f8762011-01-26 12:38:57 -08003920AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00003921 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003922 [
3923 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003924 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003925 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003926 fi
3927 ]
andre2ff7b5d2000-06-03 14:57:40 +00003928)
Tim Rice648f8762011-01-26 12:38:57 -08003929AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00003930 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003931 [
3932 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003933 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10003934 fi
3935 ]
andre2ff7b5d2000-06-03 14:57:40 +00003936)
Tim Rice648f8762011-01-26 12:38:57 -08003937AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00003938 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003939 [
3940 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003941 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003942 [Define if you don't want to use pututline()
3943 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003944 fi
3945 ]
andre2ff7b5d2000-06-03 14:57:40 +00003946)
Tim Rice648f8762011-01-26 12:38:57 -08003947AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00003948 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003949 [
3950 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003951 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003952 [Define if you don't want to use pututxline()
3953 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003954 fi
3955 ]
andre2ff7b5d2000-06-03 14:57:40 +00003956)
Tim Rice648f8762011-01-26 12:38:57 -08003957AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003958 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003959 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003960 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003961 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08003962 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003963 conf_lastlog_location=$withval
3964 fi
3965 ]
3966)
andre2ff7b5d2000-06-03 14:57:40 +00003967
3968dnl lastlog, [uw]tmpx? detection
3969dnl NOTE: set the paths in the platform section to avoid the
3970dnl need for command-line parameters
3971dnl lastlog and [uw]tmp are subject to a file search if all else fails
3972
3973dnl lastlog detection
3974dnl NOTE: the code itself will detect if lastlog is a directory
3975AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003976AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003977#include <sys/types.h>
3978#include <utmp.h>
3979#ifdef HAVE_LASTLOG_H
3980# include <lastlog.h>
3981#endif
Damien Miller2994e082000-06-04 15:51:47 +10003982#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003983# include <paths.h>
3984#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003985#ifdef HAVE_LOGIN_H
3986# include <login.h>
3987#endif
Tim Rice648f8762011-01-26 12:38:57 -08003988 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
3989 [ AC_MSG_RESULT([yes]) ],
3990 [
3991 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10003992 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08003993 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10003994#include <sys/types.h>
3995#include <utmp.h>
3996#ifdef HAVE_LASTLOG_H
3997# include <lastlog.h>
3998#endif
3999#ifdef HAVE_PATHS_H
4000# include <paths.h>
4001#endif
Tim Rice648f8762011-01-26 12:38:57 -08004002 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4003 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004004 [
Tim Rice648f8762011-01-26 12:38:57 -08004005 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004006 system_lastlog_path=no
4007 ])
Tim Rice648f8762011-01-26 12:38:57 -08004008])
Damien Miller2994e082000-06-04 15:51:47 +10004009
andre2ff7b5d2000-06-03 14:57:40 +00004010if test -z "$conf_lastlog_location"; then
4011 if test x"$system_lastlog_path" = x"no" ; then
4012 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004013 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004014 conf_lastlog_location=$f
4015 fi
4016 done
4017 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004018 AC_MSG_WARN([** Cannot find lastlog **])
4019 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004020 fi
4021 fi
4022fi
4023
4024if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004025 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004026 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004027fi
andre2ff7b5d2000-06-03 14:57:40 +00004028
4029dnl utmp detection
4030AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004031AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004032#include <sys/types.h>
4033#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004034#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004035# include <paths.h>
4036#endif
Tim Rice648f8762011-01-26 12:38:57 -08004037 ]], [[ char *utmp = UTMP_FILE; ]])],
4038 [ AC_MSG_RESULT([yes]) ],
4039 [ AC_MSG_RESULT([no])
4040 system_utmp_path=no
4041])
andre2ff7b5d2000-06-03 14:57:40 +00004042if test -z "$conf_utmp_location"; then
4043 if test x"$system_utmp_path" = x"no" ; then
4044 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4045 if test -f $f ; then
4046 conf_utmp_location=$f
4047 fi
4048 done
4049 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004050 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004051 fi
4052 fi
4053fi
4054if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004055 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004056 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004057fi
andre2ff7b5d2000-06-03 14:57:40 +00004058
4059dnl wtmp detection
4060AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004061AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004062#include <sys/types.h>
4063#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004064#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004065# include <paths.h>
4066#endif
Tim Rice648f8762011-01-26 12:38:57 -08004067 ]], [[ char *wtmp = WTMP_FILE; ]])],
4068 [ AC_MSG_RESULT([yes]) ],
4069 [ AC_MSG_RESULT([no])
4070 system_wtmp_path=no
4071])
andre2ff7b5d2000-06-03 14:57:40 +00004072if test -z "$conf_wtmp_location"; then
4073 if test x"$system_wtmp_path" = x"no" ; then
4074 for f in /usr/adm/wtmp /var/log/wtmp; do
4075 if test -f $f ; then
4076 conf_wtmp_location=$f
4077 fi
4078 done
4079 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004080 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004081 fi
4082 fi
4083fi
4084if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004085 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004086 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004087fi
andre2ff7b5d2000-06-03 14:57:40 +00004088
4089
andre2ff7b5d2000-06-03 14:57:40 +00004090dnl wtmpx detection
4091AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004092AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004093#include <sys/types.h>
4094#include <utmp.h>
4095#ifdef HAVE_UTMPX_H
4096#include <utmpx.h>
4097#endif
Damien Miller2994e082000-06-04 15:51:47 +10004098#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004099# include <paths.h>
4100#endif
Tim Rice648f8762011-01-26 12:38:57 -08004101 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4102 [ AC_MSG_RESULT([yes]) ],
4103 [ AC_MSG_RESULT([no])
4104 system_wtmpx_path=no
4105])
andre2ff7b5d2000-06-03 14:57:40 +00004106if test -z "$conf_wtmpx_location"; then
4107 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004108 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004109 fi
4110else
Tim Rice648f8762011-01-26 12:38:57 -08004111 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004112 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004113fi
andre2ff7b5d2000-06-03 14:57:40 +00004114
Damien Miller4018c192000-04-30 09:30:44 +10004115
Damien Miller29ea30d2000-03-17 10:54:15 +11004116if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004117 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4118 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004119fi
4120
Darren Tucker7da23cb2005-08-03 00:20:15 +10004121dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4122dnl Add now.
4123CFLAGS="$CFLAGS $werror_flags"
4124
Darren Tucker627337d2010-04-10 22:58:01 +10004125if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4126 TEST_SSH_IPV6=no
4127else
4128 TEST_SSH_IPV6=yes
4129fi
Tim Rice648f8762011-01-26 12:38:57 -08004130AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4131AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004132
Damien Millerbac2d8a2000-09-05 16:13:06 +11004133AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004134AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4135 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004136 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004137AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004138
Damien Miller7b22d652000-06-18 14:07:04 +10004139# Print summary of options
4140
Damien Miller7b22d652000-06-18 14:07:04 +10004141# Someone please show me a better way :)
4142A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4143B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4144C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4145D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004146E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004147F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004148G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004149H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4150I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4151J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004152
4153echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004154echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004155echo " User binaries: $B"
4156echo " System binaries: $C"
4157echo " Configuration files: $D"
4158echo " Askpass program: $E"
4159echo " Manual pages: $F"
4160echo " PID file: $G"
4161echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004162if test "x$external_path_file" = "x/etc/login.conf" ; then
4163echo " At runtime, sshd will use the path defined in $external_path_file"
4164echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004165else
Damien Millerf58c6722002-05-13 13:15:42 +10004166echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004167 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004168echo " (If PATH is set in $external_path_file it will be used instead. If"
4169echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4170 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004171fi
Damien Millera18bbd32002-05-13 10:48:57 +10004172if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004173echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004174fi
Damien Millerf58c6722002-05-13 13:15:42 +10004175echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004176echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004177echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004178echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004179echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004180echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004181echo " S/KEY support: $SKEY_MSG"
4182echo " TCP Wrappers support: $TCPW_MSG"
4183echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004184echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004185echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004186echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004187echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004188echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4189echo " BSD Auth support: $BSD_AUTH_MSG"
4190echo " Random number source: $RAND_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004191
Damien Miller7b22d652000-06-18 14:07:04 +10004192echo ""
4193
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004194echo " Host: ${host}"
4195echo " Compiler: ${CC}"
4196echo " Compiler flags: ${CFLAGS}"
4197echo "Preprocessor flags: ${CPPFLAGS}"
4198echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004199echo " Libraries: ${LIBS}"
4200if test ! -z "${SSHDLIBS}"; then
4201echo " +for sshd: ${SSHDLIBS}"
4202fi
Damien Miller71adf122011-01-25 12:16:15 +11004203if test ! -z "${SSHLIBS}"; then
4204echo " +for ssh: ${SSHLIBS}"
4205fi
Damien Miller7b22d652000-06-18 14:07:04 +10004206
4207echo ""
4208
Tim Rice6f1f7582004-05-30 21:38:51 -07004209if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004210 echo "SVR4 style packages are supported with \"make package\""
4211 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004212fi
4213
Damien Miller82cf0ce2000-12-20 13:34:48 +11004214if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004215 echo "PAM is enabled. You may need to install a PAM control file "
4216 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004217 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004218 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004219 echo ""
4220fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004221
Damien Millerb4097182004-05-23 14:09:40 +10004222if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004223 echo "WARNING: the operating system that you are using does not"
4224 echo "appear to support getpeereid(), getpeerucred() or the"
4225 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4226 echo "enforce security checks to prevent unauthorised connections to"
4227 echo "ssh-agent. Their absence increases the risk that a malicious"
4228 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004229 echo ""
4230fi
4231
Darren Tuckerd9f88912005-02-20 21:01:48 +11004232if test "$AUDIT_MODULE" = "bsm" ; then
4233 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4234 echo "See the Solaris section in README.platform for details."
4235fi