blob: 5aeb7a8f79c2dc83ac9e064cdd9df2826929fc40 [file] [log] [blame]
Darren Tucker4a725ef2011-11-21 16:38:48 +11001# $Id: configure.ac,v 1.485 2011/11/21 05:38:50 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 Tucker4a725ef2011-11-21 16:38:48 +110018AC_REVISION($Revision: 1.485 $)
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 Tuckerd9f88912005-02-20 21:01:48 +11001437 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001438 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001439 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001440 AUDIT_MODULE=linux
1441 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001442 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001443 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001444 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001445 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001446 debug)
1447 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001448 AC_MSG_RESULT([debug])
1449 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001450 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001451 no)
Tim Rice648f8762011-01-26 12:38:57 -08001452 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001453 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001454 *)
1455 AC_MSG_ERROR([Unknown audit module $withval])
1456 ;;
1457 esac ]
1458)
1459
Damien Millerfe1f1432003-02-24 15:45:42 +11001460dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001461AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001462 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001463 arc4random_buf \
1464 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001465 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001466 b64_ntop \
1467 __b64_ntop \
1468 b64_pton \
1469 __b64_pton \
1470 bcopy \
1471 bindresvport_sa \
1472 clock \
1473 closefrom \
1474 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001475 fchmod \
1476 fchown \
1477 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001478 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001479 futimes \
1480 getaddrinfo \
1481 getcwd \
1482 getgrouplist \
1483 getnameinfo \
1484 getopt \
1485 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001486 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001487 _getpty \
1488 getrlimit \
1489 getttyent \
1490 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001491 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001492 inet_aton \
1493 inet_ntoa \
1494 inet_ntop \
1495 innetgr \
1496 login_getcapbool \
1497 md5_crypt \
1498 memmove \
1499 mkdtemp \
1500 mmap \
1501 ngetaddrinfo \
1502 nsleep \
1503 ogetaddrinfo \
1504 openlog_r \
1505 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001506 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001507 prctl \
1508 pstat \
1509 readpassphrase \
1510 realpath \
1511 recvmsg \
1512 rresvport_af \
1513 sendmsg \
1514 setdtablesize \
1515 setegid \
1516 setenv \
1517 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001518 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001519 setgroups \
1520 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001521 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001522 setpcred \
1523 setproctitle \
1524 setregid \
1525 setreuid \
1526 setrlimit \
1527 setsid \
1528 setvbuf \
1529 sigaction \
1530 sigvec \
1531 snprintf \
1532 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001533 statfs \
1534 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001535 strdup \
1536 strerror \
1537 strlcat \
1538 strlcpy \
1539 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001540 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001541 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001542 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001543 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001544 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001545 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001546 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001547 sysconf \
1548 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001549 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001550 truncate \
1551 unsetenv \
1552 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001553 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001554 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001555 vhangup \
1556 vsnprintf \
1557 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001558])
Tim Rice13aae5e2001-10-21 17:53:58 -07001559
Tim Ricec7a8af02010-11-08 14:26:23 -08001560AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001561 [AC_LANG_PROGRAM(
1562 [[ #include <ctype.h> ]],
1563 [[ return (isblank('a')); ]])],
1564 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001565])
1566
Damien Millerb3c9f782010-02-12 10:11:34 +11001567# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001568AC_SEARCH_LIBS([dlopen], [dl],
1569 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001570)
1571
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001572# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001573AC_CHECK_FUNCS([gai_strerror], [
1574 AC_DEFINE([HAVE_GAI_STRERROR])
1575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001576#include <sys/types.h>
1577#include <sys/socket.h>
1578#include <netdb.h>
1579
Tim Rice648f8762011-01-26 12:38:57 -08001580const char *gai_strerror(int);
1581 ]], [[
1582 char *str;
1583 str = gai_strerror(0);
1584 ]])], [
1585 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1586 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001587
Tim Rice648f8762011-01-26 12:38:57 -08001588AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1589 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001590
Darren Tuckerf1159b52003-07-07 19:44:01 +10001591dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001592AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1593AC_CHECK_DECL([strsep],
1594 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001595 [],
1596 [
1597#ifdef HAVE_STRING_H
1598# include <string.h>
1599#endif
1600 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001601
Darren Tuckerb2427c82003-09-10 15:22:44 +10001602dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001603AC_CHECK_DECL([tcsendbreak],
1604 [AC_DEFINE([HAVE_TCSENDBREAK])],
1605 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001606 [#include <termios.h>]
1607)
1608
Tim Rice648f8762011-01-26 12:38:57 -08001609AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001610
Tim Rice648f8762011-01-26 12:38:57 -08001611AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001612 [
1613#include <sys/types.h>
1614#include <sys/socket.h>
1615 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001616
Tim Rice648f8762011-01-26 12:38:57 -08001617AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001618 [
1619#include <sys/types.h>
1620#ifdef HAVE_SYS_STAT_H
1621# include <sys/stat.h>
1622#endif
1623#ifdef HAVE_FCNTL_H
1624# include <fcntl.h>
1625#endif
1626 ])
1627
Tim Rice648f8762011-01-26 12:38:57 -08001628AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001629#include <sys/types.h>
1630#include <sys/uio.h>
1631#include <unistd.h>
1632 ])
1633
Tim Rice648f8762011-01-26 12:38:57 -08001634AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001635#include <sys/param.h>
1636 ])
1637
Tim Rice648f8762011-01-26 12:38:57 -08001638AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001639#include <stddef.h>
1640 ])
1641
Tim Rice648f8762011-01-26 12:38:57 -08001642AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001643 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001644 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001645 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001646 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001647#include <stdlib.h>
1648#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001649 ]], [[
1650 errno=0;
1651 setresuid(0,0,0);
1652 if (errno==ENOSYS)
1653 exit(1);
1654 else
1655 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001656 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001657 [AC_MSG_RESULT([yes])],
1658 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001659 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001660 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001661 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001662 )
1663])
Darren Tuckere937be32003-12-17 18:53:26 +11001664
Tim Rice648f8762011-01-26 12:38:57 -08001665AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001666 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001667 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001668 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001669 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001670#include <stdlib.h>
1671#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001672 ]], [[
1673 errno=0;
1674 setresgid(0,0,0);
1675 if (errno==ENOSYS)
1676 exit(1);
1677 else
1678 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001679 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001680 [AC_MSG_RESULT([yes])],
1681 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001682 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001683 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001684 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001685 )
1686])
Darren Tuckere937be32003-12-17 18:53:26 +11001687
Damien Millerad833b32000-08-23 10:46:23 +10001688dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001689AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001690dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001691AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1692AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001693dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001694AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1695AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001696dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001697AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001698
Tim Rice648f8762011-01-26 12:38:57 -08001699AC_CHECK_FUNC([daemon],
1700 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1701 [AC_CHECK_LIB([bsd], [daemon],
1702 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001703)
1704
Tim Rice648f8762011-01-26 12:38:57 -08001705AC_CHECK_FUNC([getpagesize],
1706 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001707 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001708 [AC_CHECK_LIB([ucb], [getpagesize],
1709 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001710)
1711
Damien Millercb170cb2000-07-01 16:52:55 +10001712# Check for broken snprintf
1713if test "x$ac_cv_func_snprintf" = "xyes" ; then
1714 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001715 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001716 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1717 [[
1718 char b[5];
1719 snprintf(b,5,"123456789");
1720 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001721 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001722 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001723 [
Tim Rice648f8762011-01-26 12:38:57 -08001724 AC_MSG_RESULT([no])
1725 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001726 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001727 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001728 ],
1729 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001730 )
1731fi
1732
Damien Miller57f39152005-11-24 19:58:19 +11001733# If we don't have a working asprintf, then we strongly depend on vsnprintf
1734# returning the right thing on overflow: the number of characters it tried to
1735# create (as per SUSv3)
1736if test "x$ac_cv_func_asprintf" != "xyes" && \
1737 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1738 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1739 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001740 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001741#include <sys/types.h>
1742#include <stdio.h>
1743#include <stdarg.h>
1744
1745int x_snprintf(char *str,size_t count,const char *fmt,...)
1746{
1747 size_t ret; va_list ap;
1748 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1749 return ret;
1750}
Tim Rice648f8762011-01-26 12:38:57 -08001751 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001752 char x[1];
1753 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001754 ]])],
1755 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001756 [
Tim Rice648f8762011-01-26 12:38:57 -08001757 AC_MSG_RESULT([no])
1758 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001759 [Define if your snprintf is busted])
1760 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1761 ],
1762 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1763 )
1764fi
1765
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001766# On systems where [v]snprintf is broken, but is declared in stdio,
1767# check that the fmt argument is const char * or just char *.
1768# This is only useful for when BROKEN_SNPRINTF
1769AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001770AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1771#include <stdio.h>
1772int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1773 ]], [[
1774 snprintf(0, 0, 0);
1775 ]])],
1776 [AC_MSG_RESULT([yes])
1777 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001778 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001779 [AC_MSG_RESULT([no])
1780 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001781
Damien Millerb4097182004-05-23 14:09:40 +10001782# Check for missing getpeereid (or equiv) support
1783NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001784if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001785 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001786 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1787#include <sys/types.h>
1788#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1789 [ AC_MSG_RESULT([yes])
1790 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1791 ], [AC_MSG_RESULT([no])
1792 NO_PEERCHECK=1
1793 ])
Damien Millerb4097182004-05-23 14:09:40 +10001794fi
1795
Damien Millere8328192003-01-07 15:18:32 +11001796dnl see whether mkstemp() requires XXXXXX
1797if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1798AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001799AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001800 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001801#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001802 ]], [[
1803 char template[]="conftest.mkstemp-test";
1804 if (mkstemp(template) == -1)
1805 exit(1);
1806 unlink(template);
1807 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001808 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001809 [
Tim Rice648f8762011-01-26 12:38:57 -08001810 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001811 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001812 [
Tim Rice648f8762011-01-26 12:38:57 -08001813 AC_MSG_RESULT([yes])
1814 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001815 ],
1816 [
Tim Rice648f8762011-01-26 12:38:57 -08001817 AC_MSG_RESULT([yes])
1818 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001819 ]
Damien Millere8328192003-01-07 15:18:32 +11001820)
1821fi
1822
Darren Tucker70a3d552003-08-21 17:58:29 +10001823dnl make sure that openpty does not reacquire controlling terminal
1824if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001825 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001826 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001827 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001828#include <stdio.h>
1829#include <sys/fcntl.h>
1830#include <sys/types.h>
1831#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001832 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001833 pid_t pid;
1834 int fd, ptyfd, ttyfd, status;
1835
1836 pid = fork();
1837 if (pid < 0) { /* failed */
1838 exit(1);
1839 } else if (pid > 0) { /* parent */
1840 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001841 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001842 exit(WEXITSTATUS(status));
1843 else
1844 exit(2);
1845 } else { /* child */
1846 close(0); close(1); close(2);
1847 setsid();
1848 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1849 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1850 if (fd >= 0)
1851 exit(3); /* Acquired ctty: broken */
1852 else
1853 exit(0); /* Did not acquire ctty: OK */
1854 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001855 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001856 [
Tim Rice648f8762011-01-26 12:38:57 -08001857 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001858 ],
1859 [
Tim Rice648f8762011-01-26 12:38:57 -08001860 AC_MSG_RESULT([no])
1861 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001862 ],
1863 [
Tim Rice648f8762011-01-26 12:38:57 -08001864 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001865 ]
1866 )
1867fi
1868
Tim Rice8bb561b2005-03-17 16:23:19 -08001869if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1870 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001871 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001872 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001873 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001874#include <stdio.h>
1875#include <sys/socket.h>
1876#include <netdb.h>
1877#include <errno.h>
1878#include <netinet/in.h>
1879
1880#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001881 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001882 int err, sock;
1883 struct addrinfo *gai_ai, *ai, hints;
1884 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1885
1886 memset(&hints, 0, sizeof(hints));
1887 hints.ai_family = PF_UNSPEC;
1888 hints.ai_socktype = SOCK_STREAM;
1889 hints.ai_flags = AI_PASSIVE;
1890
1891 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1892 if (err != 0) {
1893 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1894 exit(1);
1895 }
1896
1897 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1898 if (ai->ai_family != AF_INET6)
1899 continue;
1900
1901 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1902 sizeof(ntop), strport, sizeof(strport),
1903 NI_NUMERICHOST|NI_NUMERICSERV);
1904
1905 if (err != 0) {
1906 if (err == EAI_SYSTEM)
1907 perror("getnameinfo EAI_SYSTEM");
1908 else
1909 fprintf(stderr, "getnameinfo failed: %s\n",
1910 gai_strerror(err));
1911 exit(2);
1912 }
1913
1914 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1915 if (sock < 0)
1916 perror("socket");
1917 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1918 if (errno == EBADF)
1919 exit(3);
1920 }
1921 }
1922 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001923 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001924 [
Tim Rice648f8762011-01-26 12:38:57 -08001925 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001926 ],
1927 [
Tim Rice648f8762011-01-26 12:38:57 -08001928 AC_MSG_RESULT([no])
1929 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001930 ],
1931 [
Tim Rice648f8762011-01-26 12:38:57 -08001932 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001933 ]
1934 )
1935fi
1936
Tim Rice8bb561b2005-03-17 16:23:19 -08001937if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1938 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001939 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001940 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001941 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11001942#include <stdio.h>
1943#include <sys/socket.h>
1944#include <netdb.h>
1945#include <errno.h>
1946#include <netinet/in.h>
1947
1948#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001949 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11001950 int err, sock;
1951 struct addrinfo *gai_ai, *ai, hints;
1952 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1953
1954 memset(&hints, 0, sizeof(hints));
1955 hints.ai_family = PF_UNSPEC;
1956 hints.ai_socktype = SOCK_STREAM;
1957 hints.ai_flags = AI_PASSIVE;
1958
1959 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1960 if (err != 0) {
1961 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1962 exit(1);
1963 }
1964
1965 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1966 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1967 continue;
1968
1969 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1970 sizeof(ntop), strport, sizeof(strport),
1971 NI_NUMERICHOST|NI_NUMERICSERV);
1972
1973 if (ai->ai_family == AF_INET && err != 0) {
1974 perror("getnameinfo");
1975 exit(2);
1976 }
1977 }
1978 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001979 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001980 [
Tim Rice648f8762011-01-26 12:38:57 -08001981 AC_MSG_RESULT([yes])
1982 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001983 [Define if you have a getaddrinfo that fails
1984 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001985 ],
1986 [
Tim Rice648f8762011-01-26 12:38:57 -08001987 AC_MSG_RESULT([no])
1988 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001989 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001990 [
Tim Rice648f8762011-01-26 12:38:57 -08001991 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11001992 ]
1993 )
1994fi
1995
Darren Tuckera56f1912004-11-02 20:30:54 +11001996if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001997 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
1998 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
1999 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002000 [
Tim Rice648f8762011-01-26 12:38:57 -08002001 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002002 ],
2003 [
Tim Rice648f8762011-01-26 12:38:57 -08002004 AC_MSG_RESULT([yes])
2005 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002006 [Conflicting defs for getspnam])
2007 ]
2008 )
2009fi
2010
Damien Miller606f8802000-09-16 15:39:56 +11002011AC_FUNC_GETPGRP
2012
Tim Riceaef73712002-05-11 13:17:42 -07002013# Search for OpenSSL
2014saved_CPPFLAGS="$CPPFLAGS"
2015saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002016AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002017 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2018 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002019 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002020 case "$withval" in
2021 # Relative paths
2022 ./*|../*) withval="`pwd`/$withval"
2023 esac
Tim Riceaef73712002-05-11 13:17:42 -07002024 if test -d "$withval/lib"; then
2025 if test -n "${need_dash_r}"; then
2026 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2027 else
2028 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2029 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002030 elif test -d "$withval/lib64"; then
2031 if test -n "${need_dash_r}"; then
2032 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2033 else
2034 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2035 fi
Tim Riceaef73712002-05-11 13:17:42 -07002036 else
2037 if test -n "${need_dash_r}"; then
2038 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2039 else
2040 LDFLAGS="-L${withval} ${LDFLAGS}"
2041 fi
2042 fi
2043 if test -d "$withval/include"; then
2044 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2045 else
2046 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2047 fi
Damien Millera22ba012000-03-02 23:09:20 +11002048 fi
2049 ]
2050)
Tim Rice3d5352e2004-02-12 09:27:21 -08002051LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002052AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002053 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002054 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002055 [
Tim Riceaef73712002-05-11 13:17:42 -07002056 dnl Check default openssl install dir
2057 if test -n "${need_dash_r}"; then
2058 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002059 else
Tim Riceaef73712002-05-11 13:17:42 -07002060 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002061 fi
Tim Riceaef73712002-05-11 13:17:42 -07002062 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002063 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002064 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2065 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002066 [
2067 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2068 ]
2069 )
2070 ]
2071)
2072
Tim Riced730b782002-08-13 18:52:10 -07002073# Determine OpenSSL header version
2074AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002075AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002076 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002077#include <stdio.h>
2078#include <string.h>
2079#include <openssl/opensslv.h>
2080#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002081 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002082 FILE *fd;
2083 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002084
Damien Millera8e06ce2003-11-21 23:48:55 +11002085 fd = fopen(DATA,"w");
2086 if(fd == NULL)
2087 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002088
2089 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2090 exit(1);
2091
2092 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002093 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002094 [
2095 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002096 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002097 ],
2098 [
Tim Rice648f8762011-01-26 12:38:57 -08002099 AC_MSG_RESULT([not found])
2100 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002101 ],
2102 [
2103 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002104 ]
2105)
2106
2107# Determine OpenSSL library version
2108AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002109AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002110 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002111#include <stdio.h>
2112#include <string.h>
2113#include <openssl/opensslv.h>
2114#include <openssl/crypto.h>
2115#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002116 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002117 FILE *fd;
2118 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002119
Damien Millera8e06ce2003-11-21 23:48:55 +11002120 fd = fopen(DATA,"w");
2121 if(fd == NULL)
2122 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002123
2124 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2125 exit(1);
2126
2127 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002128 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002129 [
2130 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002131 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002132 ],
2133 [
Tim Rice648f8762011-01-26 12:38:57 -08002134 AC_MSG_RESULT([not found])
2135 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002136 ],
2137 [
2138 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002139 ]
2140)
Damien Millera22ba012000-03-02 23:09:20 +11002141
Tim Rice648f8762011-01-26 12:38:57 -08002142AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002143 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2144 [ if test "x$withval" = "xno" ; then
2145 openssl_check_nonfatal=1
2146 fi
2147 ]
2148)
2149
Damien Millerec932372002-01-22 22:16:03 +11002150# Sanity check OpenSSL headers
2151AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002152AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002153 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002154#include <string.h>
2155#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002156 ]], [[
2157 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002158 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002159 [
Tim Rice648f8762011-01-26 12:38:57 -08002160 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002161 ],
2162 [
Tim Rice648f8762011-01-26 12:38:57 -08002163 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002164 if test "x$openssl_check_nonfatal" = "x"; then
2165 AC_MSG_ERROR([Your OpenSSL headers do not match your
2166library. Check config.log for details.
2167If you are sure your installation is consistent, you can disable the check
2168by running "./configure --without-openssl-header-check".
2169Also see contrib/findssl.sh for help identifying header/library mismatches.
2170])
2171 else
2172 AC_MSG_WARN([Your OpenSSL headers do not match your
2173library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002174Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002175 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002176 ],
2177 [
2178 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002179 ]
2180)
2181
Darren Tucker639bbe82006-08-20 20:17:53 +10002182AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2183AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002184 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2185 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002186 [
Tim Rice648f8762011-01-26 12:38:57 -08002187 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002188 ],
2189 [
Tim Rice648f8762011-01-26 12:38:57 -08002190 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002191 saved_LIBS="$LIBS"
2192 LIBS="$LIBS -ldl"
2193 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2194 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002195 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2196 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002197 [
Tim Rice648f8762011-01-26 12:38:57 -08002198 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002199 ],
2200 [
Tim Rice648f8762011-01-26 12:38:57 -08002201 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002202 LIBS="$saved_LIBS"
2203 ]
2204 )
2205 ]
2206)
2207
Tim Rice648f8762011-01-26 12:38:57 -08002208AC_CHECK_FUNCS([RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex RSA_get_default_method])
Darren Tuckerebdef762010-12-04 23:20:50 +11002209
Tim Rice648f8762011-01-26 12:38:57 -08002210AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002211 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2212 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002213 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2214 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2215#include <openssl/engine.h>
2216 ]], [[
2217 ENGINE_load_builtin_engines();
2218 ENGINE_register_all_complete();
2219 ]])],
2220 [ AC_MSG_RESULT([yes])
2221 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002222 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002223 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2224 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002225 fi ]
2226)
2227
Darren Tucker129d0bb2005-12-19 17:40:40 +11002228# Check for OpenSSL without EVP_aes_{192,256}_cbc
2229AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002230AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002231 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002232#include <string.h>
2233#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002234 ]], [[
2235 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002236 ]])],
2237 [
Tim Rice648f8762011-01-26 12:38:57 -08002238 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002239 ],
2240 [
Tim Rice648f8762011-01-26 12:38:57 -08002241 AC_MSG_RESULT([yes])
2242 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002243 [libcrypto is missing AES 192 and 256 bit functions])
2244 ]
2245)
2246
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002247AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2248AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002249 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002250#include <string.h>
2251#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002252 ]], [[
2253 if(EVP_DigestUpdate(NULL, NULL,0))
2254 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002255 ]])],
2256 [
Tim Rice648f8762011-01-26 12:38:57 -08002257 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002258 ],
2259 [
Tim Rice648f8762011-01-26 12:38:57 -08002260 AC_MSG_RESULT([no])
2261 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002262 [Define if EVP_DigestUpdate returns void])
2263 ]
2264)
2265
Tim Rice3d5352e2004-02-12 09:27:21 -08002266# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2267# because the system crypt() is more featureful.
2268if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002269 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002270fi
2271
Damien Millera8e06ce2003-11-21 23:48:55 +11002272# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002273# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002274if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002275 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002276fi
2277
Damien Milleraf87af12006-03-15 13:02:28 +11002278# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002279AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002280 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002281AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002282
Damien Miller6af914a2010-09-10 11:39:26 +10002283# Check complete ECC support in OpenSSL
2284AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2285AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002286 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002287#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002288#include <openssl/ecdh.h>
2289#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002290#include <openssl/evp.h>
2291#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002292#include <openssl/opensslv.h>
2293#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2294# error "OpenSSL < 0.9.8g has unreliable ECC code"
2295#endif
Tim Rice648f8762011-01-26 12:38:57 -08002296 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002297 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2298 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002299 ]])],
2300 [
Tim Rice648f8762011-01-26 12:38:57 -08002301 AC_MSG_RESULT([yes])
2302 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002303 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002304 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002305 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002306 ],
2307 [
Tim Rice648f8762011-01-26 12:38:57 -08002308 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002309 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002310 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002311 ]
2312)
Tim Rice648f8762011-01-26 12:38:57 -08002313AC_SUBST([TEST_SSH_ECC])
2314AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002315
Tim Rice99203ec2007-03-26 09:35:28 -07002316saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002317AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002318 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002319 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2320 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002321 [Define if system has libiaf that supports set_id])
2322 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002323])
2324LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002325
2326### Configure cryptographic random number support
2327
2328# Check wheter OpenSSL seeds itself
2329AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002330AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002331 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002332#include <string.h>
2333#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002334 ]], [[
2335 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002336 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002337 [
2338 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002339 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002340 ],
2341 [
Tim Rice648f8762011-01-26 12:38:57 -08002342 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002343 ],
2344 [
2345 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002346 # This is safe, since we will fatal() at runtime if
2347 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002348 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002349 ]
2350)
2351
Damien Millerf22019b2011-05-05 13:48:37 +10002352# PRNGD TCP socket
2353AC_ARG_WITH([prngd-port],
2354 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2355 [
2356 case "$withval" in
2357 no)
2358 withval=""
2359 ;;
2360 [[0-9]]*)
2361 ;;
2362 *)
2363 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2364 ;;
2365 esac
2366 if test ! -z "$withval" ; then
2367 PRNGD_PORT="$withval"
2368 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2369 [Port number of PRNGD/EGD random number socket])
2370 fi
2371 ]
2372)
2373
2374# PRNGD Unix domain socket
2375AC_ARG_WITH([prngd-socket],
2376 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2377 [
2378 case "$withval" in
2379 yes)
2380 withval="/var/run/egd-pool"
2381 ;;
2382 no)
2383 withval=""
2384 ;;
2385 /*)
2386 ;;
2387 *)
2388 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2389 ;;
2390 esac
2391
2392 if test ! -z "$withval" ; then
2393 if test ! -z "$PRNGD_PORT" ; then
2394 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2395 fi
2396 if test ! -r "$withval" ; then
2397 AC_MSG_WARN([Entropy socket is not readable])
2398 fi
2399 PRNGD_SOCKET="$withval"
2400 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2401 [Location of PRNGD/EGD random number socket])
2402 fi
2403 ],
2404 [
2405 # Check for existing socket only if we don't have a random device already
2406 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2407 AC_MSG_CHECKING([for PRNGD/EGD socket])
2408 # Insert other locations here
2409 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2410 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2411 PRNGD_SOCKET="$sock"
2412 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2413 break;
2414 fi
2415 done
2416 if test ! -z "$PRNGD_SOCKET" ; then
2417 AC_MSG_RESULT([$PRNGD_SOCKET])
2418 else
2419 AC_MSG_RESULT([not found])
2420 fi
2421 fi
2422 ]
2423)
2424
2425# Which randomness source do we use?
2426if test ! -z "$PRNGD_PORT" ; then
2427 RAND_MSG="PRNGd port $PRNGD_PORT"
2428elif test ! -z "$PRNGD_SOCKET" ; then
2429 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2430elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2431 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2432 [Define if you want OpenSSL's internally seeded PRNG only])
2433 RAND_MSG="OpenSSL internal ONLY"
2434else
2435 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])
2436fi
2437
Darren Tucker3e6bde42006-08-20 20:03:50 +10002438# Check for PAM libs
2439PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002440AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002441 [ --with-pam Enable PAM support ],
2442 [
2443 if test "x$withval" != "xno" ; then
2444 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2445 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2446 AC_MSG_ERROR([PAM headers not found])
2447 fi
2448
2449 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002450 AC_CHECK_LIB([dl], [dlopen], , )
2451 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2452 AC_CHECK_FUNCS([pam_getenvlist])
2453 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002454 LIBS="$saved_LIBS"
2455
2456 PAM_MSG="yes"
2457
Darren Tucker20e9f972007-03-25 18:26:01 +10002458 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002459 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002460 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002461
Darren Tucker3e6bde42006-08-20 20:03:50 +10002462 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002463 case "$LIBS" in
2464 *-ldl*)
2465 # libdl already in LIBS
2466 ;;
2467 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002468 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002469 ;;
2470 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002471 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002472 fi
2473 ]
2474)
2475
2476# Check for older PAM
2477if test "x$PAM_MSG" = "xyes" ; then
2478 # Check PAM strerror arguments (old PAM)
2479 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002480 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002481#include <stdlib.h>
2482#if defined(HAVE_SECURITY_PAM_APPL_H)
2483#include <security/pam_appl.h>
2484#elif defined (HAVE_PAM_PAM_APPL_H)
2485#include <pam/pam_appl.h>
2486#endif
Tim Rice648f8762011-01-26 12:38:57 -08002487 ]], [[
2488(void)pam_strerror((pam_handle_t *)NULL, -1);
2489 ]])], [AC_MSG_RESULT([no])], [
2490 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002491 [Define if you have an old version of PAM
2492 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002493 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002494 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002495
2496 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002497fi
Damien Miller6c21c512002-01-22 21:57:53 +11002498
Damien Millerd3f6ad22002-06-25 10:24:47 +10002499SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002500AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002501 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002502 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002503 if test -n "$withval" && test "x$withval" != "xno" && \
2504 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002505 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002506 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002507 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002508)
Tim Rice648f8762011-01-26 12:38:57 -08002509AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002510 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002511AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002512
Damien Miller69ff1df2011-06-23 08:30:03 +10002513# Decide which sandbox style to use
2514sandbox_arg=""
2515AC_ARG_WITH([sandbox],
Damien Miller1a91c0f2011-08-17 11:59:25 +10002516 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002517 [
2518 if test "x$withval" = "xyes" ; then
2519 sandbox_arg=""
2520 else
2521 sandbox_arg="$withval"
2522 fi
2523 ]
2524)
2525if test "x$sandbox_arg" = "xsystrace" || \
2526 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002527 test "x$have_systr_policy_kill" != "x1" && \
2528 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002529 SANDBOX_STYLE="systrace"
2530 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002531elif test "x$sandbox_arg" = "xdarwin" || \
2532 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2533 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002534 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2535 "x$ac_cv_header_sandbox_h" != "xyes" && \
2536 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002537 SANDBOX_STYLE="darwin"
2538 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Miller69ff1df2011-06-23 08:30:03 +10002539elif test "x$sandbox_arg" = "xrlimit" || \
2540 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002541 test "x$ac_cv_func_setrlimit" != "xyes" && \
2542 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Damien Miller69ff1df2011-06-23 08:30:03 +10002543 SANDBOX_STYLE="rlimit"
2544 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
2545elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2546 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2547 SANDBOX_STYLE="none"
2548 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2549else
Tim Ricea6e60612011-08-17 21:48:22 -07002550 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10002551fi
2552
Ben Lindstromb5628642000-10-18 00:02:25 +00002553# Cheap hack to ensure NEWS-OS libraries are arranged right.
2554if test ! -z "$SONY" ; then
2555 LIBS="$LIBS -liberty";
2556fi
2557
Damien Miller57f39152005-11-24 19:58:19 +11002558# Check for long long datatypes
2559AC_CHECK_TYPES([long long, unsigned long long, long double])
2560
2561# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002562AC_CHECK_SIZEOF([short int], [2])
2563AC_CHECK_SIZEOF([int], [4])
2564AC_CHECK_SIZEOF([long int], [4])
2565AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002566
Damien Millerfa2bb692002-04-23 23:22:25 +10002567# Sanity check long long for some platforms (AIX)
2568if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2569 ac_cv_sizeof_long_long_int=0
2570fi
2571
Darren Tucker537f1ed2005-10-25 18:38:33 +10002572# compute LLONG_MIN and LLONG_MAX if we don't know them.
2573if test -z "$have_llong_max"; then
2574 AC_MSG_CHECKING([for max value of long long])
2575 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002576 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002577#include <stdio.h>
2578/* Why is this so damn hard? */
2579#ifdef __GNUC__
2580# undef __GNUC__
2581#endif
2582#define __USE_ISOC99
2583#include <limits.h>
2584#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002585#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2586
2587/*
2588 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2589 * we do this the hard way.
2590 */
2591static int
2592fprint_ll(FILE *f, long long n)
2593{
2594 unsigned int i;
2595 int l[sizeof(long long) * 8];
2596
2597 if (n < 0)
2598 if (fprintf(f, "-") < 0)
2599 return -1;
2600 for (i = 0; n != 0; i++) {
2601 l[i] = my_abs(n % 10);
2602 n /= 10;
2603 }
2604 do {
2605 if (fprintf(f, "%d", l[--i]) < 0)
2606 return -1;
2607 } while (i != 0);
2608 if (fprintf(f, " ") < 0)
2609 return -1;
2610 return 0;
2611}
Tim Rice648f8762011-01-26 12:38:57 -08002612 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002613 FILE *f;
2614 long long i, llmin, llmax = 0;
2615
2616 if((f = fopen(DATA,"w")) == NULL)
2617 exit(1);
2618
2619#if defined(LLONG_MIN) && defined(LLONG_MAX)
2620 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2621 llmin = LLONG_MIN;
2622 llmax = LLONG_MAX;
2623#else
2624 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2625 /* This will work on one's complement and two's complement */
2626 for (i = 1; i > llmax; i <<= 1, i++)
2627 llmax = i;
2628 llmin = llmax + 1LL; /* wrap */
2629#endif
2630
2631 /* Sanity check */
2632 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002633 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2634 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002635 fprintf(f, "unknown unknown\n");
2636 exit(2);
2637 }
2638
Darren Tuckerd1450db2006-03-13 19:06:51 +11002639 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002640 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002641 if (fprint_ll(f, llmax) < 0)
2642 exit(4);
2643 if (fclose(f) < 0)
2644 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002645 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002646 ]])],
2647 [
2648 llong_min=`$AWK '{print $1}' conftest.llminmax`
2649 llong_max=`$AWK '{print $2}' conftest.llminmax`
2650
Tim Rice648f8762011-01-26 12:38:57 -08002651 AC_MSG_RESULT([$llong_max])
2652 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002653 [max value of long long calculated by configure])
2654 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002655 AC_MSG_RESULT([$llong_min])
2656 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002657 [min value of long long calculated by configure])
2658 ],
2659 [
Tim Rice648f8762011-01-26 12:38:57 -08002660 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002661 ],
2662 [
2663 AC_MSG_WARN([cross compiling: not checking])
2664 ]
2665 )
2666fi
2667
2668
Damien Millera22ba012000-03-02 23:09:20 +11002669# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002670AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002671 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2672 [[ u_int a; a = 1;]])],
2673 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2674 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002675])
2676if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002677 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002678 have_u_int=1
2679fi
2680
Damien Miller61e50f12000-05-08 20:49:37 +10002681AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002682 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2683 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2684 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2685 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002686])
2687if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002688 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002689 have_intxx_t=1
2690fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002691
2692if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002693 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002694then
2695 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002696 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2697 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002698 [
Tim Rice648f8762011-01-26 12:38:57 -08002699 AC_DEFINE([HAVE_INTXX_T])
2700 AC_MSG_RESULT([yes])
2701 ], [ AC_MSG_RESULT([no])
2702 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002703fi
2704
Damien Miller578783e2000-09-23 14:12:24 +11002705AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002706 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002707#include <sys/types.h>
2708#ifdef HAVE_STDINT_H
2709# include <stdint.h>
2710#endif
2711#include <sys/socket.h>
2712#ifdef HAVE_SYS_BITYPES_H
2713# include <sys/bitypes.h>
2714#endif
Tim Rice648f8762011-01-26 12:38:57 -08002715 ]], [[
2716int64_t a; a = 1;
2717 ]])],
2718 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2719 ])
Damien Miller578783e2000-09-23 14:12:24 +11002720])
2721if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002722 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002723fi
2724
Damien Miller61e50f12000-05-08 20:49:37 +10002725AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002726 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2727 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2728 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2729 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002730])
2731if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002732 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002733 have_u_intxx_t=1
2734fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002735
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002736if test -z "$have_u_intxx_t" ; then
2737 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002738 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2739 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002740 [
Tim Rice648f8762011-01-26 12:38:57 -08002741 AC_DEFINE([HAVE_U_INTXX_T])
2742 AC_MSG_RESULT([yes])
2743 ], [ AC_MSG_RESULT([no])
2744 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002745fi
2746
Damien Miller578783e2000-09-23 14:12:24 +11002747AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002748 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2749 [[ u_int64_t a; a = 1;]])],
2750 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2751 ])
Damien Miller578783e2000-09-23 14:12:24 +11002752])
2753if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002754 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002755 have_u_int64_t=1
2756fi
2757
Tim Rice4cec93f2002-02-26 08:40:48 -08002758if test -z "$have_u_int64_t" ; then
2759 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002760 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2761 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002762 [
Tim Rice648f8762011-01-26 12:38:57 -08002763 AC_DEFINE([HAVE_U_INT64_T])
2764 AC_MSG_RESULT([yes])
2765 ], [ AC_MSG_RESULT([no])
2766 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002767fi
2768
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002769if test -z "$have_u_intxx_t" ; then
2770 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002771 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002772#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002773 ]], [[
2774 uint8_t a;
2775 uint16_t b;
2776 uint32_t c;
2777 a = b = c = 1;
2778 ]])],
2779 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2780 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002781 ])
2782 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002783 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002784 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002785 fi
2786fi
2787
2788if test -z "$have_uintxx_t" ; then
2789 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2791 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002792 [
Tim Rice648f8762011-01-26 12:38:57 -08002793 AC_DEFINE([HAVE_UINTXX_T])
2794 AC_MSG_RESULT([yes])
2795 ], [ AC_MSG_RESULT([no])
2796 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002797fi
2798
Damien Milleredb82922000-06-20 13:25:52 +10002799if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002800 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002801then
2802 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002803 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002804#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002805 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002806 int8_t a; int16_t b; int32_t c;
2807 u_int8_t e; u_int16_t f; u_int32_t g;
2808 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002809 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002810 [
Tim Rice648f8762011-01-26 12:38:57 -08002811 AC_DEFINE([HAVE_U_INTXX_T])
2812 AC_DEFINE([HAVE_INTXX_T])
2813 AC_MSG_RESULT([yes])
2814 ], [AC_MSG_RESULT([no])
2815 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002816fi
2817
Damien Miller58be7382001-09-15 21:31:54 +10002818
2819AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002820 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2821 [[ u_char foo; foo = 125; ]])],
2822 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2823 ])
Damien Miller58be7382001-09-15 21:31:54 +10002824])
2825if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002826 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002827fi
2828
Tim Rice13aae5e2001-10-21 17:53:58 -07002829TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002830
Tim Rice648f8762011-01-26 12:38:57 -08002831AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2832AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002833#include <sys/types.h>
2834#ifdef HAVE_SYS_BITYPES_H
2835#include <sys/bitypes.h>
2836#endif
2837#ifdef HAVE_SYS_STATFS_H
2838#include <sys/statfs.h>
2839#endif
2840#ifdef HAVE_SYS_STATVFS_H
2841#include <sys/statvfs.h>
2842#endif
2843])
Tim Rice4cec93f2002-02-26 08:40:48 -08002844
Tim Rice648f8762011-01-26 12:38:57 -08002845AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002846[#include <sys/types.h>
2847#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002848
Damien Miller61e50f12000-05-08 20:49:37 +10002849AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002850 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2851 [[ size_t foo; foo = 1235; ]])],
2852 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2853 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002854])
2855if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002856 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002857fi
Damien Miller95058511999-12-29 10:36:45 +11002858
Damien Miller615f9392000-05-17 22:53:33 +10002859AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002860 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2861 [[ ssize_t foo; foo = 1235; ]])],
2862 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2863 ])
Damien Miller615f9392000-05-17 22:53:33 +10002864])
2865if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002866 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002867fi
2868
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002869AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002870 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2871 [[ clock_t foo; foo = 1235; ]])],
2872 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2873 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002874])
2875if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002876 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002877fi
2878
Damien Millerb54b40e2000-06-23 08:23:34 +10002879AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002880 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002881#include <sys/types.h>
2882#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002883 ]], [[ sa_family_t foo; foo = 1235; ]])],
2884 [ ac_cv_have_sa_family_t="yes" ],
2885 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002886#include <sys/types.h>
2887#include <sys/socket.h>
2888#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002889 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002890 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002891 [ ac_cv_have_sa_family_t="no" ]
2892 )
Tim Rice648f8762011-01-26 12:38:57 -08002893 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002894])
2895if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002896 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002897 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002898fi
2899
Damien Miller0f91b4e2000-06-18 15:43:25 +10002900AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002901 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2902 [[ pid_t foo; foo = 1235; ]])],
2903 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2904 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002905])
2906if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002907 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002908fi
2909
2910AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002911 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2912 [[ mode_t foo; foo = 1235; ]])],
2913 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2914 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002915])
2916if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002917 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002918fi
2919
Damien Miller61e50f12000-05-08 20:49:37 +10002920
2921AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002922 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002923#include <sys/types.h>
2924#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002925 ]], [[ struct sockaddr_storage s; ]])],
2926 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2927 [ ac_cv_have_struct_sockaddr_storage="no"
2928 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002929])
2930if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002931 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002932 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002933fi
Damien Miller34132e52000-01-14 15:45:46 +11002934
Damien Miller61e50f12000-05-08 20:49:37 +10002935AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002936 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002937#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002938#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002939 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2940 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2941 [ ac_cv_have_struct_sockaddr_in6="no"
2942 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002943])
2944if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002945 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002946 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002947fi
Damien Miller34132e52000-01-14 15:45:46 +11002948
Damien Miller61e50f12000-05-08 20:49:37 +10002949AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002950 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002951#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002952#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002953 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2954 [ ac_cv_have_struct_in6_addr="yes" ],
2955 [ ac_cv_have_struct_in6_addr="no"
2956 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002957])
2958if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002959 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002960 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002961
2962dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002963 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002964 [
2965#ifdef HAVE_SYS_TYPES_H
2966#include <sys/types.h>
2967#endif
2968#include <netinet/in.h>
2969 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002970fi
Damien Miller34132e52000-01-14 15:45:46 +11002971
Damien Miller61e50f12000-05-08 20:49:37 +10002972AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002973 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002974#include <sys/types.h>
2975#include <sys/socket.h>
2976#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002977 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2978 [ ac_cv_have_struct_addrinfo="yes" ],
2979 [ ac_cv_have_struct_addrinfo="no"
2980 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002981])
2982if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002983 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002984 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002985fi
2986
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002987AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002988 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2989 [[ struct timeval tv; tv.tv_sec = 1;]])],
2990 [ ac_cv_have_struct_timeval="yes" ],
2991 [ ac_cv_have_struct_timeval="no"
2992 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002993])
2994if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002995 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002996 have_struct_timeval=1
2997fi
2998
Tim Rice648f8762011-01-26 12:38:57 -08002999AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003000
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003001# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003002if test "x$ac_cv_have_int64_t" = "xno" && \
3003 test "x$ac_cv_sizeof_long_int" != "x8" && \
3004 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003005 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3006 echo "an alternative compiler (I.E., GCC) before continuing."
3007 echo ""
3008 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003009else
3010dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003011 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003012 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003013#include <stdio.h>
3014#include <string.h>
3015#ifdef HAVE_SNPRINTF
3016main()
3017{
3018 char buf[50];
3019 char expected_out[50];
3020 int mazsize = 50 ;
3021#if (SIZEOF_LONG_INT == 8)
3022 long int num = 0x7fffffffffffffff;
3023#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003024 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003025#endif
3026 strcpy(expected_out, "9223372036854775807");
3027 snprintf(buf, mazsize, "%lld", num);
3028 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003029 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003030 exit(0);
3031}
3032#else
3033main() { exit(0); }
3034#endif
Tim Rice648f8762011-01-26 12:38:57 -08003035 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003036 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003037 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003038fi
3039
Damien Miller78315eb2000-09-29 23:01:36 +11003040dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003041OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3042OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3043OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3044OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3045OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3046OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3047OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3048OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3049OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3050OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3051OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3052OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3053OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3054OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3055OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3056OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3057OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003058
3059AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08003060AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003061 [Define if we don't have struct __res_state in resolv.h])],
3062[
3063#include <stdio.h>
3064#if HAVE_SYS_TYPES_H
3065# include <sys/types.h>
3066#endif
3067#include <netinet/in.h>
3068#include <arpa/nameser.h>
3069#include <resolv.h>
3070])
andre2ff7b5d2000-06-03 14:57:40 +00003071
Damien Miller61e50f12000-05-08 20:49:37 +10003072AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3073 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003074 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003075#include <sys/types.h>
3076#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003077 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3078 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3079 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003080])
3081if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003082 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003083fi
3084
Damien Miller61e50f12000-05-08 20:49:37 +10003085AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3086 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003087 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003088#include <sys/types.h>
3089#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003090 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3091 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3092 [ ac_cv_have___ss_family_in_struct_ss="no"
3093 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003094])
3095if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003096 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003097 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003098fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003099
Damien Millerad833b32000-08-23 10:46:23 +10003100AC_CACHE_CHECK([for pw_class field in struct passwd],
3101 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003102 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3103 [[ struct passwd p; p.pw_class = 0; ]])],
3104 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3105 [ ac_cv_have_pw_class_in_struct_passwd="no"
3106 ])
Damien Millerad833b32000-08-23 10:46:23 +10003107])
3108if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003109 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003110 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003111fi
3112
Kevin Steves82456952001-06-22 21:14:18 +00003113AC_CACHE_CHECK([for pw_expire field in struct passwd],
3114 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003115 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3116 [[ struct passwd p; p.pw_expire = 0; ]])],
3117 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3118 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3119 ])
Kevin Steves82456952001-06-22 21:14:18 +00003120])
3121if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003122 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003123 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003124fi
3125
3126AC_CACHE_CHECK([for pw_change field in struct passwd],
3127 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003128 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3129 [[ struct passwd p; p.pw_change = 0; ]])],
3130 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3131 [ ac_cv_have_pw_change_in_struct_passwd="no"
3132 ])
Kevin Steves82456952001-06-22 21:14:18 +00003133])
3134if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003135 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003136 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003137fi
Damien Miller61e50f12000-05-08 20:49:37 +10003138
Tim Rice28bbb0c2002-05-27 17:37:32 -07003139dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003140AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3141 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003142 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003143#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003144#include <sys/socket.h>
3145#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003146 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003147#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003148#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003149exit(1);
3150#endif
3151struct msghdr m;
3152m.msg_accrights = 0;
3153exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003154 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003155 [ ac_cv_have_accrights_in_msghdr="yes" ],
3156 [ ac_cv_have_accrights_in_msghdr="no" ]
3157 )
3158])
3159if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003160 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003161 [Define if your system uses access rights style
3162 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003163fi
3164
Tim Rice648f8762011-01-26 12:38:57 -08003165AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3166AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003167#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003168#include <sys/stat.h>
3169#ifdef HAVE_SYS_TIME_H
3170# include <sys/time.h>
3171#endif
3172#ifdef HAVE_SYS_MOUNT_H
3173#include <sys/mount.h>
3174#endif
3175#ifdef HAVE_SYS_STATVFS_H
3176#include <sys/statvfs.h>
3177#endif
Tim Rice648f8762011-01-26 12:38:57 -08003178 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3179 [ AC_MSG_RESULT([yes]) ],
3180 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003181
Tim Rice648f8762011-01-26 12:38:57 -08003182 AC_MSG_CHECKING([if fsid_t has member val])
3183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003184#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003185#include <sys/statvfs.h>
3186 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3187 [ AC_MSG_RESULT([yes])
3188 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3189 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003190
Tim Rice648f8762011-01-26 12:38:57 -08003191 AC_MSG_CHECKING([if f_fsid has member __val])
3192 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003193#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003194#include <sys/statvfs.h>
3195 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3196 [ AC_MSG_RESULT([yes])
3197 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3198 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003199])
Darren Tucker77001382008-06-09 06:17:53 +10003200
Kevin Stevesa44e0352002-04-07 16:18:03 +00003201AC_CACHE_CHECK([for msg_control field in struct msghdr],
3202 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003203 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003204#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003205#include <sys/socket.h>
3206#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003207 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003208#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003209#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003210exit(1);
3211#endif
3212struct msghdr m;
3213m.msg_control = 0;
3214exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003215 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003216 [ ac_cv_have_control_in_msghdr="yes" ],
3217 [ ac_cv_have_control_in_msghdr="no" ]
3218 )
3219])
3220if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003221 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003222 [Define if your system uses ancillary data style
3223 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003224fi
3225
Damien Miller61e50f12000-05-08 20:49:37 +10003226AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003227 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3228 [[ extern char *__progname; printf("%s", __progname); ]])],
3229 [ ac_cv_libc_defines___progname="yes" ],
3230 [ ac_cv_libc_defines___progname="no"
3231 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003232])
3233if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003234 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003235fi
3236
Kevin Steves4846f4a2002-03-22 18:19:53 +00003237AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003238 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3239 [[ printf("%s", __FUNCTION__); ]])],
3240 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3241 [ ac_cv_cc_implements___FUNCTION__="no"
3242 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003243])
3244if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003245 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003246 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003247fi
3248
3249AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003250 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3251 [[ printf("%s", __func__); ]])],
3252 [ ac_cv_cc_implements___func__="yes" ],
3253 [ ac_cv_cc_implements___func__="no"
3254 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003255])
3256if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003257 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003258fi
3259
Damien Miller57f39152005-11-24 19:58:19 +11003260AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003261 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3262#include <stdarg.h>
3263va_list x,y;
3264 ]], [[ va_copy(x,y); ]])],
3265 [ ac_cv_have_va_copy="yes" ],
3266 [ ac_cv_have_va_copy="no"
3267 ])
Damien Miller57f39152005-11-24 19:58:19 +11003268])
3269if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003270 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003271fi
3272
3273AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003274 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3275#include <stdarg.h>
3276va_list x,y;
3277 ]], [[ __va_copy(x,y); ]])],
3278 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3279 ])
Damien Miller57f39152005-11-24 19:58:19 +11003280])
3281if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003282 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003283fi
3284
Damien Miller4f8e6692001-07-14 13:22:53 +10003285AC_CACHE_CHECK([whether getopt has optreset support],
3286 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003287 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3288 [[ extern int optreset; optreset = 0; ]])],
3289 [ ac_cv_have_getopt_optreset="yes" ],
3290 [ ac_cv_have_getopt_optreset="no"
3291 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003292])
3293if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003294 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003295 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003296fi
Damien Millera22ba012000-03-02 23:09:20 +11003297
Damien Millerecbb26d2000-07-15 14:59:14 +10003298AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003299 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3300[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3301 [ ac_cv_libc_defines_sys_errlist="yes" ],
3302 [ ac_cv_libc_defines_sys_errlist="no"
3303 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003304])
3305if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003306 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003307 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003308fi
3309
3310
Damien Miller11fa2cc2000-08-16 10:35:58 +10003311AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003312 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3313[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3314 [ ac_cv_libc_defines_sys_nerr="yes" ],
3315 [ ac_cv_libc_defines_sys_nerr="no"
3316 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003317])
3318if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003319 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003320fi
3321
Darren Tucker5f88d342003-10-15 16:57:57 +10003322# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003323AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3324 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003325 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003326 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003327 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003328 AC_SEARCH_LIBS([res_query], [resolv])
3329 AC_SEARCH_LIBS([dn_expand], [resolv])
3330 AC_MSG_CHECKING([if res_query will link])
3331 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003332#include <sys/types.h>
3333#include <netinet/in.h>
3334#include <arpa/nameser.h>
3335#include <netdb.h>
3336#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003337 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003338 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003339 ]])],
3340 AC_MSG_RESULT([yes]),
3341 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003342 saved_LIBS="$LIBS"
3343 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003344 AC_MSG_CHECKING([for res_query in -lresolv])
3345 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003346#include <sys/types.h>
3347#include <netinet/in.h>
3348#include <arpa/nameser.h>
3349#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003350#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003351 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003352 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003353 ]])],
3354 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003355 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003356 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003357 ])
Tim Rice648f8762011-01-26 12:38:57 -08003358 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003359 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003360 [#include <sys/types.h>
3361 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003362 AC_CHECK_MEMBER([HEADER.ad],
3363 [AC_DEFINE([HAVE_HEADER_AD], [1],
3364 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003365 [#include <arpa/nameser.h>])
3366 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003367
Tim Rice648f8762011-01-26 12:38:57 -08003368AC_MSG_CHECKING([if struct __res_state _res is an extern])
3369AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003370#include <stdio.h>
3371#if HAVE_SYS_TYPES_H
3372# include <sys/types.h>
3373#endif
3374#include <netinet/in.h>
3375#include <arpa/nameser.h>
3376#include <resolv.h>
3377extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003378 ]], [[ ]])],
3379 [AC_MSG_RESULT([yes])
3380 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003381 [Define if you have struct __res_state _res as an extern])
3382 ],
Tim Rice648f8762011-01-26 12:38:57 -08003383 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003384)
3385
Damien Miller73b42d22006-04-22 21:26:08 +10003386# Check whether user wants SELinux support
3387SELINUX_MSG="no"
3388LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003389AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003390 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003391 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003392 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003393 AC_DEFINE([WITH_SELINUX], [1],
3394 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003395 SELINUX_MSG="yes"
3396 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003397 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3398 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003399 [ LIBSELINUX="-lselinux"
3400 LIBS="$LIBS -lselinux"
3401 ],
Tim Rice648f8762011-01-26 12:38:57 -08003402 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003403 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003404 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003406 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003407 fi ]
3408)
Tim Rice648f8762011-01-26 12:38:57 -08003409AC_SUBST([SSHLIBS])
3410AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003411
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003412# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003413KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003414AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003415 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003416 [ if test "x$withval" != "xno" ; then
3417 if test "x$withval" = "xyes" ; then
3418 KRB5ROOT="/usr/local"
3419 else
3420 KRB5ROOT=${withval}
3421 fi
3422
Tim Rice648f8762011-01-26 12:38:57 -08003423 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003424 KRB5_MSG="yes"
3425
Tim Rice648f8762011-01-26 12:38:57 -08003426 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003427 [$KRB5ROOT/bin/krb5-config],
3428 [$KRB5ROOT/bin:$PATH])
3429 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003430
Tim Rice648f8762011-01-26 12:38:57 -08003431 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003432 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003433 AC_MSG_RESULT([yes])
3434 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003435 [Define this if you want GSSAPI
3436 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003437 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003438 else
Tim Rice648f8762011-01-26 12:38:57 -08003439 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003440 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003441 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003442 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3443 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003444 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003445 AC_MSG_CHECKING([whether we are using Heimdal])
3446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3447 ]], [[ char *tmp = heimdal_version; ]])],
3448 [ AC_MSG_RESULT([yes])
3449 AC_DEFINE([HEIMDAL], [1],
3450 [Define this if you are using the Heimdal
3451 version of Kerberos V5]) ],
3452 [AC_MSG_RESULT([no])
3453 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003454 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003455 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003456 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003457 AC_MSG_CHECKING([whether we are using Heimdal])
3458 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3459 ]], [[ char *tmp = heimdal_version; ]])],
3460 [ AC_MSG_RESULT([yes])
3461 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003462 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003463 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003464 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003465 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003466 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003467 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003468 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003469 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003470
3471 ])
3472 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003473
Tim Rice648f8762011-01-26 12:38:57 -08003474 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3475 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003476 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003477 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3478 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003479 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003480 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3481 $K5LIBS)
3482 ],
3483 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003484
Tim Rice648f8762011-01-26 12:38:57 -08003485 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003486 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003487 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003488 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003489 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003490 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003491 ]
3492 )
3493
3494 oldCPP="$CPPFLAGS"
3495 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003496 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003497 [ CPPFLAGS="$oldCPP" ])
3498
Damien Millera8e06ce2003-11-21 23:48:55 +11003499 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003500 if test ! -z "$need_dash_r" ; then
3501 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3502 fi
3503 if test ! -z "$blibpath" ; then
3504 blibpath="$blibpath:${KRB5ROOT}/lib"
3505 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003506
Tim Rice648f8762011-01-26 12:38:57 -08003507 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3508 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3509 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003510
3511 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003512 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3513 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003514 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003515 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003516)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003517
Damien Millera22ba012000-03-02 23:09:20 +11003518# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003519
Damien Millerf58c6722002-05-13 13:15:42 +10003520PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003521AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003522 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003523 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003524 if test -n "$withval" && test "x$withval" != "xno" && \
3525 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003526 PRIVSEP_PATH=$withval
3527 fi
3528 ]
3529)
Tim Rice648f8762011-01-26 12:38:57 -08003530AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003531
Tim Rice648f8762011-01-26 12:38:57 -08003532AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003533 [ --with-xauth=PATH Specify path to xauth program ],
3534 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003535 if test -n "$withval" && test "x$withval" != "xno" && \
3536 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003537 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003538 fi
3539 ],
3540 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003541 TestPath="$PATH"
3542 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3543 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3544 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3545 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003546 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003547 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003548 xauth_path="/usr/openwin/bin/xauth"
3549 fi
3550 ]
3551)
3552
Damien Miller7d901272003-01-13 16:55:22 +11003553STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003554AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003555 [ --disable-strip Disable calling strip(1) on install],
3556 [
3557 if test "x$enableval" = "xno" ; then
3558 STRIP_OPT=
3559 fi
3560 ]
3561)
Tim Rice648f8762011-01-26 12:38:57 -08003562AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003563
Damien Millera19cf472000-11-29 13:28:50 +11003564if test -z "$xauth_path" ; then
3565 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003566 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003567else
Tim Rice648f8762011-01-26 12:38:57 -08003568 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003569 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003570 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003571 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003572fi
Damien Millera22ba012000-03-02 23:09:20 +11003573
Tim Rice90f42b02011-06-02 18:17:49 -07003574dnl # --with-maildir=/path/to/mail gets top priority.
3575dnl # if maildir is set in the platform case statement above we use that.
3576dnl # Otherwise we run a program to get the dir from system headers.
3577dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3578dnl # If we find _PATH_MAILDIR we do nothing because that is what
3579dnl # session.c expects anyway. Otherwise we set to the value found
3580dnl # stripping any trailing slash. If for some strage reason our program
3581dnl # does not find what it needs, we default to /var/spool/mail.
3582# Check for mail directory
3583AC_ARG_WITH([maildir],
3584 [ --with-maildir=/path/to/mail Specify your system mail directory],
3585 [
3586 if test "X$withval" != X && test "x$withval" != xno && \
3587 test "x${withval}" != xyes; then
3588 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3589 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3590 fi
3591 ],[
3592 if test "X$maildir" != "X"; then
3593 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3594 else
3595 AC_MSG_CHECKING([Discovering system mail directory])
3596 AC_RUN_IFELSE(
3597 [AC_LANG_PROGRAM([[
3598#include <stdio.h>
3599#include <string.h>
3600#ifdef HAVE_PATHS_H
3601#include <paths.h>
3602#endif
3603#ifdef HAVE_MAILLOCK_H
3604#include <maillock.h>
3605#endif
3606#define DATA "conftest.maildir"
3607 ]], [[
3608 FILE *fd;
3609 int rc;
3610
3611 fd = fopen(DATA,"w");
3612 if(fd == NULL)
3613 exit(1);
3614
3615#if defined (_PATH_MAILDIR)
3616 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3617 exit(1);
3618#elif defined (MAILDIR)
3619 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3620 exit(1);
3621#elif defined (_PATH_MAIL)
3622 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3623 exit(1);
3624#else
3625 exit (2);
3626#endif
3627
3628 exit(0);
3629 ]])],
3630 [
3631 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3632 maildir=`awk -F: '{print $2}' conftest.maildir \
3633 | sed 's|/$||'`
3634 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3635 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3636 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3637 fi
3638 ],
3639 [
3640 if test "X$ac_status" = "X2";then
3641# our test program didn't find it. Default to /var/spool/mail
3642 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3643 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3644 else
3645 AC_MSG_RESULT([*** not found ***])
3646 fi
3647 ],
3648 [
3649 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3650 ]
3651 )
3652 fi
3653 ]
3654) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003655
Darren Tucker623d92f2004-09-12 22:36:15 +10003656if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003657 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3658 disable_ptmx_check=yes
3659fi
Damien Millera22ba012000-03-02 23:09:20 +11003660if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003661 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003662 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003663 [
Tim Rice648f8762011-01-26 12:38:57 -08003664 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003665 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003666 have_dev_ptmx=1
3667 ]
3668 )
3669 fi
Damien Millera22ba012000-03-02 23:09:20 +11003670fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003671
Darren Tucker623d92f2004-09-12 22:36:15 +10003672if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003673 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003674 [
Tim Rice648f8762011-01-26 12:38:57 -08003675 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003676 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003677 have_dev_ptc=1
3678 ]
3679 )
3680else
3681 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3682fi
Damien Miller204ad072000-03-02 23:56:12 +11003683
Damien Millera22ba012000-03-02 23:09:20 +11003684# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003685AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003686 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003687 [
Damien Miller897741e2001-04-16 10:41:46 +10003688 case "$withval" in
3689 man|cat|doc)
3690 MANTYPE=$withval
3691 ;;
3692 *)
Tim Rice648f8762011-01-26 12:38:57 -08003693 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003694 ;;
3695 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003696 ]
3697)
Ben Lindstrombc709922001-04-18 18:04:21 +00003698if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003699 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003700 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003701 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3702 MANTYPE=doc
3703 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3704 MANTYPE=man
3705 else
3706 MANTYPE=cat
3707 fi
3708fi
Tim Rice648f8762011-01-26 12:38:57 -08003709AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003710if test "$MANTYPE" = "doc"; then
3711 mansubdir=man;
3712else
3713 mansubdir=$MANTYPE;
3714fi
Tim Rice648f8762011-01-26 12:38:57 -08003715AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003716
Damien Millera22ba012000-03-02 23:09:20 +11003717# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003718MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003719AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003720 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003721 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003722 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003723 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003724 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003725 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003726 fi
3727 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003728)
3729
Damien Millera22ba012000-03-02 23:09:20 +11003730# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003731AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003732 [ --without-shadow Disable shadow password support],
3733 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003734 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003735 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003736 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003737 fi
3738 ]
3739)
3740
Damien Miller1f335fb2000-06-26 11:31:33 +10003741if test -z "$disable_shadow" ; then
3742 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003743 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003744#include <sys/types.h>
3745#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003746struct spwd sp;
3747 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3748 [ sp_expire_available=yes ], [
3749 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003750
3751 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003752 AC_MSG_RESULT([yes])
3753 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003754 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003755 else
Tim Rice648f8762011-01-26 12:38:57 -08003756 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003757 fi
3758fi
3759
Damien Millera22ba012000-03-02 23:09:20 +11003760# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003761if test ! -z "$IPADDR_IN_DISPLAY" ; then
3762 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003763 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003764 [Define if you need to use IP address
3765 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003766else
Damien Millera8e06ce2003-11-21 23:48:55 +11003767 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003768 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003769 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3770 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003771 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003772 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003773 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003774 fi
3775 ]
3776 )
3777fi
Damien Miller76112de1999-12-21 11:18:08 +11003778
Darren Tuckere1a790d2003-09-16 11:52:19 +10003779# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003780AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003781 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003782 [ if test "x$enableval" = "xno"; then
3783 AC_MSG_NOTICE([/etc/default/login handling disabled])
3784 etc_default_login=no
3785 else
3786 etc_default_login=yes
3787 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003788 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3789 then
3790 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3791 etc_default_login=no
3792 else
3793 etc_default_login=yes
3794 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003795)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003796
Darren Tucker2f9573d2005-02-10 22:28:54 +11003797if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003798 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003799 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003800 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003801 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003802 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003803 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003804fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003805
Tim Rice43a1c132002-04-17 21:19:14 -07003806dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003807if test $ac_cv_func_login_getcapbool = "yes" && \
3808 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003809 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003810fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003811
Damien Millera22ba012000-03-02 23:09:20 +11003812# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003813SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003814AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003815 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003816 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003817 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003818 AC_MSG_WARN([
3819--with-default-path=PATH has no effect on this system.
3820Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003821 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003822 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003823 AC_MSG_WARN([
3824--with-default-path=PATH will only be used if PATH is not defined in
3825$external_path_file .])
3826 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003827 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003828 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003829 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003830 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003831 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3832 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003833 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003834 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003835 AC_MSG_WARN([
3836If PATH is defined in $external_path_file, ensure the path to scp is included,
3837otherwise scp will not work.])
3838 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003839 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003840 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003841/* find out what STDPATH is */
3842#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003843#ifdef HAVE_PATHS_H
3844# include <paths.h>
3845#endif
3846#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003847# ifdef _PATH_USERPATH /* Irix */
3848# define _PATH_STDPATH _PATH_USERPATH
3849# else
3850# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3851# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003852#endif
3853#include <sys/types.h>
3854#include <sys/stat.h>
3855#include <fcntl.h>
3856#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003857 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003858 FILE *fd;
3859 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003860
Tim Rice59ea0a02001-03-10 13:50:45 -08003861 fd = fopen(DATA,"w");
3862 if(fd == NULL)
3863 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003864
Tim Rice59ea0a02001-03-10 13:50:45 -08003865 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3866 exit(1);
3867
3868 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003869 ]])],
3870 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003871 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3872 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3873 )
3874# make sure $bindir is in USER_PATH so scp will work
3875 t_bindir=`eval echo ${bindir}`
3876 case $t_bindir in
3877 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3878 esac
3879 case $t_bindir in
3880 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3881 esac
3882 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3883 if test $? -ne 0 ; then
3884 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3885 if test $? -ne 0 ; then
3886 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003887 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003888 fi
3889 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003890 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003891)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003892if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003893 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3894 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003895fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003896
Damien Millera18bbd32002-05-13 10:48:57 +10003897# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003898AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003899 [ --with-superuser-path= Specify different path for super-user],
3900 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003901 if test -n "$withval" && test "x$withval" != "xno" && \
3902 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003903 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003904 [Define if you want a different $PATH
3905 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003906 superuser_path=$withval
3907 fi
3908 ]
3909)
3910
3911
Damien Miller61e50f12000-05-08 20:49:37 +10003912AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003913IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003914AC_ARG_WITH(4in6,
3915 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3916 [
3917 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003918 AC_MSG_RESULT([yes])
3919 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003920 [Detect IPv4 in IPv6 mapped addresses
3921 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003922 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003923 else
Tim Rice648f8762011-01-26 12:38:57 -08003924 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003925 fi
Tim Rice648f8762011-01-26 12:38:57 -08003926 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003927 if test "x$inet6_default_4in6" = "xyes"; then
3928 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003929 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003930 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003931 else
3932 AC_MSG_RESULT([no (default)])
3933 fi
3934 ]
3935)
3936
Damien Miller60396b02001-02-18 17:01:00 +11003937# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003938BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003939AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003940 [ --with-bsd-auth Enable BSD auth support],
3941 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003942 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003943 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003944 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003945 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003946 fi
3947 ]
3948)
3949
Damien Millera22ba012000-03-02 23:09:20 +11003950# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003951piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003952# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003953if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003954 piddir=`eval echo ${sysconfdir}`
3955 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003956 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003957 esac
3958fi
3959
Tim Rice648f8762011-01-26 12:38:57 -08003960AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003961 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3962 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003963 if test -n "$withval" && test "x$withval" != "xno" && \
3964 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003965 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003966 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003967 AC_MSG_WARN([** no $piddir directory on this system **])
3968 fi
3969 fi
3970 ]
3971)
3972
Tim Rice648f8762011-01-26 12:38:57 -08003973AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3974 [Specify location of ssh.pid])
3975AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003976
andre2ff7b5d2000-06-03 14:57:40 +00003977dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003978AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003979 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003980 [
3981 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003982 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003983 fi
3984 ]
andre2ff7b5d2000-06-03 14:57:40 +00003985)
Tim Rice648f8762011-01-26 12:38:57 -08003986AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003987 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003988 [
3989 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003990 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003991 fi
3992 ]
andre2ff7b5d2000-06-03 14:57:40 +00003993)
Tim Rice648f8762011-01-26 12:38:57 -08003994AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00003995 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003996 [
3997 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003998 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003999 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004000 fi
4001 ]
andre2ff7b5d2000-06-03 14:57:40 +00004002)
Tim Rice648f8762011-01-26 12:38:57 -08004003AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004004 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004005 [
4006 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004007 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004008 fi
4009 ]
andre2ff7b5d2000-06-03 14:57:40 +00004010)
Tim Rice648f8762011-01-26 12:38:57 -08004011AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004012 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004013 [
4014 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004015 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004016 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004017 fi
4018 ]
andre2ff7b5d2000-06-03 14:57:40 +00004019)
Tim Rice648f8762011-01-26 12:38:57 -08004020AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004021 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004022 [
4023 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004024 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004025 fi
4026 ]
andre2ff7b5d2000-06-03 14:57:40 +00004027)
Tim Rice648f8762011-01-26 12:38:57 -08004028AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004029 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004030 [
4031 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004032 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004033 [Define if you don't want to use pututline()
4034 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004035 fi
4036 ]
andre2ff7b5d2000-06-03 14:57:40 +00004037)
Tim Rice648f8762011-01-26 12:38:57 -08004038AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004039 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004040 [
4041 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004042 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004043 [Define if you don't want to use pututxline()
4044 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004045 fi
4046 ]
andre2ff7b5d2000-06-03 14:57:40 +00004047)
Tim Rice648f8762011-01-26 12:38:57 -08004048AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004049 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004050 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004051 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004052 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004053 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004054 conf_lastlog_location=$withval
4055 fi
4056 ]
4057)
andre2ff7b5d2000-06-03 14:57:40 +00004058
4059dnl lastlog, [uw]tmpx? detection
4060dnl NOTE: set the paths in the platform section to avoid the
4061dnl need for command-line parameters
4062dnl lastlog and [uw]tmp are subject to a file search if all else fails
4063
4064dnl lastlog detection
4065dnl NOTE: the code itself will detect if lastlog is a directory
4066AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004067AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004068#include <sys/types.h>
4069#include <utmp.h>
4070#ifdef HAVE_LASTLOG_H
4071# include <lastlog.h>
4072#endif
Damien Miller2994e082000-06-04 15:51:47 +10004073#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004074# include <paths.h>
4075#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004076#ifdef HAVE_LOGIN_H
4077# include <login.h>
4078#endif
Tim Rice648f8762011-01-26 12:38:57 -08004079 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4080 [ AC_MSG_RESULT([yes]) ],
4081 [
4082 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004083 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004084 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004085#include <sys/types.h>
4086#include <utmp.h>
4087#ifdef HAVE_LASTLOG_H
4088# include <lastlog.h>
4089#endif
4090#ifdef HAVE_PATHS_H
4091# include <paths.h>
4092#endif
Tim Rice648f8762011-01-26 12:38:57 -08004093 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4094 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004095 [
Tim Rice648f8762011-01-26 12:38:57 -08004096 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004097 system_lastlog_path=no
4098 ])
Tim Rice648f8762011-01-26 12:38:57 -08004099])
Damien Miller2994e082000-06-04 15:51:47 +10004100
andre2ff7b5d2000-06-03 14:57:40 +00004101if test -z "$conf_lastlog_location"; then
4102 if test x"$system_lastlog_path" = x"no" ; then
4103 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004104 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004105 conf_lastlog_location=$f
4106 fi
4107 done
4108 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004109 AC_MSG_WARN([** Cannot find lastlog **])
4110 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004111 fi
4112 fi
4113fi
4114
4115if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004116 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004117 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004118fi
andre2ff7b5d2000-06-03 14:57:40 +00004119
4120dnl utmp detection
4121AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004122AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004123#include <sys/types.h>
4124#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004125#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004126# include <paths.h>
4127#endif
Tim Rice648f8762011-01-26 12:38:57 -08004128 ]], [[ char *utmp = UTMP_FILE; ]])],
4129 [ AC_MSG_RESULT([yes]) ],
4130 [ AC_MSG_RESULT([no])
4131 system_utmp_path=no
4132])
andre2ff7b5d2000-06-03 14:57:40 +00004133if test -z "$conf_utmp_location"; then
4134 if test x"$system_utmp_path" = x"no" ; then
4135 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4136 if test -f $f ; then
4137 conf_utmp_location=$f
4138 fi
4139 done
4140 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004141 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004142 fi
4143 fi
4144fi
4145if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004146 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004147 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004148fi
andre2ff7b5d2000-06-03 14:57:40 +00004149
4150dnl wtmp detection
4151AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004152AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004153#include <sys/types.h>
4154#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004155#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004156# include <paths.h>
4157#endif
Tim Rice648f8762011-01-26 12:38:57 -08004158 ]], [[ char *wtmp = WTMP_FILE; ]])],
4159 [ AC_MSG_RESULT([yes]) ],
4160 [ AC_MSG_RESULT([no])
4161 system_wtmp_path=no
4162])
andre2ff7b5d2000-06-03 14:57:40 +00004163if test -z "$conf_wtmp_location"; then
4164 if test x"$system_wtmp_path" = x"no" ; then
4165 for f in /usr/adm/wtmp /var/log/wtmp; do
4166 if test -f $f ; then
4167 conf_wtmp_location=$f
4168 fi
4169 done
4170 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004171 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004172 fi
4173 fi
4174fi
4175if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004176 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004177 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004178fi
andre2ff7b5d2000-06-03 14:57:40 +00004179
4180
andre2ff7b5d2000-06-03 14:57:40 +00004181dnl wtmpx detection
4182AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004183AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004184#include <sys/types.h>
4185#include <utmp.h>
4186#ifdef HAVE_UTMPX_H
4187#include <utmpx.h>
4188#endif
Damien Miller2994e082000-06-04 15:51:47 +10004189#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004190# include <paths.h>
4191#endif
Tim Rice648f8762011-01-26 12:38:57 -08004192 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4193 [ AC_MSG_RESULT([yes]) ],
4194 [ AC_MSG_RESULT([no])
4195 system_wtmpx_path=no
4196])
andre2ff7b5d2000-06-03 14:57:40 +00004197if test -z "$conf_wtmpx_location"; then
4198 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004199 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004200 fi
4201else
Tim Rice648f8762011-01-26 12:38:57 -08004202 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004203 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004204fi
andre2ff7b5d2000-06-03 14:57:40 +00004205
Damien Miller4018c192000-04-30 09:30:44 +10004206
Damien Miller29ea30d2000-03-17 10:54:15 +11004207if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004208 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4209 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004210fi
4211
Darren Tucker7da23cb2005-08-03 00:20:15 +10004212dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4213dnl Add now.
4214CFLAGS="$CFLAGS $werror_flags"
4215
Darren Tucker627337d2010-04-10 22:58:01 +10004216if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4217 TEST_SSH_IPV6=no
4218else
4219 TEST_SSH_IPV6=yes
4220fi
Tim Rice648f8762011-01-26 12:38:57 -08004221AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4222AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004223
Damien Millerbac2d8a2000-09-05 16:13:06 +11004224AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004225AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4226 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004227 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004228AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004229
Damien Miller7b22d652000-06-18 14:07:04 +10004230# Print summary of options
4231
Damien Miller7b22d652000-06-18 14:07:04 +10004232# Someone please show me a better way :)
4233A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4234B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4235C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4236D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004237E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004238F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004239G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004240H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4241I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4242J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004243
4244echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004245echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004246echo " User binaries: $B"
4247echo " System binaries: $C"
4248echo " Configuration files: $D"
4249echo " Askpass program: $E"
4250echo " Manual pages: $F"
4251echo " PID file: $G"
4252echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004253if test "x$external_path_file" = "x/etc/login.conf" ; then
4254echo " At runtime, sshd will use the path defined in $external_path_file"
4255echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004256else
Damien Millerf58c6722002-05-13 13:15:42 +10004257echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004258 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004259echo " (If PATH is set in $external_path_file it will be used instead. If"
4260echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4261 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004262fi
Damien Millera18bbd32002-05-13 10:48:57 +10004263if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004264echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004265fi
Damien Millerf58c6722002-05-13 13:15:42 +10004266echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004267echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004268echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004269echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004270echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004271echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004272echo " S/KEY support: $SKEY_MSG"
4273echo " TCP Wrappers support: $TCPW_MSG"
4274echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004275echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004276echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004277echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004278echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004279echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4280echo " BSD Auth support: $BSD_AUTH_MSG"
4281echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004282echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004283
Damien Miller7b22d652000-06-18 14:07:04 +10004284echo ""
4285
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004286echo " Host: ${host}"
4287echo " Compiler: ${CC}"
4288echo " Compiler flags: ${CFLAGS}"
4289echo "Preprocessor flags: ${CPPFLAGS}"
4290echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004291echo " Libraries: ${LIBS}"
4292if test ! -z "${SSHDLIBS}"; then
4293echo " +for sshd: ${SSHDLIBS}"
4294fi
Damien Miller71adf122011-01-25 12:16:15 +11004295if test ! -z "${SSHLIBS}"; then
4296echo " +for ssh: ${SSHLIBS}"
4297fi
Damien Miller7b22d652000-06-18 14:07:04 +10004298
4299echo ""
4300
Tim Rice6f1f7582004-05-30 21:38:51 -07004301if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004302 echo "SVR4 style packages are supported with \"make package\""
4303 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004304fi
4305
Damien Miller82cf0ce2000-12-20 13:34:48 +11004306if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004307 echo "PAM is enabled. You may need to install a PAM control file "
4308 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004309 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004310 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004311 echo ""
4312fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004313
Damien Millerb4097182004-05-23 14:09:40 +10004314if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004315 echo "WARNING: the operating system that you are using does not"
4316 echo "appear to support getpeereid(), getpeerucred() or the"
4317 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4318 echo "enforce security checks to prevent unauthorised connections to"
4319 echo "ssh-agent. Their absence increases the risk that a malicious"
4320 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004321 echo ""
4322fi
4323
Darren Tuckerd9f88912005-02-20 21:01:48 +11004324if test "$AUDIT_MODULE" = "bsm" ; then
4325 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4326 echo "See the Solaris section in README.platform for details."
4327fi