blob: acf529b04fac63dfba376beb6479eb245caf9e57 [file] [log] [blame]
Darren Tucker93a2d412012-02-24 10:40:41 +11001# $Id: configure.ac,v 1.487 2012/02/23 23:40:43 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Darren Tucker93a2d412012-02-24 10:40:41 +110018AC_REVISION($Revision: 1.487 $)
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>])
Damien Miller69ff1df2011-06-23 08:30:03 +1000109AC_CHECK_DECL([SYSTR_POLICY_KILL], [have_systr_policy_kill=1], , [
110 #include <sys/types.h>
111 #include <sys/param.h>
112 #include <dev/systrace.h>
113])
114AC_CHECK_DECL([RLIMIT_NPROC],
115 [AC_DEFINE([HAVE_RLIMIT_NPROC], [], [sys/resource.h has RLIMIT_NPROC])], , [
116 #include <sys/types.h>
117 #include <sys/resource.h>
118])
Darren Tucker67b37032005-06-03 17:58:31 +1000119
Darren Tuckerb7918af2008-03-09 11:34:23 +1100120use_stack_protector=1
Tim Rice648f8762011-01-26 12:38:57 -0800121AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100122 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100123 if test "x$withval" = "xno"; then
124 use_stack_protector=0
125 fi ])
126
Damien Miller134d02a2011-01-12 16:00:37 +1100127
Damien Millera8e06ce2003-11-21 23:48:55 +1100128if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Millerb1763622011-05-20 11:45:25 +1000129 OSSH_CHECK_CFLAG_COMPILE([-Wall])
130 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
131 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
132 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
133 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
134 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
135 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
136 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100137 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Tim Rice648f8762011-01-26 12:38:57 -0800138 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100139 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700140 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000141 1.*) no_attrib_nonnull=1 ;;
142 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000143 no_attrib_nonnull=1
144 ;;
145 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100146 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700147 esac
Tim Rice648f8762011-01-26 12:38:57 -0800148 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000149
Tim Rice648f8762011-01-26 12:38:57 -0800150 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000151 saved_CFLAGS="$CFLAGS"
152 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800153 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
154 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
155 [ AC_MSG_RESULT([yes]) ],
156 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000157 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800158 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000159
Darren Tuckerb7918af2008-03-09 11:34:23 +1100160 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100161 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100162 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100163 if test "x$use_stack_protector" = "x1"; then
164 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800165 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100166 saved_CFLAGS="$CFLAGS"
167 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100168 CFLAGS="$CFLAGS $t -Werror"
169 LDFLAGS="$LDFLAGS $t -Werror"
170 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800171 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
172 [[
173 char x[256];
174 snprintf(x, sizeof(x), "XXX");
175 ]])],
176 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100177 CFLAGS="$saved_CFLAGS $t"
178 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800179 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100180 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800181 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
182 [[
183 char x[256];
184 snprintf(x, sizeof(x), "XXX");
185 ]])],
186 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100187 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800188 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100189 [ AC_MSG_WARN([cross compiling: cannot test])
190 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100191 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100192 ],
Tim Rice648f8762011-01-26 12:38:57 -0800193 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100194 )
195 CFLAGS="$saved_CFLAGS"
196 LDFLAGS="$saved_LDFLAGS"
197 done
198 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100199
Darren Tucker67b37032005-06-03 17:58:31 +1000200 if test -z "$have_llong_max"; then
201 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
202 unset ac_cv_have_decl_LLONG_MAX
203 saved_CFLAGS="$CFLAGS"
204 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800205 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000206 [have_llong_max=1],
207 [CFLAGS="$saved_CFLAGS"],
208 [#include <limits.h>]
209 )
210 fi
Damien Miller166bd442000-03-16 10:48:25 +1100211fi
212
Darren Tucker391de5c2007-04-29 14:49:21 +1000213if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800214 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000215fi
216
Tim Rice648f8762011-01-26 12:38:57 -0800217AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800218 [ --without-rpath Disable auto-added -R linker paths],
219 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800220 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800221 need_dash_r=""
222 fi
223 if test "x$withval" = "xyes" ; then
224 need_dash_r=1
225 fi
226 ]
227)
228
Tim Rice1cfab232006-10-03 09:34:35 -0700229# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800230AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700231 [ --with-cflags Specify additional flags to pass to compiler],
232 [
233 if test -n "$withval" && test "x$withval" != "xno" && \
234 test "x${withval}" != "xyes"; then
235 CFLAGS="$CFLAGS $withval"
236 fi
237 ]
238)
Tim Rice648f8762011-01-26 12:38:57 -0800239AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700240 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
241 [
242 if test -n "$withval" && test "x$withval" != "xno" && \
243 test "x${withval}" != "xyes"; then
244 CPPFLAGS="$CPPFLAGS $withval"
245 fi
246 ]
247)
Tim Rice648f8762011-01-26 12:38:57 -0800248AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700249 [ --with-ldflags Specify additional flags to pass to linker],
250 [
251 if test -n "$withval" && test "x$withval" != "xno" && \
252 test "x${withval}" != "xyes"; then
253 LDFLAGS="$LDFLAGS $withval"
254 fi
255 ]
256)
Tim Rice648f8762011-01-26 12:38:57 -0800257AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700258 [ --with-libs Specify additional libraries to link with],
259 [
260 if test -n "$withval" && test "x$withval" != "xno" && \
261 test "x${withval}" != "xyes"; then
262 LIBS="$LIBS $withval"
263 fi
264 ]
265)
Tim Rice648f8762011-01-26 12:38:57 -0800266AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700267 [ --with-Werror Build main code with -Werror],
268 [
269 if test -n "$withval" && test "x$withval" != "xno"; then
270 werror_flags="-Werror"
271 if test "x${withval}" != "xyes"; then
272 werror_flags="$withval"
273 fi
274 fi
275 ]
276)
277
Tim Rice648f8762011-01-26 12:38:57 -0800278AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700279 bstring.h \
280 crypt.h \
281 crypto/sha2.h \
282 dirent.h \
283 endian.h \
284 features.h \
285 fcntl.h \
286 floatingpoint.h \
287 getopt.h \
288 glob.h \
289 ia.h \
290 iaf.h \
291 limits.h \
292 login.h \
293 maillock.h \
294 ndir.h \
295 net/if_tun.h \
296 netdb.h \
297 netgroup.h \
298 pam/pam_appl.h \
299 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000300 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700301 pty.h \
302 readpassphrase.h \
303 rpc/types.h \
304 security/pam_appl.h \
305 sha2.h \
306 shadow.h \
307 stddef.h \
308 stdint.h \
309 string.h \
310 strings.h \
311 sys/audit.h \
312 sys/bitypes.h \
313 sys/bsdtty.h \
314 sys/cdefs.h \
315 sys/dir.h \
316 sys/mman.h \
317 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000318 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700319 sys/prctl.h \
320 sys/pstat.h \
321 sys/select.h \
322 sys/stat.h \
323 sys/stream.h \
324 sys/stropts.h \
325 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000326 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700327 sys/sysmacros.h \
328 sys/time.h \
329 sys/timers.h \
330 sys/un.h \
331 time.h \
332 tmpdir.h \
333 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700334 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700335 unistd.h \
336 usersec.h \
337 util.h \
338 utime.h \
339 utmp.h \
340 utmpx.h \
341 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800342])
Tim Rice1cfab232006-10-03 09:34:35 -0700343
344# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800345AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700346#ifdef HAVE_SYS_TIME_H
347# include <sys/time.h>
348#endif
349])
350
351# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800352AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700353#ifdef HAVE_SYS_STREAM_H
354# include <sys/stream.h>
355#endif
356])
357
358# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800359AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700360#include <sys/types.h>
361])
362
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000363# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800364AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000365#include <sys/param.h>
366])
367
Damien Miller1b06dc32006-08-31 03:24:41 +1000368# Messages for features tested for in target-specific section
369SIA_MSG="no"
370SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100371SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000372
Damien Millera22ba012000-03-02 23:09:20 +1100373# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100374case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100375*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000376 # Some versions of VAC won't allow macro redefinitions at
377 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
378 # particularly with older versions of vac or xlc.
379 # It also throws errors about null macro argments, but these are
380 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800381 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000382 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800383 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000384#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800385#define testmacro bar]],
386 [[ exit(0); ]])],
387 [ AC_MSG_RESULT([yes]) ],
388 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000389 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
390 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
391 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
392 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
393 ]
394 )
395
Damien Millera8e06ce2003-11-21 23:48:55 +1100396 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000397 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800398 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100399 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000400 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000401 if test "$GCC" = "yes"; then
402 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
403 else
404 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
405 fi
406 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000407 if (test -z "$blibflags"); then
408 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800409 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
410 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000411 fi
412 done
413 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800414 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000415 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
416 else
Tim Rice648f8762011-01-26 12:38:57 -0800417 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000418 fi
419 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000420 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800421 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700422 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800423 [AC_CHECK_LIB([s], [authenticate],
424 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700425 LIBS="$LIBS -ls"
426 ])
427 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100428 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100429 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100430 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000431 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800432 AC_CHECK_DECLS([loginfailed],
433 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
434 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
435 [[ (void)loginfailed("user","host","tty",0); ]])],
436 [AC_MSG_RESULT([yes])
437 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
438 [Define if your AIX loginfailed() function
439 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
440 ])],
441 [],
442 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000443 )
Tim Rice648f8762011-01-26 12:38:57 -0800444 AC_CHECK_FUNCS([getgrset setauthdb])
445 AC_CHECK_DECL([F_CLOSEM],
446 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000447 [],
448 [ #include <limits.h>
449 #include <fcntl.h> ]
450 )
Darren Tucker691d5232005-02-15 21:45:57 +1100451 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800452 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
453 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700454 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800455 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
456 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000457 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800458 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
459 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700460 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800461 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700462 [Define to a Set Process Title type if your system is
463 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800464 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100465 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800466 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100467 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100468*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100469 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100470 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800471 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
472 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
473 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700474 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800475 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700476 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800477 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700478 [Define if the concept of ports only accessible to
479 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800480 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700481 [Define if your platform needs to skip post auth
482 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800483 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
484 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100485 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000486*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800487 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700488 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800489 AC_DEFINE([SETEUID_BREAKS_SETUID])
490 AC_DEFINE([BROKEN_SETREUID])
491 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000492 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000493*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800494 AC_MSG_CHECKING([if we have working getaddrinfo])
495 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000496main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
497 exit(0);
498 else
499 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800500}
501 ]])],
502 [AC_MSG_RESULT([working])],
503 [AC_MSG_RESULT([buggy])
504 AC_DEFINE([BROKEN_GETADDRINFO], [1],
505 [getaddrinfo is broken (if present)])
506 ],
507 [AC_MSG_RESULT([assume it is working])])
508 AC_DEFINE([SETEUID_BREAKS_SETUID])
509 AC_DEFINE([BROKEN_SETREUID])
510 AC_DEFINE([BROKEN_SETREGID])
511 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
512 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700513 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800514 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
515 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000516 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800517 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000518 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800519 m4_pattern_allow([AU_IPv])
520 AC_CHECK_DECL([AU_IPv4], [],
521 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100522 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800523 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100524 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100525 )
Damien Millerc09182f2011-06-03 12:11:38 +1000526 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
527 [Define to a Set Process Title type if your system is
528 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000529 AC_CHECK_FUNCS([sandbox_init])
530 AC_CHECK_HEADERS([sandbox.h])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000531 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000532*-*-dragonfly*)
533 SSHDLIBS="$SSHDLIBS -lcrypt"
534 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100535*-*-haiku*)
536 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800537 AC_CHECK_LIB([network], [socket])
538 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100539 MANTYPE=man
540 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000541*-*-hpux*)
542 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000543 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100544 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800545 AC_DEFINE([USE_PIPES])
546 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700547 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800548 AC_DEFINE([LOGIN_NEEDS_UTMPX])
549 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700550 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800551 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Tim Rice90f42b02011-06-02 18:17:49 -0700552 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700553 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800554 AC_CHECK_LIB([xnet], [t_error], ,
555 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000556
557 # next, we define all of the options specific to major releases
558 case "$host" in
559 *-*-hpux10*)
560 if test -z "$GCC"; then
561 CFLAGS="$CFLAGS -Ae"
562 fi
563 ;;
564 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800565 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700566 [Define if you are using Solaris-derived PAM which
567 passes pam_messages to the conversation function
568 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800569 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700570 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800571 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000572 check_for_hpux_broken_getaddrinfo=1
573 check_for_conflicting_getspnam=1
574 ;;
575 esac
576
577 # lastly, we define options specific to minor releases
578 case "$host" in
579 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800580 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700581 [Define if you have SecureWare-based
582 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000583 disable_ptmx_check=yes
584 LIBS="$LIBS -lsecpw"
585 ;;
586 esac
Damien Miller1bead332000-04-30 00:47:29 +1000587 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100588*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100589 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700591 [Define if you system's inet_ntoa is busted
592 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800593 AC_DEFINE([SETEUID_BREAKS_SETUID])
594 AC_DEFINE([BROKEN_SETREUID])
595 AC_DEFINE([BROKEN_SETREGID])
596 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700597 [Define if you shouldn't strip 'tty' from your
598 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100600 ;;
601*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100602 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800603 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700604 [Define if you have/want arrays
605 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800606 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700607 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800608 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700609 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800610 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700611 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800612 AC_DEFINE([BROKEN_INET_NTOA])
613 AC_DEFINE([SETEUID_BREAKS_SETUID])
614 AC_DEFINE([BROKEN_SETREUID])
615 AC_DEFINE([BROKEN_SETREGID])
616 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
617 AC_DEFINE([WITH_ABBREV_NO_TTY])
618 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100619 ;;
Damien Miller90551722009-02-16 15:37:03 +1100620*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
621 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800622 AC_DEFINE([PAM_TTY_KLUDGE])
623 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
624 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
625 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
626 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100627 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100628*-*-linux*)
629 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100630 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000631 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800632 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700633 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800634 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700635 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800636 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
637 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700638 [Define to whatever link() returns for "not supported"
639 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800640 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
641 AC_DEFINE([USE_BTMP])
642 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100643 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000644 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000645 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800646 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700647 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000648 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000649 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100650 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800651 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100652 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800653 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100654 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800655 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100656 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800657 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100658 [Prepend the address family to IP tunnel traffic])
659 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100660 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000661mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800662 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000663 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000664 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100665*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000666 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800667 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800668 need_dash_r=1
669 fi
Tim Rice648f8762011-01-26 12:38:57 -0800670 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100671 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800672 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
673 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100674 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100675 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100676*-*-freebsd*)
677 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800678 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
679 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100680 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800681 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
682 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100683 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000684*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800685 AC_DEFINE([SETEUID_BREAKS_SETUID])
686 AC_DEFINE([BROKEN_SETREUID])
687 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000688 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000689*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000690 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100691 conf_utmp_location=/etc/utmp
692 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700693 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800694 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
695 AC_DEFINE([BROKEN_REALPATH])
696 AC_DEFINE([USE_PIPES])
697 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000698 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000699*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800700 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
701 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
702 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
703 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000704 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000705 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100706*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800707 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800708 need_dash_r=1
709 fi
Tim Rice648f8762011-01-26 12:38:57 -0800710 AC_DEFINE([PAM_SUN_CODEBASE])
711 AC_DEFINE([LOGIN_NEEDS_UTMPX])
712 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700713 [Some versions of /bin/login need the TERM supplied
714 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800715 AC_DEFINE([PAM_TTY_KLUDGE])
716 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700717 [Define if pam_chauthtok wants real uid set
718 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800719 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000720 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800721 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700722 [Define if sshd somehow reacquires a controlling TTY
723 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800724 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000725 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800726 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000727 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000728 # hardwire lastlog location (can't detect it on some versions)
729 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800730 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000731 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
732 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800733 AC_MSG_RESULT([yes])
734 AC_DEFINE([DISABLE_UTMP])
735 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700736 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000737 else
Tim Rice648f8762011-01-26 12:38:57 -0800738 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000739 fi
Tim Rice648f8762011-01-26 12:38:57 -0800740 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000741 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
742 [
Tim Rice648f8762011-01-26 12:38:57 -0800743 AC_CHECK_LIB([contract], [ct_tmpl_activate],
744 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000745 [Define if you have Solaris process contracts])
746 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000747 SPC_MSG="yes" ], )
748 ],
749 )
Tim Rice648f8762011-01-26 12:38:57 -0800750 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100751 [ --with-solaris-projects Enable Solaris projects (experimental)],
752 [
Tim Rice648f8762011-01-26 12:38:57 -0800753 AC_CHECK_LIB([project], [setproject],
754 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100755 [Define if you have Solaris projects])
756 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100757 SP_MSG="yes" ], )
758 ],
759 )
Damien Miller75b1d102000-01-07 14:01:41 +1100760 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000761*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000762 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800763 AC_CHECK_FUNCS([getpwanam])
764 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000765 conf_utmp_location=/etc/utmp
766 conf_wtmp_location=/var/adm/wtmp
767 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000769 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000770*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700771 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800772 AC_DEFINE([USE_PIPES])
773 AC_DEFINE([SSHD_ACQUIRES_CTTY])
774 AC_DEFINE([SETEUID_BREAKS_SETUID])
775 AC_DEFINE([BROKEN_SETREUID])
776 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000777 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000778*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700779 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800780 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100781 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800782 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100783 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800784 AC_DEFINE([USE_PIPES])
785 AC_DEFINE([IP_TOS_IS_BROKEN])
786 AC_DEFINE([SETEUID_BREAKS_SETUID])
787 AC_DEFINE([BROKEN_SETREUID])
788 AC_DEFINE([BROKEN_SETREGID])
789 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000790 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700791 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
792 # Attention: always take care to bind libsocket and libnsl before libc,
793 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000794 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800795# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100796*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800797 AC_DEFINE([USE_PIPES])
798 AC_DEFINE([SETEUID_BREAKS_SETUID])
799 AC_DEFINE([BROKEN_SETREUID])
800 AC_DEFINE([BROKEN_SETREGID])
801 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
802 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100803 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800804# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100805*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800806 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800807 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
808 AC_DEFINE([USE_PIPES])
809 AC_DEFINE([SETEUID_BREAKS_SETUID])
810 AC_DEFINE([BROKEN_GETADDRINFO])
811 AC_DEFINE([BROKEN_SETREUID])
812 AC_DEFINE([BROKEN_SETREGID])
813 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700814 case "$host" in
815 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700816 maildir=/var/spool/mail
Tim Rice4dbacff2005-06-01 20:09:28 -0700817 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800818 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700819 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800820 AC_DEFINE([BROKEN_UPDWTMPX])
821 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
822 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
823 AC_DEFINE([HAVE_SECUREWARE])
824 AC_DEFINE([DISABLE_SHADOW])
825 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700826 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800827 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800828 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800829 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700830 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100831 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100832*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100833 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800834# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100835*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800836 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100837 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800838# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100839*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800840 if test -z "$GCC"; then
841 CFLAGS="$CFLAGS -belf"
842 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100843 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000844 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800845 AC_DEFINE([USE_PIPES])
846 AC_DEFINE([HAVE_SECUREWARE])
847 AC_DEFINE([DISABLE_SHADOW])
848 AC_DEFINE([DISABLE_FD_PASSING])
849 AC_DEFINE([SETEUID_BREAKS_SETUID])
850 AC_DEFINE([BROKEN_GETADDRINFO])
851 AC_DEFINE([BROKEN_SETREUID])
852 AC_DEFINE([BROKEN_SETREGID])
853 AC_DEFINE([WITH_ABBREV_NO_TTY])
854 AC_DEFINE([BROKEN_UPDWTMPX])
855 AC_DEFINE([PASSWD_NEEDS_USERNAME])
856 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700857 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700858 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000859 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000860*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800861 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700862 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800863 AC_DEFINE([SETEUID_BREAKS_SETUID])
864 AC_DEFINE([BROKEN_SETREUID])
865 AC_DEFINE([BROKEN_SETREGID])
866 AC_DEFINE([USE_PIPES])
867 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000868 LDFLAGS="$LDFLAGS"
869 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
870 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000871 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000872*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800873 AC_DEFINE([SETEUID_BREAKS_SETUID])
874 AC_DEFINE([BROKEN_SETREUID])
875 AC_DEFINE([BROKEN_SETREGID])
876 AC_DEFINE([WITH_ABBREV_NO_TTY])
877 AC_DEFINE([USE_PIPES])
878 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000879 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100880 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000881 MANTYPE=cat
882 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000883*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800884 AC_DEFINE([SETEUID_BREAKS_SETUID])
885 AC_DEFINE([BROKEN_SETREUID])
886 AC_DEFINE([BROKEN_SETREGID])
887 AC_DEFINE([USE_PIPES])
888 AC_DEFINE([DISABLE_FD_PASSING])
889 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000890 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
891 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
892 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700893 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000894*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800895 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000896 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800897 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000898 [ --with-osfsia Enable Digital Unix SIA],
899 [
900 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800901 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000902 no_osfsia=1
903 fi
904 ],
905 )
906 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000907 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800908 AC_MSG_RESULT([yes])
909 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700910 [Define if you have Digital Unix Security
911 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800912 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700913 [Define if you don't want to use your
914 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800915 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000916 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000917 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000918 else
Tim Rice648f8762011-01-26 12:38:57 -0800919 AC_MSG_RESULT([no])
920 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700921 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000922 fi
923 fi
Tim Rice648f8762011-01-26 12:38:57 -0800924 AC_DEFINE([BROKEN_GETADDRINFO])
925 AC_DEFINE([SETEUID_BREAKS_SETUID])
926 AC_DEFINE([BROKEN_SETREUID])
927 AC_DEFINE([BROKEN_SETREGID])
928 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000929 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000930
Tim Rice70335a62006-02-04 17:42:58 -0800931*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800932 AC_DEFINE([USE_PIPES])
933 AC_DEFINE([NO_X11_UNIX_SOCKETS])
934 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
935 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
936 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
937 AC_DEFINE([DISABLE_LASTLOG])
938 AC_DEFINE([SSHD_ACQUIRES_CTTY])
939 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800940 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000941 case "$host" in
942 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800943 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000944 ;;
945 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000946 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000947
948*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800949 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
950 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
951 AC_DEFINE([NEED_SETPGRP])
952 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700953 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000954
955*-*-lynxos)
956 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -0800957 AC_DEFINE([MISSING_HOWMANY])
958 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000959 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100960esac
961
Tim Rice648f8762011-01-26 12:38:57 -0800962AC_MSG_CHECKING([compiler and flags for sanity])
963AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
964 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +1000965 [
Tim Rice648f8762011-01-26 12:38:57 -0800966 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +1000967 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000968 ],
969 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000970)
971
Darren Tucker0c9653f2005-05-28 15:58:14 +1000972dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100973# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -0800974AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
975AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000976
Tim Rice1e1ef642003-09-11 22:19:31 -0700977dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -0800978AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
979 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -0700980 AC_CACHE_CHECK([for broken dirname],
981 ac_cv_have_broken_dirname, [
982 save_LIBS="$LIBS"
983 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000984 AC_RUN_IFELSE(
985 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700986#include <libgen.h>
987#include <string.h>
988
989int main(int argc, char **argv) {
990 char *s, buf[32];
991
992 strncpy(buf,"/etc", 32);
993 s = dirname(buf);
994 if (!s || strncmp(s, "/", 32) != 0) {
995 exit(1);
996 } else {
997 exit(0);
998 }
999}
Darren Tucker314d89e2005-10-17 23:29:23 +10001000 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001001 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001002 [ ac_cv_have_broken_dirname="yes" ],
1003 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001004 )
1005 LIBS="$save_LIBS"
1006 ])
1007 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1008 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001009 AC_DEFINE([HAVE_DIRNAME])
1010 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001011 fi
1012 ])
1013])
1014
Tim Rice648f8762011-01-26 12:38:57 -08001015AC_CHECK_FUNC([getspnam], ,
1016 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1017AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1018 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001019
Tim Rice13aae5e2001-10-21 17:53:58 -07001020dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001021AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001022 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001023 [ if test "x$withval" = "xno" ; then
1024 AC_MSG_ERROR([*** zlib is required ***])
1025 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001026 if test -d "$withval/lib"; then
1027 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001028 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001029 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001030 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001031 fi
1032 else
1033 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001034 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001035 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001036 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001037 fi
1038 fi
1039 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001040 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001041 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001042 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001043 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001044 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001045)
1046
Tim Rice648f8762011-01-26 12:38:57 -08001047AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1048AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001049 [
1050 saved_CPPFLAGS="$CPPFLAGS"
1051 saved_LDFLAGS="$LDFLAGS"
1052 save_LIBS="$LIBS"
1053 dnl Check default zlib install dir
1054 if test -n "${need_dash_r}"; then
1055 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1056 else
1057 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1058 fi
1059 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1060 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001061 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001062 [
1063 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1064 ]
1065 )
1066 ]
1067)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001068
Tim Rice648f8762011-01-26 12:38:57 -08001069AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001070 [ --without-zlib-version-check Disable zlib version check],
1071 [ if test "x$withval" = "xno" ; then
1072 zlib_check_nonfatal=1
1073 fi
1074 ]
1075)
1076
Tim Rice648f8762011-01-26 12:38:57 -08001077AC_MSG_CHECKING([for possibly buggy zlib])
1078AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001079#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001080#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001081 ]],
1082 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001083 int a=0, b=0, c=0, d=0, n, v;
1084 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1085 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001086 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001087 v = a*1000000 + b*10000 + c*100 + d;
1088 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1089
1090 /* 1.1.4 is OK */
1091 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001092 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001093
Darren Tucker41097ed2005-07-25 15:24:21 +10001094 /* 1.2.3 and up are OK */
1095 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001096 exit(0);
1097
Darren Tucker2dcd2392004-01-23 17:13:33 +11001098 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001099 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001100 AC_MSG_RESULT([no]),
1101 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001102 if test -z "$zlib_check_nonfatal" ; then
1103 AC_MSG_ERROR([*** zlib too old - check config.log ***
1104Your reported zlib version has known security problems. It's possible your
1105vendor has fixed these problems without changing the version number. If you
1106are sure this is the case, you can disable the check by running
1107"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001108If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001109See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001110 else
1111 AC_MSG_WARN([zlib version may have security problems])
1112 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001113 ],
1114 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001115)
Damien Miller6f9c3372000-10-25 10:06:04 +11001116
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001117dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001118AC_CHECK_FUNC([strcasecmp],
1119 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001120)
Tim Rice648f8762011-01-26 12:38:57 -08001121AC_CHECK_FUNCS([utimes],
1122 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001123 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001124)
Damien Millerab18c411999-11-11 10:40:23 +11001125
Tim Ricee589a292001-11-03 11:09:32 -08001126dnl Checks for libutil functions
Tim Rice648f8762011-01-26 12:38:57 -08001127AC_CHECK_HEADERS([libutil.h])
1128AC_SEARCH_LIBS([login], [util bsd], [AC_DEFINE([HAVE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001129 [Define if your libraries define login()])])
Tim Rice648f8762011-01-26 12:38:57 -08001130AC_CHECK_FUNCS([fmt_scaled logout updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001131
Ben Lindstrom8697e082001-02-24 21:41:10 +00001132AC_FUNC_STRFTIME
1133
Damien Miller3c027682001-03-14 11:39:45 +11001134# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001135AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1136AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001137 [
1138 #include <glob.h>
1139 #ifdef GLOB_ALTDIRFUNC
1140 FOUNDIT
1141 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001142 ],
Damien Miller3c027682001-03-14 11:39:45 +11001143 [
Tim Rice648f8762011-01-26 12:38:57 -08001144 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001145 [Define if your system glob() function has
1146 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001147 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001148 ],
1149 [
Tim Rice648f8762011-01-26 12:38:57 -08001150 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001151 ]
1152)
Damien Millerab18c411999-11-11 10:40:23 +11001153
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001154# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001155AC_MSG_CHECKING([for gl_matchc field in glob_t])
1156AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1157 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001158 [
Tim Rice648f8762011-01-26 12:38:57 -08001159 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001160 [Define if your system glob() function has
1161 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001162 AC_MSG_RESULT([yes])
1163 ], [
1164 AC_MSG_RESULT([no])
1165])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001166
Damien Millera6e121a2010-10-07 21:39:17 +11001167# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001168AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1169AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001170#ifndef GLOB_KEEPSTAT
1171#error "glob does not support GLOB_KEEPSTAT extension"
1172#endif
1173glob_t g;
1174g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001175]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001176 [
Tim Rice648f8762011-01-26 12:38:57 -08001177 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001178 [Define if your system glob() function has
1179 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001180 AC_MSG_RESULT([yes])
1181 ], [
1182 AC_MSG_RESULT([no])
1183
1184])
Damien Millera6e121a2010-10-07 21:39:17 +11001185
Tim Rice648f8762011-01-26 12:38:57 -08001186AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001187
Damien Miller18bb4732001-03-28 14:35:30 +10001188AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001189AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001190 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001191#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001192#include <dirent.h>]],
1193 [[
1194 struct dirent d;
1195 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001196 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001197 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001198 [
Tim Rice648f8762011-01-26 12:38:57 -08001199 AC_MSG_RESULT([no])
1200 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001201 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001202 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001203 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001204 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001205 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001206 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001207 ]
1208)
1209
Damien Miller36f49652004-08-15 18:40:59 +10001210AC_MSG_CHECKING([for /proc/pid/fd directory])
1211if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001212 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1213 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001214else
Tim Rice648f8762011-01-26 12:38:57 -08001215 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001216fi
1217
Damien Millerc547bf12001-02-16 10:18:12 +11001218# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001219SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001220AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001221 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001222 [
1223 if test "x$withval" != "xno" ; then
1224
1225 if test "x$withval" != "xyes" ; then
1226 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1227 LDFLAGS="$LDFLAGS -L${withval}/lib"
1228 fi
1229
Tim Rice648f8762011-01-26 12:38:57 -08001230 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001231 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001232 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001233
Tim Rice4cec93f2002-02-26 08:40:48 -08001234 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001235 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001236 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001237#include <stdio.h>
1238#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001239 ]], [[
1240 char *ff = skey_keyinfo(""); ff="";
1241 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001242 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001243 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001244 [
Tim Rice648f8762011-01-26 12:38:57 -08001245 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001246 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1247 ])
Tim Rice648f8762011-01-26 12:38:57 -08001248 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1249 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1250#include <stdio.h>
1251#include <skey.h>
1252 ]], [[
1253 (void)skeychallenge(NULL,"name","",0);
1254 ]])],
1255 [
1256 AC_MSG_RESULT([yes])
1257 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001258 [Define if your skeychallenge()
1259 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001260 [
1261 AC_MSG_RESULT([no])
1262 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001263 fi
1264 ]
1265)
1266
1267# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001268TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001269AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001270 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001271 [
1272 if test "x$withval" != "xno" ; then
1273 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001274 saved_LDFLAGS="$LDFLAGS"
1275 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001276 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001277 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001278 if test -d "${withval}/lib"; then
1279 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001280 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001281 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001282 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001283 fi
1284 else
1285 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001286 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001287 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001288 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001289 fi
1290 fi
1291 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001292 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001293 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001294 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001295 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001296 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001297 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001298 AC_MSG_CHECKING([for libwrap])
1299 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001300#include <sys/types.h>
1301#include <sys/socket.h>
1302#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001303#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001304int deny_severity = 0, allow_severity = 0;
1305 ]], [[
1306 hosts_access(0);
1307 ]])], [
1308 AC_MSG_RESULT([yes])
1309 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001310 [Define if you want
1311 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001312 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001313 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001314 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001315 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001316
1317 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001318 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001319 fi
1320 ]
1321)
1322
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001323# Check whether user wants to use ldns
1324LDNS_MSG="no"
1325AC_ARG_WITH(ldns,
1326 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1327 [
1328 if test "x$withval" != "xno" ; then
1329
1330 if test "x$withval" != "xyes" ; then
1331 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1332 LDFLAGS="$LDFLAGS -L${withval}/lib"
1333 fi
1334
1335 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1336 LIBS="-lldns $LIBS"
1337 LDNS_MSG="yes"
1338
1339 AC_MSG_CHECKING([for ldns support])
1340 AC_LINK_IFELSE(
1341 [AC_LANG_SOURCE([[
1342#include <stdio.h>
1343#include <stdlib.h>
1344#include <stdint.h>
1345#include <ldns/ldns.h>
1346int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1347 ]])
1348 ],
1349 [AC_MSG_RESULT(yes)],
1350 [
1351 AC_MSG_RESULT(no)
1352 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1353 ])
1354 fi
1355 ]
1356)
1357
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001358# Check whether user wants libedit support
1359LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001360AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001361 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001362 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001363 if test "x$withval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001364 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001365 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001366 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001367 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001368 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001369 use_pkgconfig_for_libedit=yes
1370 else
Tim Rice648f8762011-01-26 12:38:57 -08001371 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001372 fi
1373 fi
1374 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001375 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1376 if test -n "${need_dash_r}"; then
1377 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1378 else
1379 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1380 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001381 fi
Damien Miller1f789802010-10-11 22:35:22 +11001382 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001383 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1384 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1385 else
1386 LIBEDIT="-ledit -lcurses"
1387 fi
1388 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001389 AC_CHECK_LIB([edit], [el_init],
1390 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001391 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001392 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001393 ],
Tim Rice648f8762011-01-26 12:38:57 -08001394 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001395 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001396 )
Tim Rice648f8762011-01-26 12:38:57 -08001397 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001398 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001399 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1400 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001401 int i = H_SETSIZE;
1402 el_init("", NULL, NULL, NULL);
1403 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001404 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001405 [ AC_MSG_RESULT([yes]) ],
1406 [ AC_MSG_RESULT([no])
1407 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001408 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001409 fi ]
1410)
1411
Darren Tuckerd9f88912005-02-20 21:01:48 +11001412AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001413AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001414 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001415 [
Tim Rice648f8762011-01-26 12:38:57 -08001416 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001417 case "$withval" in
1418 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001419 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001420 AUDIT_MODULE=bsm
1421 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001422 AC_CHECK_HEADERS([bsm/audit.h], [],
1423 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001424 [
1425#ifdef HAVE_TIME_H
1426# include <time.h>
1427#endif
1428 ]
1429)
Tim Rice648f8762011-01-26 12:38:57 -08001430 AC_CHECK_LIB([bsm], [getaudit], [],
1431 [AC_MSG_ERROR([BSM enabled and required library not found])])
1432 AC_CHECK_FUNCS([getaudit], [],
1433 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001434 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001435 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1436 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker93a2d412012-02-24 10:40:41 +11001437 if test "$sol2ver" -eq 11; then
1438 SSHDLIBS="$SSHDLIBS -lscf"
1439 AC_DEFINE([BROKEN_BSM_API], [1],
1440 [The system has incomplete BSM API])
1441 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001442 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001443 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001444 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001445 AUDIT_MODULE=linux
1446 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001447 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001448 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001449 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001450 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001451 debug)
1452 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001453 AC_MSG_RESULT([debug])
1454 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001455 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001456 no)
Tim Rice648f8762011-01-26 12:38:57 -08001457 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001458 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001459 *)
1460 AC_MSG_ERROR([Unknown audit module $withval])
1461 ;;
1462 esac ]
1463)
1464
Damien Millerfe1f1432003-02-24 15:45:42 +11001465dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001466AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001467 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001468 arc4random_buf \
1469 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001470 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001471 b64_ntop \
1472 __b64_ntop \
1473 b64_pton \
1474 __b64_pton \
1475 bcopy \
1476 bindresvport_sa \
1477 clock \
1478 closefrom \
1479 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001480 fchmod \
1481 fchown \
1482 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001483 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001484 futimes \
1485 getaddrinfo \
1486 getcwd \
1487 getgrouplist \
1488 getnameinfo \
1489 getopt \
1490 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001491 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001492 _getpty \
1493 getrlimit \
1494 getttyent \
1495 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001496 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001497 inet_aton \
1498 inet_ntoa \
1499 inet_ntop \
1500 innetgr \
1501 login_getcapbool \
1502 md5_crypt \
1503 memmove \
1504 mkdtemp \
1505 mmap \
1506 ngetaddrinfo \
1507 nsleep \
1508 ogetaddrinfo \
1509 openlog_r \
1510 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001511 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001512 prctl \
1513 pstat \
1514 readpassphrase \
1515 realpath \
1516 recvmsg \
1517 rresvport_af \
1518 sendmsg \
1519 setdtablesize \
1520 setegid \
1521 setenv \
1522 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001523 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001524 setgroups \
1525 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001526 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001527 setpcred \
1528 setproctitle \
1529 setregid \
1530 setreuid \
1531 setrlimit \
1532 setsid \
1533 setvbuf \
1534 sigaction \
1535 sigvec \
1536 snprintf \
1537 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001538 statfs \
1539 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001540 strdup \
1541 strerror \
1542 strlcat \
1543 strlcpy \
1544 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001545 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001546 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001547 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001548 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001549 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001550 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001551 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001552 sysconf \
1553 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001554 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001555 truncate \
1556 unsetenv \
1557 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001558 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001559 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001560 vhangup \
1561 vsnprintf \
1562 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001563])
Tim Rice13aae5e2001-10-21 17:53:58 -07001564
Tim Ricec7a8af02010-11-08 14:26:23 -08001565AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001566 [AC_LANG_PROGRAM(
1567 [[ #include <ctype.h> ]],
1568 [[ return (isblank('a')); ]])],
1569 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001570])
1571
Damien Millerb3c9f782010-02-12 10:11:34 +11001572# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001573AC_SEARCH_LIBS([dlopen], [dl],
1574 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001575)
1576
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001577# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001578AC_CHECK_FUNCS([gai_strerror], [
1579 AC_DEFINE([HAVE_GAI_STRERROR])
1580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001581#include <sys/types.h>
1582#include <sys/socket.h>
1583#include <netdb.h>
1584
Tim Rice648f8762011-01-26 12:38:57 -08001585const char *gai_strerror(int);
1586 ]], [[
1587 char *str;
1588 str = gai_strerror(0);
1589 ]])], [
1590 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1591 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001592
Tim Rice648f8762011-01-26 12:38:57 -08001593AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1594 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001595
Darren Tuckerf1159b52003-07-07 19:44:01 +10001596dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001597AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1598AC_CHECK_DECL([strsep],
1599 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001600 [],
1601 [
1602#ifdef HAVE_STRING_H
1603# include <string.h>
1604#endif
1605 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001606
Darren Tuckerb2427c82003-09-10 15:22:44 +10001607dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001608AC_CHECK_DECL([tcsendbreak],
1609 [AC_DEFINE([HAVE_TCSENDBREAK])],
1610 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001611 [#include <termios.h>]
1612)
1613
Tim Rice648f8762011-01-26 12:38:57 -08001614AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001615
Tim Rice648f8762011-01-26 12:38:57 -08001616AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001617 [
1618#include <sys/types.h>
1619#include <sys/socket.h>
1620 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001621
Tim Rice648f8762011-01-26 12:38:57 -08001622AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001623 [
1624#include <sys/types.h>
1625#ifdef HAVE_SYS_STAT_H
1626# include <sys/stat.h>
1627#endif
1628#ifdef HAVE_FCNTL_H
1629# include <fcntl.h>
1630#endif
1631 ])
1632
Tim Rice648f8762011-01-26 12:38:57 -08001633AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001634#include <sys/types.h>
1635#include <sys/uio.h>
1636#include <unistd.h>
1637 ])
1638
Tim Rice648f8762011-01-26 12:38:57 -08001639AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001640#include <sys/param.h>
1641 ])
1642
Tim Rice648f8762011-01-26 12:38:57 -08001643AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001644#include <stddef.h>
1645 ])
1646
Tim Rice648f8762011-01-26 12:38:57 -08001647AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001648 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001649 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001650 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001651 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001652#include <stdlib.h>
1653#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001654 ]], [[
1655 errno=0;
1656 setresuid(0,0,0);
1657 if (errno==ENOSYS)
1658 exit(1);
1659 else
1660 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001661 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001662 [AC_MSG_RESULT([yes])],
1663 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001664 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001665 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001666 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001667 )
1668])
Darren Tuckere937be32003-12-17 18:53:26 +11001669
Tim Rice648f8762011-01-26 12:38:57 -08001670AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001671 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001672 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001673 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001674 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001675#include <stdlib.h>
1676#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001677 ]], [[
1678 errno=0;
1679 setresgid(0,0,0);
1680 if (errno==ENOSYS)
1681 exit(1);
1682 else
1683 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001684 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001685 [AC_MSG_RESULT([yes])],
1686 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001687 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001688 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001689 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001690 )
1691])
Darren Tuckere937be32003-12-17 18:53:26 +11001692
Damien Millerad833b32000-08-23 10:46:23 +10001693dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001694AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001695dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001696AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1697AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001698dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001699AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1700AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001701dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001702AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001703
Tim Rice648f8762011-01-26 12:38:57 -08001704AC_CHECK_FUNC([daemon],
1705 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1706 [AC_CHECK_LIB([bsd], [daemon],
1707 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001708)
1709
Tim Rice648f8762011-01-26 12:38:57 -08001710AC_CHECK_FUNC([getpagesize],
1711 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001712 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001713 [AC_CHECK_LIB([ucb], [getpagesize],
1714 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001715)
1716
Damien Millercb170cb2000-07-01 16:52:55 +10001717# Check for broken snprintf
1718if test "x$ac_cv_func_snprintf" = "xyes" ; then
1719 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001720 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001721 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1722 [[
1723 char b[5];
1724 snprintf(b,5,"123456789");
1725 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001726 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001727 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001728 [
Tim Rice648f8762011-01-26 12:38:57 -08001729 AC_MSG_RESULT([no])
1730 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001731 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001732 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001733 ],
1734 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001735 )
1736fi
1737
Damien Miller57f39152005-11-24 19:58:19 +11001738# If we don't have a working asprintf, then we strongly depend on vsnprintf
1739# returning the right thing on overflow: the number of characters it tried to
1740# create (as per SUSv3)
1741if test "x$ac_cv_func_asprintf" != "xyes" && \
1742 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1743 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1744 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001745 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001746#include <sys/types.h>
1747#include <stdio.h>
1748#include <stdarg.h>
1749
1750int x_snprintf(char *str,size_t count,const char *fmt,...)
1751{
1752 size_t ret; va_list ap;
1753 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1754 return ret;
1755}
Tim Rice648f8762011-01-26 12:38:57 -08001756 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001757 char x[1];
1758 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001759 ]])],
1760 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001761 [
Tim Rice648f8762011-01-26 12:38:57 -08001762 AC_MSG_RESULT([no])
1763 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001764 [Define if your snprintf is busted])
1765 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1766 ],
1767 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1768 )
1769fi
1770
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001771# On systems where [v]snprintf is broken, but is declared in stdio,
1772# check that the fmt argument is const char * or just char *.
1773# This is only useful for when BROKEN_SNPRINTF
1774AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001775AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1776#include <stdio.h>
1777int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1778 ]], [[
1779 snprintf(0, 0, 0);
1780 ]])],
1781 [AC_MSG_RESULT([yes])
1782 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001783 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001784 [AC_MSG_RESULT([no])
1785 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001786
Damien Millerb4097182004-05-23 14:09:40 +10001787# Check for missing getpeereid (or equiv) support
1788NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001789if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001790 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1792#include <sys/types.h>
1793#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1794 [ AC_MSG_RESULT([yes])
1795 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1796 ], [AC_MSG_RESULT([no])
1797 NO_PEERCHECK=1
1798 ])
Damien Millerb4097182004-05-23 14:09:40 +10001799fi
1800
Damien Millere8328192003-01-07 15:18:32 +11001801dnl see whether mkstemp() requires XXXXXX
1802if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1803AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001804AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001805 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001806#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001807 ]], [[
1808 char template[]="conftest.mkstemp-test";
1809 if (mkstemp(template) == -1)
1810 exit(1);
1811 unlink(template);
1812 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001813 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001814 [
Tim Rice648f8762011-01-26 12:38:57 -08001815 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001816 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001817 [
Tim Rice648f8762011-01-26 12:38:57 -08001818 AC_MSG_RESULT([yes])
1819 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001820 ],
1821 [
Tim Rice648f8762011-01-26 12:38:57 -08001822 AC_MSG_RESULT([yes])
1823 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001824 ]
Damien Millere8328192003-01-07 15:18:32 +11001825)
1826fi
1827
Darren Tucker70a3d552003-08-21 17:58:29 +10001828dnl make sure that openpty does not reacquire controlling terminal
1829if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001830 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001831 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001832 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001833#include <stdio.h>
1834#include <sys/fcntl.h>
1835#include <sys/types.h>
1836#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001837 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001838 pid_t pid;
1839 int fd, ptyfd, ttyfd, status;
1840
1841 pid = fork();
1842 if (pid < 0) { /* failed */
1843 exit(1);
1844 } else if (pid > 0) { /* parent */
1845 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001846 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001847 exit(WEXITSTATUS(status));
1848 else
1849 exit(2);
1850 } else { /* child */
1851 close(0); close(1); close(2);
1852 setsid();
1853 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1854 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1855 if (fd >= 0)
1856 exit(3); /* Acquired ctty: broken */
1857 else
1858 exit(0); /* Did not acquire ctty: OK */
1859 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001860 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001861 [
Tim Rice648f8762011-01-26 12:38:57 -08001862 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001863 ],
1864 [
Tim Rice648f8762011-01-26 12:38:57 -08001865 AC_MSG_RESULT([no])
1866 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001867 ],
1868 [
Tim Rice648f8762011-01-26 12:38:57 -08001869 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001870 ]
1871 )
1872fi
1873
Tim Rice8bb561b2005-03-17 16:23:19 -08001874if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1875 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001876 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001877 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001878 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001879#include <stdio.h>
1880#include <sys/socket.h>
1881#include <netdb.h>
1882#include <errno.h>
1883#include <netinet/in.h>
1884
1885#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001886 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001887 int err, sock;
1888 struct addrinfo *gai_ai, *ai, hints;
1889 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1890
1891 memset(&hints, 0, sizeof(hints));
1892 hints.ai_family = PF_UNSPEC;
1893 hints.ai_socktype = SOCK_STREAM;
1894 hints.ai_flags = AI_PASSIVE;
1895
1896 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1897 if (err != 0) {
1898 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1899 exit(1);
1900 }
1901
1902 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1903 if (ai->ai_family != AF_INET6)
1904 continue;
1905
1906 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1907 sizeof(ntop), strport, sizeof(strport),
1908 NI_NUMERICHOST|NI_NUMERICSERV);
1909
1910 if (err != 0) {
1911 if (err == EAI_SYSTEM)
1912 perror("getnameinfo EAI_SYSTEM");
1913 else
1914 fprintf(stderr, "getnameinfo failed: %s\n",
1915 gai_strerror(err));
1916 exit(2);
1917 }
1918
1919 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1920 if (sock < 0)
1921 perror("socket");
1922 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1923 if (errno == EBADF)
1924 exit(3);
1925 }
1926 }
1927 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001928 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001929 [
Tim Rice648f8762011-01-26 12:38:57 -08001930 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001931 ],
1932 [
Tim Rice648f8762011-01-26 12:38:57 -08001933 AC_MSG_RESULT([no])
1934 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001935 ],
1936 [
Tim Rice648f8762011-01-26 12:38:57 -08001937 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001938 ]
1939 )
1940fi
1941
Tim Rice8bb561b2005-03-17 16:23:19 -08001942if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1943 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001944 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001945 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001946 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11001947#include <stdio.h>
1948#include <sys/socket.h>
1949#include <netdb.h>
1950#include <errno.h>
1951#include <netinet/in.h>
1952
1953#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001954 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11001955 int err, sock;
1956 struct addrinfo *gai_ai, *ai, hints;
1957 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1958
1959 memset(&hints, 0, sizeof(hints));
1960 hints.ai_family = PF_UNSPEC;
1961 hints.ai_socktype = SOCK_STREAM;
1962 hints.ai_flags = AI_PASSIVE;
1963
1964 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1965 if (err != 0) {
1966 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1967 exit(1);
1968 }
1969
1970 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1971 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1972 continue;
1973
1974 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1975 sizeof(ntop), strport, sizeof(strport),
1976 NI_NUMERICHOST|NI_NUMERICSERV);
1977
1978 if (ai->ai_family == AF_INET && err != 0) {
1979 perror("getnameinfo");
1980 exit(2);
1981 }
1982 }
1983 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001984 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001985 [
Tim Rice648f8762011-01-26 12:38:57 -08001986 AC_MSG_RESULT([yes])
1987 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001988 [Define if you have a getaddrinfo that fails
1989 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001990 ],
1991 [
Tim Rice648f8762011-01-26 12:38:57 -08001992 AC_MSG_RESULT([no])
1993 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001994 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001995 [
Tim Rice648f8762011-01-26 12:38:57 -08001996 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11001997 ]
1998 )
1999fi
2000
Darren Tuckera56f1912004-11-02 20:30:54 +11002001if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002002 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2003 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2004 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002005 [
Tim Rice648f8762011-01-26 12:38:57 -08002006 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002007 ],
2008 [
Tim Rice648f8762011-01-26 12:38:57 -08002009 AC_MSG_RESULT([yes])
2010 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002011 [Conflicting defs for getspnam])
2012 ]
2013 )
2014fi
2015
Damien Miller606f8802000-09-16 15:39:56 +11002016AC_FUNC_GETPGRP
2017
Tim Riceaef73712002-05-11 13:17:42 -07002018# Search for OpenSSL
2019saved_CPPFLAGS="$CPPFLAGS"
2020saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002021AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002022 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2023 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002024 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002025 case "$withval" in
2026 # Relative paths
2027 ./*|../*) withval="`pwd`/$withval"
2028 esac
Tim Riceaef73712002-05-11 13:17:42 -07002029 if test -d "$withval/lib"; then
2030 if test -n "${need_dash_r}"; then
2031 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2032 else
2033 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2034 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002035 elif test -d "$withval/lib64"; then
2036 if test -n "${need_dash_r}"; then
2037 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2038 else
2039 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2040 fi
Tim Riceaef73712002-05-11 13:17:42 -07002041 else
2042 if test -n "${need_dash_r}"; then
2043 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2044 else
2045 LDFLAGS="-L${withval} ${LDFLAGS}"
2046 fi
2047 fi
2048 if test -d "$withval/include"; then
2049 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2050 else
2051 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2052 fi
Damien Millera22ba012000-03-02 23:09:20 +11002053 fi
2054 ]
2055)
Tim Rice3d5352e2004-02-12 09:27:21 -08002056LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002057AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002058 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002059 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002060 [
Tim Riceaef73712002-05-11 13:17:42 -07002061 dnl Check default openssl install dir
2062 if test -n "${need_dash_r}"; then
2063 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002064 else
Tim Riceaef73712002-05-11 13:17:42 -07002065 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002066 fi
Tim Riceaef73712002-05-11 13:17:42 -07002067 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002068 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002069 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2070 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002071 [
2072 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2073 ]
2074 )
2075 ]
2076)
2077
Tim Riced730b782002-08-13 18:52:10 -07002078# Determine OpenSSL header version
2079AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002080AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002081 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002082#include <stdio.h>
2083#include <string.h>
2084#include <openssl/opensslv.h>
2085#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002086 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002087 FILE *fd;
2088 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002089
Damien Millera8e06ce2003-11-21 23:48:55 +11002090 fd = fopen(DATA,"w");
2091 if(fd == NULL)
2092 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002093
2094 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2095 exit(1);
2096
2097 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002098 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002099 [
2100 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002101 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002102 ],
2103 [
Tim Rice648f8762011-01-26 12:38:57 -08002104 AC_MSG_RESULT([not found])
2105 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002106 ],
2107 [
2108 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002109 ]
2110)
2111
2112# Determine OpenSSL library version
2113AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002114AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002115 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002116#include <stdio.h>
2117#include <string.h>
2118#include <openssl/opensslv.h>
2119#include <openssl/crypto.h>
2120#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002121 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002122 FILE *fd;
2123 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002124
Damien Millera8e06ce2003-11-21 23:48:55 +11002125 fd = fopen(DATA,"w");
2126 if(fd == NULL)
2127 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002128
2129 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2130 exit(1);
2131
2132 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002133 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002134 [
2135 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002136 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002137 ],
2138 [
Tim Rice648f8762011-01-26 12:38:57 -08002139 AC_MSG_RESULT([not found])
2140 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002141 ],
2142 [
2143 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002144 ]
2145)
Damien Millera22ba012000-03-02 23:09:20 +11002146
Tim Rice648f8762011-01-26 12:38:57 -08002147AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002148 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2149 [ if test "x$withval" = "xno" ; then
2150 openssl_check_nonfatal=1
2151 fi
2152 ]
2153)
2154
Damien Millerec932372002-01-22 22:16:03 +11002155# Sanity check OpenSSL headers
2156AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002157AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002158 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002159#include <string.h>
2160#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002161 ]], [[
2162 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002163 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002164 [
Tim Rice648f8762011-01-26 12:38:57 -08002165 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002166 ],
2167 [
Tim Rice648f8762011-01-26 12:38:57 -08002168 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002169 if test "x$openssl_check_nonfatal" = "x"; then
2170 AC_MSG_ERROR([Your OpenSSL headers do not match your
2171library. Check config.log for details.
2172If you are sure your installation is consistent, you can disable the check
2173by running "./configure --without-openssl-header-check".
2174Also see contrib/findssl.sh for help identifying header/library mismatches.
2175])
2176 else
2177 AC_MSG_WARN([Your OpenSSL headers do not match your
2178library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002179Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002180 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002181 ],
2182 [
2183 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002184 ]
2185)
2186
Darren Tucker639bbe82006-08-20 20:17:53 +10002187AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2188AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002189 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2190 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002191 [
Tim Rice648f8762011-01-26 12:38:57 -08002192 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002193 ],
2194 [
Tim Rice648f8762011-01-26 12:38:57 -08002195 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002196 saved_LIBS="$LIBS"
2197 LIBS="$LIBS -ldl"
2198 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2199 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002200 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2201 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002202 [
Tim Rice648f8762011-01-26 12:38:57 -08002203 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002204 ],
2205 [
Tim Rice648f8762011-01-26 12:38:57 -08002206 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002207 LIBS="$saved_LIBS"
2208 ]
2209 )
2210 ]
2211)
2212
Darren Tuckere9b3ad72012-01-17 14:03:34 +11002213AC_CHECK_FUNCS([RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex RSA_get_default_method HMAC_CTX_init])
Darren Tuckerebdef762010-12-04 23:20:50 +11002214
Tim Rice648f8762011-01-26 12:38:57 -08002215AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002216 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2217 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002218 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2220#include <openssl/engine.h>
2221 ]], [[
2222 ENGINE_load_builtin_engines();
2223 ENGINE_register_all_complete();
2224 ]])],
2225 [ AC_MSG_RESULT([yes])
2226 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002227 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002228 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2229 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002230 fi ]
2231)
2232
Darren Tucker129d0bb2005-12-19 17:40:40 +11002233# Check for OpenSSL without EVP_aes_{192,256}_cbc
2234AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002235AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002236 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002237#include <string.h>
2238#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002239 ]], [[
2240 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002241 ]])],
2242 [
Tim Rice648f8762011-01-26 12:38:57 -08002243 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002244 ],
2245 [
Tim Rice648f8762011-01-26 12:38:57 -08002246 AC_MSG_RESULT([yes])
2247 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002248 [libcrypto is missing AES 192 and 256 bit functions])
2249 ]
2250)
2251
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002252AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2253AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002254 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002255#include <string.h>
2256#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002257 ]], [[
2258 if(EVP_DigestUpdate(NULL, NULL,0))
2259 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002260 ]])],
2261 [
Tim Rice648f8762011-01-26 12:38:57 -08002262 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002263 ],
2264 [
Tim Rice648f8762011-01-26 12:38:57 -08002265 AC_MSG_RESULT([no])
2266 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002267 [Define if EVP_DigestUpdate returns void])
2268 ]
2269)
2270
Tim Rice3d5352e2004-02-12 09:27:21 -08002271# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2272# because the system crypt() is more featureful.
2273if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002274 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002275fi
2276
Damien Millera8e06ce2003-11-21 23:48:55 +11002277# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002278# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002279if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002280 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002281fi
2282
Damien Milleraf87af12006-03-15 13:02:28 +11002283# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002284AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002285 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002286AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002287
Damien Miller6af914a2010-09-10 11:39:26 +10002288# Check complete ECC support in OpenSSL
2289AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2290AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002291 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002292#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002293#include <openssl/ecdh.h>
2294#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002295#include <openssl/evp.h>
2296#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002297#include <openssl/opensslv.h>
2298#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2299# error "OpenSSL < 0.9.8g has unreliable ECC code"
2300#endif
Tim Rice648f8762011-01-26 12:38:57 -08002301 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002302 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2303 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002304 ]])],
2305 [
Tim Rice648f8762011-01-26 12:38:57 -08002306 AC_MSG_RESULT([yes])
2307 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002308 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002309 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002310 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002311 ],
2312 [
Tim Rice648f8762011-01-26 12:38:57 -08002313 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002314 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002315 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002316 ]
2317)
Tim Rice648f8762011-01-26 12:38:57 -08002318AC_SUBST([TEST_SSH_ECC])
2319AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002320
Tim Rice99203ec2007-03-26 09:35:28 -07002321saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002322AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002323 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002324 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2325 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002326 [Define if system has libiaf that supports set_id])
2327 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002328])
2329LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002330
2331### Configure cryptographic random number support
2332
2333# Check wheter OpenSSL seeds itself
2334AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002335AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002336 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002337#include <string.h>
2338#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002339 ]], [[
2340 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002341 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002342 [
2343 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002344 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002345 ],
2346 [
Tim Rice648f8762011-01-26 12:38:57 -08002347 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002348 ],
2349 [
2350 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002351 # This is safe, since we will fatal() at runtime if
2352 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002353 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002354 ]
2355)
2356
Damien Millerf22019b2011-05-05 13:48:37 +10002357# PRNGD TCP socket
2358AC_ARG_WITH([prngd-port],
2359 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2360 [
2361 case "$withval" in
2362 no)
2363 withval=""
2364 ;;
2365 [[0-9]]*)
2366 ;;
2367 *)
2368 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2369 ;;
2370 esac
2371 if test ! -z "$withval" ; then
2372 PRNGD_PORT="$withval"
2373 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2374 [Port number of PRNGD/EGD random number socket])
2375 fi
2376 ]
2377)
2378
2379# PRNGD Unix domain socket
2380AC_ARG_WITH([prngd-socket],
2381 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2382 [
2383 case "$withval" in
2384 yes)
2385 withval="/var/run/egd-pool"
2386 ;;
2387 no)
2388 withval=""
2389 ;;
2390 /*)
2391 ;;
2392 *)
2393 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2394 ;;
2395 esac
2396
2397 if test ! -z "$withval" ; then
2398 if test ! -z "$PRNGD_PORT" ; then
2399 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2400 fi
2401 if test ! -r "$withval" ; then
2402 AC_MSG_WARN([Entropy socket is not readable])
2403 fi
2404 PRNGD_SOCKET="$withval"
2405 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2406 [Location of PRNGD/EGD random number socket])
2407 fi
2408 ],
2409 [
2410 # Check for existing socket only if we don't have a random device already
2411 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2412 AC_MSG_CHECKING([for PRNGD/EGD socket])
2413 # Insert other locations here
2414 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2415 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2416 PRNGD_SOCKET="$sock"
2417 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2418 break;
2419 fi
2420 done
2421 if test ! -z "$PRNGD_SOCKET" ; then
2422 AC_MSG_RESULT([$PRNGD_SOCKET])
2423 else
2424 AC_MSG_RESULT([not found])
2425 fi
2426 fi
2427 ]
2428)
2429
2430# Which randomness source do we use?
2431if test ! -z "$PRNGD_PORT" ; then
2432 RAND_MSG="PRNGd port $PRNGD_PORT"
2433elif test ! -z "$PRNGD_SOCKET" ; then
2434 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2435elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2436 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2437 [Define if you want OpenSSL's internally seeded PRNG only])
2438 RAND_MSG="OpenSSL internal ONLY"
2439else
2440 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])
2441fi
2442
Darren Tucker3e6bde42006-08-20 20:03:50 +10002443# Check for PAM libs
2444PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002445AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002446 [ --with-pam Enable PAM support ],
2447 [
2448 if test "x$withval" != "xno" ; then
2449 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2450 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2451 AC_MSG_ERROR([PAM headers not found])
2452 fi
2453
2454 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002455 AC_CHECK_LIB([dl], [dlopen], , )
2456 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2457 AC_CHECK_FUNCS([pam_getenvlist])
2458 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002459 LIBS="$saved_LIBS"
2460
2461 PAM_MSG="yes"
2462
Darren Tucker20e9f972007-03-25 18:26:01 +10002463 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002464 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002465 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002466
Darren Tucker3e6bde42006-08-20 20:03:50 +10002467 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002468 case "$LIBS" in
2469 *-ldl*)
2470 # libdl already in LIBS
2471 ;;
2472 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002473 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002474 ;;
2475 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002476 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002477 fi
2478 ]
2479)
2480
2481# Check for older PAM
2482if test "x$PAM_MSG" = "xyes" ; then
2483 # Check PAM strerror arguments (old PAM)
2484 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002485 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002486#include <stdlib.h>
2487#if defined(HAVE_SECURITY_PAM_APPL_H)
2488#include <security/pam_appl.h>
2489#elif defined (HAVE_PAM_PAM_APPL_H)
2490#include <pam/pam_appl.h>
2491#endif
Tim Rice648f8762011-01-26 12:38:57 -08002492 ]], [[
2493(void)pam_strerror((pam_handle_t *)NULL, -1);
2494 ]])], [AC_MSG_RESULT([no])], [
2495 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002496 [Define if you have an old version of PAM
2497 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002498 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002499 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002500
2501 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002502fi
Damien Miller6c21c512002-01-22 21:57:53 +11002503
Damien Millerd3f6ad22002-06-25 10:24:47 +10002504SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002505AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002506 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002507 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002508 if test -n "$withval" && test "x$withval" != "xno" && \
2509 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002510 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002511 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002512 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002513)
Tim Rice648f8762011-01-26 12:38:57 -08002514AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002515 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002516AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002517
Damien Miller69ff1df2011-06-23 08:30:03 +10002518# Decide which sandbox style to use
2519sandbox_arg=""
2520AC_ARG_WITH([sandbox],
Damien Miller1a91c0f2011-08-17 11:59:25 +10002521 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002522 [
2523 if test "x$withval" = "xyes" ; then
2524 sandbox_arg=""
2525 else
2526 sandbox_arg="$withval"
2527 fi
2528 ]
2529)
2530if test "x$sandbox_arg" = "xsystrace" || \
2531 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002532 test "x$have_systr_policy_kill" != "x1" && \
2533 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002534 SANDBOX_STYLE="systrace"
2535 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002536elif test "x$sandbox_arg" = "xdarwin" || \
2537 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2538 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002539 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2540 "x$ac_cv_header_sandbox_h" != "xyes" && \
2541 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002542 SANDBOX_STYLE="darwin"
2543 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Miller69ff1df2011-06-23 08:30:03 +10002544elif test "x$sandbox_arg" = "xrlimit" || \
2545 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002546 test "x$ac_cv_func_setrlimit" != "xyes" && \
2547 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Damien Miller69ff1df2011-06-23 08:30:03 +10002548 SANDBOX_STYLE="rlimit"
2549 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
2550elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2551 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2552 SANDBOX_STYLE="none"
2553 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2554else
Tim Ricea6e60612011-08-17 21:48:22 -07002555 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10002556fi
2557
Ben Lindstromb5628642000-10-18 00:02:25 +00002558# Cheap hack to ensure NEWS-OS libraries are arranged right.
2559if test ! -z "$SONY" ; then
2560 LIBS="$LIBS -liberty";
2561fi
2562
Damien Miller57f39152005-11-24 19:58:19 +11002563# Check for long long datatypes
2564AC_CHECK_TYPES([long long, unsigned long long, long double])
2565
2566# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002567AC_CHECK_SIZEOF([short int], [2])
2568AC_CHECK_SIZEOF([int], [4])
2569AC_CHECK_SIZEOF([long int], [4])
2570AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002571
Damien Millerfa2bb692002-04-23 23:22:25 +10002572# Sanity check long long for some platforms (AIX)
2573if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2574 ac_cv_sizeof_long_long_int=0
2575fi
2576
Darren Tucker537f1ed2005-10-25 18:38:33 +10002577# compute LLONG_MIN and LLONG_MAX if we don't know them.
2578if test -z "$have_llong_max"; then
2579 AC_MSG_CHECKING([for max value of long long])
2580 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002581 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002582#include <stdio.h>
2583/* Why is this so damn hard? */
2584#ifdef __GNUC__
2585# undef __GNUC__
2586#endif
2587#define __USE_ISOC99
2588#include <limits.h>
2589#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002590#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2591
2592/*
2593 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2594 * we do this the hard way.
2595 */
2596static int
2597fprint_ll(FILE *f, long long n)
2598{
2599 unsigned int i;
2600 int l[sizeof(long long) * 8];
2601
2602 if (n < 0)
2603 if (fprintf(f, "-") < 0)
2604 return -1;
2605 for (i = 0; n != 0; i++) {
2606 l[i] = my_abs(n % 10);
2607 n /= 10;
2608 }
2609 do {
2610 if (fprintf(f, "%d", l[--i]) < 0)
2611 return -1;
2612 } while (i != 0);
2613 if (fprintf(f, " ") < 0)
2614 return -1;
2615 return 0;
2616}
Tim Rice648f8762011-01-26 12:38:57 -08002617 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002618 FILE *f;
2619 long long i, llmin, llmax = 0;
2620
2621 if((f = fopen(DATA,"w")) == NULL)
2622 exit(1);
2623
2624#if defined(LLONG_MIN) && defined(LLONG_MAX)
2625 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2626 llmin = LLONG_MIN;
2627 llmax = LLONG_MAX;
2628#else
2629 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2630 /* This will work on one's complement and two's complement */
2631 for (i = 1; i > llmax; i <<= 1, i++)
2632 llmax = i;
2633 llmin = llmax + 1LL; /* wrap */
2634#endif
2635
2636 /* Sanity check */
2637 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002638 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2639 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002640 fprintf(f, "unknown unknown\n");
2641 exit(2);
2642 }
2643
Darren Tuckerd1450db2006-03-13 19:06:51 +11002644 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002645 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002646 if (fprint_ll(f, llmax) < 0)
2647 exit(4);
2648 if (fclose(f) < 0)
2649 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002650 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002651 ]])],
2652 [
2653 llong_min=`$AWK '{print $1}' conftest.llminmax`
2654 llong_max=`$AWK '{print $2}' conftest.llminmax`
2655
Tim Rice648f8762011-01-26 12:38:57 -08002656 AC_MSG_RESULT([$llong_max])
2657 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002658 [max value of long long calculated by configure])
2659 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002660 AC_MSG_RESULT([$llong_min])
2661 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002662 [min value of long long calculated by configure])
2663 ],
2664 [
Tim Rice648f8762011-01-26 12:38:57 -08002665 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002666 ],
2667 [
2668 AC_MSG_WARN([cross compiling: not checking])
2669 ]
2670 )
2671fi
2672
2673
Damien Millera22ba012000-03-02 23:09:20 +11002674# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002675AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002676 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2677 [[ u_int a; a = 1;]])],
2678 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2679 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002680])
2681if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002682 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002683 have_u_int=1
2684fi
2685
Damien Miller61e50f12000-05-08 20:49:37 +10002686AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002687 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2688 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2689 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2690 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002691])
2692if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002693 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002694 have_intxx_t=1
2695fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002696
2697if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002698 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002699then
2700 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2702 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002703 [
Tim Rice648f8762011-01-26 12:38:57 -08002704 AC_DEFINE([HAVE_INTXX_T])
2705 AC_MSG_RESULT([yes])
2706 ], [ AC_MSG_RESULT([no])
2707 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002708fi
2709
Damien Miller578783e2000-09-23 14:12:24 +11002710AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002711 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002712#include <sys/types.h>
2713#ifdef HAVE_STDINT_H
2714# include <stdint.h>
2715#endif
2716#include <sys/socket.h>
2717#ifdef HAVE_SYS_BITYPES_H
2718# include <sys/bitypes.h>
2719#endif
Tim Rice648f8762011-01-26 12:38:57 -08002720 ]], [[
2721int64_t a; a = 1;
2722 ]])],
2723 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2724 ])
Damien Miller578783e2000-09-23 14:12:24 +11002725])
2726if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002727 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002728fi
2729
Damien Miller61e50f12000-05-08 20:49:37 +10002730AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002731 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2732 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2733 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2734 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002735])
2736if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002737 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002738 have_u_intxx_t=1
2739fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002740
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002741if test -z "$have_u_intxx_t" ; then
2742 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002743 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2744 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002745 [
Tim Rice648f8762011-01-26 12:38:57 -08002746 AC_DEFINE([HAVE_U_INTXX_T])
2747 AC_MSG_RESULT([yes])
2748 ], [ AC_MSG_RESULT([no])
2749 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002750fi
2751
Damien Miller578783e2000-09-23 14:12:24 +11002752AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002753 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2754 [[ u_int64_t a; a = 1;]])],
2755 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2756 ])
Damien Miller578783e2000-09-23 14:12:24 +11002757])
2758if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002759 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002760 have_u_int64_t=1
2761fi
2762
Tim Rice4cec93f2002-02-26 08:40:48 -08002763if test -z "$have_u_int64_t" ; then
2764 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002765 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2766 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002767 [
Tim Rice648f8762011-01-26 12:38:57 -08002768 AC_DEFINE([HAVE_U_INT64_T])
2769 AC_MSG_RESULT([yes])
2770 ], [ AC_MSG_RESULT([no])
2771 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002772fi
2773
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002774if test -z "$have_u_intxx_t" ; then
2775 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002776 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002777#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002778 ]], [[
2779 uint8_t a;
2780 uint16_t b;
2781 uint32_t c;
2782 a = b = c = 1;
2783 ]])],
2784 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2785 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002786 ])
2787 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002788 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002789 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002790 fi
2791fi
2792
2793if test -z "$have_uintxx_t" ; then
2794 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002795 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2796 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002797 [
Tim Rice648f8762011-01-26 12:38:57 -08002798 AC_DEFINE([HAVE_UINTXX_T])
2799 AC_MSG_RESULT([yes])
2800 ], [ AC_MSG_RESULT([no])
2801 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002802fi
2803
Damien Milleredb82922000-06-20 13:25:52 +10002804if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002805 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002806then
2807 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002808 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002809#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002810 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002811 int8_t a; int16_t b; int32_t c;
2812 u_int8_t e; u_int16_t f; u_int32_t g;
2813 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002814 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002815 [
Tim Rice648f8762011-01-26 12:38:57 -08002816 AC_DEFINE([HAVE_U_INTXX_T])
2817 AC_DEFINE([HAVE_INTXX_T])
2818 AC_MSG_RESULT([yes])
2819 ], [AC_MSG_RESULT([no])
2820 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002821fi
2822
Damien Miller58be7382001-09-15 21:31:54 +10002823
2824AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002825 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2826 [[ u_char foo; foo = 125; ]])],
2827 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2828 ])
Damien Miller58be7382001-09-15 21:31:54 +10002829])
2830if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002831 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002832fi
2833
Tim Rice13aae5e2001-10-21 17:53:58 -07002834TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002835
Tim Rice648f8762011-01-26 12:38:57 -08002836AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2837AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002838#include <sys/types.h>
2839#ifdef HAVE_SYS_BITYPES_H
2840#include <sys/bitypes.h>
2841#endif
2842#ifdef HAVE_SYS_STATFS_H
2843#include <sys/statfs.h>
2844#endif
2845#ifdef HAVE_SYS_STATVFS_H
2846#include <sys/statvfs.h>
2847#endif
2848])
Tim Rice4cec93f2002-02-26 08:40:48 -08002849
Tim Rice648f8762011-01-26 12:38:57 -08002850AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002851[#include <sys/types.h>
2852#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002853
Damien Miller61e50f12000-05-08 20:49:37 +10002854AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002855 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2856 [[ size_t foo; foo = 1235; ]])],
2857 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2858 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002859])
2860if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002861 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002862fi
Damien Miller95058511999-12-29 10:36:45 +11002863
Damien Miller615f9392000-05-17 22:53:33 +10002864AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002865 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2866 [[ ssize_t foo; foo = 1235; ]])],
2867 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2868 ])
Damien Miller615f9392000-05-17 22:53:33 +10002869])
2870if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002871 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002872fi
2873
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002874AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002875 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2876 [[ clock_t foo; foo = 1235; ]])],
2877 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2878 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002879])
2880if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002881 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002882fi
2883
Damien Millerb54b40e2000-06-23 08:23:34 +10002884AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002886#include <sys/types.h>
2887#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002888 ]], [[ sa_family_t foo; foo = 1235; ]])],
2889 [ ac_cv_have_sa_family_t="yes" ],
2890 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002891#include <sys/types.h>
2892#include <sys/socket.h>
2893#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002894 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002895 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002896 [ ac_cv_have_sa_family_t="no" ]
2897 )
Tim Rice648f8762011-01-26 12:38:57 -08002898 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002899])
2900if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002901 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002902 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002903fi
2904
Damien Miller0f91b4e2000-06-18 15:43:25 +10002905AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002906 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2907 [[ pid_t foo; foo = 1235; ]])],
2908 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2909 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002910])
2911if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002912 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002913fi
2914
2915AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002916 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2917 [[ mode_t foo; foo = 1235; ]])],
2918 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2919 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002920])
2921if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002922 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002923fi
2924
Damien Miller61e50f12000-05-08 20:49:37 +10002925
2926AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002927 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002928#include <sys/types.h>
2929#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002930 ]], [[ struct sockaddr_storage s; ]])],
2931 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2932 [ ac_cv_have_struct_sockaddr_storage="no"
2933 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002934])
2935if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002936 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002937 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002938fi
Damien Miller34132e52000-01-14 15:45:46 +11002939
Damien Miller61e50f12000-05-08 20:49:37 +10002940AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002941 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002942#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002943#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002944 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2945 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2946 [ ac_cv_have_struct_sockaddr_in6="no"
2947 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002948])
2949if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002950 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002951 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002952fi
Damien Miller34132e52000-01-14 15:45:46 +11002953
Damien Miller61e50f12000-05-08 20:49:37 +10002954AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002955 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002956#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002957#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002958 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2959 [ ac_cv_have_struct_in6_addr="yes" ],
2960 [ ac_cv_have_struct_in6_addr="no"
2961 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002962])
2963if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002964 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002965 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002966
2967dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002968 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002969 [
2970#ifdef HAVE_SYS_TYPES_H
2971#include <sys/types.h>
2972#endif
2973#include <netinet/in.h>
2974 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002975fi
Damien Miller34132e52000-01-14 15:45:46 +11002976
Damien Miller61e50f12000-05-08 20:49:37 +10002977AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002978 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002979#include <sys/types.h>
2980#include <sys/socket.h>
2981#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002982 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2983 [ ac_cv_have_struct_addrinfo="yes" ],
2984 [ ac_cv_have_struct_addrinfo="no"
2985 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002986])
2987if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002988 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002989 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002990fi
2991
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002992AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002993 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2994 [[ struct timeval tv; tv.tv_sec = 1;]])],
2995 [ ac_cv_have_struct_timeval="yes" ],
2996 [ ac_cv_have_struct_timeval="no"
2997 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002998])
2999if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003000 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003001 have_struct_timeval=1
3002fi
3003
Tim Rice648f8762011-01-26 12:38:57 -08003004AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003005
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003006# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003007if test "x$ac_cv_have_int64_t" = "xno" && \
3008 test "x$ac_cv_sizeof_long_int" != "x8" && \
3009 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003010 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3011 echo "an alternative compiler (I.E., GCC) before continuing."
3012 echo ""
3013 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003014else
3015dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003016 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003017 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003018#include <stdio.h>
3019#include <string.h>
3020#ifdef HAVE_SNPRINTF
3021main()
3022{
3023 char buf[50];
3024 char expected_out[50];
3025 int mazsize = 50 ;
3026#if (SIZEOF_LONG_INT == 8)
3027 long int num = 0x7fffffffffffffff;
3028#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003029 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003030#endif
3031 strcpy(expected_out, "9223372036854775807");
3032 snprintf(buf, mazsize, "%lld", num);
3033 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003034 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003035 exit(0);
3036}
3037#else
3038main() { exit(0); }
3039#endif
Tim Rice648f8762011-01-26 12:38:57 -08003040 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003041 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003042 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003043fi
3044
Damien Miller78315eb2000-09-29 23:01:36 +11003045dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003046OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3047OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3048OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3049OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3050OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3051OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3052OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3053OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3054OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3055OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3056OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3057OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3058OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3059OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3060OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3061OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3062OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003063
3064AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08003065AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003066 [Define if we don't have struct __res_state in resolv.h])],
3067[
3068#include <stdio.h>
3069#if HAVE_SYS_TYPES_H
3070# include <sys/types.h>
3071#endif
3072#include <netinet/in.h>
3073#include <arpa/nameser.h>
3074#include <resolv.h>
3075])
andre2ff7b5d2000-06-03 14:57:40 +00003076
Damien Miller61e50f12000-05-08 20:49:37 +10003077AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3078 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003079 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003080#include <sys/types.h>
3081#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003082 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3083 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3084 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003085])
3086if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003087 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003088fi
3089
Damien Miller61e50f12000-05-08 20:49:37 +10003090AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3091 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003092 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003093#include <sys/types.h>
3094#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003095 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3096 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3097 [ ac_cv_have___ss_family_in_struct_ss="no"
3098 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003099])
3100if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003101 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003102 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003103fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003104
Damien Millerad833b32000-08-23 10:46:23 +10003105AC_CACHE_CHECK([for pw_class field in struct passwd],
3106 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003107 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3108 [[ struct passwd p; p.pw_class = 0; ]])],
3109 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3110 [ ac_cv_have_pw_class_in_struct_passwd="no"
3111 ])
Damien Millerad833b32000-08-23 10:46:23 +10003112])
3113if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003114 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003115 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003116fi
3117
Kevin Steves82456952001-06-22 21:14:18 +00003118AC_CACHE_CHECK([for pw_expire field in struct passwd],
3119 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003120 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3121 [[ struct passwd p; p.pw_expire = 0; ]])],
3122 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3123 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3124 ])
Kevin Steves82456952001-06-22 21:14:18 +00003125])
3126if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003127 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003128 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003129fi
3130
3131AC_CACHE_CHECK([for pw_change field in struct passwd],
3132 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3134 [[ struct passwd p; p.pw_change = 0; ]])],
3135 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3136 [ ac_cv_have_pw_change_in_struct_passwd="no"
3137 ])
Kevin Steves82456952001-06-22 21:14:18 +00003138])
3139if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003140 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003141 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003142fi
Damien Miller61e50f12000-05-08 20:49:37 +10003143
Tim Rice28bbb0c2002-05-27 17:37:32 -07003144dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003145AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3146 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003147 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003148#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003149#include <sys/socket.h>
3150#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003151 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003152#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003153#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003154exit(1);
3155#endif
3156struct msghdr m;
3157m.msg_accrights = 0;
3158exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003159 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003160 [ ac_cv_have_accrights_in_msghdr="yes" ],
3161 [ ac_cv_have_accrights_in_msghdr="no" ]
3162 )
3163])
3164if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003165 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003166 [Define if your system uses access rights style
3167 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003168fi
3169
Tim Rice648f8762011-01-26 12:38:57 -08003170AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3171AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003172#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003173#include <sys/stat.h>
3174#ifdef HAVE_SYS_TIME_H
3175# include <sys/time.h>
3176#endif
3177#ifdef HAVE_SYS_MOUNT_H
3178#include <sys/mount.h>
3179#endif
3180#ifdef HAVE_SYS_STATVFS_H
3181#include <sys/statvfs.h>
3182#endif
Tim Rice648f8762011-01-26 12:38:57 -08003183 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3184 [ AC_MSG_RESULT([yes]) ],
3185 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003186
Tim Rice648f8762011-01-26 12:38:57 -08003187 AC_MSG_CHECKING([if fsid_t has member val])
3188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003189#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003190#include <sys/statvfs.h>
3191 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3192 [ AC_MSG_RESULT([yes])
3193 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3194 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003195
Tim Rice648f8762011-01-26 12:38:57 -08003196 AC_MSG_CHECKING([if f_fsid has member __val])
3197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003198#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003199#include <sys/statvfs.h>
3200 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3201 [ AC_MSG_RESULT([yes])
3202 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3203 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003204])
Darren Tucker77001382008-06-09 06:17:53 +10003205
Kevin Stevesa44e0352002-04-07 16:18:03 +00003206AC_CACHE_CHECK([for msg_control field in struct msghdr],
3207 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003208 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003209#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003210#include <sys/socket.h>
3211#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003212 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003213#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003214#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003215exit(1);
3216#endif
3217struct msghdr m;
3218m.msg_control = 0;
3219exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003220 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003221 [ ac_cv_have_control_in_msghdr="yes" ],
3222 [ ac_cv_have_control_in_msghdr="no" ]
3223 )
3224])
3225if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003226 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003227 [Define if your system uses ancillary data style
3228 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003229fi
3230
Damien Miller61e50f12000-05-08 20:49:37 +10003231AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003232 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3233 [[ extern char *__progname; printf("%s", __progname); ]])],
3234 [ ac_cv_libc_defines___progname="yes" ],
3235 [ ac_cv_libc_defines___progname="no"
3236 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003237])
3238if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003239 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003240fi
3241
Kevin Steves4846f4a2002-03-22 18:19:53 +00003242AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003243 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3244 [[ printf("%s", __FUNCTION__); ]])],
3245 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3246 [ ac_cv_cc_implements___FUNCTION__="no"
3247 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003248])
3249if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003250 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003251 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003252fi
3253
3254AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003255 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3256 [[ printf("%s", __func__); ]])],
3257 [ ac_cv_cc_implements___func__="yes" ],
3258 [ ac_cv_cc_implements___func__="no"
3259 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003260])
3261if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003262 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003263fi
3264
Damien Miller57f39152005-11-24 19:58:19 +11003265AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003266 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3267#include <stdarg.h>
3268va_list x,y;
3269 ]], [[ va_copy(x,y); ]])],
3270 [ ac_cv_have_va_copy="yes" ],
3271 [ ac_cv_have_va_copy="no"
3272 ])
Damien Miller57f39152005-11-24 19:58:19 +11003273])
3274if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003275 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003276fi
3277
3278AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003279 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3280#include <stdarg.h>
3281va_list x,y;
3282 ]], [[ __va_copy(x,y); ]])],
3283 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3284 ])
Damien Miller57f39152005-11-24 19:58:19 +11003285])
3286if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003287 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003288fi
3289
Damien Miller4f8e6692001-07-14 13:22:53 +10003290AC_CACHE_CHECK([whether getopt has optreset support],
3291 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003292 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3293 [[ extern int optreset; optreset = 0; ]])],
3294 [ ac_cv_have_getopt_optreset="yes" ],
3295 [ ac_cv_have_getopt_optreset="no"
3296 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003297])
3298if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003299 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003300 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003301fi
Damien Millera22ba012000-03-02 23:09:20 +11003302
Damien Millerecbb26d2000-07-15 14:59:14 +10003303AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003304 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3305[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3306 [ ac_cv_libc_defines_sys_errlist="yes" ],
3307 [ ac_cv_libc_defines_sys_errlist="no"
3308 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003309])
3310if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003311 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003312 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003313fi
3314
3315
Damien Miller11fa2cc2000-08-16 10:35:58 +10003316AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003317 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3318[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3319 [ ac_cv_libc_defines_sys_nerr="yes" ],
3320 [ ac_cv_libc_defines_sys_nerr="no"
3321 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003322])
3323if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003324 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003325fi
3326
Darren Tucker5f88d342003-10-15 16:57:57 +10003327# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003328AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3329 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003330 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003331 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003332 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003333 AC_SEARCH_LIBS([res_query], [resolv])
3334 AC_SEARCH_LIBS([dn_expand], [resolv])
3335 AC_MSG_CHECKING([if res_query will link])
3336 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003337#include <sys/types.h>
3338#include <netinet/in.h>
3339#include <arpa/nameser.h>
3340#include <netdb.h>
3341#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003342 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003343 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003344 ]])],
3345 AC_MSG_RESULT([yes]),
3346 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003347 saved_LIBS="$LIBS"
3348 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003349 AC_MSG_CHECKING([for res_query in -lresolv])
3350 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003351#include <sys/types.h>
3352#include <netinet/in.h>
3353#include <arpa/nameser.h>
3354#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003355#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003356 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003357 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003358 ]])],
3359 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003360 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003361 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003362 ])
Tim Rice648f8762011-01-26 12:38:57 -08003363 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003364 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003365 [#include <sys/types.h>
3366 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003367 AC_CHECK_MEMBER([HEADER.ad],
3368 [AC_DEFINE([HAVE_HEADER_AD], [1],
3369 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003370 [#include <arpa/nameser.h>])
3371 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003372
Tim Rice648f8762011-01-26 12:38:57 -08003373AC_MSG_CHECKING([if struct __res_state _res is an extern])
3374AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003375#include <stdio.h>
3376#if HAVE_SYS_TYPES_H
3377# include <sys/types.h>
3378#endif
3379#include <netinet/in.h>
3380#include <arpa/nameser.h>
3381#include <resolv.h>
3382extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003383 ]], [[ ]])],
3384 [AC_MSG_RESULT([yes])
3385 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003386 [Define if you have struct __res_state _res as an extern])
3387 ],
Tim Rice648f8762011-01-26 12:38:57 -08003388 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003389)
3390
Damien Miller73b42d22006-04-22 21:26:08 +10003391# Check whether user wants SELinux support
3392SELINUX_MSG="no"
3393LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003394AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003395 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003396 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003397 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003398 AC_DEFINE([WITH_SELINUX], [1],
3399 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003400 SELINUX_MSG="yes"
3401 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003402 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3403 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003404 [ LIBSELINUX="-lselinux"
3405 LIBS="$LIBS -lselinux"
3406 ],
Tim Rice648f8762011-01-26 12:38:57 -08003407 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003408 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003409 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003410 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003411 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003412 fi ]
3413)
Tim Rice648f8762011-01-26 12:38:57 -08003414AC_SUBST([SSHLIBS])
3415AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003416
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003417# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003418KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003419AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003420 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003421 [ if test "x$withval" != "xno" ; then
3422 if test "x$withval" = "xyes" ; then
3423 KRB5ROOT="/usr/local"
3424 else
3425 KRB5ROOT=${withval}
3426 fi
3427
Tim Rice648f8762011-01-26 12:38:57 -08003428 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003429 KRB5_MSG="yes"
3430
Tim Rice648f8762011-01-26 12:38:57 -08003431 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003432 [$KRB5ROOT/bin/krb5-config],
3433 [$KRB5ROOT/bin:$PATH])
3434 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003435
Tim Rice648f8762011-01-26 12:38:57 -08003436 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003437 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003438 AC_MSG_RESULT([yes])
3439 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003440 [Define this if you want GSSAPI
3441 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003442 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003443 else
Tim Rice648f8762011-01-26 12:38:57 -08003444 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003445 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003446 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003447 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3448 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003449 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003450 AC_MSG_CHECKING([whether we are using Heimdal])
3451 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3452 ]], [[ char *tmp = heimdal_version; ]])],
3453 [ AC_MSG_RESULT([yes])
3454 AC_DEFINE([HEIMDAL], [1],
3455 [Define this if you are using the Heimdal
3456 version of Kerberos V5]) ],
3457 [AC_MSG_RESULT([no])
3458 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003459 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003460 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003461 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003462 AC_MSG_CHECKING([whether we are using Heimdal])
3463 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3464 ]], [[ char *tmp = heimdal_version; ]])],
3465 [ AC_MSG_RESULT([yes])
3466 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003467 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003468 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003469 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003470 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003471 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003472 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003473 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003474 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003475
3476 ])
3477 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003478
Tim Rice648f8762011-01-26 12:38:57 -08003479 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3480 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003481 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003482 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3483 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003484 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003485 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3486 $K5LIBS)
3487 ],
3488 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003489
Tim Rice648f8762011-01-26 12:38:57 -08003490 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003491 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003492 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003493 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003494 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003495 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003496 ]
3497 )
3498
3499 oldCPP="$CPPFLAGS"
3500 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003501 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003502 [ CPPFLAGS="$oldCPP" ])
3503
Damien Millera8e06ce2003-11-21 23:48:55 +11003504 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003505 if test ! -z "$need_dash_r" ; then
3506 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3507 fi
3508 if test ! -z "$blibpath" ; then
3509 blibpath="$blibpath:${KRB5ROOT}/lib"
3510 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003511
Tim Rice648f8762011-01-26 12:38:57 -08003512 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3513 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3514 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003515
3516 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003517 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3518 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003519 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003520 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003521)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003522
Damien Millera22ba012000-03-02 23:09:20 +11003523# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003524
Damien Millerf58c6722002-05-13 13:15:42 +10003525PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003526AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003527 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003528 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003529 if test -n "$withval" && test "x$withval" != "xno" && \
3530 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003531 PRIVSEP_PATH=$withval
3532 fi
3533 ]
3534)
Tim Rice648f8762011-01-26 12:38:57 -08003535AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003536
Tim Rice648f8762011-01-26 12:38:57 -08003537AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003538 [ --with-xauth=PATH Specify path to xauth program ],
3539 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003540 if test -n "$withval" && test "x$withval" != "xno" && \
3541 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003542 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003543 fi
3544 ],
3545 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003546 TestPath="$PATH"
3547 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3548 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3549 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3550 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003551 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003552 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003553 xauth_path="/usr/openwin/bin/xauth"
3554 fi
3555 ]
3556)
3557
Damien Miller7d901272003-01-13 16:55:22 +11003558STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003559AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003560 [ --disable-strip Disable calling strip(1) on install],
3561 [
3562 if test "x$enableval" = "xno" ; then
3563 STRIP_OPT=
3564 fi
3565 ]
3566)
Tim Rice648f8762011-01-26 12:38:57 -08003567AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003568
Damien Millera19cf472000-11-29 13:28:50 +11003569if test -z "$xauth_path" ; then
3570 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003571 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003572else
Tim Rice648f8762011-01-26 12:38:57 -08003573 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003574 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003575 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003576 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003577fi
Damien Millera22ba012000-03-02 23:09:20 +11003578
Tim Rice90f42b02011-06-02 18:17:49 -07003579dnl # --with-maildir=/path/to/mail gets top priority.
3580dnl # if maildir is set in the platform case statement above we use that.
3581dnl # Otherwise we run a program to get the dir from system headers.
3582dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3583dnl # If we find _PATH_MAILDIR we do nothing because that is what
3584dnl # session.c expects anyway. Otherwise we set to the value found
3585dnl # stripping any trailing slash. If for some strage reason our program
3586dnl # does not find what it needs, we default to /var/spool/mail.
3587# Check for mail directory
3588AC_ARG_WITH([maildir],
3589 [ --with-maildir=/path/to/mail Specify your system mail directory],
3590 [
3591 if test "X$withval" != X && test "x$withval" != xno && \
3592 test "x${withval}" != xyes; then
3593 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3594 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3595 fi
3596 ],[
3597 if test "X$maildir" != "X"; then
3598 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3599 else
3600 AC_MSG_CHECKING([Discovering system mail directory])
3601 AC_RUN_IFELSE(
3602 [AC_LANG_PROGRAM([[
3603#include <stdio.h>
3604#include <string.h>
3605#ifdef HAVE_PATHS_H
3606#include <paths.h>
3607#endif
3608#ifdef HAVE_MAILLOCK_H
3609#include <maillock.h>
3610#endif
3611#define DATA "conftest.maildir"
3612 ]], [[
3613 FILE *fd;
3614 int rc;
3615
3616 fd = fopen(DATA,"w");
3617 if(fd == NULL)
3618 exit(1);
3619
3620#if defined (_PATH_MAILDIR)
3621 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3622 exit(1);
3623#elif defined (MAILDIR)
3624 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3625 exit(1);
3626#elif defined (_PATH_MAIL)
3627 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3628 exit(1);
3629#else
3630 exit (2);
3631#endif
3632
3633 exit(0);
3634 ]])],
3635 [
3636 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3637 maildir=`awk -F: '{print $2}' conftest.maildir \
3638 | sed 's|/$||'`
3639 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3640 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3641 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3642 fi
3643 ],
3644 [
3645 if test "X$ac_status" = "X2";then
3646# our test program didn't find it. Default to /var/spool/mail
3647 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3648 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3649 else
3650 AC_MSG_RESULT([*** not found ***])
3651 fi
3652 ],
3653 [
3654 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3655 ]
3656 )
3657 fi
3658 ]
3659) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003660
Darren Tucker623d92f2004-09-12 22:36:15 +10003661if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003662 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3663 disable_ptmx_check=yes
3664fi
Damien Millera22ba012000-03-02 23:09:20 +11003665if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003666 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003667 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003668 [
Tim Rice648f8762011-01-26 12:38:57 -08003669 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003670 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003671 have_dev_ptmx=1
3672 ]
3673 )
3674 fi
Damien Millera22ba012000-03-02 23:09:20 +11003675fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003676
Darren Tucker623d92f2004-09-12 22:36:15 +10003677if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003678 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003679 [
Tim Rice648f8762011-01-26 12:38:57 -08003680 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003681 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003682 have_dev_ptc=1
3683 ]
3684 )
3685else
3686 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3687fi
Damien Miller204ad072000-03-02 23:56:12 +11003688
Damien Millera22ba012000-03-02 23:09:20 +11003689# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003690AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003691 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003692 [
Damien Miller897741e2001-04-16 10:41:46 +10003693 case "$withval" in
3694 man|cat|doc)
3695 MANTYPE=$withval
3696 ;;
3697 *)
Tim Rice648f8762011-01-26 12:38:57 -08003698 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003699 ;;
3700 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003701 ]
3702)
Ben Lindstrombc709922001-04-18 18:04:21 +00003703if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003704 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003705 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003706 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3707 MANTYPE=doc
3708 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3709 MANTYPE=man
3710 else
3711 MANTYPE=cat
3712 fi
3713fi
Tim Rice648f8762011-01-26 12:38:57 -08003714AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003715if test "$MANTYPE" = "doc"; then
3716 mansubdir=man;
3717else
3718 mansubdir=$MANTYPE;
3719fi
Tim Rice648f8762011-01-26 12:38:57 -08003720AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003721
Damien Millera22ba012000-03-02 23:09:20 +11003722# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003723MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003724AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003725 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003726 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003727 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003728 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003729 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003730 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003731 fi
3732 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003733)
3734
Damien Millera22ba012000-03-02 23:09:20 +11003735# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003736AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003737 [ --without-shadow Disable shadow password support],
3738 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003739 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003740 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003741 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003742 fi
3743 ]
3744)
3745
Damien Miller1f335fb2000-06-26 11:31:33 +10003746if test -z "$disable_shadow" ; then
3747 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003748 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003749#include <sys/types.h>
3750#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003751struct spwd sp;
3752 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3753 [ sp_expire_available=yes ], [
3754 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003755
3756 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003757 AC_MSG_RESULT([yes])
3758 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003759 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003760 else
Tim Rice648f8762011-01-26 12:38:57 -08003761 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003762 fi
3763fi
3764
Damien Millera22ba012000-03-02 23:09:20 +11003765# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003766if test ! -z "$IPADDR_IN_DISPLAY" ; then
3767 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003768 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003769 [Define if you need to use IP address
3770 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003771else
Damien Millera8e06ce2003-11-21 23:48:55 +11003772 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003773 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003774 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3775 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003776 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003777 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003778 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003779 fi
3780 ]
3781 )
3782fi
Damien Miller76112de1999-12-21 11:18:08 +11003783
Darren Tuckere1a790d2003-09-16 11:52:19 +10003784# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003785AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003786 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003787 [ if test "x$enableval" = "xno"; then
3788 AC_MSG_NOTICE([/etc/default/login handling disabled])
3789 etc_default_login=no
3790 else
3791 etc_default_login=yes
3792 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003793 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3794 then
3795 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3796 etc_default_login=no
3797 else
3798 etc_default_login=yes
3799 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003800)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003801
Darren Tucker2f9573d2005-02-10 22:28:54 +11003802if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003803 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003804 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003805 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003806 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003807 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003808 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003809fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003810
Tim Rice43a1c132002-04-17 21:19:14 -07003811dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003812if test $ac_cv_func_login_getcapbool = "yes" && \
3813 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003814 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003815fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003816
Damien Millera22ba012000-03-02 23:09:20 +11003817# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003818SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003819AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003820 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003821 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003822 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003823 AC_MSG_WARN([
3824--with-default-path=PATH has no effect on this system.
3825Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003826 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003827 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003828 AC_MSG_WARN([
3829--with-default-path=PATH will only be used if PATH is not defined in
3830$external_path_file .])
3831 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003832 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003833 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003834 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003835 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003836 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3837 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003838 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003839 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003840 AC_MSG_WARN([
3841If PATH is defined in $external_path_file, ensure the path to scp is included,
3842otherwise scp will not work.])
3843 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003844 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003845 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003846/* find out what STDPATH is */
3847#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003848#ifdef HAVE_PATHS_H
3849# include <paths.h>
3850#endif
3851#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003852# ifdef _PATH_USERPATH /* Irix */
3853# define _PATH_STDPATH _PATH_USERPATH
3854# else
3855# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3856# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003857#endif
3858#include <sys/types.h>
3859#include <sys/stat.h>
3860#include <fcntl.h>
3861#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003862 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003863 FILE *fd;
3864 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003865
Tim Rice59ea0a02001-03-10 13:50:45 -08003866 fd = fopen(DATA,"w");
3867 if(fd == NULL)
3868 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003869
Tim Rice59ea0a02001-03-10 13:50:45 -08003870 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3871 exit(1);
3872
3873 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003874 ]])],
3875 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003876 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3877 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3878 )
3879# make sure $bindir is in USER_PATH so scp will work
3880 t_bindir=`eval echo ${bindir}`
3881 case $t_bindir in
3882 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3883 esac
3884 case $t_bindir in
3885 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3886 esac
3887 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3888 if test $? -ne 0 ; then
3889 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3890 if test $? -ne 0 ; then
3891 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003892 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003893 fi
3894 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003895 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003896)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003897if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003898 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3899 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003900fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003901
Damien Millera18bbd32002-05-13 10:48:57 +10003902# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003903AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003904 [ --with-superuser-path= Specify different path for super-user],
3905 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003906 if test -n "$withval" && test "x$withval" != "xno" && \
3907 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003908 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003909 [Define if you want a different $PATH
3910 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003911 superuser_path=$withval
3912 fi
3913 ]
3914)
3915
3916
Damien Miller61e50f12000-05-08 20:49:37 +10003917AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003918IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003919AC_ARG_WITH(4in6,
3920 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3921 [
3922 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003923 AC_MSG_RESULT([yes])
3924 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003925 [Detect IPv4 in IPv6 mapped addresses
3926 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003927 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003928 else
Tim Rice648f8762011-01-26 12:38:57 -08003929 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003930 fi
Tim Rice648f8762011-01-26 12:38:57 -08003931 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003932 if test "x$inet6_default_4in6" = "xyes"; then
3933 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003934 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003935 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003936 else
3937 AC_MSG_RESULT([no (default)])
3938 fi
3939 ]
3940)
3941
Damien Miller60396b02001-02-18 17:01:00 +11003942# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003943BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003944AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003945 [ --with-bsd-auth Enable BSD auth support],
3946 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003947 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003948 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003949 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003950 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003951 fi
3952 ]
3953)
3954
Damien Millera22ba012000-03-02 23:09:20 +11003955# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003956piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003957# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003958if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003959 piddir=`eval echo ${sysconfdir}`
3960 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003961 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003962 esac
3963fi
3964
Tim Rice648f8762011-01-26 12:38:57 -08003965AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003966 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3967 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003968 if test -n "$withval" && test "x$withval" != "xno" && \
3969 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003970 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003971 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003972 AC_MSG_WARN([** no $piddir directory on this system **])
3973 fi
3974 fi
3975 ]
3976)
3977
Tim Rice648f8762011-01-26 12:38:57 -08003978AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3979 [Specify location of ssh.pid])
3980AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003981
andre2ff7b5d2000-06-03 14:57:40 +00003982dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003983AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003984 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003985 [
3986 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003987 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003988 fi
3989 ]
andre2ff7b5d2000-06-03 14:57:40 +00003990)
Tim Rice648f8762011-01-26 12:38:57 -08003991AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003992 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003993 [
3994 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003995 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003996 fi
3997 ]
andre2ff7b5d2000-06-03 14:57:40 +00003998)
Tim Rice648f8762011-01-26 12:38:57 -08003999AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004000 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004001 [
4002 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004003 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004004 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004005 fi
4006 ]
andre2ff7b5d2000-06-03 14:57:40 +00004007)
Tim Rice648f8762011-01-26 12:38:57 -08004008AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004009 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004010 [
4011 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004012 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004013 fi
4014 ]
andre2ff7b5d2000-06-03 14:57:40 +00004015)
Tim Rice648f8762011-01-26 12:38:57 -08004016AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004017 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004018 [
4019 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004020 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004021 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004022 fi
4023 ]
andre2ff7b5d2000-06-03 14:57:40 +00004024)
Tim Rice648f8762011-01-26 12:38:57 -08004025AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004026 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004027 [
4028 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004029 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004030 fi
4031 ]
andre2ff7b5d2000-06-03 14:57:40 +00004032)
Tim Rice648f8762011-01-26 12:38:57 -08004033AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004034 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004035 [
4036 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004037 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004038 [Define if you don't want to use pututline()
4039 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004040 fi
4041 ]
andre2ff7b5d2000-06-03 14:57:40 +00004042)
Tim Rice648f8762011-01-26 12:38:57 -08004043AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004044 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004045 [
4046 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004047 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004048 [Define if you don't want to use pututxline()
4049 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004050 fi
4051 ]
andre2ff7b5d2000-06-03 14:57:40 +00004052)
Tim Rice648f8762011-01-26 12:38:57 -08004053AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004054 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004055 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004056 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004057 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004058 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004059 conf_lastlog_location=$withval
4060 fi
4061 ]
4062)
andre2ff7b5d2000-06-03 14:57:40 +00004063
4064dnl lastlog, [uw]tmpx? detection
4065dnl NOTE: set the paths in the platform section to avoid the
4066dnl need for command-line parameters
4067dnl lastlog and [uw]tmp are subject to a file search if all else fails
4068
4069dnl lastlog detection
4070dnl NOTE: the code itself will detect if lastlog is a directory
4071AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004072AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004073#include <sys/types.h>
4074#include <utmp.h>
4075#ifdef HAVE_LASTLOG_H
4076# include <lastlog.h>
4077#endif
Damien Miller2994e082000-06-04 15:51:47 +10004078#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004079# include <paths.h>
4080#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004081#ifdef HAVE_LOGIN_H
4082# include <login.h>
4083#endif
Tim Rice648f8762011-01-26 12:38:57 -08004084 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4085 [ AC_MSG_RESULT([yes]) ],
4086 [
4087 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004088 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004089 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004090#include <sys/types.h>
4091#include <utmp.h>
4092#ifdef HAVE_LASTLOG_H
4093# include <lastlog.h>
4094#endif
4095#ifdef HAVE_PATHS_H
4096# include <paths.h>
4097#endif
Tim Rice648f8762011-01-26 12:38:57 -08004098 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4099 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004100 [
Tim Rice648f8762011-01-26 12:38:57 -08004101 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004102 system_lastlog_path=no
4103 ])
Tim Rice648f8762011-01-26 12:38:57 -08004104])
Damien Miller2994e082000-06-04 15:51:47 +10004105
andre2ff7b5d2000-06-03 14:57:40 +00004106if test -z "$conf_lastlog_location"; then
4107 if test x"$system_lastlog_path" = x"no" ; then
4108 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004109 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004110 conf_lastlog_location=$f
4111 fi
4112 done
4113 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004114 AC_MSG_WARN([** Cannot find lastlog **])
4115 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004116 fi
4117 fi
4118fi
4119
4120if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004121 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004122 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004123fi
andre2ff7b5d2000-06-03 14:57:40 +00004124
4125dnl utmp detection
4126AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004127AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004128#include <sys/types.h>
4129#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004130#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004131# include <paths.h>
4132#endif
Tim Rice648f8762011-01-26 12:38:57 -08004133 ]], [[ char *utmp = UTMP_FILE; ]])],
4134 [ AC_MSG_RESULT([yes]) ],
4135 [ AC_MSG_RESULT([no])
4136 system_utmp_path=no
4137])
andre2ff7b5d2000-06-03 14:57:40 +00004138if test -z "$conf_utmp_location"; then
4139 if test x"$system_utmp_path" = x"no" ; then
4140 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4141 if test -f $f ; then
4142 conf_utmp_location=$f
4143 fi
4144 done
4145 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004146 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004147 fi
4148 fi
4149fi
4150if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004151 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004152 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004153fi
andre2ff7b5d2000-06-03 14:57:40 +00004154
4155dnl wtmp detection
4156AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004157AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004158#include <sys/types.h>
4159#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004160#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004161# include <paths.h>
4162#endif
Tim Rice648f8762011-01-26 12:38:57 -08004163 ]], [[ char *wtmp = WTMP_FILE; ]])],
4164 [ AC_MSG_RESULT([yes]) ],
4165 [ AC_MSG_RESULT([no])
4166 system_wtmp_path=no
4167])
andre2ff7b5d2000-06-03 14:57:40 +00004168if test -z "$conf_wtmp_location"; then
4169 if test x"$system_wtmp_path" = x"no" ; then
4170 for f in /usr/adm/wtmp /var/log/wtmp; do
4171 if test -f $f ; then
4172 conf_wtmp_location=$f
4173 fi
4174 done
4175 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004176 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004177 fi
4178 fi
4179fi
4180if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004181 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004182 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004183fi
andre2ff7b5d2000-06-03 14:57:40 +00004184
4185
andre2ff7b5d2000-06-03 14:57:40 +00004186dnl wtmpx detection
4187AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004188AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004189#include <sys/types.h>
4190#include <utmp.h>
4191#ifdef HAVE_UTMPX_H
4192#include <utmpx.h>
4193#endif
Damien Miller2994e082000-06-04 15:51:47 +10004194#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004195# include <paths.h>
4196#endif
Tim Rice648f8762011-01-26 12:38:57 -08004197 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4198 [ AC_MSG_RESULT([yes]) ],
4199 [ AC_MSG_RESULT([no])
4200 system_wtmpx_path=no
4201])
andre2ff7b5d2000-06-03 14:57:40 +00004202if test -z "$conf_wtmpx_location"; then
4203 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004204 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004205 fi
4206else
Tim Rice648f8762011-01-26 12:38:57 -08004207 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004208 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004209fi
andre2ff7b5d2000-06-03 14:57:40 +00004210
Damien Miller4018c192000-04-30 09:30:44 +10004211
Damien Miller29ea30d2000-03-17 10:54:15 +11004212if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004213 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4214 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004215fi
4216
Darren Tucker7da23cb2005-08-03 00:20:15 +10004217dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4218dnl Add now.
4219CFLAGS="$CFLAGS $werror_flags"
4220
Darren Tucker627337d2010-04-10 22:58:01 +10004221if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4222 TEST_SSH_IPV6=no
4223else
4224 TEST_SSH_IPV6=yes
4225fi
Tim Rice648f8762011-01-26 12:38:57 -08004226AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4227AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004228
Damien Millerbac2d8a2000-09-05 16:13:06 +11004229AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004230AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4231 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004232 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004233AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004234
Damien Miller7b22d652000-06-18 14:07:04 +10004235# Print summary of options
4236
Damien Miller7b22d652000-06-18 14:07:04 +10004237# Someone please show me a better way :)
4238A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4239B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4240C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4241D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004242E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004243F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004244G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004245H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4246I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4247J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004248
4249echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004250echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004251echo " User binaries: $B"
4252echo " System binaries: $C"
4253echo " Configuration files: $D"
4254echo " Askpass program: $E"
4255echo " Manual pages: $F"
4256echo " PID file: $G"
4257echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004258if test "x$external_path_file" = "x/etc/login.conf" ; then
4259echo " At runtime, sshd will use the path defined in $external_path_file"
4260echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004261else
Damien Millerf58c6722002-05-13 13:15:42 +10004262echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004263 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004264echo " (If PATH is set in $external_path_file it will be used instead. If"
4265echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4266 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004267fi
Damien Millera18bbd32002-05-13 10:48:57 +10004268if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004269echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004270fi
Damien Millerf58c6722002-05-13 13:15:42 +10004271echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004272echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004273echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004274echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004275echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004276echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004277echo " S/KEY support: $SKEY_MSG"
4278echo " TCP Wrappers support: $TCPW_MSG"
4279echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004280echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004281echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004282echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004283echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004284echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4285echo " BSD Auth support: $BSD_AUTH_MSG"
4286echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004287echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004288
Damien Miller7b22d652000-06-18 14:07:04 +10004289echo ""
4290
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004291echo " Host: ${host}"
4292echo " Compiler: ${CC}"
4293echo " Compiler flags: ${CFLAGS}"
4294echo "Preprocessor flags: ${CPPFLAGS}"
4295echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004296echo " Libraries: ${LIBS}"
4297if test ! -z "${SSHDLIBS}"; then
4298echo " +for sshd: ${SSHDLIBS}"
4299fi
Damien Miller71adf122011-01-25 12:16:15 +11004300if test ! -z "${SSHLIBS}"; then
4301echo " +for ssh: ${SSHLIBS}"
4302fi
Damien Miller7b22d652000-06-18 14:07:04 +10004303
4304echo ""
4305
Tim Rice6f1f7582004-05-30 21:38:51 -07004306if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004307 echo "SVR4 style packages are supported with \"make package\""
4308 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004309fi
4310
Damien Miller82cf0ce2000-12-20 13:34:48 +11004311if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004312 echo "PAM is enabled. You may need to install a PAM control file "
4313 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004314 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004315 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004316 echo ""
4317fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004318
Damien Millerb4097182004-05-23 14:09:40 +10004319if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004320 echo "WARNING: the operating system that you are using does not"
4321 echo "appear to support getpeereid(), getpeerucred() or the"
4322 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4323 echo "enforce security checks to prevent unauthorised connections to"
4324 echo "ssh-agent. Their absence increases the risk that a malicious"
4325 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004326 echo ""
4327fi
4328
Darren Tuckerd9f88912005-02-20 21:01:48 +11004329if test "$AUDIT_MODULE" = "bsm" ; then
4330 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4331 echo "See the Solaris section in README.platform for details."
4332fi