blob: 6bf30e82c585e2e276ea9d08afa401659dda78b3 [file] [log] [blame]
Damien Millerc96d8532014-01-25 13:12:28 +11001# $Id: configure.ac,v 1.561 2014/01/25 02:12:29 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Damien Millerc96d8532014-01-25 13:12:28 +110018AC_REVISION($Revision: 1.561 $)
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])
Damien Millere0956e32012-04-04 11:27:54 +1000119AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [
120 #include <sys/types.h>
121 #include <linux/prctl.h>
122])
Damien Miller868ea1e2014-01-17 16:47:04 +1100123
Darren Tuckerb7918af2008-03-09 11:34:23 +1100124use_stack_protector=1
Darren Tuckerfd994372014-01-17 09:53:24 +1100125use_toolchain_hardening=1
Tim Rice648f8762011-01-26 12:38:57 -0800126AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100127 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100128 if test "x$withval" = "xno"; then
129 use_stack_protector=0
130 fi ])
Darren Tuckerfd994372014-01-17 09:53:24 +1100131AC_ARG_WITH([hardening],
132 [ --without-hardening Don't use toolchain hardening flags], [
133 if test "x$withval" = "xno"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100134 use_toolchain_hardening=0
135 fi ])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100136
Darren Tuckerfd994372014-01-17 09:53:24 +1100137# We use -Werror for the tests only so that we catch warnings like "this is
138# on by default" for things like -fPIE.
139AC_MSG_CHECKING([if $CC supports -Werror])
140saved_CFLAGS="$CFLAGS"
141CFLAGS="$CFLAGS -Werror"
142AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
143 [ AC_MSG_RESULT([yes])
144 WERROR="-Werror"],
145 [ AC_MSG_RESULT([no])
146 WERROR="" ]
147)
148CFLAGS="$saved_CFLAGS"
Damien Miller134d02a2011-01-12 16:00:37 +1100149
Damien Millera8e06ce2003-11-21 23:48:55 +1100150if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100151 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
152 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option])
Damien Millerb1763622011-05-20 11:45:25 +1000153 OSSH_CHECK_CFLAG_COMPILE([-Wall])
154 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
155 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
156 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
157 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000158 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000159 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
160 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
161 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100162 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100163 if test "x$use_toolchain_hardening" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100164 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
165 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
166 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
Damien Miller5c2ff5e2014-01-22 21:30:12 +1100167 # NB. -ftrapv expects certain support functions to be present in
168 # the compiler library (libgcc or similar) to detect integer operations
169 # that can overflow. We must check that the result of enabling it
170 # actually links. The test program compiled/linked includes a number
171 # of integer operations that should exercise this.
172 OSSH_CHECK_CFLAG_LINK([-ftrapv])
Darren Tuckerfd994372014-01-17 09:53:24 +1100173 fi
Tim Rice648f8762011-01-26 12:38:57 -0800174 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100175 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700176 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000177 1.*) no_attrib_nonnull=1 ;;
178 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000179 no_attrib_nonnull=1
180 ;;
181 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100182 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700183 esac
Tim Rice648f8762011-01-26 12:38:57 -0800184 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000185
Tim Rice648f8762011-01-26 12:38:57 -0800186 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000187 saved_CFLAGS="$CFLAGS"
188 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800189 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
190 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
191 [ AC_MSG_RESULT([yes]) ],
192 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000193 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800194 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000195
Darren Tuckerb7918af2008-03-09 11:34:23 +1100196 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100197 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100198 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100199 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100200 for t in -fstack-protector-strong -fstack-protector-all \
201 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800202 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100203 saved_CFLAGS="$CFLAGS"
204 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100205 CFLAGS="$CFLAGS $t -Werror"
206 LDFLAGS="$LDFLAGS $t -Werror"
207 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800208 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
209 [[
210 char x[256];
211 snprintf(x, sizeof(x), "XXX");
212 ]])],
213 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100214 CFLAGS="$saved_CFLAGS $t"
215 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800216 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100217 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800218 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
219 [[
220 char x[256];
221 snprintf(x, sizeof(x), "XXX");
222 ]])],
223 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100224 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800225 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100226 [ AC_MSG_WARN([cross compiling: cannot test])
227 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100228 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100229 ],
Tim Rice648f8762011-01-26 12:38:57 -0800230 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100231 )
232 CFLAGS="$saved_CFLAGS"
233 LDFLAGS="$saved_LDFLAGS"
234 done
235 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100236
Darren Tucker67b37032005-06-03 17:58:31 +1000237 if test -z "$have_llong_max"; then
238 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
239 unset ac_cv_have_decl_LLONG_MAX
240 saved_CFLAGS="$CFLAGS"
241 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800242 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000243 [have_llong_max=1],
244 [CFLAGS="$saved_CFLAGS"],
245 [#include <limits.h>]
246 )
247 fi
Damien Miller166bd442000-03-16 10:48:25 +1100248fi
249
Darren Tucker951b53b2013-02-08 11:50:09 +1100250AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
251AC_COMPILE_IFELSE(
252 [AC_LANG_PROGRAM([[
253#include <stdlib.h>
254__attribute__((__unused__)) static void foo(void){return;}]],
255 [[ exit(0); ]])],
256 [ AC_MSG_RESULT([yes]) ],
257 [ AC_MSG_RESULT([no])
258 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
259 [compiler does not accept __attribute__ on return types]) ]
260)
261
Darren Tucker391de5c2007-04-29 14:49:21 +1000262if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800263 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000264fi
265
Tim Rice648f8762011-01-26 12:38:57 -0800266AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800267 [ --without-rpath Disable auto-added -R linker paths],
268 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800269 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800270 need_dash_r=""
271 fi
272 if test "x$withval" = "xyes" ; then
273 need_dash_r=1
274 fi
275 ]
276)
277
Tim Rice1cfab232006-10-03 09:34:35 -0700278# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800279AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700280 [ --with-cflags Specify additional flags to pass to compiler],
281 [
282 if test -n "$withval" && test "x$withval" != "xno" && \
283 test "x${withval}" != "xyes"; then
284 CFLAGS="$CFLAGS $withval"
285 fi
286 ]
287)
Tim Rice648f8762011-01-26 12:38:57 -0800288AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700289 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
290 [
291 if test -n "$withval" && test "x$withval" != "xno" && \
292 test "x${withval}" != "xyes"; then
293 CPPFLAGS="$CPPFLAGS $withval"
294 fi
295 ]
296)
Tim Rice648f8762011-01-26 12:38:57 -0800297AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700298 [ --with-ldflags Specify additional flags to pass to linker],
299 [
300 if test -n "$withval" && test "x$withval" != "xno" && \
301 test "x${withval}" != "xyes"; then
302 LDFLAGS="$LDFLAGS $withval"
303 fi
304 ]
305)
Tim Rice648f8762011-01-26 12:38:57 -0800306AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700307 [ --with-libs Specify additional libraries to link with],
308 [
309 if test -n "$withval" && test "x$withval" != "xno" && \
310 test "x${withval}" != "xyes"; then
311 LIBS="$LIBS $withval"
312 fi
313 ]
314)
Tim Rice648f8762011-01-26 12:38:57 -0800315AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700316 [ --with-Werror Build main code with -Werror],
317 [
318 if test -n "$withval" && test "x$withval" != "xno"; then
319 werror_flags="-Werror"
320 if test "x${withval}" != "xyes"; then
321 werror_flags="$withval"
322 fi
323 fi
324 ]
325)
326
Tim Rice648f8762011-01-26 12:38:57 -0800327AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100328 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700329 bstring.h \
330 crypt.h \
331 crypto/sha2.h \
332 dirent.h \
333 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100334 elf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700335 features.h \
336 fcntl.h \
337 floatingpoint.h \
338 getopt.h \
339 glob.h \
340 ia.h \
341 iaf.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100342 inttypes.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700343 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000344 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700345 login.h \
346 maillock.h \
347 ndir.h \
348 net/if_tun.h \
349 netdb.h \
350 netgroup.h \
351 pam/pam_appl.h \
352 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000353 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700354 pty.h \
355 readpassphrase.h \
356 rpc/types.h \
357 security/pam_appl.h \
358 sha2.h \
359 shadow.h \
360 stddef.h \
361 stdint.h \
362 string.h \
363 strings.h \
364 sys/audit.h \
365 sys/bitypes.h \
366 sys/bsdtty.h \
Damien Millerc96d8532014-01-25 13:12:28 +1100367 sys/capability.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700368 sys/cdefs.h \
369 sys/dir.h \
370 sys/mman.h \
371 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000372 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700373 sys/prctl.h \
374 sys/pstat.h \
375 sys/select.h \
376 sys/stat.h \
377 sys/stream.h \
378 sys/stropts.h \
379 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000380 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700381 sys/sysmacros.h \
382 sys/time.h \
383 sys/timers.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700384 time.h \
385 tmpdir.h \
386 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700387 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700388 unistd.h \
389 usersec.h \
390 util.h \
391 utime.h \
392 utmp.h \
393 utmpx.h \
394 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800395])
Tim Rice1cfab232006-10-03 09:34:35 -0700396
397# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800398AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700399#ifdef HAVE_SYS_TIME_H
400# include <sys/time.h>
401#endif
402])
403
404# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800405AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700406#ifdef HAVE_SYS_STREAM_H
407# include <sys/stream.h>
408#endif
409])
410
411# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800412AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700413#include <sys/types.h>
414])
415
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000416# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800417AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000418#include <sys/param.h>
419])
420
Darren Tuckeref4901c2013-06-03 01:59:13 +1000421# Android requires sys/socket.h to be included before sys/un.h
422AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000423#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000424#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000425])
426
Damien Miller1b06dc32006-08-31 03:24:41 +1000427# Messages for features tested for in target-specific section
428SIA_MSG="no"
429SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100430SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000431
Damien Millera22ba012000-03-02 23:09:20 +1100432# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100433case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100434*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000435 # Some versions of VAC won't allow macro redefinitions at
436 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
437 # particularly with older versions of vac or xlc.
438 # It also throws errors about null macro argments, but these are
439 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800440 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000441 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800442 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000443#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800444#define testmacro bar]],
445 [[ exit(0); ]])],
446 [ AC_MSG_RESULT([yes]) ],
447 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000448 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
449 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
450 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
451 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
452 ]
453 )
454
Damien Millera8e06ce2003-11-21 23:48:55 +1100455 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000456 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800457 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100458 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000459 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000460 if test "$GCC" = "yes"; then
461 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
462 else
463 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
464 fi
465 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000466 if (test -z "$blibflags"); then
467 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800468 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
469 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000470 fi
471 done
472 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800473 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000474 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
475 else
Tim Rice648f8762011-01-26 12:38:57 -0800476 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000477 fi
478 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000479 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800480 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700481 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800482 [AC_CHECK_LIB([s], [authenticate],
483 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700484 LIBS="$LIBS -ls"
485 ])
486 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100487 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100488 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100489 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000490 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800491 AC_CHECK_DECLS([loginfailed],
492 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
494 [[ (void)loginfailed("user","host","tty",0); ]])],
495 [AC_MSG_RESULT([yes])
496 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
497 [Define if your AIX loginfailed() function
498 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
499 ])],
500 [],
501 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000502 )
Tim Rice648f8762011-01-26 12:38:57 -0800503 AC_CHECK_FUNCS([getgrset setauthdb])
504 AC_CHECK_DECL([F_CLOSEM],
505 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000506 [],
507 [ #include <limits.h>
508 #include <fcntl.h> ]
509 )
Darren Tucker691d5232005-02-15 21:45:57 +1100510 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800511 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
512 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700513 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800514 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
515 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000516 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800517 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
518 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700519 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800520 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700521 [Define to a Set Process Title type if your system is
522 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800523 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100524 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800525 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100526 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100527 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000528*-*-android*)
529 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
530 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
531 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100532*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100533 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100534 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800535 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
536 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
537 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700538 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800539 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700540 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800541 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700542 [Define if the concept of ports only accessible to
543 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800544 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700545 [Define if your platform needs to skip post auth
546 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800547 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100548 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
549 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
550 # reasons which cause compile warnings, so we disable those warnings.
551 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100552 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000553*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800554 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700555 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800556 AC_DEFINE([SETEUID_BREAKS_SETUID])
557 AC_DEFINE([BROKEN_SETREUID])
558 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000559 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000560*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100561 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800562 AC_MSG_CHECKING([if we have working getaddrinfo])
563 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000564main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
565 exit(0);
566 else
567 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800568}
569 ]])],
570 [AC_MSG_RESULT([working])],
571 [AC_MSG_RESULT([buggy])
572 AC_DEFINE([BROKEN_GETADDRINFO], [1],
573 [getaddrinfo is broken (if present)])
574 ],
575 [AC_MSG_RESULT([assume it is working])])
576 AC_DEFINE([SETEUID_BREAKS_SETUID])
577 AC_DEFINE([BROKEN_SETREUID])
578 AC_DEFINE([BROKEN_SETREGID])
579 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
580 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700581 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800582 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
583 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000584 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800585 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000586 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800587 m4_pattern_allow([AU_IPv])
588 AC_CHECK_DECL([AU_IPv4], [],
589 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100590 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800591 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100592 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100593 )
Damien Millerc09182f2011-06-03 12:11:38 +1000594 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
595 [Define to a Set Process Title type if your system is
596 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000597 AC_CHECK_FUNCS([sandbox_init])
598 AC_CHECK_HEADERS([sandbox.h])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000599 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000600*-*-dragonfly*)
601 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100602 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000603 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100604*-*-haiku*)
605 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800606 AC_CHECK_LIB([network], [socket])
607 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100608 MANTYPE=man
609 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000610*-*-hpux*)
611 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000612 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100613 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800614 AC_DEFINE([USE_PIPES])
615 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700616 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800617 AC_DEFINE([LOGIN_NEEDS_UTMPX])
618 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700619 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800620 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100621 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700622 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700623 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800624 AC_CHECK_LIB([xnet], [t_error], ,
625 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000626
627 # next, we define all of the options specific to major releases
628 case "$host" in
629 *-*-hpux10*)
630 if test -z "$GCC"; then
631 CFLAGS="$CFLAGS -Ae"
632 fi
633 ;;
634 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800635 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700636 [Define if you are using Solaris-derived PAM which
637 passes pam_messages to the conversation function
638 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800639 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700640 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800641 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000642 check_for_hpux_broken_getaddrinfo=1
643 check_for_conflicting_getspnam=1
644 ;;
645 esac
646
647 # lastly, we define options specific to minor releases
648 case "$host" in
649 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800650 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700651 [Define if you have SecureWare-based
652 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000653 disable_ptmx_check=yes
654 LIBS="$LIBS -lsecpw"
655 ;;
656 esac
Damien Miller1bead332000-04-30 00:47:29 +1000657 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100658*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100659 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800660 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700661 [Define if you system's inet_ntoa is busted
662 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800663 AC_DEFINE([SETEUID_BREAKS_SETUID])
664 AC_DEFINE([BROKEN_SETREUID])
665 AC_DEFINE([BROKEN_SETREGID])
666 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700667 [Define if you shouldn't strip 'tty' from your
668 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800669 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100670 ;;
671*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100672 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800673 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700674 [Define if you have/want arrays
675 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800676 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700677 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800678 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700679 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800680 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700681 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800682 AC_DEFINE([BROKEN_INET_NTOA])
683 AC_DEFINE([SETEUID_BREAKS_SETUID])
684 AC_DEFINE([BROKEN_SETREUID])
685 AC_DEFINE([BROKEN_SETREGID])
686 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
687 AC_DEFINE([WITH_ABBREV_NO_TTY])
688 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100689 ;;
Damien Miller90551722009-02-16 15:37:03 +1100690*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
691 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800692 AC_DEFINE([PAM_TTY_KLUDGE])
693 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
694 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
695 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
696 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100697 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100698*-*-linux*)
699 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100700 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100701 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000702 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800703 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700704 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800705 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700706 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800707 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
708 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700709 [Define to whatever link() returns for "not supported"
710 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800711 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
712 AC_DEFINE([USE_BTMP])
713 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100714 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000715 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000716 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700718 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000719 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000720 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100721 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800722 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100723 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800724 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100725 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800726 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100727 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800728 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100729 [Prepend the address family to IP tunnel traffic])
730 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000731 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
732 [], [#include <linux/types.h>])
Damien Millere0956e32012-04-04 11:27:54 +1000733 AC_CHECK_FUNCS([prctl])
Damien Miller91f40d82013-02-22 11:37:00 +1100734 AC_MSG_CHECKING([for seccomp architecture])
735 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000736 case "$host" in
737 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100738 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000739 ;;
740 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100741 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000742 ;;
Damien Miller91f40d82013-02-22 11:37:00 +1100743 arm*-*)
744 seccomp_audit_arch=AUDIT_ARCH_ARM
745 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000746 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100747 if test "x$seccomp_audit_arch" != "x" ; then
748 AC_MSG_RESULT(["$seccomp_audit_arch"])
749 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
750 [Specify the system call convention in use])
751 else
752 AC_MSG_RESULT([architecture not supported])
753 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100754 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000755mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800756 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000757 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000758 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100759*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000760 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800761 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800762 need_dash_r=1
763 fi
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100765 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800766 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
767 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100768 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100769 TEST_MALLOC_OPTIONS="AJRX"
Darren Tucker42a09252014-01-23 23:14:39 +1100770 AC_DEFINE([BROKEN_STRNVIS], [1],
771 [NetBSD strnvis argument order is swapped compared to OpenBSD])
Damien Milleree1c0b32000-01-21 00:18:15 +1100772 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100773*-*-freebsd*)
774 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800775 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
776 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100777 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800778 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
779 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker42a09252014-01-23 23:14:39 +1100780 AC_DEFINE([BROKEN_STRNVIS], [1],
781 [FreeBSD strnvis argument order is swapped compared to OpenBSD])
Darren Tucker882abfd2013-11-09 00:17:41 +1100782 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerfbd884a2001-02-27 08:39:07 +1100783 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000784*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800785 AC_DEFINE([SETEUID_BREAKS_SETUID])
786 AC_DEFINE([BROKEN_SETREUID])
787 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000788 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000789*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000790 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100791 conf_utmp_location=/etc/utmp
792 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700793 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800794 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
795 AC_DEFINE([BROKEN_REALPATH])
796 AC_DEFINE([USE_PIPES])
797 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000798 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000799*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100800 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800801 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
802 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
803 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
804 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000805 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100806 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000807 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100808*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800809 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800810 need_dash_r=1
811 fi
Tim Rice648f8762011-01-26 12:38:57 -0800812 AC_DEFINE([PAM_SUN_CODEBASE])
813 AC_DEFINE([LOGIN_NEEDS_UTMPX])
814 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700815 [Some versions of /bin/login need the TERM supplied
816 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800817 AC_DEFINE([PAM_TTY_KLUDGE])
818 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700819 [Define if pam_chauthtok wants real uid set
820 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800821 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000822 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800823 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700824 [Define if sshd somehow reacquires a controlling TTY
825 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800826 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000827 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800828 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000829 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000830 # hardwire lastlog location (can't detect it on some versions)
831 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800832 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000833 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
834 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800835 AC_MSG_RESULT([yes])
836 AC_DEFINE([DISABLE_UTMP])
837 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700838 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000839 else
Tim Rice648f8762011-01-26 12:38:57 -0800840 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000841 fi
Tim Rice648f8762011-01-26 12:38:57 -0800842 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000843 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
844 [
Tim Rice648f8762011-01-26 12:38:57 -0800845 AC_CHECK_LIB([contract], [ct_tmpl_activate],
846 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000847 [Define if you have Solaris process contracts])
848 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000849 SPC_MSG="yes" ], )
850 ],
851 )
Tim Rice648f8762011-01-26 12:38:57 -0800852 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100853 [ --with-solaris-projects Enable Solaris projects (experimental)],
854 [
Tim Rice648f8762011-01-26 12:38:57 -0800855 AC_CHECK_LIB([project], [setproject],
856 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100857 [Define if you have Solaris projects])
858 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100859 SP_MSG="yes" ], )
860 ],
861 )
Tim Rice5ab9b632013-06-02 14:05:48 -0700862 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +1100863 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000864*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000865 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800866 AC_CHECK_FUNCS([getpwanam])
867 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000868 conf_utmp_location=/etc/utmp
869 conf_wtmp_location=/var/adm/wtmp
870 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800871 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000872 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000873*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700874 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800875 AC_DEFINE([USE_PIPES])
876 AC_DEFINE([SSHD_ACQUIRES_CTTY])
877 AC_DEFINE([SETEUID_BREAKS_SETUID])
878 AC_DEFINE([BROKEN_SETREUID])
879 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000880 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000881*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700882 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800883 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100884 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800885 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100886 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800887 AC_DEFINE([USE_PIPES])
888 AC_DEFINE([IP_TOS_IS_BROKEN])
889 AC_DEFINE([SETEUID_BREAKS_SETUID])
890 AC_DEFINE([BROKEN_SETREUID])
891 AC_DEFINE([BROKEN_SETREGID])
892 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000893 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700894 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
895 # Attention: always take care to bind libsocket and libnsl before libc,
896 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000897 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800898# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100899*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800900 AC_DEFINE([USE_PIPES])
901 AC_DEFINE([SETEUID_BREAKS_SETUID])
902 AC_DEFINE([BROKEN_SETREUID])
903 AC_DEFINE([BROKEN_SETREGID])
904 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
905 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -0700906 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +1100907 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800908# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100909*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800910 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800911 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
912 AC_DEFINE([USE_PIPES])
913 AC_DEFINE([SETEUID_BREAKS_SETUID])
914 AC_DEFINE([BROKEN_GETADDRINFO])
915 AC_DEFINE([BROKEN_SETREUID])
916 AC_DEFINE([BROKEN_SETREGID])
917 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice5ab9b632013-06-02 14:05:48 -0700918 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4dbacff2005-06-01 20:09:28 -0700919 case "$host" in
920 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700921 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800922 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700923 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800924 AC_DEFINE([BROKEN_UPDWTMPX])
925 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
926 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
927 AC_DEFINE([HAVE_SECUREWARE])
928 AC_DEFINE([DISABLE_SHADOW])
929 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700930 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800931 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800932 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800933 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700934 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100935 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100936*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100937 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800938# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100939*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800940 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100941 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800942# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100943*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800944 if test -z "$GCC"; then
945 CFLAGS="$CFLAGS -belf"
946 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100947 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000948 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800949 AC_DEFINE([USE_PIPES])
950 AC_DEFINE([HAVE_SECUREWARE])
951 AC_DEFINE([DISABLE_SHADOW])
952 AC_DEFINE([DISABLE_FD_PASSING])
953 AC_DEFINE([SETEUID_BREAKS_SETUID])
954 AC_DEFINE([BROKEN_GETADDRINFO])
955 AC_DEFINE([BROKEN_SETREUID])
956 AC_DEFINE([BROKEN_SETREGID])
957 AC_DEFINE([WITH_ABBREV_NO_TTY])
958 AC_DEFINE([BROKEN_UPDWTMPX])
959 AC_DEFINE([PASSWD_NEEDS_USERNAME])
960 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700961 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -0700962 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -0700963 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +1000964 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000965*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800966 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700967 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800968 AC_DEFINE([SETEUID_BREAKS_SETUID])
969 AC_DEFINE([BROKEN_SETREUID])
970 AC_DEFINE([BROKEN_SETREGID])
971 AC_DEFINE([USE_PIPES])
972 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000973 LDFLAGS="$LDFLAGS"
974 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
975 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000976 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000977*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800978 AC_DEFINE([SETEUID_BREAKS_SETUID])
979 AC_DEFINE([BROKEN_SETREUID])
980 AC_DEFINE([BROKEN_SETREGID])
981 AC_DEFINE([WITH_ABBREV_NO_TTY])
982 AC_DEFINE([USE_PIPES])
983 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000984 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100985 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000986 MANTYPE=cat
987 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000988*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800989 AC_DEFINE([SETEUID_BREAKS_SETUID])
990 AC_DEFINE([BROKEN_SETREUID])
991 AC_DEFINE([BROKEN_SETREGID])
992 AC_DEFINE([USE_PIPES])
993 AC_DEFINE([DISABLE_FD_PASSING])
994 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000995 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
996 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
997 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700998 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000999*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001000 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001001 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001002 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001003 [ --with-osfsia Enable Digital Unix SIA],
1004 [
1005 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001006 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001007 no_osfsia=1
1008 fi
1009 ],
1010 )
1011 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001012 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001013 AC_MSG_RESULT([yes])
1014 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001015 [Define if you have Digital Unix Security
1016 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001017 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001018 [Define if you don't want to use your
1019 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001020 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001021 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001022 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001023 else
Tim Rice648f8762011-01-26 12:38:57 -08001024 AC_MSG_RESULT([no])
1025 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001026 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001027 fi
1028 fi
Tim Rice648f8762011-01-26 12:38:57 -08001029 AC_DEFINE([BROKEN_GETADDRINFO])
1030 AC_DEFINE([SETEUID_BREAKS_SETUID])
1031 AC_DEFINE([BROKEN_SETREUID])
1032 AC_DEFINE([BROKEN_SETREGID])
1033 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001034 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001035
Tim Rice70335a62006-02-04 17:42:58 -08001036*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001037 AC_DEFINE([USE_PIPES])
1038 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001039 AC_DEFINE([DISABLE_LASTLOG])
1040 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1041 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001042 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001043 case "$host" in
1044 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001045 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001046 ;;
1047 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001048 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001049
1050*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001051 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
1052 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
1053 AC_DEFINE([NEED_SETPGRP])
1054 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001055 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001056
1057*-*-lynxos)
1058 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001059 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001060 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001061esac
1062
Tim Rice648f8762011-01-26 12:38:57 -08001063AC_MSG_CHECKING([compiler and flags for sanity])
1064AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1065 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001066 [
Tim Rice648f8762011-01-26 12:38:57 -08001067 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001068 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001069 ],
1070 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001071)
1072
Darren Tucker0c9653f2005-05-28 15:58:14 +10001073dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001074# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001075AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
1076AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001077
Tim Rice1e1ef642003-09-11 22:19:31 -07001078dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001079AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1080 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001081 AC_CACHE_CHECK([for broken dirname],
1082 ac_cv_have_broken_dirname, [
1083 save_LIBS="$LIBS"
1084 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001085 AC_RUN_IFELSE(
1086 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001087#include <libgen.h>
1088#include <string.h>
1089
1090int main(int argc, char **argv) {
1091 char *s, buf[32];
1092
1093 strncpy(buf,"/etc", 32);
1094 s = dirname(buf);
1095 if (!s || strncmp(s, "/", 32) != 0) {
1096 exit(1);
1097 } else {
1098 exit(0);
1099 }
1100}
Darren Tucker314d89e2005-10-17 23:29:23 +10001101 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001102 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001103 [ ac_cv_have_broken_dirname="yes" ],
1104 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001105 )
1106 LIBS="$save_LIBS"
1107 ])
1108 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1109 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001110 AC_DEFINE([HAVE_DIRNAME])
1111 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001112 fi
1113 ])
1114])
1115
Tim Rice648f8762011-01-26 12:38:57 -08001116AC_CHECK_FUNC([getspnam], ,
1117 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1118AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1119 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001120
Tim Rice13aae5e2001-10-21 17:53:58 -07001121dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001122AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001123 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001124 [ if test "x$withval" = "xno" ; then
1125 AC_MSG_ERROR([*** zlib is required ***])
1126 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001127 if test -d "$withval/lib"; then
1128 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001129 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001130 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001131 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001132 fi
1133 else
1134 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001135 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001136 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001137 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001138 fi
1139 fi
1140 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001141 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001142 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001143 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001144 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001145 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001146)
1147
Tim Rice648f8762011-01-26 12:38:57 -08001148AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1149AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001150 [
1151 saved_CPPFLAGS="$CPPFLAGS"
1152 saved_LDFLAGS="$LDFLAGS"
1153 save_LIBS="$LIBS"
1154 dnl Check default zlib install dir
1155 if test -n "${need_dash_r}"; then
1156 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1157 else
1158 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1159 fi
1160 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1161 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001162 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001163 [
1164 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1165 ]
1166 )
1167 ]
1168)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001169
Tim Rice648f8762011-01-26 12:38:57 -08001170AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001171 [ --without-zlib-version-check Disable zlib version check],
1172 [ if test "x$withval" = "xno" ; then
1173 zlib_check_nonfatal=1
1174 fi
1175 ]
1176)
1177
Tim Rice648f8762011-01-26 12:38:57 -08001178AC_MSG_CHECKING([for possibly buggy zlib])
1179AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001180#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001181#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001182#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001183 ]],
1184 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001185 int a=0, b=0, c=0, d=0, n, v;
1186 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1187 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001188 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001189 v = a*1000000 + b*10000 + c*100 + d;
1190 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1191
1192 /* 1.1.4 is OK */
1193 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001194 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001195
Darren Tucker41097ed2005-07-25 15:24:21 +10001196 /* 1.2.3 and up are OK */
1197 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001198 exit(0);
1199
Darren Tucker2dcd2392004-01-23 17:13:33 +11001200 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001201 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001202 AC_MSG_RESULT([no]),
1203 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001204 if test -z "$zlib_check_nonfatal" ; then
1205 AC_MSG_ERROR([*** zlib too old - check config.log ***
1206Your reported zlib version has known security problems. It's possible your
1207vendor has fixed these problems without changing the version number. If you
1208are sure this is the case, you can disable the check by running
1209"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001210If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001211See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001212 else
1213 AC_MSG_WARN([zlib version may have security problems])
1214 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001215 ],
1216 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001217)
Damien Miller6f9c3372000-10-25 10:06:04 +11001218
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001219dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001220AC_CHECK_FUNC([strcasecmp],
1221 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001222)
Tim Rice648f8762011-01-26 12:38:57 -08001223AC_CHECK_FUNCS([utimes],
1224 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001225 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001226)
Damien Millerab18c411999-11-11 10:40:23 +11001227
Tim Ricee589a292001-11-03 11:09:32 -08001228dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001229AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001230AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001231AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001232AC_SEARCH_LIBS([login], [util bsd])
1233AC_SEARCH_LIBS([logout], [util bsd])
1234AC_SEARCH_LIBS([logwtmp], [util bsd])
1235AC_SEARCH_LIBS([openpty], [util bsd])
1236AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001237AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001238
Ben Lindstrom8697e082001-02-24 21:41:10 +00001239AC_FUNC_STRFTIME
1240
Damien Miller3c027682001-03-14 11:39:45 +11001241# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001242AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1243AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001244 [
1245 #include <glob.h>
1246 #ifdef GLOB_ALTDIRFUNC
1247 FOUNDIT
1248 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001249 ],
Damien Miller3c027682001-03-14 11:39:45 +11001250 [
Tim Rice648f8762011-01-26 12:38:57 -08001251 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001252 [Define if your system glob() function has
1253 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001254 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001255 ],
1256 [
Tim Rice648f8762011-01-26 12:38:57 -08001257 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001258 ]
1259)
Damien Millerab18c411999-11-11 10:40:23 +11001260
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001261# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001262AC_MSG_CHECKING([for gl_matchc field in glob_t])
1263AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1264 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001265 [
Tim Rice648f8762011-01-26 12:38:57 -08001266 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001267 [Define if your system glob() function has
1268 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001269 AC_MSG_RESULT([yes])
1270 ], [
1271 AC_MSG_RESULT([no])
1272])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001273
Damien Millera6e121a2010-10-07 21:39:17 +11001274# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001275AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1276AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001277#ifndef GLOB_KEEPSTAT
1278#error "glob does not support GLOB_KEEPSTAT extension"
1279#endif
1280glob_t g;
1281g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001282]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001283 [
Tim Rice648f8762011-01-26 12:38:57 -08001284 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001285 [Define if your system glob() function has
1286 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001287 AC_MSG_RESULT([yes])
1288 ], [
1289 AC_MSG_RESULT([no])
1290
1291])
Damien Millera6e121a2010-10-07 21:39:17 +11001292
Tim Rice648f8762011-01-26 12:38:57 -08001293AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001294
Damien Miller18bb4732001-03-28 14:35:30 +10001295AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001296AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001297 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001298#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001299#include <dirent.h>]],
1300 [[
1301 struct dirent d;
1302 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001303 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001304 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001305 [
Tim Rice648f8762011-01-26 12:38:57 -08001306 AC_MSG_RESULT([no])
1307 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001308 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001309 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001310 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001311 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001312 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001313 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001314 ]
1315)
1316
Damien Miller36f49652004-08-15 18:40:59 +10001317AC_MSG_CHECKING([for /proc/pid/fd directory])
1318if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001319 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1320 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001321else
Tim Rice648f8762011-01-26 12:38:57 -08001322 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001323fi
1324
Damien Millerc547bf12001-02-16 10:18:12 +11001325# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001326SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001327AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001328 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001329 [
1330 if test "x$withval" != "xno" ; then
1331
1332 if test "x$withval" != "xyes" ; then
1333 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1334 LDFLAGS="$LDFLAGS -L${withval}/lib"
1335 fi
1336
Tim Rice648f8762011-01-26 12:38:57 -08001337 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001338 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001339 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001340
Tim Rice4cec93f2002-02-26 08:40:48 -08001341 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001342 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001343 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001344#include <stdio.h>
1345#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001346 ]], [[
1347 char *ff = skey_keyinfo(""); ff="";
1348 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001349 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001350 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001351 [
Tim Rice648f8762011-01-26 12:38:57 -08001352 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001353 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1354 ])
Tim Rice648f8762011-01-26 12:38:57 -08001355 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1357#include <stdio.h>
1358#include <skey.h>
1359 ]], [[
1360 (void)skeychallenge(NULL,"name","",0);
1361 ]])],
1362 [
1363 AC_MSG_RESULT([yes])
1364 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001365 [Define if your skeychallenge()
1366 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001367 [
1368 AC_MSG_RESULT([no])
1369 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001370 fi
1371 ]
1372)
1373
1374# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001375TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001376AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001377 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001378 [
1379 if test "x$withval" != "xno" ; then
1380 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001381 saved_LDFLAGS="$LDFLAGS"
1382 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001383 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001384 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001385 if test -d "${withval}/lib"; then
1386 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001387 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001388 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001389 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001390 fi
1391 else
1392 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001393 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001394 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001395 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001396 fi
1397 fi
1398 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001399 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001400 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001401 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001402 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001403 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001404 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001405 AC_MSG_CHECKING([for libwrap])
1406 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001407#include <sys/types.h>
1408#include <sys/socket.h>
1409#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001410#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001411int deny_severity = 0, allow_severity = 0;
1412 ]], [[
1413 hosts_access(0);
1414 ]])], [
1415 AC_MSG_RESULT([yes])
1416 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001417 [Define if you want
1418 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001419 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001420 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001421 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001422 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001423
1424 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001425 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001426 fi
1427 ]
1428)
1429
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001430# Check whether user wants to use ldns
1431LDNS_MSG="no"
1432AC_ARG_WITH(ldns,
1433 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1434 [
1435 if test "x$withval" != "xno" ; then
1436
1437 if test "x$withval" != "xyes" ; then
1438 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1439 LDFLAGS="$LDFLAGS -L${withval}/lib"
1440 fi
1441
1442 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1443 LIBS="-lldns $LIBS"
1444 LDNS_MSG="yes"
1445
1446 AC_MSG_CHECKING([for ldns support])
1447 AC_LINK_IFELSE(
1448 [AC_LANG_SOURCE([[
1449#include <stdio.h>
1450#include <stdlib.h>
1451#include <stdint.h>
1452#include <ldns/ldns.h>
1453int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1454 ]])
1455 ],
1456 [AC_MSG_RESULT(yes)],
1457 [
1458 AC_MSG_RESULT(no)
1459 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1460 ])
1461 fi
1462 ]
1463)
1464
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001465# Check whether user wants libedit support
1466LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001467AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001468 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001469 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001470 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001471 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001472 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001473 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001474 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001475 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001476 use_pkgconfig_for_libedit=yes
1477 else
Tim Rice648f8762011-01-26 12:38:57 -08001478 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001479 fi
1480 fi
1481 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001482 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1483 if test -n "${need_dash_r}"; then
1484 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1485 else
1486 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1487 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001488 fi
Damien Miller1f789802010-10-11 22:35:22 +11001489 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001490 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001491 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1492 else
1493 LIBEDIT="-ledit -lcurses"
1494 fi
1495 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001496 AC_CHECK_LIB([edit], [el_init],
1497 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001498 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001499 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001500 ],
Tim Rice648f8762011-01-26 12:38:57 -08001501 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001502 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001503 )
Tim Rice648f8762011-01-26 12:38:57 -08001504 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001505 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001506 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1507 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001508 int i = H_SETSIZE;
1509 el_init("", NULL, NULL, NULL);
1510 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001511 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001512 [ AC_MSG_RESULT([yes]) ],
1513 [ AC_MSG_RESULT([no])
1514 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001515 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001516 fi ]
1517)
1518
Darren Tuckerd9f88912005-02-20 21:01:48 +11001519AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001520AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001521 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001522 [
Tim Rice648f8762011-01-26 12:38:57 -08001523 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001524 case "$withval" in
1525 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001526 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001527 AUDIT_MODULE=bsm
1528 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001529 AC_CHECK_HEADERS([bsm/audit.h], [],
1530 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001531 [
1532#ifdef HAVE_TIME_H
1533# include <time.h>
1534#endif
1535 ]
1536)
Tim Rice648f8762011-01-26 12:38:57 -08001537 AC_CHECK_LIB([bsm], [getaudit], [],
1538 [AC_MSG_ERROR([BSM enabled and required library not found])])
1539 AC_CHECK_FUNCS([getaudit], [],
1540 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001541 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001542 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1543 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001544 if test "$sol2ver" -ge 11; then
Darren Tucker93a2d412012-02-24 10:40:41 +11001545 SSHDLIBS="$SSHDLIBS -lscf"
1546 AC_DEFINE([BROKEN_BSM_API], [1],
1547 [The system has incomplete BSM API])
1548 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001549 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001550 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001551 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001552 AUDIT_MODULE=linux
1553 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001554 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001555 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001556 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001557 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001558 debug)
1559 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001560 AC_MSG_RESULT([debug])
1561 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001562 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001563 no)
Tim Rice648f8762011-01-26 12:38:57 -08001564 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001565 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001566 *)
1567 AC_MSG_ERROR([Unknown audit module $withval])
1568 ;;
1569 esac ]
1570)
1571
Darren Tucker096118d2014-01-21 12:48:51 +11001572AC_ARG_WITH([pie],
1573 [ --with-pie Build Position Independent Executables if possible], [
1574 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001575 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001576 fi
1577 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001578 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001579 fi
1580 ]
1581)
Damien Miller852472a2014-01-22 16:31:18 +11001582if test "x$use_pie" = "x"; then
1583 use_pie=no
1584fi
1585if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1586 # Turn off automatic PIE when toolchain hardening is off.
1587 use_pie=no
1588fi
1589if test "x$use_pie" == "xauto"; then
1590 # Automatic PIE requires gcc >= 4.x
1591 AC_MSG_CHECKING([for gcc >= 4.x])
1592 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1593#if !defined(__GNUC__) || __GNUC__ < 4
1594#error gcc is too old
1595#endif
1596]])],
1597 [ AC_MSG_RESULT([yes]) ],
1598 [ AC_MSG_RESULT([no])
1599 use_pie=no ]
1600)
1601fi
1602if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001603 SAVED_CFLAGS="$CFLAGS"
1604 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001605 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1606 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001607 # We use both -fPIE and -pie or neither.
1608 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1609 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1610 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1611 AC_MSG_RESULT([yes])
1612 else
1613 AC_MSG_RESULT([no])
1614 CFLAGS="$SAVED_CFLAGS"
1615 LDFLAGS="$SAVED_LDFLAGS"
1616 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001617fi
1618
Damien Millerfe1f1432003-02-24 15:45:42 +11001619dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001620AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001621 Blowfish_initstate \
1622 Blowfish_expandstate \
1623 Blowfish_expand0state \
1624 Blowfish_stream2word \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001625 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001626 arc4random_buf \
Damien Millerdf8b0302013-11-07 13:28:16 +11001627 arc4random_stir \
Damien Millera4be7c22008-05-19 14:47:37 +10001628 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001629 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001630 b64_ntop \
1631 __b64_ntop \
1632 b64_pton \
1633 __b64_pton \
1634 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001635 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001636 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001637 blf_enc \
Damien Millerc96d8532014-01-25 13:12:28 +11001638 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001639 clock \
1640 closefrom \
1641 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001642 endgrent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001643 fchmod \
1644 fchown \
1645 freeaddrinfo \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001646 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001647 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001648 futimes \
1649 getaddrinfo \
1650 getcwd \
1651 getgrouplist \
1652 getnameinfo \
1653 getopt \
1654 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001655 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001656 getpgid \
1657 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001658 _getpty \
1659 getrlimit \
1660 getttyent \
1661 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001662 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001663 inet_aton \
1664 inet_ntoa \
1665 inet_ntop \
1666 innetgr \
1667 login_getcapbool \
Darren Tuckerae133d42013-06-06 08:30:20 +10001668 mblen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001669 md5_crypt \
1670 memmove \
1671 mkdtemp \
1672 mmap \
1673 ngetaddrinfo \
1674 nsleep \
1675 ogetaddrinfo \
1676 openlog_r \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001677 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001678 prctl \
1679 pstat \
1680 readpassphrase \
1681 realpath \
1682 recvmsg \
1683 rresvport_af \
1684 sendmsg \
1685 setdtablesize \
1686 setegid \
1687 setenv \
1688 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001689 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001690 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001691 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001692 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001693 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001694 setpcred \
1695 setproctitle \
1696 setregid \
1697 setreuid \
1698 setrlimit \
1699 setsid \
1700 setvbuf \
1701 sigaction \
1702 sigvec \
1703 snprintf \
1704 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001705 statfs \
1706 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001707 strdup \
1708 strerror \
1709 strlcat \
1710 strlcpy \
1711 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001712 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001713 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001714 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001715 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001716 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001717 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001718 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001719 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001720 sysconf \
1721 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001722 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001723 truncate \
1724 unsetenv \
1725 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001726 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001727 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001728 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001729 vhangup \
1730 vsnprintf \
1731 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001732])
Tim Rice13aae5e2001-10-21 17:53:58 -07001733
Tim Ricec7a8af02010-11-08 14:26:23 -08001734AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001735 [AC_LANG_PROGRAM(
1736 [[ #include <ctype.h> ]],
1737 [[ return (isblank('a')); ]])],
1738 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001739])
1740
Damien Millerb3c9f782010-02-12 10:11:34 +11001741# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001742AC_SEARCH_LIBS([dlopen], [dl],
1743 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001744)
1745
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001746# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001747AC_CHECK_FUNCS([gai_strerror], [
1748 AC_DEFINE([HAVE_GAI_STRERROR])
1749 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001750#include <sys/types.h>
1751#include <sys/socket.h>
1752#include <netdb.h>
1753
Tim Rice648f8762011-01-26 12:38:57 -08001754const char *gai_strerror(int);
1755 ]], [[
1756 char *str;
1757 str = gai_strerror(0);
1758 ]])], [
1759 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1760 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001761
Tim Rice648f8762011-01-26 12:38:57 -08001762AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1763 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001764
Darren Tuckera7108912013-06-02 08:18:31 +10001765AC_SEARCH_LIBS([clock_gettime], [rt],
1766 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1767
Darren Tuckerf1159b52003-07-07 19:44:01 +10001768dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001769AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1770AC_CHECK_DECL([strsep],
1771 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001772 [],
1773 [
1774#ifdef HAVE_STRING_H
1775# include <string.h>
1776#endif
1777 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001778
Darren Tuckerb2427c82003-09-10 15:22:44 +10001779dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001780AC_CHECK_DECL([tcsendbreak],
1781 [AC_DEFINE([HAVE_TCSENDBREAK])],
1782 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001783 [#include <termios.h>]
1784)
1785
Tim Rice648f8762011-01-26 12:38:57 -08001786AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001787
Tim Rice648f8762011-01-26 12:38:57 -08001788AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001789 [
1790#include <sys/types.h>
1791#include <sys/socket.h>
1792 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001793
Tim Rice648f8762011-01-26 12:38:57 -08001794AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001795 [
1796#include <sys/types.h>
1797#ifdef HAVE_SYS_STAT_H
1798# include <sys/stat.h>
1799#endif
1800#ifdef HAVE_FCNTL_H
1801# include <fcntl.h>
1802#endif
1803 ])
1804
Tim Rice648f8762011-01-26 12:38:57 -08001805AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001806#include <sys/types.h>
1807#include <sys/uio.h>
1808#include <unistd.h>
1809 ])
1810
Tim Rice648f8762011-01-26 12:38:57 -08001811AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001812#include <sys/param.h>
1813 ])
1814
Tim Rice648f8762011-01-26 12:38:57 -08001815AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001816#include <stddef.h>
1817 ])
1818
Darren Tuckerc7aad002013-06-02 07:18:47 +10001819# extra bits for select(2)
1820AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1821#include <sys/param.h>
1822#include <sys/types.h>
1823#ifdef HAVE_SYS_SYSMACROS_H
1824#include <sys/sysmacros.h>
1825#endif
1826#ifdef HAVE_SYS_SELECT_H
1827#include <sys/select.h>
1828#endif
1829#ifdef HAVE_SYS_TIME_H
1830#include <sys/time.h>
1831#endif
1832#ifdef HAVE_UNISTD_H
1833#include <unistd.h>
1834#endif
1835 ]])
1836AC_CHECK_TYPES([fd_mask], [], [], [[
1837#include <sys/param.h>
1838#include <sys/types.h>
1839#ifdef HAVE_SYS_SELECT_H
1840#include <sys/select.h>
1841#endif
1842#ifdef HAVE_SYS_TIME_H
1843#include <sys/time.h>
1844#endif
1845#ifdef HAVE_UNISTD_H
1846#include <unistd.h>
1847#endif
1848 ]])
1849
Tim Rice648f8762011-01-26 12:38:57 -08001850AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001851 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001852 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001853 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001854 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001855#include <stdlib.h>
1856#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001857 ]], [[
1858 errno=0;
1859 setresuid(0,0,0);
1860 if (errno==ENOSYS)
1861 exit(1);
1862 else
1863 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001864 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001865 [AC_MSG_RESULT([yes])],
1866 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001867 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001868 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001869 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001870 )
1871])
Darren Tuckere937be32003-12-17 18:53:26 +11001872
Tim Rice648f8762011-01-26 12:38:57 -08001873AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001874 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001875 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001876 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001877 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001878#include <stdlib.h>
1879#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001880 ]], [[
1881 errno=0;
1882 setresgid(0,0,0);
1883 if (errno==ENOSYS)
1884 exit(1);
1885 else
1886 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001887 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001888 [AC_MSG_RESULT([yes])],
1889 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001890 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001891 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001892 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001893 )
1894])
Darren Tuckere937be32003-12-17 18:53:26 +11001895
Damien Millerad833b32000-08-23 10:46:23 +10001896dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001897AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001898dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001899AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1900AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001901dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001902AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1903AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001904dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001905AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001906
Tim Rice648f8762011-01-26 12:38:57 -08001907AC_CHECK_FUNC([daemon],
1908 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1909 [AC_CHECK_LIB([bsd], [daemon],
1910 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001911)
1912
Tim Rice648f8762011-01-26 12:38:57 -08001913AC_CHECK_FUNC([getpagesize],
1914 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001915 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001916 [AC_CHECK_LIB([ucb], [getpagesize],
1917 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001918)
1919
Damien Millercb170cb2000-07-01 16:52:55 +10001920# Check for broken snprintf
1921if test "x$ac_cv_func_snprintf" = "xyes" ; then
1922 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001923 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001924 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1925 [[
1926 char b[5];
1927 snprintf(b,5,"123456789");
1928 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001929 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001930 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001931 [
Tim Rice648f8762011-01-26 12:38:57 -08001932 AC_MSG_RESULT([no])
1933 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001934 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001935 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001936 ],
1937 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001938 )
1939fi
1940
Damien Miller57f39152005-11-24 19:58:19 +11001941# If we don't have a working asprintf, then we strongly depend on vsnprintf
1942# returning the right thing on overflow: the number of characters it tried to
1943# create (as per SUSv3)
1944if test "x$ac_cv_func_asprintf" != "xyes" && \
1945 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1946 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1947 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001948 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001949#include <sys/types.h>
1950#include <stdio.h>
1951#include <stdarg.h>
1952
1953int x_snprintf(char *str,size_t count,const char *fmt,...)
1954{
1955 size_t ret; va_list ap;
1956 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1957 return ret;
1958}
Tim Rice648f8762011-01-26 12:38:57 -08001959 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001960 char x[1];
1961 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001962 ]])],
1963 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001964 [
Tim Rice648f8762011-01-26 12:38:57 -08001965 AC_MSG_RESULT([no])
1966 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001967 [Define if your snprintf is busted])
1968 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1969 ],
1970 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1971 )
1972fi
1973
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001974# On systems where [v]snprintf is broken, but is declared in stdio,
1975# check that the fmt argument is const char * or just char *.
1976# This is only useful for when BROKEN_SNPRINTF
1977AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001978AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1979#include <stdio.h>
1980int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1981 ]], [[
1982 snprintf(0, 0, 0);
1983 ]])],
1984 [AC_MSG_RESULT([yes])
1985 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001986 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001987 [AC_MSG_RESULT([no])
1988 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001989
Damien Millerb4097182004-05-23 14:09:40 +10001990# Check for missing getpeereid (or equiv) support
1991NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001992if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001993 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1995#include <sys/types.h>
1996#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1997 [ AC_MSG_RESULT([yes])
1998 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1999 ], [AC_MSG_RESULT([no])
2000 NO_PEERCHECK=1
2001 ])
Damien Millerb4097182004-05-23 14:09:40 +10002002fi
2003
Damien Millere8328192003-01-07 15:18:32 +11002004dnl see whether mkstemp() requires XXXXXX
2005if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2006AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002007AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002008 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002009#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002010 ]], [[
2011 char template[]="conftest.mkstemp-test";
2012 if (mkstemp(template) == -1)
2013 exit(1);
2014 unlink(template);
2015 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002016 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002017 [
Tim Rice648f8762011-01-26 12:38:57 -08002018 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002019 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002020 [
Tim Rice648f8762011-01-26 12:38:57 -08002021 AC_MSG_RESULT([yes])
2022 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002023 ],
2024 [
Tim Rice648f8762011-01-26 12:38:57 -08002025 AC_MSG_RESULT([yes])
2026 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002027 ]
Damien Millere8328192003-01-07 15:18:32 +11002028)
2029fi
2030
Darren Tucker70a3d552003-08-21 17:58:29 +10002031dnl make sure that openpty does not reacquire controlling terminal
2032if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002033 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002034 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002035 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002036#include <stdio.h>
2037#include <sys/fcntl.h>
2038#include <sys/types.h>
2039#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002040 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002041 pid_t pid;
2042 int fd, ptyfd, ttyfd, status;
2043
2044 pid = fork();
2045 if (pid < 0) { /* failed */
2046 exit(1);
2047 } else if (pid > 0) { /* parent */
2048 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002049 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002050 exit(WEXITSTATUS(status));
2051 else
2052 exit(2);
2053 } else { /* child */
2054 close(0); close(1); close(2);
2055 setsid();
2056 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2057 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2058 if (fd >= 0)
2059 exit(3); /* Acquired ctty: broken */
2060 else
2061 exit(0); /* Did not acquire ctty: OK */
2062 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002063 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002064 [
Tim Rice648f8762011-01-26 12:38:57 -08002065 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002066 ],
2067 [
Tim Rice648f8762011-01-26 12:38:57 -08002068 AC_MSG_RESULT([no])
2069 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002070 ],
2071 [
Tim Rice648f8762011-01-26 12:38:57 -08002072 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002073 ]
2074 )
2075fi
2076
Tim Rice8bb561b2005-03-17 16:23:19 -08002077if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2078 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002079 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002080 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002081 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002082#include <stdio.h>
2083#include <sys/socket.h>
2084#include <netdb.h>
2085#include <errno.h>
2086#include <netinet/in.h>
2087
2088#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002089 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002090 int err, sock;
2091 struct addrinfo *gai_ai, *ai, hints;
2092 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2093
2094 memset(&hints, 0, sizeof(hints));
2095 hints.ai_family = PF_UNSPEC;
2096 hints.ai_socktype = SOCK_STREAM;
2097 hints.ai_flags = AI_PASSIVE;
2098
2099 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2100 if (err != 0) {
2101 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2102 exit(1);
2103 }
2104
2105 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2106 if (ai->ai_family != AF_INET6)
2107 continue;
2108
2109 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2110 sizeof(ntop), strport, sizeof(strport),
2111 NI_NUMERICHOST|NI_NUMERICSERV);
2112
2113 if (err != 0) {
2114 if (err == EAI_SYSTEM)
2115 perror("getnameinfo EAI_SYSTEM");
2116 else
2117 fprintf(stderr, "getnameinfo failed: %s\n",
2118 gai_strerror(err));
2119 exit(2);
2120 }
2121
2122 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2123 if (sock < 0)
2124 perror("socket");
2125 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2126 if (errno == EBADF)
2127 exit(3);
2128 }
2129 }
2130 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002131 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002132 [
Tim Rice648f8762011-01-26 12:38:57 -08002133 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002134 ],
2135 [
Tim Rice648f8762011-01-26 12:38:57 -08002136 AC_MSG_RESULT([no])
2137 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002138 ],
2139 [
Tim Rice648f8762011-01-26 12:38:57 -08002140 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002141 ]
2142 )
2143fi
2144
Tim Rice8bb561b2005-03-17 16:23:19 -08002145if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2146 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002147 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002148 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002149 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002150#include <stdio.h>
2151#include <sys/socket.h>
2152#include <netdb.h>
2153#include <errno.h>
2154#include <netinet/in.h>
2155
2156#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002157 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002158 int err, sock;
2159 struct addrinfo *gai_ai, *ai, hints;
2160 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2161
2162 memset(&hints, 0, sizeof(hints));
2163 hints.ai_family = PF_UNSPEC;
2164 hints.ai_socktype = SOCK_STREAM;
2165 hints.ai_flags = AI_PASSIVE;
2166
2167 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2168 if (err != 0) {
2169 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2170 exit(1);
2171 }
2172
2173 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2174 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2175 continue;
2176
2177 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2178 sizeof(ntop), strport, sizeof(strport),
2179 NI_NUMERICHOST|NI_NUMERICSERV);
2180
2181 if (ai->ai_family == AF_INET && err != 0) {
2182 perror("getnameinfo");
2183 exit(2);
2184 }
2185 }
2186 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002187 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002188 [
Tim Rice648f8762011-01-26 12:38:57 -08002189 AC_MSG_RESULT([yes])
2190 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002191 [Define if you have a getaddrinfo that fails
2192 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002193 ],
2194 [
Tim Rice648f8762011-01-26 12:38:57 -08002195 AC_MSG_RESULT([no])
2196 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002197 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002198 [
Tim Rice648f8762011-01-26 12:38:57 -08002199 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002200 ]
2201 )
2202fi
2203
Darren Tuckera56f1912004-11-02 20:30:54 +11002204if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002205 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2206 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2207 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002208 [
Tim Rice648f8762011-01-26 12:38:57 -08002209 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002210 ],
2211 [
Tim Rice648f8762011-01-26 12:38:57 -08002212 AC_MSG_RESULT([yes])
2213 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002214 [Conflicting defs for getspnam])
2215 ]
2216 )
2217fi
2218
Damien Miller606f8802000-09-16 15:39:56 +11002219AC_FUNC_GETPGRP
2220
Tim Riceaef73712002-05-11 13:17:42 -07002221# Search for OpenSSL
2222saved_CPPFLAGS="$CPPFLAGS"
2223saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002224AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002225 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2226 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002227 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002228 case "$withval" in
2229 # Relative paths
2230 ./*|../*) withval="`pwd`/$withval"
2231 esac
Tim Riceaef73712002-05-11 13:17:42 -07002232 if test -d "$withval/lib"; then
2233 if test -n "${need_dash_r}"; then
2234 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2235 else
2236 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2237 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002238 elif test -d "$withval/lib64"; then
2239 if test -n "${need_dash_r}"; then
2240 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2241 else
2242 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2243 fi
Tim Riceaef73712002-05-11 13:17:42 -07002244 else
2245 if test -n "${need_dash_r}"; then
2246 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2247 else
2248 LDFLAGS="-L${withval} ${LDFLAGS}"
2249 fi
2250 fi
2251 if test -d "$withval/include"; then
2252 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2253 else
2254 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2255 fi
Damien Millera22ba012000-03-02 23:09:20 +11002256 fi
2257 ]
2258)
Tim Rice3d5352e2004-02-12 09:27:21 -08002259LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002260AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002261 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002262 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002263 [
Tim Riceaef73712002-05-11 13:17:42 -07002264 dnl Check default openssl install dir
2265 if test -n "${need_dash_r}"; then
2266 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002267 else
Tim Riceaef73712002-05-11 13:17:42 -07002268 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002269 fi
Tim Riceaef73712002-05-11 13:17:42 -07002270 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002271 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002272 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2273 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002274 [
2275 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2276 ]
2277 )
2278 ]
2279)
2280
Tim Riced730b782002-08-13 18:52:10 -07002281# Determine OpenSSL header version
2282AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002283AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002284 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002285#include <stdio.h>
2286#include <string.h>
2287#include <openssl/opensslv.h>
2288#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002289 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002290 FILE *fd;
2291 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002292
Damien Millera8e06ce2003-11-21 23:48:55 +11002293 fd = fopen(DATA,"w");
2294 if(fd == NULL)
2295 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002296
2297 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2298 exit(1);
2299
2300 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002301 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002302 [
2303 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002304 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002305 ],
2306 [
Tim Rice648f8762011-01-26 12:38:57 -08002307 AC_MSG_RESULT([not found])
2308 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002309 ],
2310 [
2311 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002312 ]
2313)
2314
2315# Determine OpenSSL library version
2316AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002317AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002318 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002319#include <stdio.h>
2320#include <string.h>
2321#include <openssl/opensslv.h>
2322#include <openssl/crypto.h>
2323#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002324 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002325 FILE *fd;
2326 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002327
Damien Millera8e06ce2003-11-21 23:48:55 +11002328 fd = fopen(DATA,"w");
2329 if(fd == NULL)
2330 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002331
2332 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2333 exit(1);
2334
2335 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002336 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002337 [
2338 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002339 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002340 ],
2341 [
Tim Rice648f8762011-01-26 12:38:57 -08002342 AC_MSG_RESULT([not found])
2343 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002344 ],
2345 [
2346 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002347 ]
2348)
Damien Millera22ba012000-03-02 23:09:20 +11002349
Tim Rice648f8762011-01-26 12:38:57 -08002350AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002351 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2352 [ if test "x$withval" = "xno" ; then
2353 openssl_check_nonfatal=1
2354 fi
2355 ]
2356)
2357
Damien Millerec932372002-01-22 22:16:03 +11002358# Sanity check OpenSSL headers
2359AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002360AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002361 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002362#include <string.h>
2363#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002364 ]], [[
2365 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002366 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002367 [
Tim Rice648f8762011-01-26 12:38:57 -08002368 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002369 ],
2370 [
Tim Rice648f8762011-01-26 12:38:57 -08002371 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002372 if test "x$openssl_check_nonfatal" = "x"; then
2373 AC_MSG_ERROR([Your OpenSSL headers do not match your
2374library. Check config.log for details.
2375If you are sure your installation is consistent, you can disable the check
2376by running "./configure --without-openssl-header-check".
2377Also see contrib/findssl.sh for help identifying header/library mismatches.
2378])
2379 else
2380 AC_MSG_WARN([Your OpenSSL headers do not match your
2381library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002382Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002383 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002384 ],
2385 [
2386 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002387 ]
2388)
2389
Darren Tucker639bbe82006-08-20 20:17:53 +10002390AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2391AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002392 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2393 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002394 [
Tim Rice648f8762011-01-26 12:38:57 -08002395 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002396 ],
2397 [
Tim Rice648f8762011-01-26 12:38:57 -08002398 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002399 saved_LIBS="$LIBS"
2400 LIBS="$LIBS -ldl"
2401 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2402 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002403 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2404 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002405 [
Tim Rice648f8762011-01-26 12:38:57 -08002406 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002407 ],
2408 [
Tim Rice648f8762011-01-26 12:38:57 -08002409 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002410 LIBS="$saved_LIBS"
2411 ]
2412 )
2413 ]
2414)
2415
Darren Tuckerc5487222014-01-17 15:12:16 +11002416AC_CHECK_FUNCS([ \
2417 BN_is_prime_ex \
2418 DSA_generate_parameters_ex \
Darren Tuckerd23a91f2014-01-17 17:32:30 +11002419 EVP_DigestInit_ex \
2420 EVP_DigestFinal_ex \
2421 EVP_MD_CTX_init \
2422 EVP_MD_CTX_cleanup \
Darren Tuckerc5487222014-01-17 15:12:16 +11002423 HMAC_CTX_init \
2424 RSA_generate_key_ex \
2425 RSA_get_default_method \
2426])
Darren Tuckerebdef762010-12-04 23:20:50 +11002427
Tim Rice648f8762011-01-26 12:38:57 -08002428AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002429 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2430 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002431 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2432 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2433#include <openssl/engine.h>
2434 ]], [[
2435 ENGINE_load_builtin_engines();
2436 ENGINE_register_all_complete();
2437 ]])],
2438 [ AC_MSG_RESULT([yes])
2439 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002440 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002441 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2442 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002443 fi ]
2444)
2445
Darren Tucker129d0bb2005-12-19 17:40:40 +11002446# Check for OpenSSL without EVP_aes_{192,256}_cbc
2447AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002448AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002449 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002450#include <string.h>
2451#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002452 ]], [[
2453 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002454 ]])],
2455 [
Tim Rice648f8762011-01-26 12:38:57 -08002456 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002457 ],
2458 [
Tim Rice648f8762011-01-26 12:38:57 -08002459 AC_MSG_RESULT([yes])
2460 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002461 [libcrypto is missing AES 192 and 256 bit functions])
2462 ]
2463)
2464
Damien Miller25a02b02012-12-13 08:18:56 +11002465# Check for OpenSSL with EVP_aes_*ctr
2466AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2467AC_LINK_IFELSE(
2468 [AC_LANG_PROGRAM([[
2469#include <string.h>
2470#include <openssl/evp.h>
2471 ]], [[
2472 exit(EVP_aes_128_ctr() == NULL ||
2473 EVP_aes_192_cbc() == NULL ||
2474 EVP_aes_256_cbc() == NULL);
2475 ]])],
2476 [
2477 AC_MSG_RESULT([yes])
2478 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2479 [libcrypto has EVP AES CTR])
2480 ],
2481 [
2482 AC_MSG_RESULT([no])
2483 ]
2484)
2485
Damien Millerd522c682013-01-09 16:42:47 +11002486# Check for OpenSSL with EVP_aes_*gcm
2487AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2488AC_LINK_IFELSE(
2489 [AC_LANG_PROGRAM([[
2490#include <string.h>
2491#include <openssl/evp.h>
2492 ]], [[
2493 exit(EVP_aes_128_gcm() == NULL ||
Damien Millerb6f73b32013-02-11 10:39:12 +11002494 EVP_aes_256_gcm() == NULL ||
2495 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2496 EVP_CTRL_GCM_IV_GEN == 0 ||
2497 EVP_CTRL_GCM_SET_TAG == 0 ||
2498 EVP_CTRL_GCM_GET_TAG == 0 ||
2499 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
Damien Millerd522c682013-01-09 16:42:47 +11002500 ]])],
2501 [
2502 AC_MSG_RESULT([yes])
2503 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2504 [libcrypto has EVP AES GCM])
2505 ],
2506 [
2507 AC_MSG_RESULT([no])
Darren Tucker6d8bd572013-06-11 11:26:10 +10002508 unsupported_algorithms="$unsupported_cipers \
2509 aes128-gcm@openssh.com aes256-gcm@openssh.com"
Damien Millerd522c682013-01-09 16:42:47 +11002510 ]
2511)
2512
Damien Millerb6f73b32013-02-11 10:39:12 +11002513AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2514 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2515 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2516
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002517AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2518AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002519 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002520#include <string.h>
2521#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002522 ]], [[
2523 if(EVP_DigestUpdate(NULL, NULL,0))
2524 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002525 ]])],
2526 [
Tim Rice648f8762011-01-26 12:38:57 -08002527 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002528 ],
2529 [
Tim Rice648f8762011-01-26 12:38:57 -08002530 AC_MSG_RESULT([no])
2531 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002532 [Define if EVP_DigestUpdate returns void])
2533 ]
2534)
2535
Tim Rice3d5352e2004-02-12 09:27:21 -08002536# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2537# because the system crypt() is more featureful.
2538if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002539 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002540fi
2541
Damien Millera8e06ce2003-11-21 23:48:55 +11002542# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002543# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002544if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002545 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002546fi
Darren Tuckerc0c33732013-06-02 06:28:03 +10002547AC_CHECK_FUNCS([crypt DES_crypt])
Damien Millera64b57a2001-01-17 10:44:13 +11002548
Damien Milleraf87af12006-03-15 13:02:28 +11002549# Search for SHA256 support in libc and/or OpenSSL
Darren Tucker4bf7e502013-11-07 22:33:48 +11002550AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2551 [unsupported_algorithms="$unsupported_algorithms \
Darren Tucker6d8bd572013-06-11 11:26:10 +10002552 hmac-sha2-256 hmac-sha2-512 \
2553 diffie-hellman-group-exchange-sha256 \
2554 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2555 ]
2556)
Damien Milleraf87af12006-03-15 13:02:28 +11002557
Damien Miller6af914a2010-09-10 11:39:26 +10002558# Check complete ECC support in OpenSSL
Darren Tucker37bcef52013-11-09 18:39:25 +11002559AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2560AC_LINK_IFELSE(
2561 [AC_LANG_PROGRAM([[
2562#include <openssl/ec.h>
2563#include <openssl/ecdh.h>
2564#include <openssl/ecdsa.h>
2565#include <openssl/evp.h>
2566#include <openssl/objects.h>
2567#include <openssl/opensslv.h>
2568#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2569# error "OpenSSL < 0.9.8g has unreliable ECC code"
2570#endif
2571 ]], [[
2572 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2573 const EVP_MD *m = EVP_sha256(); /* We need this too */
2574 ]])],
2575 [ AC_MSG_RESULT([yes])
2576 enable_nistp256=1 ],
2577 [ AC_MSG_RESULT([no]) ]
2578)
2579
2580AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2581AC_LINK_IFELSE(
2582 [AC_LANG_PROGRAM([[
2583#include <openssl/ec.h>
2584#include <openssl/ecdh.h>
2585#include <openssl/ecdsa.h>
2586#include <openssl/evp.h>
2587#include <openssl/objects.h>
2588#include <openssl/opensslv.h>
2589#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2590# error "OpenSSL < 0.9.8g has unreliable ECC code"
2591#endif
2592 ]], [[
2593 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2594 const EVP_MD *m = EVP_sha384(); /* We need this too */
2595 ]])],
2596 [ AC_MSG_RESULT([yes])
2597 enable_nistp384=1 ],
2598 [ AC_MSG_RESULT([no]) ]
2599)
2600
2601AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
Damien Miller6af914a2010-09-10 11:39:26 +10002602AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002603 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002604#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002605#include <openssl/ecdh.h>
2606#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002607#include <openssl/evp.h>
2608#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002609#include <openssl/opensslv.h>
2610#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2611# error "OpenSSL < 0.9.8g has unreliable ECC code"
2612#endif
Tim Rice648f8762011-01-26 12:38:57 -08002613 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002614 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2615 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002616 ]])],
Darren Tucker37bcef52013-11-09 18:39:25 +11002617 [ AC_MSG_RESULT([yes])
2618 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2619 AC_RUN_IFELSE(
2620 [AC_LANG_PROGRAM([[
2621#include <openssl/ec.h>
2622#include <openssl/ecdh.h>
2623#include <openssl/ecdsa.h>
2624#include <openssl/evp.h>
2625#include <openssl/objects.h>
2626#include <openssl/opensslv.h>
2627 ]],[[
2628 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2629 const EVP_MD *m = EVP_sha512(); /* We need this too */
2630 exit(e == NULL || m == NULL);
2631 ]])],
2632 [ AC_MSG_RESULT([yes])
2633 enable_nistp521=1 ],
2634 [ AC_MSG_RESULT([no]) ],
Darren Tucker95cb2d42013-11-09 22:02:31 +11002635 [ AC_MSG_WARN([cross-compiling: assuming yes])
Darren Tucker37bcef52013-11-09 18:39:25 +11002636 enable_nistp521=1 ]
Darren Tucker95cb2d42013-11-09 22:02:31 +11002637 )],
Darren Tucker37bcef52013-11-09 18:39:25 +11002638 AC_MSG_RESULT([no])
Damien Miller6af914a2010-09-10 11:39:26 +10002639)
Darren Tucker37bcef52013-11-09 18:39:25 +11002640
2641COMMENT_OUT_ECC="#no ecc#"
2642TEST_SSH_ECC=no
2643
2644if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
Darren Tuckerdd5264d2013-11-09 22:32:51 +11002645 test x$enable_nistp521 = x1; then
Darren Tucker37bcef52013-11-09 18:39:25 +11002646 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2647fi
2648if test x$enable_nistp256 = x1; then
2649 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2650 [libcrypto has NID_X9_62_prime256v1])
2651 TEST_SSH_ECC=yes
2652 COMMENT_OUT_ECC=""
2653else
2654 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2655 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2656fi
2657if test x$enable_nistp384 = x1; then
2658 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2659 TEST_SSH_ECC=yes
2660 COMMENT_OUT_ECC=""
2661else
2662 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2663 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2664fi
2665if test x$enable_nistp521 = x1; then
2666 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2667 TEST_SSH_ECC=yes
2668 COMMENT_OUT_ECC=""
2669else
2670 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2671 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2672fi
2673
Tim Rice648f8762011-01-26 12:38:57 -08002674AC_SUBST([TEST_SSH_ECC])
2675AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002676
Tim Rice99203ec2007-03-26 09:35:28 -07002677saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002678AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002679 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002680 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2681 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002682 [Define if system has libiaf that supports set_id])
2683 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002684])
2685LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002686
2687### Configure cryptographic random number support
2688
2689# Check wheter OpenSSL seeds itself
2690AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002691AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002692 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002693#include <string.h>
2694#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002695 ]], [[
2696 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002697 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002698 [
2699 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002700 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002701 ],
2702 [
Tim Rice648f8762011-01-26 12:38:57 -08002703 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002704 ],
2705 [
2706 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002707 # This is safe, since we will fatal() at runtime if
2708 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002709 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002710 ]
2711)
2712
Damien Millerf22019b2011-05-05 13:48:37 +10002713# PRNGD TCP socket
2714AC_ARG_WITH([prngd-port],
2715 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2716 [
2717 case "$withval" in
2718 no)
2719 withval=""
2720 ;;
2721 [[0-9]]*)
2722 ;;
2723 *)
2724 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2725 ;;
2726 esac
2727 if test ! -z "$withval" ; then
2728 PRNGD_PORT="$withval"
2729 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2730 [Port number of PRNGD/EGD random number socket])
2731 fi
2732 ]
2733)
2734
2735# PRNGD Unix domain socket
2736AC_ARG_WITH([prngd-socket],
2737 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2738 [
2739 case "$withval" in
2740 yes)
2741 withval="/var/run/egd-pool"
2742 ;;
2743 no)
2744 withval=""
2745 ;;
2746 /*)
2747 ;;
2748 *)
2749 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2750 ;;
2751 esac
2752
2753 if test ! -z "$withval" ; then
2754 if test ! -z "$PRNGD_PORT" ; then
2755 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2756 fi
2757 if test ! -r "$withval" ; then
2758 AC_MSG_WARN([Entropy socket is not readable])
2759 fi
2760 PRNGD_SOCKET="$withval"
2761 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2762 [Location of PRNGD/EGD random number socket])
2763 fi
2764 ],
2765 [
2766 # Check for existing socket only if we don't have a random device already
2767 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2768 AC_MSG_CHECKING([for PRNGD/EGD socket])
2769 # Insert other locations here
2770 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2771 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2772 PRNGD_SOCKET="$sock"
2773 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2774 break;
2775 fi
2776 done
2777 if test ! -z "$PRNGD_SOCKET" ; then
2778 AC_MSG_RESULT([$PRNGD_SOCKET])
2779 else
2780 AC_MSG_RESULT([not found])
2781 fi
2782 fi
2783 ]
2784)
2785
2786# Which randomness source do we use?
2787if test ! -z "$PRNGD_PORT" ; then
2788 RAND_MSG="PRNGd port $PRNGD_PORT"
2789elif test ! -z "$PRNGD_SOCKET" ; then
2790 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2791elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2792 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2793 [Define if you want OpenSSL's internally seeded PRNG only])
2794 RAND_MSG="OpenSSL internal ONLY"
2795else
2796 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])
2797fi
2798
Darren Tucker3e6bde42006-08-20 20:03:50 +10002799# Check for PAM libs
2800PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002801AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002802 [ --with-pam Enable PAM support ],
2803 [
2804 if test "x$withval" != "xno" ; then
2805 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2806 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2807 AC_MSG_ERROR([PAM headers not found])
2808 fi
2809
2810 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002811 AC_CHECK_LIB([dl], [dlopen], , )
2812 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2813 AC_CHECK_FUNCS([pam_getenvlist])
2814 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002815 LIBS="$saved_LIBS"
2816
2817 PAM_MSG="yes"
2818
Darren Tucker20e9f972007-03-25 18:26:01 +10002819 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002820 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002821 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002822
Darren Tucker3e6bde42006-08-20 20:03:50 +10002823 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002824 case "$LIBS" in
2825 *-ldl*)
2826 # libdl already in LIBS
2827 ;;
2828 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002829 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002830 ;;
2831 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002832 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002833 fi
2834 ]
2835)
2836
2837# Check for older PAM
2838if test "x$PAM_MSG" = "xyes" ; then
2839 # Check PAM strerror arguments (old PAM)
2840 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002841 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002842#include <stdlib.h>
2843#if defined(HAVE_SECURITY_PAM_APPL_H)
2844#include <security/pam_appl.h>
2845#elif defined (HAVE_PAM_PAM_APPL_H)
2846#include <pam/pam_appl.h>
2847#endif
Tim Rice648f8762011-01-26 12:38:57 -08002848 ]], [[
2849(void)pam_strerror((pam_handle_t *)NULL, -1);
2850 ]])], [AC_MSG_RESULT([no])], [
2851 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002852 [Define if you have an old version of PAM
2853 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002854 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002855 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002856
2857 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002858fi
Damien Miller6c21c512002-01-22 21:57:53 +11002859
Damien Millerd3f6ad22002-06-25 10:24:47 +10002860SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002861AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002862 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002863 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002864 if test -n "$withval" && test "x$withval" != "xno" && \
2865 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002866 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002867 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002868 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002869)
Tim Rice648f8762011-01-26 12:38:57 -08002870AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002871 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002872AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002873
Damien Miller91f40d82013-02-22 11:37:00 +11002874if test "x$have_linux_no_new_privs" = "x1" ; then
2875AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2876 #include <sys/types.h>
2877 #include <linux/seccomp.h>
2878])
2879fi
2880if test "x$have_seccomp_filter" = "x1" ; then
2881AC_MSG_CHECKING([kernel for seccomp_filter support])
2882AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2883 #include <errno.h>
2884 #include <elf.h>
2885 #include <linux/audit.h>
2886 #include <linux/seccomp.h>
2887 #include <stdlib.h>
2888 #include <sys/prctl.h>
2889 ]],
2890 [[ int i = $seccomp_audit_arch;
2891 errno = 0;
2892 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2893 exit(errno == EFAULT ? 0 : 1); ]])],
2894 [ AC_MSG_RESULT([yes]) ], [
2895 AC_MSG_RESULT([no])
2896 # Disable seccomp filter as a target
2897 have_seccomp_filter=0
2898 ]
2899)
2900fi
2901
Damien Miller69ff1df2011-06-23 08:30:03 +10002902# Decide which sandbox style to use
2903sandbox_arg=""
2904AC_ARG_WITH([sandbox],
Damien Miller868ea1e2014-01-17 16:47:04 +11002905 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter, capsicum)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002906 [
2907 if test "x$withval" = "xyes" ; then
2908 sandbox_arg=""
2909 else
2910 sandbox_arg="$withval"
2911 fi
2912 ]
2913)
Darren Tucker60395f92012-07-03 14:31:18 +10002914
2915# Some platforms (seems to be the ones that have a kernel poll(2)-type
2916# function with which they implement select(2)) use an extra file descriptor
2917# when calling select(2), which means we can't use the rlimit sandbox.
2918AC_MSG_CHECKING([if select works with descriptor rlimit])
2919AC_RUN_IFELSE(
2920 [AC_LANG_PROGRAM([[
2921#include <sys/types.h>
2922#ifdef HAVE_SYS_TIME_H
2923# include <sys/time.h>
2924#endif
2925#include <sys/resource.h>
2926#ifdef HAVE_SYS_SELECT_H
2927# include <sys/select.h>
2928#endif
2929#include <errno.h>
2930#include <fcntl.h>
2931#include <stdlib.h>
2932 ]],[[
2933 struct rlimit rl_zero;
2934 int fd, r;
2935 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002936 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002937
2938 fd = open("/dev/null", O_RDONLY);
2939 FD_ZERO(&fds);
2940 FD_SET(fd, &fds);
2941 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2942 setrlimit(RLIMIT_FSIZE, &rl_zero);
2943 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002944 tv.tv_sec = 1;
2945 tv.tv_usec = 0;
2946 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002947 exit (r == -1 ? 1 : 0);
2948 ]])],
2949 [AC_MSG_RESULT([yes])
2950 select_works_with_rlimit=yes],
2951 [AC_MSG_RESULT([no])
2952 select_works_with_rlimit=no],
2953 [AC_MSG_WARN([cross compiling: assuming yes])]
2954)
2955
Darren Tuckerff008de2013-03-06 17:48:48 +11002956AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2957AC_RUN_IFELSE(
2958 [AC_LANG_PROGRAM([[
2959#include <sys/types.h>
2960#ifdef HAVE_SYS_TIME_H
2961# include <sys/time.h>
2962#endif
2963#include <sys/resource.h>
2964#include <errno.h>
2965#include <stdlib.h>
2966 ]],[[
2967 struct rlimit rl_zero;
2968 int fd, r;
2969 fd_set fds;
2970
2971 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2972 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2973 exit (r == -1 ? 1 : 0);
2974 ]])],
2975 [AC_MSG_RESULT([yes])
2976 rlimit_nofile_zero_works=yes],
2977 [AC_MSG_RESULT([no])
2978 rlimit_nofile_zero_works=no],
2979 [AC_MSG_WARN([cross compiling: assuming yes])]
2980)
2981
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002982AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2983AC_RUN_IFELSE(
2984 [AC_LANG_PROGRAM([[
2985#include <sys/types.h>
2986#include <sys/resource.h>
2987#include <stdlib.h>
2988 ]],[[
2989 struct rlimit rl_zero;
2990
2991 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2992 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2993 ]])],
2994 [AC_MSG_RESULT([yes])],
2995 [AC_MSG_RESULT([no])
2996 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
2997 [setrlimit RLIMIT_FSIZE works])],
2998 [AC_MSG_WARN([cross compiling: assuming yes])]
2999)
3000
Damien Miller69ff1df2011-06-23 08:30:03 +10003001if test "x$sandbox_arg" = "xsystrace" || \
3002 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003003 test "x$have_systr_policy_kill" != "x1" && \
3004 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003005 SANDBOX_STYLE="systrace"
3006 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003007elif test "x$sandbox_arg" = "xdarwin" || \
3008 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3009 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003010 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3011 "x$ac_cv_header_sandbox_h" != "xyes" && \
3012 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003013 SANDBOX_STYLE="darwin"
3014 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003015elif test "x$sandbox_arg" = "xseccomp_filter" || \
3016 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003017 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003018 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003019 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003020 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3021 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003022 test "x$have_linux_no_new_privs" = "x1" && \
3023 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003024 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003025 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3026 test "x$have_linux_no_new_privs" != "x1" && \
3027 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3028 test "x$have_seccomp_filter" != "x1" && \
3029 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3030 test "x$ac_cv_func_prctl" != "xyes" && \
3031 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3032 SANDBOX_STYLE="seccomp_filter"
3033 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003034elif test "x$sandbox_arg" = "xcapsicum" || \
3035 ( test -z "$sandbox_arg" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003036 test "x$ac_cv_header_sys_capability_h" = "x1" && \
3037 test "x$ac_cv_func_cap_rights_limit" = "x1") ; then
3038 test "x$ac_cv_header_sys_capability_h" != "x1" && \
3039 AC_MSG_ERROR([capsicum sandbox requires sys/capability.h header])
3040 test "x$ac_cv_func_cap_rights_limit" != "x1" && \
3041 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003042 SANDBOX_STYLE="capsicum"
3043 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003044elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003045 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003046 test "x$select_works_with_rlimit" = "xyes" && \
3047 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003048 test "x$ac_cv_func_setrlimit" != "xyes" && \
3049 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003050 test "x$select_works_with_rlimit" != "xyes" && \
3051 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003052 SANDBOX_STYLE="rlimit"
3053 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
3054elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3055 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3056 SANDBOX_STYLE="none"
3057 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3058else
Tim Ricea6e60612011-08-17 21:48:22 -07003059 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003060fi
3061
Ben Lindstromb5628642000-10-18 00:02:25 +00003062# Cheap hack to ensure NEWS-OS libraries are arranged right.
3063if test ! -z "$SONY" ; then
3064 LIBS="$LIBS -liberty";
3065fi
3066
Damien Miller57f39152005-11-24 19:58:19 +11003067# Check for long long datatypes
3068AC_CHECK_TYPES([long long, unsigned long long, long double])
3069
3070# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003071AC_CHECK_SIZEOF([short int], [2])
3072AC_CHECK_SIZEOF([int], [4])
3073AC_CHECK_SIZEOF([long int], [4])
3074AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003075
Damien Millerfa2bb692002-04-23 23:22:25 +10003076# Sanity check long long for some platforms (AIX)
3077if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3078 ac_cv_sizeof_long_long_int=0
3079fi
3080
Darren Tucker537f1ed2005-10-25 18:38:33 +10003081# compute LLONG_MIN and LLONG_MAX if we don't know them.
3082if test -z "$have_llong_max"; then
3083 AC_MSG_CHECKING([for max value of long long])
3084 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003085 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003086#include <stdio.h>
3087/* Why is this so damn hard? */
3088#ifdef __GNUC__
3089# undef __GNUC__
3090#endif
3091#define __USE_ISOC99
3092#include <limits.h>
3093#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003094#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3095
3096/*
3097 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3098 * we do this the hard way.
3099 */
3100static int
3101fprint_ll(FILE *f, long long n)
3102{
3103 unsigned int i;
3104 int l[sizeof(long long) * 8];
3105
3106 if (n < 0)
3107 if (fprintf(f, "-") < 0)
3108 return -1;
3109 for (i = 0; n != 0; i++) {
3110 l[i] = my_abs(n % 10);
3111 n /= 10;
3112 }
3113 do {
3114 if (fprintf(f, "%d", l[--i]) < 0)
3115 return -1;
3116 } while (i != 0);
3117 if (fprintf(f, " ") < 0)
3118 return -1;
3119 return 0;
3120}
Tim Rice648f8762011-01-26 12:38:57 -08003121 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003122 FILE *f;
3123 long long i, llmin, llmax = 0;
3124
3125 if((f = fopen(DATA,"w")) == NULL)
3126 exit(1);
3127
3128#if defined(LLONG_MIN) && defined(LLONG_MAX)
3129 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3130 llmin = LLONG_MIN;
3131 llmax = LLONG_MAX;
3132#else
3133 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3134 /* This will work on one's complement and two's complement */
3135 for (i = 1; i > llmax; i <<= 1, i++)
3136 llmax = i;
3137 llmin = llmax + 1LL; /* wrap */
3138#endif
3139
3140 /* Sanity check */
3141 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003142 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3143 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003144 fprintf(f, "unknown unknown\n");
3145 exit(2);
3146 }
3147
Darren Tuckerd1450db2006-03-13 19:06:51 +11003148 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003149 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003150 if (fprint_ll(f, llmax) < 0)
3151 exit(4);
3152 if (fclose(f) < 0)
3153 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003154 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003155 ]])],
3156 [
3157 llong_min=`$AWK '{print $1}' conftest.llminmax`
3158 llong_max=`$AWK '{print $2}' conftest.llminmax`
3159
Tim Rice648f8762011-01-26 12:38:57 -08003160 AC_MSG_RESULT([$llong_max])
3161 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003162 [max value of long long calculated by configure])
3163 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003164 AC_MSG_RESULT([$llong_min])
3165 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003166 [min value of long long calculated by configure])
3167 ],
3168 [
Tim Rice648f8762011-01-26 12:38:57 -08003169 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003170 ],
3171 [
3172 AC_MSG_WARN([cross compiling: not checking])
3173 ]
3174 )
3175fi
3176
3177
Damien Millera22ba012000-03-02 23:09:20 +11003178# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003179AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003180 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3181 [[ u_int a; a = 1;]])],
3182 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
3183 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003184])
3185if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003186 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003187 have_u_int=1
3188fi
3189
Damien Miller61e50f12000-05-08 20:49:37 +10003190AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003191 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3192 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
3193 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
3194 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003195])
3196if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003197 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003198 have_intxx_t=1
3199fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003200
3201if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003202 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003203then
3204 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003205 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3206 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003207 [
Tim Rice648f8762011-01-26 12:38:57 -08003208 AC_DEFINE([HAVE_INTXX_T])
3209 AC_MSG_RESULT([yes])
3210 ], [ AC_MSG_RESULT([no])
3211 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003212fi
3213
Damien Miller578783e2000-09-23 14:12:24 +11003214AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003215 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003216#include <sys/types.h>
3217#ifdef HAVE_STDINT_H
3218# include <stdint.h>
3219#endif
3220#include <sys/socket.h>
3221#ifdef HAVE_SYS_BITYPES_H
3222# include <sys/bitypes.h>
3223#endif
Tim Rice648f8762011-01-26 12:38:57 -08003224 ]], [[
3225int64_t a; a = 1;
3226 ]])],
3227 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
3228 ])
Damien Miller578783e2000-09-23 14:12:24 +11003229])
3230if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003231 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003232fi
3233
Damien Miller61e50f12000-05-08 20:49:37 +10003234AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003235 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3236 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
3237 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
3238 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003239])
3240if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003241 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003242 have_u_intxx_t=1
3243fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003244
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003245if test -z "$have_u_intxx_t" ; then
3246 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003247 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3248 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003249 [
Tim Rice648f8762011-01-26 12:38:57 -08003250 AC_DEFINE([HAVE_U_INTXX_T])
3251 AC_MSG_RESULT([yes])
3252 ], [ AC_MSG_RESULT([no])
3253 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003254fi
3255
Damien Miller578783e2000-09-23 14:12:24 +11003256AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003257 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3258 [[ u_int64_t a; a = 1;]])],
3259 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
3260 ])
Damien Miller578783e2000-09-23 14:12:24 +11003261])
3262if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003263 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003264 have_u_int64_t=1
3265fi
3266
Tim Rice4cec93f2002-02-26 08:40:48 -08003267if test -z "$have_u_int64_t" ; then
3268 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003269 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3270 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003271 [
Tim Rice648f8762011-01-26 12:38:57 -08003272 AC_DEFINE([HAVE_U_INT64_T])
3273 AC_MSG_RESULT([yes])
3274 ], [ AC_MSG_RESULT([no])
3275 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003276fi
3277
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003278if test -z "$have_u_intxx_t" ; then
3279 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003280 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003281#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003282 ]], [[
3283 uint8_t a;
3284 uint16_t b;
3285 uint32_t c;
3286 a = b = c = 1;
3287 ]])],
3288 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3289 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003290 ])
3291 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003292 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003293 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003294 fi
3295fi
3296
3297if test -z "$have_uintxx_t" ; then
3298 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3300 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003301 [
Tim Rice648f8762011-01-26 12:38:57 -08003302 AC_DEFINE([HAVE_UINTXX_T])
3303 AC_MSG_RESULT([yes])
3304 ], [ AC_MSG_RESULT([no])
3305 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003306fi
3307
Darren Tucker6d725682014-01-17 19:17:34 +11003308if test -z "$have_uintxx_t" ; then
3309 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3310 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3311 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3312 [
3313 AC_DEFINE([HAVE_UINTXX_T])
3314 AC_MSG_RESULT([yes])
3315 ], [ AC_MSG_RESULT([no])
3316 ])
3317fi
3318
Damien Milleredb82922000-06-20 13:25:52 +10003319if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003320 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003321then
3322 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003323 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003324#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003325 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003326 int8_t a; int16_t b; int32_t c;
3327 u_int8_t e; u_int16_t f; u_int32_t g;
3328 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003329 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003330 [
Tim Rice648f8762011-01-26 12:38:57 -08003331 AC_DEFINE([HAVE_U_INTXX_T])
3332 AC_DEFINE([HAVE_INTXX_T])
3333 AC_MSG_RESULT([yes])
3334 ], [AC_MSG_RESULT([no])
3335 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003336fi
3337
Damien Miller58be7382001-09-15 21:31:54 +10003338
3339AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003340 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3341 [[ u_char foo; foo = 125; ]])],
3342 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3343 ])
Damien Miller58be7382001-09-15 21:31:54 +10003344])
3345if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003346 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003347fi
3348
Darren Tucker007e3b32013-11-03 18:43:55 +11003349AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3350#include <sys/types.h>
3351#include <stdint.h>
3352])
3353
Tim Rice13aae5e2001-10-21 17:53:58 -07003354TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003355
Tim Rice648f8762011-01-26 12:38:57 -08003356AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3357AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003358#include <sys/types.h>
3359#ifdef HAVE_SYS_BITYPES_H
3360#include <sys/bitypes.h>
3361#endif
3362#ifdef HAVE_SYS_STATFS_H
3363#include <sys/statfs.h>
3364#endif
3365#ifdef HAVE_SYS_STATVFS_H
3366#include <sys/statvfs.h>
3367#endif
3368])
Tim Rice4cec93f2002-02-26 08:40:48 -08003369
Tim Rice648f8762011-01-26 12:38:57 -08003370AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003371[#include <sys/types.h>
3372#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003373
Damien Miller61e50f12000-05-08 20:49:37 +10003374AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003375 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3376 [[ size_t foo; foo = 1235; ]])],
3377 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3378 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003379])
3380if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003381 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003382fi
Damien Miller95058511999-12-29 10:36:45 +11003383
Damien Miller615f9392000-05-17 22:53:33 +10003384AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3386 [[ ssize_t foo; foo = 1235; ]])],
3387 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3388 ])
Damien Miller615f9392000-05-17 22:53:33 +10003389])
3390if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003391 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003392fi
3393
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003394AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003395 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3396 [[ clock_t foo; foo = 1235; ]])],
3397 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3398 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003399])
3400if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003401 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003402fi
3403
Damien Millerb54b40e2000-06-23 08:23:34 +10003404AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003406#include <sys/types.h>
3407#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003408 ]], [[ sa_family_t foo; foo = 1235; ]])],
3409 [ ac_cv_have_sa_family_t="yes" ],
3410 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003411#include <sys/types.h>
3412#include <sys/socket.h>
3413#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003414 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003415 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003416 [ ac_cv_have_sa_family_t="no" ]
3417 )
Tim Rice648f8762011-01-26 12:38:57 -08003418 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003419])
3420if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003421 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003422 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003423fi
3424
Damien Miller0f91b4e2000-06-18 15:43:25 +10003425AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003426 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3427 [[ pid_t foo; foo = 1235; ]])],
3428 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3429 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003430])
3431if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003432 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003433fi
3434
3435AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003436 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3437 [[ mode_t foo; foo = 1235; ]])],
3438 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3439 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003440])
3441if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003442 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003443fi
3444
Damien Miller61e50f12000-05-08 20:49:37 +10003445
3446AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003447 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003448#include <sys/types.h>
3449#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003450 ]], [[ struct sockaddr_storage s; ]])],
3451 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3452 [ ac_cv_have_struct_sockaddr_storage="no"
3453 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003454])
3455if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003456 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003457 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003458fi
Damien Miller34132e52000-01-14 15:45:46 +11003459
Damien Miller61e50f12000-05-08 20:49:37 +10003460AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003462#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003463#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003464 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3465 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3466 [ ac_cv_have_struct_sockaddr_in6="no"
3467 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003468])
3469if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003470 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003471 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003472fi
Damien Miller34132e52000-01-14 15:45:46 +11003473
Damien Miller61e50f12000-05-08 20:49:37 +10003474AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003475 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003476#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003477#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003478 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3479 [ ac_cv_have_struct_in6_addr="yes" ],
3480 [ ac_cv_have_struct_in6_addr="no"
3481 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003482])
3483if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003484 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003485 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003486
3487dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003488 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003489 [
3490#ifdef HAVE_SYS_TYPES_H
3491#include <sys/types.h>
3492#endif
3493#include <netinet/in.h>
3494 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003495fi
Damien Miller34132e52000-01-14 15:45:46 +11003496
Damien Miller61e50f12000-05-08 20:49:37 +10003497AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003498 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003499#include <sys/types.h>
3500#include <sys/socket.h>
3501#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003502 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3503 [ ac_cv_have_struct_addrinfo="yes" ],
3504 [ ac_cv_have_struct_addrinfo="no"
3505 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003506])
3507if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003508 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003509 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003510fi
3511
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003512AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003513 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3514 [[ struct timeval tv; tv.tv_sec = 1;]])],
3515 [ ac_cv_have_struct_timeval="yes" ],
3516 [ ac_cv_have_struct_timeval="no"
3517 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003518])
3519if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003520 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003521 have_struct_timeval=1
3522fi
3523
Tim Rice648f8762011-01-26 12:38:57 -08003524AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003525
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003526# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003527if test "x$ac_cv_have_int64_t" = "xno" && \
3528 test "x$ac_cv_sizeof_long_int" != "x8" && \
3529 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003530 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3531 echo "an alternative compiler (I.E., GCC) before continuing."
3532 echo ""
3533 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003534else
3535dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003536 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003537 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003538#include <stdio.h>
3539#include <string.h>
3540#ifdef HAVE_SNPRINTF
3541main()
3542{
3543 char buf[50];
3544 char expected_out[50];
3545 int mazsize = 50 ;
3546#if (SIZEOF_LONG_INT == 8)
3547 long int num = 0x7fffffffffffffff;
3548#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003549 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003550#endif
3551 strcpy(expected_out, "9223372036854775807");
3552 snprintf(buf, mazsize, "%lld", num);
3553 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003554 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003555 exit(0);
3556}
3557#else
3558main() { exit(0); }
3559#endif
Tim Rice648f8762011-01-26 12:38:57 -08003560 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003561 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003562 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003563fi
3564
Damien Miller78315eb2000-09-29 23:01:36 +11003565dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003566OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3567OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3568OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3569OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3570OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3571OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3572OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3573OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3574OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3575OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3576OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3577OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3578OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3579OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3580OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3581OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3582OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003583
3584AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003585AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3586struct passwd.pw_change, struct passwd.pw_expire],
3587[], [], [[
3588#include <sys/types.h>
3589#include <pwd.h>
3590]])
3591
Tim Rice648f8762011-01-26 12:38:57 -08003592AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003593 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003594[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003595#include <stdio.h>
3596#if HAVE_SYS_TYPES_H
3597# include <sys/types.h>
3598#endif
3599#include <netinet/in.h>
3600#include <arpa/nameser.h>
3601#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003602]])
andre2ff7b5d2000-06-03 14:57:40 +00003603
Damien Miller61e50f12000-05-08 20:49:37 +10003604AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3605 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003607#include <sys/types.h>
3608#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003609 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3610 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3611 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003612])
3613if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003614 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003615fi
3616
Damien Miller61e50f12000-05-08 20:49:37 +10003617AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3618 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003619 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003620#include <sys/types.h>
3621#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003622 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3623 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3624 [ ac_cv_have___ss_family_in_struct_ss="no"
3625 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003626])
3627if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003628 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003629 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003630fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003631
Tim Rice28bbb0c2002-05-27 17:37:32 -07003632dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003633AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3634 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003636#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003637#include <sys/socket.h>
3638#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003639 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003640#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003641#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003642exit(1);
3643#endif
3644struct msghdr m;
3645m.msg_accrights = 0;
3646exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003647 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003648 [ ac_cv_have_accrights_in_msghdr="yes" ],
3649 [ ac_cv_have_accrights_in_msghdr="no" ]
3650 )
3651])
3652if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003653 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003654 [Define if your system uses access rights style
3655 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003656fi
3657
Tim Rice648f8762011-01-26 12:38:57 -08003658AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3659AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003660#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003661#include <sys/stat.h>
3662#ifdef HAVE_SYS_TIME_H
3663# include <sys/time.h>
3664#endif
3665#ifdef HAVE_SYS_MOUNT_H
3666#include <sys/mount.h>
3667#endif
3668#ifdef HAVE_SYS_STATVFS_H
3669#include <sys/statvfs.h>
3670#endif
Tim Rice648f8762011-01-26 12:38:57 -08003671 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3672 [ AC_MSG_RESULT([yes]) ],
3673 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003674
Tim Rice648f8762011-01-26 12:38:57 -08003675 AC_MSG_CHECKING([if fsid_t has member val])
3676 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003677#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003678#include <sys/statvfs.h>
3679 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3680 [ AC_MSG_RESULT([yes])
3681 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3682 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003683
Tim Rice648f8762011-01-26 12:38:57 -08003684 AC_MSG_CHECKING([if f_fsid has member __val])
3685 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003686#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003687#include <sys/statvfs.h>
3688 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3689 [ AC_MSG_RESULT([yes])
3690 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3691 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003692])
Darren Tucker77001382008-06-09 06:17:53 +10003693
Kevin Stevesa44e0352002-04-07 16:18:03 +00003694AC_CACHE_CHECK([for msg_control field in struct msghdr],
3695 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003696 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003697#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003698#include <sys/socket.h>
3699#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003700 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003701#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003702#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003703exit(1);
3704#endif
3705struct msghdr m;
3706m.msg_control = 0;
3707exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003708 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003709 [ ac_cv_have_control_in_msghdr="yes" ],
3710 [ ac_cv_have_control_in_msghdr="no" ]
3711 )
3712])
3713if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003714 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003715 [Define if your system uses ancillary data style
3716 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003717fi
3718
Damien Miller61e50f12000-05-08 20:49:37 +10003719AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003720 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3721 [[ extern char *__progname; printf("%s", __progname); ]])],
3722 [ ac_cv_libc_defines___progname="yes" ],
3723 [ ac_cv_libc_defines___progname="no"
3724 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003725])
3726if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003727 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003728fi
3729
Kevin Steves4846f4a2002-03-22 18:19:53 +00003730AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003731 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3732 [[ printf("%s", __FUNCTION__); ]])],
3733 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3734 [ ac_cv_cc_implements___FUNCTION__="no"
3735 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003736])
3737if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003738 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003739 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003740fi
3741
3742AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003743 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3744 [[ printf("%s", __func__); ]])],
3745 [ ac_cv_cc_implements___func__="yes" ],
3746 [ ac_cv_cc_implements___func__="no"
3747 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003748])
3749if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003750 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003751fi
3752
Damien Miller57f39152005-11-24 19:58:19 +11003753AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003754 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3755#include <stdarg.h>
3756va_list x,y;
3757 ]], [[ va_copy(x,y); ]])],
3758 [ ac_cv_have_va_copy="yes" ],
3759 [ ac_cv_have_va_copy="no"
3760 ])
Damien Miller57f39152005-11-24 19:58:19 +11003761])
3762if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003763 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003764fi
3765
3766AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003767 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3768#include <stdarg.h>
3769va_list x,y;
3770 ]], [[ __va_copy(x,y); ]])],
3771 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3772 ])
Damien Miller57f39152005-11-24 19:58:19 +11003773])
3774if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003775 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003776fi
3777
Damien Miller4f8e6692001-07-14 13:22:53 +10003778AC_CACHE_CHECK([whether getopt has optreset support],
3779 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003780 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3781 [[ extern int optreset; optreset = 0; ]])],
3782 [ ac_cv_have_getopt_optreset="yes" ],
3783 [ ac_cv_have_getopt_optreset="no"
3784 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003785])
3786if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003787 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003788 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003789fi
Damien Millera22ba012000-03-02 23:09:20 +11003790
Damien Millerecbb26d2000-07-15 14:59:14 +10003791AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003792 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3793[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3794 [ ac_cv_libc_defines_sys_errlist="yes" ],
3795 [ ac_cv_libc_defines_sys_errlist="no"
3796 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003797])
3798if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003799 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003800 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003801fi
3802
3803
Damien Miller11fa2cc2000-08-16 10:35:58 +10003804AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003805 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3806[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3807 [ ac_cv_libc_defines_sys_nerr="yes" ],
3808 [ ac_cv_libc_defines_sys_nerr="no"
3809 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003810])
3811if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003812 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003813fi
3814
Darren Tucker5f88d342003-10-15 16:57:57 +10003815# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003816AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3817 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003818 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003819 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003820 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003821 AC_SEARCH_LIBS([res_query], [resolv])
3822 AC_SEARCH_LIBS([dn_expand], [resolv])
3823 AC_MSG_CHECKING([if res_query will link])
3824 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003825#include <sys/types.h>
3826#include <netinet/in.h>
3827#include <arpa/nameser.h>
3828#include <netdb.h>
3829#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003830 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003831 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003832 ]])],
3833 AC_MSG_RESULT([yes]),
3834 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003835 saved_LIBS="$LIBS"
3836 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003837 AC_MSG_CHECKING([for res_query in -lresolv])
3838 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003839#include <sys/types.h>
3840#include <netinet/in.h>
3841#include <arpa/nameser.h>
3842#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003843#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003844 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003845 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003846 ]])],
3847 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003848 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003849 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003850 ])
Tim Rice648f8762011-01-26 12:38:57 -08003851 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003852 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003853 [#include <sys/types.h>
3854 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003855 AC_CHECK_MEMBER([HEADER.ad],
3856 [AC_DEFINE([HAVE_HEADER_AD], [1],
3857 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003858 [#include <arpa/nameser.h>])
3859 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003860
Tim Rice648f8762011-01-26 12:38:57 -08003861AC_MSG_CHECKING([if struct __res_state _res is an extern])
3862AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003863#include <stdio.h>
3864#if HAVE_SYS_TYPES_H
3865# include <sys/types.h>
3866#endif
3867#include <netinet/in.h>
3868#include <arpa/nameser.h>
3869#include <resolv.h>
3870extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003871 ]], [[ ]])],
3872 [AC_MSG_RESULT([yes])
3873 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003874 [Define if you have struct __res_state _res as an extern])
3875 ],
Tim Rice648f8762011-01-26 12:38:57 -08003876 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003877)
3878
Damien Miller73b42d22006-04-22 21:26:08 +10003879# Check whether user wants SELinux support
3880SELINUX_MSG="no"
3881LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003882AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003883 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003884 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003885 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003886 AC_DEFINE([WITH_SELINUX], [1],
3887 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003888 SELINUX_MSG="yes"
3889 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003890 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3891 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003892 [ LIBSELINUX="-lselinux"
3893 LIBS="$LIBS -lselinux"
3894 ],
Tim Rice648f8762011-01-26 12:38:57 -08003895 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003896 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003897 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003898 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003899 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003900 fi ]
3901)
Tim Rice648f8762011-01-26 12:38:57 -08003902AC_SUBST([SSHLIBS])
3903AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003904
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003905# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003906KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003907AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003908 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003909 [ if test "x$withval" != "xno" ; then
3910 if test "x$withval" = "xyes" ; then
3911 KRB5ROOT="/usr/local"
3912 else
3913 KRB5ROOT=${withval}
3914 fi
3915
Tim Rice648f8762011-01-26 12:38:57 -08003916 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003917 KRB5_MSG="yes"
3918
Tim Rice648f8762011-01-26 12:38:57 -08003919 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003920 [$KRB5ROOT/bin/krb5-config],
3921 [$KRB5ROOT/bin:$PATH])
3922 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003923 K5CFLAGS="`$KRB5CONF --cflags`"
3924 K5LIBS="`$KRB5CONF --libs`"
3925 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003926
Tim Rice648f8762011-01-26 12:38:57 -08003927 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003928 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003929 AC_MSG_RESULT([yes])
3930 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003931 [Define this if you want GSSAPI
3932 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003933 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3934 GSSLIBS="`$KRB5CONF --libs gssapi`"
3935 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003936 else
Tim Rice648f8762011-01-26 12:38:57 -08003937 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003938 fi
Tim Rice648f8762011-01-26 12:38:57 -08003939 AC_MSG_CHECKING([whether we are using Heimdal])
3940 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3941 ]], [[ char *tmp = heimdal_version; ]])],
3942 [ AC_MSG_RESULT([yes])
3943 AC_DEFINE([HEIMDAL], [1],
3944 [Define this if you are using the Heimdal
3945 version of Kerberos V5]) ],
3946 [AC_MSG_RESULT([no])
3947 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003948 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003949 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003950 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003951 AC_MSG_CHECKING([whether we are using Heimdal])
3952 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3953 ]], [[ char *tmp = heimdal_version; ]])],
3954 [ AC_MSG_RESULT([yes])
3955 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003956 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003957 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003958 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003959 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003960 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003961 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003962 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003963 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003964
3965 ])
3966 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003967
Tim Rice648f8762011-01-26 12:38:57 -08003968 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3969 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003970 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003971 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3972 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003973 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003974 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3975 [ AC_DEFINE([GSSAPI])
3976 GSSLIBS="-lgss" ],
3977 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3978 ])
Darren Tucker964de182013-02-22 10:39:59 +11003979 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003980
Tim Rice648f8762011-01-26 12:38:57 -08003981 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003982 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003983 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003984 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003985 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003986 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003987 ]
3988 )
3989
3990 oldCPP="$CPPFLAGS"
3991 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003992 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003993 [ CPPFLAGS="$oldCPP" ])
3994
Damien Millera8e06ce2003-11-21 23:48:55 +11003995 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003996 if test ! -z "$need_dash_r" ; then
3997 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3998 fi
3999 if test ! -z "$blibpath" ; then
4000 blibpath="$blibpath:${KRB5ROOT}/lib"
4001 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004002
Tim Rice648f8762011-01-26 12:38:57 -08004003 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4004 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4005 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004006
Tim Rice648f8762011-01-26 12:38:57 -08004007 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4008 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004009
4010 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4011#ifdef HAVE_GSSAPI_H
4012# include <gssapi.h>
4013#elif defined(HAVE_GSSAPI_GSSAPI_H)
4014# include <gssapi/gssapi.h>
4015#endif
4016
4017#ifdef HAVE_GSSAPI_GENERIC_H
4018# include <gssapi_generic.h>
4019#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4020# include <gssapi/gssapi_generic.h>
4021#endif
4022 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004023 saved_LIBS="$LIBS"
4024 LIBS="$LIBS $K5LIBS"
4025 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4026 LIBS="$saved_LIBS"
4027
Darren Tucker0d27ed12004-02-24 10:37:33 +11004028 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004029 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004030)
Darren Tucker964de182013-02-22 10:39:59 +11004031AC_SUBST([GSSLIBS])
4032AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004033
Damien Millera22ba012000-03-02 23:09:20 +11004034# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004035
Damien Millerf58c6722002-05-13 13:15:42 +10004036PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004037AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004038 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004039 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004040 if test -n "$withval" && test "x$withval" != "xno" && \
4041 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004042 PRIVSEP_PATH=$withval
4043 fi
4044 ]
4045)
Tim Rice648f8762011-01-26 12:38:57 -08004046AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004047
Tim Rice648f8762011-01-26 12:38:57 -08004048AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004049 [ --with-xauth=PATH Specify path to xauth program ],
4050 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004051 if test -n "$withval" && test "x$withval" != "xno" && \
4052 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004053 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004054 fi
4055 ],
4056 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004057 TestPath="$PATH"
4058 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4059 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4060 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4061 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004062 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004063 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004064 xauth_path="/usr/openwin/bin/xauth"
4065 fi
4066 ]
4067)
4068
Damien Miller7d901272003-01-13 16:55:22 +11004069STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004070AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004071 [ --disable-strip Disable calling strip(1) on install],
4072 [
4073 if test "x$enableval" = "xno" ; then
4074 STRIP_OPT=
4075 fi
4076 ]
4077)
Tim Rice648f8762011-01-26 12:38:57 -08004078AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004079
Damien Millera19cf472000-11-29 13:28:50 +11004080if test -z "$xauth_path" ; then
4081 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004082 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004083else
Tim Rice648f8762011-01-26 12:38:57 -08004084 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004085 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004086 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004087 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004088fi
Damien Millera22ba012000-03-02 23:09:20 +11004089
Tim Rice90f42b02011-06-02 18:17:49 -07004090dnl # --with-maildir=/path/to/mail gets top priority.
4091dnl # if maildir is set in the platform case statement above we use that.
4092dnl # Otherwise we run a program to get the dir from system headers.
4093dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4094dnl # If we find _PATH_MAILDIR we do nothing because that is what
4095dnl # session.c expects anyway. Otherwise we set to the value found
4096dnl # stripping any trailing slash. If for some strage reason our program
4097dnl # does not find what it needs, we default to /var/spool/mail.
4098# Check for mail directory
4099AC_ARG_WITH([maildir],
4100 [ --with-maildir=/path/to/mail Specify your system mail directory],
4101 [
4102 if test "X$withval" != X && test "x$withval" != xno && \
4103 test "x${withval}" != xyes; then
4104 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4105 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4106 fi
4107 ],[
4108 if test "X$maildir" != "X"; then
4109 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4110 else
4111 AC_MSG_CHECKING([Discovering system mail directory])
4112 AC_RUN_IFELSE(
4113 [AC_LANG_PROGRAM([[
4114#include <stdio.h>
4115#include <string.h>
4116#ifdef HAVE_PATHS_H
4117#include <paths.h>
4118#endif
4119#ifdef HAVE_MAILLOCK_H
4120#include <maillock.h>
4121#endif
4122#define DATA "conftest.maildir"
4123 ]], [[
4124 FILE *fd;
4125 int rc;
4126
4127 fd = fopen(DATA,"w");
4128 if(fd == NULL)
4129 exit(1);
4130
4131#if defined (_PATH_MAILDIR)
4132 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4133 exit(1);
4134#elif defined (MAILDIR)
4135 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4136 exit(1);
4137#elif defined (_PATH_MAIL)
4138 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4139 exit(1);
4140#else
4141 exit (2);
4142#endif
4143
4144 exit(0);
4145 ]])],
4146 [
4147 maildir_what=`awk -F: '{print $1}' conftest.maildir`
4148 maildir=`awk -F: '{print $2}' conftest.maildir \
4149 | sed 's|/$||'`
4150 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4151 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4152 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4153 fi
4154 ],
4155 [
4156 if test "X$ac_status" = "X2";then
4157# our test program didn't find it. Default to /var/spool/mail
4158 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4159 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4160 else
4161 AC_MSG_RESULT([*** not found ***])
4162 fi
4163 ],
4164 [
4165 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4166 ]
4167 )
4168 fi
4169 ]
4170) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004171
Darren Tucker623d92f2004-09-12 22:36:15 +10004172if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004173 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4174 disable_ptmx_check=yes
4175fi
Damien Millera22ba012000-03-02 23:09:20 +11004176if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004177 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004178 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004179 [
Tim Rice648f8762011-01-26 12:38:57 -08004180 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004181 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004182 have_dev_ptmx=1
4183 ]
4184 )
4185 fi
Damien Millera22ba012000-03-02 23:09:20 +11004186fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004187
Darren Tucker623d92f2004-09-12 22:36:15 +10004188if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004189 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004190 [
Tim Rice648f8762011-01-26 12:38:57 -08004191 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004192 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004193 have_dev_ptc=1
4194 ]
4195 )
4196else
4197 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4198fi
Damien Miller204ad072000-03-02 23:56:12 +11004199
Damien Millera22ba012000-03-02 23:09:20 +11004200# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004201AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004202 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004203 [
Damien Miller897741e2001-04-16 10:41:46 +10004204 case "$withval" in
4205 man|cat|doc)
4206 MANTYPE=$withval
4207 ;;
4208 *)
Tim Rice648f8762011-01-26 12:38:57 -08004209 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004210 ;;
4211 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004212 ]
4213)
Ben Lindstrombc709922001-04-18 18:04:21 +00004214if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004215 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004216 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004217 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4218 MANTYPE=doc
4219 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4220 MANTYPE=man
4221 else
4222 MANTYPE=cat
4223 fi
4224fi
Tim Rice648f8762011-01-26 12:38:57 -08004225AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004226if test "$MANTYPE" = "doc"; then
4227 mansubdir=man;
4228else
4229 mansubdir=$MANTYPE;
4230fi
Tim Rice648f8762011-01-26 12:38:57 -08004231AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004232
Damien Millera22ba012000-03-02 23:09:20 +11004233# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004234MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004235AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004236 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004237 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004238 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004239 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004240 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004241 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004242 fi
4243 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004244)
4245
Damien Millera22ba012000-03-02 23:09:20 +11004246# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004247AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004248 [ --without-shadow Disable shadow password support],
4249 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004250 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004251 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004252 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004253 fi
4254 ]
4255)
4256
Damien Miller1f335fb2000-06-26 11:31:33 +10004257if test -z "$disable_shadow" ; then
4258 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004259 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004260#include <sys/types.h>
4261#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004262struct spwd sp;
4263 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4264 [ sp_expire_available=yes ], [
4265 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004266
4267 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004268 AC_MSG_RESULT([yes])
4269 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004270 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004271 else
Tim Rice648f8762011-01-26 12:38:57 -08004272 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004273 fi
4274fi
4275
Damien Millera22ba012000-03-02 23:09:20 +11004276# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004277if test ! -z "$IPADDR_IN_DISPLAY" ; then
4278 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004279 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004280 [Define if you need to use IP address
4281 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004282else
Damien Millera8e06ce2003-11-21 23:48:55 +11004283 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004284 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004285 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4286 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004287 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004288 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004289 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004290 fi
4291 ]
4292 )
4293fi
Damien Miller76112de1999-12-21 11:18:08 +11004294
Darren Tuckere1a790d2003-09-16 11:52:19 +10004295# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004296AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004297 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004298 [ if test "x$enableval" = "xno"; then
4299 AC_MSG_NOTICE([/etc/default/login handling disabled])
4300 etc_default_login=no
4301 else
4302 etc_default_login=yes
4303 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004304 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4305 then
4306 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4307 etc_default_login=no
4308 else
4309 etc_default_login=yes
4310 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004311)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004312
Darren Tucker2f9573d2005-02-10 22:28:54 +11004313if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004314 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004315 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004316 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004317 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004318 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004319 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004320fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004321
Tim Rice43a1c132002-04-17 21:19:14 -07004322dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004323if test $ac_cv_func_login_getcapbool = "yes" && \
4324 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004325 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004326fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004327
Damien Millera22ba012000-03-02 23:09:20 +11004328# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004329SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004330AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004331 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004332 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004333 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004334 AC_MSG_WARN([
4335--with-default-path=PATH has no effect on this system.
4336Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004337 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004338 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004339 AC_MSG_WARN([
4340--with-default-path=PATH will only be used if PATH is not defined in
4341$external_path_file .])
4342 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004343 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004344 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004345 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004346 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004347 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4348 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004349 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004350 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004351 AC_MSG_WARN([
4352If PATH is defined in $external_path_file, ensure the path to scp is included,
4353otherwise scp will not work.])
4354 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004355 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004356 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004357/* find out what STDPATH is */
4358#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004359#ifdef HAVE_PATHS_H
4360# include <paths.h>
4361#endif
4362#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004363# ifdef _PATH_USERPATH /* Irix */
4364# define _PATH_STDPATH _PATH_USERPATH
4365# else
4366# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4367# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004368#endif
4369#include <sys/types.h>
4370#include <sys/stat.h>
4371#include <fcntl.h>
4372#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004373 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004374 FILE *fd;
4375 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004376
Tim Rice59ea0a02001-03-10 13:50:45 -08004377 fd = fopen(DATA,"w");
4378 if(fd == NULL)
4379 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004380
Tim Rice59ea0a02001-03-10 13:50:45 -08004381 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4382 exit(1);
4383
4384 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004385 ]])],
4386 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004387 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4388 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4389 )
4390# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004391 t_bindir="${bindir}"
4392 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4393 t_bindir=`eval echo ${t_bindir}`
4394 case $t_bindir in
4395 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4396 esac
4397 case $t_bindir in
4398 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4399 esac
4400 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004401 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4402 if test $? -ne 0 ; then
4403 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4404 if test $? -ne 0 ; then
4405 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004406 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004407 fi
4408 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004409 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004410)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004411if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004412 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4413 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004414fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004415
Damien Millera18bbd32002-05-13 10:48:57 +10004416# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004417AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004418 [ --with-superuser-path= Specify different path for super-user],
4419 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004420 if test -n "$withval" && test "x$withval" != "xno" && \
4421 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004422 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004423 [Define if you want a different $PATH
4424 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004425 superuser_path=$withval
4426 fi
4427 ]
4428)
4429
4430
Damien Miller61e50f12000-05-08 20:49:37 +10004431AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004432IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004433AC_ARG_WITH(4in6,
4434 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4435 [
4436 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004437 AC_MSG_RESULT([yes])
4438 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004439 [Detect IPv4 in IPv6 mapped addresses
4440 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004441 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004442 else
Tim Rice648f8762011-01-26 12:38:57 -08004443 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004444 fi
Tim Rice648f8762011-01-26 12:38:57 -08004445 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004446 if test "x$inet6_default_4in6" = "xyes"; then
4447 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004448 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004449 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004450 else
4451 AC_MSG_RESULT([no (default)])
4452 fi
4453 ]
4454)
4455
Damien Miller60396b02001-02-18 17:01:00 +11004456# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004457BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004458AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004459 [ --with-bsd-auth Enable BSD auth support],
4460 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004461 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004462 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004463 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004464 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004465 fi
4466 ]
4467)
4468
Damien Millera22ba012000-03-02 23:09:20 +11004469# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004470piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004471# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004472if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004473 piddir=`eval echo ${sysconfdir}`
4474 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004475 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004476 esac
4477fi
4478
Tim Rice648f8762011-01-26 12:38:57 -08004479AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004480 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4481 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004482 if test -n "$withval" && test "x$withval" != "xno" && \
4483 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004484 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004485 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004486 AC_MSG_WARN([** no $piddir directory on this system **])
4487 fi
4488 fi
4489 ]
4490)
4491
Tim Rice648f8762011-01-26 12:38:57 -08004492AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4493 [Specify location of ssh.pid])
4494AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004495
andre2ff7b5d2000-06-03 14:57:40 +00004496dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004497AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004498 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004499 [
4500 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004501 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004502 fi
4503 ]
andre2ff7b5d2000-06-03 14:57:40 +00004504)
Tim Rice648f8762011-01-26 12:38:57 -08004505AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004506 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004507 [
4508 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004509 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004510 fi
4511 ]
andre2ff7b5d2000-06-03 14:57:40 +00004512)
Tim Rice648f8762011-01-26 12:38:57 -08004513AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004514 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004515 [
4516 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004517 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004518 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004519 fi
4520 ]
andre2ff7b5d2000-06-03 14:57:40 +00004521)
Tim Rice648f8762011-01-26 12:38:57 -08004522AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004523 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004524 [
4525 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004526 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004527 fi
4528 ]
andre2ff7b5d2000-06-03 14:57:40 +00004529)
Tim Rice648f8762011-01-26 12:38:57 -08004530AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004531 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004532 [
4533 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004534 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004535 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004536 fi
4537 ]
andre2ff7b5d2000-06-03 14:57:40 +00004538)
Tim Rice648f8762011-01-26 12:38:57 -08004539AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004540 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004541 [
4542 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004543 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004544 fi
4545 ]
andre2ff7b5d2000-06-03 14:57:40 +00004546)
Tim Rice648f8762011-01-26 12:38:57 -08004547AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004548 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004549 [
4550 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004551 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004552 [Define if you don't want to use pututline()
4553 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004554 fi
4555 ]
andre2ff7b5d2000-06-03 14:57:40 +00004556)
Tim Rice648f8762011-01-26 12:38:57 -08004557AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004558 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004559 [
4560 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004561 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004562 [Define if you don't want to use pututxline()
4563 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004564 fi
4565 ]
andre2ff7b5d2000-06-03 14:57:40 +00004566)
Tim Rice648f8762011-01-26 12:38:57 -08004567AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004568 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004569 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004570 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004571 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004572 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004573 conf_lastlog_location=$withval
4574 fi
4575 ]
4576)
andre2ff7b5d2000-06-03 14:57:40 +00004577
4578dnl lastlog, [uw]tmpx? detection
4579dnl NOTE: set the paths in the platform section to avoid the
4580dnl need for command-line parameters
4581dnl lastlog and [uw]tmp are subject to a file search if all else fails
4582
4583dnl lastlog detection
4584dnl NOTE: the code itself will detect if lastlog is a directory
4585AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004586AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004587#include <sys/types.h>
4588#include <utmp.h>
4589#ifdef HAVE_LASTLOG_H
4590# include <lastlog.h>
4591#endif
Damien Miller2994e082000-06-04 15:51:47 +10004592#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004593# include <paths.h>
4594#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004595#ifdef HAVE_LOGIN_H
4596# include <login.h>
4597#endif
Tim Rice648f8762011-01-26 12:38:57 -08004598 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4599 [ AC_MSG_RESULT([yes]) ],
4600 [
4601 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004602 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004604#include <sys/types.h>
4605#include <utmp.h>
4606#ifdef HAVE_LASTLOG_H
4607# include <lastlog.h>
4608#endif
4609#ifdef HAVE_PATHS_H
4610# include <paths.h>
4611#endif
Tim Rice648f8762011-01-26 12:38:57 -08004612 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4613 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004614 [
Tim Rice648f8762011-01-26 12:38:57 -08004615 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004616 system_lastlog_path=no
4617 ])
Tim Rice648f8762011-01-26 12:38:57 -08004618])
Damien Miller2994e082000-06-04 15:51:47 +10004619
andre2ff7b5d2000-06-03 14:57:40 +00004620if test -z "$conf_lastlog_location"; then
4621 if test x"$system_lastlog_path" = x"no" ; then
4622 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004623 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004624 conf_lastlog_location=$f
4625 fi
4626 done
4627 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004628 AC_MSG_WARN([** Cannot find lastlog **])
4629 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004630 fi
4631 fi
4632fi
4633
4634if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004635 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004636 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004637fi
andre2ff7b5d2000-06-03 14:57:40 +00004638
4639dnl utmp detection
4640AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004641AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004642#include <sys/types.h>
4643#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004644#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004645# include <paths.h>
4646#endif
Tim Rice648f8762011-01-26 12:38:57 -08004647 ]], [[ char *utmp = UTMP_FILE; ]])],
4648 [ AC_MSG_RESULT([yes]) ],
4649 [ AC_MSG_RESULT([no])
4650 system_utmp_path=no
4651])
andre2ff7b5d2000-06-03 14:57:40 +00004652if test -z "$conf_utmp_location"; then
4653 if test x"$system_utmp_path" = x"no" ; then
4654 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4655 if test -f $f ; then
4656 conf_utmp_location=$f
4657 fi
4658 done
4659 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004660 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004661 fi
4662 fi
4663fi
4664if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004665 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004666 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004667fi
andre2ff7b5d2000-06-03 14:57:40 +00004668
4669dnl wtmp detection
4670AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004671AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004672#include <sys/types.h>
4673#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004674#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004675# include <paths.h>
4676#endif
Tim Rice648f8762011-01-26 12:38:57 -08004677 ]], [[ char *wtmp = WTMP_FILE; ]])],
4678 [ AC_MSG_RESULT([yes]) ],
4679 [ AC_MSG_RESULT([no])
4680 system_wtmp_path=no
4681])
andre2ff7b5d2000-06-03 14:57:40 +00004682if test -z "$conf_wtmp_location"; then
4683 if test x"$system_wtmp_path" = x"no" ; then
4684 for f in /usr/adm/wtmp /var/log/wtmp; do
4685 if test -f $f ; then
4686 conf_wtmp_location=$f
4687 fi
4688 done
4689 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004690 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004691 fi
4692 fi
4693fi
4694if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004695 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004696 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004697fi
andre2ff7b5d2000-06-03 14:57:40 +00004698
andre2ff7b5d2000-06-03 14:57:40 +00004699dnl wtmpx detection
4700AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004701AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004702#include <sys/types.h>
4703#include <utmp.h>
4704#ifdef HAVE_UTMPX_H
4705#include <utmpx.h>
4706#endif
Damien Miller2994e082000-06-04 15:51:47 +10004707#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004708# include <paths.h>
4709#endif
Tim Rice648f8762011-01-26 12:38:57 -08004710 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4711 [ AC_MSG_RESULT([yes]) ],
4712 [ AC_MSG_RESULT([no])
4713 system_wtmpx_path=no
4714])
andre2ff7b5d2000-06-03 14:57:40 +00004715if test -z "$conf_wtmpx_location"; then
4716 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004717 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004718 fi
4719else
Tim Rice648f8762011-01-26 12:38:57 -08004720 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004721 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004722fi
andre2ff7b5d2000-06-03 14:57:40 +00004723
Damien Miller4018c192000-04-30 09:30:44 +10004724
Damien Miller29ea30d2000-03-17 10:54:15 +11004725if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004726 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4727 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004728fi
4729
Damien Millera2438bb2013-03-15 10:23:07 +11004730AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004731 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004732 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004733 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004734 ], [
4735#ifdef HAVE_SYS_TYPES_H
4736#include <sys/types.h>
4737#endif
4738#ifdef HAVE_UTMP_H
4739#include <utmp.h>
4740#endif
4741#ifdef HAVE_UTMPX_H
4742#include <utmpx.h>
4743#endif
4744#ifdef HAVE_LASTLOG_H
4745#include <lastlog.h>
4746#endif
4747 ])
4748
4749AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4750 AC_DEFINE([DISABLE_UTMP])
4751 AC_DEFINE([DISABLE_WTMP])
4752 ], [
4753#ifdef HAVE_SYS_TYPES_H
4754#include <sys/types.h>
4755#endif
4756#ifdef HAVE_UTMP_H
4757#include <utmp.h>
4758#endif
4759#ifdef HAVE_UTMPX_H
4760#include <utmpx.h>
4761#endif
4762#ifdef HAVE_LASTLOG_H
4763#include <lastlog.h>
4764#endif
4765 ])
4766
Darren Tucker7da23cb2005-08-03 00:20:15 +10004767dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4768dnl Add now.
4769CFLAGS="$CFLAGS $werror_flags"
4770
Darren Tucker627337d2010-04-10 22:58:01 +10004771if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4772 TEST_SSH_IPV6=no
4773else
4774 TEST_SSH_IPV6=yes
4775fi
Tim Rice648f8762011-01-26 12:38:57 -08004776AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4777AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker882abfd2013-11-09 00:17:41 +11004778AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10004779AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker5d376902008-06-11 04:15:05 +10004780
Damien Millerbac2d8a2000-09-05 16:13:06 +11004781AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004782AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4783 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004784 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004785AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004786
Damien Miller7b22d652000-06-18 14:07:04 +10004787# Print summary of options
4788
Damien Miller7b22d652000-06-18 14:07:04 +10004789# Someone please show me a better way :)
4790A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4791B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4792C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4793D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004794E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004795F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004796G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004797H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4798I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4799J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004800
4801echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004802echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004803echo " User binaries: $B"
4804echo " System binaries: $C"
4805echo " Configuration files: $D"
4806echo " Askpass program: $E"
4807echo " Manual pages: $F"
4808echo " PID file: $G"
4809echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004810if test "x$external_path_file" = "x/etc/login.conf" ; then
4811echo " At runtime, sshd will use the path defined in $external_path_file"
4812echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004813else
Damien Millerf58c6722002-05-13 13:15:42 +10004814echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004815 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004816echo " (If PATH is set in $external_path_file it will be used instead. If"
4817echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4818 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004819fi
Damien Millera18bbd32002-05-13 10:48:57 +10004820if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004821echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004822fi
Damien Millerf58c6722002-05-13 13:15:42 +10004823echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004824echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004825echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004826echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004827echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004828echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004829echo " S/KEY support: $SKEY_MSG"
4830echo " TCP Wrappers support: $TCPW_MSG"
4831echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004832echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004833echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004834echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004835echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004836echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4837echo " BSD Auth support: $BSD_AUTH_MSG"
4838echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004839echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004840
Damien Miller7b22d652000-06-18 14:07:04 +10004841echo ""
4842
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004843echo " Host: ${host}"
4844echo " Compiler: ${CC}"
4845echo " Compiler flags: ${CFLAGS}"
4846echo "Preprocessor flags: ${CPPFLAGS}"
4847echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004848echo " Libraries: ${LIBS}"
4849if test ! -z "${SSHDLIBS}"; then
4850echo " +for sshd: ${SSHDLIBS}"
4851fi
Damien Miller71adf122011-01-25 12:16:15 +11004852if test ! -z "${SSHLIBS}"; then
4853echo " +for ssh: ${SSHLIBS}"
4854fi
Damien Miller7b22d652000-06-18 14:07:04 +10004855
4856echo ""
4857
Tim Rice6f1f7582004-05-30 21:38:51 -07004858if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004859 echo "SVR4 style packages are supported with \"make package\""
4860 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004861fi
4862
Damien Miller82cf0ce2000-12-20 13:34:48 +11004863if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004864 echo "PAM is enabled. You may need to install a PAM control file "
4865 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004866 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004867 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004868 echo ""
4869fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004870
Damien Millerb4097182004-05-23 14:09:40 +10004871if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004872 echo "WARNING: the operating system that you are using does not"
4873 echo "appear to support getpeereid(), getpeerucred() or the"
4874 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4875 echo "enforce security checks to prevent unauthorised connections to"
4876 echo "ssh-agent. Their absence increases the risk that a malicious"
4877 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004878 echo ""
4879fi
4880
Darren Tuckerd9f88912005-02-20 21:01:48 +11004881if test "$AUDIT_MODULE" = "bsm" ; then
4882 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4883 echo "See the Solaris section in README.platform for details."
4884fi