blob: d56bf6d36eaa5f79457f72596a96f77ae4ddfb99 [file] [log] [blame]
Damien Millerb1763622011-05-20 11:45:25 +10001# $Id: configure.ac,v 1.474 2011/05/20 01:45:25 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 Millerb1763622011-05-20 11:45:25 +100018AC_REVISION($Revision: 1.474 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Tim Rice648f8762011-01-26 12:38:57 -080020AC_LANG([C])
Damien Miller7f6ea021999-10-28 13:25:17 +100021
Tim Rice648f8762011-01-26 12:38:57 -080022AC_CONFIG_HEADER([config.h])
Damien Miller856799b2000-03-15 21:18:10 +110023AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110024AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110025AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100026
Damien Millera22ba012000-03-02 23:09:20 +110027# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100028AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110029AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100030AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110031AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080032AC_PROG_EGREP
Tim Rice648f8762011-01-26 12:38:57 -080033AC_PATH_PROG([AR], [ar])
34AC_PATH_PROG([CAT], [cat])
35AC_PATH_PROG([KILL], [kill])
36AC_PATH_PROGS([PERL], [perl5 perl])
37AC_PATH_PROG([SED], [sed])
38AC_SUBST([PERL])
39AC_PATH_PROG([ENT], [ent])
40AC_SUBST([ENT])
41AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
42AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
43AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
44AC_PATH_PROG([SH], [sh])
45AC_PATH_PROG([GROFF], [groff])
46AC_PATH_PROG([NROFF], [nroff])
47AC_PATH_PROG([MANDOC], [mandoc])
48AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110049
Damien Miller30a69e72011-01-04 08:16:27 +110050dnl select manpage formatter
51if test "x$MANDOC" != "x" ; then
52 MANFMT="$MANDOC"
53elif test "x$NROFF" != "x" ; then
54 MANFMT="$NROFF -mandoc"
55elif test "x$GROFF" != "x" ; then
56 MANFMT="$GROFF -mandoc -Tascii"
57else
58 AC_MSG_WARN([no manpage formatted found])
59 MANFMT="false"
60fi
Tim Rice648f8762011-01-26 12:38:57 -080061AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110062
Tim Rice6f1f7582004-05-30 21:38:51 -070063dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080064AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070065 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080066AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070067 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080068AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110069if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080070 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110071else
Tim Rice648f8762011-01-26 12:38:57 -080072 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110073fi
Tim Rice6f1f7582004-05-30 21:38:51 -070074
Damien Millere8bb4502001-09-25 16:39:35 +100075# System features
76AC_SYS_LARGEFILE
77
Damien Miller3f62aba2000-11-29 11:56:35 +110078if test -z "$AR" ; then
79 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
80fi
81
Damien Millerad833b32000-08-23 10:46:23 +100082# Use LOGIN_PROGRAM from environment if possible
83if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice648f8762011-01-26 12:38:57 -080084 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM"],
Tim Rice7df8d392005-09-19 09:33:39 -070085 [If your header files don't define LOGIN_PROGRAM,
86 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100087else
88 # Search for login
Tim Rice648f8762011-01-26 12:38:57 -080089 AC_PATH_PROG([LOGIN_PROGRAM_FALLBACK], [login])
Damien Millerad833b32000-08-23 10:46:23 +100090 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
Tim Rice648f8762011-01-26 12:38:57 -080091 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM_FALLBACK"])
Damien Millerad833b32000-08-23 10:46:23 +100092 fi
93fi
94
Tim Rice648f8762011-01-26 12:38:57 -080095AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +110096if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -080097 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -070098 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110099fi
100
Damien Miller166bd442000-03-16 10:48:25 +1100101if test -z "$LD" ; then
102 LD=$CC
103fi
Tim Rice648f8762011-01-26 12:38:57 -0800104AC_SUBST([LD])
Tim Riceeae17cc2005-03-17 16:52:20 -0800105
Damien Miller166bd442000-03-16 10:48:25 +1100106AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +1000107
Tim Rice648f8762011-01-26 12:38:57 -0800108AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
Darren Tucker67b37032005-06-03 17:58:31 +1000109
Darren Tuckerb7918af2008-03-09 11:34:23 +1100110use_stack_protector=1
Tim Rice648f8762011-01-26 12:38:57 -0800111AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100112 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100113 if test "x$withval" = "xno"; then
114 use_stack_protector=0
115 fi ])
116
Damien Miller134d02a2011-01-12 16:00:37 +1100117
Damien Millera8e06ce2003-11-21 23:48:55 +1100118if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Millerb1763622011-05-20 11:45:25 +1000119 OSSH_CHECK_CFLAG_COMPILE([-Wall])
120 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
121 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
122 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
123 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
124 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
125 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
126 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Tim Rice648f8762011-01-26 12:38:57 -0800127 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100128 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700129 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000130 1.*) no_attrib_nonnull=1 ;;
131 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000132 no_attrib_nonnull=1
133 ;;
134 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100135 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700136 esac
Tim Rice648f8762011-01-26 12:38:57 -0800137 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000138
Tim Rice648f8762011-01-26 12:38:57 -0800139 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000140 saved_CFLAGS="$CFLAGS"
141 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800142 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
143 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
144 [ AC_MSG_RESULT([yes]) ],
145 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000146 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800147 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000148
Darren Tuckerb7918af2008-03-09 11:34:23 +1100149 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100150 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100151 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100152 if test "x$use_stack_protector" = "x1"; then
153 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800154 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100155 saved_CFLAGS="$CFLAGS"
156 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100157 CFLAGS="$CFLAGS $t -Werror"
158 LDFLAGS="$LDFLAGS $t -Werror"
159 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800160 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
161 [[
162 char x[256];
163 snprintf(x, sizeof(x), "XXX");
164 ]])],
165 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100166 CFLAGS="$saved_CFLAGS $t"
167 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800168 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100169 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800170 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
171 [[
172 char x[256];
173 snprintf(x, sizeof(x), "XXX");
174 ]])],
175 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100176 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800177 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100178 [ AC_MSG_WARN([cross compiling: cannot test])
179 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100180 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100181 ],
Tim Rice648f8762011-01-26 12:38:57 -0800182 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100183 )
184 CFLAGS="$saved_CFLAGS"
185 LDFLAGS="$saved_LDFLAGS"
186 done
187 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100188
Darren Tucker67b37032005-06-03 17:58:31 +1000189 if test -z "$have_llong_max"; then
190 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
191 unset ac_cv_have_decl_LLONG_MAX
192 saved_CFLAGS="$CFLAGS"
193 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800194 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000195 [have_llong_max=1],
196 [CFLAGS="$saved_CFLAGS"],
197 [#include <limits.h>]
198 )
199 fi
Damien Miller166bd442000-03-16 10:48:25 +1100200fi
201
Darren Tucker391de5c2007-04-29 14:49:21 +1000202if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800203 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000204fi
205
Tim Rice648f8762011-01-26 12:38:57 -0800206AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800207 [ --without-rpath Disable auto-added -R linker paths],
208 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800209 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800210 need_dash_r=""
211 fi
212 if test "x$withval" = "xyes" ; then
213 need_dash_r=1
214 fi
215 ]
216)
217
Tim Rice1cfab232006-10-03 09:34:35 -0700218# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800219AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700220 [ --with-cflags Specify additional flags to pass to compiler],
221 [
222 if test -n "$withval" && test "x$withval" != "xno" && \
223 test "x${withval}" != "xyes"; then
224 CFLAGS="$CFLAGS $withval"
225 fi
226 ]
227)
Tim Rice648f8762011-01-26 12:38:57 -0800228AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700229 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
230 [
231 if test -n "$withval" && test "x$withval" != "xno" && \
232 test "x${withval}" != "xyes"; then
233 CPPFLAGS="$CPPFLAGS $withval"
234 fi
235 ]
236)
Tim Rice648f8762011-01-26 12:38:57 -0800237AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700238 [ --with-ldflags Specify additional flags to pass to linker],
239 [
240 if test -n "$withval" && test "x$withval" != "xno" && \
241 test "x${withval}" != "xyes"; then
242 LDFLAGS="$LDFLAGS $withval"
243 fi
244 ]
245)
Tim Rice648f8762011-01-26 12:38:57 -0800246AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700247 [ --with-libs Specify additional libraries to link with],
248 [
249 if test -n "$withval" && test "x$withval" != "xno" && \
250 test "x${withval}" != "xyes"; then
251 LIBS="$LIBS $withval"
252 fi
253 ]
254)
Tim Rice648f8762011-01-26 12:38:57 -0800255AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700256 [ --with-Werror Build main code with -Werror],
257 [
258 if test -n "$withval" && test "x$withval" != "xno"; then
259 werror_flags="-Werror"
260 if test "x${withval}" != "xyes"; then
261 werror_flags="$withval"
262 fi
263 fi
264 ]
265)
266
Tim Rice648f8762011-01-26 12:38:57 -0800267AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700268 bstring.h \
269 crypt.h \
270 crypto/sha2.h \
271 dirent.h \
272 endian.h \
273 features.h \
274 fcntl.h \
275 floatingpoint.h \
276 getopt.h \
277 glob.h \
278 ia.h \
279 iaf.h \
280 limits.h \
281 login.h \
282 maillock.h \
283 ndir.h \
284 net/if_tun.h \
285 netdb.h \
286 netgroup.h \
287 pam/pam_appl.h \
288 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000289 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700290 pty.h \
291 readpassphrase.h \
292 rpc/types.h \
293 security/pam_appl.h \
294 sha2.h \
295 shadow.h \
296 stddef.h \
297 stdint.h \
298 string.h \
299 strings.h \
300 sys/audit.h \
301 sys/bitypes.h \
302 sys/bsdtty.h \
303 sys/cdefs.h \
304 sys/dir.h \
305 sys/mman.h \
306 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000307 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700308 sys/prctl.h \
309 sys/pstat.h \
310 sys/select.h \
311 sys/stat.h \
312 sys/stream.h \
313 sys/stropts.h \
314 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000315 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700316 sys/sysmacros.h \
317 sys/time.h \
318 sys/timers.h \
319 sys/un.h \
320 time.h \
321 tmpdir.h \
322 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700323 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700324 unistd.h \
325 usersec.h \
326 util.h \
327 utime.h \
328 utmp.h \
329 utmpx.h \
330 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800331])
Tim Rice1cfab232006-10-03 09:34:35 -0700332
333# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800334AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700335#ifdef HAVE_SYS_TIME_H
336# include <sys/time.h>
337#endif
338])
339
340# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800341AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700342#ifdef HAVE_SYS_STREAM_H
343# include <sys/stream.h>
344#endif
345])
346
347# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800348AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700349#include <sys/types.h>
350])
351
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000352# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800353AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000354#include <sys/param.h>
355])
356
Damien Miller1b06dc32006-08-31 03:24:41 +1000357# Messages for features tested for in target-specific section
358SIA_MSG="no"
359SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100360SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000361
Damien Millera22ba012000-03-02 23:09:20 +1100362# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100363case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100364*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000365 # Some versions of VAC won't allow macro redefinitions at
366 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
367 # particularly with older versions of vac or xlc.
368 # It also throws errors about null macro argments, but these are
369 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800370 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000371 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800372 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000373#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800374#define testmacro bar]],
375 [[ exit(0); ]])],
376 [ AC_MSG_RESULT([yes]) ],
377 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000378 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
379 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
380 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
381 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
382 ]
383 )
384
Damien Millera8e06ce2003-11-21 23:48:55 +1100385 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000386 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800387 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100388 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000389 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000390 if test "$GCC" = "yes"; then
391 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
392 else
393 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
394 fi
395 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000396 if (test -z "$blibflags"); then
397 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800398 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
399 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000400 fi
401 done
402 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800403 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000404 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
405 else
Tim Rice648f8762011-01-26 12:38:57 -0800406 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000407 fi
408 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000409 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800410 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700411 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800412 [AC_CHECK_LIB([s], [authenticate],
413 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700414 LIBS="$LIBS -ls"
415 ])
416 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100417 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100418 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100419 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000420 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800421 AC_CHECK_DECLS([loginfailed],
422 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
423 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
424 [[ (void)loginfailed("user","host","tty",0); ]])],
425 [AC_MSG_RESULT([yes])
426 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
427 [Define if your AIX loginfailed() function
428 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
429 ])],
430 [],
431 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000432 )
Tim Rice648f8762011-01-26 12:38:57 -0800433 AC_CHECK_FUNCS([getgrset setauthdb])
434 AC_CHECK_DECL([F_CLOSEM],
435 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000436 [],
437 [ #include <limits.h>
438 #include <fcntl.h> ]
439 )
Darren Tucker691d5232005-02-15 21:45:57 +1100440 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800441 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
442 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700443 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800444 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
445 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000446 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800447 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
448 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700449 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800450 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700451 [Define to a Set Process Title type if your system is
452 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800453 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100454 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800455 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100456 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100457*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100458 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100459 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800460 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
461 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
462 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700463 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800464 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700465 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800466 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700467 [Define if the concept of ports only accessible to
468 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800469 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700470 [Define if your platform needs to skip post auth
471 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800472 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
473 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100474 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000475*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800476 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700477 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800478 AC_DEFINE([SETEUID_BREAKS_SETUID])
479 AC_DEFINE([BROKEN_SETREUID])
480 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000481 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000482*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800483 AC_MSG_CHECKING([if we have working getaddrinfo])
484 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000485main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
486 exit(0);
487 else
488 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800489}
490 ]])],
491 [AC_MSG_RESULT([working])],
492 [AC_MSG_RESULT([buggy])
493 AC_DEFINE([BROKEN_GETADDRINFO], [1],
494 [getaddrinfo is broken (if present)])
495 ],
496 [AC_MSG_RESULT([assume it is working])])
497 AC_DEFINE([SETEUID_BREAKS_SETUID])
498 AC_DEFINE([BROKEN_SETREUID])
499 AC_DEFINE([BROKEN_SETREGID])
500 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
501 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700502 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800503 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
504 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000505 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800506 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000507 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800508 m4_pattern_allow([AU_IPv])
509 AC_CHECK_DECL([AU_IPv4], [],
510 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100511 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800512 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100513 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100514 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000515 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000516*-*-dragonfly*)
517 SSHDLIBS="$SSHDLIBS -lcrypt"
518 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100519*-*-haiku*)
520 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800521 AC_CHECK_LIB([network], [socket])
522 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100523 MANTYPE=man
524 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000525*-*-hpux*)
526 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000527 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100528 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800529 AC_DEFINE([USE_PIPES])
530 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700531 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800532 AC_DEFINE([LOGIN_NEEDS_UTMPX])
533 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700534 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800535 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tucker1e6616b2005-10-08 12:07:01 +1000536 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700537 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800538 AC_CHECK_LIB([xnet], [t_error], ,
539 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000540
541 # next, we define all of the options specific to major releases
542 case "$host" in
543 *-*-hpux10*)
544 if test -z "$GCC"; then
545 CFLAGS="$CFLAGS -Ae"
546 fi
547 ;;
548 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800549 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700550 [Define if you are using Solaris-derived PAM which
551 passes pam_messages to the conversation function
552 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800553 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700554 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800555 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000556 check_for_hpux_broken_getaddrinfo=1
557 check_for_conflicting_getspnam=1
558 ;;
559 esac
560
561 # lastly, we define options specific to minor releases
562 case "$host" in
563 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800564 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700565 [Define if you have SecureWare-based
566 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000567 disable_ptmx_check=yes
568 LIBS="$LIBS -lsecpw"
569 ;;
570 esac
Damien Miller1bead332000-04-30 00:47:29 +1000571 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100572*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100573 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800574 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700575 [Define if you system's inet_ntoa is busted
576 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800577 AC_DEFINE([SETEUID_BREAKS_SETUID])
578 AC_DEFINE([BROKEN_SETREUID])
579 AC_DEFINE([BROKEN_SETREGID])
580 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700581 [Define if you shouldn't strip 'tty' from your
582 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800583 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100584 ;;
585*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100586 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800587 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700588 [Define if you have/want arrays
589 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700591 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800592 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700593 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800594 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700595 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800596 AC_DEFINE([BROKEN_INET_NTOA])
597 AC_DEFINE([SETEUID_BREAKS_SETUID])
598 AC_DEFINE([BROKEN_SETREUID])
599 AC_DEFINE([BROKEN_SETREGID])
600 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
601 AC_DEFINE([WITH_ABBREV_NO_TTY])
602 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100603 ;;
Damien Miller90551722009-02-16 15:37:03 +1100604*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
605 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800606 AC_DEFINE([PAM_TTY_KLUDGE])
607 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
608 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
609 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
610 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100611 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100612*-*-linux*)
613 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100614 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000615 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800616 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700617 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800618 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700619 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800620 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
621 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700622 [Define to whatever link() returns for "not supported"
623 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800624 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
625 AC_DEFINE([USE_BTMP])
626 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100627 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000628 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000629 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800630 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700631 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000632 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000633 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100634 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800635 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100636 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800637 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100638 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800639 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100640 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800641 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100642 [Prepend the address family to IP tunnel traffic])
643 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100644 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000645mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800646 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000647 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000648 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100649*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000650 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800651 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800652 need_dash_r=1
653 fi
Tim Rice648f8762011-01-26 12:38:57 -0800654 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100655 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800656 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
657 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100658 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100659 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100660*-*-freebsd*)
661 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800662 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
663 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100664 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
666 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100667 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000668*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800669 AC_DEFINE([SETEUID_BREAKS_SETUID])
670 AC_DEFINE([BROKEN_SETREUID])
671 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000672 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000673*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000674 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100675 conf_utmp_location=/etc/utmp
676 conf_wtmp_location=/usr/adm/wtmp
677 MAIL=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800678 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
679 AC_DEFINE([BROKEN_REALPATH])
680 AC_DEFINE([USE_PIPES])
681 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000682 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000683*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800684 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
685 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
686 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
687 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000688 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000689 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100690*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800691 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800692 need_dash_r=1
693 fi
Tim Rice648f8762011-01-26 12:38:57 -0800694 AC_DEFINE([PAM_SUN_CODEBASE])
695 AC_DEFINE([LOGIN_NEEDS_UTMPX])
696 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700697 [Some versions of /bin/login need the TERM supplied
698 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800699 AC_DEFINE([PAM_TTY_KLUDGE])
700 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700701 [Define if pam_chauthtok wants real uid set
702 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800703 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000704 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800705 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700706 [Define if sshd somehow reacquires a controlling TTY
707 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800708 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000709 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800710 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000711 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000712 # hardwire lastlog location (can't detect it on some versions)
713 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800714 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000715 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
716 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_MSG_RESULT([yes])
718 AC_DEFINE([DISABLE_UTMP])
719 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700720 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000721 else
Tim Rice648f8762011-01-26 12:38:57 -0800722 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000723 fi
Tim Rice648f8762011-01-26 12:38:57 -0800724 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000725 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
726 [
Tim Rice648f8762011-01-26 12:38:57 -0800727 AC_CHECK_LIB([contract], [ct_tmpl_activate],
728 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000729 [Define if you have Solaris process contracts])
730 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000731 SPC_MSG="yes" ], )
732 ],
733 )
Tim Rice648f8762011-01-26 12:38:57 -0800734 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100735 [ --with-solaris-projects Enable Solaris projects (experimental)],
736 [
Tim Rice648f8762011-01-26 12:38:57 -0800737 AC_CHECK_LIB([project], [setproject],
738 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100739 [Define if you have Solaris projects])
740 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100741 SP_MSG="yes" ], )
742 ],
743 )
Damien Miller75b1d102000-01-07 14:01:41 +1100744 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000745*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000746 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800747 AC_CHECK_FUNCS([getpwanam])
748 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000749 conf_utmp_location=/etc/utmp
750 conf_wtmp_location=/var/adm/wtmp
751 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800752 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000753 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000754*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700755 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800756 AC_DEFINE([USE_PIPES])
757 AC_DEFINE([SSHD_ACQUIRES_CTTY])
758 AC_DEFINE([SETEUID_BREAKS_SETUID])
759 AC_DEFINE([BROKEN_SETREUID])
760 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000761 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000762*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700763 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100765 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800766 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100767 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([USE_PIPES])
769 AC_DEFINE([IP_TOS_IS_BROKEN])
770 AC_DEFINE([SETEUID_BREAKS_SETUID])
771 AC_DEFINE([BROKEN_SETREUID])
772 AC_DEFINE([BROKEN_SETREGID])
773 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000774 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700775 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
776 # Attention: always take care to bind libsocket and libnsl before libc,
777 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000778 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800779# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100780*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800781 AC_DEFINE([USE_PIPES])
782 AC_DEFINE([SETEUID_BREAKS_SETUID])
783 AC_DEFINE([BROKEN_SETREUID])
784 AC_DEFINE([BROKEN_SETREGID])
785 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
786 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100787 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800788# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100789*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800790 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800791 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
792 AC_DEFINE([USE_PIPES])
793 AC_DEFINE([SETEUID_BREAKS_SETUID])
794 AC_DEFINE([BROKEN_GETADDRINFO])
795 AC_DEFINE([BROKEN_SETREUID])
796 AC_DEFINE([BROKEN_SETREGID])
797 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700798 case "$host" in
799 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
800 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800801 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700802 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800803 AC_DEFINE([BROKEN_UPDWTMPX])
804 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
805 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
806 AC_DEFINE([HAVE_SECUREWARE])
807 AC_DEFINE([DISABLE_SHADOW])
808 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700809 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800810 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800811 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800812 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700813 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100814 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100815*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100816 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800817# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100818*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800819 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100820 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800821# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100822*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800823 if test -z "$GCC"; then
824 CFLAGS="$CFLAGS -belf"
825 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100826 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000827 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800828 AC_DEFINE([USE_PIPES])
829 AC_DEFINE([HAVE_SECUREWARE])
830 AC_DEFINE([DISABLE_SHADOW])
831 AC_DEFINE([DISABLE_FD_PASSING])
832 AC_DEFINE([SETEUID_BREAKS_SETUID])
833 AC_DEFINE([BROKEN_GETADDRINFO])
834 AC_DEFINE([BROKEN_SETREUID])
835 AC_DEFINE([BROKEN_SETREGID])
836 AC_DEFINE([WITH_ABBREV_NO_TTY])
837 AC_DEFINE([BROKEN_UPDWTMPX])
838 AC_DEFINE([PASSWD_NEEDS_USERNAME])
839 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700840 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700841 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000842 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000843*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800844 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700845 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800846 AC_DEFINE([SETEUID_BREAKS_SETUID])
847 AC_DEFINE([BROKEN_SETREUID])
848 AC_DEFINE([BROKEN_SETREGID])
849 AC_DEFINE([USE_PIPES])
850 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000851 LDFLAGS="$LDFLAGS"
852 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
853 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000854 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000855*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800856 AC_DEFINE([SETEUID_BREAKS_SETUID])
857 AC_DEFINE([BROKEN_SETREUID])
858 AC_DEFINE([BROKEN_SETREGID])
859 AC_DEFINE([WITH_ABBREV_NO_TTY])
860 AC_DEFINE([USE_PIPES])
861 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000862 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100863 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000864 MANTYPE=cat
865 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000866*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800867 AC_DEFINE([SETEUID_BREAKS_SETUID])
868 AC_DEFINE([BROKEN_SETREUID])
869 AC_DEFINE([BROKEN_SETREGID])
870 AC_DEFINE([USE_PIPES])
871 AC_DEFINE([DISABLE_FD_PASSING])
872 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000873 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
874 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
875 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700876 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000877*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800878 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000879 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800880 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000881 [ --with-osfsia Enable Digital Unix SIA],
882 [
883 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800884 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000885 no_osfsia=1
886 fi
887 ],
888 )
889 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000890 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800891 AC_MSG_RESULT([yes])
892 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700893 [Define if you have Digital Unix Security
894 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800895 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700896 [Define if you don't want to use your
897 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800898 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000899 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000900 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000901 else
Tim Rice648f8762011-01-26 12:38:57 -0800902 AC_MSG_RESULT([no])
903 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700904 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000905 fi
906 fi
Tim Rice648f8762011-01-26 12:38:57 -0800907 AC_DEFINE([BROKEN_GETADDRINFO])
908 AC_DEFINE([SETEUID_BREAKS_SETUID])
909 AC_DEFINE([BROKEN_SETREUID])
910 AC_DEFINE([BROKEN_SETREGID])
911 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000912 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000913
Tim Rice70335a62006-02-04 17:42:58 -0800914*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800915 AC_DEFINE([USE_PIPES])
916 AC_DEFINE([NO_X11_UNIX_SOCKETS])
917 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
918 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
919 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
920 AC_DEFINE([DISABLE_LASTLOG])
921 AC_DEFINE([SSHD_ACQUIRES_CTTY])
922 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800923 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000924 case "$host" in
925 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800926 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000927 ;;
928 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000929 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000930
931*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800932 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
933 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
934 AC_DEFINE([NEED_SETPGRP])
935 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700936 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000937
938*-*-lynxos)
939 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -0800940 AC_DEFINE([MISSING_HOWMANY])
941 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000942 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100943esac
944
Tim Rice648f8762011-01-26 12:38:57 -0800945AC_MSG_CHECKING([compiler and flags for sanity])
946AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
947 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +1000948 [
Tim Rice648f8762011-01-26 12:38:57 -0800949 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +1000950 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000951 ],
952 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000953)
954
Darren Tucker0c9653f2005-05-28 15:58:14 +1000955dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100956# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -0800957AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
958AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000959
Tim Rice1e1ef642003-09-11 22:19:31 -0700960dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -0800961AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
962 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -0700963 AC_CACHE_CHECK([for broken dirname],
964 ac_cv_have_broken_dirname, [
965 save_LIBS="$LIBS"
966 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000967 AC_RUN_IFELSE(
968 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700969#include <libgen.h>
970#include <string.h>
971
972int main(int argc, char **argv) {
973 char *s, buf[32];
974
975 strncpy(buf,"/etc", 32);
976 s = dirname(buf);
977 if (!s || strncmp(s, "/", 32) != 0) {
978 exit(1);
979 } else {
980 exit(0);
981 }
982}
Darren Tucker314d89e2005-10-17 23:29:23 +1000983 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700984 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000985 [ ac_cv_have_broken_dirname="yes" ],
986 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700987 )
988 LIBS="$save_LIBS"
989 ])
990 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
991 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -0800992 AC_DEFINE([HAVE_DIRNAME])
993 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -0700994 fi
995 ])
996])
997
Tim Rice648f8762011-01-26 12:38:57 -0800998AC_CHECK_FUNC([getspnam], ,
999 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1000AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1001 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001002
Tim Rice13aae5e2001-10-21 17:53:58 -07001003dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001004AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001005 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001006 [ if test "x$withval" = "xno" ; then
1007 AC_MSG_ERROR([*** zlib is required ***])
1008 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001009 if test -d "$withval/lib"; then
1010 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001011 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001012 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001013 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001014 fi
1015 else
1016 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001017 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001018 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001019 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001020 fi
1021 fi
1022 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001023 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001024 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001025 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001026 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001027 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001028)
1029
Tim Rice648f8762011-01-26 12:38:57 -08001030AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1031AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001032 [
1033 saved_CPPFLAGS="$CPPFLAGS"
1034 saved_LDFLAGS="$LDFLAGS"
1035 save_LIBS="$LIBS"
1036 dnl Check default zlib install dir
1037 if test -n "${need_dash_r}"; then
1038 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1039 else
1040 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1041 fi
1042 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1043 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001044 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001045 [
1046 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1047 ]
1048 )
1049 ]
1050)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001051
Tim Rice648f8762011-01-26 12:38:57 -08001052AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001053 [ --without-zlib-version-check Disable zlib version check],
1054 [ if test "x$withval" = "xno" ; then
1055 zlib_check_nonfatal=1
1056 fi
1057 ]
1058)
1059
Tim Rice648f8762011-01-26 12:38:57 -08001060AC_MSG_CHECKING([for possibly buggy zlib])
1061AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001062#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001063#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001064 ]],
1065 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001066 int a=0, b=0, c=0, d=0, n, v;
1067 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1068 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001069 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001070 v = a*1000000 + b*10000 + c*100 + d;
1071 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1072
1073 /* 1.1.4 is OK */
1074 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001075 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001076
Darren Tucker41097ed2005-07-25 15:24:21 +10001077 /* 1.2.3 and up are OK */
1078 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001079 exit(0);
1080
Darren Tucker2dcd2392004-01-23 17:13:33 +11001081 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001082 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001083 AC_MSG_RESULT([no]),
1084 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001085 if test -z "$zlib_check_nonfatal" ; then
1086 AC_MSG_ERROR([*** zlib too old - check config.log ***
1087Your reported zlib version has known security problems. It's possible your
1088vendor has fixed these problems without changing the version number. If you
1089are sure this is the case, you can disable the check by running
1090"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001091If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001092See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001093 else
1094 AC_MSG_WARN([zlib version may have security problems])
1095 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001096 ],
1097 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001098)
Damien Miller6f9c3372000-10-25 10:06:04 +11001099
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001100dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001101AC_CHECK_FUNC([strcasecmp],
1102 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001103)
Tim Rice648f8762011-01-26 12:38:57 -08001104AC_CHECK_FUNCS([utimes],
1105 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001106 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001107)
Damien Millerab18c411999-11-11 10:40:23 +11001108
Tim Ricee589a292001-11-03 11:09:32 -08001109dnl Checks for libutil functions
Tim Rice648f8762011-01-26 12:38:57 -08001110AC_CHECK_HEADERS([libutil.h])
1111AC_SEARCH_LIBS([login], [util bsd], [AC_DEFINE([HAVE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001112 [Define if your libraries define login()])])
Tim Rice648f8762011-01-26 12:38:57 -08001113AC_CHECK_FUNCS([fmt_scaled logout updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001114
Ben Lindstrom8697e082001-02-24 21:41:10 +00001115AC_FUNC_STRFTIME
1116
Damien Miller3c027682001-03-14 11:39:45 +11001117# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001118AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1119AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001120 [
1121 #include <glob.h>
1122 #ifdef GLOB_ALTDIRFUNC
1123 FOUNDIT
1124 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001125 ],
Damien Miller3c027682001-03-14 11:39:45 +11001126 [
Tim Rice648f8762011-01-26 12:38:57 -08001127 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001128 [Define if your system glob() function has
1129 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001130 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001131 ],
1132 [
Tim Rice648f8762011-01-26 12:38:57 -08001133 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001134 ]
1135)
Damien Millerab18c411999-11-11 10:40:23 +11001136
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001137# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001138AC_MSG_CHECKING([for gl_matchc field in glob_t])
1139AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1140 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001141 [
Tim Rice648f8762011-01-26 12:38:57 -08001142 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001143 [Define if your system glob() function has
1144 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001145 AC_MSG_RESULT([yes])
1146 ], [
1147 AC_MSG_RESULT([no])
1148])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001149
Damien Millera6e121a2010-10-07 21:39:17 +11001150# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001151AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1152AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001153#ifndef GLOB_KEEPSTAT
1154#error "glob does not support GLOB_KEEPSTAT extension"
1155#endif
1156glob_t g;
1157g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001158]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001159 [
Tim Rice648f8762011-01-26 12:38:57 -08001160 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001161 [Define if your system glob() function has
1162 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001163 AC_MSG_RESULT([yes])
1164 ], [
1165 AC_MSG_RESULT([no])
1166
1167])
Damien Millera6e121a2010-10-07 21:39:17 +11001168
Tim Rice648f8762011-01-26 12:38:57 -08001169AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001170
Damien Miller18bb4732001-03-28 14:35:30 +10001171AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001172AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001173 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001174#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001175#include <dirent.h>]],
1176 [[
1177 struct dirent d;
1178 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001179 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001180 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001181 [
Tim Rice648f8762011-01-26 12:38:57 -08001182 AC_MSG_RESULT([no])
1183 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001184 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001185 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001186 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001187 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001188 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001189 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001190 ]
1191)
1192
Damien Miller36f49652004-08-15 18:40:59 +10001193AC_MSG_CHECKING([for /proc/pid/fd directory])
1194if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001195 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1196 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001197else
Tim Rice648f8762011-01-26 12:38:57 -08001198 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001199fi
1200
Damien Millerc547bf12001-02-16 10:18:12 +11001201# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001202SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001203AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001204 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001205 [
1206 if test "x$withval" != "xno" ; then
1207
1208 if test "x$withval" != "xyes" ; then
1209 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1210 LDFLAGS="$LDFLAGS -L${withval}/lib"
1211 fi
1212
Tim Rice648f8762011-01-26 12:38:57 -08001213 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001214 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001215 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001216
Tim Rice4cec93f2002-02-26 08:40:48 -08001217 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001218 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001219 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001220#include <stdio.h>
1221#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001222 ]], [[
1223 char *ff = skey_keyinfo(""); ff="";
1224 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001225 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001226 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001227 [
Tim Rice648f8762011-01-26 12:38:57 -08001228 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001229 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1230 ])
Tim Rice648f8762011-01-26 12:38:57 -08001231 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1232 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1233#include <stdio.h>
1234#include <skey.h>
1235 ]], [[
1236 (void)skeychallenge(NULL,"name","",0);
1237 ]])],
1238 [
1239 AC_MSG_RESULT([yes])
1240 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001241 [Define if your skeychallenge()
1242 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001243 [
1244 AC_MSG_RESULT([no])
1245 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001246 fi
1247 ]
1248)
1249
1250# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001251TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001252AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001253 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001254 [
1255 if test "x$withval" != "xno" ; then
1256 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001257 saved_LDFLAGS="$LDFLAGS"
1258 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001259 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001260 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001261 if test -d "${withval}/lib"; then
1262 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001263 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001264 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001265 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001266 fi
1267 else
1268 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001269 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001270 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001271 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001272 fi
1273 fi
1274 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001275 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001276 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001277 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001278 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001279 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001280 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001281 AC_MSG_CHECKING([for libwrap])
1282 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001283#include <sys/types.h>
1284#include <sys/socket.h>
1285#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001286#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001287int deny_severity = 0, allow_severity = 0;
1288 ]], [[
1289 hosts_access(0);
1290 ]])], [
1291 AC_MSG_RESULT([yes])
1292 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001293 [Define if you want
1294 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001295 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001296 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001297 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001298 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001299
1300 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001301 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001302 fi
1303 ]
1304)
1305
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001306# Check whether user wants libedit support
1307LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001308AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001309 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001310 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001311 if test "x$withval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001312 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001313 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001314 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001315 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001316 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001317 use_pkgconfig_for_libedit=yes
1318 else
Tim Rice648f8762011-01-26 12:38:57 -08001319 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001320 fi
1321 fi
1322 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001323 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1324 if test -n "${need_dash_r}"; then
1325 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1326 else
1327 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1328 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001329 fi
Damien Miller1f789802010-10-11 22:35:22 +11001330 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001331 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1332 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1333 else
1334 LIBEDIT="-ledit -lcurses"
1335 fi
1336 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001337 AC_CHECK_LIB([edit], [el_init],
1338 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001339 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001340 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001341 ],
Tim Rice648f8762011-01-26 12:38:57 -08001342 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001343 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001344 )
Tim Rice648f8762011-01-26 12:38:57 -08001345 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001346 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001347 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1348 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001349 int i = H_SETSIZE;
1350 el_init("", NULL, NULL, NULL);
1351 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001352 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001353 [ AC_MSG_RESULT([yes]) ],
1354 [ AC_MSG_RESULT([no])
1355 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001356 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001357 fi ]
1358)
1359
Darren Tuckerd9f88912005-02-20 21:01:48 +11001360AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001361AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001362 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001363 [
Tim Rice648f8762011-01-26 12:38:57 -08001364 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001365 case "$withval" in
1366 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001367 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001368 AUDIT_MODULE=bsm
1369 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001370 AC_CHECK_HEADERS([bsm/audit.h], [],
1371 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001372 [
1373#ifdef HAVE_TIME_H
1374# include <time.h>
1375#endif
1376 ]
1377)
Tim Rice648f8762011-01-26 12:38:57 -08001378 AC_CHECK_LIB([bsm], [getaudit], [],
1379 [AC_MSG_ERROR([BSM enabled and required library not found])])
1380 AC_CHECK_FUNCS([getaudit], [],
1381 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001382 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001383 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1384 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001385 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001386 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001387 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001388 AUDIT_MODULE=linux
1389 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001390 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001391 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001392 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001393 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001394 debug)
1395 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001396 AC_MSG_RESULT([debug])
1397 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001398 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001399 no)
Tim Rice648f8762011-01-26 12:38:57 -08001400 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001401 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001402 *)
1403 AC_MSG_ERROR([Unknown audit module $withval])
1404 ;;
1405 esac ]
1406)
1407
Damien Millerfe1f1432003-02-24 15:45:42 +11001408dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001409AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001410 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001411 arc4random_buf \
1412 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001413 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001414 b64_ntop \
1415 __b64_ntop \
1416 b64_pton \
1417 __b64_pton \
1418 bcopy \
1419 bindresvport_sa \
1420 clock \
1421 closefrom \
1422 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001423 fchmod \
1424 fchown \
1425 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001426 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001427 futimes \
1428 getaddrinfo \
1429 getcwd \
1430 getgrouplist \
1431 getnameinfo \
1432 getopt \
1433 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001434 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001435 _getpty \
1436 getrlimit \
1437 getttyent \
1438 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001439 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001440 inet_aton \
1441 inet_ntoa \
1442 inet_ntop \
1443 innetgr \
1444 login_getcapbool \
1445 md5_crypt \
1446 memmove \
1447 mkdtemp \
1448 mmap \
1449 ngetaddrinfo \
1450 nsleep \
1451 ogetaddrinfo \
1452 openlog_r \
1453 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001454 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001455 prctl \
1456 pstat \
1457 readpassphrase \
1458 realpath \
1459 recvmsg \
1460 rresvport_af \
1461 sendmsg \
1462 setdtablesize \
1463 setegid \
1464 setenv \
1465 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001466 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001467 setgroups \
1468 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001469 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001470 setpcred \
1471 setproctitle \
1472 setregid \
1473 setreuid \
1474 setrlimit \
1475 setsid \
1476 setvbuf \
1477 sigaction \
1478 sigvec \
1479 snprintf \
1480 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001481 statfs \
1482 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001483 strdup \
1484 strerror \
1485 strlcat \
1486 strlcpy \
1487 strmode \
1488 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001489 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001490 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001491 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001492 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001493 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001494 sysconf \
1495 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001496 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001497 truncate \
1498 unsetenv \
1499 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001500 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001501 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001502 vhangup \
1503 vsnprintf \
1504 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001505])
Tim Rice13aae5e2001-10-21 17:53:58 -07001506
Tim Ricec7a8af02010-11-08 14:26:23 -08001507AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001508 [AC_LANG_PROGRAM(
1509 [[ #include <ctype.h> ]],
1510 [[ return (isblank('a')); ]])],
1511 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001512])
1513
Damien Millerb3c9f782010-02-12 10:11:34 +11001514# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001515AC_SEARCH_LIBS([dlopen], [dl],
1516 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001517)
1518
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001519# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001520AC_CHECK_FUNCS([gai_strerror], [
1521 AC_DEFINE([HAVE_GAI_STRERROR])
1522 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001523#include <sys/types.h>
1524#include <sys/socket.h>
1525#include <netdb.h>
1526
Tim Rice648f8762011-01-26 12:38:57 -08001527const char *gai_strerror(int);
1528 ]], [[
1529 char *str;
1530 str = gai_strerror(0);
1531 ]])], [
1532 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1533 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001534
Tim Rice648f8762011-01-26 12:38:57 -08001535AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1536 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001537
Darren Tuckerf1159b52003-07-07 19:44:01 +10001538dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001539AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1540AC_CHECK_DECL([strsep],
1541 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001542 [],
1543 [
1544#ifdef HAVE_STRING_H
1545# include <string.h>
1546#endif
1547 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001548
Darren Tuckerb2427c82003-09-10 15:22:44 +10001549dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001550AC_CHECK_DECL([tcsendbreak],
1551 [AC_DEFINE([HAVE_TCSENDBREAK])],
1552 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001553 [#include <termios.h>]
1554)
1555
Tim Rice648f8762011-01-26 12:38:57 -08001556AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001557
Tim Rice648f8762011-01-26 12:38:57 -08001558AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001559 [
1560#include <sys/types.h>
1561#include <sys/socket.h>
1562 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001563
Tim Rice648f8762011-01-26 12:38:57 -08001564AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001565 [
1566#include <sys/types.h>
1567#ifdef HAVE_SYS_STAT_H
1568# include <sys/stat.h>
1569#endif
1570#ifdef HAVE_FCNTL_H
1571# include <fcntl.h>
1572#endif
1573 ])
1574
Tim Rice648f8762011-01-26 12:38:57 -08001575AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001576#include <sys/types.h>
1577#include <sys/uio.h>
1578#include <unistd.h>
1579 ])
1580
Tim Rice648f8762011-01-26 12:38:57 -08001581AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001582#include <sys/param.h>
1583 ])
1584
Tim Rice648f8762011-01-26 12:38:57 -08001585AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001586#include <stddef.h>
1587 ])
1588
Tim Rice648f8762011-01-26 12:38:57 -08001589AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001590 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001591 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001592 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001593 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001594#include <stdlib.h>
1595#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001596 ]], [[
1597 errno=0;
1598 setresuid(0,0,0);
1599 if (errno==ENOSYS)
1600 exit(1);
1601 else
1602 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001603 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001604 [AC_MSG_RESULT([yes])],
1605 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001606 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001607 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001608 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001609 )
1610])
Darren Tuckere937be32003-12-17 18:53:26 +11001611
Tim Rice648f8762011-01-26 12:38:57 -08001612AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001613 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001614 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001615 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001616 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001617#include <stdlib.h>
1618#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001619 ]], [[
1620 errno=0;
1621 setresgid(0,0,0);
1622 if (errno==ENOSYS)
1623 exit(1);
1624 else
1625 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001626 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001627 [AC_MSG_RESULT([yes])],
1628 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001629 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001630 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001631 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001632 )
1633])
Darren Tuckere937be32003-12-17 18:53:26 +11001634
Damien Millerad833b32000-08-23 10:46:23 +10001635dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001636AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001637dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001638AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1639AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001640dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001641AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1642AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001643dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001644AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001645
Tim Rice648f8762011-01-26 12:38:57 -08001646AC_CHECK_FUNC([daemon],
1647 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1648 [AC_CHECK_LIB([bsd], [daemon],
1649 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001650)
1651
Tim Rice648f8762011-01-26 12:38:57 -08001652AC_CHECK_FUNC([getpagesize],
1653 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001654 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001655 [AC_CHECK_LIB([ucb], [getpagesize],
1656 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001657)
1658
Damien Millercb170cb2000-07-01 16:52:55 +10001659# Check for broken snprintf
1660if test "x$ac_cv_func_snprintf" = "xyes" ; then
1661 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001662 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001663 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1664 [[
1665 char b[5];
1666 snprintf(b,5,"123456789");
1667 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001668 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001669 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001670 [
Tim Rice648f8762011-01-26 12:38:57 -08001671 AC_MSG_RESULT([no])
1672 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001673 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001674 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001675 ],
1676 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001677 )
1678fi
1679
Damien Miller57f39152005-11-24 19:58:19 +11001680# If we don't have a working asprintf, then we strongly depend on vsnprintf
1681# returning the right thing on overflow: the number of characters it tried to
1682# create (as per SUSv3)
1683if test "x$ac_cv_func_asprintf" != "xyes" && \
1684 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1685 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1686 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001687 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001688#include <sys/types.h>
1689#include <stdio.h>
1690#include <stdarg.h>
1691
1692int x_snprintf(char *str,size_t count,const char *fmt,...)
1693{
1694 size_t ret; va_list ap;
1695 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1696 return ret;
1697}
Tim Rice648f8762011-01-26 12:38:57 -08001698 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001699 char x[1];
1700 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001701 ]])],
1702 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001703 [
Tim Rice648f8762011-01-26 12:38:57 -08001704 AC_MSG_RESULT([no])
1705 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001706 [Define if your snprintf is busted])
1707 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1708 ],
1709 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1710 )
1711fi
1712
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001713# On systems where [v]snprintf is broken, but is declared in stdio,
1714# check that the fmt argument is const char * or just char *.
1715# This is only useful for when BROKEN_SNPRINTF
1716AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001717AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1718#include <stdio.h>
1719int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1720 ]], [[
1721 snprintf(0, 0, 0);
1722 ]])],
1723 [AC_MSG_RESULT([yes])
1724 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001725 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001726 [AC_MSG_RESULT([no])
1727 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001728
Damien Millerb4097182004-05-23 14:09:40 +10001729# Check for missing getpeereid (or equiv) support
1730NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001731if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001732 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001733 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1734#include <sys/types.h>
1735#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1736 [ AC_MSG_RESULT([yes])
1737 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1738 ], [AC_MSG_RESULT([no])
1739 NO_PEERCHECK=1
1740 ])
Damien Millerb4097182004-05-23 14:09:40 +10001741fi
1742
Damien Millere8328192003-01-07 15:18:32 +11001743dnl see whether mkstemp() requires XXXXXX
1744if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1745AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001746AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001747 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001748#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001749 ]], [[
1750 char template[]="conftest.mkstemp-test";
1751 if (mkstemp(template) == -1)
1752 exit(1);
1753 unlink(template);
1754 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001755 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001756 [
Tim Rice648f8762011-01-26 12:38:57 -08001757 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001758 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001759 [
Tim Rice648f8762011-01-26 12:38:57 -08001760 AC_MSG_RESULT([yes])
1761 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001762 ],
1763 [
Tim Rice648f8762011-01-26 12:38:57 -08001764 AC_MSG_RESULT([yes])
1765 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001766 ]
Damien Millere8328192003-01-07 15:18:32 +11001767)
1768fi
1769
Darren Tucker70a3d552003-08-21 17:58:29 +10001770dnl make sure that openpty does not reacquire controlling terminal
1771if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001772 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001773 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001774 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001775#include <stdio.h>
1776#include <sys/fcntl.h>
1777#include <sys/types.h>
1778#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001779 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001780 pid_t pid;
1781 int fd, ptyfd, ttyfd, status;
1782
1783 pid = fork();
1784 if (pid < 0) { /* failed */
1785 exit(1);
1786 } else if (pid > 0) { /* parent */
1787 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001788 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001789 exit(WEXITSTATUS(status));
1790 else
1791 exit(2);
1792 } else { /* child */
1793 close(0); close(1); close(2);
1794 setsid();
1795 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1796 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1797 if (fd >= 0)
1798 exit(3); /* Acquired ctty: broken */
1799 else
1800 exit(0); /* Did not acquire ctty: OK */
1801 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001802 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001803 [
Tim Rice648f8762011-01-26 12:38:57 -08001804 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001805 ],
1806 [
Tim Rice648f8762011-01-26 12:38:57 -08001807 AC_MSG_RESULT([no])
1808 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001809 ],
1810 [
Tim Rice648f8762011-01-26 12:38:57 -08001811 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001812 ]
1813 )
1814fi
1815
Tim Rice8bb561b2005-03-17 16:23:19 -08001816if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1817 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001818 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001819 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001820 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001821#include <stdio.h>
1822#include <sys/socket.h>
1823#include <netdb.h>
1824#include <errno.h>
1825#include <netinet/in.h>
1826
1827#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001828 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001829 int err, sock;
1830 struct addrinfo *gai_ai, *ai, hints;
1831 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1832
1833 memset(&hints, 0, sizeof(hints));
1834 hints.ai_family = PF_UNSPEC;
1835 hints.ai_socktype = SOCK_STREAM;
1836 hints.ai_flags = AI_PASSIVE;
1837
1838 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1839 if (err != 0) {
1840 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1841 exit(1);
1842 }
1843
1844 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1845 if (ai->ai_family != AF_INET6)
1846 continue;
1847
1848 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1849 sizeof(ntop), strport, sizeof(strport),
1850 NI_NUMERICHOST|NI_NUMERICSERV);
1851
1852 if (err != 0) {
1853 if (err == EAI_SYSTEM)
1854 perror("getnameinfo EAI_SYSTEM");
1855 else
1856 fprintf(stderr, "getnameinfo failed: %s\n",
1857 gai_strerror(err));
1858 exit(2);
1859 }
1860
1861 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1862 if (sock < 0)
1863 perror("socket");
1864 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1865 if (errno == EBADF)
1866 exit(3);
1867 }
1868 }
1869 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001870 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001871 [
Tim Rice648f8762011-01-26 12:38:57 -08001872 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001873 ],
1874 [
Tim Rice648f8762011-01-26 12:38:57 -08001875 AC_MSG_RESULT([no])
1876 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001877 ],
1878 [
Tim Rice648f8762011-01-26 12:38:57 -08001879 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001880 ]
1881 )
1882fi
1883
Tim Rice8bb561b2005-03-17 16:23:19 -08001884if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1885 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001886 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001887 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001888 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11001889#include <stdio.h>
1890#include <sys/socket.h>
1891#include <netdb.h>
1892#include <errno.h>
1893#include <netinet/in.h>
1894
1895#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001896 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11001897 int err, sock;
1898 struct addrinfo *gai_ai, *ai, hints;
1899 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1900
1901 memset(&hints, 0, sizeof(hints));
1902 hints.ai_family = PF_UNSPEC;
1903 hints.ai_socktype = SOCK_STREAM;
1904 hints.ai_flags = AI_PASSIVE;
1905
1906 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1907 if (err != 0) {
1908 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1909 exit(1);
1910 }
1911
1912 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1913 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1914 continue;
1915
1916 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1917 sizeof(ntop), strport, sizeof(strport),
1918 NI_NUMERICHOST|NI_NUMERICSERV);
1919
1920 if (ai->ai_family == AF_INET && err != 0) {
1921 perror("getnameinfo");
1922 exit(2);
1923 }
1924 }
1925 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001926 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001927 [
Tim Rice648f8762011-01-26 12:38:57 -08001928 AC_MSG_RESULT([yes])
1929 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001930 [Define if you have a getaddrinfo that fails
1931 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001932 ],
1933 [
Tim Rice648f8762011-01-26 12:38:57 -08001934 AC_MSG_RESULT([no])
1935 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001936 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001937 [
Tim Rice648f8762011-01-26 12:38:57 -08001938 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11001939 ]
1940 )
1941fi
1942
Darren Tuckera56f1912004-11-02 20:30:54 +11001943if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001944 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
1945 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
1946 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11001947 [
Tim Rice648f8762011-01-26 12:38:57 -08001948 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11001949 ],
1950 [
Tim Rice648f8762011-01-26 12:38:57 -08001951 AC_MSG_RESULT([yes])
1952 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11001953 [Conflicting defs for getspnam])
1954 ]
1955 )
1956fi
1957
Damien Miller606f8802000-09-16 15:39:56 +11001958AC_FUNC_GETPGRP
1959
Tim Riceaef73712002-05-11 13:17:42 -07001960# Search for OpenSSL
1961saved_CPPFLAGS="$CPPFLAGS"
1962saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08001963AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11001964 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1965 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001966 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001967 case "$withval" in
1968 # Relative paths
1969 ./*|../*) withval="`pwd`/$withval"
1970 esac
Tim Riceaef73712002-05-11 13:17:42 -07001971 if test -d "$withval/lib"; then
1972 if test -n "${need_dash_r}"; then
1973 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1974 else
1975 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1976 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10001977 elif test -d "$withval/lib64"; then
1978 if test -n "${need_dash_r}"; then
1979 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
1980 else
1981 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
1982 fi
Tim Riceaef73712002-05-11 13:17:42 -07001983 else
1984 if test -n "${need_dash_r}"; then
1985 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1986 else
1987 LDFLAGS="-L${withval} ${LDFLAGS}"
1988 fi
1989 fi
1990 if test -d "$withval/include"; then
1991 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1992 else
1993 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1994 fi
Damien Millera22ba012000-03-02 23:09:20 +11001995 fi
1996 ]
1997)
Tim Rice3d5352e2004-02-12 09:27:21 -08001998LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001999AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002000 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002001 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002002 [
Tim Riceaef73712002-05-11 13:17:42 -07002003 dnl Check default openssl install dir
2004 if test -n "${need_dash_r}"; then
2005 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002006 else
Tim Riceaef73712002-05-11 13:17:42 -07002007 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002008 fi
Tim Riceaef73712002-05-11 13:17:42 -07002009 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002010 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002011 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2012 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002013 [
2014 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2015 ]
2016 )
2017 ]
2018)
2019
Tim Riced730b782002-08-13 18:52:10 -07002020# Determine OpenSSL header version
2021AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002022AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002023 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002024#include <stdio.h>
2025#include <string.h>
2026#include <openssl/opensslv.h>
2027#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002028 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002029 FILE *fd;
2030 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002031
Damien Millera8e06ce2003-11-21 23:48:55 +11002032 fd = fopen(DATA,"w");
2033 if(fd == NULL)
2034 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002035
2036 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2037 exit(1);
2038
2039 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002040 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002041 [
2042 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002043 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002044 ],
2045 [
Tim Rice648f8762011-01-26 12:38:57 -08002046 AC_MSG_RESULT([not found])
2047 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002048 ],
2049 [
2050 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002051 ]
2052)
2053
2054# Determine OpenSSL library version
2055AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002056AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002057 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002058#include <stdio.h>
2059#include <string.h>
2060#include <openssl/opensslv.h>
2061#include <openssl/crypto.h>
2062#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002063 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002064 FILE *fd;
2065 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002066
Damien Millera8e06ce2003-11-21 23:48:55 +11002067 fd = fopen(DATA,"w");
2068 if(fd == NULL)
2069 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002070
2071 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2072 exit(1);
2073
2074 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002075 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002076 [
2077 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002078 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002079 ],
2080 [
Tim Rice648f8762011-01-26 12:38:57 -08002081 AC_MSG_RESULT([not found])
2082 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002083 ],
2084 [
2085 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002086 ]
2087)
Damien Millera22ba012000-03-02 23:09:20 +11002088
Tim Rice648f8762011-01-26 12:38:57 -08002089AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002090 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2091 [ if test "x$withval" = "xno" ; then
2092 openssl_check_nonfatal=1
2093 fi
2094 ]
2095)
2096
Damien Millerec932372002-01-22 22:16:03 +11002097# Sanity check OpenSSL headers
2098AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002099AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002100 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002101#include <string.h>
2102#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002103 ]], [[
2104 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002105 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002106 [
Tim Rice648f8762011-01-26 12:38:57 -08002107 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002108 ],
2109 [
Tim Rice648f8762011-01-26 12:38:57 -08002110 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002111 if test "x$openssl_check_nonfatal" = "x"; then
2112 AC_MSG_ERROR([Your OpenSSL headers do not match your
2113library. Check config.log for details.
2114If you are sure your installation is consistent, you can disable the check
2115by running "./configure --without-openssl-header-check".
2116Also see contrib/findssl.sh for help identifying header/library mismatches.
2117])
2118 else
2119 AC_MSG_WARN([Your OpenSSL headers do not match your
2120library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002121Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002122 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002123 ],
2124 [
2125 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002126 ]
2127)
2128
Darren Tucker639bbe82006-08-20 20:17:53 +10002129AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2130AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002131 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2132 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002133 [
Tim Rice648f8762011-01-26 12:38:57 -08002134 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002135 ],
2136 [
Tim Rice648f8762011-01-26 12:38:57 -08002137 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002138 saved_LIBS="$LIBS"
2139 LIBS="$LIBS -ldl"
2140 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2141 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002142 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2143 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002144 [
Tim Rice648f8762011-01-26 12:38:57 -08002145 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002146 ],
2147 [
Tim Rice648f8762011-01-26 12:38:57 -08002148 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002149 LIBS="$saved_LIBS"
2150 ]
2151 )
2152 ]
2153)
2154
Tim Rice648f8762011-01-26 12:38:57 -08002155AC_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 +11002156
Tim Rice648f8762011-01-26 12:38:57 -08002157AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002158 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2159 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002160 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2161 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2162#include <openssl/engine.h>
2163 ]], [[
2164 ENGINE_load_builtin_engines();
2165 ENGINE_register_all_complete();
2166 ]])],
2167 [ AC_MSG_RESULT([yes])
2168 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002169 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002170 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2171 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002172 fi ]
2173)
2174
Darren Tucker129d0bb2005-12-19 17:40:40 +11002175# Check for OpenSSL without EVP_aes_{192,256}_cbc
2176AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002177AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002178 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002179#include <string.h>
2180#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002181 ]], [[
2182 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002183 ]])],
2184 [
Tim Rice648f8762011-01-26 12:38:57 -08002185 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002186 ],
2187 [
Tim Rice648f8762011-01-26 12:38:57 -08002188 AC_MSG_RESULT([yes])
2189 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002190 [libcrypto is missing AES 192 and 256 bit functions])
2191 ]
2192)
2193
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002194AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2195AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002196 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002197#include <string.h>
2198#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002199 ]], [[
2200 if(EVP_DigestUpdate(NULL, NULL,0))
2201 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002202 ]])],
2203 [
Tim Rice648f8762011-01-26 12:38:57 -08002204 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002205 ],
2206 [
Tim Rice648f8762011-01-26 12:38:57 -08002207 AC_MSG_RESULT([no])
2208 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002209 [Define if EVP_DigestUpdate returns void])
2210 ]
2211)
2212
Tim Rice3d5352e2004-02-12 09:27:21 -08002213# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2214# because the system crypt() is more featureful.
2215if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002216 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002217fi
2218
Damien Millera8e06ce2003-11-21 23:48:55 +11002219# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002220# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002221if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002222 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002223fi
2224
Damien Milleraf87af12006-03-15 13:02:28 +11002225# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002226AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002227 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002228AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002229
Damien Miller6af914a2010-09-10 11:39:26 +10002230# Check complete ECC support in OpenSSL
2231AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2232AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002233 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002234#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002235#include <openssl/ecdh.h>
2236#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002237#include <openssl/evp.h>
2238#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002239#include <openssl/opensslv.h>
2240#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2241# error "OpenSSL < 0.9.8g has unreliable ECC code"
2242#endif
Tim Rice648f8762011-01-26 12:38:57 -08002243 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002244 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2245 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002246 ]])],
2247 [
Tim Rice648f8762011-01-26 12:38:57 -08002248 AC_MSG_RESULT([yes])
2249 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002250 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002251 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002252 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002253 ],
2254 [
Tim Rice648f8762011-01-26 12:38:57 -08002255 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002256 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002257 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002258 ]
2259)
Tim Rice648f8762011-01-26 12:38:57 -08002260AC_SUBST([TEST_SSH_ECC])
2261AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002262
Tim Rice99203ec2007-03-26 09:35:28 -07002263saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002264AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002265 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002266 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2267 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002268 [Define if system has libiaf that supports set_id])
2269 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002270])
2271LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002272
2273### Configure cryptographic random number support
2274
2275# Check wheter OpenSSL seeds itself
2276AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002277AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002278 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002279#include <string.h>
2280#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002281 ]], [[
2282 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002283 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002284 [
2285 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002286 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002287 ],
2288 [
Tim Rice648f8762011-01-26 12:38:57 -08002289 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002290 ],
2291 [
2292 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002293 # This is safe, since we will fatal() at runtime if
2294 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002295 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002296 ]
2297)
2298
Damien Millerf22019b2011-05-05 13:48:37 +10002299# PRNGD TCP socket
2300AC_ARG_WITH([prngd-port],
2301 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2302 [
2303 case "$withval" in
2304 no)
2305 withval=""
2306 ;;
2307 [[0-9]]*)
2308 ;;
2309 *)
2310 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2311 ;;
2312 esac
2313 if test ! -z "$withval" ; then
2314 PRNGD_PORT="$withval"
2315 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2316 [Port number of PRNGD/EGD random number socket])
2317 fi
2318 ]
2319)
2320
2321# PRNGD Unix domain socket
2322AC_ARG_WITH([prngd-socket],
2323 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2324 [
2325 case "$withval" in
2326 yes)
2327 withval="/var/run/egd-pool"
2328 ;;
2329 no)
2330 withval=""
2331 ;;
2332 /*)
2333 ;;
2334 *)
2335 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2336 ;;
2337 esac
2338
2339 if test ! -z "$withval" ; then
2340 if test ! -z "$PRNGD_PORT" ; then
2341 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2342 fi
2343 if test ! -r "$withval" ; then
2344 AC_MSG_WARN([Entropy socket is not readable])
2345 fi
2346 PRNGD_SOCKET="$withval"
2347 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2348 [Location of PRNGD/EGD random number socket])
2349 fi
2350 ],
2351 [
2352 # Check for existing socket only if we don't have a random device already
2353 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2354 AC_MSG_CHECKING([for PRNGD/EGD socket])
2355 # Insert other locations here
2356 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2357 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2358 PRNGD_SOCKET="$sock"
2359 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2360 break;
2361 fi
2362 done
2363 if test ! -z "$PRNGD_SOCKET" ; then
2364 AC_MSG_RESULT([$PRNGD_SOCKET])
2365 else
2366 AC_MSG_RESULT([not found])
2367 fi
2368 fi
2369 ]
2370)
2371
2372# Which randomness source do we use?
2373if test ! -z "$PRNGD_PORT" ; then
2374 RAND_MSG="PRNGd port $PRNGD_PORT"
2375elif test ! -z "$PRNGD_SOCKET" ; then
2376 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2377elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2378 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2379 [Define if you want OpenSSL's internally seeded PRNG only])
2380 RAND_MSG="OpenSSL internal ONLY"
2381else
2382 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])
2383fi
2384
Darren Tucker3e6bde42006-08-20 20:03:50 +10002385# Check for PAM libs
2386PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002387AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002388 [ --with-pam Enable PAM support ],
2389 [
2390 if test "x$withval" != "xno" ; then
2391 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2392 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2393 AC_MSG_ERROR([PAM headers not found])
2394 fi
2395
2396 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002397 AC_CHECK_LIB([dl], [dlopen], , )
2398 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2399 AC_CHECK_FUNCS([pam_getenvlist])
2400 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002401 LIBS="$saved_LIBS"
2402
2403 PAM_MSG="yes"
2404
Darren Tucker20e9f972007-03-25 18:26:01 +10002405 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002406 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002407 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002408
Darren Tucker3e6bde42006-08-20 20:03:50 +10002409 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002410 case "$LIBS" in
2411 *-ldl*)
2412 # libdl already in LIBS
2413 ;;
2414 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002415 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002416 ;;
2417 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002418 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002419 fi
2420 ]
2421)
2422
2423# Check for older PAM
2424if test "x$PAM_MSG" = "xyes" ; then
2425 # Check PAM strerror arguments (old PAM)
2426 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002427 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002428#include <stdlib.h>
2429#if defined(HAVE_SECURITY_PAM_APPL_H)
2430#include <security/pam_appl.h>
2431#elif defined (HAVE_PAM_PAM_APPL_H)
2432#include <pam/pam_appl.h>
2433#endif
Tim Rice648f8762011-01-26 12:38:57 -08002434 ]], [[
2435(void)pam_strerror((pam_handle_t *)NULL, -1);
2436 ]])], [AC_MSG_RESULT([no])], [
2437 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002438 [Define if you have an old version of PAM
2439 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002440 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002441 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002442
2443 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002444fi
Damien Miller6c21c512002-01-22 21:57:53 +11002445
Damien Millerd3f6ad22002-06-25 10:24:47 +10002446SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002447AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002448 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002449 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002450 if test -n "$withval" && test "x$withval" != "xno" && \
2451 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002452 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002453 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002454 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002455)
Tim Rice648f8762011-01-26 12:38:57 -08002456AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002457 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002458AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002459
Ben Lindstromb5628642000-10-18 00:02:25 +00002460# Cheap hack to ensure NEWS-OS libraries are arranged right.
2461if test ! -z "$SONY" ; then
2462 LIBS="$LIBS -liberty";
2463fi
2464
Damien Miller57f39152005-11-24 19:58:19 +11002465# Check for long long datatypes
2466AC_CHECK_TYPES([long long, unsigned long long, long double])
2467
2468# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002469AC_CHECK_SIZEOF([char], [1])
2470AC_CHECK_SIZEOF([short int], [2])
2471AC_CHECK_SIZEOF([int], [4])
2472AC_CHECK_SIZEOF([long int], [4])
2473AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002474
Damien Millerfa2bb692002-04-23 23:22:25 +10002475# Sanity check long long for some platforms (AIX)
2476if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2477 ac_cv_sizeof_long_long_int=0
2478fi
2479
Darren Tucker537f1ed2005-10-25 18:38:33 +10002480# compute LLONG_MIN and LLONG_MAX if we don't know them.
2481if test -z "$have_llong_max"; then
2482 AC_MSG_CHECKING([for max value of long long])
2483 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002484 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002485#include <stdio.h>
2486/* Why is this so damn hard? */
2487#ifdef __GNUC__
2488# undef __GNUC__
2489#endif
2490#define __USE_ISOC99
2491#include <limits.h>
2492#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002493#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2494
2495/*
2496 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2497 * we do this the hard way.
2498 */
2499static int
2500fprint_ll(FILE *f, long long n)
2501{
2502 unsigned int i;
2503 int l[sizeof(long long) * 8];
2504
2505 if (n < 0)
2506 if (fprintf(f, "-") < 0)
2507 return -1;
2508 for (i = 0; n != 0; i++) {
2509 l[i] = my_abs(n % 10);
2510 n /= 10;
2511 }
2512 do {
2513 if (fprintf(f, "%d", l[--i]) < 0)
2514 return -1;
2515 } while (i != 0);
2516 if (fprintf(f, " ") < 0)
2517 return -1;
2518 return 0;
2519}
Tim Rice648f8762011-01-26 12:38:57 -08002520 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002521 FILE *f;
2522 long long i, llmin, llmax = 0;
2523
2524 if((f = fopen(DATA,"w")) == NULL)
2525 exit(1);
2526
2527#if defined(LLONG_MIN) && defined(LLONG_MAX)
2528 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2529 llmin = LLONG_MIN;
2530 llmax = LLONG_MAX;
2531#else
2532 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2533 /* This will work on one's complement and two's complement */
2534 for (i = 1; i > llmax; i <<= 1, i++)
2535 llmax = i;
2536 llmin = llmax + 1LL; /* wrap */
2537#endif
2538
2539 /* Sanity check */
2540 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002541 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2542 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002543 fprintf(f, "unknown unknown\n");
2544 exit(2);
2545 }
2546
Darren Tuckerd1450db2006-03-13 19:06:51 +11002547 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002548 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002549 if (fprint_ll(f, llmax) < 0)
2550 exit(4);
2551 if (fclose(f) < 0)
2552 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002553 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002554 ]])],
2555 [
2556 llong_min=`$AWK '{print $1}' conftest.llminmax`
2557 llong_max=`$AWK '{print $2}' conftest.llminmax`
2558
Tim Rice648f8762011-01-26 12:38:57 -08002559 AC_MSG_RESULT([$llong_max])
2560 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002561 [max value of long long calculated by configure])
2562 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002563 AC_MSG_RESULT([$llong_min])
2564 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002565 [min value of long long calculated by configure])
2566 ],
2567 [
Tim Rice648f8762011-01-26 12:38:57 -08002568 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002569 ],
2570 [
2571 AC_MSG_WARN([cross compiling: not checking])
2572 ]
2573 )
2574fi
2575
2576
Damien Millera22ba012000-03-02 23:09:20 +11002577# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002578AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002579 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2580 [[ u_int a; a = 1;]])],
2581 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2582 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002583])
2584if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002585 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002586 have_u_int=1
2587fi
2588
Damien Miller61e50f12000-05-08 20:49:37 +10002589AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002590 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2591 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2592 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2593 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002594])
2595if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002596 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002597 have_intxx_t=1
2598fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002599
2600if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002601 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002602then
2603 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002604 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2605 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002606 [
Tim Rice648f8762011-01-26 12:38:57 -08002607 AC_DEFINE([HAVE_INTXX_T])
2608 AC_MSG_RESULT([yes])
2609 ], [ AC_MSG_RESULT([no])
2610 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002611fi
2612
Damien Miller578783e2000-09-23 14:12:24 +11002613AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002615#include <sys/types.h>
2616#ifdef HAVE_STDINT_H
2617# include <stdint.h>
2618#endif
2619#include <sys/socket.h>
2620#ifdef HAVE_SYS_BITYPES_H
2621# include <sys/bitypes.h>
2622#endif
Tim Rice648f8762011-01-26 12:38:57 -08002623 ]], [[
2624int64_t a; a = 1;
2625 ]])],
2626 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2627 ])
Damien Miller578783e2000-09-23 14:12:24 +11002628])
2629if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002630 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002631fi
2632
Damien Miller61e50f12000-05-08 20:49:37 +10002633AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002634 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2635 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2636 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2637 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002638])
2639if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002640 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002641 have_u_intxx_t=1
2642fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002643
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002644if test -z "$have_u_intxx_t" ; then
2645 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2647 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002648 [
Tim Rice648f8762011-01-26 12:38:57 -08002649 AC_DEFINE([HAVE_U_INTXX_T])
2650 AC_MSG_RESULT([yes])
2651 ], [ AC_MSG_RESULT([no])
2652 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002653fi
2654
Damien Miller578783e2000-09-23 14:12:24 +11002655AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002656 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2657 [[ u_int64_t a; a = 1;]])],
2658 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2659 ])
Damien Miller578783e2000-09-23 14:12:24 +11002660])
2661if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002662 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002663 have_u_int64_t=1
2664fi
2665
Tim Rice4cec93f2002-02-26 08:40:48 -08002666if test -z "$have_u_int64_t" ; then
2667 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002668 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2669 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002670 [
Tim Rice648f8762011-01-26 12:38:57 -08002671 AC_DEFINE([HAVE_U_INT64_T])
2672 AC_MSG_RESULT([yes])
2673 ], [ AC_MSG_RESULT([no])
2674 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002675fi
2676
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002677if test -z "$have_u_intxx_t" ; then
2678 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002680#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002681 ]], [[
2682 uint8_t a;
2683 uint16_t b;
2684 uint32_t c;
2685 a = b = c = 1;
2686 ]])],
2687 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2688 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002689 ])
2690 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002691 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002692 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002693 fi
2694fi
2695
2696if test -z "$have_uintxx_t" ; then
2697 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002698 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2699 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002700 [
Tim Rice648f8762011-01-26 12:38:57 -08002701 AC_DEFINE([HAVE_UINTXX_T])
2702 AC_MSG_RESULT([yes])
2703 ], [ AC_MSG_RESULT([no])
2704 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002705fi
2706
Damien Milleredb82922000-06-20 13:25:52 +10002707if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002708 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002709then
2710 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002711 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002712#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002713 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002714 int8_t a; int16_t b; int32_t c;
2715 u_int8_t e; u_int16_t f; u_int32_t g;
2716 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002717 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002718 [
Tim Rice648f8762011-01-26 12:38:57 -08002719 AC_DEFINE([HAVE_U_INTXX_T])
2720 AC_DEFINE([HAVE_INTXX_T])
2721 AC_MSG_RESULT([yes])
2722 ], [AC_MSG_RESULT([no])
2723 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002724fi
2725
Damien Miller58be7382001-09-15 21:31:54 +10002726
2727AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2729 [[ u_char foo; foo = 125; ]])],
2730 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2731 ])
Damien Miller58be7382001-09-15 21:31:54 +10002732])
2733if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002734 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002735fi
2736
Tim Rice13aae5e2001-10-21 17:53:58 -07002737TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002738
Tim Rice648f8762011-01-26 12:38:57 -08002739AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2740AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002741#include <sys/types.h>
2742#ifdef HAVE_SYS_BITYPES_H
2743#include <sys/bitypes.h>
2744#endif
2745#ifdef HAVE_SYS_STATFS_H
2746#include <sys/statfs.h>
2747#endif
2748#ifdef HAVE_SYS_STATVFS_H
2749#include <sys/statvfs.h>
2750#endif
2751])
Tim Rice4cec93f2002-02-26 08:40:48 -08002752
Tim Rice648f8762011-01-26 12:38:57 -08002753AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002754[#include <sys/types.h>
2755#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002756
Damien Miller61e50f12000-05-08 20:49:37 +10002757AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002758 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2759 [[ size_t foo; foo = 1235; ]])],
2760 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2761 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002762])
2763if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002764 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002765fi
Damien Miller95058511999-12-29 10:36:45 +11002766
Damien Miller615f9392000-05-17 22:53:33 +10002767AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002768 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2769 [[ ssize_t foo; foo = 1235; ]])],
2770 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2771 ])
Damien Miller615f9392000-05-17 22:53:33 +10002772])
2773if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002774 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002775fi
2776
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002777AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002778 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2779 [[ clock_t foo; foo = 1235; ]])],
2780 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2781 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002782])
2783if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002784 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002785fi
2786
Damien Millerb54b40e2000-06-23 08:23:34 +10002787AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002788 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002789#include <sys/types.h>
2790#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002791 ]], [[ sa_family_t foo; foo = 1235; ]])],
2792 [ ac_cv_have_sa_family_t="yes" ],
2793 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002794#include <sys/types.h>
2795#include <sys/socket.h>
2796#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002797 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002798 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002799 [ ac_cv_have_sa_family_t="no" ]
2800 )
Tim Rice648f8762011-01-26 12:38:57 -08002801 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002802])
2803if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002804 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002805 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002806fi
2807
Damien Miller0f91b4e2000-06-18 15:43:25 +10002808AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002809 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2810 [[ pid_t foo; foo = 1235; ]])],
2811 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2812 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002813])
2814if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002815 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002816fi
2817
2818AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002819 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2820 [[ mode_t foo; foo = 1235; ]])],
2821 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2822 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002823])
2824if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002825 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002826fi
2827
Damien Miller61e50f12000-05-08 20:49:37 +10002828
2829AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002830 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002831#include <sys/types.h>
2832#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002833 ]], [[ struct sockaddr_storage s; ]])],
2834 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2835 [ ac_cv_have_struct_sockaddr_storage="no"
2836 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002837])
2838if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002839 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002840 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002841fi
Damien Miller34132e52000-01-14 15:45:46 +11002842
Damien Miller61e50f12000-05-08 20:49:37 +10002843AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002844 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002845#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002846#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002847 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2848 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2849 [ ac_cv_have_struct_sockaddr_in6="no"
2850 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002851])
2852if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002853 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002854 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002855fi
Damien Miller34132e52000-01-14 15:45:46 +11002856
Damien Miller61e50f12000-05-08 20:49:37 +10002857AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002858 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002859#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002860#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002861 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2862 [ ac_cv_have_struct_in6_addr="yes" ],
2863 [ ac_cv_have_struct_in6_addr="no"
2864 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002865])
2866if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002867 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002868 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002869
2870dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002871 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002872 [
2873#ifdef HAVE_SYS_TYPES_H
2874#include <sys/types.h>
2875#endif
2876#include <netinet/in.h>
2877 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002878fi
Damien Miller34132e52000-01-14 15:45:46 +11002879
Damien Miller61e50f12000-05-08 20:49:37 +10002880AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002882#include <sys/types.h>
2883#include <sys/socket.h>
2884#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002885 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2886 [ ac_cv_have_struct_addrinfo="yes" ],
2887 [ ac_cv_have_struct_addrinfo="no"
2888 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002889])
2890if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002891 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002892 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002893fi
2894
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002895AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002896 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2897 [[ struct timeval tv; tv.tv_sec = 1;]])],
2898 [ ac_cv_have_struct_timeval="yes" ],
2899 [ ac_cv_have_struct_timeval="no"
2900 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002901])
2902if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002903 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002904 have_struct_timeval=1
2905fi
2906
Tim Rice648f8762011-01-26 12:38:57 -08002907AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08002908
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002909# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002910if test "x$ac_cv_have_int64_t" = "xno" && \
2911 test "x$ac_cv_sizeof_long_int" != "x8" && \
2912 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002913 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2914 echo "an alternative compiler (I.E., GCC) before continuing."
2915 echo ""
2916 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002917else
2918dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002919 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002920 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002921#include <stdio.h>
2922#include <string.h>
2923#ifdef HAVE_SNPRINTF
2924main()
2925{
2926 char buf[50];
2927 char expected_out[50];
2928 int mazsize = 50 ;
2929#if (SIZEOF_LONG_INT == 8)
2930 long int num = 0x7fffffffffffffff;
2931#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002932 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002933#endif
2934 strcpy(expected_out, "9223372036854775807");
2935 snprintf(buf, mazsize, "%lld", num);
2936 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002937 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002938 exit(0);
2939}
2940#else
2941main() { exit(0); }
2942#endif
Tim Rice648f8762011-01-26 12:38:57 -08002943 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002944 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002945 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002946fi
2947
Damien Miller78315eb2000-09-29 23:01:36 +11002948dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08002949OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
2950OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
2951OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
2952OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
2953OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
2954OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
2955OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
2956OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
2957OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
2958OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
2959OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
2960OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
2961OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
2962OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
2963OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
2964OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
2965OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07002966
2967AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08002968AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11002969 [Define if we don't have struct __res_state in resolv.h])],
2970[
2971#include <stdio.h>
2972#if HAVE_SYS_TYPES_H
2973# include <sys/types.h>
2974#endif
2975#include <netinet/in.h>
2976#include <arpa/nameser.h>
2977#include <resolv.h>
2978])
andre2ff7b5d2000-06-03 14:57:40 +00002979
Damien Miller61e50f12000-05-08 20:49:37 +10002980AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2981 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002982 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002983#include <sys/types.h>
2984#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002985 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
2986 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2987 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10002988])
2989if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002990 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002991fi
2992
Damien Miller61e50f12000-05-08 20:49:37 +10002993AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2994 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002996#include <sys/types.h>
2997#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002998 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
2999 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3000 [ ac_cv_have___ss_family_in_struct_ss="no"
3001 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003002])
3003if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003004 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003005 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003006fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003007
Damien Millerad833b32000-08-23 10:46:23 +10003008AC_CACHE_CHECK([for pw_class field in struct passwd],
3009 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003010 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3011 [[ struct passwd p; p.pw_class = 0; ]])],
3012 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3013 [ ac_cv_have_pw_class_in_struct_passwd="no"
3014 ])
Damien Millerad833b32000-08-23 10:46:23 +10003015])
3016if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003017 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003018 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003019fi
3020
Kevin Steves82456952001-06-22 21:14:18 +00003021AC_CACHE_CHECK([for pw_expire field in struct passwd],
3022 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003023 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3024 [[ struct passwd p; p.pw_expire = 0; ]])],
3025 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3026 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3027 ])
Kevin Steves82456952001-06-22 21:14:18 +00003028])
3029if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003030 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003031 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003032fi
3033
3034AC_CACHE_CHECK([for pw_change field in struct passwd],
3035 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003036 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3037 [[ struct passwd p; p.pw_change = 0; ]])],
3038 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3039 [ ac_cv_have_pw_change_in_struct_passwd="no"
3040 ])
Kevin Steves82456952001-06-22 21:14:18 +00003041])
3042if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003043 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003044 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003045fi
Damien Miller61e50f12000-05-08 20:49:37 +10003046
Tim Rice28bbb0c2002-05-27 17:37:32 -07003047dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003048AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3049 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003050 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003051#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003052#include <sys/socket.h>
3053#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003054 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003055#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003056#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003057exit(1);
3058#endif
3059struct msghdr m;
3060m.msg_accrights = 0;
3061exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003062 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003063 [ ac_cv_have_accrights_in_msghdr="yes" ],
3064 [ ac_cv_have_accrights_in_msghdr="no" ]
3065 )
3066])
3067if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003068 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003069 [Define if your system uses access rights style
3070 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003071fi
3072
Tim Rice648f8762011-01-26 12:38:57 -08003073AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3074AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003075#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003076#include <sys/stat.h>
3077#ifdef HAVE_SYS_TIME_H
3078# include <sys/time.h>
3079#endif
3080#ifdef HAVE_SYS_MOUNT_H
3081#include <sys/mount.h>
3082#endif
3083#ifdef HAVE_SYS_STATVFS_H
3084#include <sys/statvfs.h>
3085#endif
Tim Rice648f8762011-01-26 12:38:57 -08003086 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3087 [ AC_MSG_RESULT([yes]) ],
3088 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003089
Tim Rice648f8762011-01-26 12:38:57 -08003090 AC_MSG_CHECKING([if fsid_t has member val])
3091 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003092#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003093#include <sys/statvfs.h>
3094 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3095 [ AC_MSG_RESULT([yes])
3096 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3097 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003098
Tim Rice648f8762011-01-26 12:38:57 -08003099 AC_MSG_CHECKING([if f_fsid has member __val])
3100 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003101#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003102#include <sys/statvfs.h>
3103 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3104 [ AC_MSG_RESULT([yes])
3105 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3106 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003107])
Darren Tucker77001382008-06-09 06:17:53 +10003108
Kevin Stevesa44e0352002-04-07 16:18:03 +00003109AC_CACHE_CHECK([for msg_control field in struct msghdr],
3110 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003111 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003112#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003113#include <sys/socket.h>
3114#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003115 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003116#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003117#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003118exit(1);
3119#endif
3120struct msghdr m;
3121m.msg_control = 0;
3122exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003123 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003124 [ ac_cv_have_control_in_msghdr="yes" ],
3125 [ ac_cv_have_control_in_msghdr="no" ]
3126 )
3127])
3128if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003129 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003130 [Define if your system uses ancillary data style
3131 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003132fi
3133
Damien Miller61e50f12000-05-08 20:49:37 +10003134AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003135 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3136 [[ extern char *__progname; printf("%s", __progname); ]])],
3137 [ ac_cv_libc_defines___progname="yes" ],
3138 [ ac_cv_libc_defines___progname="no"
3139 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003140])
3141if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003142 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003143fi
3144
Kevin Steves4846f4a2002-03-22 18:19:53 +00003145AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003146 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3147 [[ printf("%s", __FUNCTION__); ]])],
3148 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3149 [ ac_cv_cc_implements___FUNCTION__="no"
3150 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003151])
3152if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003153 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003154 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003155fi
3156
3157AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003158 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3159 [[ printf("%s", __func__); ]])],
3160 [ ac_cv_cc_implements___func__="yes" ],
3161 [ ac_cv_cc_implements___func__="no"
3162 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003163])
3164if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003165 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003166fi
3167
Damien Miller57f39152005-11-24 19:58:19 +11003168AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003169 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3170#include <stdarg.h>
3171va_list x,y;
3172 ]], [[ va_copy(x,y); ]])],
3173 [ ac_cv_have_va_copy="yes" ],
3174 [ ac_cv_have_va_copy="no"
3175 ])
Damien Miller57f39152005-11-24 19:58:19 +11003176])
3177if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003178 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003179fi
3180
3181AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003182 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3183#include <stdarg.h>
3184va_list x,y;
3185 ]], [[ __va_copy(x,y); ]])],
3186 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3187 ])
Damien Miller57f39152005-11-24 19:58:19 +11003188])
3189if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003190 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003191fi
3192
Damien Miller4f8e6692001-07-14 13:22:53 +10003193AC_CACHE_CHECK([whether getopt has optreset support],
3194 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003195 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3196 [[ extern int optreset; optreset = 0; ]])],
3197 [ ac_cv_have_getopt_optreset="yes" ],
3198 [ ac_cv_have_getopt_optreset="no"
3199 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003200])
3201if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003202 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003203 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003204fi
Damien Millera22ba012000-03-02 23:09:20 +11003205
Damien Millerecbb26d2000-07-15 14:59:14 +10003206AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003207 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3208[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3209 [ ac_cv_libc_defines_sys_errlist="yes" ],
3210 [ ac_cv_libc_defines_sys_errlist="no"
3211 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003212])
3213if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003214 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003215 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003216fi
3217
3218
Damien Miller11fa2cc2000-08-16 10:35:58 +10003219AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003220 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3221[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3222 [ ac_cv_libc_defines_sys_nerr="yes" ],
3223 [ ac_cv_libc_defines_sys_nerr="no"
3224 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003225])
3226if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003227 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003228fi
3229
Darren Tucker5f88d342003-10-15 16:57:57 +10003230# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003231AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3232 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003233 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003234 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003235 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003236 AC_SEARCH_LIBS([res_query], [resolv])
3237 AC_SEARCH_LIBS([dn_expand], [resolv])
3238 AC_MSG_CHECKING([if res_query will link])
3239 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003240#include <sys/types.h>
3241#include <netinet/in.h>
3242#include <arpa/nameser.h>
3243#include <netdb.h>
3244#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003245 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003246 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003247 ]])],
3248 AC_MSG_RESULT([yes]),
3249 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003250 saved_LIBS="$LIBS"
3251 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003252 AC_MSG_CHECKING([for res_query in -lresolv])
3253 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003254#include <sys/types.h>
3255#include <netinet/in.h>
3256#include <arpa/nameser.h>
3257#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003258#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003259 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003260 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003261 ]])],
3262 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003263 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003264 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003265 ])
Tim Rice648f8762011-01-26 12:38:57 -08003266 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003267 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003268 [#include <sys/types.h>
3269 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003270 AC_CHECK_MEMBER([HEADER.ad],
3271 [AC_DEFINE([HAVE_HEADER_AD], [1],
3272 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003273 [#include <arpa/nameser.h>])
3274 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003275
Tim Rice648f8762011-01-26 12:38:57 -08003276AC_MSG_CHECKING([if struct __res_state _res is an extern])
3277AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003278#include <stdio.h>
3279#if HAVE_SYS_TYPES_H
3280# include <sys/types.h>
3281#endif
3282#include <netinet/in.h>
3283#include <arpa/nameser.h>
3284#include <resolv.h>
3285extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003286 ]], [[ ]])],
3287 [AC_MSG_RESULT([yes])
3288 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003289 [Define if you have struct __res_state _res as an extern])
3290 ],
Tim Rice648f8762011-01-26 12:38:57 -08003291 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003292)
3293
Damien Miller73b42d22006-04-22 21:26:08 +10003294# Check whether user wants SELinux support
3295SELINUX_MSG="no"
3296LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003297AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003298 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003299 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003300 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003301 AC_DEFINE([WITH_SELINUX], [1],
3302 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003303 SELINUX_MSG="yes"
3304 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003305 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3306 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003307 [ LIBSELINUX="-lselinux"
3308 LIBS="$LIBS -lselinux"
3309 ],
Tim Rice648f8762011-01-26 12:38:57 -08003310 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003311 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003312 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003313 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003314 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003315 fi ]
3316)
Tim Rice648f8762011-01-26 12:38:57 -08003317AC_SUBST([SSHLIBS])
3318AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003319
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003320# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003321KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003322AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003323 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003324 [ if test "x$withval" != "xno" ; then
3325 if test "x$withval" = "xyes" ; then
3326 KRB5ROOT="/usr/local"
3327 else
3328 KRB5ROOT=${withval}
3329 fi
3330
Tim Rice648f8762011-01-26 12:38:57 -08003331 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003332 KRB5_MSG="yes"
3333
Tim Rice648f8762011-01-26 12:38:57 -08003334 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003335 [$KRB5ROOT/bin/krb5-config],
3336 [$KRB5ROOT/bin:$PATH])
3337 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003338
Tim Rice648f8762011-01-26 12:38:57 -08003339 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003340 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003341 AC_MSG_RESULT([yes])
3342 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003343 [Define this if you want GSSAPI
3344 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003345 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003346 else
Tim Rice648f8762011-01-26 12:38:57 -08003347 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003348 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003349 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003350 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3351 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003352 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003353 AC_MSG_CHECKING([whether we are using Heimdal])
3354 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3355 ]], [[ char *tmp = heimdal_version; ]])],
3356 [ AC_MSG_RESULT([yes])
3357 AC_DEFINE([HEIMDAL], [1],
3358 [Define this if you are using the Heimdal
3359 version of Kerberos V5]) ],
3360 [AC_MSG_RESULT([no])
3361 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003362 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003363 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003364 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003365 AC_MSG_CHECKING([whether we are using Heimdal])
3366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3367 ]], [[ char *tmp = heimdal_version; ]])],
3368 [ AC_MSG_RESULT([yes])
3369 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003370 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003371 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003372 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003373 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003374 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003375 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003376 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003377 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003378
3379 ])
3380 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003381
Tim Rice648f8762011-01-26 12:38:57 -08003382 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3383 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003384 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003385 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3386 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003387 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003388 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3389 $K5LIBS)
3390 ],
3391 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003392
Tim Rice648f8762011-01-26 12:38:57 -08003393 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003394 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003395 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003396 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003397 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003398 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003399 ]
3400 )
3401
3402 oldCPP="$CPPFLAGS"
3403 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003404 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003405 [ CPPFLAGS="$oldCPP" ])
3406
Damien Millera8e06ce2003-11-21 23:48:55 +11003407 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003408 if test ! -z "$need_dash_r" ; then
3409 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3410 fi
3411 if test ! -z "$blibpath" ; then
3412 blibpath="$blibpath:${KRB5ROOT}/lib"
3413 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003414
Tim Rice648f8762011-01-26 12:38:57 -08003415 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3416 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3417 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003418
3419 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003420 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3421 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003422 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003423 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003424)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003425
Damien Millera22ba012000-03-02 23:09:20 +11003426# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003427
Damien Millerf58c6722002-05-13 13:15:42 +10003428PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003429AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003430 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003431 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003432 if test -n "$withval" && test "x$withval" != "xno" && \
3433 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003434 PRIVSEP_PATH=$withval
3435 fi
3436 ]
3437)
Tim Rice648f8762011-01-26 12:38:57 -08003438AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003439
Tim Rice648f8762011-01-26 12:38:57 -08003440AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003441 [ --with-xauth=PATH Specify path to xauth program ],
3442 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003443 if test -n "$withval" && test "x$withval" != "xno" && \
3444 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003445 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003446 fi
3447 ],
3448 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003449 TestPath="$PATH"
3450 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3451 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3452 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3453 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003454 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003455 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003456 xauth_path="/usr/openwin/bin/xauth"
3457 fi
3458 ]
3459)
3460
Damien Miller7d901272003-01-13 16:55:22 +11003461STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003462AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003463 [ --disable-strip Disable calling strip(1) on install],
3464 [
3465 if test "x$enableval" = "xno" ; then
3466 STRIP_OPT=
3467 fi
3468 ]
3469)
Tim Rice648f8762011-01-26 12:38:57 -08003470AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003471
Damien Millera19cf472000-11-29 13:28:50 +11003472if test -z "$xauth_path" ; then
3473 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003474 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003475else
Tim Rice648f8762011-01-26 12:38:57 -08003476 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003477 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003478 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003479 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003480fi
Damien Millera22ba012000-03-02 23:09:20 +11003481
3482# Check for mail directory (last resort if we cannot get it from headers)
3483if test ! -z "$MAIL" ; then
3484 maildir=`dirname $MAIL`
Tim Rice648f8762011-01-26 12:38:57 -08003485 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"],
Tim Rice7df8d392005-09-19 09:33:39 -07003486 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003487fi
3488
Darren Tucker623d92f2004-09-12 22:36:15 +10003489if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003490 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3491 disable_ptmx_check=yes
3492fi
Damien Millera22ba012000-03-02 23:09:20 +11003493if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003494 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003495 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003496 [
Tim Rice648f8762011-01-26 12:38:57 -08003497 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003498 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003499 have_dev_ptmx=1
3500 ]
3501 )
3502 fi
Damien Millera22ba012000-03-02 23:09:20 +11003503fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003504
Darren Tucker623d92f2004-09-12 22:36:15 +10003505if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003506 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003507 [
Tim Rice648f8762011-01-26 12:38:57 -08003508 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003509 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003510 have_dev_ptc=1
3511 ]
3512 )
3513else
3514 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3515fi
Damien Miller204ad072000-03-02 23:56:12 +11003516
Damien Millera22ba012000-03-02 23:09:20 +11003517# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003518AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003519 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003520 [
Damien Miller897741e2001-04-16 10:41:46 +10003521 case "$withval" in
3522 man|cat|doc)
3523 MANTYPE=$withval
3524 ;;
3525 *)
Tim Rice648f8762011-01-26 12:38:57 -08003526 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003527 ;;
3528 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003529 ]
3530)
Ben Lindstrombc709922001-04-18 18:04:21 +00003531if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003532 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003533 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003534 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3535 MANTYPE=doc
3536 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3537 MANTYPE=man
3538 else
3539 MANTYPE=cat
3540 fi
3541fi
Tim Rice648f8762011-01-26 12:38:57 -08003542AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003543if test "$MANTYPE" = "doc"; then
3544 mansubdir=man;
3545else
3546 mansubdir=$MANTYPE;
3547fi
Tim Rice648f8762011-01-26 12:38:57 -08003548AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003549
Damien Millera22ba012000-03-02 23:09:20 +11003550# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003551MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003552AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003553 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003554 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003555 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003556 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003557 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003558 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003559 fi
3560 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003561)
3562
Damien Millera22ba012000-03-02 23:09:20 +11003563# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003564AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003565 [ --without-shadow Disable shadow password support],
3566 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003567 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003568 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003569 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003570 fi
3571 ]
3572)
3573
Damien Miller1f335fb2000-06-26 11:31:33 +10003574if test -z "$disable_shadow" ; then
3575 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003576 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003577#include <sys/types.h>
3578#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003579struct spwd sp;
3580 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3581 [ sp_expire_available=yes ], [
3582 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003583
3584 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003585 AC_MSG_RESULT([yes])
3586 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003587 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003588 else
Tim Rice648f8762011-01-26 12:38:57 -08003589 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003590 fi
3591fi
3592
Damien Millera22ba012000-03-02 23:09:20 +11003593# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003594if test ! -z "$IPADDR_IN_DISPLAY" ; then
3595 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003596 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003597 [Define if you need to use IP address
3598 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003599else
Damien Millera8e06ce2003-11-21 23:48:55 +11003600 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003601 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003602 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3603 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003604 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003605 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003606 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003607 fi
3608 ]
3609 )
3610fi
Damien Miller76112de1999-12-21 11:18:08 +11003611
Darren Tuckere1a790d2003-09-16 11:52:19 +10003612# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003613AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003614 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003615 [ if test "x$enableval" = "xno"; then
3616 AC_MSG_NOTICE([/etc/default/login handling disabled])
3617 etc_default_login=no
3618 else
3619 etc_default_login=yes
3620 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003621 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3622 then
3623 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3624 etc_default_login=no
3625 else
3626 etc_default_login=yes
3627 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003628)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003629
Darren Tucker2f9573d2005-02-10 22:28:54 +11003630if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003631 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003632 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003633 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003634 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003635 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003636 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003637fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003638
Tim Rice43a1c132002-04-17 21:19:14 -07003639dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003640if test $ac_cv_func_login_getcapbool = "yes" && \
3641 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003642 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003643fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003644
Damien Millera22ba012000-03-02 23:09:20 +11003645# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003646SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003647AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003648 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003649 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003650 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003651 AC_MSG_WARN([
3652--with-default-path=PATH has no effect on this system.
3653Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003654 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003655 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003656 AC_MSG_WARN([
3657--with-default-path=PATH will only be used if PATH is not defined in
3658$external_path_file .])
3659 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003660 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003661 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003662 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003663 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003664 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3665 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003666 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003667 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003668 AC_MSG_WARN([
3669If PATH is defined in $external_path_file, ensure the path to scp is included,
3670otherwise scp will not work.])
3671 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003672 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003673 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003674/* find out what STDPATH is */
3675#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003676#ifdef HAVE_PATHS_H
3677# include <paths.h>
3678#endif
3679#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003680# ifdef _PATH_USERPATH /* Irix */
3681# define _PATH_STDPATH _PATH_USERPATH
3682# else
3683# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3684# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003685#endif
3686#include <sys/types.h>
3687#include <sys/stat.h>
3688#include <fcntl.h>
3689#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003690 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003691 FILE *fd;
3692 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003693
Tim Rice59ea0a02001-03-10 13:50:45 -08003694 fd = fopen(DATA,"w");
3695 if(fd == NULL)
3696 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003697
Tim Rice59ea0a02001-03-10 13:50:45 -08003698 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3699 exit(1);
3700
3701 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003702 ]])],
3703 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003704 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3705 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3706 )
3707# make sure $bindir is in USER_PATH so scp will work
3708 t_bindir=`eval echo ${bindir}`
3709 case $t_bindir in
3710 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3711 esac
3712 case $t_bindir in
3713 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3714 esac
3715 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3716 if test $? -ne 0 ; then
3717 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3718 if test $? -ne 0 ; then
3719 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003720 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003721 fi
3722 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003723 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003724)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003725if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003726 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3727 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003728fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003729
Damien Millera18bbd32002-05-13 10:48:57 +10003730# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003731AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003732 [ --with-superuser-path= Specify different path for super-user],
3733 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003734 if test -n "$withval" && test "x$withval" != "xno" && \
3735 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003736 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003737 [Define if you want a different $PATH
3738 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003739 superuser_path=$withval
3740 fi
3741 ]
3742)
3743
3744
Damien Miller61e50f12000-05-08 20:49:37 +10003745AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003746IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003747AC_ARG_WITH(4in6,
3748 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3749 [
3750 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003751 AC_MSG_RESULT([yes])
3752 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003753 [Detect IPv4 in IPv6 mapped addresses
3754 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003755 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003756 else
Tim Rice648f8762011-01-26 12:38:57 -08003757 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003758 fi
Tim Rice648f8762011-01-26 12:38:57 -08003759 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003760 if test "x$inet6_default_4in6" = "xyes"; then
3761 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003762 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003763 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003764 else
3765 AC_MSG_RESULT([no (default)])
3766 fi
3767 ]
3768)
3769
Damien Miller60396b02001-02-18 17:01:00 +11003770# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003771BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003772AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003773 [ --with-bsd-auth Enable BSD auth support],
3774 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003775 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003776 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003777 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003778 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003779 fi
3780 ]
3781)
3782
Damien Millera22ba012000-03-02 23:09:20 +11003783# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003784piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003785# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003786if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003787 piddir=`eval echo ${sysconfdir}`
3788 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003789 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003790 esac
3791fi
3792
Tim Rice648f8762011-01-26 12:38:57 -08003793AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003794 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3795 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003796 if test -n "$withval" && test "x$withval" != "xno" && \
3797 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003798 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003799 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003800 AC_MSG_WARN([** no $piddir directory on this system **])
3801 fi
3802 fi
3803 ]
3804)
3805
Tim Rice648f8762011-01-26 12:38:57 -08003806AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3807 [Specify location of ssh.pid])
3808AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003809
andre2ff7b5d2000-06-03 14:57:40 +00003810dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003811AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003812 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003813 [
3814 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003815 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003816 fi
3817 ]
andre2ff7b5d2000-06-03 14:57:40 +00003818)
Tim Rice648f8762011-01-26 12:38:57 -08003819AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003820 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003821 [
3822 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003823 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003824 fi
3825 ]
andre2ff7b5d2000-06-03 14:57:40 +00003826)
Tim Rice648f8762011-01-26 12:38:57 -08003827AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00003828 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003829 [
3830 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003831 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003832 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003833 fi
3834 ]
andre2ff7b5d2000-06-03 14:57:40 +00003835)
Tim Rice648f8762011-01-26 12:38:57 -08003836AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00003837 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003838 [
3839 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003840 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003841 fi
3842 ]
andre2ff7b5d2000-06-03 14:57:40 +00003843)
Tim Rice648f8762011-01-26 12:38:57 -08003844AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00003845 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003846 [
3847 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003848 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003849 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003850 fi
3851 ]
andre2ff7b5d2000-06-03 14:57:40 +00003852)
Tim Rice648f8762011-01-26 12:38:57 -08003853AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00003854 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003855 [
3856 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003857 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10003858 fi
3859 ]
andre2ff7b5d2000-06-03 14:57:40 +00003860)
Tim Rice648f8762011-01-26 12:38:57 -08003861AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00003862 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003863 [
3864 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003865 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003866 [Define if you don't want to use pututline()
3867 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003868 fi
3869 ]
andre2ff7b5d2000-06-03 14:57:40 +00003870)
Tim Rice648f8762011-01-26 12:38:57 -08003871AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00003872 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003873 [
3874 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003875 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003876 [Define if you don't want to use pututxline()
3877 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003878 fi
3879 ]
andre2ff7b5d2000-06-03 14:57:40 +00003880)
Tim Rice648f8762011-01-26 12:38:57 -08003881AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003882 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003883 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003884 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003885 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08003886 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003887 conf_lastlog_location=$withval
3888 fi
3889 ]
3890)
andre2ff7b5d2000-06-03 14:57:40 +00003891
3892dnl lastlog, [uw]tmpx? detection
3893dnl NOTE: set the paths in the platform section to avoid the
3894dnl need for command-line parameters
3895dnl lastlog and [uw]tmp are subject to a file search if all else fails
3896
3897dnl lastlog detection
3898dnl NOTE: the code itself will detect if lastlog is a directory
3899AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003900AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003901#include <sys/types.h>
3902#include <utmp.h>
3903#ifdef HAVE_LASTLOG_H
3904# include <lastlog.h>
3905#endif
Damien Miller2994e082000-06-04 15:51:47 +10003906#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003907# include <paths.h>
3908#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003909#ifdef HAVE_LOGIN_H
3910# include <login.h>
3911#endif
Tim Rice648f8762011-01-26 12:38:57 -08003912 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
3913 [ AC_MSG_RESULT([yes]) ],
3914 [
3915 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10003916 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08003917 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10003918#include <sys/types.h>
3919#include <utmp.h>
3920#ifdef HAVE_LASTLOG_H
3921# include <lastlog.h>
3922#endif
3923#ifdef HAVE_PATHS_H
3924# include <paths.h>
3925#endif
Tim Rice648f8762011-01-26 12:38:57 -08003926 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
3927 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10003928 [
Tim Rice648f8762011-01-26 12:38:57 -08003929 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10003930 system_lastlog_path=no
3931 ])
Tim Rice648f8762011-01-26 12:38:57 -08003932])
Damien Miller2994e082000-06-04 15:51:47 +10003933
andre2ff7b5d2000-06-03 14:57:40 +00003934if test -z "$conf_lastlog_location"; then
3935 if test x"$system_lastlog_path" = x"no" ; then
3936 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003937 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003938 conf_lastlog_location=$f
3939 fi
3940 done
3941 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003942 AC_MSG_WARN([** Cannot find lastlog **])
3943 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003944 fi
3945 fi
3946fi
3947
3948if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08003949 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07003950 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003951fi
andre2ff7b5d2000-06-03 14:57:40 +00003952
3953dnl utmp detection
3954AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003955AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003956#include <sys/types.h>
3957#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003958#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003959# include <paths.h>
3960#endif
Tim Rice648f8762011-01-26 12:38:57 -08003961 ]], [[ char *utmp = UTMP_FILE; ]])],
3962 [ AC_MSG_RESULT([yes]) ],
3963 [ AC_MSG_RESULT([no])
3964 system_utmp_path=no
3965])
andre2ff7b5d2000-06-03 14:57:40 +00003966if test -z "$conf_utmp_location"; then
3967 if test x"$system_utmp_path" = x"no" ; then
3968 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3969 if test -f $f ; then
3970 conf_utmp_location=$f
3971 fi
3972 done
3973 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08003974 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00003975 fi
3976 fi
3977fi
3978if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08003979 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07003980 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003981fi
andre2ff7b5d2000-06-03 14:57:40 +00003982
3983dnl wtmp detection
3984AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003985AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003986#include <sys/types.h>
3987#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003988#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003989# include <paths.h>
3990#endif
Tim Rice648f8762011-01-26 12:38:57 -08003991 ]], [[ char *wtmp = WTMP_FILE; ]])],
3992 [ AC_MSG_RESULT([yes]) ],
3993 [ AC_MSG_RESULT([no])
3994 system_wtmp_path=no
3995])
andre2ff7b5d2000-06-03 14:57:40 +00003996if test -z "$conf_wtmp_location"; then
3997 if test x"$system_wtmp_path" = x"no" ; then
3998 for f in /usr/adm/wtmp /var/log/wtmp; do
3999 if test -f $f ; then
4000 conf_wtmp_location=$f
4001 fi
4002 done
4003 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004004 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004005 fi
4006 fi
4007fi
4008if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004009 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004010 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004011fi
andre2ff7b5d2000-06-03 14:57:40 +00004012
4013
andre2ff7b5d2000-06-03 14:57:40 +00004014dnl wtmpx detection
4015AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004016AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004017#include <sys/types.h>
4018#include <utmp.h>
4019#ifdef HAVE_UTMPX_H
4020#include <utmpx.h>
4021#endif
Damien Miller2994e082000-06-04 15:51:47 +10004022#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004023# include <paths.h>
4024#endif
Tim Rice648f8762011-01-26 12:38:57 -08004025 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4026 [ AC_MSG_RESULT([yes]) ],
4027 [ AC_MSG_RESULT([no])
4028 system_wtmpx_path=no
4029])
andre2ff7b5d2000-06-03 14:57:40 +00004030if test -z "$conf_wtmpx_location"; then
4031 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004032 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004033 fi
4034else
Tim Rice648f8762011-01-26 12:38:57 -08004035 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004036 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004037fi
andre2ff7b5d2000-06-03 14:57:40 +00004038
Damien Miller4018c192000-04-30 09:30:44 +10004039
Damien Miller29ea30d2000-03-17 10:54:15 +11004040if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004041 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4042 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004043fi
4044
Darren Tucker7da23cb2005-08-03 00:20:15 +10004045dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4046dnl Add now.
4047CFLAGS="$CFLAGS $werror_flags"
4048
Darren Tucker627337d2010-04-10 22:58:01 +10004049if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4050 TEST_SSH_IPV6=no
4051else
4052 TEST_SSH_IPV6=yes
4053fi
Tim Rice648f8762011-01-26 12:38:57 -08004054AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4055AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004056
Damien Millerbac2d8a2000-09-05 16:13:06 +11004057AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004058AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4059 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004060 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004061AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004062
Damien Miller7b22d652000-06-18 14:07:04 +10004063# Print summary of options
4064
Damien Miller7b22d652000-06-18 14:07:04 +10004065# Someone please show me a better way :)
4066A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4067B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4068C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4069D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004070E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004071F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004072G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004073H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4074I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4075J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004076
4077echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004078echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004079echo " User binaries: $B"
4080echo " System binaries: $C"
4081echo " Configuration files: $D"
4082echo " Askpass program: $E"
4083echo " Manual pages: $F"
4084echo " PID file: $G"
4085echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004086if test "x$external_path_file" = "x/etc/login.conf" ; then
4087echo " At runtime, sshd will use the path defined in $external_path_file"
4088echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004089else
Damien Millerf58c6722002-05-13 13:15:42 +10004090echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004091 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004092echo " (If PATH is set in $external_path_file it will be used instead. If"
4093echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4094 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004095fi
Damien Millera18bbd32002-05-13 10:48:57 +10004096if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004097echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004098fi
Damien Millerf58c6722002-05-13 13:15:42 +10004099echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004100echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004101echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004102echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004103echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004104echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004105echo " S/KEY support: $SKEY_MSG"
4106echo " TCP Wrappers support: $TCPW_MSG"
4107echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004108echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004109echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004110echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004111echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004112echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4113echo " BSD Auth support: $BSD_AUTH_MSG"
4114echo " Random number source: $RAND_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004115
Damien Miller7b22d652000-06-18 14:07:04 +10004116echo ""
4117
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004118echo " Host: ${host}"
4119echo " Compiler: ${CC}"
4120echo " Compiler flags: ${CFLAGS}"
4121echo "Preprocessor flags: ${CPPFLAGS}"
4122echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004123echo " Libraries: ${LIBS}"
4124if test ! -z "${SSHDLIBS}"; then
4125echo " +for sshd: ${SSHDLIBS}"
4126fi
Damien Miller71adf122011-01-25 12:16:15 +11004127if test ! -z "${SSHLIBS}"; then
4128echo " +for ssh: ${SSHLIBS}"
4129fi
Damien Miller7b22d652000-06-18 14:07:04 +10004130
4131echo ""
4132
Tim Rice6f1f7582004-05-30 21:38:51 -07004133if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004134 echo "SVR4 style packages are supported with \"make package\""
4135 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004136fi
4137
Damien Miller82cf0ce2000-12-20 13:34:48 +11004138if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004139 echo "PAM is enabled. You may need to install a PAM control file "
4140 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004141 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004142 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004143 echo ""
4144fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004145
Damien Millerb4097182004-05-23 14:09:40 +10004146if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004147 echo "WARNING: the operating system that you are using does not"
4148 echo "appear to support getpeereid(), getpeerucred() or the"
4149 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4150 echo "enforce security checks to prevent unauthorised connections to"
4151 echo "ssh-agent. Their absence increases the risk that a malicious"
4152 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004153 echo ""
4154fi
4155
Darren Tuckerd9f88912005-02-20 21:01:48 +11004156if test "$AUDIT_MODULE" = "bsm" ; then
4157 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4158 echo "See the Solaris section in README.platform for details."
4159fi