blob: 8f36338ff2be1f7ba95435dfe48a16a7c1b3f844 [file] [log] [blame]
Damien Millerc09182f2011-06-03 12:11:38 +10001# $Id: configure.ac,v 1.476 2011/06/03 02:11:38 djm 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])
Damien Millerc09182f2011-06-03 12:11:38 +100018AC_REVISION($Revision: 1.476 $)
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 )
Damien Millerc09182f2011-06-03 12:11:38 +1000515 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
516 [Define to a Set Process Title type if your system is
517 supported by bsd-setproctitle.c])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000518 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000519*-*-dragonfly*)
520 SSHDLIBS="$SSHDLIBS -lcrypt"
521 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100522*-*-haiku*)
523 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800524 AC_CHECK_LIB([network], [socket])
525 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100526 MANTYPE=man
527 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000528*-*-hpux*)
529 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000530 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100531 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800532 AC_DEFINE([USE_PIPES])
533 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700534 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800535 AC_DEFINE([LOGIN_NEEDS_UTMPX])
536 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700537 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800538 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Tim Rice90f42b02011-06-02 18:17:49 -0700539 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700540 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800541 AC_CHECK_LIB([xnet], [t_error], ,
542 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000543
544 # next, we define all of the options specific to major releases
545 case "$host" in
546 *-*-hpux10*)
547 if test -z "$GCC"; then
548 CFLAGS="$CFLAGS -Ae"
549 fi
550 ;;
551 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800552 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700553 [Define if you are using Solaris-derived PAM which
554 passes pam_messages to the conversation function
555 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800556 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700557 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800558 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000559 check_for_hpux_broken_getaddrinfo=1
560 check_for_conflicting_getspnam=1
561 ;;
562 esac
563
564 # lastly, we define options specific to minor releases
565 case "$host" in
566 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800567 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700568 [Define if you have SecureWare-based
569 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000570 disable_ptmx_check=yes
571 LIBS="$LIBS -lsecpw"
572 ;;
573 esac
Damien Miller1bead332000-04-30 00:47:29 +1000574 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100575*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100576 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800577 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700578 [Define if you system's inet_ntoa is busted
579 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800580 AC_DEFINE([SETEUID_BREAKS_SETUID])
581 AC_DEFINE([BROKEN_SETREUID])
582 AC_DEFINE([BROKEN_SETREGID])
583 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700584 [Define if you shouldn't strip 'tty' from your
585 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800586 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100587 ;;
588*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100589 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700591 [Define if you have/want arrays
592 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800593 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700594 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800595 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700596 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800597 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700598 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([BROKEN_INET_NTOA])
600 AC_DEFINE([SETEUID_BREAKS_SETUID])
601 AC_DEFINE([BROKEN_SETREUID])
602 AC_DEFINE([BROKEN_SETREGID])
603 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
604 AC_DEFINE([WITH_ABBREV_NO_TTY])
605 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100606 ;;
Damien Miller90551722009-02-16 15:37:03 +1100607*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
608 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800609 AC_DEFINE([PAM_TTY_KLUDGE])
610 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
611 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
612 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
613 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100614 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100615*-*-linux*)
616 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100617 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000618 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800619 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700620 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800621 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700622 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800623 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
624 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700625 [Define to whatever link() returns for "not supported"
626 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800627 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
628 AC_DEFINE([USE_BTMP])
629 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100630 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000631 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000632 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800633 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700634 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000635 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000636 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100637 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800638 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100639 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800640 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100641 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800642 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100643 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800644 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100645 [Prepend the address family to IP tunnel traffic])
646 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100647 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000648mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800649 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000650 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000651 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100652*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000653 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800654 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800655 need_dash_r=1
656 fi
Tim Rice648f8762011-01-26 12:38:57 -0800657 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100658 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800659 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
660 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100661 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100662 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100663*-*-freebsd*)
664 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
666 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100667 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800668 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
669 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100670 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000671*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800672 AC_DEFINE([SETEUID_BREAKS_SETUID])
673 AC_DEFINE([BROKEN_SETREUID])
674 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000675 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000676*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000677 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100678 conf_utmp_location=/etc/utmp
679 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700680 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800681 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
682 AC_DEFINE([BROKEN_REALPATH])
683 AC_DEFINE([USE_PIPES])
684 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000685 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000686*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800687 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
688 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
689 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
690 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000691 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000692 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100693*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800694 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800695 need_dash_r=1
696 fi
Tim Rice648f8762011-01-26 12:38:57 -0800697 AC_DEFINE([PAM_SUN_CODEBASE])
698 AC_DEFINE([LOGIN_NEEDS_UTMPX])
699 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700700 [Some versions of /bin/login need the TERM supplied
701 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800702 AC_DEFINE([PAM_TTY_KLUDGE])
703 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700704 [Define if pam_chauthtok wants real uid set
705 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800706 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000707 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800708 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700709 [Define if sshd somehow reacquires a controlling TTY
710 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800711 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000712 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800713 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000714 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000715 # hardwire lastlog location (can't detect it on some versions)
716 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000718 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
719 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800720 AC_MSG_RESULT([yes])
721 AC_DEFINE([DISABLE_UTMP])
722 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700723 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000724 else
Tim Rice648f8762011-01-26 12:38:57 -0800725 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000726 fi
Tim Rice648f8762011-01-26 12:38:57 -0800727 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000728 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
729 [
Tim Rice648f8762011-01-26 12:38:57 -0800730 AC_CHECK_LIB([contract], [ct_tmpl_activate],
731 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000732 [Define if you have Solaris process contracts])
733 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000734 SPC_MSG="yes" ], )
735 ],
736 )
Tim Rice648f8762011-01-26 12:38:57 -0800737 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100738 [ --with-solaris-projects Enable Solaris projects (experimental)],
739 [
Tim Rice648f8762011-01-26 12:38:57 -0800740 AC_CHECK_LIB([project], [setproject],
741 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100742 [Define if you have Solaris projects])
743 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100744 SP_MSG="yes" ], )
745 ],
746 )
Damien Miller75b1d102000-01-07 14:01:41 +1100747 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000748*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000749 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800750 AC_CHECK_FUNCS([getpwanam])
751 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000752 conf_utmp_location=/etc/utmp
753 conf_wtmp_location=/var/adm/wtmp
754 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800755 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000756 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000757*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700758 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800759 AC_DEFINE([USE_PIPES])
760 AC_DEFINE([SSHD_ACQUIRES_CTTY])
761 AC_DEFINE([SETEUID_BREAKS_SETUID])
762 AC_DEFINE([BROKEN_SETREUID])
763 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000764 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000765*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700766 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800767 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100768 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800769 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100770 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800771 AC_DEFINE([USE_PIPES])
772 AC_DEFINE([IP_TOS_IS_BROKEN])
773 AC_DEFINE([SETEUID_BREAKS_SETUID])
774 AC_DEFINE([BROKEN_SETREUID])
775 AC_DEFINE([BROKEN_SETREGID])
776 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000777 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700778 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
779 # Attention: always take care to bind libsocket and libnsl before libc,
780 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000781 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800782# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100783*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800784 AC_DEFINE([USE_PIPES])
785 AC_DEFINE([SETEUID_BREAKS_SETUID])
786 AC_DEFINE([BROKEN_SETREUID])
787 AC_DEFINE([BROKEN_SETREGID])
788 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
789 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100790 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800791# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100792*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800793 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800794 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
795 AC_DEFINE([USE_PIPES])
796 AC_DEFINE([SETEUID_BREAKS_SETUID])
797 AC_DEFINE([BROKEN_GETADDRINFO])
798 AC_DEFINE([BROKEN_SETREUID])
799 AC_DEFINE([BROKEN_SETREGID])
800 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700801 case "$host" in
802 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700803 maildir=/var/spool/mail
Tim Rice4dbacff2005-06-01 20:09:28 -0700804 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800805 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700806 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800807 AC_DEFINE([BROKEN_UPDWTMPX])
808 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
809 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
810 AC_DEFINE([HAVE_SECUREWARE])
811 AC_DEFINE([DISABLE_SHADOW])
812 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700813 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800814 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800815 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800816 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700817 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100818 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100819*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100820 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800821# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100822*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800823 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100824 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800825# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100826*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800827 if test -z "$GCC"; then
828 CFLAGS="$CFLAGS -belf"
829 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100830 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000831 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800832 AC_DEFINE([USE_PIPES])
833 AC_DEFINE([HAVE_SECUREWARE])
834 AC_DEFINE([DISABLE_SHADOW])
835 AC_DEFINE([DISABLE_FD_PASSING])
836 AC_DEFINE([SETEUID_BREAKS_SETUID])
837 AC_DEFINE([BROKEN_GETADDRINFO])
838 AC_DEFINE([BROKEN_SETREUID])
839 AC_DEFINE([BROKEN_SETREGID])
840 AC_DEFINE([WITH_ABBREV_NO_TTY])
841 AC_DEFINE([BROKEN_UPDWTMPX])
842 AC_DEFINE([PASSWD_NEEDS_USERNAME])
843 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700844 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700845 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000846 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000847*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800848 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700849 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800850 AC_DEFINE([SETEUID_BREAKS_SETUID])
851 AC_DEFINE([BROKEN_SETREUID])
852 AC_DEFINE([BROKEN_SETREGID])
853 AC_DEFINE([USE_PIPES])
854 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000855 LDFLAGS="$LDFLAGS"
856 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
857 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000858 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000859*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800860 AC_DEFINE([SETEUID_BREAKS_SETUID])
861 AC_DEFINE([BROKEN_SETREUID])
862 AC_DEFINE([BROKEN_SETREGID])
863 AC_DEFINE([WITH_ABBREV_NO_TTY])
864 AC_DEFINE([USE_PIPES])
865 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000866 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100867 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000868 MANTYPE=cat
869 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000870*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800871 AC_DEFINE([SETEUID_BREAKS_SETUID])
872 AC_DEFINE([BROKEN_SETREUID])
873 AC_DEFINE([BROKEN_SETREGID])
874 AC_DEFINE([USE_PIPES])
875 AC_DEFINE([DISABLE_FD_PASSING])
876 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000877 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
878 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
879 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700880 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000881*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800882 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000883 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800884 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000885 [ --with-osfsia Enable Digital Unix SIA],
886 [
887 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800888 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000889 no_osfsia=1
890 fi
891 ],
892 )
893 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000894 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800895 AC_MSG_RESULT([yes])
896 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700897 [Define if you have Digital Unix Security
898 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800899 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700900 [Define if you don't want to use your
901 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800902 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000903 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000904 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000905 else
Tim Rice648f8762011-01-26 12:38:57 -0800906 AC_MSG_RESULT([no])
907 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700908 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000909 fi
910 fi
Tim Rice648f8762011-01-26 12:38:57 -0800911 AC_DEFINE([BROKEN_GETADDRINFO])
912 AC_DEFINE([SETEUID_BREAKS_SETUID])
913 AC_DEFINE([BROKEN_SETREUID])
914 AC_DEFINE([BROKEN_SETREGID])
915 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000916 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000917
Tim Rice70335a62006-02-04 17:42:58 -0800918*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800919 AC_DEFINE([USE_PIPES])
920 AC_DEFINE([NO_X11_UNIX_SOCKETS])
921 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
922 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
923 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
924 AC_DEFINE([DISABLE_LASTLOG])
925 AC_DEFINE([SSHD_ACQUIRES_CTTY])
926 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800927 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000928 case "$host" in
929 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800930 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000931 ;;
932 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000933 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000934
935*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800936 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
937 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
938 AC_DEFINE([NEED_SETPGRP])
939 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700940 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000941
942*-*-lynxos)
943 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -0800944 AC_DEFINE([MISSING_HOWMANY])
945 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000946 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100947esac
948
Tim Rice648f8762011-01-26 12:38:57 -0800949AC_MSG_CHECKING([compiler and flags for sanity])
950AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
951 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +1000952 [
Tim Rice648f8762011-01-26 12:38:57 -0800953 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +1000954 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000955 ],
956 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000957)
958
Darren Tucker0c9653f2005-05-28 15:58:14 +1000959dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100960# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -0800961AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
962AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000963
Tim Rice1e1ef642003-09-11 22:19:31 -0700964dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -0800965AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
966 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -0700967 AC_CACHE_CHECK([for broken dirname],
968 ac_cv_have_broken_dirname, [
969 save_LIBS="$LIBS"
970 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000971 AC_RUN_IFELSE(
972 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700973#include <libgen.h>
974#include <string.h>
975
976int main(int argc, char **argv) {
977 char *s, buf[32];
978
979 strncpy(buf,"/etc", 32);
980 s = dirname(buf);
981 if (!s || strncmp(s, "/", 32) != 0) {
982 exit(1);
983 } else {
984 exit(0);
985 }
986}
Darren Tucker314d89e2005-10-17 23:29:23 +1000987 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700988 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000989 [ ac_cv_have_broken_dirname="yes" ],
990 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700991 )
992 LIBS="$save_LIBS"
993 ])
994 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
995 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -0800996 AC_DEFINE([HAVE_DIRNAME])
997 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -0700998 fi
999 ])
1000])
1001
Tim Rice648f8762011-01-26 12:38:57 -08001002AC_CHECK_FUNC([getspnam], ,
1003 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1004AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1005 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001006
Tim Rice13aae5e2001-10-21 17:53:58 -07001007dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001008AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001009 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001010 [ if test "x$withval" = "xno" ; then
1011 AC_MSG_ERROR([*** zlib is required ***])
1012 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001013 if test -d "$withval/lib"; then
1014 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001015 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001016 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001017 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001018 fi
1019 else
1020 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001021 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001022 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001023 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001024 fi
1025 fi
1026 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001027 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001028 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001029 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001030 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001031 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001032)
1033
Tim Rice648f8762011-01-26 12:38:57 -08001034AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1035AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001036 [
1037 saved_CPPFLAGS="$CPPFLAGS"
1038 saved_LDFLAGS="$LDFLAGS"
1039 save_LIBS="$LIBS"
1040 dnl Check default zlib install dir
1041 if test -n "${need_dash_r}"; then
1042 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1043 else
1044 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1045 fi
1046 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1047 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001048 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001049 [
1050 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1051 ]
1052 )
1053 ]
1054)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001055
Tim Rice648f8762011-01-26 12:38:57 -08001056AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001057 [ --without-zlib-version-check Disable zlib version check],
1058 [ if test "x$withval" = "xno" ; then
1059 zlib_check_nonfatal=1
1060 fi
1061 ]
1062)
1063
Tim Rice648f8762011-01-26 12:38:57 -08001064AC_MSG_CHECKING([for possibly buggy zlib])
1065AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001066#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001067#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001068 ]],
1069 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001070 int a=0, b=0, c=0, d=0, n, v;
1071 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1072 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001073 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001074 v = a*1000000 + b*10000 + c*100 + d;
1075 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1076
1077 /* 1.1.4 is OK */
1078 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001079 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001080
Darren Tucker41097ed2005-07-25 15:24:21 +10001081 /* 1.2.3 and up are OK */
1082 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001083 exit(0);
1084
Darren Tucker2dcd2392004-01-23 17:13:33 +11001085 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001086 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001087 AC_MSG_RESULT([no]),
1088 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001089 if test -z "$zlib_check_nonfatal" ; then
1090 AC_MSG_ERROR([*** zlib too old - check config.log ***
1091Your reported zlib version has known security problems. It's possible your
1092vendor has fixed these problems without changing the version number. If you
1093are sure this is the case, you can disable the check by running
1094"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001095If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001096See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001097 else
1098 AC_MSG_WARN([zlib version may have security problems])
1099 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001100 ],
1101 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001102)
Damien Miller6f9c3372000-10-25 10:06:04 +11001103
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001104dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001105AC_CHECK_FUNC([strcasecmp],
1106 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001107)
Tim Rice648f8762011-01-26 12:38:57 -08001108AC_CHECK_FUNCS([utimes],
1109 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001110 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001111)
Damien Millerab18c411999-11-11 10:40:23 +11001112
Tim Ricee589a292001-11-03 11:09:32 -08001113dnl Checks for libutil functions
Tim Rice648f8762011-01-26 12:38:57 -08001114AC_CHECK_HEADERS([libutil.h])
1115AC_SEARCH_LIBS([login], [util bsd], [AC_DEFINE([HAVE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001116 [Define if your libraries define login()])])
Tim Rice648f8762011-01-26 12:38:57 -08001117AC_CHECK_FUNCS([fmt_scaled logout updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001118
Ben Lindstrom8697e082001-02-24 21:41:10 +00001119AC_FUNC_STRFTIME
1120
Damien Miller3c027682001-03-14 11:39:45 +11001121# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001122AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1123AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001124 [
1125 #include <glob.h>
1126 #ifdef GLOB_ALTDIRFUNC
1127 FOUNDIT
1128 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001129 ],
Damien Miller3c027682001-03-14 11:39:45 +11001130 [
Tim Rice648f8762011-01-26 12:38:57 -08001131 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001132 [Define if your system glob() function has
1133 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001134 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001135 ],
1136 [
Tim Rice648f8762011-01-26 12:38:57 -08001137 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001138 ]
1139)
Damien Millerab18c411999-11-11 10:40:23 +11001140
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001141# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001142AC_MSG_CHECKING([for gl_matchc field in glob_t])
1143AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1144 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001145 [
Tim Rice648f8762011-01-26 12:38:57 -08001146 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001147 [Define if your system glob() function has
1148 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001149 AC_MSG_RESULT([yes])
1150 ], [
1151 AC_MSG_RESULT([no])
1152])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001153
Damien Millera6e121a2010-10-07 21:39:17 +11001154# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001155AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1156AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001157#ifndef GLOB_KEEPSTAT
1158#error "glob does not support GLOB_KEEPSTAT extension"
1159#endif
1160glob_t g;
1161g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001162]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001163 [
Tim Rice648f8762011-01-26 12:38:57 -08001164 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001165 [Define if your system glob() function has
1166 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001167 AC_MSG_RESULT([yes])
1168 ], [
1169 AC_MSG_RESULT([no])
1170
1171])
Damien Millera6e121a2010-10-07 21:39:17 +11001172
Tim Rice648f8762011-01-26 12:38:57 -08001173AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001174
Damien Miller18bb4732001-03-28 14:35:30 +10001175AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001176AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001177 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001178#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001179#include <dirent.h>]],
1180 [[
1181 struct dirent d;
1182 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001183 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001184 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001185 [
Tim Rice648f8762011-01-26 12:38:57 -08001186 AC_MSG_RESULT([no])
1187 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001188 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001189 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001190 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001191 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001192 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001193 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001194 ]
1195)
1196
Damien Miller36f49652004-08-15 18:40:59 +10001197AC_MSG_CHECKING([for /proc/pid/fd directory])
1198if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001199 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1200 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001201else
Tim Rice648f8762011-01-26 12:38:57 -08001202 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001203fi
1204
Damien Millerc547bf12001-02-16 10:18:12 +11001205# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001206SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001207AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001208 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001209 [
1210 if test "x$withval" != "xno" ; then
1211
1212 if test "x$withval" != "xyes" ; then
1213 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1214 LDFLAGS="$LDFLAGS -L${withval}/lib"
1215 fi
1216
Tim Rice648f8762011-01-26 12:38:57 -08001217 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001218 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001219 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001220
Tim Rice4cec93f2002-02-26 08:40:48 -08001221 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001222 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001223 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001224#include <stdio.h>
1225#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001226 ]], [[
1227 char *ff = skey_keyinfo(""); ff="";
1228 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001229 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001230 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001231 [
Tim Rice648f8762011-01-26 12:38:57 -08001232 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001233 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1234 ])
Tim Rice648f8762011-01-26 12:38:57 -08001235 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1236 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1237#include <stdio.h>
1238#include <skey.h>
1239 ]], [[
1240 (void)skeychallenge(NULL,"name","",0);
1241 ]])],
1242 [
1243 AC_MSG_RESULT([yes])
1244 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001245 [Define if your skeychallenge()
1246 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001247 [
1248 AC_MSG_RESULT([no])
1249 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001250 fi
1251 ]
1252)
1253
1254# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001255TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001256AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001257 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001258 [
1259 if test "x$withval" != "xno" ; then
1260 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001261 saved_LDFLAGS="$LDFLAGS"
1262 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001263 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001264 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001265 if test -d "${withval}/lib"; then
1266 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001267 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001268 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001269 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001270 fi
1271 else
1272 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001273 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001274 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001275 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001276 fi
1277 fi
1278 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001279 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001280 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001281 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001282 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001283 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001284 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001285 AC_MSG_CHECKING([for libwrap])
1286 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001287#include <sys/types.h>
1288#include <sys/socket.h>
1289#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001290#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001291int deny_severity = 0, allow_severity = 0;
1292 ]], [[
1293 hosts_access(0);
1294 ]])], [
1295 AC_MSG_RESULT([yes])
1296 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001297 [Define if you want
1298 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001299 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001300 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001301 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001302 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001303
1304 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001305 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001306 fi
1307 ]
1308)
1309
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001310# Check whether user wants libedit support
1311LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001312AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001313 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001314 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001315 if test "x$withval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001316 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001317 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001318 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001319 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001320 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001321 use_pkgconfig_for_libedit=yes
1322 else
Tim Rice648f8762011-01-26 12:38:57 -08001323 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001324 fi
1325 fi
1326 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001327 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1328 if test -n "${need_dash_r}"; then
1329 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1330 else
1331 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1332 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001333 fi
Damien Miller1f789802010-10-11 22:35:22 +11001334 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001335 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1336 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1337 else
1338 LIBEDIT="-ledit -lcurses"
1339 fi
1340 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001341 AC_CHECK_LIB([edit], [el_init],
1342 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001343 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001344 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001345 ],
Tim Rice648f8762011-01-26 12:38:57 -08001346 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001347 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001348 )
Tim Rice648f8762011-01-26 12:38:57 -08001349 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001350 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001351 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1352 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001353 int i = H_SETSIZE;
1354 el_init("", NULL, NULL, NULL);
1355 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001356 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001357 [ AC_MSG_RESULT([yes]) ],
1358 [ AC_MSG_RESULT([no])
1359 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001360 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001361 fi ]
1362)
1363
Darren Tuckerd9f88912005-02-20 21:01:48 +11001364AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001365AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001366 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001367 [
Tim Rice648f8762011-01-26 12:38:57 -08001368 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001369 case "$withval" in
1370 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001371 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001372 AUDIT_MODULE=bsm
1373 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001374 AC_CHECK_HEADERS([bsm/audit.h], [],
1375 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001376 [
1377#ifdef HAVE_TIME_H
1378# include <time.h>
1379#endif
1380 ]
1381)
Tim Rice648f8762011-01-26 12:38:57 -08001382 AC_CHECK_LIB([bsm], [getaudit], [],
1383 [AC_MSG_ERROR([BSM enabled and required library not found])])
1384 AC_CHECK_FUNCS([getaudit], [],
1385 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001386 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001387 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1388 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001389 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001390 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001391 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001392 AUDIT_MODULE=linux
1393 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001394 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001395 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001396 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001397 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001398 debug)
1399 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001400 AC_MSG_RESULT([debug])
1401 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001402 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001403 no)
Tim Rice648f8762011-01-26 12:38:57 -08001404 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001405 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001406 *)
1407 AC_MSG_ERROR([Unknown audit module $withval])
1408 ;;
1409 esac ]
1410)
1411
Damien Millerfe1f1432003-02-24 15:45:42 +11001412dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001413AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001414 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001415 arc4random_buf \
1416 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001417 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001418 b64_ntop \
1419 __b64_ntop \
1420 b64_pton \
1421 __b64_pton \
1422 bcopy \
1423 bindresvport_sa \
1424 clock \
1425 closefrom \
1426 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001427 fchmod \
1428 fchown \
1429 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001430 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001431 futimes \
1432 getaddrinfo \
1433 getcwd \
1434 getgrouplist \
1435 getnameinfo \
1436 getopt \
1437 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001438 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001439 _getpty \
1440 getrlimit \
1441 getttyent \
1442 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001443 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001444 inet_aton \
1445 inet_ntoa \
1446 inet_ntop \
1447 innetgr \
1448 login_getcapbool \
1449 md5_crypt \
1450 memmove \
1451 mkdtemp \
1452 mmap \
1453 ngetaddrinfo \
1454 nsleep \
1455 ogetaddrinfo \
1456 openlog_r \
1457 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001458 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001459 prctl \
1460 pstat \
1461 readpassphrase \
1462 realpath \
1463 recvmsg \
1464 rresvport_af \
1465 sendmsg \
1466 setdtablesize \
1467 setegid \
1468 setenv \
1469 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001470 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001471 setgroups \
1472 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001473 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001474 setpcred \
1475 setproctitle \
1476 setregid \
1477 setreuid \
1478 setrlimit \
1479 setsid \
1480 setvbuf \
1481 sigaction \
1482 sigvec \
1483 snprintf \
1484 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001485 statfs \
1486 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001487 strdup \
1488 strerror \
1489 strlcat \
1490 strlcpy \
1491 strmode \
1492 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001493 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001494 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001495 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001496 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001497 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001498 sysconf \
1499 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001500 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001501 truncate \
1502 unsetenv \
1503 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001504 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001505 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001506 vhangup \
1507 vsnprintf \
1508 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001509])
Tim Rice13aae5e2001-10-21 17:53:58 -07001510
Tim Ricec7a8af02010-11-08 14:26:23 -08001511AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001512 [AC_LANG_PROGRAM(
1513 [[ #include <ctype.h> ]],
1514 [[ return (isblank('a')); ]])],
1515 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001516])
1517
Damien Millerb3c9f782010-02-12 10:11:34 +11001518# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001519AC_SEARCH_LIBS([dlopen], [dl],
1520 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001521)
1522
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001523# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001524AC_CHECK_FUNCS([gai_strerror], [
1525 AC_DEFINE([HAVE_GAI_STRERROR])
1526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001527#include <sys/types.h>
1528#include <sys/socket.h>
1529#include <netdb.h>
1530
Tim Rice648f8762011-01-26 12:38:57 -08001531const char *gai_strerror(int);
1532 ]], [[
1533 char *str;
1534 str = gai_strerror(0);
1535 ]])], [
1536 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1537 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001538
Tim Rice648f8762011-01-26 12:38:57 -08001539AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1540 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001541
Darren Tuckerf1159b52003-07-07 19:44:01 +10001542dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001543AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1544AC_CHECK_DECL([strsep],
1545 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001546 [],
1547 [
1548#ifdef HAVE_STRING_H
1549# include <string.h>
1550#endif
1551 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001552
Darren Tuckerb2427c82003-09-10 15:22:44 +10001553dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001554AC_CHECK_DECL([tcsendbreak],
1555 [AC_DEFINE([HAVE_TCSENDBREAK])],
1556 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001557 [#include <termios.h>]
1558)
1559
Tim Rice648f8762011-01-26 12:38:57 -08001560AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001561
Tim Rice648f8762011-01-26 12:38:57 -08001562AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001563 [
1564#include <sys/types.h>
1565#include <sys/socket.h>
1566 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001567
Tim Rice648f8762011-01-26 12:38:57 -08001568AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001569 [
1570#include <sys/types.h>
1571#ifdef HAVE_SYS_STAT_H
1572# include <sys/stat.h>
1573#endif
1574#ifdef HAVE_FCNTL_H
1575# include <fcntl.h>
1576#endif
1577 ])
1578
Tim Rice648f8762011-01-26 12:38:57 -08001579AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001580#include <sys/types.h>
1581#include <sys/uio.h>
1582#include <unistd.h>
1583 ])
1584
Tim Rice648f8762011-01-26 12:38:57 -08001585AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001586#include <sys/param.h>
1587 ])
1588
Tim Rice648f8762011-01-26 12:38:57 -08001589AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001590#include <stddef.h>
1591 ])
1592
Tim Rice648f8762011-01-26 12:38:57 -08001593AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001594 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001595 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001596 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001597 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001598#include <stdlib.h>
1599#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001600 ]], [[
1601 errno=0;
1602 setresuid(0,0,0);
1603 if (errno==ENOSYS)
1604 exit(1);
1605 else
1606 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001607 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001608 [AC_MSG_RESULT([yes])],
1609 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001610 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001611 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001612 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001613 )
1614])
Darren Tuckere937be32003-12-17 18:53:26 +11001615
Tim Rice648f8762011-01-26 12:38:57 -08001616AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001617 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001618 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001619 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001620 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001621#include <stdlib.h>
1622#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001623 ]], [[
1624 errno=0;
1625 setresgid(0,0,0);
1626 if (errno==ENOSYS)
1627 exit(1);
1628 else
1629 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001630 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001631 [AC_MSG_RESULT([yes])],
1632 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001633 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001634 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001635 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001636 )
1637])
Darren Tuckere937be32003-12-17 18:53:26 +11001638
Damien Millerad833b32000-08-23 10:46:23 +10001639dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001640AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001641dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001642AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1643AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001644dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001645AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1646AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001647dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001648AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001649
Tim Rice648f8762011-01-26 12:38:57 -08001650AC_CHECK_FUNC([daemon],
1651 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1652 [AC_CHECK_LIB([bsd], [daemon],
1653 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001654)
1655
Tim Rice648f8762011-01-26 12:38:57 -08001656AC_CHECK_FUNC([getpagesize],
1657 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001658 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001659 [AC_CHECK_LIB([ucb], [getpagesize],
1660 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001661)
1662
Damien Millercb170cb2000-07-01 16:52:55 +10001663# Check for broken snprintf
1664if test "x$ac_cv_func_snprintf" = "xyes" ; then
1665 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001666 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001667 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1668 [[
1669 char b[5];
1670 snprintf(b,5,"123456789");
1671 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001672 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001673 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001674 [
Tim Rice648f8762011-01-26 12:38:57 -08001675 AC_MSG_RESULT([no])
1676 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001677 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001678 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001679 ],
1680 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001681 )
1682fi
1683
Damien Miller57f39152005-11-24 19:58:19 +11001684# If we don't have a working asprintf, then we strongly depend on vsnprintf
1685# returning the right thing on overflow: the number of characters it tried to
1686# create (as per SUSv3)
1687if test "x$ac_cv_func_asprintf" != "xyes" && \
1688 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1689 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1690 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001691 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001692#include <sys/types.h>
1693#include <stdio.h>
1694#include <stdarg.h>
1695
1696int x_snprintf(char *str,size_t count,const char *fmt,...)
1697{
1698 size_t ret; va_list ap;
1699 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1700 return ret;
1701}
Tim Rice648f8762011-01-26 12:38:57 -08001702 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001703 char x[1];
1704 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001705 ]])],
1706 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001707 [
Tim Rice648f8762011-01-26 12:38:57 -08001708 AC_MSG_RESULT([no])
1709 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001710 [Define if your snprintf is busted])
1711 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1712 ],
1713 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1714 )
1715fi
1716
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001717# On systems where [v]snprintf is broken, but is declared in stdio,
1718# check that the fmt argument is const char * or just char *.
1719# This is only useful for when BROKEN_SNPRINTF
1720AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001721AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1722#include <stdio.h>
1723int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1724 ]], [[
1725 snprintf(0, 0, 0);
1726 ]])],
1727 [AC_MSG_RESULT([yes])
1728 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001729 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001730 [AC_MSG_RESULT([no])
1731 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001732
Damien Millerb4097182004-05-23 14:09:40 +10001733# Check for missing getpeereid (or equiv) support
1734NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001735if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001736 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001737 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1738#include <sys/types.h>
1739#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1740 [ AC_MSG_RESULT([yes])
1741 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1742 ], [AC_MSG_RESULT([no])
1743 NO_PEERCHECK=1
1744 ])
Damien Millerb4097182004-05-23 14:09:40 +10001745fi
1746
Damien Millere8328192003-01-07 15:18:32 +11001747dnl see whether mkstemp() requires XXXXXX
1748if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1749AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001750AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001751 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001752#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001753 ]], [[
1754 char template[]="conftest.mkstemp-test";
1755 if (mkstemp(template) == -1)
1756 exit(1);
1757 unlink(template);
1758 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001759 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001760 [
Tim Rice648f8762011-01-26 12:38:57 -08001761 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001762 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001763 [
Tim Rice648f8762011-01-26 12:38:57 -08001764 AC_MSG_RESULT([yes])
1765 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001766 ],
1767 [
Tim Rice648f8762011-01-26 12:38:57 -08001768 AC_MSG_RESULT([yes])
1769 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001770 ]
Damien Millere8328192003-01-07 15:18:32 +11001771)
1772fi
1773
Darren Tucker70a3d552003-08-21 17:58:29 +10001774dnl make sure that openpty does not reacquire controlling terminal
1775if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001776 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001777 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001778 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001779#include <stdio.h>
1780#include <sys/fcntl.h>
1781#include <sys/types.h>
1782#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001783 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001784 pid_t pid;
1785 int fd, ptyfd, ttyfd, status;
1786
1787 pid = fork();
1788 if (pid < 0) { /* failed */
1789 exit(1);
1790 } else if (pid > 0) { /* parent */
1791 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001792 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001793 exit(WEXITSTATUS(status));
1794 else
1795 exit(2);
1796 } else { /* child */
1797 close(0); close(1); close(2);
1798 setsid();
1799 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1800 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1801 if (fd >= 0)
1802 exit(3); /* Acquired ctty: broken */
1803 else
1804 exit(0); /* Did not acquire ctty: OK */
1805 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001806 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001807 [
Tim Rice648f8762011-01-26 12:38:57 -08001808 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001809 ],
1810 [
Tim Rice648f8762011-01-26 12:38:57 -08001811 AC_MSG_RESULT([no])
1812 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001813 ],
1814 [
Tim Rice648f8762011-01-26 12:38:57 -08001815 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001816 ]
1817 )
1818fi
1819
Tim Rice8bb561b2005-03-17 16:23:19 -08001820if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1821 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001822 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001823 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001824 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001825#include <stdio.h>
1826#include <sys/socket.h>
1827#include <netdb.h>
1828#include <errno.h>
1829#include <netinet/in.h>
1830
1831#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001832 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001833 int err, sock;
1834 struct addrinfo *gai_ai, *ai, hints;
1835 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1836
1837 memset(&hints, 0, sizeof(hints));
1838 hints.ai_family = PF_UNSPEC;
1839 hints.ai_socktype = SOCK_STREAM;
1840 hints.ai_flags = AI_PASSIVE;
1841
1842 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1843 if (err != 0) {
1844 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1845 exit(1);
1846 }
1847
1848 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1849 if (ai->ai_family != AF_INET6)
1850 continue;
1851
1852 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1853 sizeof(ntop), strport, sizeof(strport),
1854 NI_NUMERICHOST|NI_NUMERICSERV);
1855
1856 if (err != 0) {
1857 if (err == EAI_SYSTEM)
1858 perror("getnameinfo EAI_SYSTEM");
1859 else
1860 fprintf(stderr, "getnameinfo failed: %s\n",
1861 gai_strerror(err));
1862 exit(2);
1863 }
1864
1865 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1866 if (sock < 0)
1867 perror("socket");
1868 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1869 if (errno == EBADF)
1870 exit(3);
1871 }
1872 }
1873 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001874 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001875 [
Tim Rice648f8762011-01-26 12:38:57 -08001876 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001877 ],
1878 [
Tim Rice648f8762011-01-26 12:38:57 -08001879 AC_MSG_RESULT([no])
1880 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001881 ],
1882 [
Tim Rice648f8762011-01-26 12:38:57 -08001883 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001884 ]
1885 )
1886fi
1887
Tim Rice8bb561b2005-03-17 16:23:19 -08001888if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1889 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001890 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001891 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001892 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11001893#include <stdio.h>
1894#include <sys/socket.h>
1895#include <netdb.h>
1896#include <errno.h>
1897#include <netinet/in.h>
1898
1899#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001900 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11001901 int err, sock;
1902 struct addrinfo *gai_ai, *ai, hints;
1903 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1904
1905 memset(&hints, 0, sizeof(hints));
1906 hints.ai_family = PF_UNSPEC;
1907 hints.ai_socktype = SOCK_STREAM;
1908 hints.ai_flags = AI_PASSIVE;
1909
1910 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1911 if (err != 0) {
1912 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1913 exit(1);
1914 }
1915
1916 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1917 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1918 continue;
1919
1920 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1921 sizeof(ntop), strport, sizeof(strport),
1922 NI_NUMERICHOST|NI_NUMERICSERV);
1923
1924 if (ai->ai_family == AF_INET && err != 0) {
1925 perror("getnameinfo");
1926 exit(2);
1927 }
1928 }
1929 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001930 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001931 [
Tim Rice648f8762011-01-26 12:38:57 -08001932 AC_MSG_RESULT([yes])
1933 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001934 [Define if you have a getaddrinfo that fails
1935 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001936 ],
1937 [
Tim Rice648f8762011-01-26 12:38:57 -08001938 AC_MSG_RESULT([no])
1939 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001940 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001941 [
Tim Rice648f8762011-01-26 12:38:57 -08001942 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11001943 ]
1944 )
1945fi
1946
Darren Tuckera56f1912004-11-02 20:30:54 +11001947if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001948 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
1949 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
1950 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11001951 [
Tim Rice648f8762011-01-26 12:38:57 -08001952 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11001953 ],
1954 [
Tim Rice648f8762011-01-26 12:38:57 -08001955 AC_MSG_RESULT([yes])
1956 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11001957 [Conflicting defs for getspnam])
1958 ]
1959 )
1960fi
1961
Damien Miller606f8802000-09-16 15:39:56 +11001962AC_FUNC_GETPGRP
1963
Tim Riceaef73712002-05-11 13:17:42 -07001964# Search for OpenSSL
1965saved_CPPFLAGS="$CPPFLAGS"
1966saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08001967AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11001968 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1969 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001970 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001971 case "$withval" in
1972 # Relative paths
1973 ./*|../*) withval="`pwd`/$withval"
1974 esac
Tim Riceaef73712002-05-11 13:17:42 -07001975 if test -d "$withval/lib"; then
1976 if test -n "${need_dash_r}"; then
1977 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1978 else
1979 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1980 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10001981 elif test -d "$withval/lib64"; then
1982 if test -n "${need_dash_r}"; then
1983 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
1984 else
1985 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
1986 fi
Tim Riceaef73712002-05-11 13:17:42 -07001987 else
1988 if test -n "${need_dash_r}"; then
1989 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1990 else
1991 LDFLAGS="-L${withval} ${LDFLAGS}"
1992 fi
1993 fi
1994 if test -d "$withval/include"; then
1995 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1996 else
1997 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1998 fi
Damien Millera22ba012000-03-02 23:09:20 +11001999 fi
2000 ]
2001)
Tim Rice3d5352e2004-02-12 09:27:21 -08002002LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002003AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002004 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002005 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002006 [
Tim Riceaef73712002-05-11 13:17:42 -07002007 dnl Check default openssl install dir
2008 if test -n "${need_dash_r}"; then
2009 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002010 else
Tim Riceaef73712002-05-11 13:17:42 -07002011 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002012 fi
Tim Riceaef73712002-05-11 13:17:42 -07002013 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002014 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002015 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2016 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002017 [
2018 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2019 ]
2020 )
2021 ]
2022)
2023
Tim Riced730b782002-08-13 18:52:10 -07002024# Determine OpenSSL header version
2025AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002026AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002027 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002028#include <stdio.h>
2029#include <string.h>
2030#include <openssl/opensslv.h>
2031#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002032 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002033 FILE *fd;
2034 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002035
Damien Millera8e06ce2003-11-21 23:48:55 +11002036 fd = fopen(DATA,"w");
2037 if(fd == NULL)
2038 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002039
2040 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2041 exit(1);
2042
2043 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002044 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002045 [
2046 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002047 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002048 ],
2049 [
Tim Rice648f8762011-01-26 12:38:57 -08002050 AC_MSG_RESULT([not found])
2051 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002052 ],
2053 [
2054 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002055 ]
2056)
2057
2058# Determine OpenSSL library version
2059AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002060AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002061 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002062#include <stdio.h>
2063#include <string.h>
2064#include <openssl/opensslv.h>
2065#include <openssl/crypto.h>
2066#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002067 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002068 FILE *fd;
2069 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002070
Damien Millera8e06ce2003-11-21 23:48:55 +11002071 fd = fopen(DATA,"w");
2072 if(fd == NULL)
2073 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002074
2075 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2076 exit(1);
2077
2078 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002079 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002080 [
2081 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002082 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002083 ],
2084 [
Tim Rice648f8762011-01-26 12:38:57 -08002085 AC_MSG_RESULT([not found])
2086 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002087 ],
2088 [
2089 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002090 ]
2091)
Damien Millera22ba012000-03-02 23:09:20 +11002092
Tim Rice648f8762011-01-26 12:38:57 -08002093AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002094 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2095 [ if test "x$withval" = "xno" ; then
2096 openssl_check_nonfatal=1
2097 fi
2098 ]
2099)
2100
Damien Millerec932372002-01-22 22:16:03 +11002101# Sanity check OpenSSL headers
2102AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002103AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002104 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002105#include <string.h>
2106#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002107 ]], [[
2108 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002109 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002110 [
Tim Rice648f8762011-01-26 12:38:57 -08002111 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002112 ],
2113 [
Tim Rice648f8762011-01-26 12:38:57 -08002114 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002115 if test "x$openssl_check_nonfatal" = "x"; then
2116 AC_MSG_ERROR([Your OpenSSL headers do not match your
2117library. Check config.log for details.
2118If you are sure your installation is consistent, you can disable the check
2119by running "./configure --without-openssl-header-check".
2120Also see contrib/findssl.sh for help identifying header/library mismatches.
2121])
2122 else
2123 AC_MSG_WARN([Your OpenSSL headers do not match your
2124library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002125Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002126 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002127 ],
2128 [
2129 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002130 ]
2131)
2132
Darren Tucker639bbe82006-08-20 20:17:53 +10002133AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2134AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002135 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2136 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002137 [
Tim Rice648f8762011-01-26 12:38:57 -08002138 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002139 ],
2140 [
Tim Rice648f8762011-01-26 12:38:57 -08002141 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002142 saved_LIBS="$LIBS"
2143 LIBS="$LIBS -ldl"
2144 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2145 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002146 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2147 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002148 [
Tim Rice648f8762011-01-26 12:38:57 -08002149 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002150 ],
2151 [
Tim Rice648f8762011-01-26 12:38:57 -08002152 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002153 LIBS="$saved_LIBS"
2154 ]
2155 )
2156 ]
2157)
2158
Tim Rice648f8762011-01-26 12:38:57 -08002159AC_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 +11002160
Tim Rice648f8762011-01-26 12:38:57 -08002161AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002162 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2163 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002164 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2165 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2166#include <openssl/engine.h>
2167 ]], [[
2168 ENGINE_load_builtin_engines();
2169 ENGINE_register_all_complete();
2170 ]])],
2171 [ AC_MSG_RESULT([yes])
2172 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002173 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002174 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2175 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002176 fi ]
2177)
2178
Darren Tucker129d0bb2005-12-19 17:40:40 +11002179# Check for OpenSSL without EVP_aes_{192,256}_cbc
2180AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002181AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002182 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002183#include <string.h>
2184#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002185 ]], [[
2186 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002187 ]])],
2188 [
Tim Rice648f8762011-01-26 12:38:57 -08002189 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002190 ],
2191 [
Tim Rice648f8762011-01-26 12:38:57 -08002192 AC_MSG_RESULT([yes])
2193 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002194 [libcrypto is missing AES 192 and 256 bit functions])
2195 ]
2196)
2197
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002198AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2199AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002200 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002201#include <string.h>
2202#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002203 ]], [[
2204 if(EVP_DigestUpdate(NULL, NULL,0))
2205 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002206 ]])],
2207 [
Tim Rice648f8762011-01-26 12:38:57 -08002208 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002209 ],
2210 [
Tim Rice648f8762011-01-26 12:38:57 -08002211 AC_MSG_RESULT([no])
2212 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002213 [Define if EVP_DigestUpdate returns void])
2214 ]
2215)
2216
Tim Rice3d5352e2004-02-12 09:27:21 -08002217# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2218# because the system crypt() is more featureful.
2219if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002220 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002221fi
2222
Damien Millera8e06ce2003-11-21 23:48:55 +11002223# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002224# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002225if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002226 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002227fi
2228
Damien Milleraf87af12006-03-15 13:02:28 +11002229# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002230AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002231 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002232AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002233
Damien Miller6af914a2010-09-10 11:39:26 +10002234# Check complete ECC support in OpenSSL
2235AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2236AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002237 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002238#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002239#include <openssl/ecdh.h>
2240#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002241#include <openssl/evp.h>
2242#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002243#include <openssl/opensslv.h>
2244#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2245# error "OpenSSL < 0.9.8g has unreliable ECC code"
2246#endif
Tim Rice648f8762011-01-26 12:38:57 -08002247 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002248 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2249 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002250 ]])],
2251 [
Tim Rice648f8762011-01-26 12:38:57 -08002252 AC_MSG_RESULT([yes])
2253 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002254 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002255 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002256 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002257 ],
2258 [
Tim Rice648f8762011-01-26 12:38:57 -08002259 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002260 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002261 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002262 ]
2263)
Tim Rice648f8762011-01-26 12:38:57 -08002264AC_SUBST([TEST_SSH_ECC])
2265AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002266
Tim Rice99203ec2007-03-26 09:35:28 -07002267saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002268AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002269 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002270 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2271 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002272 [Define if system has libiaf that supports set_id])
2273 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002274])
2275LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002276
2277### Configure cryptographic random number support
2278
2279# Check wheter OpenSSL seeds itself
2280AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002281AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002282 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002283#include <string.h>
2284#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002285 ]], [[
2286 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002287 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002288 [
2289 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002290 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002291 ],
2292 [
Tim Rice648f8762011-01-26 12:38:57 -08002293 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002294 ],
2295 [
2296 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002297 # This is safe, since we will fatal() at runtime if
2298 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002299 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002300 ]
2301)
2302
Damien Millerf22019b2011-05-05 13:48:37 +10002303# PRNGD TCP socket
2304AC_ARG_WITH([prngd-port],
2305 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2306 [
2307 case "$withval" in
2308 no)
2309 withval=""
2310 ;;
2311 [[0-9]]*)
2312 ;;
2313 *)
2314 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2315 ;;
2316 esac
2317 if test ! -z "$withval" ; then
2318 PRNGD_PORT="$withval"
2319 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2320 [Port number of PRNGD/EGD random number socket])
2321 fi
2322 ]
2323)
2324
2325# PRNGD Unix domain socket
2326AC_ARG_WITH([prngd-socket],
2327 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2328 [
2329 case "$withval" in
2330 yes)
2331 withval="/var/run/egd-pool"
2332 ;;
2333 no)
2334 withval=""
2335 ;;
2336 /*)
2337 ;;
2338 *)
2339 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2340 ;;
2341 esac
2342
2343 if test ! -z "$withval" ; then
2344 if test ! -z "$PRNGD_PORT" ; then
2345 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2346 fi
2347 if test ! -r "$withval" ; then
2348 AC_MSG_WARN([Entropy socket is not readable])
2349 fi
2350 PRNGD_SOCKET="$withval"
2351 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2352 [Location of PRNGD/EGD random number socket])
2353 fi
2354 ],
2355 [
2356 # Check for existing socket only if we don't have a random device already
2357 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2358 AC_MSG_CHECKING([for PRNGD/EGD socket])
2359 # Insert other locations here
2360 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2361 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2362 PRNGD_SOCKET="$sock"
2363 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2364 break;
2365 fi
2366 done
2367 if test ! -z "$PRNGD_SOCKET" ; then
2368 AC_MSG_RESULT([$PRNGD_SOCKET])
2369 else
2370 AC_MSG_RESULT([not found])
2371 fi
2372 fi
2373 ]
2374)
2375
2376# Which randomness source do we use?
2377if test ! -z "$PRNGD_PORT" ; then
2378 RAND_MSG="PRNGd port $PRNGD_PORT"
2379elif test ! -z "$PRNGD_SOCKET" ; then
2380 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2381elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2382 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2383 [Define if you want OpenSSL's internally seeded PRNG only])
2384 RAND_MSG="OpenSSL internal ONLY"
2385else
2386 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])
2387fi
2388
Darren Tucker3e6bde42006-08-20 20:03:50 +10002389# Check for PAM libs
2390PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002391AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002392 [ --with-pam Enable PAM support ],
2393 [
2394 if test "x$withval" != "xno" ; then
2395 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2396 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2397 AC_MSG_ERROR([PAM headers not found])
2398 fi
2399
2400 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002401 AC_CHECK_LIB([dl], [dlopen], , )
2402 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2403 AC_CHECK_FUNCS([pam_getenvlist])
2404 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002405 LIBS="$saved_LIBS"
2406
2407 PAM_MSG="yes"
2408
Darren Tucker20e9f972007-03-25 18:26:01 +10002409 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002410 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002411 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002412
Darren Tucker3e6bde42006-08-20 20:03:50 +10002413 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002414 case "$LIBS" in
2415 *-ldl*)
2416 # libdl already in LIBS
2417 ;;
2418 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002419 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002420 ;;
2421 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002422 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002423 fi
2424 ]
2425)
2426
2427# Check for older PAM
2428if test "x$PAM_MSG" = "xyes" ; then
2429 # Check PAM strerror arguments (old PAM)
2430 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002432#include <stdlib.h>
2433#if defined(HAVE_SECURITY_PAM_APPL_H)
2434#include <security/pam_appl.h>
2435#elif defined (HAVE_PAM_PAM_APPL_H)
2436#include <pam/pam_appl.h>
2437#endif
Tim Rice648f8762011-01-26 12:38:57 -08002438 ]], [[
2439(void)pam_strerror((pam_handle_t *)NULL, -1);
2440 ]])], [AC_MSG_RESULT([no])], [
2441 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002442 [Define if you have an old version of PAM
2443 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002444 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002445 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002446
2447 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002448fi
Damien Miller6c21c512002-01-22 21:57:53 +11002449
Damien Millerd3f6ad22002-06-25 10:24:47 +10002450SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002451AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002452 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002453 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002454 if test -n "$withval" && test "x$withval" != "xno" && \
2455 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002456 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002457 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002458 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002459)
Tim Rice648f8762011-01-26 12:38:57 -08002460AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002461 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002462AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002463
Ben Lindstromb5628642000-10-18 00:02:25 +00002464# Cheap hack to ensure NEWS-OS libraries are arranged right.
2465if test ! -z "$SONY" ; then
2466 LIBS="$LIBS -liberty";
2467fi
2468
Damien Miller57f39152005-11-24 19:58:19 +11002469# Check for long long datatypes
2470AC_CHECK_TYPES([long long, unsigned long long, long double])
2471
2472# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002473AC_CHECK_SIZEOF([char], [1])
2474AC_CHECK_SIZEOF([short int], [2])
2475AC_CHECK_SIZEOF([int], [4])
2476AC_CHECK_SIZEOF([long int], [4])
2477AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002478
Damien Millerfa2bb692002-04-23 23:22:25 +10002479# Sanity check long long for some platforms (AIX)
2480if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2481 ac_cv_sizeof_long_long_int=0
2482fi
2483
Darren Tucker537f1ed2005-10-25 18:38:33 +10002484# compute LLONG_MIN and LLONG_MAX if we don't know them.
2485if test -z "$have_llong_max"; then
2486 AC_MSG_CHECKING([for max value of long long])
2487 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002488 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002489#include <stdio.h>
2490/* Why is this so damn hard? */
2491#ifdef __GNUC__
2492# undef __GNUC__
2493#endif
2494#define __USE_ISOC99
2495#include <limits.h>
2496#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002497#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2498
2499/*
2500 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2501 * we do this the hard way.
2502 */
2503static int
2504fprint_ll(FILE *f, long long n)
2505{
2506 unsigned int i;
2507 int l[sizeof(long long) * 8];
2508
2509 if (n < 0)
2510 if (fprintf(f, "-") < 0)
2511 return -1;
2512 for (i = 0; n != 0; i++) {
2513 l[i] = my_abs(n % 10);
2514 n /= 10;
2515 }
2516 do {
2517 if (fprintf(f, "%d", l[--i]) < 0)
2518 return -1;
2519 } while (i != 0);
2520 if (fprintf(f, " ") < 0)
2521 return -1;
2522 return 0;
2523}
Tim Rice648f8762011-01-26 12:38:57 -08002524 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002525 FILE *f;
2526 long long i, llmin, llmax = 0;
2527
2528 if((f = fopen(DATA,"w")) == NULL)
2529 exit(1);
2530
2531#if defined(LLONG_MIN) && defined(LLONG_MAX)
2532 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2533 llmin = LLONG_MIN;
2534 llmax = LLONG_MAX;
2535#else
2536 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2537 /* This will work on one's complement and two's complement */
2538 for (i = 1; i > llmax; i <<= 1, i++)
2539 llmax = i;
2540 llmin = llmax + 1LL; /* wrap */
2541#endif
2542
2543 /* Sanity check */
2544 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002545 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2546 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002547 fprintf(f, "unknown unknown\n");
2548 exit(2);
2549 }
2550
Darren Tuckerd1450db2006-03-13 19:06:51 +11002551 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002552 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002553 if (fprint_ll(f, llmax) < 0)
2554 exit(4);
2555 if (fclose(f) < 0)
2556 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002557 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002558 ]])],
2559 [
2560 llong_min=`$AWK '{print $1}' conftest.llminmax`
2561 llong_max=`$AWK '{print $2}' conftest.llminmax`
2562
Tim Rice648f8762011-01-26 12:38:57 -08002563 AC_MSG_RESULT([$llong_max])
2564 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002565 [max value of long long calculated by configure])
2566 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002567 AC_MSG_RESULT([$llong_min])
2568 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002569 [min value of long long calculated by configure])
2570 ],
2571 [
Tim Rice648f8762011-01-26 12:38:57 -08002572 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002573 ],
2574 [
2575 AC_MSG_WARN([cross compiling: not checking])
2576 ]
2577 )
2578fi
2579
2580
Damien Millera22ba012000-03-02 23:09:20 +11002581# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002582AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2584 [[ u_int a; a = 1;]])],
2585 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2586 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002587])
2588if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002589 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002590 have_u_int=1
2591fi
2592
Damien Miller61e50f12000-05-08 20:49:37 +10002593AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2595 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2596 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2597 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002598])
2599if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002600 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002601 have_intxx_t=1
2602fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002603
2604if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002605 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002606then
2607 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002608 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2609 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002610 [
Tim Rice648f8762011-01-26 12:38:57 -08002611 AC_DEFINE([HAVE_INTXX_T])
2612 AC_MSG_RESULT([yes])
2613 ], [ AC_MSG_RESULT([no])
2614 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002615fi
2616
Damien Miller578783e2000-09-23 14:12:24 +11002617AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002618 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002619#include <sys/types.h>
2620#ifdef HAVE_STDINT_H
2621# include <stdint.h>
2622#endif
2623#include <sys/socket.h>
2624#ifdef HAVE_SYS_BITYPES_H
2625# include <sys/bitypes.h>
2626#endif
Tim Rice648f8762011-01-26 12:38:57 -08002627 ]], [[
2628int64_t a; a = 1;
2629 ]])],
2630 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2631 ])
Damien Miller578783e2000-09-23 14:12:24 +11002632])
2633if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002634 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002635fi
2636
Damien Miller61e50f12000-05-08 20:49:37 +10002637AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002638 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2639 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2640 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2641 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002642])
2643if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002644 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002645 have_u_intxx_t=1
2646fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002647
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002648if test -z "$have_u_intxx_t" ; then
2649 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002650 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2651 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002652 [
Tim Rice648f8762011-01-26 12:38:57 -08002653 AC_DEFINE([HAVE_U_INTXX_T])
2654 AC_MSG_RESULT([yes])
2655 ], [ AC_MSG_RESULT([no])
2656 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002657fi
2658
Damien Miller578783e2000-09-23 14:12:24 +11002659AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002660 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2661 [[ u_int64_t a; a = 1;]])],
2662 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2663 ])
Damien Miller578783e2000-09-23 14:12:24 +11002664])
2665if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002666 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002667 have_u_int64_t=1
2668fi
2669
Tim Rice4cec93f2002-02-26 08:40:48 -08002670if test -z "$have_u_int64_t" ; then
2671 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002672 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2673 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002674 [
Tim Rice648f8762011-01-26 12:38:57 -08002675 AC_DEFINE([HAVE_U_INT64_T])
2676 AC_MSG_RESULT([yes])
2677 ], [ AC_MSG_RESULT([no])
2678 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002679fi
2680
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002681if test -z "$have_u_intxx_t" ; then
2682 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002684#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002685 ]], [[
2686 uint8_t a;
2687 uint16_t b;
2688 uint32_t c;
2689 a = b = c = 1;
2690 ]])],
2691 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2692 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002693 ])
2694 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002695 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002696 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002697 fi
2698fi
2699
2700if test -z "$have_uintxx_t" ; then
2701 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002702 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2703 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002704 [
Tim Rice648f8762011-01-26 12:38:57 -08002705 AC_DEFINE([HAVE_UINTXX_T])
2706 AC_MSG_RESULT([yes])
2707 ], [ AC_MSG_RESULT([no])
2708 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002709fi
2710
Damien Milleredb82922000-06-20 13:25:52 +10002711if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002712 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002713then
2714 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002715 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002716#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002717 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002718 int8_t a; int16_t b; int32_t c;
2719 u_int8_t e; u_int16_t f; u_int32_t g;
2720 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002721 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002722 [
Tim Rice648f8762011-01-26 12:38:57 -08002723 AC_DEFINE([HAVE_U_INTXX_T])
2724 AC_DEFINE([HAVE_INTXX_T])
2725 AC_MSG_RESULT([yes])
2726 ], [AC_MSG_RESULT([no])
2727 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002728fi
2729
Damien Miller58be7382001-09-15 21:31:54 +10002730
2731AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002732 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2733 [[ u_char foo; foo = 125; ]])],
2734 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2735 ])
Damien Miller58be7382001-09-15 21:31:54 +10002736])
2737if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002738 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002739fi
2740
Tim Rice13aae5e2001-10-21 17:53:58 -07002741TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002742
Tim Rice648f8762011-01-26 12:38:57 -08002743AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2744AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002745#include <sys/types.h>
2746#ifdef HAVE_SYS_BITYPES_H
2747#include <sys/bitypes.h>
2748#endif
2749#ifdef HAVE_SYS_STATFS_H
2750#include <sys/statfs.h>
2751#endif
2752#ifdef HAVE_SYS_STATVFS_H
2753#include <sys/statvfs.h>
2754#endif
2755])
Tim Rice4cec93f2002-02-26 08:40:48 -08002756
Tim Rice648f8762011-01-26 12:38:57 -08002757AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002758[#include <sys/types.h>
2759#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002760
Damien Miller61e50f12000-05-08 20:49:37 +10002761AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002762 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2763 [[ size_t foo; foo = 1235; ]])],
2764 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2765 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002766])
2767if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002768 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002769fi
Damien Miller95058511999-12-29 10:36:45 +11002770
Damien Miller615f9392000-05-17 22:53:33 +10002771AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2773 [[ ssize_t foo; foo = 1235; ]])],
2774 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2775 ])
Damien Miller615f9392000-05-17 22:53:33 +10002776])
2777if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002778 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002779fi
2780
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002781AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002782 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2783 [[ clock_t foo; foo = 1235; ]])],
2784 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2785 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002786])
2787if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002788 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002789fi
2790
Damien Millerb54b40e2000-06-23 08:23:34 +10002791AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002792 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002793#include <sys/types.h>
2794#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002795 ]], [[ sa_family_t foo; foo = 1235; ]])],
2796 [ ac_cv_have_sa_family_t="yes" ],
2797 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002798#include <sys/types.h>
2799#include <sys/socket.h>
2800#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002801 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002802 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002803 [ ac_cv_have_sa_family_t="no" ]
2804 )
Tim Rice648f8762011-01-26 12:38:57 -08002805 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002806])
2807if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002808 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002809 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002810fi
2811
Damien Miller0f91b4e2000-06-18 15:43:25 +10002812AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002813 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2814 [[ pid_t foo; foo = 1235; ]])],
2815 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2816 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002817])
2818if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002819 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002820fi
2821
2822AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002823 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2824 [[ mode_t foo; foo = 1235; ]])],
2825 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2826 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002827])
2828if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002829 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002830fi
2831
Damien Miller61e50f12000-05-08 20:49:37 +10002832
2833AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002834 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002835#include <sys/types.h>
2836#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002837 ]], [[ struct sockaddr_storage s; ]])],
2838 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2839 [ ac_cv_have_struct_sockaddr_storage="no"
2840 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002841])
2842if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002843 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002844 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002845fi
Damien Miller34132e52000-01-14 15:45:46 +11002846
Damien Miller61e50f12000-05-08 20:49:37 +10002847AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002848 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002849#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002850#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002851 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2852 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2853 [ ac_cv_have_struct_sockaddr_in6="no"
2854 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002855])
2856if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002857 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002858 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002859fi
Damien Miller34132e52000-01-14 15:45:46 +11002860
Damien Miller61e50f12000-05-08 20:49:37 +10002861AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002862 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002863#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002864#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002865 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2866 [ ac_cv_have_struct_in6_addr="yes" ],
2867 [ ac_cv_have_struct_in6_addr="no"
2868 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002869])
2870if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002871 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002872 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002873
2874dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002875 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002876 [
2877#ifdef HAVE_SYS_TYPES_H
2878#include <sys/types.h>
2879#endif
2880#include <netinet/in.h>
2881 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002882fi
Damien Miller34132e52000-01-14 15:45:46 +11002883
Damien Miller61e50f12000-05-08 20:49:37 +10002884AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002886#include <sys/types.h>
2887#include <sys/socket.h>
2888#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002889 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2890 [ ac_cv_have_struct_addrinfo="yes" ],
2891 [ ac_cv_have_struct_addrinfo="no"
2892 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002893])
2894if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002895 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002896 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002897fi
2898
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002899AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002900 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2901 [[ struct timeval tv; tv.tv_sec = 1;]])],
2902 [ ac_cv_have_struct_timeval="yes" ],
2903 [ ac_cv_have_struct_timeval="no"
2904 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002905])
2906if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002907 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002908 have_struct_timeval=1
2909fi
2910
Tim Rice648f8762011-01-26 12:38:57 -08002911AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08002912
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002913# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002914if test "x$ac_cv_have_int64_t" = "xno" && \
2915 test "x$ac_cv_sizeof_long_int" != "x8" && \
2916 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002917 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2918 echo "an alternative compiler (I.E., GCC) before continuing."
2919 echo ""
2920 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002921else
2922dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002923 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002924 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002925#include <stdio.h>
2926#include <string.h>
2927#ifdef HAVE_SNPRINTF
2928main()
2929{
2930 char buf[50];
2931 char expected_out[50];
2932 int mazsize = 50 ;
2933#if (SIZEOF_LONG_INT == 8)
2934 long int num = 0x7fffffffffffffff;
2935#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002936 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002937#endif
2938 strcpy(expected_out, "9223372036854775807");
2939 snprintf(buf, mazsize, "%lld", num);
2940 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002941 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002942 exit(0);
2943}
2944#else
2945main() { exit(0); }
2946#endif
Tim Rice648f8762011-01-26 12:38:57 -08002947 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002948 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002949 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002950fi
2951
Damien Miller78315eb2000-09-29 23:01:36 +11002952dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08002953OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
2954OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
2955OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
2956OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
2957OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
2958OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
2959OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
2960OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
2961OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
2962OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
2963OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
2964OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
2965OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
2966OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
2967OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
2968OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
2969OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07002970
2971AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08002972AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11002973 [Define if we don't have struct __res_state in resolv.h])],
2974[
2975#include <stdio.h>
2976#if HAVE_SYS_TYPES_H
2977# include <sys/types.h>
2978#endif
2979#include <netinet/in.h>
2980#include <arpa/nameser.h>
2981#include <resolv.h>
2982])
andre2ff7b5d2000-06-03 14:57:40 +00002983
Damien Miller61e50f12000-05-08 20:49:37 +10002984AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2985 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002987#include <sys/types.h>
2988#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002989 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
2990 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2991 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10002992])
2993if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002994 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002995fi
2996
Damien Miller61e50f12000-05-08 20:49:37 +10002997AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2998 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002999 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003000#include <sys/types.h>
3001#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003002 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3003 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3004 [ ac_cv_have___ss_family_in_struct_ss="no"
3005 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003006])
3007if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003008 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003009 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003010fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003011
Damien Millerad833b32000-08-23 10:46:23 +10003012AC_CACHE_CHECK([for pw_class field in struct passwd],
3013 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003014 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3015 [[ struct passwd p; p.pw_class = 0; ]])],
3016 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3017 [ ac_cv_have_pw_class_in_struct_passwd="no"
3018 ])
Damien Millerad833b32000-08-23 10:46:23 +10003019])
3020if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003021 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003022 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003023fi
3024
Kevin Steves82456952001-06-22 21:14:18 +00003025AC_CACHE_CHECK([for pw_expire field in struct passwd],
3026 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003027 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3028 [[ struct passwd p; p.pw_expire = 0; ]])],
3029 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3030 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3031 ])
Kevin Steves82456952001-06-22 21:14:18 +00003032])
3033if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003034 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003035 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003036fi
3037
3038AC_CACHE_CHECK([for pw_change field in struct passwd],
3039 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003040 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3041 [[ struct passwd p; p.pw_change = 0; ]])],
3042 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3043 [ ac_cv_have_pw_change_in_struct_passwd="no"
3044 ])
Kevin Steves82456952001-06-22 21:14:18 +00003045])
3046if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003047 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003048 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003049fi
Damien Miller61e50f12000-05-08 20:49:37 +10003050
Tim Rice28bbb0c2002-05-27 17:37:32 -07003051dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003052AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3053 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003054 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003055#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003056#include <sys/socket.h>
3057#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003058 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003059#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003060#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003061exit(1);
3062#endif
3063struct msghdr m;
3064m.msg_accrights = 0;
3065exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003066 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003067 [ ac_cv_have_accrights_in_msghdr="yes" ],
3068 [ ac_cv_have_accrights_in_msghdr="no" ]
3069 )
3070])
3071if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003072 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003073 [Define if your system uses access rights style
3074 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003075fi
3076
Tim Rice648f8762011-01-26 12:38:57 -08003077AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3078AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003079#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003080#include <sys/stat.h>
3081#ifdef HAVE_SYS_TIME_H
3082# include <sys/time.h>
3083#endif
3084#ifdef HAVE_SYS_MOUNT_H
3085#include <sys/mount.h>
3086#endif
3087#ifdef HAVE_SYS_STATVFS_H
3088#include <sys/statvfs.h>
3089#endif
Tim Rice648f8762011-01-26 12:38:57 -08003090 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3091 [ AC_MSG_RESULT([yes]) ],
3092 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003093
Tim Rice648f8762011-01-26 12:38:57 -08003094 AC_MSG_CHECKING([if fsid_t has member val])
3095 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003096#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003097#include <sys/statvfs.h>
3098 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3099 [ AC_MSG_RESULT([yes])
3100 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3101 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003102
Tim Rice648f8762011-01-26 12:38:57 -08003103 AC_MSG_CHECKING([if f_fsid has member __val])
3104 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003105#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003106#include <sys/statvfs.h>
3107 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3108 [ AC_MSG_RESULT([yes])
3109 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3110 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003111])
Darren Tucker77001382008-06-09 06:17:53 +10003112
Kevin Stevesa44e0352002-04-07 16:18:03 +00003113AC_CACHE_CHECK([for msg_control field in struct msghdr],
3114 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003115 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003116#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003117#include <sys/socket.h>
3118#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003119 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003120#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003121#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003122exit(1);
3123#endif
3124struct msghdr m;
3125m.msg_control = 0;
3126exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003127 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003128 [ ac_cv_have_control_in_msghdr="yes" ],
3129 [ ac_cv_have_control_in_msghdr="no" ]
3130 )
3131])
3132if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003133 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003134 [Define if your system uses ancillary data style
3135 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003136fi
3137
Damien Miller61e50f12000-05-08 20:49:37 +10003138AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003139 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3140 [[ extern char *__progname; printf("%s", __progname); ]])],
3141 [ ac_cv_libc_defines___progname="yes" ],
3142 [ ac_cv_libc_defines___progname="no"
3143 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003144])
3145if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003146 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003147fi
3148
Kevin Steves4846f4a2002-03-22 18:19:53 +00003149AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003150 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3151 [[ printf("%s", __FUNCTION__); ]])],
3152 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3153 [ ac_cv_cc_implements___FUNCTION__="no"
3154 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003155])
3156if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003157 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003158 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003159fi
3160
3161AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003162 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3163 [[ printf("%s", __func__); ]])],
3164 [ ac_cv_cc_implements___func__="yes" ],
3165 [ ac_cv_cc_implements___func__="no"
3166 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003167])
3168if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003169 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003170fi
3171
Damien Miller57f39152005-11-24 19:58:19 +11003172AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003173 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3174#include <stdarg.h>
3175va_list x,y;
3176 ]], [[ va_copy(x,y); ]])],
3177 [ ac_cv_have_va_copy="yes" ],
3178 [ ac_cv_have_va_copy="no"
3179 ])
Damien Miller57f39152005-11-24 19:58:19 +11003180])
3181if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003182 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003183fi
3184
3185AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003186 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3187#include <stdarg.h>
3188va_list x,y;
3189 ]], [[ __va_copy(x,y); ]])],
3190 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3191 ])
Damien Miller57f39152005-11-24 19:58:19 +11003192])
3193if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003194 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003195fi
3196
Damien Miller4f8e6692001-07-14 13:22:53 +10003197AC_CACHE_CHECK([whether getopt has optreset support],
3198 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003199 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3200 [[ extern int optreset; optreset = 0; ]])],
3201 [ ac_cv_have_getopt_optreset="yes" ],
3202 [ ac_cv_have_getopt_optreset="no"
3203 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003204])
3205if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003206 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003207 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003208fi
Damien Millera22ba012000-03-02 23:09:20 +11003209
Damien Millerecbb26d2000-07-15 14:59:14 +10003210AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003211 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3212[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3213 [ ac_cv_libc_defines_sys_errlist="yes" ],
3214 [ ac_cv_libc_defines_sys_errlist="no"
3215 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003216])
3217if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003218 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003219 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003220fi
3221
3222
Damien Miller11fa2cc2000-08-16 10:35:58 +10003223AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003224 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3225[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3226 [ ac_cv_libc_defines_sys_nerr="yes" ],
3227 [ ac_cv_libc_defines_sys_nerr="no"
3228 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003229])
3230if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003231 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003232fi
3233
Darren Tucker5f88d342003-10-15 16:57:57 +10003234# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003235AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3236 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003237 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003238 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003239 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003240 AC_SEARCH_LIBS([res_query], [resolv])
3241 AC_SEARCH_LIBS([dn_expand], [resolv])
3242 AC_MSG_CHECKING([if res_query will link])
3243 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003244#include <sys/types.h>
3245#include <netinet/in.h>
3246#include <arpa/nameser.h>
3247#include <netdb.h>
3248#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003249 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003250 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003251 ]])],
3252 AC_MSG_RESULT([yes]),
3253 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003254 saved_LIBS="$LIBS"
3255 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003256 AC_MSG_CHECKING([for res_query in -lresolv])
3257 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003258#include <sys/types.h>
3259#include <netinet/in.h>
3260#include <arpa/nameser.h>
3261#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003262#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003263 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003264 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003265 ]])],
3266 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003267 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003268 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003269 ])
Tim Rice648f8762011-01-26 12:38:57 -08003270 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003271 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003272 [#include <sys/types.h>
3273 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003274 AC_CHECK_MEMBER([HEADER.ad],
3275 [AC_DEFINE([HAVE_HEADER_AD], [1],
3276 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003277 [#include <arpa/nameser.h>])
3278 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003279
Tim Rice648f8762011-01-26 12:38:57 -08003280AC_MSG_CHECKING([if struct __res_state _res is an extern])
3281AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003282#include <stdio.h>
3283#if HAVE_SYS_TYPES_H
3284# include <sys/types.h>
3285#endif
3286#include <netinet/in.h>
3287#include <arpa/nameser.h>
3288#include <resolv.h>
3289extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003290 ]], [[ ]])],
3291 [AC_MSG_RESULT([yes])
3292 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003293 [Define if you have struct __res_state _res as an extern])
3294 ],
Tim Rice648f8762011-01-26 12:38:57 -08003295 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003296)
3297
Damien Miller73b42d22006-04-22 21:26:08 +10003298# Check whether user wants SELinux support
3299SELINUX_MSG="no"
3300LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003301AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003302 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003303 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003304 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003305 AC_DEFINE([WITH_SELINUX], [1],
3306 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003307 SELINUX_MSG="yes"
3308 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003309 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3310 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003311 [ LIBSELINUX="-lselinux"
3312 LIBS="$LIBS -lselinux"
3313 ],
Tim Rice648f8762011-01-26 12:38:57 -08003314 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003315 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003316 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003317 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003318 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003319 fi ]
3320)
Tim Rice648f8762011-01-26 12:38:57 -08003321AC_SUBST([SSHLIBS])
3322AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003323
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003324# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003325KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003326AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003327 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003328 [ if test "x$withval" != "xno" ; then
3329 if test "x$withval" = "xyes" ; then
3330 KRB5ROOT="/usr/local"
3331 else
3332 KRB5ROOT=${withval}
3333 fi
3334
Tim Rice648f8762011-01-26 12:38:57 -08003335 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003336 KRB5_MSG="yes"
3337
Tim Rice648f8762011-01-26 12:38:57 -08003338 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003339 [$KRB5ROOT/bin/krb5-config],
3340 [$KRB5ROOT/bin:$PATH])
3341 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003342
Tim Rice648f8762011-01-26 12:38:57 -08003343 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003344 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003345 AC_MSG_RESULT([yes])
3346 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003347 [Define this if you want GSSAPI
3348 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003349 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003350 else
Tim Rice648f8762011-01-26 12:38:57 -08003351 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003352 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003353 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003354 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3355 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003356 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003357 AC_MSG_CHECKING([whether we are using Heimdal])
3358 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3359 ]], [[ char *tmp = heimdal_version; ]])],
3360 [ AC_MSG_RESULT([yes])
3361 AC_DEFINE([HEIMDAL], [1],
3362 [Define this if you are using the Heimdal
3363 version of Kerberos V5]) ],
3364 [AC_MSG_RESULT([no])
3365 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003366 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003367 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003368 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003369 AC_MSG_CHECKING([whether we are using Heimdal])
3370 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3371 ]], [[ char *tmp = heimdal_version; ]])],
3372 [ AC_MSG_RESULT([yes])
3373 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003374 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003375 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003376 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003377 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003378 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003379 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003380 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003381 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003382
3383 ])
3384 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003385
Tim Rice648f8762011-01-26 12:38:57 -08003386 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3387 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003388 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003389 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3390 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003391 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003392 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3393 $K5LIBS)
3394 ],
3395 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003396
Tim Rice648f8762011-01-26 12:38:57 -08003397 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003398 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003399 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003400 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003401 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003402 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003403 ]
3404 )
3405
3406 oldCPP="$CPPFLAGS"
3407 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003408 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003409 [ CPPFLAGS="$oldCPP" ])
3410
Damien Millera8e06ce2003-11-21 23:48:55 +11003411 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003412 if test ! -z "$need_dash_r" ; then
3413 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3414 fi
3415 if test ! -z "$blibpath" ; then
3416 blibpath="$blibpath:${KRB5ROOT}/lib"
3417 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003418
Tim Rice648f8762011-01-26 12:38:57 -08003419 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3420 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3421 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003422
3423 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003424 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3425 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003426 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003427 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003428)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003429
Damien Millera22ba012000-03-02 23:09:20 +11003430# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003431
Damien Millerf58c6722002-05-13 13:15:42 +10003432PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003433AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003434 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003435 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003436 if test -n "$withval" && test "x$withval" != "xno" && \
3437 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003438 PRIVSEP_PATH=$withval
3439 fi
3440 ]
3441)
Tim Rice648f8762011-01-26 12:38:57 -08003442AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003443
Tim Rice648f8762011-01-26 12:38:57 -08003444AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003445 [ --with-xauth=PATH Specify path to xauth program ],
3446 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003447 if test -n "$withval" && test "x$withval" != "xno" && \
3448 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003449 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003450 fi
3451 ],
3452 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003453 TestPath="$PATH"
3454 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3455 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3456 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3457 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003458 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003459 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003460 xauth_path="/usr/openwin/bin/xauth"
3461 fi
3462 ]
3463)
3464
Damien Miller7d901272003-01-13 16:55:22 +11003465STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003466AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003467 [ --disable-strip Disable calling strip(1) on install],
3468 [
3469 if test "x$enableval" = "xno" ; then
3470 STRIP_OPT=
3471 fi
3472 ]
3473)
Tim Rice648f8762011-01-26 12:38:57 -08003474AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003475
Damien Millera19cf472000-11-29 13:28:50 +11003476if test -z "$xauth_path" ; then
3477 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003478 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003479else
Tim Rice648f8762011-01-26 12:38:57 -08003480 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003481 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003482 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003483 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003484fi
Damien Millera22ba012000-03-02 23:09:20 +11003485
Tim Rice90f42b02011-06-02 18:17:49 -07003486dnl # --with-maildir=/path/to/mail gets top priority.
3487dnl # if maildir is set in the platform case statement above we use that.
3488dnl # Otherwise we run a program to get the dir from system headers.
3489dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3490dnl # If we find _PATH_MAILDIR we do nothing because that is what
3491dnl # session.c expects anyway. Otherwise we set to the value found
3492dnl # stripping any trailing slash. If for some strage reason our program
3493dnl # does not find what it needs, we default to /var/spool/mail.
3494# Check for mail directory
3495AC_ARG_WITH([maildir],
3496 [ --with-maildir=/path/to/mail Specify your system mail directory],
3497 [
3498 if test "X$withval" != X && test "x$withval" != xno && \
3499 test "x${withval}" != xyes; then
3500 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3501 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3502 fi
3503 ],[
3504 if test "X$maildir" != "X"; then
3505 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3506 else
3507 AC_MSG_CHECKING([Discovering system mail directory])
3508 AC_RUN_IFELSE(
3509 [AC_LANG_PROGRAM([[
3510#include <stdio.h>
3511#include <string.h>
3512#ifdef HAVE_PATHS_H
3513#include <paths.h>
3514#endif
3515#ifdef HAVE_MAILLOCK_H
3516#include <maillock.h>
3517#endif
3518#define DATA "conftest.maildir"
3519 ]], [[
3520 FILE *fd;
3521 int rc;
3522
3523 fd = fopen(DATA,"w");
3524 if(fd == NULL)
3525 exit(1);
3526
3527#if defined (_PATH_MAILDIR)
3528 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3529 exit(1);
3530#elif defined (MAILDIR)
3531 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3532 exit(1);
3533#elif defined (_PATH_MAIL)
3534 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3535 exit(1);
3536#else
3537 exit (2);
3538#endif
3539
3540 exit(0);
3541 ]])],
3542 [
3543 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3544 maildir=`awk -F: '{print $2}' conftest.maildir \
3545 | sed 's|/$||'`
3546 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3547 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3548 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3549 fi
3550 ],
3551 [
3552 if test "X$ac_status" = "X2";then
3553# our test program didn't find it. Default to /var/spool/mail
3554 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3555 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3556 else
3557 AC_MSG_RESULT([*** not found ***])
3558 fi
3559 ],
3560 [
3561 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3562 ]
3563 )
3564 fi
3565 ]
3566) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003567
Darren Tucker623d92f2004-09-12 22:36:15 +10003568if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003569 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3570 disable_ptmx_check=yes
3571fi
Damien Millera22ba012000-03-02 23:09:20 +11003572if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003573 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003574 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003575 [
Tim Rice648f8762011-01-26 12:38:57 -08003576 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003577 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003578 have_dev_ptmx=1
3579 ]
3580 )
3581 fi
Damien Millera22ba012000-03-02 23:09:20 +11003582fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003583
Darren Tucker623d92f2004-09-12 22:36:15 +10003584if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003585 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003586 [
Tim Rice648f8762011-01-26 12:38:57 -08003587 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003588 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003589 have_dev_ptc=1
3590 ]
3591 )
3592else
3593 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3594fi
Damien Miller204ad072000-03-02 23:56:12 +11003595
Damien Millera22ba012000-03-02 23:09:20 +11003596# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003597AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003598 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003599 [
Damien Miller897741e2001-04-16 10:41:46 +10003600 case "$withval" in
3601 man|cat|doc)
3602 MANTYPE=$withval
3603 ;;
3604 *)
Tim Rice648f8762011-01-26 12:38:57 -08003605 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003606 ;;
3607 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003608 ]
3609)
Ben Lindstrombc709922001-04-18 18:04:21 +00003610if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003611 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003612 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003613 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3614 MANTYPE=doc
3615 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3616 MANTYPE=man
3617 else
3618 MANTYPE=cat
3619 fi
3620fi
Tim Rice648f8762011-01-26 12:38:57 -08003621AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003622if test "$MANTYPE" = "doc"; then
3623 mansubdir=man;
3624else
3625 mansubdir=$MANTYPE;
3626fi
Tim Rice648f8762011-01-26 12:38:57 -08003627AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003628
Damien Millera22ba012000-03-02 23:09:20 +11003629# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003630MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003631AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003632 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003633 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003634 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003635 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003636 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003637 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003638 fi
3639 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003640)
3641
Damien Millera22ba012000-03-02 23:09:20 +11003642# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003643AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003644 [ --without-shadow Disable shadow password support],
3645 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003646 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003647 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003648 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003649 fi
3650 ]
3651)
3652
Damien Miller1f335fb2000-06-26 11:31:33 +10003653if test -z "$disable_shadow" ; then
3654 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003655 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003656#include <sys/types.h>
3657#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003658struct spwd sp;
3659 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3660 [ sp_expire_available=yes ], [
3661 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003662
3663 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003664 AC_MSG_RESULT([yes])
3665 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003666 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003667 else
Tim Rice648f8762011-01-26 12:38:57 -08003668 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003669 fi
3670fi
3671
Damien Millera22ba012000-03-02 23:09:20 +11003672# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003673if test ! -z "$IPADDR_IN_DISPLAY" ; then
3674 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003675 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003676 [Define if you need to use IP address
3677 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003678else
Damien Millera8e06ce2003-11-21 23:48:55 +11003679 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003680 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003681 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3682 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003683 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003684 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003685 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003686 fi
3687 ]
3688 )
3689fi
Damien Miller76112de1999-12-21 11:18:08 +11003690
Darren Tuckere1a790d2003-09-16 11:52:19 +10003691# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003692AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003693 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003694 [ if test "x$enableval" = "xno"; then
3695 AC_MSG_NOTICE([/etc/default/login handling disabled])
3696 etc_default_login=no
3697 else
3698 etc_default_login=yes
3699 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003700 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3701 then
3702 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3703 etc_default_login=no
3704 else
3705 etc_default_login=yes
3706 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003707)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003708
Darren Tucker2f9573d2005-02-10 22:28:54 +11003709if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003710 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003711 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003712 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003713 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003714 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003715 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003716fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003717
Tim Rice43a1c132002-04-17 21:19:14 -07003718dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003719if test $ac_cv_func_login_getcapbool = "yes" && \
3720 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003721 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003722fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003723
Damien Millera22ba012000-03-02 23:09:20 +11003724# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003725SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003726AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003727 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003728 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003729 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003730 AC_MSG_WARN([
3731--with-default-path=PATH has no effect on this system.
3732Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003733 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003734 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003735 AC_MSG_WARN([
3736--with-default-path=PATH will only be used if PATH is not defined in
3737$external_path_file .])
3738 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003739 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003740 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003741 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003742 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003743 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3744 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003745 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003746 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003747 AC_MSG_WARN([
3748If PATH is defined in $external_path_file, ensure the path to scp is included,
3749otherwise scp will not work.])
3750 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003751 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003752 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003753/* find out what STDPATH is */
3754#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003755#ifdef HAVE_PATHS_H
3756# include <paths.h>
3757#endif
3758#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003759# ifdef _PATH_USERPATH /* Irix */
3760# define _PATH_STDPATH _PATH_USERPATH
3761# else
3762# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3763# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003764#endif
3765#include <sys/types.h>
3766#include <sys/stat.h>
3767#include <fcntl.h>
3768#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003769 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003770 FILE *fd;
3771 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003772
Tim Rice59ea0a02001-03-10 13:50:45 -08003773 fd = fopen(DATA,"w");
3774 if(fd == NULL)
3775 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003776
Tim Rice59ea0a02001-03-10 13:50:45 -08003777 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3778 exit(1);
3779
3780 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003781 ]])],
3782 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003783 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3784 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3785 )
3786# make sure $bindir is in USER_PATH so scp will work
3787 t_bindir=`eval echo ${bindir}`
3788 case $t_bindir in
3789 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3790 esac
3791 case $t_bindir in
3792 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3793 esac
3794 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3795 if test $? -ne 0 ; then
3796 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3797 if test $? -ne 0 ; then
3798 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003799 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003800 fi
3801 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003802 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003803)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003804if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003805 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3806 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003807fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003808
Damien Millera18bbd32002-05-13 10:48:57 +10003809# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003810AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003811 [ --with-superuser-path= Specify different path for super-user],
3812 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003813 if test -n "$withval" && test "x$withval" != "xno" && \
3814 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003815 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003816 [Define if you want a different $PATH
3817 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003818 superuser_path=$withval
3819 fi
3820 ]
3821)
3822
3823
Damien Miller61e50f12000-05-08 20:49:37 +10003824AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003825IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003826AC_ARG_WITH(4in6,
3827 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3828 [
3829 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003830 AC_MSG_RESULT([yes])
3831 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003832 [Detect IPv4 in IPv6 mapped addresses
3833 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003834 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003835 else
Tim Rice648f8762011-01-26 12:38:57 -08003836 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003837 fi
Tim Rice648f8762011-01-26 12:38:57 -08003838 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003839 if test "x$inet6_default_4in6" = "xyes"; then
3840 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003841 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003842 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003843 else
3844 AC_MSG_RESULT([no (default)])
3845 fi
3846 ]
3847)
3848
Damien Miller60396b02001-02-18 17:01:00 +11003849# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003850BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003851AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003852 [ --with-bsd-auth Enable BSD auth support],
3853 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003854 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003855 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003856 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003857 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003858 fi
3859 ]
3860)
3861
Damien Millera22ba012000-03-02 23:09:20 +11003862# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003863piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003864# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003865if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003866 piddir=`eval echo ${sysconfdir}`
3867 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003868 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003869 esac
3870fi
3871
Tim Rice648f8762011-01-26 12:38:57 -08003872AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003873 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3874 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003875 if test -n "$withval" && test "x$withval" != "xno" && \
3876 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003877 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003878 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003879 AC_MSG_WARN([** no $piddir directory on this system **])
3880 fi
3881 fi
3882 ]
3883)
3884
Tim Rice648f8762011-01-26 12:38:57 -08003885AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3886 [Specify location of ssh.pid])
3887AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003888
andre2ff7b5d2000-06-03 14:57:40 +00003889dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003890AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003891 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003892 [
3893 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003894 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003895 fi
3896 ]
andre2ff7b5d2000-06-03 14:57:40 +00003897)
Tim Rice648f8762011-01-26 12:38:57 -08003898AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003899 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003900 [
3901 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003902 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003903 fi
3904 ]
andre2ff7b5d2000-06-03 14:57:40 +00003905)
Tim Rice648f8762011-01-26 12:38:57 -08003906AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00003907 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003908 [
3909 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003910 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003911 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003912 fi
3913 ]
andre2ff7b5d2000-06-03 14:57:40 +00003914)
Tim Rice648f8762011-01-26 12:38:57 -08003915AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00003916 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003917 [
3918 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003919 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003920 fi
3921 ]
andre2ff7b5d2000-06-03 14:57:40 +00003922)
Tim Rice648f8762011-01-26 12:38:57 -08003923AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00003924 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003925 [
3926 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003927 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003928 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003929 fi
3930 ]
andre2ff7b5d2000-06-03 14:57:40 +00003931)
Tim Rice648f8762011-01-26 12:38:57 -08003932AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00003933 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003934 [
3935 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003936 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10003937 fi
3938 ]
andre2ff7b5d2000-06-03 14:57:40 +00003939)
Tim Rice648f8762011-01-26 12:38:57 -08003940AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00003941 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003942 [
3943 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003944 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003945 [Define if you don't want to use pututline()
3946 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003947 fi
3948 ]
andre2ff7b5d2000-06-03 14:57:40 +00003949)
Tim Rice648f8762011-01-26 12:38:57 -08003950AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00003951 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003952 [
3953 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003954 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003955 [Define if you don't want to use pututxline()
3956 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003957 fi
3958 ]
andre2ff7b5d2000-06-03 14:57:40 +00003959)
Tim Rice648f8762011-01-26 12:38:57 -08003960AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003961 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003962 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003963 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003964 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08003965 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003966 conf_lastlog_location=$withval
3967 fi
3968 ]
3969)
andre2ff7b5d2000-06-03 14:57:40 +00003970
3971dnl lastlog, [uw]tmpx? detection
3972dnl NOTE: set the paths in the platform section to avoid the
3973dnl need for command-line parameters
3974dnl lastlog and [uw]tmp are subject to a file search if all else fails
3975
3976dnl lastlog detection
3977dnl NOTE: the code itself will detect if lastlog is a directory
3978AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003979AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003980#include <sys/types.h>
3981#include <utmp.h>
3982#ifdef HAVE_LASTLOG_H
3983# include <lastlog.h>
3984#endif
Damien Miller2994e082000-06-04 15:51:47 +10003985#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003986# include <paths.h>
3987#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003988#ifdef HAVE_LOGIN_H
3989# include <login.h>
3990#endif
Tim Rice648f8762011-01-26 12:38:57 -08003991 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
3992 [ AC_MSG_RESULT([yes]) ],
3993 [
3994 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10003995 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08003996 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10003997#include <sys/types.h>
3998#include <utmp.h>
3999#ifdef HAVE_LASTLOG_H
4000# include <lastlog.h>
4001#endif
4002#ifdef HAVE_PATHS_H
4003# include <paths.h>
4004#endif
Tim Rice648f8762011-01-26 12:38:57 -08004005 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4006 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004007 [
Tim Rice648f8762011-01-26 12:38:57 -08004008 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004009 system_lastlog_path=no
4010 ])
Tim Rice648f8762011-01-26 12:38:57 -08004011])
Damien Miller2994e082000-06-04 15:51:47 +10004012
andre2ff7b5d2000-06-03 14:57:40 +00004013if test -z "$conf_lastlog_location"; then
4014 if test x"$system_lastlog_path" = x"no" ; then
4015 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004016 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004017 conf_lastlog_location=$f
4018 fi
4019 done
4020 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004021 AC_MSG_WARN([** Cannot find lastlog **])
4022 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004023 fi
4024 fi
4025fi
4026
4027if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004028 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004029 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004030fi
andre2ff7b5d2000-06-03 14:57:40 +00004031
4032dnl utmp detection
4033AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004034AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004035#include <sys/types.h>
4036#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004037#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004038# include <paths.h>
4039#endif
Tim Rice648f8762011-01-26 12:38:57 -08004040 ]], [[ char *utmp = UTMP_FILE; ]])],
4041 [ AC_MSG_RESULT([yes]) ],
4042 [ AC_MSG_RESULT([no])
4043 system_utmp_path=no
4044])
andre2ff7b5d2000-06-03 14:57:40 +00004045if test -z "$conf_utmp_location"; then
4046 if test x"$system_utmp_path" = x"no" ; then
4047 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4048 if test -f $f ; then
4049 conf_utmp_location=$f
4050 fi
4051 done
4052 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004053 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004054 fi
4055 fi
4056fi
4057if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004058 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004059 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004060fi
andre2ff7b5d2000-06-03 14:57:40 +00004061
4062dnl wtmp detection
4063AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004064AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004065#include <sys/types.h>
4066#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004067#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004068# include <paths.h>
4069#endif
Tim Rice648f8762011-01-26 12:38:57 -08004070 ]], [[ char *wtmp = WTMP_FILE; ]])],
4071 [ AC_MSG_RESULT([yes]) ],
4072 [ AC_MSG_RESULT([no])
4073 system_wtmp_path=no
4074])
andre2ff7b5d2000-06-03 14:57:40 +00004075if test -z "$conf_wtmp_location"; then
4076 if test x"$system_wtmp_path" = x"no" ; then
4077 for f in /usr/adm/wtmp /var/log/wtmp; do
4078 if test -f $f ; then
4079 conf_wtmp_location=$f
4080 fi
4081 done
4082 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004083 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004084 fi
4085 fi
4086fi
4087if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004088 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004089 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004090fi
andre2ff7b5d2000-06-03 14:57:40 +00004091
4092
andre2ff7b5d2000-06-03 14:57:40 +00004093dnl wtmpx detection
4094AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004095AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004096#include <sys/types.h>
4097#include <utmp.h>
4098#ifdef HAVE_UTMPX_H
4099#include <utmpx.h>
4100#endif
Damien Miller2994e082000-06-04 15:51:47 +10004101#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004102# include <paths.h>
4103#endif
Tim Rice648f8762011-01-26 12:38:57 -08004104 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4105 [ AC_MSG_RESULT([yes]) ],
4106 [ AC_MSG_RESULT([no])
4107 system_wtmpx_path=no
4108])
andre2ff7b5d2000-06-03 14:57:40 +00004109if test -z "$conf_wtmpx_location"; then
4110 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004111 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004112 fi
4113else
Tim Rice648f8762011-01-26 12:38:57 -08004114 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004115 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004116fi
andre2ff7b5d2000-06-03 14:57:40 +00004117
Damien Miller4018c192000-04-30 09:30:44 +10004118
Damien Miller29ea30d2000-03-17 10:54:15 +11004119if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004120 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4121 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004122fi
4123
Darren Tucker7da23cb2005-08-03 00:20:15 +10004124dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4125dnl Add now.
4126CFLAGS="$CFLAGS $werror_flags"
4127
Darren Tucker627337d2010-04-10 22:58:01 +10004128if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4129 TEST_SSH_IPV6=no
4130else
4131 TEST_SSH_IPV6=yes
4132fi
Tim Rice648f8762011-01-26 12:38:57 -08004133AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4134AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004135
Damien Millerbac2d8a2000-09-05 16:13:06 +11004136AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004137AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4138 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004139 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004140AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004141
Damien Miller7b22d652000-06-18 14:07:04 +10004142# Print summary of options
4143
Damien Miller7b22d652000-06-18 14:07:04 +10004144# Someone please show me a better way :)
4145A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4146B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4147C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4148D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004149E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004150F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004151G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004152H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4153I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4154J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004155
4156echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004157echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004158echo " User binaries: $B"
4159echo " System binaries: $C"
4160echo " Configuration files: $D"
4161echo " Askpass program: $E"
4162echo " Manual pages: $F"
4163echo " PID file: $G"
4164echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004165if test "x$external_path_file" = "x/etc/login.conf" ; then
4166echo " At runtime, sshd will use the path defined in $external_path_file"
4167echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004168else
Damien Millerf58c6722002-05-13 13:15:42 +10004169echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004170 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004171echo " (If PATH is set in $external_path_file it will be used instead. If"
4172echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4173 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004174fi
Damien Millera18bbd32002-05-13 10:48:57 +10004175if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004176echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004177fi
Damien Millerf58c6722002-05-13 13:15:42 +10004178echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004179echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004180echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004181echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004182echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004183echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004184echo " S/KEY support: $SKEY_MSG"
4185echo " TCP Wrappers support: $TCPW_MSG"
4186echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004187echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004188echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004189echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004190echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004191echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4192echo " BSD Auth support: $BSD_AUTH_MSG"
4193echo " Random number source: $RAND_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004194
Damien Miller7b22d652000-06-18 14:07:04 +10004195echo ""
4196
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004197echo " Host: ${host}"
4198echo " Compiler: ${CC}"
4199echo " Compiler flags: ${CFLAGS}"
4200echo "Preprocessor flags: ${CPPFLAGS}"
4201echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004202echo " Libraries: ${LIBS}"
4203if test ! -z "${SSHDLIBS}"; then
4204echo " +for sshd: ${SSHDLIBS}"
4205fi
Damien Miller71adf122011-01-25 12:16:15 +11004206if test ! -z "${SSHLIBS}"; then
4207echo " +for ssh: ${SSHLIBS}"
4208fi
Damien Miller7b22d652000-06-18 14:07:04 +10004209
4210echo ""
4211
Tim Rice6f1f7582004-05-30 21:38:51 -07004212if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004213 echo "SVR4 style packages are supported with \"make package\""
4214 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004215fi
4216
Damien Miller82cf0ce2000-12-20 13:34:48 +11004217if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004218 echo "PAM is enabled. You may need to install a PAM control file "
4219 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004220 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004221 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004222 echo ""
4223fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004224
Damien Millerb4097182004-05-23 14:09:40 +10004225if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004226 echo "WARNING: the operating system that you are using does not"
4227 echo "appear to support getpeereid(), getpeerucred() or the"
4228 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4229 echo "enforce security checks to prevent unauthorised connections to"
4230 echo "ssh-agent. Their absence increases the risk that a malicious"
4231 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004232 echo ""
4233fi
4234
Darren Tuckerd9f88912005-02-20 21:01:48 +11004235if test "$AUDIT_MODULE" = "bsm" ; then
4236 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4237 echo "See the Solaris section in README.platform for details."
4238fi