blob: ce881e2793cc60e62339fede094b40b56e74b70d [file] [log] [blame]
Damien Miller5b447c02014-01-26 09:46:53 +11001# $Id: configure.ac,v 1.564 2014/01/25 22:46:54 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 Miller5b447c02014-01-26 09:46:53 +110018AC_REVISION($Revision: 1.564 $)
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 Miller2035b222014-01-26 09:39:53 +1100783 # Preauth crypto occasionally uses file descriptors for crypto offload
784 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100785 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
786 [define if setrlimit RLIMIT_NOFILE breaks things])],
Damien Millerfbd884a2001-02-27 08:39:07 +1100787 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000788*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800789 AC_DEFINE([SETEUID_BREAKS_SETUID])
790 AC_DEFINE([BROKEN_SETREUID])
791 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000792 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000793*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000794 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100795 conf_utmp_location=/etc/utmp
796 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700797 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800798 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
799 AC_DEFINE([BROKEN_REALPATH])
800 AC_DEFINE([USE_PIPES])
801 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000802 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000803*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100804 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800805 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
806 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
807 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
808 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000809 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100810 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000811 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100812*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800813 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800814 need_dash_r=1
815 fi
Tim Rice648f8762011-01-26 12:38:57 -0800816 AC_DEFINE([PAM_SUN_CODEBASE])
817 AC_DEFINE([LOGIN_NEEDS_UTMPX])
818 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700819 [Some versions of /bin/login need the TERM supplied
820 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800821 AC_DEFINE([PAM_TTY_KLUDGE])
822 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700823 [Define if pam_chauthtok wants real uid set
824 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800825 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000826 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800827 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700828 [Define if sshd somehow reacquires a controlling TTY
829 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800830 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000831 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800832 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000833 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000834 # hardwire lastlog location (can't detect it on some versions)
835 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800836 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000837 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
838 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800839 AC_MSG_RESULT([yes])
840 AC_DEFINE([DISABLE_UTMP])
841 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700842 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000843 else
Tim Rice648f8762011-01-26 12:38:57 -0800844 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000845 fi
Tim Rice648f8762011-01-26 12:38:57 -0800846 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000847 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
848 [
Tim Rice648f8762011-01-26 12:38:57 -0800849 AC_CHECK_LIB([contract], [ct_tmpl_activate],
850 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000851 [Define if you have Solaris process contracts])
852 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000853 SPC_MSG="yes" ], )
854 ],
855 )
Tim Rice648f8762011-01-26 12:38:57 -0800856 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100857 [ --with-solaris-projects Enable Solaris projects (experimental)],
858 [
Tim Rice648f8762011-01-26 12:38:57 -0800859 AC_CHECK_LIB([project], [setproject],
860 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100861 [Define if you have Solaris projects])
862 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100863 SP_MSG="yes" ], )
864 ],
865 )
Tim Rice5ab9b632013-06-02 14:05:48 -0700866 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +1100867 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000868*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000869 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800870 AC_CHECK_FUNCS([getpwanam])
871 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000872 conf_utmp_location=/etc/utmp
873 conf_wtmp_location=/var/adm/wtmp
874 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800875 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000876 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000877*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700878 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800879 AC_DEFINE([USE_PIPES])
880 AC_DEFINE([SSHD_ACQUIRES_CTTY])
881 AC_DEFINE([SETEUID_BREAKS_SETUID])
882 AC_DEFINE([BROKEN_SETREUID])
883 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000884 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000885*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700886 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800887 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100888 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800889 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100890 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800891 AC_DEFINE([USE_PIPES])
892 AC_DEFINE([IP_TOS_IS_BROKEN])
893 AC_DEFINE([SETEUID_BREAKS_SETUID])
894 AC_DEFINE([BROKEN_SETREUID])
895 AC_DEFINE([BROKEN_SETREGID])
896 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000897 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700898 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
899 # Attention: always take care to bind libsocket and libnsl before libc,
900 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000901 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800902# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100903*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800904 AC_DEFINE([USE_PIPES])
905 AC_DEFINE([SETEUID_BREAKS_SETUID])
906 AC_DEFINE([BROKEN_SETREUID])
907 AC_DEFINE([BROKEN_SETREGID])
908 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
909 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -0700910 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +1100911 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800912# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100913*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800914 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800915 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
916 AC_DEFINE([USE_PIPES])
917 AC_DEFINE([SETEUID_BREAKS_SETUID])
918 AC_DEFINE([BROKEN_GETADDRINFO])
919 AC_DEFINE([BROKEN_SETREUID])
920 AC_DEFINE([BROKEN_SETREGID])
921 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice5ab9b632013-06-02 14:05:48 -0700922 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4dbacff2005-06-01 20:09:28 -0700923 case "$host" in
924 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700925 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800926 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700927 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800928 AC_DEFINE([BROKEN_UPDWTMPX])
929 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
930 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
931 AC_DEFINE([HAVE_SECUREWARE])
932 AC_DEFINE([DISABLE_SHADOW])
933 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700934 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800935 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800936 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800937 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700938 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100939 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100940*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100941 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800942# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100943*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800944 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100945 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800946# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100947*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800948 if test -z "$GCC"; then
949 CFLAGS="$CFLAGS -belf"
950 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100951 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000952 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800953 AC_DEFINE([USE_PIPES])
954 AC_DEFINE([HAVE_SECUREWARE])
955 AC_DEFINE([DISABLE_SHADOW])
956 AC_DEFINE([DISABLE_FD_PASSING])
957 AC_DEFINE([SETEUID_BREAKS_SETUID])
958 AC_DEFINE([BROKEN_GETADDRINFO])
959 AC_DEFINE([BROKEN_SETREUID])
960 AC_DEFINE([BROKEN_SETREGID])
961 AC_DEFINE([WITH_ABBREV_NO_TTY])
962 AC_DEFINE([BROKEN_UPDWTMPX])
963 AC_DEFINE([PASSWD_NEEDS_USERNAME])
964 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700965 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -0700966 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -0700967 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +1000968 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000969*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800970 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700971 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800972 AC_DEFINE([SETEUID_BREAKS_SETUID])
973 AC_DEFINE([BROKEN_SETREUID])
974 AC_DEFINE([BROKEN_SETREGID])
975 AC_DEFINE([USE_PIPES])
976 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000977 LDFLAGS="$LDFLAGS"
978 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
979 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000980 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000981*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800982 AC_DEFINE([SETEUID_BREAKS_SETUID])
983 AC_DEFINE([BROKEN_SETREUID])
984 AC_DEFINE([BROKEN_SETREGID])
985 AC_DEFINE([WITH_ABBREV_NO_TTY])
986 AC_DEFINE([USE_PIPES])
987 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000988 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100989 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000990 MANTYPE=cat
991 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000992*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800993 AC_DEFINE([SETEUID_BREAKS_SETUID])
994 AC_DEFINE([BROKEN_SETREUID])
995 AC_DEFINE([BROKEN_SETREGID])
996 AC_DEFINE([USE_PIPES])
997 AC_DEFINE([DISABLE_FD_PASSING])
998 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000999 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
1000 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
1001 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -07001002 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001003*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001004 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001005 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001006 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001007 [ --with-osfsia Enable Digital Unix SIA],
1008 [
1009 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001010 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001011 no_osfsia=1
1012 fi
1013 ],
1014 )
1015 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001016 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001017 AC_MSG_RESULT([yes])
1018 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001019 [Define if you have Digital Unix Security
1020 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001021 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001022 [Define if you don't want to use your
1023 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001024 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001025 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001026 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001027 else
Tim Rice648f8762011-01-26 12:38:57 -08001028 AC_MSG_RESULT([no])
1029 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001030 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001031 fi
1032 fi
Tim Rice648f8762011-01-26 12:38:57 -08001033 AC_DEFINE([BROKEN_GETADDRINFO])
1034 AC_DEFINE([SETEUID_BREAKS_SETUID])
1035 AC_DEFINE([BROKEN_SETREUID])
1036 AC_DEFINE([BROKEN_SETREGID])
1037 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001038 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001039
Tim Rice70335a62006-02-04 17:42:58 -08001040*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001041 AC_DEFINE([USE_PIPES])
1042 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001043 AC_DEFINE([DISABLE_LASTLOG])
1044 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1045 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001046 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001047 case "$host" in
1048 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001049 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001050 ;;
1051 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001052 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001053
1054*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001055 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
1056 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
1057 AC_DEFINE([NEED_SETPGRP])
1058 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001059 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001060
1061*-*-lynxos)
1062 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001063 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001064 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001065esac
1066
Tim Rice648f8762011-01-26 12:38:57 -08001067AC_MSG_CHECKING([compiler and flags for sanity])
1068AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1069 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001070 [
Tim Rice648f8762011-01-26 12:38:57 -08001071 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001072 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001073 ],
1074 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001075)
1076
Darren Tucker0c9653f2005-05-28 15:58:14 +10001077dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001078# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001079AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
1080AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001081
Tim Rice1e1ef642003-09-11 22:19:31 -07001082dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001083AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1084 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001085 AC_CACHE_CHECK([for broken dirname],
1086 ac_cv_have_broken_dirname, [
1087 save_LIBS="$LIBS"
1088 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001089 AC_RUN_IFELSE(
1090 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001091#include <libgen.h>
1092#include <string.h>
1093
1094int main(int argc, char **argv) {
1095 char *s, buf[32];
1096
1097 strncpy(buf,"/etc", 32);
1098 s = dirname(buf);
1099 if (!s || strncmp(s, "/", 32) != 0) {
1100 exit(1);
1101 } else {
1102 exit(0);
1103 }
1104}
Darren Tucker314d89e2005-10-17 23:29:23 +10001105 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001106 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001107 [ ac_cv_have_broken_dirname="yes" ],
1108 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001109 )
1110 LIBS="$save_LIBS"
1111 ])
1112 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1113 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001114 AC_DEFINE([HAVE_DIRNAME])
1115 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001116 fi
1117 ])
1118])
1119
Tim Rice648f8762011-01-26 12:38:57 -08001120AC_CHECK_FUNC([getspnam], ,
1121 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1122AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1123 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001124
Tim Rice13aae5e2001-10-21 17:53:58 -07001125dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001126AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001127 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001128 [ if test "x$withval" = "xno" ; then
1129 AC_MSG_ERROR([*** zlib is required ***])
1130 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001131 if test -d "$withval/lib"; then
1132 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001133 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001134 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001135 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001136 fi
1137 else
1138 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001139 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001140 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001141 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001142 fi
1143 fi
1144 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001145 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001146 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001147 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001148 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001149 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001150)
1151
Tim Rice648f8762011-01-26 12:38:57 -08001152AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1153AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001154 [
1155 saved_CPPFLAGS="$CPPFLAGS"
1156 saved_LDFLAGS="$LDFLAGS"
1157 save_LIBS="$LIBS"
1158 dnl Check default zlib install dir
1159 if test -n "${need_dash_r}"; then
1160 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1161 else
1162 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1163 fi
1164 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1165 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001166 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001167 [
1168 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1169 ]
1170 )
1171 ]
1172)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001173
Tim Rice648f8762011-01-26 12:38:57 -08001174AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001175 [ --without-zlib-version-check Disable zlib version check],
1176 [ if test "x$withval" = "xno" ; then
1177 zlib_check_nonfatal=1
1178 fi
1179 ]
1180)
1181
Tim Rice648f8762011-01-26 12:38:57 -08001182AC_MSG_CHECKING([for possibly buggy zlib])
1183AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001184#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001185#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001186#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001187 ]],
1188 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001189 int a=0, b=0, c=0, d=0, n, v;
1190 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1191 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001192 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001193 v = a*1000000 + b*10000 + c*100 + d;
1194 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1195
1196 /* 1.1.4 is OK */
1197 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001198 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001199
Darren Tucker41097ed2005-07-25 15:24:21 +10001200 /* 1.2.3 and up are OK */
1201 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001202 exit(0);
1203
Darren Tucker2dcd2392004-01-23 17:13:33 +11001204 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001205 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001206 AC_MSG_RESULT([no]),
1207 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001208 if test -z "$zlib_check_nonfatal" ; then
1209 AC_MSG_ERROR([*** zlib too old - check config.log ***
1210Your reported zlib version has known security problems. It's possible your
1211vendor has fixed these problems without changing the version number. If you
1212are sure this is the case, you can disable the check by running
1213"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001214If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001215See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001216 else
1217 AC_MSG_WARN([zlib version may have security problems])
1218 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001219 ],
1220 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001221)
Damien Miller6f9c3372000-10-25 10:06:04 +11001222
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001223dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001224AC_CHECK_FUNC([strcasecmp],
1225 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001226)
Tim Rice648f8762011-01-26 12:38:57 -08001227AC_CHECK_FUNCS([utimes],
1228 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001229 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001230)
Damien Millerab18c411999-11-11 10:40:23 +11001231
Tim Ricee589a292001-11-03 11:09:32 -08001232dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001233AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001234AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001235AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001236AC_SEARCH_LIBS([login], [util bsd])
1237AC_SEARCH_LIBS([logout], [util bsd])
1238AC_SEARCH_LIBS([logwtmp], [util bsd])
1239AC_SEARCH_LIBS([openpty], [util bsd])
1240AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001241AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001242
Ben Lindstrom8697e082001-02-24 21:41:10 +00001243AC_FUNC_STRFTIME
1244
Damien Miller3c027682001-03-14 11:39:45 +11001245# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001246AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1247AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001248 [
1249 #include <glob.h>
1250 #ifdef GLOB_ALTDIRFUNC
1251 FOUNDIT
1252 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001253 ],
Damien Miller3c027682001-03-14 11:39:45 +11001254 [
Tim Rice648f8762011-01-26 12:38:57 -08001255 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001256 [Define if your system glob() function has
1257 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001258 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001259 ],
1260 [
Tim Rice648f8762011-01-26 12:38:57 -08001261 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001262 ]
1263)
Damien Millerab18c411999-11-11 10:40:23 +11001264
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001265# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001266AC_MSG_CHECKING([for gl_matchc field in glob_t])
1267AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1268 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001269 [
Tim Rice648f8762011-01-26 12:38:57 -08001270 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001271 [Define if your system glob() function has
1272 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001273 AC_MSG_RESULT([yes])
1274 ], [
1275 AC_MSG_RESULT([no])
1276])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001277
Damien Millera6e121a2010-10-07 21:39:17 +11001278# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001279AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1280AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001281#ifndef GLOB_KEEPSTAT
1282#error "glob does not support GLOB_KEEPSTAT extension"
1283#endif
1284glob_t g;
1285g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001286]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001287 [
Tim Rice648f8762011-01-26 12:38:57 -08001288 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001289 [Define if your system glob() function has
1290 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001291 AC_MSG_RESULT([yes])
1292 ], [
1293 AC_MSG_RESULT([no])
1294
1295])
Damien Millera6e121a2010-10-07 21:39:17 +11001296
Tim Rice648f8762011-01-26 12:38:57 -08001297AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001298
Damien Miller18bb4732001-03-28 14:35:30 +10001299AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001300AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001301 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001302#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001303#include <dirent.h>]],
1304 [[
1305 struct dirent d;
1306 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001307 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001308 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001309 [
Tim Rice648f8762011-01-26 12:38:57 -08001310 AC_MSG_RESULT([no])
1311 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001312 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001313 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001314 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001315 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001316 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001317 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001318 ]
1319)
1320
Damien Miller36f49652004-08-15 18:40:59 +10001321AC_MSG_CHECKING([for /proc/pid/fd directory])
1322if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001323 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1324 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001325else
Tim Rice648f8762011-01-26 12:38:57 -08001326 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001327fi
1328
Damien Millerc547bf12001-02-16 10:18:12 +11001329# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001330SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001331AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001332 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001333 [
1334 if test "x$withval" != "xno" ; then
1335
1336 if test "x$withval" != "xyes" ; then
1337 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1338 LDFLAGS="$LDFLAGS -L${withval}/lib"
1339 fi
1340
Tim Rice648f8762011-01-26 12:38:57 -08001341 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001342 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001343 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001344
Tim Rice4cec93f2002-02-26 08:40:48 -08001345 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001346 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001347 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001348#include <stdio.h>
1349#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001350 ]], [[
1351 char *ff = skey_keyinfo(""); ff="";
1352 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001353 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001354 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001355 [
Tim Rice648f8762011-01-26 12:38:57 -08001356 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001357 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1358 ])
Tim Rice648f8762011-01-26 12:38:57 -08001359 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1360 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1361#include <stdio.h>
1362#include <skey.h>
1363 ]], [[
1364 (void)skeychallenge(NULL,"name","",0);
1365 ]])],
1366 [
1367 AC_MSG_RESULT([yes])
1368 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001369 [Define if your skeychallenge()
1370 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001371 [
1372 AC_MSG_RESULT([no])
1373 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001374 fi
1375 ]
1376)
1377
1378# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001379TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001380AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001381 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001382 [
1383 if test "x$withval" != "xno" ; then
1384 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001385 saved_LDFLAGS="$LDFLAGS"
1386 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001387 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001388 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001389 if test -d "${withval}/lib"; then
1390 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001391 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001392 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001393 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001394 fi
1395 else
1396 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001397 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001398 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001399 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001400 fi
1401 fi
1402 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001403 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001404 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001405 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001406 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001407 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001408 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001409 AC_MSG_CHECKING([for libwrap])
1410 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001411#include <sys/types.h>
1412#include <sys/socket.h>
1413#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001414#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001415int deny_severity = 0, allow_severity = 0;
1416 ]], [[
1417 hosts_access(0);
1418 ]])], [
1419 AC_MSG_RESULT([yes])
1420 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001421 [Define if you want
1422 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001423 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001424 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001425 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001426 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001427
1428 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001429 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001430 fi
1431 ]
1432)
1433
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001434# Check whether user wants to use ldns
1435LDNS_MSG="no"
1436AC_ARG_WITH(ldns,
1437 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1438 [
1439 if test "x$withval" != "xno" ; then
1440
1441 if test "x$withval" != "xyes" ; then
1442 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1443 LDFLAGS="$LDFLAGS -L${withval}/lib"
1444 fi
1445
1446 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1447 LIBS="-lldns $LIBS"
1448 LDNS_MSG="yes"
1449
1450 AC_MSG_CHECKING([for ldns support])
1451 AC_LINK_IFELSE(
1452 [AC_LANG_SOURCE([[
1453#include <stdio.h>
1454#include <stdlib.h>
1455#include <stdint.h>
1456#include <ldns/ldns.h>
1457int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1458 ]])
1459 ],
1460 [AC_MSG_RESULT(yes)],
1461 [
1462 AC_MSG_RESULT(no)
1463 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1464 ])
1465 fi
1466 ]
1467)
1468
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001469# Check whether user wants libedit support
1470LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001471AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001472 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001473 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001474 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001475 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001476 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001477 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001478 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001479 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001480 use_pkgconfig_for_libedit=yes
1481 else
Tim Rice648f8762011-01-26 12:38:57 -08001482 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001483 fi
1484 fi
1485 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001486 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1487 if test -n "${need_dash_r}"; then
1488 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1489 else
1490 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1491 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001492 fi
Damien Miller1f789802010-10-11 22:35:22 +11001493 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001494 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001495 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1496 else
1497 LIBEDIT="-ledit -lcurses"
1498 fi
1499 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001500 AC_CHECK_LIB([edit], [el_init],
1501 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001502 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001503 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001504 ],
Tim Rice648f8762011-01-26 12:38:57 -08001505 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001506 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001507 )
Tim Rice648f8762011-01-26 12:38:57 -08001508 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001509 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001510 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1511 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001512 int i = H_SETSIZE;
1513 el_init("", NULL, NULL, NULL);
1514 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001515 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001516 [ AC_MSG_RESULT([yes]) ],
1517 [ AC_MSG_RESULT([no])
1518 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001519 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001520 fi ]
1521)
1522
Darren Tuckerd9f88912005-02-20 21:01:48 +11001523AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001524AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001525 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001526 [
Tim Rice648f8762011-01-26 12:38:57 -08001527 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001528 case "$withval" in
1529 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001530 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001531 AUDIT_MODULE=bsm
1532 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001533 AC_CHECK_HEADERS([bsm/audit.h], [],
1534 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001535 [
1536#ifdef HAVE_TIME_H
1537# include <time.h>
1538#endif
1539 ]
1540)
Tim Rice648f8762011-01-26 12:38:57 -08001541 AC_CHECK_LIB([bsm], [getaudit], [],
1542 [AC_MSG_ERROR([BSM enabled and required library not found])])
1543 AC_CHECK_FUNCS([getaudit], [],
1544 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001545 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001546 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1547 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001548 if test "$sol2ver" -ge 11; then
Darren Tucker93a2d412012-02-24 10:40:41 +11001549 SSHDLIBS="$SSHDLIBS -lscf"
1550 AC_DEFINE([BROKEN_BSM_API], [1],
1551 [The system has incomplete BSM API])
1552 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001553 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001554 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001555 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001556 AUDIT_MODULE=linux
1557 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001558 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001559 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001560 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001561 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001562 debug)
1563 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001564 AC_MSG_RESULT([debug])
1565 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001566 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001567 no)
Tim Rice648f8762011-01-26 12:38:57 -08001568 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001569 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001570 *)
1571 AC_MSG_ERROR([Unknown audit module $withval])
1572 ;;
1573 esac ]
1574)
1575
Darren Tucker096118d2014-01-21 12:48:51 +11001576AC_ARG_WITH([pie],
1577 [ --with-pie Build Position Independent Executables if possible], [
1578 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001579 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001580 fi
1581 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001582 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001583 fi
1584 ]
1585)
Damien Miller852472a2014-01-22 16:31:18 +11001586if test "x$use_pie" = "x"; then
1587 use_pie=no
1588fi
1589if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1590 # Turn off automatic PIE when toolchain hardening is off.
1591 use_pie=no
1592fi
1593if test "x$use_pie" == "xauto"; then
1594 # Automatic PIE requires gcc >= 4.x
1595 AC_MSG_CHECKING([for gcc >= 4.x])
1596 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1597#if !defined(__GNUC__) || __GNUC__ < 4
1598#error gcc is too old
1599#endif
1600]])],
1601 [ AC_MSG_RESULT([yes]) ],
1602 [ AC_MSG_RESULT([no])
1603 use_pie=no ]
1604)
1605fi
1606if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001607 SAVED_CFLAGS="$CFLAGS"
1608 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001609 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1610 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001611 # We use both -fPIE and -pie or neither.
1612 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1613 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1614 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1615 AC_MSG_RESULT([yes])
1616 else
1617 AC_MSG_RESULT([no])
1618 CFLAGS="$SAVED_CFLAGS"
1619 LDFLAGS="$SAVED_LDFLAGS"
1620 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001621fi
1622
Damien Millerfe1f1432003-02-24 15:45:42 +11001623dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001624AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001625 Blowfish_initstate \
1626 Blowfish_expandstate \
1627 Blowfish_expand0state \
1628 Blowfish_stream2word \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001629 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001630 arc4random_buf \
Damien Millerdf8b0302013-11-07 13:28:16 +11001631 arc4random_stir \
Damien Millera4be7c22008-05-19 14:47:37 +10001632 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001633 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001634 b64_ntop \
1635 __b64_ntop \
1636 b64_pton \
1637 __b64_pton \
1638 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001639 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001640 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001641 blf_enc \
Damien Millerc96d8532014-01-25 13:12:28 +11001642 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001643 clock \
1644 closefrom \
1645 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001646 endgrent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001647 fchmod \
1648 fchown \
1649 freeaddrinfo \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001650 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001651 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001652 futimes \
1653 getaddrinfo \
1654 getcwd \
1655 getgrouplist \
1656 getnameinfo \
1657 getopt \
1658 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001659 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001660 getpgid \
1661 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001662 _getpty \
1663 getrlimit \
1664 getttyent \
1665 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001666 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001667 inet_aton \
1668 inet_ntoa \
1669 inet_ntop \
1670 innetgr \
1671 login_getcapbool \
Darren Tuckerae133d42013-06-06 08:30:20 +10001672 mblen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001673 md5_crypt \
1674 memmove \
1675 mkdtemp \
1676 mmap \
1677 ngetaddrinfo \
1678 nsleep \
1679 ogetaddrinfo \
1680 openlog_r \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001681 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001682 prctl \
1683 pstat \
1684 readpassphrase \
1685 realpath \
1686 recvmsg \
1687 rresvport_af \
1688 sendmsg \
1689 setdtablesize \
1690 setegid \
1691 setenv \
1692 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001693 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001694 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001695 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001696 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001697 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001698 setpcred \
1699 setproctitle \
1700 setregid \
1701 setreuid \
1702 setrlimit \
1703 setsid \
1704 setvbuf \
1705 sigaction \
1706 sigvec \
1707 snprintf \
1708 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001709 statfs \
1710 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001711 strdup \
1712 strerror \
1713 strlcat \
1714 strlcpy \
1715 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001716 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001717 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001718 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001719 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001720 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001721 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001722 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001723 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001724 sysconf \
1725 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001726 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001727 truncate \
1728 unsetenv \
1729 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001730 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001731 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001732 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001733 vhangup \
1734 vsnprintf \
1735 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001736])
Tim Rice13aae5e2001-10-21 17:53:58 -07001737
Tim Ricec7a8af02010-11-08 14:26:23 -08001738AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001739 [AC_LANG_PROGRAM(
1740 [[ #include <ctype.h> ]],
1741 [[ return (isblank('a')); ]])],
1742 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001743])
1744
Damien Millerb3c9f782010-02-12 10:11:34 +11001745# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001746AC_SEARCH_LIBS([dlopen], [dl],
1747 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001748)
1749
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001750# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001751AC_CHECK_FUNCS([gai_strerror], [
1752 AC_DEFINE([HAVE_GAI_STRERROR])
1753 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001754#include <sys/types.h>
1755#include <sys/socket.h>
1756#include <netdb.h>
1757
Tim Rice648f8762011-01-26 12:38:57 -08001758const char *gai_strerror(int);
1759 ]], [[
1760 char *str;
1761 str = gai_strerror(0);
1762 ]])], [
1763 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1764 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001765
Tim Rice648f8762011-01-26 12:38:57 -08001766AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1767 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001768
Darren Tuckera7108912013-06-02 08:18:31 +10001769AC_SEARCH_LIBS([clock_gettime], [rt],
1770 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1771
Darren Tuckerf1159b52003-07-07 19:44:01 +10001772dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001773AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1774AC_CHECK_DECL([strsep],
1775 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001776 [],
1777 [
1778#ifdef HAVE_STRING_H
1779# include <string.h>
1780#endif
1781 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001782
Darren Tuckerb2427c82003-09-10 15:22:44 +10001783dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001784AC_CHECK_DECL([tcsendbreak],
1785 [AC_DEFINE([HAVE_TCSENDBREAK])],
1786 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001787 [#include <termios.h>]
1788)
1789
Tim Rice648f8762011-01-26 12:38:57 -08001790AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001791
Tim Rice648f8762011-01-26 12:38:57 -08001792AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001793 [
1794#include <sys/types.h>
1795#include <sys/socket.h>
1796 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001797
Tim Rice648f8762011-01-26 12:38:57 -08001798AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001799 [
1800#include <sys/types.h>
1801#ifdef HAVE_SYS_STAT_H
1802# include <sys/stat.h>
1803#endif
1804#ifdef HAVE_FCNTL_H
1805# include <fcntl.h>
1806#endif
1807 ])
1808
Tim Rice648f8762011-01-26 12:38:57 -08001809AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001810#include <sys/types.h>
1811#include <sys/uio.h>
1812#include <unistd.h>
1813 ])
1814
Tim Rice648f8762011-01-26 12:38:57 -08001815AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001816#include <sys/param.h>
1817 ])
1818
Tim Rice648f8762011-01-26 12:38:57 -08001819AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001820#include <stddef.h>
1821 ])
1822
Darren Tuckerc7aad002013-06-02 07:18:47 +10001823# extra bits for select(2)
1824AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1825#include <sys/param.h>
1826#include <sys/types.h>
1827#ifdef HAVE_SYS_SYSMACROS_H
1828#include <sys/sysmacros.h>
1829#endif
1830#ifdef HAVE_SYS_SELECT_H
1831#include <sys/select.h>
1832#endif
1833#ifdef HAVE_SYS_TIME_H
1834#include <sys/time.h>
1835#endif
1836#ifdef HAVE_UNISTD_H
1837#include <unistd.h>
1838#endif
1839 ]])
1840AC_CHECK_TYPES([fd_mask], [], [], [[
1841#include <sys/param.h>
1842#include <sys/types.h>
1843#ifdef HAVE_SYS_SELECT_H
1844#include <sys/select.h>
1845#endif
1846#ifdef HAVE_SYS_TIME_H
1847#include <sys/time.h>
1848#endif
1849#ifdef HAVE_UNISTD_H
1850#include <unistd.h>
1851#endif
1852 ]])
1853
Tim Rice648f8762011-01-26 12:38:57 -08001854AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001855 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001856 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001857 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001858 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001859#include <stdlib.h>
1860#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001861 ]], [[
1862 errno=0;
1863 setresuid(0,0,0);
1864 if (errno==ENOSYS)
1865 exit(1);
1866 else
1867 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001868 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001869 [AC_MSG_RESULT([yes])],
1870 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001871 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001872 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001873 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001874 )
1875])
Darren Tuckere937be32003-12-17 18:53:26 +11001876
Tim Rice648f8762011-01-26 12:38:57 -08001877AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001878 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001879 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001880 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001881 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001882#include <stdlib.h>
1883#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001884 ]], [[
1885 errno=0;
1886 setresgid(0,0,0);
1887 if (errno==ENOSYS)
1888 exit(1);
1889 else
1890 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001891 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001892 [AC_MSG_RESULT([yes])],
1893 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001894 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001895 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001896 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001897 )
1898])
Darren Tuckere937be32003-12-17 18:53:26 +11001899
Damien Millerad833b32000-08-23 10:46:23 +10001900dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001901AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001902dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001903AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1904AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001905dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001906AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1907AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001908dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001909AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001910
Tim Rice648f8762011-01-26 12:38:57 -08001911AC_CHECK_FUNC([daemon],
1912 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1913 [AC_CHECK_LIB([bsd], [daemon],
1914 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001915)
1916
Tim Rice648f8762011-01-26 12:38:57 -08001917AC_CHECK_FUNC([getpagesize],
1918 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001919 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001920 [AC_CHECK_LIB([ucb], [getpagesize],
1921 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001922)
1923
Damien Millercb170cb2000-07-01 16:52:55 +10001924# Check for broken snprintf
1925if test "x$ac_cv_func_snprintf" = "xyes" ; then
1926 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001927 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001928 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1929 [[
1930 char b[5];
1931 snprintf(b,5,"123456789");
1932 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001933 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001934 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001935 [
Tim Rice648f8762011-01-26 12:38:57 -08001936 AC_MSG_RESULT([no])
1937 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001938 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001939 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001940 ],
1941 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001942 )
1943fi
1944
Damien Miller57f39152005-11-24 19:58:19 +11001945# If we don't have a working asprintf, then we strongly depend on vsnprintf
1946# returning the right thing on overflow: the number of characters it tried to
1947# create (as per SUSv3)
1948if test "x$ac_cv_func_asprintf" != "xyes" && \
1949 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1950 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1951 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001952 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001953#include <sys/types.h>
1954#include <stdio.h>
1955#include <stdarg.h>
1956
1957int x_snprintf(char *str,size_t count,const char *fmt,...)
1958{
1959 size_t ret; va_list ap;
1960 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1961 return ret;
1962}
Tim Rice648f8762011-01-26 12:38:57 -08001963 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001964 char x[1];
1965 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001966 ]])],
1967 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001968 [
Tim Rice648f8762011-01-26 12:38:57 -08001969 AC_MSG_RESULT([no])
1970 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001971 [Define if your snprintf is busted])
1972 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1973 ],
1974 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1975 )
1976fi
1977
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001978# On systems where [v]snprintf is broken, but is declared in stdio,
1979# check that the fmt argument is const char * or just char *.
1980# This is only useful for when BROKEN_SNPRINTF
1981AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001982AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1983#include <stdio.h>
1984int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1985 ]], [[
1986 snprintf(0, 0, 0);
1987 ]])],
1988 [AC_MSG_RESULT([yes])
1989 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001990 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001991 [AC_MSG_RESULT([no])
1992 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001993
Damien Millerb4097182004-05-23 14:09:40 +10001994# Check for missing getpeereid (or equiv) support
1995NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001996if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001997 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001998 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1999#include <sys/types.h>
2000#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2001 [ AC_MSG_RESULT([yes])
2002 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2003 ], [AC_MSG_RESULT([no])
2004 NO_PEERCHECK=1
2005 ])
Damien Millerb4097182004-05-23 14:09:40 +10002006fi
2007
Damien Millere8328192003-01-07 15:18:32 +11002008dnl see whether mkstemp() requires XXXXXX
2009if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2010AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002011AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002012 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002013#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002014 ]], [[
2015 char template[]="conftest.mkstemp-test";
2016 if (mkstemp(template) == -1)
2017 exit(1);
2018 unlink(template);
2019 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002020 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002021 [
Tim Rice648f8762011-01-26 12:38:57 -08002022 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002023 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002024 [
Tim Rice648f8762011-01-26 12:38:57 -08002025 AC_MSG_RESULT([yes])
2026 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002027 ],
2028 [
Tim Rice648f8762011-01-26 12:38:57 -08002029 AC_MSG_RESULT([yes])
2030 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002031 ]
Damien Millere8328192003-01-07 15:18:32 +11002032)
2033fi
2034
Darren Tucker70a3d552003-08-21 17:58:29 +10002035dnl make sure that openpty does not reacquire controlling terminal
2036if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002037 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002038 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002039 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002040#include <stdio.h>
2041#include <sys/fcntl.h>
2042#include <sys/types.h>
2043#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002044 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002045 pid_t pid;
2046 int fd, ptyfd, ttyfd, status;
2047
2048 pid = fork();
2049 if (pid < 0) { /* failed */
2050 exit(1);
2051 } else if (pid > 0) { /* parent */
2052 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002053 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002054 exit(WEXITSTATUS(status));
2055 else
2056 exit(2);
2057 } else { /* child */
2058 close(0); close(1); close(2);
2059 setsid();
2060 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2061 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2062 if (fd >= 0)
2063 exit(3); /* Acquired ctty: broken */
2064 else
2065 exit(0); /* Did not acquire ctty: OK */
2066 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002067 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002068 [
Tim Rice648f8762011-01-26 12:38:57 -08002069 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002070 ],
2071 [
Tim Rice648f8762011-01-26 12:38:57 -08002072 AC_MSG_RESULT([no])
2073 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002074 ],
2075 [
Tim Rice648f8762011-01-26 12:38:57 -08002076 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002077 ]
2078 )
2079fi
2080
Tim Rice8bb561b2005-03-17 16:23:19 -08002081if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2082 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002083 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002084 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002085 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002086#include <stdio.h>
2087#include <sys/socket.h>
2088#include <netdb.h>
2089#include <errno.h>
2090#include <netinet/in.h>
2091
2092#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002093 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002094 int err, sock;
2095 struct addrinfo *gai_ai, *ai, hints;
2096 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2097
2098 memset(&hints, 0, sizeof(hints));
2099 hints.ai_family = PF_UNSPEC;
2100 hints.ai_socktype = SOCK_STREAM;
2101 hints.ai_flags = AI_PASSIVE;
2102
2103 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2104 if (err != 0) {
2105 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2106 exit(1);
2107 }
2108
2109 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2110 if (ai->ai_family != AF_INET6)
2111 continue;
2112
2113 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2114 sizeof(ntop), strport, sizeof(strport),
2115 NI_NUMERICHOST|NI_NUMERICSERV);
2116
2117 if (err != 0) {
2118 if (err == EAI_SYSTEM)
2119 perror("getnameinfo EAI_SYSTEM");
2120 else
2121 fprintf(stderr, "getnameinfo failed: %s\n",
2122 gai_strerror(err));
2123 exit(2);
2124 }
2125
2126 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2127 if (sock < 0)
2128 perror("socket");
2129 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2130 if (errno == EBADF)
2131 exit(3);
2132 }
2133 }
2134 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002135 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002136 [
Tim Rice648f8762011-01-26 12:38:57 -08002137 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002138 ],
2139 [
Tim Rice648f8762011-01-26 12:38:57 -08002140 AC_MSG_RESULT([no])
2141 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002142 ],
2143 [
Tim Rice648f8762011-01-26 12:38:57 -08002144 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002145 ]
2146 )
2147fi
2148
Tim Rice8bb561b2005-03-17 16:23:19 -08002149if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2150 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002151 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002152 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002153 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002154#include <stdio.h>
2155#include <sys/socket.h>
2156#include <netdb.h>
2157#include <errno.h>
2158#include <netinet/in.h>
2159
2160#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002161 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002162 int err, sock;
2163 struct addrinfo *gai_ai, *ai, hints;
2164 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2165
2166 memset(&hints, 0, sizeof(hints));
2167 hints.ai_family = PF_UNSPEC;
2168 hints.ai_socktype = SOCK_STREAM;
2169 hints.ai_flags = AI_PASSIVE;
2170
2171 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2172 if (err != 0) {
2173 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2174 exit(1);
2175 }
2176
2177 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2178 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2179 continue;
2180
2181 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2182 sizeof(ntop), strport, sizeof(strport),
2183 NI_NUMERICHOST|NI_NUMERICSERV);
2184
2185 if (ai->ai_family == AF_INET && err != 0) {
2186 perror("getnameinfo");
2187 exit(2);
2188 }
2189 }
2190 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002191 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002192 [
Tim Rice648f8762011-01-26 12:38:57 -08002193 AC_MSG_RESULT([yes])
2194 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002195 [Define if you have a getaddrinfo that fails
2196 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002197 ],
2198 [
Tim Rice648f8762011-01-26 12:38:57 -08002199 AC_MSG_RESULT([no])
2200 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002201 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002202 [
Tim Rice648f8762011-01-26 12:38:57 -08002203 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002204 ]
2205 )
2206fi
2207
Darren Tuckera56f1912004-11-02 20:30:54 +11002208if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002209 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2210 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2211 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002212 [
Tim Rice648f8762011-01-26 12:38:57 -08002213 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002214 ],
2215 [
Tim Rice648f8762011-01-26 12:38:57 -08002216 AC_MSG_RESULT([yes])
2217 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002218 [Conflicting defs for getspnam])
2219 ]
2220 )
2221fi
2222
Damien Miller606f8802000-09-16 15:39:56 +11002223AC_FUNC_GETPGRP
2224
Tim Riceaef73712002-05-11 13:17:42 -07002225# Search for OpenSSL
2226saved_CPPFLAGS="$CPPFLAGS"
2227saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002228AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002229 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2230 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002231 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002232 case "$withval" in
2233 # Relative paths
2234 ./*|../*) withval="`pwd`/$withval"
2235 esac
Tim Riceaef73712002-05-11 13:17:42 -07002236 if test -d "$withval/lib"; then
2237 if test -n "${need_dash_r}"; then
2238 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2239 else
2240 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2241 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002242 elif test -d "$withval/lib64"; then
2243 if test -n "${need_dash_r}"; then
2244 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2245 else
2246 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2247 fi
Tim Riceaef73712002-05-11 13:17:42 -07002248 else
2249 if test -n "${need_dash_r}"; then
2250 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2251 else
2252 LDFLAGS="-L${withval} ${LDFLAGS}"
2253 fi
2254 fi
2255 if test -d "$withval/include"; then
2256 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2257 else
2258 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2259 fi
Damien Millera22ba012000-03-02 23:09:20 +11002260 fi
2261 ]
2262)
Tim Rice3d5352e2004-02-12 09:27:21 -08002263LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002264AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002265 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002266 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002267 [
Tim Riceaef73712002-05-11 13:17:42 -07002268 dnl Check default openssl install dir
2269 if test -n "${need_dash_r}"; then
2270 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002271 else
Tim Riceaef73712002-05-11 13:17:42 -07002272 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002273 fi
Tim Riceaef73712002-05-11 13:17:42 -07002274 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002275 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002276 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2277 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002278 [
2279 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2280 ]
2281 )
2282 ]
2283)
2284
Tim Riced730b782002-08-13 18:52:10 -07002285# Determine OpenSSL header version
2286AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002287AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002288 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002289#include <stdio.h>
2290#include <string.h>
2291#include <openssl/opensslv.h>
2292#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002293 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002294 FILE *fd;
2295 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002296
Damien Millera8e06ce2003-11-21 23:48:55 +11002297 fd = fopen(DATA,"w");
2298 if(fd == NULL)
2299 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002300
2301 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2302 exit(1);
2303
2304 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002305 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002306 [
2307 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002308 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002309 ],
2310 [
Tim Rice648f8762011-01-26 12:38:57 -08002311 AC_MSG_RESULT([not found])
2312 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002313 ],
2314 [
2315 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002316 ]
2317)
2318
2319# Determine OpenSSL library version
2320AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002321AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002322 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002323#include <stdio.h>
2324#include <string.h>
2325#include <openssl/opensslv.h>
2326#include <openssl/crypto.h>
2327#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002328 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002329 FILE *fd;
2330 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002331
Damien Millera8e06ce2003-11-21 23:48:55 +11002332 fd = fopen(DATA,"w");
2333 if(fd == NULL)
2334 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002335
2336 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2337 exit(1);
2338
2339 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002340 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002341 [
2342 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002343 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002344 ],
2345 [
Tim Rice648f8762011-01-26 12:38:57 -08002346 AC_MSG_RESULT([not found])
2347 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002348 ],
2349 [
2350 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002351 ]
2352)
Damien Millera22ba012000-03-02 23:09:20 +11002353
Tim Rice648f8762011-01-26 12:38:57 -08002354AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002355 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2356 [ if test "x$withval" = "xno" ; then
2357 openssl_check_nonfatal=1
2358 fi
2359 ]
2360)
2361
Damien Millerec932372002-01-22 22:16:03 +11002362# Sanity check OpenSSL headers
2363AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002364AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002365 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002366#include <string.h>
2367#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002368 ]], [[
2369 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002370 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002371 [
Tim Rice648f8762011-01-26 12:38:57 -08002372 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002373 ],
2374 [
Tim Rice648f8762011-01-26 12:38:57 -08002375 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002376 if test "x$openssl_check_nonfatal" = "x"; then
2377 AC_MSG_ERROR([Your OpenSSL headers do not match your
2378library. Check config.log for details.
2379If you are sure your installation is consistent, you can disable the check
2380by running "./configure --without-openssl-header-check".
2381Also see contrib/findssl.sh for help identifying header/library mismatches.
2382])
2383 else
2384 AC_MSG_WARN([Your OpenSSL headers do not match your
2385library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002386Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002387 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002388 ],
2389 [
2390 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002391 ]
2392)
2393
Darren Tucker639bbe82006-08-20 20:17:53 +10002394AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2395AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002396 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2397 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002398 [
Tim Rice648f8762011-01-26 12:38:57 -08002399 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002400 ],
2401 [
Tim Rice648f8762011-01-26 12:38:57 -08002402 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002403 saved_LIBS="$LIBS"
2404 LIBS="$LIBS -ldl"
2405 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2406 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002407 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2408 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002409 [
Tim Rice648f8762011-01-26 12:38:57 -08002410 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002411 ],
2412 [
Tim Rice648f8762011-01-26 12:38:57 -08002413 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002414 LIBS="$saved_LIBS"
2415 ]
2416 )
2417 ]
2418)
2419
Darren Tuckerc5487222014-01-17 15:12:16 +11002420AC_CHECK_FUNCS([ \
2421 BN_is_prime_ex \
2422 DSA_generate_parameters_ex \
Darren Tuckerd23a91f2014-01-17 17:32:30 +11002423 EVP_DigestInit_ex \
2424 EVP_DigestFinal_ex \
2425 EVP_MD_CTX_init \
2426 EVP_MD_CTX_cleanup \
Darren Tuckerc5487222014-01-17 15:12:16 +11002427 HMAC_CTX_init \
2428 RSA_generate_key_ex \
2429 RSA_get_default_method \
2430])
Darren Tuckerebdef762010-12-04 23:20:50 +11002431
Tim Rice648f8762011-01-26 12:38:57 -08002432AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002433 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2434 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002435 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2436 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2437#include <openssl/engine.h>
2438 ]], [[
2439 ENGINE_load_builtin_engines();
2440 ENGINE_register_all_complete();
2441 ]])],
2442 [ AC_MSG_RESULT([yes])
2443 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002444 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002445 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2446 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002447 fi ]
2448)
2449
Darren Tucker129d0bb2005-12-19 17:40:40 +11002450# Check for OpenSSL without EVP_aes_{192,256}_cbc
2451AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002452AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002453 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002454#include <string.h>
2455#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002456 ]], [[
2457 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002458 ]])],
2459 [
Tim Rice648f8762011-01-26 12:38:57 -08002460 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002461 ],
2462 [
Tim Rice648f8762011-01-26 12:38:57 -08002463 AC_MSG_RESULT([yes])
2464 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002465 [libcrypto is missing AES 192 and 256 bit functions])
2466 ]
2467)
2468
Damien Miller25a02b02012-12-13 08:18:56 +11002469# Check for OpenSSL with EVP_aes_*ctr
2470AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2471AC_LINK_IFELSE(
2472 [AC_LANG_PROGRAM([[
2473#include <string.h>
2474#include <openssl/evp.h>
2475 ]], [[
2476 exit(EVP_aes_128_ctr() == NULL ||
2477 EVP_aes_192_cbc() == NULL ||
2478 EVP_aes_256_cbc() == NULL);
2479 ]])],
2480 [
2481 AC_MSG_RESULT([yes])
2482 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2483 [libcrypto has EVP AES CTR])
2484 ],
2485 [
2486 AC_MSG_RESULT([no])
2487 ]
2488)
2489
Damien Millerd522c682013-01-09 16:42:47 +11002490# Check for OpenSSL with EVP_aes_*gcm
2491AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2492AC_LINK_IFELSE(
2493 [AC_LANG_PROGRAM([[
2494#include <string.h>
2495#include <openssl/evp.h>
2496 ]], [[
2497 exit(EVP_aes_128_gcm() == NULL ||
Damien Millerb6f73b32013-02-11 10:39:12 +11002498 EVP_aes_256_gcm() == NULL ||
2499 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2500 EVP_CTRL_GCM_IV_GEN == 0 ||
2501 EVP_CTRL_GCM_SET_TAG == 0 ||
2502 EVP_CTRL_GCM_GET_TAG == 0 ||
2503 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
Damien Millerd522c682013-01-09 16:42:47 +11002504 ]])],
2505 [
2506 AC_MSG_RESULT([yes])
2507 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2508 [libcrypto has EVP AES GCM])
2509 ],
2510 [
2511 AC_MSG_RESULT([no])
Darren Tucker6d8bd572013-06-11 11:26:10 +10002512 unsupported_algorithms="$unsupported_cipers \
2513 aes128-gcm@openssh.com aes256-gcm@openssh.com"
Damien Millerd522c682013-01-09 16:42:47 +11002514 ]
2515)
2516
Damien Millerb6f73b32013-02-11 10:39:12 +11002517AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2518 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2519 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2520
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002521AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2522AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002523 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002524#include <string.h>
2525#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002526 ]], [[
2527 if(EVP_DigestUpdate(NULL, NULL,0))
2528 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002529 ]])],
2530 [
Tim Rice648f8762011-01-26 12:38:57 -08002531 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002532 ],
2533 [
Tim Rice648f8762011-01-26 12:38:57 -08002534 AC_MSG_RESULT([no])
2535 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002536 [Define if EVP_DigestUpdate returns void])
2537 ]
2538)
2539
Tim Rice3d5352e2004-02-12 09:27:21 -08002540# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2541# because the system crypt() is more featureful.
2542if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002543 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002544fi
2545
Damien Millera8e06ce2003-11-21 23:48:55 +11002546# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002547# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002548if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002549 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002550fi
Darren Tuckerc0c33732013-06-02 06:28:03 +10002551AC_CHECK_FUNCS([crypt DES_crypt])
Damien Millera64b57a2001-01-17 10:44:13 +11002552
Damien Milleraf87af12006-03-15 13:02:28 +11002553# Search for SHA256 support in libc and/or OpenSSL
Darren Tucker4bf7e502013-11-07 22:33:48 +11002554AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2555 [unsupported_algorithms="$unsupported_algorithms \
Darren Tucker6d8bd572013-06-11 11:26:10 +10002556 hmac-sha2-256 hmac-sha2-512 \
2557 diffie-hellman-group-exchange-sha256 \
2558 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2559 ]
2560)
Damien Milleraf87af12006-03-15 13:02:28 +11002561
Damien Miller6af914a2010-09-10 11:39:26 +10002562# Check complete ECC support in OpenSSL
Darren Tucker37bcef52013-11-09 18:39:25 +11002563AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2564AC_LINK_IFELSE(
2565 [AC_LANG_PROGRAM([[
2566#include <openssl/ec.h>
2567#include <openssl/ecdh.h>
2568#include <openssl/ecdsa.h>
2569#include <openssl/evp.h>
2570#include <openssl/objects.h>
2571#include <openssl/opensslv.h>
2572#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2573# error "OpenSSL < 0.9.8g has unreliable ECC code"
2574#endif
2575 ]], [[
2576 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2577 const EVP_MD *m = EVP_sha256(); /* We need this too */
2578 ]])],
2579 [ AC_MSG_RESULT([yes])
2580 enable_nistp256=1 ],
2581 [ AC_MSG_RESULT([no]) ]
2582)
2583
2584AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2585AC_LINK_IFELSE(
2586 [AC_LANG_PROGRAM([[
2587#include <openssl/ec.h>
2588#include <openssl/ecdh.h>
2589#include <openssl/ecdsa.h>
2590#include <openssl/evp.h>
2591#include <openssl/objects.h>
2592#include <openssl/opensslv.h>
2593#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2594# error "OpenSSL < 0.9.8g has unreliable ECC code"
2595#endif
2596 ]], [[
2597 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2598 const EVP_MD *m = EVP_sha384(); /* We need this too */
2599 ]])],
2600 [ AC_MSG_RESULT([yes])
2601 enable_nistp384=1 ],
2602 [ AC_MSG_RESULT([no]) ]
2603)
2604
2605AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
Damien Miller6af914a2010-09-10 11:39:26 +10002606AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002607 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002608#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002609#include <openssl/ecdh.h>
2610#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002611#include <openssl/evp.h>
2612#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002613#include <openssl/opensslv.h>
2614#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2615# error "OpenSSL < 0.9.8g has unreliable ECC code"
2616#endif
Tim Rice648f8762011-01-26 12:38:57 -08002617 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002618 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2619 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002620 ]])],
Darren Tucker37bcef52013-11-09 18:39:25 +11002621 [ AC_MSG_RESULT([yes])
2622 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2623 AC_RUN_IFELSE(
2624 [AC_LANG_PROGRAM([[
2625#include <openssl/ec.h>
2626#include <openssl/ecdh.h>
2627#include <openssl/ecdsa.h>
2628#include <openssl/evp.h>
2629#include <openssl/objects.h>
2630#include <openssl/opensslv.h>
2631 ]],[[
2632 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2633 const EVP_MD *m = EVP_sha512(); /* We need this too */
2634 exit(e == NULL || m == NULL);
2635 ]])],
2636 [ AC_MSG_RESULT([yes])
2637 enable_nistp521=1 ],
2638 [ AC_MSG_RESULT([no]) ],
Darren Tucker95cb2d42013-11-09 22:02:31 +11002639 [ AC_MSG_WARN([cross-compiling: assuming yes])
Darren Tucker37bcef52013-11-09 18:39:25 +11002640 enable_nistp521=1 ]
Darren Tucker95cb2d42013-11-09 22:02:31 +11002641 )],
Darren Tucker37bcef52013-11-09 18:39:25 +11002642 AC_MSG_RESULT([no])
Damien Miller6af914a2010-09-10 11:39:26 +10002643)
Darren Tucker37bcef52013-11-09 18:39:25 +11002644
2645COMMENT_OUT_ECC="#no ecc#"
2646TEST_SSH_ECC=no
2647
2648if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
Darren Tuckerdd5264d2013-11-09 22:32:51 +11002649 test x$enable_nistp521 = x1; then
Darren Tucker37bcef52013-11-09 18:39:25 +11002650 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2651fi
2652if test x$enable_nistp256 = x1; then
2653 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2654 [libcrypto has NID_X9_62_prime256v1])
2655 TEST_SSH_ECC=yes
2656 COMMENT_OUT_ECC=""
2657else
2658 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2659 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2660fi
2661if test x$enable_nistp384 = x1; then
2662 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2663 TEST_SSH_ECC=yes
2664 COMMENT_OUT_ECC=""
2665else
2666 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2667 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2668fi
2669if test x$enable_nistp521 = x1; then
2670 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2671 TEST_SSH_ECC=yes
2672 COMMENT_OUT_ECC=""
2673else
2674 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2675 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2676fi
2677
Tim Rice648f8762011-01-26 12:38:57 -08002678AC_SUBST([TEST_SSH_ECC])
2679AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002680
Tim Rice99203ec2007-03-26 09:35:28 -07002681saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002682AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002683 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002684 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2685 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002686 [Define if system has libiaf that supports set_id])
2687 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002688])
2689LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002690
2691### Configure cryptographic random number support
2692
2693# Check wheter OpenSSL seeds itself
2694AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002695AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002696 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002697#include <string.h>
2698#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002699 ]], [[
2700 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002701 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002702 [
2703 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002704 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002705 ],
2706 [
Tim Rice648f8762011-01-26 12:38:57 -08002707 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002708 ],
2709 [
2710 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002711 # This is safe, since we will fatal() at runtime if
2712 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002713 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002714 ]
2715)
2716
Damien Millerf22019b2011-05-05 13:48:37 +10002717# PRNGD TCP socket
2718AC_ARG_WITH([prngd-port],
2719 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2720 [
2721 case "$withval" in
2722 no)
2723 withval=""
2724 ;;
2725 [[0-9]]*)
2726 ;;
2727 *)
2728 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2729 ;;
2730 esac
2731 if test ! -z "$withval" ; then
2732 PRNGD_PORT="$withval"
2733 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2734 [Port number of PRNGD/EGD random number socket])
2735 fi
2736 ]
2737)
2738
2739# PRNGD Unix domain socket
2740AC_ARG_WITH([prngd-socket],
2741 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2742 [
2743 case "$withval" in
2744 yes)
2745 withval="/var/run/egd-pool"
2746 ;;
2747 no)
2748 withval=""
2749 ;;
2750 /*)
2751 ;;
2752 *)
2753 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2754 ;;
2755 esac
2756
2757 if test ! -z "$withval" ; then
2758 if test ! -z "$PRNGD_PORT" ; then
2759 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2760 fi
2761 if test ! -r "$withval" ; then
2762 AC_MSG_WARN([Entropy socket is not readable])
2763 fi
2764 PRNGD_SOCKET="$withval"
2765 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2766 [Location of PRNGD/EGD random number socket])
2767 fi
2768 ],
2769 [
2770 # Check for existing socket only if we don't have a random device already
2771 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2772 AC_MSG_CHECKING([for PRNGD/EGD socket])
2773 # Insert other locations here
2774 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2775 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2776 PRNGD_SOCKET="$sock"
2777 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2778 break;
2779 fi
2780 done
2781 if test ! -z "$PRNGD_SOCKET" ; then
2782 AC_MSG_RESULT([$PRNGD_SOCKET])
2783 else
2784 AC_MSG_RESULT([not found])
2785 fi
2786 fi
2787 ]
2788)
2789
2790# Which randomness source do we use?
2791if test ! -z "$PRNGD_PORT" ; then
2792 RAND_MSG="PRNGd port $PRNGD_PORT"
2793elif test ! -z "$PRNGD_SOCKET" ; then
2794 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2795elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2796 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2797 [Define if you want OpenSSL's internally seeded PRNG only])
2798 RAND_MSG="OpenSSL internal ONLY"
2799else
2800 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])
2801fi
2802
Darren Tucker3e6bde42006-08-20 20:03:50 +10002803# Check for PAM libs
2804PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002805AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002806 [ --with-pam Enable PAM support ],
2807 [
2808 if test "x$withval" != "xno" ; then
2809 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2810 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2811 AC_MSG_ERROR([PAM headers not found])
2812 fi
2813
2814 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002815 AC_CHECK_LIB([dl], [dlopen], , )
2816 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2817 AC_CHECK_FUNCS([pam_getenvlist])
2818 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002819 LIBS="$saved_LIBS"
2820
2821 PAM_MSG="yes"
2822
Darren Tucker20e9f972007-03-25 18:26:01 +10002823 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002824 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002825 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002826
Darren Tucker3e6bde42006-08-20 20:03:50 +10002827 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002828 case "$LIBS" in
2829 *-ldl*)
2830 # libdl already in LIBS
2831 ;;
2832 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002833 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002834 ;;
2835 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002836 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002837 fi
2838 ]
2839)
2840
2841# Check for older PAM
2842if test "x$PAM_MSG" = "xyes" ; then
2843 # Check PAM strerror arguments (old PAM)
2844 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002845 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002846#include <stdlib.h>
2847#if defined(HAVE_SECURITY_PAM_APPL_H)
2848#include <security/pam_appl.h>
2849#elif defined (HAVE_PAM_PAM_APPL_H)
2850#include <pam/pam_appl.h>
2851#endif
Tim Rice648f8762011-01-26 12:38:57 -08002852 ]], [[
2853(void)pam_strerror((pam_handle_t *)NULL, -1);
2854 ]])], [AC_MSG_RESULT([no])], [
2855 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002856 [Define if you have an old version of PAM
2857 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002858 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002859 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002860
2861 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002862fi
Damien Miller6c21c512002-01-22 21:57:53 +11002863
Damien Millerd3f6ad22002-06-25 10:24:47 +10002864SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002865AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002866 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002867 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002868 if test -n "$withval" && test "x$withval" != "xno" && \
2869 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002870 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002871 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002872 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002873)
Tim Rice648f8762011-01-26 12:38:57 -08002874AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002875 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002876AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002877
Damien Miller91f40d82013-02-22 11:37:00 +11002878if test "x$have_linux_no_new_privs" = "x1" ; then
2879AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2880 #include <sys/types.h>
2881 #include <linux/seccomp.h>
2882])
2883fi
2884if test "x$have_seccomp_filter" = "x1" ; then
2885AC_MSG_CHECKING([kernel for seccomp_filter support])
2886AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2887 #include <errno.h>
2888 #include <elf.h>
2889 #include <linux/audit.h>
2890 #include <linux/seccomp.h>
2891 #include <stdlib.h>
2892 #include <sys/prctl.h>
2893 ]],
2894 [[ int i = $seccomp_audit_arch;
2895 errno = 0;
2896 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2897 exit(errno == EFAULT ? 0 : 1); ]])],
2898 [ AC_MSG_RESULT([yes]) ], [
2899 AC_MSG_RESULT([no])
2900 # Disable seccomp filter as a target
2901 have_seccomp_filter=0
2902 ]
2903)
2904fi
2905
Damien Miller69ff1df2011-06-23 08:30:03 +10002906# Decide which sandbox style to use
2907sandbox_arg=""
2908AC_ARG_WITH([sandbox],
Damien Miller868ea1e2014-01-17 16:47:04 +11002909 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter, capsicum)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002910 [
2911 if test "x$withval" = "xyes" ; then
2912 sandbox_arg=""
2913 else
2914 sandbox_arg="$withval"
2915 fi
2916 ]
2917)
Darren Tucker60395f92012-07-03 14:31:18 +10002918
2919# Some platforms (seems to be the ones that have a kernel poll(2)-type
2920# function with which they implement select(2)) use an extra file descriptor
2921# when calling select(2), which means we can't use the rlimit sandbox.
2922AC_MSG_CHECKING([if select works with descriptor rlimit])
2923AC_RUN_IFELSE(
2924 [AC_LANG_PROGRAM([[
2925#include <sys/types.h>
2926#ifdef HAVE_SYS_TIME_H
2927# include <sys/time.h>
2928#endif
2929#include <sys/resource.h>
2930#ifdef HAVE_SYS_SELECT_H
2931# include <sys/select.h>
2932#endif
2933#include <errno.h>
2934#include <fcntl.h>
2935#include <stdlib.h>
2936 ]],[[
2937 struct rlimit rl_zero;
2938 int fd, r;
2939 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002940 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002941
2942 fd = open("/dev/null", O_RDONLY);
2943 FD_ZERO(&fds);
2944 FD_SET(fd, &fds);
2945 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2946 setrlimit(RLIMIT_FSIZE, &rl_zero);
2947 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002948 tv.tv_sec = 1;
2949 tv.tv_usec = 0;
2950 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002951 exit (r == -1 ? 1 : 0);
2952 ]])],
2953 [AC_MSG_RESULT([yes])
2954 select_works_with_rlimit=yes],
2955 [AC_MSG_RESULT([no])
2956 select_works_with_rlimit=no],
2957 [AC_MSG_WARN([cross compiling: assuming yes])]
2958)
2959
Darren Tuckerff008de2013-03-06 17:48:48 +11002960AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2961AC_RUN_IFELSE(
2962 [AC_LANG_PROGRAM([[
2963#include <sys/types.h>
2964#ifdef HAVE_SYS_TIME_H
2965# include <sys/time.h>
2966#endif
2967#include <sys/resource.h>
2968#include <errno.h>
2969#include <stdlib.h>
2970 ]],[[
2971 struct rlimit rl_zero;
2972 int fd, r;
2973 fd_set fds;
2974
2975 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2976 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2977 exit (r == -1 ? 1 : 0);
2978 ]])],
2979 [AC_MSG_RESULT([yes])
2980 rlimit_nofile_zero_works=yes],
2981 [AC_MSG_RESULT([no])
2982 rlimit_nofile_zero_works=no],
2983 [AC_MSG_WARN([cross compiling: assuming yes])]
2984)
2985
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002986AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2987AC_RUN_IFELSE(
2988 [AC_LANG_PROGRAM([[
2989#include <sys/types.h>
2990#include <sys/resource.h>
2991#include <stdlib.h>
2992 ]],[[
2993 struct rlimit rl_zero;
2994
2995 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2996 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2997 ]])],
2998 [AC_MSG_RESULT([yes])],
2999 [AC_MSG_RESULT([no])
3000 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3001 [setrlimit RLIMIT_FSIZE works])],
3002 [AC_MSG_WARN([cross compiling: assuming yes])]
3003)
3004
Damien Miller69ff1df2011-06-23 08:30:03 +10003005if test "x$sandbox_arg" = "xsystrace" || \
3006 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003007 test "x$have_systr_policy_kill" != "x1" && \
3008 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003009 SANDBOX_STYLE="systrace"
3010 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003011elif test "x$sandbox_arg" = "xdarwin" || \
3012 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3013 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003014 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3015 "x$ac_cv_header_sandbox_h" != "xyes" && \
3016 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003017 SANDBOX_STYLE="darwin"
3018 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003019elif test "x$sandbox_arg" = "xseccomp_filter" || \
3020 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003021 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003022 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003023 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003024 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3025 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003026 test "x$have_linux_no_new_privs" = "x1" && \
3027 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003028 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003029 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3030 test "x$have_linux_no_new_privs" != "x1" && \
3031 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3032 test "x$have_seccomp_filter" != "x1" && \
3033 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3034 test "x$ac_cv_func_prctl" != "xyes" && \
3035 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3036 SANDBOX_STYLE="seccomp_filter"
3037 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003038elif test "x$sandbox_arg" = "xcapsicum" || \
3039 ( test -z "$sandbox_arg" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003040 test "x$ac_cv_header_sys_capability_h" = "xyes" && \
3041 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
3042 test "x$ac_cv_header_sys_capability_h" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003043 AC_MSG_ERROR([capsicum sandbox requires sys/capability.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003044 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003045 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003046 SANDBOX_STYLE="capsicum"
3047 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003048elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003049 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003050 test "x$select_works_with_rlimit" = "xyes" && \
3051 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003052 test "x$ac_cv_func_setrlimit" != "xyes" && \
3053 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003054 test "x$select_works_with_rlimit" != "xyes" && \
3055 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003056 SANDBOX_STYLE="rlimit"
3057 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
3058elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3059 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3060 SANDBOX_STYLE="none"
3061 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3062else
Tim Ricea6e60612011-08-17 21:48:22 -07003063 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003064fi
3065
Ben Lindstromb5628642000-10-18 00:02:25 +00003066# Cheap hack to ensure NEWS-OS libraries are arranged right.
3067if test ! -z "$SONY" ; then
3068 LIBS="$LIBS -liberty";
3069fi
3070
Damien Miller57f39152005-11-24 19:58:19 +11003071# Check for long long datatypes
3072AC_CHECK_TYPES([long long, unsigned long long, long double])
3073
3074# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003075AC_CHECK_SIZEOF([short int], [2])
3076AC_CHECK_SIZEOF([int], [4])
3077AC_CHECK_SIZEOF([long int], [4])
3078AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003079
Damien Millerfa2bb692002-04-23 23:22:25 +10003080# Sanity check long long for some platforms (AIX)
3081if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3082 ac_cv_sizeof_long_long_int=0
3083fi
3084
Darren Tucker537f1ed2005-10-25 18:38:33 +10003085# compute LLONG_MIN and LLONG_MAX if we don't know them.
3086if test -z "$have_llong_max"; then
3087 AC_MSG_CHECKING([for max value of long long])
3088 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003089 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003090#include <stdio.h>
3091/* Why is this so damn hard? */
3092#ifdef __GNUC__
3093# undef __GNUC__
3094#endif
3095#define __USE_ISOC99
3096#include <limits.h>
3097#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003098#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3099
3100/*
3101 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3102 * we do this the hard way.
3103 */
3104static int
3105fprint_ll(FILE *f, long long n)
3106{
3107 unsigned int i;
3108 int l[sizeof(long long) * 8];
3109
3110 if (n < 0)
3111 if (fprintf(f, "-") < 0)
3112 return -1;
3113 for (i = 0; n != 0; i++) {
3114 l[i] = my_abs(n % 10);
3115 n /= 10;
3116 }
3117 do {
3118 if (fprintf(f, "%d", l[--i]) < 0)
3119 return -1;
3120 } while (i != 0);
3121 if (fprintf(f, " ") < 0)
3122 return -1;
3123 return 0;
3124}
Tim Rice648f8762011-01-26 12:38:57 -08003125 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003126 FILE *f;
3127 long long i, llmin, llmax = 0;
3128
3129 if((f = fopen(DATA,"w")) == NULL)
3130 exit(1);
3131
3132#if defined(LLONG_MIN) && defined(LLONG_MAX)
3133 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3134 llmin = LLONG_MIN;
3135 llmax = LLONG_MAX;
3136#else
3137 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3138 /* This will work on one's complement and two's complement */
3139 for (i = 1; i > llmax; i <<= 1, i++)
3140 llmax = i;
3141 llmin = llmax + 1LL; /* wrap */
3142#endif
3143
3144 /* Sanity check */
3145 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003146 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3147 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003148 fprintf(f, "unknown unknown\n");
3149 exit(2);
3150 }
3151
Darren Tuckerd1450db2006-03-13 19:06:51 +11003152 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003153 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003154 if (fprint_ll(f, llmax) < 0)
3155 exit(4);
3156 if (fclose(f) < 0)
3157 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003158 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003159 ]])],
3160 [
3161 llong_min=`$AWK '{print $1}' conftest.llminmax`
3162 llong_max=`$AWK '{print $2}' conftest.llminmax`
3163
Tim Rice648f8762011-01-26 12:38:57 -08003164 AC_MSG_RESULT([$llong_max])
3165 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003166 [max value of long long calculated by configure])
3167 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003168 AC_MSG_RESULT([$llong_min])
3169 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003170 [min value of long long calculated by configure])
3171 ],
3172 [
Tim Rice648f8762011-01-26 12:38:57 -08003173 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003174 ],
3175 [
3176 AC_MSG_WARN([cross compiling: not checking])
3177 ]
3178 )
3179fi
3180
3181
Damien Millera22ba012000-03-02 23:09:20 +11003182# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003183AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003184 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3185 [[ u_int a; a = 1;]])],
3186 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
3187 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003188])
3189if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003190 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003191 have_u_int=1
3192fi
3193
Damien Miller61e50f12000-05-08 20:49:37 +10003194AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003195 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3196 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
3197 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
3198 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003199])
3200if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003201 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003202 have_intxx_t=1
3203fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003204
3205if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003206 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003207then
3208 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003209 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3210 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003211 [
Tim Rice648f8762011-01-26 12:38:57 -08003212 AC_DEFINE([HAVE_INTXX_T])
3213 AC_MSG_RESULT([yes])
3214 ], [ AC_MSG_RESULT([no])
3215 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003216fi
3217
Damien Miller578783e2000-09-23 14:12:24 +11003218AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003220#include <sys/types.h>
3221#ifdef HAVE_STDINT_H
3222# include <stdint.h>
3223#endif
3224#include <sys/socket.h>
3225#ifdef HAVE_SYS_BITYPES_H
3226# include <sys/bitypes.h>
3227#endif
Tim Rice648f8762011-01-26 12:38:57 -08003228 ]], [[
3229int64_t a; a = 1;
3230 ]])],
3231 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
3232 ])
Damien Miller578783e2000-09-23 14:12:24 +11003233])
3234if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003235 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003236fi
3237
Damien Miller61e50f12000-05-08 20:49:37 +10003238AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3240 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
3241 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
3242 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003243])
3244if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003245 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003246 have_u_intxx_t=1
3247fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003248
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003249if test -z "$have_u_intxx_t" ; then
3250 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003251 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3252 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003253 [
Tim Rice648f8762011-01-26 12:38:57 -08003254 AC_DEFINE([HAVE_U_INTXX_T])
3255 AC_MSG_RESULT([yes])
3256 ], [ AC_MSG_RESULT([no])
3257 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003258fi
3259
Damien Miller578783e2000-09-23 14:12:24 +11003260AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3262 [[ u_int64_t a; a = 1;]])],
3263 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
3264 ])
Damien Miller578783e2000-09-23 14:12:24 +11003265])
3266if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003267 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003268 have_u_int64_t=1
3269fi
3270
Tim Rice4cec93f2002-02-26 08:40:48 -08003271if test -z "$have_u_int64_t" ; then
3272 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003273 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3274 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003275 [
Tim Rice648f8762011-01-26 12:38:57 -08003276 AC_DEFINE([HAVE_U_INT64_T])
3277 AC_MSG_RESULT([yes])
3278 ], [ AC_MSG_RESULT([no])
3279 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003280fi
3281
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003282if test -z "$have_u_intxx_t" ; then
3283 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003284 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003285#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003286 ]], [[
3287 uint8_t a;
3288 uint16_t b;
3289 uint32_t c;
3290 a = b = c = 1;
3291 ]])],
3292 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3293 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003294 ])
3295 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003296 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003297 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003298 fi
3299fi
3300
3301if test -z "$have_uintxx_t" ; then
3302 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003303 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3304 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003305 [
Tim Rice648f8762011-01-26 12:38:57 -08003306 AC_DEFINE([HAVE_UINTXX_T])
3307 AC_MSG_RESULT([yes])
3308 ], [ AC_MSG_RESULT([no])
3309 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003310fi
3311
Darren Tucker6d725682014-01-17 19:17:34 +11003312if test -z "$have_uintxx_t" ; then
3313 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3314 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3315 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3316 [
3317 AC_DEFINE([HAVE_UINTXX_T])
3318 AC_MSG_RESULT([yes])
3319 ], [ AC_MSG_RESULT([no])
3320 ])
3321fi
3322
Damien Milleredb82922000-06-20 13:25:52 +10003323if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003324 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003325then
3326 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003327 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003328#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003329 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003330 int8_t a; int16_t b; int32_t c;
3331 u_int8_t e; u_int16_t f; u_int32_t g;
3332 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003333 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003334 [
Tim Rice648f8762011-01-26 12:38:57 -08003335 AC_DEFINE([HAVE_U_INTXX_T])
3336 AC_DEFINE([HAVE_INTXX_T])
3337 AC_MSG_RESULT([yes])
3338 ], [AC_MSG_RESULT([no])
3339 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003340fi
3341
Damien Miller58be7382001-09-15 21:31:54 +10003342
3343AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003344 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3345 [[ u_char foo; foo = 125; ]])],
3346 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3347 ])
Damien Miller58be7382001-09-15 21:31:54 +10003348])
3349if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003350 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003351fi
3352
Darren Tucker007e3b32013-11-03 18:43:55 +11003353AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3354#include <sys/types.h>
3355#include <stdint.h>
3356])
3357
Tim Rice13aae5e2001-10-21 17:53:58 -07003358TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003359
Tim Rice648f8762011-01-26 12:38:57 -08003360AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3361AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003362#include <sys/types.h>
3363#ifdef HAVE_SYS_BITYPES_H
3364#include <sys/bitypes.h>
3365#endif
3366#ifdef HAVE_SYS_STATFS_H
3367#include <sys/statfs.h>
3368#endif
3369#ifdef HAVE_SYS_STATVFS_H
3370#include <sys/statvfs.h>
3371#endif
3372])
Tim Rice4cec93f2002-02-26 08:40:48 -08003373
Tim Rice648f8762011-01-26 12:38:57 -08003374AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003375[#include <sys/types.h>
3376#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003377
Damien Miller61e50f12000-05-08 20:49:37 +10003378AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003379 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3380 [[ size_t foo; foo = 1235; ]])],
3381 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3382 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003383])
3384if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003385 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003386fi
Damien Miller95058511999-12-29 10:36:45 +11003387
Damien Miller615f9392000-05-17 22:53:33 +10003388AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003389 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3390 [[ ssize_t foo; foo = 1235; ]])],
3391 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3392 ])
Damien Miller615f9392000-05-17 22:53:33 +10003393])
3394if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003395 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003396fi
3397
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003398AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3400 [[ clock_t foo; foo = 1235; ]])],
3401 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3402 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003403])
3404if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003406fi
3407
Damien Millerb54b40e2000-06-23 08:23:34 +10003408AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003410#include <sys/types.h>
3411#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003412 ]], [[ sa_family_t foo; foo = 1235; ]])],
3413 [ ac_cv_have_sa_family_t="yes" ],
3414 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003415#include <sys/types.h>
3416#include <sys/socket.h>
3417#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003418 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003419 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003420 [ ac_cv_have_sa_family_t="no" ]
3421 )
Tim Rice648f8762011-01-26 12:38:57 -08003422 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003423])
3424if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003425 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003426 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003427fi
3428
Damien Miller0f91b4e2000-06-18 15:43:25 +10003429AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003430 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3431 [[ pid_t foo; foo = 1235; ]])],
3432 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3433 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003434])
3435if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003436 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003437fi
3438
3439AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003440 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3441 [[ mode_t foo; foo = 1235; ]])],
3442 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3443 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003444])
3445if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003446 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003447fi
3448
Damien Miller61e50f12000-05-08 20:49:37 +10003449
3450AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003451 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003452#include <sys/types.h>
3453#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003454 ]], [[ struct sockaddr_storage s; ]])],
3455 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3456 [ ac_cv_have_struct_sockaddr_storage="no"
3457 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003458])
3459if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003460 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003461 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003462fi
Damien Miller34132e52000-01-14 15:45:46 +11003463
Damien Miller61e50f12000-05-08 20:49:37 +10003464AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003465 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003466#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003467#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003468 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3469 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3470 [ ac_cv_have_struct_sockaddr_in6="no"
3471 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003472])
3473if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003474 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003475 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003476fi
Damien Miller34132e52000-01-14 15:45:46 +11003477
Damien Miller61e50f12000-05-08 20:49:37 +10003478AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003480#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003481#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003482 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3483 [ ac_cv_have_struct_in6_addr="yes" ],
3484 [ ac_cv_have_struct_in6_addr="no"
3485 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003486])
3487if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003488 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003489 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003490
3491dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003492 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003493 [
3494#ifdef HAVE_SYS_TYPES_H
3495#include <sys/types.h>
3496#endif
3497#include <netinet/in.h>
3498 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003499fi
Damien Miller34132e52000-01-14 15:45:46 +11003500
Damien Miller61e50f12000-05-08 20:49:37 +10003501AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003503#include <sys/types.h>
3504#include <sys/socket.h>
3505#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003506 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3507 [ ac_cv_have_struct_addrinfo="yes" ],
3508 [ ac_cv_have_struct_addrinfo="no"
3509 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003510])
3511if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003512 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003513 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003514fi
3515
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003516AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003517 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3518 [[ struct timeval tv; tv.tv_sec = 1;]])],
3519 [ ac_cv_have_struct_timeval="yes" ],
3520 [ ac_cv_have_struct_timeval="no"
3521 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003522])
3523if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003524 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003525 have_struct_timeval=1
3526fi
3527
Tim Rice648f8762011-01-26 12:38:57 -08003528AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003529
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003530# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003531if test "x$ac_cv_have_int64_t" = "xno" && \
3532 test "x$ac_cv_sizeof_long_int" != "x8" && \
3533 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003534 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3535 echo "an alternative compiler (I.E., GCC) before continuing."
3536 echo ""
3537 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003538else
3539dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003540 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003541 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003542#include <stdio.h>
3543#include <string.h>
3544#ifdef HAVE_SNPRINTF
3545main()
3546{
3547 char buf[50];
3548 char expected_out[50];
3549 int mazsize = 50 ;
3550#if (SIZEOF_LONG_INT == 8)
3551 long int num = 0x7fffffffffffffff;
3552#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003553 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003554#endif
3555 strcpy(expected_out, "9223372036854775807");
3556 snprintf(buf, mazsize, "%lld", num);
3557 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003558 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003559 exit(0);
3560}
3561#else
3562main() { exit(0); }
3563#endif
Tim Rice648f8762011-01-26 12:38:57 -08003564 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003565 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003566 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003567fi
3568
Damien Miller78315eb2000-09-29 23:01:36 +11003569dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003570OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3571OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3572OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3573OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3574OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3575OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3576OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3577OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3578OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3579OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3580OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3581OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3582OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3583OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3584OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3585OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3586OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003587
3588AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003589AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3590struct passwd.pw_change, struct passwd.pw_expire],
3591[], [], [[
3592#include <sys/types.h>
3593#include <pwd.h>
3594]])
3595
Tim Rice648f8762011-01-26 12:38:57 -08003596AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003597 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003598[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003599#include <stdio.h>
3600#if HAVE_SYS_TYPES_H
3601# include <sys/types.h>
3602#endif
3603#include <netinet/in.h>
3604#include <arpa/nameser.h>
3605#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003606]])
andre2ff7b5d2000-06-03 14:57:40 +00003607
Damien Miller61e50f12000-05-08 20:49:37 +10003608AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3609 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003611#include <sys/types.h>
3612#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003613 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3614 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3615 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003616])
3617if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003618 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003619fi
3620
Damien Miller61e50f12000-05-08 20:49:37 +10003621AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3622 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003624#include <sys/types.h>
3625#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003626 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3627 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3628 [ ac_cv_have___ss_family_in_struct_ss="no"
3629 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003630])
3631if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003632 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003633 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003634fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003635
Tim Rice28bbb0c2002-05-27 17:37:32 -07003636dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003637AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3638 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003639 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003640#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003641#include <sys/socket.h>
3642#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003643 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003644#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003645#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003646exit(1);
3647#endif
3648struct msghdr m;
3649m.msg_accrights = 0;
3650exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003651 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003652 [ ac_cv_have_accrights_in_msghdr="yes" ],
3653 [ ac_cv_have_accrights_in_msghdr="no" ]
3654 )
3655])
3656if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003657 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003658 [Define if your system uses access rights style
3659 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003660fi
3661
Tim Rice648f8762011-01-26 12:38:57 -08003662AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3663AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003664#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003665#include <sys/stat.h>
3666#ifdef HAVE_SYS_TIME_H
3667# include <sys/time.h>
3668#endif
3669#ifdef HAVE_SYS_MOUNT_H
3670#include <sys/mount.h>
3671#endif
3672#ifdef HAVE_SYS_STATVFS_H
3673#include <sys/statvfs.h>
3674#endif
Tim Rice648f8762011-01-26 12:38:57 -08003675 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3676 [ AC_MSG_RESULT([yes]) ],
3677 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003678
Tim Rice648f8762011-01-26 12:38:57 -08003679 AC_MSG_CHECKING([if fsid_t has member val])
3680 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003681#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003682#include <sys/statvfs.h>
3683 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3684 [ AC_MSG_RESULT([yes])
3685 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3686 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003687
Tim Rice648f8762011-01-26 12:38:57 -08003688 AC_MSG_CHECKING([if f_fsid has member __val])
3689 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003690#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003691#include <sys/statvfs.h>
3692 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3693 [ AC_MSG_RESULT([yes])
3694 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3695 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003696])
Darren Tucker77001382008-06-09 06:17:53 +10003697
Kevin Stevesa44e0352002-04-07 16:18:03 +00003698AC_CACHE_CHECK([for msg_control field in struct msghdr],
3699 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003700 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003701#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003702#include <sys/socket.h>
3703#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003704 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003705#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003706#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003707exit(1);
3708#endif
3709struct msghdr m;
3710m.msg_control = 0;
3711exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003712 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003713 [ ac_cv_have_control_in_msghdr="yes" ],
3714 [ ac_cv_have_control_in_msghdr="no" ]
3715 )
3716])
3717if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003718 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003719 [Define if your system uses ancillary data style
3720 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003721fi
3722
Damien Miller61e50f12000-05-08 20:49:37 +10003723AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003724 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3725 [[ extern char *__progname; printf("%s", __progname); ]])],
3726 [ ac_cv_libc_defines___progname="yes" ],
3727 [ ac_cv_libc_defines___progname="no"
3728 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003729])
3730if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003731 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003732fi
3733
Kevin Steves4846f4a2002-03-22 18:19:53 +00003734AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003735 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3736 [[ printf("%s", __FUNCTION__); ]])],
3737 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3738 [ ac_cv_cc_implements___FUNCTION__="no"
3739 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003740])
3741if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003742 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003743 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003744fi
3745
3746AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003747 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3748 [[ printf("%s", __func__); ]])],
3749 [ ac_cv_cc_implements___func__="yes" ],
3750 [ ac_cv_cc_implements___func__="no"
3751 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003752])
3753if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003754 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003755fi
3756
Damien Miller57f39152005-11-24 19:58:19 +11003757AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003758 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3759#include <stdarg.h>
3760va_list x,y;
3761 ]], [[ va_copy(x,y); ]])],
3762 [ ac_cv_have_va_copy="yes" ],
3763 [ ac_cv_have_va_copy="no"
3764 ])
Damien Miller57f39152005-11-24 19:58:19 +11003765])
3766if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003767 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003768fi
3769
3770AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003771 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3772#include <stdarg.h>
3773va_list x,y;
3774 ]], [[ __va_copy(x,y); ]])],
3775 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3776 ])
Damien Miller57f39152005-11-24 19:58:19 +11003777])
3778if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003779 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003780fi
3781
Damien Miller4f8e6692001-07-14 13:22:53 +10003782AC_CACHE_CHECK([whether getopt has optreset support],
3783 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003784 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3785 [[ extern int optreset; optreset = 0; ]])],
3786 [ ac_cv_have_getopt_optreset="yes" ],
3787 [ ac_cv_have_getopt_optreset="no"
3788 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003789])
3790if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003791 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003792 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003793fi
Damien Millera22ba012000-03-02 23:09:20 +11003794
Damien Millerecbb26d2000-07-15 14:59:14 +10003795AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003796 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3797[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3798 [ ac_cv_libc_defines_sys_errlist="yes" ],
3799 [ ac_cv_libc_defines_sys_errlist="no"
3800 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003801])
3802if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003803 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003804 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003805fi
3806
3807
Damien Miller11fa2cc2000-08-16 10:35:58 +10003808AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003809 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3810[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3811 [ ac_cv_libc_defines_sys_nerr="yes" ],
3812 [ ac_cv_libc_defines_sys_nerr="no"
3813 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003814])
3815if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003816 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003817fi
3818
Darren Tucker5f88d342003-10-15 16:57:57 +10003819# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003820AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3821 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003822 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003823 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003824 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003825 AC_SEARCH_LIBS([res_query], [resolv])
3826 AC_SEARCH_LIBS([dn_expand], [resolv])
3827 AC_MSG_CHECKING([if res_query will link])
3828 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003829#include <sys/types.h>
3830#include <netinet/in.h>
3831#include <arpa/nameser.h>
3832#include <netdb.h>
3833#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003834 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003835 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003836 ]])],
3837 AC_MSG_RESULT([yes]),
3838 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003839 saved_LIBS="$LIBS"
3840 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003841 AC_MSG_CHECKING([for res_query in -lresolv])
3842 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003843#include <sys/types.h>
3844#include <netinet/in.h>
3845#include <arpa/nameser.h>
3846#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003847#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003848 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003849 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003850 ]])],
3851 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003852 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003853 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003854 ])
Tim Rice648f8762011-01-26 12:38:57 -08003855 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003856 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003857 [#include <sys/types.h>
3858 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003859 AC_CHECK_MEMBER([HEADER.ad],
3860 [AC_DEFINE([HAVE_HEADER_AD], [1],
3861 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003862 [#include <arpa/nameser.h>])
3863 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003864
Tim Rice648f8762011-01-26 12:38:57 -08003865AC_MSG_CHECKING([if struct __res_state _res is an extern])
3866AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003867#include <stdio.h>
3868#if HAVE_SYS_TYPES_H
3869# include <sys/types.h>
3870#endif
3871#include <netinet/in.h>
3872#include <arpa/nameser.h>
3873#include <resolv.h>
3874extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003875 ]], [[ ]])],
3876 [AC_MSG_RESULT([yes])
3877 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003878 [Define if you have struct __res_state _res as an extern])
3879 ],
Tim Rice648f8762011-01-26 12:38:57 -08003880 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003881)
3882
Damien Miller73b42d22006-04-22 21:26:08 +10003883# Check whether user wants SELinux support
3884SELINUX_MSG="no"
3885LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003886AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003887 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003888 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003889 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003890 AC_DEFINE([WITH_SELINUX], [1],
3891 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003892 SELINUX_MSG="yes"
3893 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003894 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3895 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003896 [ LIBSELINUX="-lselinux"
3897 LIBS="$LIBS -lselinux"
3898 ],
Tim Rice648f8762011-01-26 12:38:57 -08003899 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003900 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003901 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003902 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003903 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003904 fi ]
3905)
Tim Rice648f8762011-01-26 12:38:57 -08003906AC_SUBST([SSHLIBS])
3907AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003908
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003909# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003910KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003911AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003912 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003913 [ if test "x$withval" != "xno" ; then
3914 if test "x$withval" = "xyes" ; then
3915 KRB5ROOT="/usr/local"
3916 else
3917 KRB5ROOT=${withval}
3918 fi
3919
Tim Rice648f8762011-01-26 12:38:57 -08003920 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003921 KRB5_MSG="yes"
3922
Tim Rice648f8762011-01-26 12:38:57 -08003923 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003924 [$KRB5ROOT/bin/krb5-config],
3925 [$KRB5ROOT/bin:$PATH])
3926 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003927 K5CFLAGS="`$KRB5CONF --cflags`"
3928 K5LIBS="`$KRB5CONF --libs`"
3929 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003930
Tim Rice648f8762011-01-26 12:38:57 -08003931 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003932 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003933 AC_MSG_RESULT([yes])
3934 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003935 [Define this if you want GSSAPI
3936 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003937 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3938 GSSLIBS="`$KRB5CONF --libs gssapi`"
3939 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003940 else
Tim Rice648f8762011-01-26 12:38:57 -08003941 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003942 fi
Tim Rice648f8762011-01-26 12:38:57 -08003943 AC_MSG_CHECKING([whether we are using Heimdal])
3944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3945 ]], [[ char *tmp = heimdal_version; ]])],
3946 [ AC_MSG_RESULT([yes])
3947 AC_DEFINE([HEIMDAL], [1],
3948 [Define this if you are using the Heimdal
3949 version of Kerberos V5]) ],
3950 [AC_MSG_RESULT([no])
3951 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003952 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003953 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003954 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003955 AC_MSG_CHECKING([whether we are using Heimdal])
3956 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3957 ]], [[ char *tmp = heimdal_version; ]])],
3958 [ AC_MSG_RESULT([yes])
3959 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003960 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003961 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003962 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003963 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003964 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003965 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003966 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003967 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003968
3969 ])
3970 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003971
Tim Rice648f8762011-01-26 12:38:57 -08003972 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3973 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003974 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003975 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3976 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003977 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003978 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3979 [ AC_DEFINE([GSSAPI])
3980 GSSLIBS="-lgss" ],
3981 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3982 ])
Darren Tucker964de182013-02-22 10:39:59 +11003983 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003984
Tim Rice648f8762011-01-26 12:38:57 -08003985 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003986 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003987 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003988 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003989 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003990 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003991 ]
3992 )
3993
3994 oldCPP="$CPPFLAGS"
3995 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003996 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003997 [ CPPFLAGS="$oldCPP" ])
3998
Damien Millera8e06ce2003-11-21 23:48:55 +11003999 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11004000 if test ! -z "$need_dash_r" ; then
4001 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
4002 fi
4003 if test ! -z "$blibpath" ; then
4004 blibpath="$blibpath:${KRB5ROOT}/lib"
4005 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004006
Tim Rice648f8762011-01-26 12:38:57 -08004007 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4008 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4009 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004010
Tim Rice648f8762011-01-26 12:38:57 -08004011 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4012 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004013
4014 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4015#ifdef HAVE_GSSAPI_H
4016# include <gssapi.h>
4017#elif defined(HAVE_GSSAPI_GSSAPI_H)
4018# include <gssapi/gssapi.h>
4019#endif
4020
4021#ifdef HAVE_GSSAPI_GENERIC_H
4022# include <gssapi_generic.h>
4023#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4024# include <gssapi/gssapi_generic.h>
4025#endif
4026 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004027 saved_LIBS="$LIBS"
4028 LIBS="$LIBS $K5LIBS"
4029 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4030 LIBS="$saved_LIBS"
4031
Darren Tucker0d27ed12004-02-24 10:37:33 +11004032 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004033 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004034)
Darren Tucker964de182013-02-22 10:39:59 +11004035AC_SUBST([GSSLIBS])
4036AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004037
Damien Millera22ba012000-03-02 23:09:20 +11004038# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004039
Damien Millerf58c6722002-05-13 13:15:42 +10004040PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004041AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004042 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004043 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004044 if test -n "$withval" && test "x$withval" != "xno" && \
4045 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004046 PRIVSEP_PATH=$withval
4047 fi
4048 ]
4049)
Tim Rice648f8762011-01-26 12:38:57 -08004050AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004051
Tim Rice648f8762011-01-26 12:38:57 -08004052AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004053 [ --with-xauth=PATH Specify path to xauth program ],
4054 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004055 if test -n "$withval" && test "x$withval" != "xno" && \
4056 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004057 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004058 fi
4059 ],
4060 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004061 TestPath="$PATH"
4062 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4063 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4064 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4065 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004066 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004067 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004068 xauth_path="/usr/openwin/bin/xauth"
4069 fi
4070 ]
4071)
4072
Damien Miller7d901272003-01-13 16:55:22 +11004073STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004074AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004075 [ --disable-strip Disable calling strip(1) on install],
4076 [
4077 if test "x$enableval" = "xno" ; then
4078 STRIP_OPT=
4079 fi
4080 ]
4081)
Tim Rice648f8762011-01-26 12:38:57 -08004082AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004083
Damien Millera19cf472000-11-29 13:28:50 +11004084if test -z "$xauth_path" ; then
4085 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004086 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004087else
Tim Rice648f8762011-01-26 12:38:57 -08004088 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004089 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004090 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004091 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004092fi
Damien Millera22ba012000-03-02 23:09:20 +11004093
Tim Rice90f42b02011-06-02 18:17:49 -07004094dnl # --with-maildir=/path/to/mail gets top priority.
4095dnl # if maildir is set in the platform case statement above we use that.
4096dnl # Otherwise we run a program to get the dir from system headers.
4097dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4098dnl # If we find _PATH_MAILDIR we do nothing because that is what
4099dnl # session.c expects anyway. Otherwise we set to the value found
4100dnl # stripping any trailing slash. If for some strage reason our program
4101dnl # does not find what it needs, we default to /var/spool/mail.
4102# Check for mail directory
4103AC_ARG_WITH([maildir],
4104 [ --with-maildir=/path/to/mail Specify your system mail directory],
4105 [
4106 if test "X$withval" != X && test "x$withval" != xno && \
4107 test "x${withval}" != xyes; then
4108 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4109 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4110 fi
4111 ],[
4112 if test "X$maildir" != "X"; then
4113 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4114 else
4115 AC_MSG_CHECKING([Discovering system mail directory])
4116 AC_RUN_IFELSE(
4117 [AC_LANG_PROGRAM([[
4118#include <stdio.h>
4119#include <string.h>
4120#ifdef HAVE_PATHS_H
4121#include <paths.h>
4122#endif
4123#ifdef HAVE_MAILLOCK_H
4124#include <maillock.h>
4125#endif
4126#define DATA "conftest.maildir"
4127 ]], [[
4128 FILE *fd;
4129 int rc;
4130
4131 fd = fopen(DATA,"w");
4132 if(fd == NULL)
4133 exit(1);
4134
4135#if defined (_PATH_MAILDIR)
4136 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4137 exit(1);
4138#elif defined (MAILDIR)
4139 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4140 exit(1);
4141#elif defined (_PATH_MAIL)
4142 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4143 exit(1);
4144#else
4145 exit (2);
4146#endif
4147
4148 exit(0);
4149 ]])],
4150 [
4151 maildir_what=`awk -F: '{print $1}' conftest.maildir`
4152 maildir=`awk -F: '{print $2}' conftest.maildir \
4153 | sed 's|/$||'`
4154 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4155 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4156 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4157 fi
4158 ],
4159 [
4160 if test "X$ac_status" = "X2";then
4161# our test program didn't find it. Default to /var/spool/mail
4162 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4163 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4164 else
4165 AC_MSG_RESULT([*** not found ***])
4166 fi
4167 ],
4168 [
4169 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4170 ]
4171 )
4172 fi
4173 ]
4174) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004175
Darren Tucker623d92f2004-09-12 22:36:15 +10004176if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004177 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4178 disable_ptmx_check=yes
4179fi
Damien Millera22ba012000-03-02 23:09:20 +11004180if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004181 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004182 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004183 [
Tim Rice648f8762011-01-26 12:38:57 -08004184 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004185 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004186 have_dev_ptmx=1
4187 ]
4188 )
4189 fi
Damien Millera22ba012000-03-02 23:09:20 +11004190fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004191
Darren Tucker623d92f2004-09-12 22:36:15 +10004192if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004193 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004194 [
Tim Rice648f8762011-01-26 12:38:57 -08004195 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004196 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004197 have_dev_ptc=1
4198 ]
4199 )
4200else
4201 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4202fi
Damien Miller204ad072000-03-02 23:56:12 +11004203
Damien Millera22ba012000-03-02 23:09:20 +11004204# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004205AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004206 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004207 [
Damien Miller897741e2001-04-16 10:41:46 +10004208 case "$withval" in
4209 man|cat|doc)
4210 MANTYPE=$withval
4211 ;;
4212 *)
Tim Rice648f8762011-01-26 12:38:57 -08004213 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004214 ;;
4215 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004216 ]
4217)
Ben Lindstrombc709922001-04-18 18:04:21 +00004218if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004219 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004220 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004221 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4222 MANTYPE=doc
4223 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4224 MANTYPE=man
4225 else
4226 MANTYPE=cat
4227 fi
4228fi
Tim Rice648f8762011-01-26 12:38:57 -08004229AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004230if test "$MANTYPE" = "doc"; then
4231 mansubdir=man;
4232else
4233 mansubdir=$MANTYPE;
4234fi
Tim Rice648f8762011-01-26 12:38:57 -08004235AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004236
Damien Millera22ba012000-03-02 23:09:20 +11004237# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004238MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004239AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004240 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004241 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004242 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004243 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004244 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004245 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004246 fi
4247 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004248)
4249
Damien Millera22ba012000-03-02 23:09:20 +11004250# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004251AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004252 [ --without-shadow Disable shadow password support],
4253 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004254 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004255 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004256 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004257 fi
4258 ]
4259)
4260
Damien Miller1f335fb2000-06-26 11:31:33 +10004261if test -z "$disable_shadow" ; then
4262 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004264#include <sys/types.h>
4265#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004266struct spwd sp;
4267 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4268 [ sp_expire_available=yes ], [
4269 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004270
4271 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004272 AC_MSG_RESULT([yes])
4273 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004274 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004275 else
Tim Rice648f8762011-01-26 12:38:57 -08004276 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004277 fi
4278fi
4279
Damien Millera22ba012000-03-02 23:09:20 +11004280# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004281if test ! -z "$IPADDR_IN_DISPLAY" ; then
4282 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004283 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004284 [Define if you need to use IP address
4285 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004286else
Damien Millera8e06ce2003-11-21 23:48:55 +11004287 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004288 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004289 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4290 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004291 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004292 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004293 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004294 fi
4295 ]
4296 )
4297fi
Damien Miller76112de1999-12-21 11:18:08 +11004298
Darren Tuckere1a790d2003-09-16 11:52:19 +10004299# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004300AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004301 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004302 [ if test "x$enableval" = "xno"; then
4303 AC_MSG_NOTICE([/etc/default/login handling disabled])
4304 etc_default_login=no
4305 else
4306 etc_default_login=yes
4307 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004308 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4309 then
4310 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4311 etc_default_login=no
4312 else
4313 etc_default_login=yes
4314 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004315)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004316
Darren Tucker2f9573d2005-02-10 22:28:54 +11004317if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004318 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004319 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004320 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004321 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004322 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004323 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004324fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004325
Tim Rice43a1c132002-04-17 21:19:14 -07004326dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004327if test $ac_cv_func_login_getcapbool = "yes" && \
4328 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004329 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004330fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004331
Damien Millera22ba012000-03-02 23:09:20 +11004332# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004333SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004334AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004335 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004336 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004337 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004338 AC_MSG_WARN([
4339--with-default-path=PATH has no effect on this system.
4340Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004341 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004342 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004343 AC_MSG_WARN([
4344--with-default-path=PATH will only be used if PATH is not defined in
4345$external_path_file .])
4346 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004347 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004348 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004349 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004350 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004351 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4352 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004353 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004354 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004355 AC_MSG_WARN([
4356If PATH is defined in $external_path_file, ensure the path to scp is included,
4357otherwise scp will not work.])
4358 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004359 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004360 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004361/* find out what STDPATH is */
4362#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004363#ifdef HAVE_PATHS_H
4364# include <paths.h>
4365#endif
4366#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004367# ifdef _PATH_USERPATH /* Irix */
4368# define _PATH_STDPATH _PATH_USERPATH
4369# else
4370# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4371# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004372#endif
4373#include <sys/types.h>
4374#include <sys/stat.h>
4375#include <fcntl.h>
4376#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004377 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004378 FILE *fd;
4379 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004380
Tim Rice59ea0a02001-03-10 13:50:45 -08004381 fd = fopen(DATA,"w");
4382 if(fd == NULL)
4383 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004384
Tim Rice59ea0a02001-03-10 13:50:45 -08004385 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4386 exit(1);
4387
4388 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004389 ]])],
4390 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004391 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4392 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4393 )
4394# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004395 t_bindir="${bindir}"
4396 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4397 t_bindir=`eval echo ${t_bindir}`
4398 case $t_bindir in
4399 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4400 esac
4401 case $t_bindir in
4402 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4403 esac
4404 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004405 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4406 if test $? -ne 0 ; then
4407 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4408 if test $? -ne 0 ; then
4409 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004410 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004411 fi
4412 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004413 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004414)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004415if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004416 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4417 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004418fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004419
Damien Millera18bbd32002-05-13 10:48:57 +10004420# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004421AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004422 [ --with-superuser-path= Specify different path for super-user],
4423 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004424 if test -n "$withval" && test "x$withval" != "xno" && \
4425 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004426 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004427 [Define if you want a different $PATH
4428 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004429 superuser_path=$withval
4430 fi
4431 ]
4432)
4433
4434
Damien Miller61e50f12000-05-08 20:49:37 +10004435AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004436IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004437AC_ARG_WITH(4in6,
4438 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4439 [
4440 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004441 AC_MSG_RESULT([yes])
4442 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004443 [Detect IPv4 in IPv6 mapped addresses
4444 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004445 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004446 else
Tim Rice648f8762011-01-26 12:38:57 -08004447 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004448 fi
Tim Rice648f8762011-01-26 12:38:57 -08004449 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004450 if test "x$inet6_default_4in6" = "xyes"; then
4451 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004452 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004453 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004454 else
4455 AC_MSG_RESULT([no (default)])
4456 fi
4457 ]
4458)
4459
Damien Miller60396b02001-02-18 17:01:00 +11004460# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004461BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004462AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004463 [ --with-bsd-auth Enable BSD auth support],
4464 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004465 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004466 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004467 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004468 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004469 fi
4470 ]
4471)
4472
Damien Millera22ba012000-03-02 23:09:20 +11004473# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004474piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004475# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004476if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004477 piddir=`eval echo ${sysconfdir}`
4478 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004479 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004480 esac
4481fi
4482
Tim Rice648f8762011-01-26 12:38:57 -08004483AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004484 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4485 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004486 if test -n "$withval" && test "x$withval" != "xno" && \
4487 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004488 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004489 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004490 AC_MSG_WARN([** no $piddir directory on this system **])
4491 fi
4492 fi
4493 ]
4494)
4495
Tim Rice648f8762011-01-26 12:38:57 -08004496AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4497 [Specify location of ssh.pid])
4498AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004499
andre2ff7b5d2000-06-03 14:57:40 +00004500dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004501AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004502 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004503 [
4504 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004505 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004506 fi
4507 ]
andre2ff7b5d2000-06-03 14:57:40 +00004508)
Tim Rice648f8762011-01-26 12:38:57 -08004509AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004510 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004511 [
4512 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004513 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004514 fi
4515 ]
andre2ff7b5d2000-06-03 14:57:40 +00004516)
Tim Rice648f8762011-01-26 12:38:57 -08004517AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004518 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004519 [
4520 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004521 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004522 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004523 fi
4524 ]
andre2ff7b5d2000-06-03 14:57:40 +00004525)
Tim Rice648f8762011-01-26 12:38:57 -08004526AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004527 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004528 [
4529 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004530 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004531 fi
4532 ]
andre2ff7b5d2000-06-03 14:57:40 +00004533)
Tim Rice648f8762011-01-26 12:38:57 -08004534AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004535 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004536 [
4537 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004538 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004539 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004540 fi
4541 ]
andre2ff7b5d2000-06-03 14:57:40 +00004542)
Tim Rice648f8762011-01-26 12:38:57 -08004543AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004544 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004545 [
4546 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004547 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004548 fi
4549 ]
andre2ff7b5d2000-06-03 14:57:40 +00004550)
Tim Rice648f8762011-01-26 12:38:57 -08004551AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004552 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004553 [
4554 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004555 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004556 [Define if you don't want to use pututline()
4557 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004558 fi
4559 ]
andre2ff7b5d2000-06-03 14:57:40 +00004560)
Tim Rice648f8762011-01-26 12:38:57 -08004561AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004562 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004563 [
4564 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004565 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004566 [Define if you don't want to use pututxline()
4567 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004568 fi
4569 ]
andre2ff7b5d2000-06-03 14:57:40 +00004570)
Tim Rice648f8762011-01-26 12:38:57 -08004571AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004572 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004573 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004574 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004575 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004576 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004577 conf_lastlog_location=$withval
4578 fi
4579 ]
4580)
andre2ff7b5d2000-06-03 14:57:40 +00004581
4582dnl lastlog, [uw]tmpx? detection
4583dnl NOTE: set the paths in the platform section to avoid the
4584dnl need for command-line parameters
4585dnl lastlog and [uw]tmp are subject to a file search if all else fails
4586
4587dnl lastlog detection
4588dnl NOTE: the code itself will detect if lastlog is a directory
4589AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004590AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004591#include <sys/types.h>
4592#include <utmp.h>
4593#ifdef HAVE_LASTLOG_H
4594# include <lastlog.h>
4595#endif
Damien Miller2994e082000-06-04 15:51:47 +10004596#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004597# include <paths.h>
4598#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004599#ifdef HAVE_LOGIN_H
4600# include <login.h>
4601#endif
Tim Rice648f8762011-01-26 12:38:57 -08004602 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4603 [ AC_MSG_RESULT([yes]) ],
4604 [
4605 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004606 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004607 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004608#include <sys/types.h>
4609#include <utmp.h>
4610#ifdef HAVE_LASTLOG_H
4611# include <lastlog.h>
4612#endif
4613#ifdef HAVE_PATHS_H
4614# include <paths.h>
4615#endif
Tim Rice648f8762011-01-26 12:38:57 -08004616 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4617 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004618 [
Tim Rice648f8762011-01-26 12:38:57 -08004619 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004620 system_lastlog_path=no
4621 ])
Tim Rice648f8762011-01-26 12:38:57 -08004622])
Damien Miller2994e082000-06-04 15:51:47 +10004623
andre2ff7b5d2000-06-03 14:57:40 +00004624if test -z "$conf_lastlog_location"; then
4625 if test x"$system_lastlog_path" = x"no" ; then
4626 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004627 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004628 conf_lastlog_location=$f
4629 fi
4630 done
4631 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004632 AC_MSG_WARN([** Cannot find lastlog **])
4633 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004634 fi
4635 fi
4636fi
4637
4638if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004639 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004640 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004641fi
andre2ff7b5d2000-06-03 14:57:40 +00004642
4643dnl utmp detection
4644AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004645AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004646#include <sys/types.h>
4647#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004648#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004649# include <paths.h>
4650#endif
Tim Rice648f8762011-01-26 12:38:57 -08004651 ]], [[ char *utmp = UTMP_FILE; ]])],
4652 [ AC_MSG_RESULT([yes]) ],
4653 [ AC_MSG_RESULT([no])
4654 system_utmp_path=no
4655])
andre2ff7b5d2000-06-03 14:57:40 +00004656if test -z "$conf_utmp_location"; then
4657 if test x"$system_utmp_path" = x"no" ; then
4658 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4659 if test -f $f ; then
4660 conf_utmp_location=$f
4661 fi
4662 done
4663 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004664 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004665 fi
4666 fi
4667fi
4668if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004669 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004670 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004671fi
andre2ff7b5d2000-06-03 14:57:40 +00004672
4673dnl wtmp detection
4674AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004675AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004676#include <sys/types.h>
4677#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004678#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004679# include <paths.h>
4680#endif
Tim Rice648f8762011-01-26 12:38:57 -08004681 ]], [[ char *wtmp = WTMP_FILE; ]])],
4682 [ AC_MSG_RESULT([yes]) ],
4683 [ AC_MSG_RESULT([no])
4684 system_wtmp_path=no
4685])
andre2ff7b5d2000-06-03 14:57:40 +00004686if test -z "$conf_wtmp_location"; then
4687 if test x"$system_wtmp_path" = x"no" ; then
4688 for f in /usr/adm/wtmp /var/log/wtmp; do
4689 if test -f $f ; then
4690 conf_wtmp_location=$f
4691 fi
4692 done
4693 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004694 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004695 fi
4696 fi
4697fi
4698if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004699 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004700 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004701fi
andre2ff7b5d2000-06-03 14:57:40 +00004702
andre2ff7b5d2000-06-03 14:57:40 +00004703dnl wtmpx detection
4704AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004705AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004706#include <sys/types.h>
4707#include <utmp.h>
4708#ifdef HAVE_UTMPX_H
4709#include <utmpx.h>
4710#endif
Damien Miller2994e082000-06-04 15:51:47 +10004711#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004712# include <paths.h>
4713#endif
Tim Rice648f8762011-01-26 12:38:57 -08004714 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4715 [ AC_MSG_RESULT([yes]) ],
4716 [ AC_MSG_RESULT([no])
4717 system_wtmpx_path=no
4718])
andre2ff7b5d2000-06-03 14:57:40 +00004719if test -z "$conf_wtmpx_location"; then
4720 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004721 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004722 fi
4723else
Tim Rice648f8762011-01-26 12:38:57 -08004724 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004725 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004726fi
andre2ff7b5d2000-06-03 14:57:40 +00004727
Damien Miller4018c192000-04-30 09:30:44 +10004728
Damien Miller29ea30d2000-03-17 10:54:15 +11004729if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004730 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4731 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004732fi
4733
Damien Millera2438bb2013-03-15 10:23:07 +11004734AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004735 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004736 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004737 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004738 ], [
4739#ifdef HAVE_SYS_TYPES_H
4740#include <sys/types.h>
4741#endif
4742#ifdef HAVE_UTMP_H
4743#include <utmp.h>
4744#endif
4745#ifdef HAVE_UTMPX_H
4746#include <utmpx.h>
4747#endif
4748#ifdef HAVE_LASTLOG_H
4749#include <lastlog.h>
4750#endif
4751 ])
4752
4753AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4754 AC_DEFINE([DISABLE_UTMP])
4755 AC_DEFINE([DISABLE_WTMP])
4756 ], [
4757#ifdef HAVE_SYS_TYPES_H
4758#include <sys/types.h>
4759#endif
4760#ifdef HAVE_UTMP_H
4761#include <utmp.h>
4762#endif
4763#ifdef HAVE_UTMPX_H
4764#include <utmpx.h>
4765#endif
4766#ifdef HAVE_LASTLOG_H
4767#include <lastlog.h>
4768#endif
4769 ])
4770
Darren Tucker7da23cb2005-08-03 00:20:15 +10004771dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4772dnl Add now.
4773CFLAGS="$CFLAGS $werror_flags"
4774
Darren Tucker627337d2010-04-10 22:58:01 +10004775if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4776 TEST_SSH_IPV6=no
4777else
4778 TEST_SSH_IPV6=yes
4779fi
Tim Rice648f8762011-01-26 12:38:57 -08004780AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4781AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker882abfd2013-11-09 00:17:41 +11004782AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10004783AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker5d376902008-06-11 04:15:05 +10004784
Damien Millerbac2d8a2000-09-05 16:13:06 +11004785AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004786AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4787 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004788 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004789AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004790
Damien Miller7b22d652000-06-18 14:07:04 +10004791# Print summary of options
4792
Damien Miller7b22d652000-06-18 14:07:04 +10004793# Someone please show me a better way :)
4794A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4795B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4796C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4797D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004798E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004799F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004800G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004801H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4802I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4803J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004804
4805echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004806echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004807echo " User binaries: $B"
4808echo " System binaries: $C"
4809echo " Configuration files: $D"
4810echo " Askpass program: $E"
4811echo " Manual pages: $F"
4812echo " PID file: $G"
4813echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004814if test "x$external_path_file" = "x/etc/login.conf" ; then
4815echo " At runtime, sshd will use the path defined in $external_path_file"
4816echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004817else
Damien Millerf58c6722002-05-13 13:15:42 +10004818echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004819 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004820echo " (If PATH is set in $external_path_file it will be used instead. If"
4821echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4822 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004823fi
Damien Millera18bbd32002-05-13 10:48:57 +10004824if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004825echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004826fi
Damien Millerf58c6722002-05-13 13:15:42 +10004827echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004828echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004829echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004830echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004831echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004832echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004833echo " S/KEY support: $SKEY_MSG"
4834echo " TCP Wrappers support: $TCPW_MSG"
4835echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004836echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004837echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004838echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004839echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004840echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4841echo " BSD Auth support: $BSD_AUTH_MSG"
4842echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004843echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004844
Damien Miller7b22d652000-06-18 14:07:04 +10004845echo ""
4846
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004847echo " Host: ${host}"
4848echo " Compiler: ${CC}"
4849echo " Compiler flags: ${CFLAGS}"
4850echo "Preprocessor flags: ${CPPFLAGS}"
4851echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004852echo " Libraries: ${LIBS}"
4853if test ! -z "${SSHDLIBS}"; then
4854echo " +for sshd: ${SSHDLIBS}"
4855fi
Damien Miller71adf122011-01-25 12:16:15 +11004856if test ! -z "${SSHLIBS}"; then
4857echo " +for ssh: ${SSHLIBS}"
4858fi
Damien Miller7b22d652000-06-18 14:07:04 +10004859
4860echo ""
4861
Tim Rice6f1f7582004-05-30 21:38:51 -07004862if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004863 echo "SVR4 style packages are supported with \"make package\""
4864 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004865fi
4866
Damien Miller82cf0ce2000-12-20 13:34:48 +11004867if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004868 echo "PAM is enabled. You may need to install a PAM control file "
4869 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004870 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004871 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004872 echo ""
4873fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004874
Damien Millerb4097182004-05-23 14:09:40 +10004875if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004876 echo "WARNING: the operating system that you are using does not"
4877 echo "appear to support getpeereid(), getpeerucred() or the"
4878 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4879 echo "enforce security checks to prevent unauthorised connections to"
4880 echo "ssh-agent. Their absence increases the risk that a malicious"
4881 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004882 echo ""
4883fi
4884
Darren Tuckerd9f88912005-02-20 21:01:48 +11004885if test "$AUDIT_MODULE" = "bsm" ; then
4886 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4887 echo "See the Solaris section in README.platform for details."
4888fi