blob: 9022ee9c9f62fb08c07b621af5ae1687b1a13438 [file] [log] [blame]
Damien Miller4fefe242004-03-11 14:20:10 +11001#
2# Copyright (c) 1999-2004 Damien Miller
3#
4# Permission to use, copy, modify, and distribute this software for any
5# purpose with or without fee is hereby granted, provided that the above
6# copyright notice and this permission notice appear in all copies.
7#
8# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110015
Tim Rice648f8762011-01-26 12:38:57 -080016AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Damien Miller3d673d12014-08-27 06:32:01 +100017AC_REVISION($Revision: 1.583 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Tim Rice648f8762011-01-26 12:38:57 -080019AC_LANG([C])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
Tim Rice648f8762011-01-26 12:38:57 -080021AC_CONFIG_HEADER([config.h])
Darren Tuckerc90a7922019-01-21 09:22:36 +110022AC_PROG_CC([cc gcc])
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Darren Tucker6c8a2462017-12-01 17:11:47 +110032AC_PROG_MKDIR_P
Darren Tucker408f4c22015-04-17 09:39:58 +100033AC_CHECK_TOOLS([AR], [ar])
Tim Rice648f8762011-01-26 12:38:57 -080034AC_PATH_PROG([CAT], [cat])
35AC_PATH_PROG([KILL], [kill])
Tim Rice648f8762011-01-26 12:38:57 -080036AC_PATH_PROG([SED], [sed])
Tim Rice648f8762011-01-26 12:38:57 -080037AC_PATH_PROG([ENT], [ent])
38AC_SUBST([ENT])
39AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
40AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
41AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
42AC_PATH_PROG([SH], [sh])
43AC_PATH_PROG([GROFF], [groff])
44AC_PATH_PROG([NROFF], [nroff])
45AC_PATH_PROG([MANDOC], [mandoc])
46AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110047
Damien Miller30a69e72011-01-04 08:16:27 +110048dnl select manpage formatter
49if test "x$MANDOC" != "x" ; then
50 MANFMT="$MANDOC"
51elif test "x$NROFF" != "x" ; then
52 MANFMT="$NROFF -mandoc"
53elif test "x$GROFF" != "x" ; then
54 MANFMT="$GROFF -mandoc -Tascii"
55else
56 AC_MSG_WARN([no manpage formatted found])
57 MANFMT="false"
58fi
Tim Rice648f8762011-01-26 12:38:57 -080059AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110060
Tim Rice6f1f7582004-05-30 21:38:51 -070061dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080062AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070063 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080064AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070065 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080066AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110067if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080068 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110069else
Tim Rice648f8762011-01-26 12:38:57 -080070 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110071fi
Tim Rice6f1f7582004-05-30 21:38:51 -070072
Damien Millere8bb4502001-09-25 16:39:35 +100073# System features
74AC_SYS_LARGEFILE
75
Damien Miller3f62aba2000-11-29 11:56:35 +110076if test -z "$AR" ; then
77 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
78fi
79
Tim Rice648f8762011-01-26 12:38:57 -080080AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +110081if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -080082 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -070083 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110084fi
85
Darren Tuckerf2c06ab2018-06-08 17:43:36 +100086dnl Since autoconf doesn't support it very well, we no longer allow users to
87dnl override LD, however keeping the hook here for now in case there's a use
88dnl use case we overlooked and someone needs to re-enable it. Unless a good
89dnl reason is found we'll be removing this in future.
90LD="$CC"
Tim Rice648f8762011-01-26 12:38:57 -080091AC_SUBST([LD])
Tim Riceeae17cc2005-03-17 16:52:20 -080092
Damien Miller166bd442000-03-16 10:48:25 +110093AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100094
Tim Rice648f8762011-01-26 12:38:57 -080095AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
Damien Miller69ff1df2011-06-23 08:30:03 +100096AC_CHECK_DECL([SYSTR_POLICY_KILL], [have_systr_policy_kill=1], , [
97 #include <sys/types.h>
98 #include <sys/param.h>
99 #include <dev/systrace.h>
100])
101AC_CHECK_DECL([RLIMIT_NPROC],
102 [AC_DEFINE([HAVE_RLIMIT_NPROC], [], [sys/resource.h has RLIMIT_NPROC])], , [
103 #include <sys/types.h>
104 #include <sys/resource.h>
105])
Damien Millere0956e32012-04-04 11:27:54 +1000106AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [
107 #include <sys/types.h>
108 #include <linux/prctl.h>
109])
Damien Miller868ea1e2014-01-17 16:47:04 +1100110
Damien Miller72ef7c12015-01-15 02:21:31 +1100111openssl=yes
Damien Miller72ef7c12015-01-15 02:21:31 +1100112AC_ARG_WITH([openssl],
113 [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ],
Damien Miller76c04802015-01-13 19:38:18 +1100114 [ if test "x$withval" = "xno" ; then
Damien Miller72ef7c12015-01-15 02:21:31 +1100115 openssl=no
Damien Miller76c04802015-01-13 19:38:18 +1100116 fi
117 ]
118)
Damien Miller72ef7c12015-01-15 02:21:31 +1100119AC_MSG_CHECKING([whether OpenSSL will be used for cryptography])
120if test "x$openssl" = "xyes" ; then
121 AC_MSG_RESULT([yes])
122 AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography])
123else
124 AC_MSG_RESULT([no])
125fi
126
Darren Tuckerb7918af2008-03-09 11:34:23 +1100127use_stack_protector=1
Darren Tuckerfd994372014-01-17 09:53:24 +1100128use_toolchain_hardening=1
Tim Rice648f8762011-01-26 12:38:57 -0800129AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100130 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100131 if test "x$withval" = "xno"; then
132 use_stack_protector=0
133 fi ])
Darren Tuckerfd994372014-01-17 09:53:24 +1100134AC_ARG_WITH([hardening],
135 [ --without-hardening Don't use toolchain hardening flags], [
136 if test "x$withval" = "xno"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100137 use_toolchain_hardening=0
138 fi ])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100139
Darren Tuckerfd994372014-01-17 09:53:24 +1100140# We use -Werror for the tests only so that we catch warnings like "this is
141# on by default" for things like -fPIE.
142AC_MSG_CHECKING([if $CC supports -Werror])
143saved_CFLAGS="$CFLAGS"
144CFLAGS="$CFLAGS -Werror"
145AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
146 [ AC_MSG_RESULT([yes])
147 WERROR="-Werror"],
148 [ AC_MSG_RESULT([no])
149 WERROR="" ]
150)
151CFLAGS="$saved_CFLAGS"
Damien Miller134d02a2011-01-12 16:00:37 +1100152
Damien Millera8e06ce2003-11-21 23:48:55 +1100153if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerd9048862017-03-31 11:04:43 +1100154 OSSH_CHECK_CFLAG_COMPILE([-pipe])
Darren Tuckerfd994372014-01-17 09:53:24 +1100155 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
156 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option])
Damien Millerb1763622011-05-20 11:45:25 +1000157 OSSH_CHECK_CFLAG_COMPILE([-Wall])
158 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
159 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
160 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
161 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000162 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000163 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
164 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
165 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tuckerfd994372014-01-17 09:53:24 +1100166 if test "x$use_toolchain_hardening" = "x1"; then
Darren Tucker3377df02018-02-11 09:32:37 +1100167 OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang
Darren Tucker174bed62018-02-13 18:12:47 +1100168 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt])
Damien Miller161af8f2017-09-19 10:18:56 +1000169 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100170 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
171 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
172 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
Damien Miller5c2ff5e2014-01-22 21:30:12 +1100173 # NB. -ftrapv expects certain support functions to be present in
174 # the compiler library (libgcc or similar) to detect integer operations
175 # that can overflow. We must check that the result of enabling it
176 # actually links. The test program compiled/linked includes a number
177 # of integer operations that should exercise this.
178 OSSH_CHECK_CFLAG_LINK([-ftrapv])
Darren Tuckerfd994372014-01-17 09:53:24 +1100179 fi
Tim Rice648f8762011-01-26 12:38:57 -0800180 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100181 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700182 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000183 1.*) no_attrib_nonnull=1 ;;
184 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000185 no_attrib_nonnull=1
186 ;;
187 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100188 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700189 esac
Tim Rice648f8762011-01-26 12:38:57 -0800190 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000191
Tim Rice648f8762011-01-26 12:38:57 -0800192 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000193 saved_CFLAGS="$CFLAGS"
194 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800195 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
196 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
197 [ AC_MSG_RESULT([yes]) ],
198 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000199 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800200 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000201
Darren Tuckerb7918af2008-03-09 11:34:23 +1100202 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100203 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100204 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100205 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100206 for t in -fstack-protector-strong -fstack-protector-all \
207 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800208 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100209 saved_CFLAGS="$CFLAGS"
210 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100211 CFLAGS="$CFLAGS $t -Werror"
212 LDFLAGS="$LDFLAGS $t -Werror"
213 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800214 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
215 [[
216 char x[256];
217 snprintf(x, sizeof(x), "XXX");
218 ]])],
219 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100220 CFLAGS="$saved_CFLAGS $t"
221 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800222 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100223 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800224 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
225 [[
226 char x[256];
227 snprintf(x, sizeof(x), "XXX");
228 ]])],
229 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100230 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800231 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100232 [ AC_MSG_WARN([cross compiling: cannot test])
233 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100234 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100235 ],
Tim Rice648f8762011-01-26 12:38:57 -0800236 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100237 )
238 CFLAGS="$saved_CFLAGS"
239 LDFLAGS="$saved_LDFLAGS"
240 done
241 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100242
Darren Tucker67b37032005-06-03 17:58:31 +1000243 if test -z "$have_llong_max"; then
244 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
245 unset ac_cv_have_decl_LLONG_MAX
246 saved_CFLAGS="$CFLAGS"
247 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800248 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000249 [have_llong_max=1],
250 [CFLAGS="$saved_CFLAGS"],
251 [#include <limits.h>]
252 )
253 fi
Damien Miller166bd442000-03-16 10:48:25 +1100254fi
255
Darren Tucker951b53b2013-02-08 11:50:09 +1100256AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
257AC_COMPILE_IFELSE(
258 [AC_LANG_PROGRAM([[
259#include <stdlib.h>
260__attribute__((__unused__)) static void foo(void){return;}]],
261 [[ exit(0); ]])],
262 [ AC_MSG_RESULT([yes]) ],
263 [ AC_MSG_RESULT([no])
264 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
265 [compiler does not accept __attribute__ on return types]) ]
266)
267
Darren Tucker1323f122018-02-27 08:41:25 +1100268AC_MSG_CHECKING([if compiler allows __attribute__ prototype args])
269AC_COMPILE_IFELSE(
270 [AC_LANG_PROGRAM([[
271#include <stdlib.h>
272typedef void foo(const char *, ...) __attribute__((format(printf, 1, 2)));]],
273 [[ exit(0); ]])],
274 [ AC_MSG_RESULT([yes]) ],
275 [ AC_MSG_RESULT([no])
276 AC_DEFINE(NO_ATTRIBUTE_ON_PROTOTYPE_ARGS, 1,
Damien Miller10479cc2018-04-10 10:19:02 +1000277 [compiler does not accept __attribute__ on prototype args]) ]
Darren Tucker1323f122018-02-27 08:41:25 +1100278)
279
Darren Tucker391de5c2007-04-29 14:49:21 +1000280if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800281 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000282fi
283
Tim Rice648f8762011-01-26 12:38:57 -0800284AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800285 [ --without-rpath Disable auto-added -R linker paths],
286 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800287 if test "x$withval" = "xno" ; then
Darren Tucker2f0bad22019-01-21 21:28:27 +1100288 rpath_opt=""
289 elif test "x$withval" = "xyes" ; then
290 rpath_opt="-R"
291 else
292 rpath_opt="$withval"
Tim Rice88368a32003-12-08 12:35:59 -0800293 fi
294 ]
295)
296
Tim Rice1cfab232006-10-03 09:34:35 -0700297# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800298AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700299 [ --with-cflags Specify additional flags to pass to compiler],
300 [
301 if test -n "$withval" && test "x$withval" != "xno" && \
302 test "x${withval}" != "xyes"; then
303 CFLAGS="$CFLAGS $withval"
304 fi
305 ]
306)
Damien Millerde35c382017-09-08 12:38:31 +1000307
308AC_ARG_WITH([cflags-after],
309 [ --with-cflags-after Specify additional flags to pass to compiler after configure],
310 [
311 if test -n "$withval" && test "x$withval" != "xno" && \
312 test "x${withval}" != "xyes"; then
313 CFLAGS_AFTER="$withval"
314 fi
315 ]
316)
Tim Rice648f8762011-01-26 12:38:57 -0800317AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700318 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
319 [
320 if test -n "$withval" && test "x$withval" != "xno" && \
321 test "x${withval}" != "xyes"; then
322 CPPFLAGS="$CPPFLAGS $withval"
323 fi
324 ]
325)
Tim Rice648f8762011-01-26 12:38:57 -0800326AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700327 [ --with-ldflags Specify additional flags to pass to linker],
328 [
329 if test -n "$withval" && test "x$withval" != "xno" && \
330 test "x${withval}" != "xyes"; then
331 LDFLAGS="$LDFLAGS $withval"
332 fi
333 ]
334)
Damien Millerde35c382017-09-08 12:38:31 +1000335AC_ARG_WITH([ldflags-after],
336 [ --with-ldflags-after Specify additional flags to pass to linker after configure],
337 [
338 if test -n "$withval" && test "x$withval" != "xno" && \
339 test "x${withval}" != "xyes"; then
340 LDFLAGS_AFTER="$withval"
341 fi
342 ]
343)
Tim Rice648f8762011-01-26 12:38:57 -0800344AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700345 [ --with-libs Specify additional libraries to link with],
346 [
347 if test -n "$withval" && test "x$withval" != "xno" && \
348 test "x${withval}" != "xyes"; then
349 LIBS="$LIBS $withval"
350 fi
351 ]
352)
Tim Rice648f8762011-01-26 12:38:57 -0800353AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700354 [ --with-Werror Build main code with -Werror],
355 [
356 if test -n "$withval" && test "x$withval" != "xno"; then
357 werror_flags="-Werror"
358 if test "x${withval}" != "xyes"; then
359 werror_flags="$withval"
360 fi
361 fi
362 ]
363)
364
Tim Rice648f8762011-01-26 12:38:57 -0800365AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100366 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700367 bstring.h \
368 crypt.h \
369 crypto/sha2.h \
370 dirent.h \
371 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100372 elf.h \
Darren Tucker6310ef22016-07-13 14:42:35 +1000373 err.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700374 features.h \
375 fcntl.h \
376 floatingpoint.h \
377 getopt.h \
378 glob.h \
379 ia.h \
380 iaf.h \
Darren Tuckerb59162d2018-02-23 15:20:42 +1100381 ifaddrs.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100382 inttypes.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000383 langinfo.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700384 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000385 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700386 login.h \
387 maillock.h \
388 ndir.h \
389 net/if_tun.h \
390 netdb.h \
391 netgroup.h \
392 pam/pam_appl.h \
393 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000394 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700395 pty.h \
396 readpassphrase.h \
397 rpc/types.h \
398 security/pam_appl.h \
399 sha2.h \
400 shadow.h \
401 stddef.h \
402 stdint.h \
403 string.h \
404 strings.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700405 sys/bitypes.h \
406 sys/bsdtty.h \
407 sys/cdefs.h \
408 sys/dir.h \
Damien Millerf8854742018-02-26 12:18:14 +1100409 sys/file.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700410 sys/mman.h \
Darren Tuckerce066f62018-02-22 20:45:09 +1100411 sys/label.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700412 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000413 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700414 sys/prctl.h \
415 sys/pstat.h \
Darren Tucker5ee3fb52016-11-01 08:12:33 +1100416 sys/ptrace.h \
Damien Millerafa6e792018-04-13 13:31:42 +1000417 sys/random.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700418 sys/select.h \
419 sys/stat.h \
420 sys/stream.h \
421 sys/stropts.h \
422 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000423 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700424 sys/sysmacros.h \
425 sys/time.h \
426 sys/timers.h \
Darren Tucker11057562018-02-25 11:22:57 +1100427 sys/vfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700428 time.h \
429 tmpdir.h \
430 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700431 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700432 unistd.h \
433 usersec.h \
434 util.h \
435 utime.h \
436 utmp.h \
437 utmpx.h \
438 vis.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000439 wchar.h \
Tim Rice648f8762011-01-26 12:38:57 -0800440])
Tim Rice1cfab232006-10-03 09:34:35 -0700441
Darren Tuckerce066f62018-02-22 20:45:09 +1100442# On some platforms (eg SunOS4) sys/audit.h requires sys/[time|types|label.h]
443# to be included first.
444AC_CHECK_HEADERS([sys/audit.h], [], [], [
445#ifdef HAVE_SYS_TIME_H
446# include <sys/time.h>
447#endif
448#ifdef HAVE_SYS_TYPES_H
449# include <sys/types.h>
450#endif
451#ifdef HAVE_SYS_LABEL_H
452# include <sys/label.h>
453#endif
454])
455
Darren Tuckerdd9d9b32017-08-28 16:48:27 +1000456# sys/capsicum.h requires sys/types.h
457AC_CHECK_HEADERS([sys/capsicum.h], [], [], [
458#ifdef HAVE_SYS_TYPES_H
459# include <sys/types.h>
460#endif
461])
462
Darren Tuckerfa1b8342017-11-03 14:09:45 +1100463# net/route.h requires sys/socket.h and sys/types.h.
464# sys/sysctl.h also requires sys/param.h
465AC_CHECK_HEADERS([net/route.h sys/sysctl.h], [], [], [
466#ifdef HAVE_SYS_TYPES_H
467# include <sys/types.h>
468#endif
469#include <sys/param.h>
Damien Miller32354732017-10-25 11:25:43 +1100470#include <sys/socket.h>
471])
472
Tim Rice1cfab232006-10-03 09:34:35 -0700473# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800474AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700475#ifdef HAVE_SYS_TIME_H
476# include <sys/time.h>
477#endif
478])
479
480# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800481AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700482#ifdef HAVE_SYS_STREAM_H
483# include <sys/stream.h>
484#endif
485])
486
487# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800488AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700489#include <sys/types.h>
490])
491
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000492# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800493AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000494#include <sys/param.h>
495])
496
Darren Tuckeref4901c2013-06-03 01:59:13 +1000497# Android requires sys/socket.h to be included before sys/un.h
498AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000499#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000500#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000501])
502
Damien Miller1b06dc32006-08-31 03:24:41 +1000503# Messages for features tested for in target-specific section
504SIA_MSG="no"
505SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100506SP_MSG="no"
Damien Miller4626cba2016-01-08 14:24:56 +1100507SPP_MSG="no"
508
509# Support for Solaris/Illumos privileges (this test is used by both
510# the --with-solaris-privs option and --with-sandbox=solaris).
511SOLARIS_PRIVS="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000512
Damien Millera22ba012000-03-02 23:09:20 +1100513# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100514case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100515*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000516 # Some versions of VAC won't allow macro redefinitions at
517 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
518 # particularly with older versions of vac or xlc.
Damien Miller10479cc2018-04-10 10:19:02 +1000519 # It also throws errors about null macro arguments, but these are
Darren Tucker9216c372006-09-18 23:17:40 +1000520 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800521 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000522 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800523 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000524#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800525#define testmacro bar]],
526 [[ exit(0); ]])],
527 [ AC_MSG_RESULT([yes]) ],
528 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000529 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
Darren Tucker9216c372006-09-18 23:17:40 +1000530 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
531 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
532 ]
533 )
534
Damien Millera8e06ce2003-11-21 23:48:55 +1100535 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000536 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800537 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100538 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000539 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000540 if test "$GCC" = "yes"; then
541 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
542 else
543 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
544 fi
545 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000546 if (test -z "$blibflags"); then
547 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800548 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
549 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000550 fi
551 done
552 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800553 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000554 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
555 else
Tim Rice648f8762011-01-26 12:38:57 -0800556 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000557 fi
558 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000559 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800560 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700561 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800562 [AC_CHECK_LIB([s], [authenticate],
563 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700564 LIBS="$LIBS -ls"
565 ])
566 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100567 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100568 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100569 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000570 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800571 AC_CHECK_DECLS([loginfailed],
572 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
574 [[ (void)loginfailed("user","host","tty",0); ]])],
575 [AC_MSG_RESULT([yes])
576 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
577 [Define if your AIX loginfailed() function
578 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
579 ])],
580 [],
581 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000582 )
Tim Rice648f8762011-01-26 12:38:57 -0800583 AC_CHECK_FUNCS([getgrset setauthdb])
584 AC_CHECK_DECL([F_CLOSEM],
585 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000586 [],
587 [ #include <limits.h>
588 #include <fcntl.h> ]
589 )
Darren Tucker691d5232005-02-15 21:45:57 +1100590 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800591 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
592 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700593 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800594 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
595 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000596 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800597 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
598 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700599 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800600 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700601 [Define to a Set Process Title type if your system is
602 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800603 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100604 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800605 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100606 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Darren Tucker2c71ca12018-03-30 18:23:07 +1100607 AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211])
608 AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551])
Damien Miller75b1d102000-01-07 14:01:41 +1100609 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000610*-*-android*)
611 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
612 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
613 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100614*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100615 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100616 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800617 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
618 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
Damien Miller4626cba2016-01-08 14:24:56 +1100619 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
620 [Define to disable UID restoration test])
Tim Rice648f8762011-01-26 12:38:57 -0800621 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700622 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800623 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700624 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800625 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700626 [Define if your platform needs to skip post auth
627 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800628 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100629 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
630 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
631 # reasons which cause compile warnings, so we disable those warnings.
632 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100633 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000634*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800635 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700636 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800637 AC_DEFINE([SETEUID_BREAKS_SETUID])
638 AC_DEFINE([BROKEN_SETREUID])
639 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000640 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000641*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100642 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800643 AC_MSG_CHECKING([if we have working getaddrinfo])
644 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000645main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
646 exit(0);
647 else
648 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800649}
650 ]])],
651 [AC_MSG_RESULT([working])],
652 [AC_MSG_RESULT([buggy])
653 AC_DEFINE([BROKEN_GETADDRINFO], [1],
654 [getaddrinfo is broken (if present)])
655 ],
656 [AC_MSG_RESULT([assume it is working])])
657 AC_DEFINE([SETEUID_BREAKS_SETUID])
658 AC_DEFINE([BROKEN_SETREUID])
659 AC_DEFINE([BROKEN_SETREGID])
660 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
661 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700662 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800663 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
664 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000665 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800666 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000667 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800668 m4_pattern_allow([AU_IPv])
Tim Ricee1d93702016-05-31 11:13:22 -0700669 AC_CHECK_DECL([AU_IPv4], [],
Tim Rice648f8762011-01-26 12:38:57 -0800670 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100671 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800672 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100673 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100674 )
Damien Millerc09182f2011-06-03 12:11:38 +1000675 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
676 [Define to a Set Process Title type if your system is
677 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000678 AC_CHECK_FUNCS([sandbox_init])
679 AC_CHECK_HEADERS([sandbox.h])
Damien Miller39f303b2016-02-23 12:56:59 +1100680 AC_CHECK_LIB([sandbox], [sandbox_apply], [
681 SSHDLIBS="$SSHDLIBS -lsandbox"
682 ])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000683 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000684*-*-dragonfly*)
685 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100686 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000687 ;;
Tim Ricee1d93702016-05-31 11:13:22 -0700688*-*-haiku*)
Darren Tucker5faa52d2016-08-02 15:22:40 +1000689 LIBS="$LIBS -lbsd "
690 AC_CHECK_LIB([network], [socket])
691 AC_DEFINE([HAVE_U_INT64_T])
692 MANTYPE=man
693 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000694*-*-hpux*)
695 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000696 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100697 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800698 AC_DEFINE([USE_PIPES])
Tim Rice648f8762011-01-26 12:38:57 -0800699 AC_DEFINE([LOGIN_NEEDS_UTMPX])
700 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700701 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800702 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100703 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700704 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700705 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800706 AC_CHECK_LIB([xnet], [t_error], ,
707 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000708
709 # next, we define all of the options specific to major releases
710 case "$host" in
711 *-*-hpux10*)
712 if test -z "$GCC"; then
713 CFLAGS="$CFLAGS -Ae"
714 fi
715 ;;
716 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700718 [Define if you are using Solaris-derived PAM which
719 passes pam_messages to the conversation function
720 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800721 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700722 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800723 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000724 check_for_hpux_broken_getaddrinfo=1
725 check_for_conflicting_getspnam=1
726 ;;
727 esac
728
729 # lastly, we define options specific to minor releases
730 case "$host" in
731 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800732 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700733 [Define if you have SecureWare-based
734 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000735 disable_ptmx_check=yes
736 LIBS="$LIBS -lsecpw"
737 ;;
738 esac
Damien Miller1bead332000-04-30 00:47:29 +1000739 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100740*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100741 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800742 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700743 [Define if you system's inet_ntoa is busted
744 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800745 AC_DEFINE([SETEUID_BREAKS_SETUID])
746 AC_DEFINE([BROKEN_SETREUID])
747 AC_DEFINE([BROKEN_SETREGID])
748 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700749 [Define if you shouldn't strip 'tty' from your
750 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800751 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100752 ;;
753*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100754 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800755 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700756 [Define if you have/want arrays
Damien Miller10479cc2018-04-10 10:19:02 +1000757 (cluster-wide session management, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800758 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700759 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800760 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700761 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800762 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700763 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_DEFINE([BROKEN_INET_NTOA])
765 AC_DEFINE([SETEUID_BREAKS_SETUID])
766 AC_DEFINE([BROKEN_SETREUID])
767 AC_DEFINE([BROKEN_SETREGID])
768 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
769 AC_DEFINE([WITH_ABBREV_NO_TTY])
770 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100771 ;;
Damien Miller90551722009-02-16 15:37:03 +1100772*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
773 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800774 AC_DEFINE([PAM_TTY_KLUDGE])
775 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
776 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
777 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
778 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100779 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100780*-*-linux*)
781 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100782 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100783 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000784 check_for_openpty_ctty_bug=1
Darren Tuckerc61d5ec2017-02-03 14:10:34 +1100785 dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
786 dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
787 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800788 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700789 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800790 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700791 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800792 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
793 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700794 [Define to whatever link() returns for "not supported"
795 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800796 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
797 AC_DEFINE([USE_BTMP])
798 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100799 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000800 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000801 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800802 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700803 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000804 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000805 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100806 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800807 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100808 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800809 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100810 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800811 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100812 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800813 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100814 [Prepend the address family to IP tunnel traffic])
815 fi
Darren Tucker81c9ccd2017-11-03 14:52:51 +1100816 AC_CHECK_HEADER([linux/if.h],
817 AC_DEFINE([SYS_RDOMAIN_LINUX], [1],
Darren Tucker24d2a332018-02-11 21:20:39 +1300818 [Support routing domains using Linux VRF]), [], [
819#ifdef HAVE_SYS_TYPES_H
820# include <sys/types.H>
821#endif
822 ])
Darren Tucker60395f92012-07-03 14:31:18 +1000823 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
824 [], [#include <linux/types.h>])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100825 # Obtain MIPS ABI
826 case "$host" in
827 mips*)
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100828 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100829#if _MIPS_SIM != _ABIO32
830#error
831#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100832 ]])],[mips_abi="o32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100833#if _MIPS_SIM != _ABIN32
834#error
835#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100836 ]])],[mips_abi="n32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100837#if _MIPS_SIM != _ABI64
838#error
839#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100840 ]])],[mips_abi="n64"],[AC_MSG_ERROR([unknown MIPS ABI])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100841 ])
842 ])
843 ])
844 ;;
845 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100846 AC_MSG_CHECKING([for seccomp architecture])
847 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000848 case "$host" in
849 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100850 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000851 ;;
852 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100853 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000854 ;;
Damien Miller99f33d72015-06-17 10:50:51 +1000855 arm*-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100856 seccomp_audit_arch=AUDIT_ARCH_ARM
Damien Miller99f33d72015-06-17 10:50:51 +1000857 ;;
858 aarch64*-*)
859 seccomp_audit_arch=AUDIT_ARCH_AARCH64
Damien Miller5c15e222015-06-18 15:07:56 +1000860 ;;
Damien Millerb9c50612016-07-08 13:59:13 +1000861 s390x-*)
862 seccomp_audit_arch=AUDIT_ARCH_S390X
863 ;;
864 s390-*)
865 seccomp_audit_arch=AUDIT_ARCH_S390
866 ;;
867 powerpc64-*)
868 seccomp_audit_arch=AUDIT_ARCH_PPC64
869 ;;
870 powerpc64le-*)
871 seccomp_audit_arch=AUDIT_ARCH_PPC64LE
872 ;;
873 mips-*)
874 seccomp_audit_arch=AUDIT_ARCH_MIPS
875 ;;
876 mipsel-*)
877 seccomp_audit_arch=AUDIT_ARCH_MIPSEL
878 ;;
879 mips64-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100880 case "$mips_abi" in
881 "n32")
882 seccomp_audit_arch=AUDIT_ARCH_MIPS64N32
883 ;;
884 "n64")
885 seccomp_audit_arch=AUDIT_ARCH_MIPS64
886 ;;
887 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000888 ;;
889 mips64el-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100890 case "$mips_abi" in
891 "n32")
892 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64N32
893 ;;
894 "n64")
895 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
896 ;;
897 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000898 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000899 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100900 if test "x$seccomp_audit_arch" != "x" ; then
901 AC_MSG_RESULT(["$seccomp_audit_arch"])
Damien Miller99f33d72015-06-17 10:50:51 +1000902 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
903 [Specify the system call convention in use])
Damien Miller91f40d82013-02-22 11:37:00 +1100904 else
905 AC_MSG_RESULT([architecture not supported])
906 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100907 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000908mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800909 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000910 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000911 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100912*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000913 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800914 if test "x$withval" != "xno" ; then
Darren Tucker2f0bad22019-01-21 21:28:27 +1100915 rpath_opt="-R"
Tim Rice88368a32003-12-08 12:35:59 -0800916 fi
Damien Miller99522ba2016-07-28 08:54:27 +1000917 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800918 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100919 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800920 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
921 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100922 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100923 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerf5bbd3b2014-01-30 11:26:46 +1100924 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
925 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
Damien Milleree1c0b32000-01-21 00:18:15 +1100926 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100927*-*-freebsd*)
928 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800929 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
930 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100931 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800932 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
933 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100934 TEST_MALLOC_OPTIONS="AJRX"
Damien Miller2035b222014-01-26 09:39:53 +1100935 # Preauth crypto occasionally uses file descriptors for crypto offload
936 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100937 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
Tim Rice03ae0812014-02-21 09:09:34 -0800938 [define if setrlimit RLIMIT_NOFILE breaks things])
Damien Millerfbd884a2001-02-27 08:39:07 +1100939 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000940*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800941 AC_DEFINE([SETEUID_BREAKS_SETUID])
942 AC_DEFINE([BROKEN_SETREUID])
943 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000944 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000945*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000946 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100947 conf_utmp_location=/etc/utmp
948 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700949 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800950 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
951 AC_DEFINE([BROKEN_REALPATH])
952 AC_DEFINE([USE_PIPES])
953 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000954 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000955*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100956 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800957 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
958 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
959 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
960 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000961 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100962 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000963 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100964*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800965 if test "x$withval" != "xno" ; then
Darren Tucker2f0bad22019-01-21 21:28:27 +1100966 rpath_opt="-R"
Tim Ricead4a1882004-02-29 15:53:37 -0800967 fi
Tim Rice648f8762011-01-26 12:38:57 -0800968 AC_DEFINE([PAM_SUN_CODEBASE])
969 AC_DEFINE([LOGIN_NEEDS_UTMPX])
Tim Rice648f8762011-01-26 12:38:57 -0800970 AC_DEFINE([PAM_TTY_KLUDGE])
971 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700972 [Define if pam_chauthtok wants real uid set
973 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800974 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000975 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800976 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700977 [Define if sshd somehow reacquires a controlling TTY
978 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800979 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000980 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800981 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000982 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000983 # hardwire lastlog location (can't detect it on some versions)
984 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800985 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000986 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
987 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800988 AC_MSG_RESULT([yes])
989 AC_DEFINE([DISABLE_UTMP])
990 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700991 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000992 else
Tim Rice648f8762011-01-26 12:38:57 -0800993 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000994 fi
Darren Tuckera86ec4d2016-06-14 10:48:27 +1000995 AC_CHECK_FUNCS([setpflags])
Darren Tucker907091a2016-02-19 09:05:39 +1100996 AC_CHECK_FUNCS([setppriv])
997 AC_CHECK_FUNCS([priv_basicset])
998 AC_CHECK_HEADERS([priv.h])
Tim Rice648f8762011-01-26 12:38:57 -0800999 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +10001000 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
1001 [
Tim Rice648f8762011-01-26 12:38:57 -08001002 AC_CHECK_LIB([contract], [ct_tmpl_activate],
1003 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +10001004 [Define if you have Solaris process contracts])
Damien Miller4626cba2016-01-08 14:24:56 +11001005 LIBS="$LIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +10001006 SPC_MSG="yes" ], )
1007 ],
1008 )
Tim Rice648f8762011-01-26 12:38:57 -08001009 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +11001010 [ --with-solaris-projects Enable Solaris projects (experimental)],
1011 [
Tim Rice648f8762011-01-26 12:38:57 -08001012 AC_CHECK_LIB([project], [setproject],
1013 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +11001014 [Define if you have Solaris projects])
Damien Miller4626cba2016-01-08 14:24:56 +11001015 LIBS="$LIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +11001016 SP_MSG="yes" ], )
1017 ],
1018 )
Damien Miller4626cba2016-01-08 14:24:56 +11001019 AC_ARG_WITH([solaris-privs],
1020 [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)],
1021 [
1022 AC_MSG_CHECKING([for Solaris/Illumos privilege support])
Darren Tucker907091a2016-02-19 09:05:39 +11001023 if test "x$ac_cv_func_setppriv" = "xyes" -a \
1024 "x$ac_cv_header_priv_h" = "xyes" ; then
1025 SOLARIS_PRIVS=yes
Damien Miller4626cba2016-01-08 14:24:56 +11001026 AC_MSG_RESULT([found])
1027 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
1028 [Define to disable UID restoration test])
1029 AC_DEFINE([USE_SOLARIS_PRIVS], [1],
1030 [Define if you have Solaris privileges])
1031 SPP_MSG="yes"
1032 else
1033 AC_MSG_RESULT([not found])
1034 AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs])
1035 fi
1036 ],
1037 )
Tim Rice5ab9b632013-06-02 14:05:48 -07001038 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +11001039 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +10001040*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001041 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -08001042 AC_CHECK_FUNCS([getpwanam])
1043 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +10001044 conf_utmp_location=/etc/utmp
1045 conf_wtmp_location=/var/adm/wtmp
1046 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -08001047 AC_DEFINE([USE_PIPES])
Darren Tuckerc0a0c3f2018-03-05 20:03:07 +11001048 AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx])
Damien Millerdfc83f42000-05-20 15:02:59 +10001049 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001050*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -07001051 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -08001052 AC_DEFINE([USE_PIPES])
1053 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1054 AC_DEFINE([SETEUID_BREAKS_SETUID])
1055 AC_DEFINE([BROKEN_SETREUID])
1056 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001057 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +10001058*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -07001059 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -08001060 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +11001061 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -08001062 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +11001063 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -08001064 AC_DEFINE([USE_PIPES])
1065 AC_DEFINE([IP_TOS_IS_BROKEN])
1066 AC_DEFINE([SETEUID_BREAKS_SETUID])
1067 AC_DEFINE([BROKEN_SETREUID])
1068 AC_DEFINE([BROKEN_SETREGID])
1069 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +10001070 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -07001071 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
1072 # Attention: always take care to bind libsocket and libnsl before libc,
1073 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +10001074 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001075# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +11001076*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -08001077 AC_DEFINE([USE_PIPES])
1078 AC_DEFINE([SETEUID_BREAKS_SETUID])
1079 AC_DEFINE([BROKEN_SETREUID])
1080 AC_DEFINE([BROKEN_SETREGID])
1081 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
1082 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -07001083 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +11001084 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001085# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +11001086*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -08001087 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -08001088 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
1089 AC_DEFINE([USE_PIPES])
1090 AC_DEFINE([SETEUID_BREAKS_SETUID])
1091 AC_DEFINE([BROKEN_GETADDRINFO])
1092 AC_DEFINE([BROKEN_SETREUID])
1093 AC_DEFINE([BROKEN_SETREGID])
1094 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice8433d512017-07-11 18:47:56 -07001095 AC_DEFINE([BROKEN_TCGETATTR_ICANON])
Tim Rice5ab9b632013-06-02 14:05:48 -07001096 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4afeaf32018-03-25 10:00:21 -07001097 check_for_libcrypt_later=1
Tim Rice4dbacff2005-06-01 20:09:28 -07001098 case "$host" in
1099 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -07001100 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -08001101 AC_DEFINE([BROKEN_UPDWTMPX])
1102 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
1103 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
Tim Rice648f8762011-01-26 12:38:57 -08001104 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -07001105 ;;
Tim Rice648f8762011-01-26 12:38:57 -08001106 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice46259d82005-11-28 18:40:34 -08001107 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -07001108 esac
Damien Miller78315eb2000-09-29 23:01:36 +11001109 ;;
Damien Miller75b1d102000-01-07 14:01:41 +11001110*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +11001111 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001112# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +11001113*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -08001114 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +11001115 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001116# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +11001117*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -08001118 if test -z "$GCC"; then
1119 CFLAGS="$CFLAGS -belf"
1120 fi
Damien Miller5dfe9762001-02-16 12:05:39 +11001121 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +10001122 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -08001123 AC_DEFINE([USE_PIPES])
1124 AC_DEFINE([HAVE_SECUREWARE])
1125 AC_DEFINE([DISABLE_SHADOW])
1126 AC_DEFINE([DISABLE_FD_PASSING])
1127 AC_DEFINE([SETEUID_BREAKS_SETUID])
1128 AC_DEFINE([BROKEN_GETADDRINFO])
1129 AC_DEFINE([BROKEN_SETREUID])
1130 AC_DEFINE([BROKEN_SETREGID])
1131 AC_DEFINE([WITH_ABBREV_NO_TTY])
1132 AC_DEFINE([BROKEN_UPDWTMPX])
1133 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1134 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -07001135 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -07001136 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -07001137 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +10001138 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001139*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001140 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001141 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001142 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001143 [ --with-osfsia Enable Digital Unix SIA],
1144 [
1145 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001146 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001147 no_osfsia=1
1148 fi
1149 ],
1150 )
1151 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001152 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001153 AC_MSG_RESULT([yes])
1154 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001155 [Define if you have Digital Unix Security
1156 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001157 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001158 [Define if you don't want to use your
1159 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001160 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001161 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001162 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001163 else
Tim Rice648f8762011-01-26 12:38:57 -08001164 AC_MSG_RESULT([no])
1165 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001166 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001167 fi
1168 fi
Tim Rice648f8762011-01-26 12:38:57 -08001169 AC_DEFINE([BROKEN_GETADDRINFO])
1170 AC_DEFINE([SETEUID_BREAKS_SETUID])
1171 AC_DEFINE([BROKEN_SETREUID])
1172 AC_DEFINE([BROKEN_SETREGID])
1173 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001174 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001175
Tim Rice70335a62006-02-04 17:42:58 -08001176*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001177 AC_DEFINE([USE_PIPES])
1178 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001179 AC_DEFINE([DISABLE_LASTLOG])
1180 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1181 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001182 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001183 case "$host" in
1184 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001185 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001186 ;;
1187 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001188 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001189
1190*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001191 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
Tim Rice648f8762011-01-26 12:38:57 -08001192 AC_DEFINE([NEED_SETPGRP])
1193 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001194 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001195
1196*-*-lynxos)
Darren Tucker5faa52d2016-08-02 15:22:40 +10001197 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
1198 AC_DEFINE([BROKEN_SETVBUF], [1],
1199 [LynxOS has broken setvbuf() implementation])
1200 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001201esac
1202
Tim Rice648f8762011-01-26 12:38:57 -08001203AC_MSG_CHECKING([compiler and flags for sanity])
1204AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1205 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001206 [
Tim Rice648f8762011-01-26 12:38:57 -08001207 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001208 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001209 ],
1210 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001211)
1212
Darren Tucker0c9653f2005-05-28 15:58:14 +10001213dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001214# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001215AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001216
Tim Rice1e1ef642003-09-11 22:19:31 -07001217dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001218AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1219 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001220 AC_CACHE_CHECK([for broken dirname],
1221 ac_cv_have_broken_dirname, [
1222 save_LIBS="$LIBS"
1223 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001224 AC_RUN_IFELSE(
1225 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001226#include <libgen.h>
1227#include <string.h>
1228
1229int main(int argc, char **argv) {
1230 char *s, buf[32];
1231
1232 strncpy(buf,"/etc", 32);
1233 s = dirname(buf);
1234 if (!s || strncmp(s, "/", 32) != 0) {
1235 exit(1);
1236 } else {
1237 exit(0);
1238 }
1239}
Darren Tucker314d89e2005-10-17 23:29:23 +10001240 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001241 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001242 [ ac_cv_have_broken_dirname="yes" ],
1243 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001244 )
1245 LIBS="$save_LIBS"
1246 ])
1247 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1248 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001249 AC_DEFINE([HAVE_DIRNAME])
1250 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001251 fi
1252 ])
1253])
1254
Tim Rice648f8762011-01-26 12:38:57 -08001255AC_CHECK_FUNC([getspnam], ,
1256 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1257AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1258 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001259
Tim Rice13aae5e2001-10-21 17:53:58 -07001260dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001261AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001262 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001263 [ if test "x$withval" = "xno" ; then
1264 AC_MSG_ERROR([*** zlib is required ***])
1265 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001266 if test -d "$withval/lib"; then
Darren Tucker2f0bad22019-01-21 21:28:27 +11001267 if test -n "${rpath_opt}"; then
1268 LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001269 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001270 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001271 fi
1272 else
Darren Tucker2f0bad22019-01-21 21:28:27 +11001273 if test -n "${rpath_opt}"; then
1274 LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001275 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001276 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001277 fi
1278 fi
1279 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001280 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001281 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001282 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001283 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001284 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001285)
1286
Tim Rice648f8762011-01-26 12:38:57 -08001287AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1288AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001289 [
1290 saved_CPPFLAGS="$CPPFLAGS"
1291 saved_LDFLAGS="$LDFLAGS"
1292 save_LIBS="$LIBS"
1293 dnl Check default zlib install dir
Darren Tucker2f0bad22019-01-21 21:28:27 +11001294 if test -n "${rpath_opt}"; then
1295 LDFLAGS="-L/usr/local/lib ${rpath_opt}/usr/local/lib ${saved_LDFLAGS}"
Tim Ricefcb62202004-01-23 18:35:16 -08001296 else
1297 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1298 fi
1299 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1300 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001301 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001302 [
1303 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1304 ]
1305 )
1306 ]
1307)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001308
Tim Rice648f8762011-01-26 12:38:57 -08001309AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001310 [ --without-zlib-version-check Disable zlib version check],
1311 [ if test "x$withval" = "xno" ; then
1312 zlib_check_nonfatal=1
1313 fi
1314 ]
1315)
1316
Tim Rice648f8762011-01-26 12:38:57 -08001317AC_MSG_CHECKING([for possibly buggy zlib])
1318AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001319#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001320#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001321#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001322 ]],
1323 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001324 int a=0, b=0, c=0, d=0, n, v;
1325 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1326 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001327 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001328 v = a*1000000 + b*10000 + c*100 + d;
1329 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1330
1331 /* 1.1.4 is OK */
1332 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001333 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001334
Darren Tucker41097ed2005-07-25 15:24:21 +10001335 /* 1.2.3 and up are OK */
1336 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001337 exit(0);
1338
Darren Tucker2dcd2392004-01-23 17:13:33 +11001339 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001340 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001341 AC_MSG_RESULT([no]),
1342 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001343 if test -z "$zlib_check_nonfatal" ; then
1344 AC_MSG_ERROR([*** zlib too old - check config.log ***
1345Your reported zlib version has known security problems. It's possible your
1346vendor has fixed these problems without changing the version number. If you
1347are sure this is the case, you can disable the check by running
1348"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001349If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001350See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001351 else
1352 AC_MSG_WARN([zlib version may have security problems])
1353 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001354 ],
1355 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001356)
Damien Miller6f9c3372000-10-25 10:06:04 +11001357
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001358dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001359AC_CHECK_FUNC([strcasecmp],
1360 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001361)
Tim Rice648f8762011-01-26 12:38:57 -08001362AC_CHECK_FUNCS([utimes],
1363 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001364 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001365)
Damien Millerab18c411999-11-11 10:40:23 +11001366
Tim Ricee589a292001-11-03 11:09:32 -08001367dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001368AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001369AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001370AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001371AC_SEARCH_LIBS([login], [util bsd])
1372AC_SEARCH_LIBS([logout], [util bsd])
1373AC_SEARCH_LIBS([logwtmp], [util bsd])
1374AC_SEARCH_LIBS([openpty], [util bsd])
1375AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001376AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001377
Darren Tucker2fee9092016-02-17 09:48:15 +11001378# On some platforms, inet_ntop and gethostbyname may be found in libresolv
1379# or libnsl.
Damien Millerab039492014-01-28 15:07:10 +11001380AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
Darren Tucker2fee9092016-02-17 09:48:15 +11001381AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
Damien Millerab039492014-01-28 15:07:10 +11001382
Darren Tucker74c1c362017-09-27 07:44:41 +10001383# "Particular Function Checks"
1384# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html
Ben Lindstrom8697e082001-02-24 21:41:10 +00001385AC_FUNC_STRFTIME
Darren Tucker74c1c362017-09-27 07:44:41 +10001386AC_FUNC_MALLOC
1387AC_FUNC_REALLOC
1388# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL;
Darren Tuckere9dede02018-02-25 10:20:31 +11001389AC_MSG_CHECKING([if calloc(0, N) returns non-null])
1390AC_RUN_IFELSE(
1391 [AC_LANG_PROGRAM(
1392 [[ #include <stdlib.h> ]],
1393 [[ void *p = calloc(0, 1); exit(p == NULL); ]]
1394 )],
1395 [ func_calloc_0_nonnull=yes ],
1396 [ func_calloc_0_nonnull=no ],
1397 [ AC_MSG_WARN([cross compiling: assuming same as malloc])
1398 func_calloc_0_nonnull="$ac_cv_func_malloc_0_nonnull"]
1399)
1400AC_MSG_RESULT([$func_calloc_0_nonnull])
1401
Darren Tuckerd97874c2018-04-13 13:43:55 +10001402if test "x$func_calloc_0_nonnull" = "xyes"; then
Darren Tuckere9dede02018-02-25 10:20:31 +11001403 AC_DEFINE(HAVE_CALLOC, 1, [calloc(0, x) returns non-null])
1404else
1405 AC_DEFINE(HAVE_CALLOC, 0, [calloc(0, x) returns NULL])
Darren Tucker74c1c362017-09-27 07:44:41 +10001406 AC_DEFINE(calloc, rpl_calloc,
1407 [Define to rpl_calloc if the replacement function should be used.])
1408fi
Ben Lindstrom8697e082001-02-24 21:41:10 +00001409
Damien Miller3c027682001-03-14 11:39:45 +11001410# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001411AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1412AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001413 [
1414 #include <glob.h>
1415 #ifdef GLOB_ALTDIRFUNC
1416 FOUNDIT
1417 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001418 ],
Damien Miller3c027682001-03-14 11:39:45 +11001419 [
Tim Rice648f8762011-01-26 12:38:57 -08001420 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001421 [Define if your system glob() function has
1422 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001423 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001424 ],
1425 [
Tim Rice648f8762011-01-26 12:38:57 -08001426 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001427 ]
1428)
Damien Millerab18c411999-11-11 10:40:23 +11001429
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001430# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001431AC_MSG_CHECKING([for gl_matchc field in glob_t])
1432AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1433 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001434 [
Tim Rice648f8762011-01-26 12:38:57 -08001435 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001436 [Define if your system glob() function has
1437 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001438 AC_MSG_RESULT([yes])
1439 ], [
1440 AC_MSG_RESULT([no])
1441])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001442
Damien Millera6e121a2010-10-07 21:39:17 +11001443# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001444AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1445AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001446#ifndef GLOB_KEEPSTAT
1447#error "glob does not support GLOB_KEEPSTAT extension"
1448#endif
1449glob_t g;
1450g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001451]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001452 [
Tim Rice648f8762011-01-26 12:38:57 -08001453 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001454 [Define if your system glob() function has
1455 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001456 AC_MSG_RESULT([yes])
1457 ], [
1458 AC_MSG_RESULT([no])
Damien Miller72ef7c12015-01-15 02:21:31 +11001459
Tim Rice648f8762011-01-26 12:38:57 -08001460])
Damien Millera6e121a2010-10-07 21:39:17 +11001461
Tim Rice648f8762011-01-26 12:38:57 -08001462AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001463
Darren Tucker7df91b02016-07-14 12:25:24 +10001464AC_CHECK_DECL([VIS_ALL], ,
1465 AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
1466
Damien Miller18bb4732001-03-28 14:35:30 +10001467AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001468AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001469 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001470#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001471#include <dirent.h>]],
1472 [[
1473 struct dirent d;
1474 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001475 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001476 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001477 [
Tim Rice648f8762011-01-26 12:38:57 -08001478 AC_MSG_RESULT([no])
1479 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001480 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001481 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001482 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001483 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001484 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001485 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001486 ]
1487)
1488
Damien Miller36f49652004-08-15 18:40:59 +10001489AC_MSG_CHECKING([for /proc/pid/fd directory])
1490if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001491 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1492 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001493else
Tim Rice648f8762011-01-26 12:38:57 -08001494 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001495fi
1496
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001497# Check whether user wants to use ldns
1498LDNS_MSG="no"
1499AC_ARG_WITH(ldns,
1500 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
Damien Miller523db852017-02-03 16:01:22 +11001501 [
1502 ldns=""
1503 if test "x$withval" = "xyes" ; then
1504 AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no])
Darren Tuckerf001de82017-12-11 13:42:51 +11001505 if test "x$LDNSCONFIG" = "xno"; then
Damien Miller523db852017-02-03 16:01:22 +11001506 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1507 LDFLAGS="$LDFLAGS -L${withval}/lib"
1508 LIBS="-lldns $LIBS"
1509 ldns=yes
1510 else
1511 LIBS="$LIBS `$LDNSCONFIG --libs`"
1512 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`"
Darren Tucker7af27bf2017-03-24 09:44:56 +11001513 ldns=yes
Damien Miller523db852017-02-03 16:01:22 +11001514 fi
1515 elif test "x$withval" != "xno" ; then
1516 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1517 LDFLAGS="$LDFLAGS -L${withval}/lib"
1518 LIBS="-lldns $LIBS"
1519 ldns=yes
1520 fi
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001521
Damien Miller523db852017-02-03 16:01:22 +11001522 # Verify that it works.
1523 if test "x$ldns" = "xyes" ; then
1524 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1525 LDNS_MSG="yes"
1526 AC_MSG_CHECKING([for ldns support])
1527 AC_LINK_IFELSE(
1528 [AC_LANG_SOURCE([[
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001529#include <stdio.h>
1530#include <stdlib.h>
1531#include <stdint.h>
1532#include <ldns/ldns.h>
1533int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
Damien Miller523db852017-02-03 16:01:22 +11001534 ]])
1535 ],
1536 [AC_MSG_RESULT(yes)],
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001537 [
1538 AC_MSG_RESULT(no)
1539 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1540 ])
Damien Miller523db852017-02-03 16:01:22 +11001541 fi
1542])
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001543
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001544# Check whether user wants libedit support
1545LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001546AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001547 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001548 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001549 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001550 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001551 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001552 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Tim Ricee1d93702016-05-31 11:13:22 -07001553 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001554 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001555 use_pkgconfig_for_libedit=yes
1556 else
Tim Rice648f8762011-01-26 12:38:57 -08001557 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001558 fi
1559 fi
1560 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001561 CPPFLAGS="$CPPFLAGS -I${withval}/include"
Darren Tucker2f0bad22019-01-21 21:28:27 +11001562 if test -n "${rpath_opt}"; then
1563 LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}"
Darren Tuckerc373a562005-09-22 20:15:08 +10001564 else
1565 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1566 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001567 fi
Damien Miller1f789802010-10-11 22:35:22 +11001568 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001569 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001570 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1571 else
1572 LIBEDIT="-ledit -lcurses"
1573 fi
1574 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001575 AC_CHECK_LIB([edit], [el_init],
1576 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001577 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001578 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001579 ],
Tim Rice648f8762011-01-26 12:38:57 -08001580 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001581 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001582 )
Tim Rice648f8762011-01-26 12:38:57 -08001583 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001584 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001585 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1586 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001587 int i = H_SETSIZE;
1588 el_init("", NULL, NULL, NULL);
1589 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001590 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001591 [ AC_MSG_RESULT([yes]) ],
1592 [ AC_MSG_RESULT([no])
1593 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001594 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001595 fi ]
1596)
1597
Darren Tuckerd9f88912005-02-20 21:01:48 +11001598AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001599AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001600 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001601 [
Tim Rice648f8762011-01-26 12:38:57 -08001602 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001603 case "$withval" in
1604 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001605 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001606 AUDIT_MODULE=bsm
1607 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001608 AC_CHECK_HEADERS([bsm/audit.h], [],
1609 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001610 [
1611#ifdef HAVE_TIME_H
1612# include <time.h>
1613#endif
1614 ]
1615)
Tim Rice648f8762011-01-26 12:38:57 -08001616 AC_CHECK_LIB([bsm], [getaudit], [],
1617 [AC_MSG_ERROR([BSM enabled and required library not found])])
1618 AC_CHECK_FUNCS([getaudit], [],
1619 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001620 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001621 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1622 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001623 if test "$sol2ver" -ge 11; then
Tim Ricee1d93702016-05-31 11:13:22 -07001624 SSHDLIBS="$SSHDLIBS -lscf"
1625 AC_DEFINE([BROKEN_BSM_API], [1],
1626 [The system has incomplete BSM API])
Darren Tucker93a2d412012-02-24 10:40:41 +11001627 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001628 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001629 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001630 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001631 AUDIT_MODULE=linux
1632 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001633 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001634 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001635 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001636 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001637 debug)
1638 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001639 AC_MSG_RESULT([debug])
1640 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001641 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001642 no)
Tim Rice648f8762011-01-26 12:38:57 -08001643 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001644 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001645 *)
1646 AC_MSG_ERROR([Unknown audit module $withval])
1647 ;;
1648 esac ]
1649)
1650
Darren Tucker096118d2014-01-21 12:48:51 +11001651AC_ARG_WITH([pie],
Damien Miller76c04802015-01-13 19:38:18 +11001652 [ --with-pie Build Position Independent Executables if possible], [
Darren Tucker096118d2014-01-21 12:48:51 +11001653 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001654 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001655 fi
1656 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001657 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001658 fi
1659 ]
1660)
Damien Miller852472a2014-01-22 16:31:18 +11001661if test "x$use_pie" = "x"; then
1662 use_pie=no
1663fi
1664if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1665 # Turn off automatic PIE when toolchain hardening is off.
1666 use_pie=no
1667fi
Damien Millerc161fc92014-01-29 21:01:33 +11001668if test "x$use_pie" = "xauto"; then
Damien Miller852472a2014-01-22 16:31:18 +11001669 # Automatic PIE requires gcc >= 4.x
1670 AC_MSG_CHECKING([for gcc >= 4.x])
1671 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1672#if !defined(__GNUC__) || __GNUC__ < 4
1673#error gcc is too old
1674#endif
1675]])],
1676 [ AC_MSG_RESULT([yes]) ],
1677 [ AC_MSG_RESULT([no])
1678 use_pie=no ]
1679)
1680fi
1681if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001682 SAVED_CFLAGS="$CFLAGS"
1683 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001684 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1685 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001686 # We use both -fPIE and -pie or neither.
1687 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1688 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1689 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1690 AC_MSG_RESULT([yes])
1691 else
1692 AC_MSG_RESULT([no])
1693 CFLAGS="$SAVED_CFLAGS"
1694 LDFLAGS="$SAVED_LDFLAGS"
1695 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001696fi
1697
Damien Millerfe1f1432003-02-24 15:45:42 +11001698dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001699AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001700 Blowfish_initstate \
1701 Blowfish_expandstate \
1702 Blowfish_expand0state \
1703 Blowfish_stream2word \
Damien Miller57f39152005-11-24 19:58:19 +11001704 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001705 b64_ntop \
1706 __b64_ntop \
1707 b64_pton \
1708 __b64_pton \
1709 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001710 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001711 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001712 blf_enc \
Darren Tuckera9004422018-02-24 20:25:22 +11001713 bzero \
Damien Millerc96d8532014-01-25 13:12:28 +11001714 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001715 clock \
1716 closefrom \
1717 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001718 endgrent \
Darren Tucker6310ef22016-07-13 14:42:35 +10001719 err \
1720 errx \
Damien Miller1d2c4562014-02-04 11:18:20 +11001721 explicit_bzero \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001722 fchmod \
Darren Tuckera6258e52019-01-18 11:09:01 +11001723 fchmodat \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001724 fchown \
Darren Tuckera6258e52019-01-18 11:09:01 +11001725 fchownat \
Darren Tuckercd3ab572018-02-26 14:37:06 +11001726 flock \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001727 freeaddrinfo \
Damien Millerb7956912017-09-19 12:29:23 +10001728 freezero \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001729 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001730 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001731 futimes \
1732 getaddrinfo \
1733 getcwd \
1734 getgrouplist \
Darren Tucker6301e6c2018-07-02 21:16:58 +10001735 getline \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001736 getnameinfo \
1737 getopt \
Damien Miller151c6e42017-06-01 15:25:13 +10001738 getpagesize \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001739 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001740 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001741 getpgid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001742 _getpty \
1743 getrlimit \
Damien Millerafa6e792018-04-13 13:31:42 +10001744 getrandom \
Darren Tuckerb39593a2018-02-25 13:25:15 +11001745 getsid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001746 getttyent \
1747 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001748 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001749 inet_aton \
1750 inet_ntoa \
1751 inet_ntop \
1752 innetgr \
Darren Tuckerd38f05d2017-03-20 13:38:27 +11001753 llabs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001754 login_getcapbool \
1755 md5_crypt \
1756 memmove \
Damien Miller3d673d12014-08-27 06:32:01 +10001757 memset_s \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001758 mkdtemp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001759 ngetaddrinfo \
1760 nsleep \
1761 ogetaddrinfo \
1762 openlog_r \
Darren Tucker3ddd15e2015-11-30 07:23:53 +11001763 pledge \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001764 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001765 prctl \
1766 pstat \
Darren Tucker6c8c9a62018-02-24 20:46:37 +11001767 raise \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001768 readpassphrase \
Darren Tucker642652d2014-12-10 01:32:23 +11001769 reallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001770 recvmsg \
Damien Miller151c6e42017-06-01 15:25:13 +10001771 recallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001772 rresvport_af \
1773 sendmsg \
1774 setdtablesize \
1775 setegid \
1776 setenv \
1777 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001778 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001779 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001780 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001781 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001782 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001783 setpcred \
1784 setproctitle \
1785 setregid \
1786 setreuid \
1787 setrlimit \
1788 setsid \
1789 setvbuf \
1790 sigaction \
1791 sigvec \
1792 snprintf \
1793 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001794 statfs \
1795 statvfs \
Darren Tuckerafec0772016-12-13 10:23:03 +11001796 strcasestr \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001797 strdup \
1798 strerror \
1799 strlcat \
1800 strlcpy \
1801 strmode \
Darren Tucker33561e62018-03-03 14:56:09 +11001802 strndup \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001803 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001804 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001805 strptime \
Darren Tucker44fc3342017-09-25 09:48:10 +10001806 strsignal \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001807 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001808 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001809 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001810 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001811 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001812 sysconf \
1813 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001814 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001815 truncate \
1816 unsetenv \
1817 updwtmpx \
Darren Tucker091093d2019-01-18 12:11:42 +13001818 utimensat \
Darren Tucker909a3902010-01-15 12:38:30 +11001819 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001820 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001821 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001822 vsnprintf \
1823 waitpid \
Darren Tucker6310ef22016-07-13 14:42:35 +10001824 warn \
Tim Rice648f8762011-01-26 12:38:57 -08001825])
Tim Rice13aae5e2001-10-21 17:53:58 -07001826
Darren Tuckera9004422018-02-24 20:25:22 +11001827AC_CHECK_DECLS([bzero])
1828
Darren Tuckerc61d5ec2017-02-03 14:10:34 +11001829dnl Wide character support.
Darren Tuckera2333582016-07-14 10:59:09 +10001830AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth])
Darren Tuckera2333582016-07-14 10:59:09 +10001831
Darren Tucker10e290e2016-12-13 13:51:32 +11001832TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes}
Darren Tucker47b8c992016-12-08 15:48:34 +11001833AC_MSG_CHECKING([for utf8 locale support])
1834AC_RUN_IFELSE(
1835 [AC_LANG_PROGRAM([[
1836#include <locale.h>
Darren Tuckerc3599502016-12-09 12:52:02 +11001837#include <stdlib.h>
Darren Tucker47b8c992016-12-08 15:48:34 +11001838 ]], [[
1839 char *loc = setlocale(LC_CTYPE, "en_US.UTF-8");
1840 if (loc != NULL)
1841 exit(0);
1842 exit(1);
1843 ]])],
1844 AC_MSG_RESULT(yes),
1845 [AC_MSG_RESULT(no)
1846 TEST_SSH_UTF8=no],
1847 AC_MSG_WARN([cross compiling: assuming yes])
1848)
1849
Tim Ricec7a8af02010-11-08 14:26:23 -08001850AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001851 [AC_LANG_PROGRAM(
1852 [[ #include <ctype.h> ]],
1853 [[ return (isblank('a')); ]])],
1854 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001855])
1856
Damien Miller5fbe93f2016-07-15 13:54:31 +10001857disable_pkcs11=
1858AC_ARG_ENABLE([pkcs11],
1859 [ --disable-pkcs11 disable PKCS#11 support code [no]],
1860 [
1861 if test "x$enableval" = "xno" ; then
1862 disable_pkcs11=1
1863 fi
1864 ]
1865)
1866
Damien Miller72ef7c12015-01-15 02:21:31 +11001867# PKCS11 depends on OpenSSL.
Damien Miller5fbe93f2016-07-15 13:54:31 +10001868if test "x$openssl" = "xyes" && test "x$disable_pkcs11" = "x"; then
Damien Miller72ef7c12015-01-15 02:21:31 +11001869 # PKCS#11 support requires dlopen() and co
1870 AC_SEARCH_LIBS([dlopen], [dl],
Darren Tucker146c3bd2018-02-26 12:51:29 +11001871 AC_CHECK_DECL([RTLD_NOW],
1872 AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support]),
1873 [], [#include <dlfcn.h>]
1874 )
Damien Miller72ef7c12015-01-15 02:21:31 +11001875 )
1876fi
Damien Millerb3c9f782010-02-12 10:11:34 +11001877
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001878# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001879AC_CHECK_FUNCS([gai_strerror], [
1880 AC_DEFINE([HAVE_GAI_STRERROR])
1881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001882#include <sys/types.h>
1883#include <sys/socket.h>
1884#include <netdb.h>
1885
Tim Rice648f8762011-01-26 12:38:57 -08001886const char *gai_strerror(int);
1887 ]], [[
1888 char *str;
1889 str = gai_strerror(0);
1890 ]])], [
1891 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1892 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001893
Tim Rice648f8762011-01-26 12:38:57 -08001894AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1895 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001896
Darren Tuckera7108912013-06-02 08:18:31 +10001897AC_SEARCH_LIBS([clock_gettime], [rt],
1898 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1899
Darren Tuckerf1159b52003-07-07 19:44:01 +10001900dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001901AC_CHECK_DECL([strsep],
1902 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001903 [],
1904 [
1905#ifdef HAVE_STRING_H
1906# include <string.h>
1907#endif
1908 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001909
Darren Tuckerb2427c82003-09-10 15:22:44 +10001910dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001911AC_CHECK_DECL([tcsendbreak],
1912 [AC_DEFINE([HAVE_TCSENDBREAK])],
1913 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001914 [#include <termios.h>]
1915)
1916
Tim Rice648f8762011-01-26 12:38:57 -08001917AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001918
Tim Rice648f8762011-01-26 12:38:57 -08001919AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001920 [
1921#include <sys/types.h>
1922#include <sys/socket.h>
1923 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001924
Tim Rice648f8762011-01-26 12:38:57 -08001925AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001926 [
1927#include <sys/types.h>
1928#ifdef HAVE_SYS_STAT_H
1929# include <sys/stat.h>
1930#endif
1931#ifdef HAVE_FCNTL_H
1932# include <fcntl.h>
1933#endif
1934 ])
1935
Darren Tucker2eb40412018-02-24 21:06:48 +11001936AC_CHECK_DECLS([readv, writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001937#include <sys/types.h>
1938#include <sys/uio.h>
1939#include <unistd.h>
1940 ])
1941
Tim Rice648f8762011-01-26 12:38:57 -08001942AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001943#include <sys/param.h>
1944 ])
1945
Tim Rice648f8762011-01-26 12:38:57 -08001946AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001947#include <stddef.h>
1948 ])
1949
Darren Tuckerc7aad002013-06-02 07:18:47 +10001950# extra bits for select(2)
1951AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1952#include <sys/param.h>
1953#include <sys/types.h>
1954#ifdef HAVE_SYS_SYSMACROS_H
1955#include <sys/sysmacros.h>
1956#endif
1957#ifdef HAVE_SYS_SELECT_H
1958#include <sys/select.h>
1959#endif
1960#ifdef HAVE_SYS_TIME_H
1961#include <sys/time.h>
1962#endif
1963#ifdef HAVE_UNISTD_H
1964#include <unistd.h>
1965#endif
1966 ]])
1967AC_CHECK_TYPES([fd_mask], [], [], [[
1968#include <sys/param.h>
1969#include <sys/types.h>
1970#ifdef HAVE_SYS_SELECT_H
1971#include <sys/select.h>
1972#endif
1973#ifdef HAVE_SYS_TIME_H
1974#include <sys/time.h>
1975#endif
1976#ifdef HAVE_UNISTD_H
1977#include <unistd.h>
1978#endif
1979 ]])
1980
Tim Rice648f8762011-01-26 12:38:57 -08001981AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001982 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001983 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001984 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001985 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001986#include <stdlib.h>
1987#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001988 ]], [[
1989 errno=0;
1990 setresuid(0,0,0);
1991 if (errno==ENOSYS)
1992 exit(1);
1993 else
1994 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001995 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001996 [AC_MSG_RESULT([yes])],
1997 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001998 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001999 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002000 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11002001 )
2002])
Darren Tuckere937be32003-12-17 18:53:26 +11002003
Tim Rice648f8762011-01-26 12:38:57 -08002004AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11002005 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08002006 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10002007 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002008 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11002009#include <stdlib.h>
2010#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08002011 ]], [[
2012 errno=0;
2013 setresgid(0,0,0);
2014 if (errno==ENOSYS)
2015 exit(1);
2016 else
2017 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002018 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002019 [AC_MSG_RESULT([yes])],
2020 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002021 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08002022 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002023 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11002024 )
2025])
Darren Tuckere937be32003-12-17 18:53:26 +11002026
Darren Tuckerd3e2aee2015-07-17 12:52:34 +10002027AC_CHECK_FUNCS([realpath], [
2028 dnl the sftp v3 spec says SSH_FXP_REALPATH will "canonicalize any given
2029 dnl path name", however some implementations of realpath (and some
2030 dnl versions of the POSIX spec) do not work on non-existent files,
2031 dnl so we use the OpenBSD implementation on those platforms.
2032 AC_MSG_CHECKING([if realpath works with non-existent files])
2033 AC_RUN_IFELSE(
2034 [AC_LANG_PROGRAM([[
2035#include <limits.h>
2036#include <stdlib.h>
2037#include <errno.h>
2038 ]], [[
2039 char buf[PATH_MAX];
2040 if (realpath("/opensshnonexistentfilename1234", buf) == NULL)
2041 if (errno == ENOENT)
2042 exit(1);
2043 exit(0);
2044 ]])],
2045 [AC_MSG_RESULT([yes])],
2046 [AC_DEFINE([BROKEN_REALPATH], [1],
2047 [realpath does not work with nonexistent files])
2048 AC_MSG_RESULT([no])],
2049 [AC_MSG_WARN([cross compiling: assuming working])]
2050 )
2051])
2052
Darren Tucker58fd4c52018-03-05 19:28:08 +11002053AC_MSG_CHECKING([for working fflush(NULL)])
2054AC_RUN_IFELSE(
2055 [AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(NULL); exit(0);]])],
2056 AC_MSG_RESULT([yes]),
2057 [AC_MSG_RESULT([no])
2058 AC_DEFINE([FFLUSH_NULL_BUG], [1],
2059 [define if fflush(NULL) does not work])],
2060 AC_MSG_WARN([cross compiling: assuming working])
2061)
2062
Damien Millerad833b32000-08-23 10:46:23 +10002063dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08002064AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10002065dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08002066AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
2067AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10002068dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08002069AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
2070AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11002071dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08002072AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11002073
Tim Rice648f8762011-01-26 12:38:57 -08002074AC_CHECK_FUNC([daemon],
2075 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
2076 [AC_CHECK_LIB([bsd], [daemon],
2077 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11002078)
2079
Tim Rice648f8762011-01-26 12:38:57 -08002080AC_CHECK_FUNC([getpagesize],
2081 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002082 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08002083 [AC_CHECK_LIB([ucb], [getpagesize],
2084 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11002085)
2086
Damien Millercb170cb2000-07-01 16:52:55 +10002087# Check for broken snprintf
2088if test "x$ac_cv_func_snprintf" = "xyes" ; then
2089 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002090 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002091 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
2092 [[
2093 char b[5];
2094 snprintf(b,5,"123456789");
Tim Ricee1d93702016-05-31 11:13:22 -07002095 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10002096 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002097 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10002098 [
Tim Rice648f8762011-01-26 12:38:57 -08002099 AC_MSG_RESULT([no])
2100 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002101 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10002102 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002103 ],
2104 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10002105 )
2106fi
2107
Darren Tuckere5261272018-10-12 16:43:35 +11002108if test "x$ac_cv_func_snprintf" = "xyes" ; then
2109 AC_MSG_CHECKING([whether snprintf understands %zu])
2110 AC_RUN_IFELSE(
2111 [AC_LANG_PROGRAM([[
2112#include <sys/types.h>
2113#include <stdio.h>
2114 ]],
2115 [[
2116 size_t a = 1, b = 2;
2117 char z[128];
2118 snprintf(z, sizeof z, "%zu%zu", a, b);
2119 exit(strcmp(z, "12"));
2120 ]])],
2121 [AC_MSG_RESULT([yes])],
2122 [
2123 AC_MSG_RESULT([no])
2124 AC_DEFINE([BROKEN_SNPRINTF], [1],
2125 [snprintf does not understand %zu])
2126 ],
2127 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
2128 )
2129fi
2130
Damien Millerd244a582014-08-23 17:06:49 +10002131# We depend on vsnprintf returning the right thing on overflow: the
2132# number of characters it tried to create (as per SUSv3)
2133if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
Damien Miller57f39152005-11-24 19:58:19 +11002134 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
2135 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002136 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11002137#include <sys/types.h>
2138#include <stdio.h>
2139#include <stdarg.h>
2140
Damien Millerd244a582014-08-23 17:06:49 +10002141int x_snprintf(char *str, size_t count, const char *fmt, ...)
Damien Miller57f39152005-11-24 19:58:19 +11002142{
Damien Millerd244a582014-08-23 17:06:49 +10002143 size_t ret;
2144 va_list ap;
2145
2146 va_start(ap, fmt);
2147 ret = vsnprintf(str, count, fmt, ap);
2148 va_end(ap);
Damien Miller57f39152005-11-24 19:58:19 +11002149 return ret;
2150}
Tim Rice648f8762011-01-26 12:38:57 -08002151 ]], [[
Damien Millerd244a582014-08-23 17:06:49 +10002152char x[1];
2153if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11)
2154 return 1;
2155if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11)
2156 return 1;
2157return 0;
Tim Rice648f8762011-01-26 12:38:57 -08002158 ]])],
2159 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11002160 [
Tim Rice648f8762011-01-26 12:38:57 -08002161 AC_MSG_RESULT([no])
2162 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11002163 [Define if your snprintf is busted])
2164 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
2165 ],
2166 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
2167 )
2168fi
2169
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002170# On systems where [v]snprintf is broken, but is declared in stdio,
2171# check that the fmt argument is const char * or just char *.
2172# This is only useful for when BROKEN_SNPRINTF
2173AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08002174AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2175#include <stdio.h>
2176int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
2177 ]], [[
2178 snprintf(0, 0, 0);
2179 ]])],
2180 [AC_MSG_RESULT([yes])
2181 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002182 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08002183 [AC_MSG_RESULT([no])
2184 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002185
Damien Millerb4097182004-05-23 14:09:40 +10002186# Check for missing getpeereid (or equiv) support
2187NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11002188if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10002189 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08002190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2191#include <sys/types.h>
2192#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2193 [ AC_MSG_RESULT([yes])
2194 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2195 ], [AC_MSG_RESULT([no])
2196 NO_PEERCHECK=1
2197 ])
Damien Millerb4097182004-05-23 14:09:40 +10002198fi
2199
Damien Millere8328192003-01-07 15:18:32 +11002200dnl see whether mkstemp() requires XXXXXX
2201if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2202AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002203AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002204 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002205#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002206 ]], [[
2207 char template[]="conftest.mkstemp-test";
2208 if (mkstemp(template) == -1)
2209 exit(1);
2210 unlink(template);
2211 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002212 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002213 [
Tim Rice648f8762011-01-26 12:38:57 -08002214 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002215 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002216 [
Tim Rice648f8762011-01-26 12:38:57 -08002217 AC_MSG_RESULT([yes])
2218 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002219 ],
2220 [
Tim Rice648f8762011-01-26 12:38:57 -08002221 AC_MSG_RESULT([yes])
2222 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002223 ]
Damien Millere8328192003-01-07 15:18:32 +11002224)
2225fi
2226
Darren Tucker70a3d552003-08-21 17:58:29 +10002227dnl make sure that openpty does not reacquire controlling terminal
2228if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002229 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002230 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002231 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002232#include <stdio.h>
2233#include <sys/fcntl.h>
2234#include <sys/types.h>
2235#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002236 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002237 pid_t pid;
2238 int fd, ptyfd, ttyfd, status;
2239
2240 pid = fork();
2241 if (pid < 0) { /* failed */
2242 exit(1);
2243 } else if (pid > 0) { /* parent */
2244 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002245 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002246 exit(WEXITSTATUS(status));
2247 else
2248 exit(2);
2249 } else { /* child */
2250 close(0); close(1); close(2);
2251 setsid();
2252 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2253 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2254 if (fd >= 0)
2255 exit(3); /* Acquired ctty: broken */
2256 else
2257 exit(0); /* Did not acquire ctty: OK */
2258 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002259 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002260 [
Tim Rice648f8762011-01-26 12:38:57 -08002261 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002262 ],
2263 [
Tim Rice648f8762011-01-26 12:38:57 -08002264 AC_MSG_RESULT([no])
2265 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002266 ],
2267 [
Tim Rice648f8762011-01-26 12:38:57 -08002268 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002269 ]
2270 )
2271fi
2272
Tim Rice8bb561b2005-03-17 16:23:19 -08002273if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2274 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002275 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002276 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002277 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002278#include <stdio.h>
2279#include <sys/socket.h>
2280#include <netdb.h>
2281#include <errno.h>
2282#include <netinet/in.h>
2283
2284#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002285 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002286 int err, sock;
2287 struct addrinfo *gai_ai, *ai, hints;
2288 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2289
2290 memset(&hints, 0, sizeof(hints));
2291 hints.ai_family = PF_UNSPEC;
2292 hints.ai_socktype = SOCK_STREAM;
2293 hints.ai_flags = AI_PASSIVE;
2294
2295 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2296 if (err != 0) {
2297 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2298 exit(1);
2299 }
2300
2301 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2302 if (ai->ai_family != AF_INET6)
2303 continue;
2304
2305 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2306 sizeof(ntop), strport, sizeof(strport),
2307 NI_NUMERICHOST|NI_NUMERICSERV);
2308
2309 if (err != 0) {
2310 if (err == EAI_SYSTEM)
2311 perror("getnameinfo EAI_SYSTEM");
2312 else
2313 fprintf(stderr, "getnameinfo failed: %s\n",
2314 gai_strerror(err));
2315 exit(2);
2316 }
2317
2318 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2319 if (sock < 0)
2320 perror("socket");
2321 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2322 if (errno == EBADF)
2323 exit(3);
2324 }
2325 }
2326 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002327 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002328 [
Tim Rice648f8762011-01-26 12:38:57 -08002329 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002330 ],
2331 [
Tim Rice648f8762011-01-26 12:38:57 -08002332 AC_MSG_RESULT([no])
2333 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002334 ],
2335 [
Tim Rice648f8762011-01-26 12:38:57 -08002336 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002337 ]
2338 )
2339fi
2340
Tim Rice8bb561b2005-03-17 16:23:19 -08002341if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2342 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002343 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002344 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002345 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002346#include <stdio.h>
2347#include <sys/socket.h>
2348#include <netdb.h>
2349#include <errno.h>
2350#include <netinet/in.h>
2351
2352#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002353 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002354 int err, sock;
2355 struct addrinfo *gai_ai, *ai, hints;
2356 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2357
2358 memset(&hints, 0, sizeof(hints));
2359 hints.ai_family = PF_UNSPEC;
2360 hints.ai_socktype = SOCK_STREAM;
2361 hints.ai_flags = AI_PASSIVE;
2362
2363 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2364 if (err != 0) {
2365 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2366 exit(1);
2367 }
2368
2369 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2370 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2371 continue;
2372
2373 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2374 sizeof(ntop), strport, sizeof(strport),
2375 NI_NUMERICHOST|NI_NUMERICSERV);
2376
2377 if (ai->ai_family == AF_INET && err != 0) {
2378 perror("getnameinfo");
2379 exit(2);
2380 }
2381 }
2382 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002383 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002384 [
Tim Rice648f8762011-01-26 12:38:57 -08002385 AC_MSG_RESULT([yes])
2386 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002387 [Define if you have a getaddrinfo that fails
2388 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002389 ],
2390 [
Tim Rice648f8762011-01-26 12:38:57 -08002391 AC_MSG_RESULT([no])
2392 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002393 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002394 [
Tim Rice648f8762011-01-26 12:38:57 -08002395 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002396 ]
2397 )
2398fi
2399
Darren Tuckere50e8c92015-02-21 15:10:33 +11002400if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2401 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2402 [#include <sys/types.h>
2403 #include <sys/socket.h>
2404 #include <netdb.h>])
2405fi
2406
Darren Tuckera56f1912004-11-02 20:30:54 +11002407if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002408 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2409 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2410 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002411 [
Tim Rice648f8762011-01-26 12:38:57 -08002412 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002413 ],
2414 [
Tim Rice648f8762011-01-26 12:38:57 -08002415 AC_MSG_RESULT([yes])
2416 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002417 [Conflicting defs for getspnam])
2418 ]
2419 )
2420fi
2421
Darren Tucker20e5e8b2016-08-02 12:16:34 +10002422dnl NetBSD added an strnvis and unfortunately made it incompatible with the
2423dnl existing one in OpenBSD and Linux's libbsd (the former having existed
2424dnl for over ten years). Despite this incompatibility being reported during
2425dnl development (see http://gnats.netbsd.org/44977) they still shipped it.
2426dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible
2427dnl implementation. Try to detect this mess, and assume the only safe option
2428dnl if we're cross compiling.
2429dnl
2430dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
2431dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
2432if test "x$ac_cv_func_strnvis" = "xyes"; then
2433 AC_MSG_CHECKING([for working strnvis])
2434 AC_RUN_IFELSE(
2435 [AC_LANG_PROGRAM([[
2436#include <signal.h>
2437#include <stdlib.h>
2438#include <string.h>
2439#include <vis.h>
2440static void sighandler(int sig) { _exit(1); }
2441 ]], [[
2442 char dst[16];
2443
2444 signal(SIGSEGV, sighandler);
2445 if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0)
2446 exit(0);
2447 exit(1)
2448 ]])],
2449 [AC_MSG_RESULT([yes])],
2450 [AC_MSG_RESULT([no])
2451 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])],
2452 [AC_MSG_WARN([cross compiling: assuming broken])
2453 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])]
2454 )
2455fi
2456
Darren Tuckerc7b5a472018-02-25 23:55:41 +11002457AC_CHECK_FUNCS([getpgrp],[
2458 AC_MSG_CHECKING([if getpgrp accepts zero args])
2459 AC_COMPILE_IFELSE(
2460 [AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])],
2461 [ AC_MSG_RESULT([yes])
2462 AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])],
2463 [ AC_MSG_RESULT([no])
2464 AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])]
2465 )
2466])
Damien Miller606f8802000-09-16 15:39:56 +11002467
Tim Riceaef73712002-05-11 13:17:42 -07002468# Search for OpenSSL
2469saved_CPPFLAGS="$CPPFLAGS"
2470saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002471AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002472 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2473 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002474 if test "x$openssl" = "xno" ; then
2475 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2476 fi
Ben Lindstrom23e13712000-10-29 22:49:19 +00002477 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002478 case "$withval" in
2479 # Relative paths
2480 ./*|../*) withval="`pwd`/$withval"
2481 esac
Tim Riceaef73712002-05-11 13:17:42 -07002482 if test -d "$withval/lib"; then
Darren Tucker2f0bad22019-01-21 21:28:27 +11002483 if test -n "${rpath_opt}"; then
2484 LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}"
Tim Riceaef73712002-05-11 13:17:42 -07002485 else
2486 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2487 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002488 elif test -d "$withval/lib64"; then
Darren Tucker2f0bad22019-01-21 21:28:27 +11002489 if test -n "${rpath_opt}"; then
2490 LDFLAGS="-L${withval}/lib64 ${rpath_opt}${withval}/lib64 ${LDFLAGS}"
Darren Tucker9f8703b2010-04-23 11:12:06 +10002491 else
2492 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2493 fi
Tim Riceaef73712002-05-11 13:17:42 -07002494 else
Darren Tucker2f0bad22019-01-21 21:28:27 +11002495 if test -n "${rpath_opt}"; then
2496 LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}"
Tim Riceaef73712002-05-11 13:17:42 -07002497 else
2498 LDFLAGS="-L${withval} ${LDFLAGS}"
2499 fi
2500 fi
2501 if test -d "$withval/include"; then
2502 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2503 else
2504 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2505 fi
Damien Millera22ba012000-03-02 23:09:20 +11002506 fi
2507 ]
2508)
Damien Millerb9c56672014-05-15 14:43:37 +10002509
Tim Rice648f8762011-01-26 12:38:57 -08002510AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002511 [ --without-openssl-header-check Disable OpenSSL version consistency check],
Damien Millerec932372002-01-22 22:16:03 +11002512 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002513 if test "x$withval" = "xno" ; then
2514 openssl_check_nonfatal=1
Damien Miller9975e482007-03-05 11:51:27 +11002515 fi
Damien Millerec932372002-01-22 22:16:03 +11002516 ]
2517)
2518
Damien Miller72ef7c12015-01-15 02:21:31 +11002519openssl_engine=no
Tim Rice648f8762011-01-26 12:38:57 -08002520AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002521 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
Damien Miller72ef7c12015-01-15 02:21:31 +11002522 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002523 if test "x$withval" != "xno" ; then
Darren Tuckerb5fa0cd2015-12-15 15:10:32 +11002524 if test "x$openssl" = "xno" ; then
2525 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2526 fi
Damien Miller72ef7c12015-01-15 02:21:31 +11002527 openssl_engine=yes
2528 fi
2529 ]
2530)
2531
2532if test "x$openssl" = "xyes" ; then
2533 LIBS="-lcrypto $LIBS"
Darren Tucker8d8340e2018-11-16 13:32:13 +11002534 AC_TRY_LINK_FUNC([RAND_add], ,
2535 [AC_MSG_ERROR([*** working libcrypto not found, check config.log])])
2536 AC_CHECK_HEADER([openssl/opensslv.h], ,
2537 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
Damien Miller72ef7c12015-01-15 02:21:31 +11002538
2539 # Determine OpenSSL header version
2540 AC_MSG_CHECKING([OpenSSL header version])
2541 AC_RUN_IFELSE(
2542 [AC_LANG_PROGRAM([[
Darren Tucker15605962015-11-10 11:14:47 +11002543 #include <stdlib.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002544 #include <stdio.h>
2545 #include <string.h>
2546 #include <openssl/opensslv.h>
2547 #define DATA "conftest.sslincver"
2548 ]], [[
2549 FILE *fd;
2550 int rc;
2551
2552 fd = fopen(DATA,"w");
2553 if(fd == NULL)
2554 exit(1);
2555
Darren Tuckerb3413532016-04-04 11:09:21 +10002556 if ((rc = fprintf(fd, "%08lx (%s)\n",
2557 (unsigned long)OPENSSL_VERSION_NUMBER,
2558 OPENSSL_VERSION_TEXT)) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002559 exit(1);
2560
2561 exit(0);
2562 ]])],
2563 [
2564 ssl_header_ver=`cat conftest.sslincver`
2565 AC_MSG_RESULT([$ssl_header_ver])
2566 ],
2567 [
2568 AC_MSG_RESULT([not found])
2569 AC_MSG_ERROR([OpenSSL version header not found.])
2570 ],
2571 [
2572 AC_MSG_WARN([cross compiling: not checking])
2573 ]
2574 )
2575
Darren Tucker262d81a2018-10-27 16:45:59 +11002576 # Determining OpenSSL library version is version dependent.
2577 AC_CHECK_FUNCS([OpenSSL_version OpenSSL_version_num])
2578
Damien Miller72ef7c12015-01-15 02:21:31 +11002579 # Determine OpenSSL library version
2580 AC_MSG_CHECKING([OpenSSL library version])
2581 AC_RUN_IFELSE(
2582 [AC_LANG_PROGRAM([[
2583 #include <stdio.h>
2584 #include <string.h>
2585 #include <openssl/opensslv.h>
2586 #include <openssl/crypto.h>
2587 #define DATA "conftest.ssllibver"
2588 ]], [[
2589 FILE *fd;
2590 int rc;
2591
2592 fd = fopen(DATA,"w");
2593 if(fd == NULL)
2594 exit(1);
Darren Tucker262d81a2018-10-27 16:45:59 +11002595#ifndef OPENSSL_VERSION
2596# define OPENSSL_VERSION SSLEAY_VERSION
2597#endif
2598#ifndef HAVE_OPENSSL_VERSION
Damien Miller406a24b2018-10-26 13:43:28 +11002599# define OpenSSL_version SSLeay_version
Darren Tucker262d81a2018-10-27 16:45:59 +11002600#endif
2601#ifndef HAVE_OPENSSL_VERSION_NUM
2602# define OpenSSL_version_num SSLeay
Damien Miller406a24b2018-10-26 13:43:28 +11002603#endif
Damien Miller859754b2018-10-23 17:10:41 +11002604 if ((rc = fprintf(fd, "%08lx (%s)\n",
2605 (unsigned long)OpenSSL_version_num(),
2606 OpenSSL_version(OPENSSL_VERSION))) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002607 exit(1);
2608
2609 exit(0);
2610 ]])],
2611 [
2612 ssl_library_ver=`cat conftest.ssllibver`
2613 # Check version is supported.
2614 case "$ssl_library_ver" in
Damien Milleraede1c32018-10-17 11:01:20 +11002615 10000*|0*)
2616 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
2617 ;;
2618 100*) ;; # 1.0.x
Damien Miller28c7b2c2018-11-23 10:45:20 +11002619 101000[[0123456]]*)
Damien Milleraede1c32018-10-17 11:01:20 +11002620 # https://github.com/openssl/openssl/pull/4613
2621 AC_MSG_ERROR([OpenSSL 1.1.x versions prior to 1.1.0g have a bug that breaks their use with OpenSSH (have "$ssl_library_ver")])
2622 ;;
2623 101*) ;; # 1.1.x
2624 200*) ;; # LibreSSL
Darren Tuckerc882d742019-01-22 20:38:40 +11002625 300*) ;; # OpenSSL development branch.
Damien Milleraede1c32018-10-17 11:01:20 +11002626 *)
Darren Tuckerc882d742019-01-22 20:38:40 +11002627 AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_library_ver")])
Damien Milleraede1c32018-10-17 11:01:20 +11002628 ;;
Damien Miller72ef7c12015-01-15 02:21:31 +11002629 esac
2630 AC_MSG_RESULT([$ssl_library_ver])
2631 ],
2632 [
2633 AC_MSG_RESULT([not found])
2634 AC_MSG_ERROR([OpenSSL library not found.])
2635 ],
2636 [
2637 AC_MSG_WARN([cross compiling: not checking])
2638 ]
2639 )
2640
2641 # Sanity check OpenSSL headers
2642 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2643 AC_RUN_IFELSE(
2644 [AC_LANG_PROGRAM([[
2645 #include <string.h>
2646 #include <openssl/opensslv.h>
Darren Tuckerc1d7e542015-12-15 14:27:09 +11002647 #include <openssl/crypto.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002648 ]], [[
Darren Tucker262d81a2018-10-27 16:45:59 +11002649#ifndef HAVE_OPENSSL_VERSION_NUM
2650# define OpenSSL_version_num SSLeay
Damien Miller406a24b2018-10-26 13:43:28 +11002651#endif
Damien Miller859754b2018-10-23 17:10:41 +11002652 exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Damien Miller72ef7c12015-01-15 02:21:31 +11002653 ]])],
2654 [
2655 AC_MSG_RESULT([yes])
2656 ],
2657 [
2658 AC_MSG_RESULT([no])
2659 if test "x$openssl_check_nonfatal" = "x"; then
2660 AC_MSG_ERROR([Your OpenSSL headers do not match your
2661 library. Check config.log for details.
2662 If you are sure your installation is consistent, you can disable the check
2663 by running "./configure --without-openssl-header-check".
2664 Also see contrib/findssl.sh for help identifying header/library mismatches.
2665 ])
2666 else
2667 AC_MSG_WARN([Your OpenSSL headers do not match your
2668 library. Check config.log for details.
2669 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2670 fi
2671 ],
2672 [
2673 AC_MSG_WARN([cross compiling: not checking])
2674 ]
2675 )
2676
2677 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2678 AC_LINK_IFELSE(
Damien Miller42c5ec42018-11-23 10:40:06 +11002679 [AC_LANG_PROGRAM([[ #include <openssl/err.h> ]],
2680 [[ ERR_load_crypto_strings(); ]])],
Damien Miller72ef7c12015-01-15 02:21:31 +11002681 [
2682 AC_MSG_RESULT([yes])
2683 ],
2684 [
2685 AC_MSG_RESULT([no])
2686 saved_LIBS="$LIBS"
2687 LIBS="$LIBS -ldl"
2688 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2689 AC_LINK_IFELSE(
Damien Miller42c5ec42018-11-23 10:40:06 +11002690 [AC_LANG_PROGRAM([[ #include <openssl/err.h> ]],
2691 [[ ERR_load_crypto_strings(); ]])],
Damien Miller72ef7c12015-01-15 02:21:31 +11002692 [
2693 AC_MSG_RESULT([yes])
2694 ],
2695 [
2696 AC_MSG_RESULT([no])
2697 LIBS="$saved_LIBS"
2698 ]
2699 )
2700 ]
2701 )
2702
2703 AC_CHECK_FUNCS([ \
2704 BN_is_prime_ex \
2705 DSA_generate_parameters_ex \
Damien Miller42c5ec42018-11-23 10:40:06 +11002706 EVP_CIPHER_CTX_ctrl \
Damien Miller72ef7c12015-01-15 02:21:31 +11002707 EVP_DigestFinal_ex \
Damien Miller42c5ec42018-11-23 10:40:06 +11002708 EVP_DigestInit_ex \
Damien Miller72ef7c12015-01-15 02:21:31 +11002709 EVP_MD_CTX_cleanup \
2710 EVP_MD_CTX_copy_ex \
Damien Miller42c5ec42018-11-23 10:40:06 +11002711 EVP_MD_CTX_init \
Damien Miller72ef7c12015-01-15 02:21:31 +11002712 HMAC_CTX_init \
2713 RSA_generate_key_ex \
2714 RSA_get_default_method \
Darren Tucker1801cd12018-11-08 15:03:11 +11002715 ])
Darren Tucker98f878d2018-11-25 14:05:08 +11002716
2717 # OpenSSL_add_all_algorithms may be a macro.
2718 AC_CHECK_FUNC(OpenSSL_add_all_algorithms,
2719 AC_DEFINE(HAVE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [as a function]),
2720 AC_CHECK_DECL(OpenSSL_add_all_algorithms,
2721 AC_DEFINE(HAVE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [as a macro]), ,
2722 [[#include <openssl/evp.h>]]
2723 )
2724 )
2725
Darren Tucker1801cd12018-11-08 15:03:11 +11002726 # LibreSSL/OpenSSL 1.1x API
2727 AC_CHECK_FUNCS([ \
Darren Tuckerd0d1dfa2018-11-16 14:11:44 +11002728 OPENSSL_init_crypto \
Darren Tucker1801cd12018-11-08 15:03:11 +11002729 DH_get0_key \
2730 DH_get0_pqg \
2731 DH_set0_key \
2732 DH_set_length \
2733 DH_set0_pqg \
2734 DSA_get0_key \
2735 DSA_get0_pqg \
2736 DSA_set0_key \
2737 DSA_set0_pqg \
2738 DSA_SIG_get0 \
2739 DSA_SIG_set0 \
2740 ECDSA_SIG_get0 \
2741 ECDSA_SIG_set0 \
2742 EVP_CIPHER_CTX_iv \
2743 EVP_CIPHER_CTX_iv_noconst \
2744 EVP_CIPHER_CTX_get_iv \
2745 EVP_CIPHER_CTX_set_iv \
2746 RSA_get0_crt_params \
2747 RSA_get0_factors \
2748 RSA_get0_key \
2749 RSA_set0_crt_params \
2750 RSA_set0_factors \
2751 RSA_set0_key \
2752 RSA_meth_free \
2753 RSA_meth_dup \
2754 RSA_meth_set1_name \
2755 RSA_meth_get_finish \
2756 RSA_meth_set_priv_enc \
2757 RSA_meth_set_priv_dec \
2758 RSA_meth_set_finish \
2759 EVP_PKEY_get0_RSA \
2760 EVP_MD_CTX_new \
2761 EVP_MD_CTX_free \
Damien Miller72ef7c12015-01-15 02:21:31 +11002762 ])
2763
2764 if test "x$openssl_engine" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002765 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2766 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002767 #include <openssl/engine.h>
Tim Rice648f8762011-01-26 12:38:57 -08002768 ]], [[
Damien Miller72ef7c12015-01-15 02:21:31 +11002769 ENGINE_load_builtin_engines();
2770 ENGINE_register_all_complete();
Tim Rice648f8762011-01-26 12:38:57 -08002771 ]])],
2772 [ AC_MSG_RESULT([yes])
2773 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002774 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002775 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2776 ])
Damien Miller72ef7c12015-01-15 02:21:31 +11002777 fi
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002778
Damien Miller72ef7c12015-01-15 02:21:31 +11002779 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2780 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2781 AC_LINK_IFELSE(
Darren Tucker37bcef52013-11-09 18:39:25 +11002782 [AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002783 #include <string.h>
2784 #include <openssl/evp.h>
2785 ]], [[
2786 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2787 ]])],
2788 [
2789 AC_MSG_RESULT([no])
2790 ],
2791 [
2792 AC_MSG_RESULT([yes])
2793 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2794 [libcrypto is missing AES 192 and 256 bit functions])
2795 ]
2796 )
2797
2798 # Check for OpenSSL with EVP_aes_*ctr
2799 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2800 AC_LINK_IFELSE(
2801 [AC_LANG_PROGRAM([[
2802 #include <string.h>
2803 #include <openssl/evp.h>
2804 ]], [[
2805 exit(EVP_aes_128_ctr() == NULL ||
2806 EVP_aes_192_cbc() == NULL ||
2807 EVP_aes_256_cbc() == NULL);
2808 ]])],
2809 [
2810 AC_MSG_RESULT([yes])
2811 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2812 [libcrypto has EVP AES CTR])
2813 ],
2814 [
2815 AC_MSG_RESULT([no])
2816 ]
2817 )
2818
2819 # Check for OpenSSL with EVP_aes_*gcm
2820 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2821 AC_LINK_IFELSE(
2822 [AC_LANG_PROGRAM([[
2823 #include <string.h>
2824 #include <openssl/evp.h>
2825 ]], [[
2826 exit(EVP_aes_128_gcm() == NULL ||
2827 EVP_aes_256_gcm() == NULL ||
2828 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2829 EVP_CTRL_GCM_IV_GEN == 0 ||
2830 EVP_CTRL_GCM_SET_TAG == 0 ||
2831 EVP_CTRL_GCM_GET_TAG == 0 ||
2832 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2833 ]])],
2834 [
2835 AC_MSG_RESULT([yes])
2836 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2837 [libcrypto has EVP AES GCM])
2838 ],
2839 [
2840 AC_MSG_RESULT([no])
2841 unsupported_algorithms="$unsupported_cipers \
Damien Miller679ce882016-07-15 13:44:38 +10002842 aes128-gcm@openssh.com \
2843 aes256-gcm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002844 ]
2845 )
2846
Damien Miller72ef7c12015-01-15 02:21:31 +11002847 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2848 AC_LINK_IFELSE(
2849 [AC_LANG_PROGRAM([[
2850 #include <string.h>
2851 #include <openssl/evp.h>
2852 ]], [[
2853 if(EVP_DigestUpdate(NULL, NULL,0))
2854 exit(0);
2855 ]])],
2856 [
2857 AC_MSG_RESULT([yes])
2858 ],
2859 [
2860 AC_MSG_RESULT([no])
2861 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2862 [Define if EVP_DigestUpdate returns void])
2863 ]
2864 )
2865
2866 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2867 # because the system crypt() is more featureful.
2868 if test "x$check_for_libcrypt_before" = "x1"; then
2869 AC_CHECK_LIB([crypt], [crypt])
2870 fi
2871
2872 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2873 # version in OpenSSL.
2874 if test "x$check_for_libcrypt_later" = "x1"; then
2875 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2876 fi
Damien Miller00797e82015-03-04 05:02:45 +11002877 AC_CHECK_FUNCS([crypt DES_crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002878
2879 # Search for SHA256 support in libc and/or OpenSSL
2880 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2881 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002882 hmac-sha2-256 \
2883 hmac-sha2-512 \
Damien Miller72ef7c12015-01-15 02:21:31 +11002884 diffie-hellman-group-exchange-sha256 \
Damien Miller679ce882016-07-15 13:44:38 +10002885 hmac-sha2-256-etm@openssh.com \
2886 hmac-sha2-512-etm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002887 ]
2888 )
2889 # Search for RIPE-MD support in OpenSSL
2890 AC_CHECK_FUNCS([EVP_ripemd160], ,
2891 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002892 hmac-ripemd160 \
2893 hmac-ripemd160@openssh.com \
Damien Miller72ef7c12015-01-15 02:21:31 +11002894 hmac-ripemd160-etm@openssh.com"
2895 ]
2896 )
2897
2898 # Check complete ECC support in OpenSSL
2899 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2900 AC_LINK_IFELSE(
2901 [AC_LANG_PROGRAM([[
2902 #include <openssl/ec.h>
2903 #include <openssl/ecdh.h>
2904 #include <openssl/ecdsa.h>
2905 #include <openssl/evp.h>
2906 #include <openssl/objects.h>
2907 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002908 ]], [[
2909 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2910 const EVP_MD *m = EVP_sha256(); /* We need this too */
Darren Tucker37bcef52013-11-09 18:39:25 +11002911 ]])],
2912 [ AC_MSG_RESULT([yes])
Damien Miller72ef7c12015-01-15 02:21:31 +11002913 enable_nistp256=1 ],
2914 [ AC_MSG_RESULT([no]) ]
2915 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002916
Damien Miller72ef7c12015-01-15 02:21:31 +11002917 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2918 AC_LINK_IFELSE(
2919 [AC_LANG_PROGRAM([[
2920 #include <openssl/ec.h>
2921 #include <openssl/ecdh.h>
2922 #include <openssl/ecdsa.h>
2923 #include <openssl/evp.h>
2924 #include <openssl/objects.h>
2925 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002926 ]], [[
2927 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2928 const EVP_MD *m = EVP_sha384(); /* We need this too */
2929 ]])],
2930 [ AC_MSG_RESULT([yes])
2931 enable_nistp384=1 ],
2932 [ AC_MSG_RESULT([no]) ]
2933 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002934
Damien Miller72ef7c12015-01-15 02:21:31 +11002935 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2936 AC_LINK_IFELSE(
2937 [AC_LANG_PROGRAM([[
2938 #include <openssl/ec.h>
2939 #include <openssl/ecdh.h>
2940 #include <openssl/ecdsa.h>
2941 #include <openssl/evp.h>
2942 #include <openssl/objects.h>
2943 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002944 ]], [[
2945 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2946 const EVP_MD *m = EVP_sha512(); /* We need this too */
2947 ]])],
2948 [ AC_MSG_RESULT([yes])
2949 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2950 AC_RUN_IFELSE(
2951 [AC_LANG_PROGRAM([[
2952 #include <openssl/ec.h>
2953 #include <openssl/ecdh.h>
2954 #include <openssl/ecdsa.h>
2955 #include <openssl/evp.h>
2956 #include <openssl/objects.h>
2957 #include <openssl/opensslv.h>
2958 ]],[[
2959 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2960 const EVP_MD *m = EVP_sha512(); /* We need this too */
2961 exit(e == NULL || m == NULL);
2962 ]])],
2963 [ AC_MSG_RESULT([yes])
2964 enable_nistp521=1 ],
2965 [ AC_MSG_RESULT([no]) ],
2966 [ AC_MSG_WARN([cross-compiling: assuming yes])
2967 enable_nistp521=1 ]
2968 )],
2969 AC_MSG_RESULT([no])
2970 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002971
Damien Miller72ef7c12015-01-15 02:21:31 +11002972 COMMENT_OUT_ECC="#no ecc#"
2973 TEST_SSH_ECC=no
2974
2975 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2976 test x$enable_nistp521 = x1; then
2977 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
Damien Millere2cb4452019-01-21 11:32:28 +11002978 AC_CHECK_FUNCS([EC_KEY_METHOD_new])
Damien Miller72ef7c12015-01-15 02:21:31 +11002979 fi
2980 if test x$enable_nistp256 = x1; then
2981 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2982 [libcrypto has NID_X9_62_prime256v1])
2983 TEST_SSH_ECC=yes
2984 COMMENT_OUT_ECC=""
2985 else
Damien Miller679ce882016-07-15 13:44:38 +10002986 unsupported_algorithms="$unsupported_algorithms \
2987 ecdsa-sha2-nistp256 \
2988 ecdh-sha2-nistp256 \
2989 ecdsa-sha2-nistp256-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002990 fi
2991 if test x$enable_nistp384 = x1; then
2992 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2993 TEST_SSH_ECC=yes
2994 COMMENT_OUT_ECC=""
2995 else
Damien Miller679ce882016-07-15 13:44:38 +10002996 unsupported_algorithms="$unsupported_algorithms \
2997 ecdsa-sha2-nistp384 \
2998 ecdh-sha2-nistp384 \
2999 ecdsa-sha2-nistp384-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003000 fi
3001 if test x$enable_nistp521 = x1; then
3002 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
3003 TEST_SSH_ECC=yes
3004 COMMENT_OUT_ECC=""
3005 else
Damien Miller679ce882016-07-15 13:44:38 +10003006 unsupported_algorithms="$unsupported_algorithms \
3007 ecdh-sha2-nistp521 \
3008 ecdsa-sha2-nistp521 \
3009 ecdsa-sha2-nistp521-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003010 fi
3011
3012 AC_SUBST([TEST_SSH_ECC])
3013 AC_SUBST([COMMENT_OUT_ECC])
3014else
3015 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Miller00797e82015-03-04 05:02:45 +11003016 AC_CHECK_FUNCS([crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11003017fi
Damien Miller6af914a2010-09-10 11:39:26 +10003018
Damien Miller00f9cd22014-07-15 10:41:38 +10003019AC_CHECK_FUNCS([ \
3020 arc4random \
3021 arc4random_buf \
3022 arc4random_stir \
3023 arc4random_uniform \
3024])
3025
Tim Rice99203ec2007-03-26 09:35:28 -07003026saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003027AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07003028 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08003029 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
3030 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Ricee1d93702016-05-31 11:13:22 -07003031 [Define if system has libiaf that supports set_id])
Tim Rice0eeaf122007-09-10 16:24:17 -07003032 ])
Tim Rice99203ec2007-03-26 09:35:28 -07003033])
3034LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11003035
3036### Configure cryptographic random number support
3037
Damien Miller10479cc2018-04-10 10:19:02 +10003038# Check whether OpenSSL seeds itself
Damien Miller72ef7c12015-01-15 02:21:31 +11003039if test "x$openssl" = "xyes" ; then
3040 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
3041 AC_RUN_IFELSE(
3042 [AC_LANG_PROGRAM([[
3043 #include <string.h>
3044 #include <openssl/rand.h>
3045 ]], [[
3046 exit(RAND_status() == 1 ? 0 : 1);
3047 ]])],
3048 [
3049 OPENSSL_SEEDS_ITSELF=yes
3050 AC_MSG_RESULT([yes])
3051 ],
3052 [
3053 AC_MSG_RESULT([no])
3054 ],
3055 [
3056 AC_MSG_WARN([cross compiling: assuming yes])
3057 # This is safe, since we will fatal() at runtime if
3058 # OpenSSL is not seeded correctly.
3059 OPENSSL_SEEDS_ITSELF=yes
3060 ]
3061 )
3062fi
Damien Miller6c21c512002-01-22 21:57:53 +11003063
Damien Millerf22019b2011-05-05 13:48:37 +10003064# PRNGD TCP socket
3065AC_ARG_WITH([prngd-port],
3066 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
3067 [
3068 case "$withval" in
3069 no)
3070 withval=""
3071 ;;
3072 [[0-9]]*)
3073 ;;
3074 *)
3075 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
3076 ;;
3077 esac
3078 if test ! -z "$withval" ; then
3079 PRNGD_PORT="$withval"
3080 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
3081 [Port number of PRNGD/EGD random number socket])
3082 fi
3083 ]
3084)
3085
3086# PRNGD Unix domain socket
3087AC_ARG_WITH([prngd-socket],
3088 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
3089 [
3090 case "$withval" in
3091 yes)
3092 withval="/var/run/egd-pool"
3093 ;;
3094 no)
3095 withval=""
3096 ;;
3097 /*)
3098 ;;
3099 *)
3100 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
3101 ;;
3102 esac
3103
3104 if test ! -z "$withval" ; then
3105 if test ! -z "$PRNGD_PORT" ; then
3106 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
3107 fi
3108 if test ! -r "$withval" ; then
3109 AC_MSG_WARN([Entropy socket is not readable])
3110 fi
3111 PRNGD_SOCKET="$withval"
3112 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
3113 [Location of PRNGD/EGD random number socket])
3114 fi
3115 ],
3116 [
3117 # Check for existing socket only if we don't have a random device already
3118 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
3119 AC_MSG_CHECKING([for PRNGD/EGD socket])
3120 # Insert other locations here
3121 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
3122 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
3123 PRNGD_SOCKET="$sock"
3124 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
3125 break;
3126 fi
3127 done
3128 if test ! -z "$PRNGD_SOCKET" ; then
3129 AC_MSG_RESULT([$PRNGD_SOCKET])
3130 else
3131 AC_MSG_RESULT([not found])
3132 fi
3133 fi
3134 ]
3135)
3136
3137# Which randomness source do we use?
3138if test ! -z "$PRNGD_PORT" ; then
3139 RAND_MSG="PRNGd port $PRNGD_PORT"
3140elif test ! -z "$PRNGD_SOCKET" ; then
3141 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
3142elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
3143 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Damien Miller72ef7c12015-01-15 02:21:31 +11003144 [Define if you want the OpenSSL internally seeded PRNG only])
Damien Millerf22019b2011-05-05 13:48:37 +10003145 RAND_MSG="OpenSSL internal ONLY"
Damien Miller72ef7c12015-01-15 02:21:31 +11003146elif test "x$openssl" = "xno" ; then
3147 AC_MSG_WARN([OpenSSH will use /dev/urandom as a source of random numbers. It will fail if this device is not supported or accessible])
Damien Millerf22019b2011-05-05 13:48:37 +10003148else
3149 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])
3150fi
3151
Darren Tucker3e6bde42006-08-20 20:03:50 +10003152# Check for PAM libs
3153PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003154AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003155 [ --with-pam Enable PAM support ],
3156 [
3157 if test "x$withval" != "xno" ; then
3158 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
3159 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
3160 AC_MSG_ERROR([PAM headers not found])
3161 fi
3162
3163 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003164 AC_CHECK_LIB([dl], [dlopen], , )
3165 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
3166 AC_CHECK_FUNCS([pam_getenvlist])
3167 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003168 LIBS="$saved_LIBS"
3169
3170 PAM_MSG="yes"
3171
Darren Tucker20e9f972007-03-25 18:26:01 +10003172 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08003173 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003174 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10003175
Darren Tucker3e6bde42006-08-20 20:03:50 +10003176 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10003177 case "$LIBS" in
3178 *-ldl*)
3179 # libdl already in LIBS
3180 ;;
3181 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10003182 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10003183 ;;
3184 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10003185 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10003186 fi
3187 ]
3188)
3189
Damien Miller8bd81e12016-08-16 13:30:56 +10003190AC_ARG_WITH([pam-service],
3191 [ --with-pam-service=name Specify PAM service name ],
3192 [
3193 if test "x$withval" != "xno" && \
3194 test "x$withval" != "xyes" ; then
3195 AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE],
3196 ["$withval"], [sshd PAM service name])
3197 fi
3198 ]
3199)
3200
Darren Tucker3e6bde42006-08-20 20:03:50 +10003201# Check for older PAM
3202if test "x$PAM_MSG" = "xyes" ; then
3203 # Check PAM strerror arguments (old PAM)
3204 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08003205 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10003206#include <stdlib.h>
3207#if defined(HAVE_SECURITY_PAM_APPL_H)
3208#include <security/pam_appl.h>
3209#elif defined (HAVE_PAM_PAM_APPL_H)
3210#include <pam/pam_appl.h>
3211#endif
Tim Rice648f8762011-01-26 12:38:57 -08003212 ]], [[
3213(void)pam_strerror((pam_handle_t *)NULL, -1);
3214 ]])], [AC_MSG_RESULT([no])], [
3215 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003216 [Define if you have an old version of PAM
3217 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08003218 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003219 PAM_MSG="yes (old library)"
Damien Miller72ef7c12015-01-15 02:21:31 +11003220
Tim Rice648f8762011-01-26 12:38:57 -08003221 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003222fi
Damien Miller6c21c512002-01-22 21:57:53 +11003223
Damien Miller6482d902014-05-27 14:34:42 +10003224case "$host" in
3225*-*-cygwin*)
3226 SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER
3227 ;;
3228*)
3229 SSH_PRIVSEP_USER=sshd
3230 ;;
3231esac
Tim Rice648f8762011-01-26 12:38:57 -08003232AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00003233 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00003234 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003235 if test -n "$withval" && test "x$withval" != "xno" && \
3236 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10003237 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00003238 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08003239 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00003240)
Damien Miller6482d902014-05-27 14:34:42 +10003241if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then
3242 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER],
3243 [Cygwin function to fetch non-privileged user for privilege separation])
3244else
3245 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
3246 [non-privileged user for privilege separation])
3247fi
Tim Rice648f8762011-01-26 12:38:57 -08003248AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00003249
Damien Miller91f40d82013-02-22 11:37:00 +11003250if test "x$have_linux_no_new_privs" = "x1" ; then
3251AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
3252 #include <sys/types.h>
3253 #include <linux/seccomp.h>
3254])
3255fi
3256if test "x$have_seccomp_filter" = "x1" ; then
3257AC_MSG_CHECKING([kernel for seccomp_filter support])
3258AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3259 #include <errno.h>
3260 #include <elf.h>
3261 #include <linux/audit.h>
3262 #include <linux/seccomp.h>
3263 #include <stdlib.h>
3264 #include <sys/prctl.h>
3265 ]],
3266 [[ int i = $seccomp_audit_arch;
3267 errno = 0;
3268 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
3269 exit(errno == EFAULT ? 0 : 1); ]])],
3270 [ AC_MSG_RESULT([yes]) ], [
3271 AC_MSG_RESULT([no])
3272 # Disable seccomp filter as a target
3273 have_seccomp_filter=0
3274 ]
3275)
3276fi
3277
Damien Miller69ff1df2011-06-23 08:30:03 +10003278# Decide which sandbox style to use
3279sandbox_arg=""
3280AC_ARG_WITH([sandbox],
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003281 [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)],
Damien Miller69ff1df2011-06-23 08:30:03 +10003282 [
3283 if test "x$withval" = "xyes" ; then
3284 sandbox_arg=""
3285 else
3286 sandbox_arg="$withval"
3287 fi
3288 ]
3289)
Darren Tucker60395f92012-07-03 14:31:18 +10003290
3291# Some platforms (seems to be the ones that have a kernel poll(2)-type
3292# function with which they implement select(2)) use an extra file descriptor
3293# when calling select(2), which means we can't use the rlimit sandbox.
3294AC_MSG_CHECKING([if select works with descriptor rlimit])
3295AC_RUN_IFELSE(
3296 [AC_LANG_PROGRAM([[
3297#include <sys/types.h>
3298#ifdef HAVE_SYS_TIME_H
3299# include <sys/time.h>
3300#endif
3301#include <sys/resource.h>
3302#ifdef HAVE_SYS_SELECT_H
3303# include <sys/select.h>
3304#endif
3305#include <errno.h>
3306#include <fcntl.h>
3307#include <stdlib.h>
3308 ]],[[
3309 struct rlimit rl_zero;
3310 int fd, r;
3311 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11003312 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10003313
3314 fd = open("/dev/null", O_RDONLY);
3315 FD_ZERO(&fds);
3316 FD_SET(fd, &fds);
3317 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3318 setrlimit(RLIMIT_FSIZE, &rl_zero);
3319 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11003320 tv.tv_sec = 1;
3321 tv.tv_usec = 0;
3322 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10003323 exit (r == -1 ? 1 : 0);
3324 ]])],
3325 [AC_MSG_RESULT([yes])
3326 select_works_with_rlimit=yes],
3327 [AC_MSG_RESULT([no])
3328 select_works_with_rlimit=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003329 [AC_MSG_WARN([cross compiling: assuming yes])
3330 select_works_with_rlimit=yes]
Darren Tucker60395f92012-07-03 14:31:18 +10003331)
3332
Darren Tuckerff008de2013-03-06 17:48:48 +11003333AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
3334AC_RUN_IFELSE(
3335 [AC_LANG_PROGRAM([[
3336#include <sys/types.h>
3337#ifdef HAVE_SYS_TIME_H
3338# include <sys/time.h>
3339#endif
3340#include <sys/resource.h>
3341#include <errno.h>
3342#include <stdlib.h>
3343 ]],[[
3344 struct rlimit rl_zero;
Darren Tucker34e87fb2019-04-30 12:27:57 +10003345 int r;
Darren Tuckerff008de2013-03-06 17:48:48 +11003346
3347 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3348 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
3349 exit (r == -1 ? 1 : 0);
3350 ]])],
3351 [AC_MSG_RESULT([yes])
3352 rlimit_nofile_zero_works=yes],
3353 [AC_MSG_RESULT([no])
3354 rlimit_nofile_zero_works=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003355 [AC_MSG_WARN([cross compiling: assuming yes])
3356 rlimit_nofile_zero_works=yes]
Darren Tuckerff008de2013-03-06 17:48:48 +11003357)
3358
Darren Tuckerd545a4b2012-07-03 22:48:31 +10003359AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
3360AC_RUN_IFELSE(
3361 [AC_LANG_PROGRAM([[
3362#include <sys/types.h>
3363#include <sys/resource.h>
3364#include <stdlib.h>
3365 ]],[[
3366 struct rlimit rl_zero;
3367
3368 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3369 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
3370 ]])],
3371 [AC_MSG_RESULT([yes])],
3372 [AC_MSG_RESULT([no])
3373 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3374 [setrlimit RLIMIT_FSIZE works])],
3375 [AC_MSG_WARN([cross compiling: assuming yes])]
3376)
3377
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003378if test "x$sandbox_arg" = "xpledge" || \
3379 ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then
3380 test "x$ac_cv_func_pledge" != "xyes" && \
3381 AC_MSG_ERROR([pledge sandbox requires pledge(2) support])
3382 SANDBOX_STYLE="pledge"
Damien Millerfafe1d82015-10-14 09:22:15 -07003383 AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)])
Damien Miller9846a2f2015-10-08 04:30:48 +11003384elif test "x$sandbox_arg" = "xsystrace" || \
Damien Miller69ff1df2011-06-23 08:30:03 +10003385 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003386 test "x$have_systr_policy_kill" != "x1" && \
3387 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003388 SANDBOX_STYLE="systrace"
3389 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003390elif test "x$sandbox_arg" = "xdarwin" || \
3391 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3392 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003393 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3394 "x$ac_cv_header_sandbox_h" != "xyes" && \
3395 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003396 SANDBOX_STYLE="darwin"
3397 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003398elif test "x$sandbox_arg" = "xseccomp_filter" || \
3399 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003400 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003401 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003402 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003403 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3404 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003405 test "x$have_linux_no_new_privs" = "x1" && \
3406 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003407 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003408 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3409 test "x$have_linux_no_new_privs" != "x1" && \
3410 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3411 test "x$have_seccomp_filter" != "x1" && \
3412 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3413 test "x$ac_cv_func_prctl" != "xyes" && \
3414 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3415 SANDBOX_STYLE="seccomp_filter"
3416 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003417elif test "x$sandbox_arg" = "xcapsicum" || \
3418 ( test -z "$sandbox_arg" && \
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003419 test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003420 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003421 test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \
3422 AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003423 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003424 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003425 SANDBOX_STYLE="capsicum"
3426 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003427elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003428 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003429 test "x$select_works_with_rlimit" = "xyes" && \
3430 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003431 test "x$ac_cv_func_setrlimit" != "xyes" && \
3432 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003433 test "x$select_works_with_rlimit" != "xyes" && \
3434 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003435 SANDBOX_STYLE="rlimit"
3436 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller4626cba2016-01-08 14:24:56 +11003437elif test "x$sandbox_arg" = "xsolaris" || \
3438 ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then
3439 SANDBOX_STYLE="solaris"
3440 AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges])
Damien Miller69ff1df2011-06-23 08:30:03 +10003441elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3442 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3443 SANDBOX_STYLE="none"
3444 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3445else
Tim Ricea6e60612011-08-17 21:48:22 -07003446 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003447fi
3448
Ben Lindstromb5628642000-10-18 00:02:25 +00003449# Cheap hack to ensure NEWS-OS libraries are arranged right.
3450if test ! -z "$SONY" ; then
3451 LIBS="$LIBS -liberty";
3452fi
3453
Damien Miller57f39152005-11-24 19:58:19 +11003454# Check for long long datatypes
3455AC_CHECK_TYPES([long long, unsigned long long, long double])
3456
3457# Check datatype sizes
Dag-Erling Smørgravd0153c72018-10-09 23:03:40 +02003458AC_CHECK_SIZEOF([short int])
3459AC_CHECK_SIZEOF([int])
3460AC_CHECK_SIZEOF([long int])
3461AC_CHECK_SIZEOF([long long int])
Damien Millerc6398ef1999-11-20 12:18:40 +11003462
Damien Millerfa2bb692002-04-23 23:22:25 +10003463# Sanity check long long for some platforms (AIX)
3464if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3465 ac_cv_sizeof_long_long_int=0
3466fi
3467
Darren Tucker537f1ed2005-10-25 18:38:33 +10003468# compute LLONG_MIN and LLONG_MAX if we don't know them.
3469if test -z "$have_llong_max"; then
3470 AC_MSG_CHECKING([for max value of long long])
3471 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003472 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003473#include <stdio.h>
3474/* Why is this so damn hard? */
3475#ifdef __GNUC__
3476# undef __GNUC__
3477#endif
3478#define __USE_ISOC99
3479#include <limits.h>
3480#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003481#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3482
3483/*
3484 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3485 * we do this the hard way.
3486 */
3487static int
3488fprint_ll(FILE *f, long long n)
3489{
3490 unsigned int i;
3491 int l[sizeof(long long) * 8];
3492
3493 if (n < 0)
3494 if (fprintf(f, "-") < 0)
3495 return -1;
3496 for (i = 0; n != 0; i++) {
3497 l[i] = my_abs(n % 10);
3498 n /= 10;
3499 }
3500 do {
3501 if (fprintf(f, "%d", l[--i]) < 0)
3502 return -1;
3503 } while (i != 0);
3504 if (fprintf(f, " ") < 0)
3505 return -1;
3506 return 0;
3507}
Tim Rice648f8762011-01-26 12:38:57 -08003508 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003509 FILE *f;
3510 long long i, llmin, llmax = 0;
3511
3512 if((f = fopen(DATA,"w")) == NULL)
3513 exit(1);
3514
3515#if defined(LLONG_MIN) && defined(LLONG_MAX)
3516 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3517 llmin = LLONG_MIN;
3518 llmax = LLONG_MAX;
3519#else
3520 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3521 /* This will work on one's complement and two's complement */
3522 for (i = 1; i > llmax; i <<= 1, i++)
3523 llmax = i;
3524 llmin = llmax + 1LL; /* wrap */
3525#endif
3526
3527 /* Sanity check */
3528 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003529 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3530 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003531 fprintf(f, "unknown unknown\n");
3532 exit(2);
3533 }
3534
Darren Tuckerd1450db2006-03-13 19:06:51 +11003535 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003536 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003537 if (fprint_ll(f, llmax) < 0)
3538 exit(4);
3539 if (fclose(f) < 0)
3540 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003541 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003542 ]])],
3543 [
3544 llong_min=`$AWK '{print $1}' conftest.llminmax`
3545 llong_max=`$AWK '{print $2}' conftest.llminmax`
3546
Tim Rice648f8762011-01-26 12:38:57 -08003547 AC_MSG_RESULT([$llong_max])
3548 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003549 [max value of long long calculated by configure])
3550 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003551 AC_MSG_RESULT([$llong_min])
3552 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003553 [min value of long long calculated by configure])
3554 ],
3555 [
Tim Rice648f8762011-01-26 12:38:57 -08003556 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003557 ],
3558 [
3559 AC_MSG_WARN([cross compiling: not checking])
3560 ]
3561 )
3562fi
3563
3564
Damien Millera22ba012000-03-02 23:09:20 +11003565# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003566AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003567 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3568 [[ u_int a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003569 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
Tim Rice648f8762011-01-26 12:38:57 -08003570 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003571])
3572if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003573 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003574 have_u_int=1
3575fi
3576
Damien Miller61e50f12000-05-08 20:49:37 +10003577AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003578 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3579 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003580 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003581 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003582])
3583if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003584 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003585 have_intxx_t=1
3586fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003587
3588if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003589 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003590then
3591 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003592 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3593 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003594 [
Tim Rice648f8762011-01-26 12:38:57 -08003595 AC_DEFINE([HAVE_INTXX_T])
3596 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003597 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003598 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003599fi
3600
Damien Miller578783e2000-09-23 14:12:24 +11003601AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003602 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003603#include <sys/types.h>
3604#ifdef HAVE_STDINT_H
3605# include <stdint.h>
3606#endif
3607#include <sys/socket.h>
3608#ifdef HAVE_SYS_BITYPES_H
3609# include <sys/bitypes.h>
3610#endif
Tim Rice648f8762011-01-26 12:38:57 -08003611 ]], [[
3612int64_t a; a = 1;
3613 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003614 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003615 ])
Damien Miller578783e2000-09-23 14:12:24 +11003616])
3617if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003618 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003619fi
3620
Damien Miller61e50f12000-05-08 20:49:37 +10003621AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003622 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3623 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003624 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003625 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003626])
3627if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003628 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003629 have_u_intxx_t=1
3630fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003631
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003632if test -z "$have_u_intxx_t" ; then
3633 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003634 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3635 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003636 [
Tim Rice648f8762011-01-26 12:38:57 -08003637 AC_DEFINE([HAVE_U_INTXX_T])
3638 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003639 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003640 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003641fi
3642
Damien Miller578783e2000-09-23 14:12:24 +11003643AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003644 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3645 [[ u_int64_t a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003646 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003647 ])
Damien Miller578783e2000-09-23 14:12:24 +11003648])
3649if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003650 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003651 have_u_int64_t=1
3652fi
3653
Damien Millerc2868192014-01-30 10:21:19 +11003654if (test -z "$have_u_int64_t" && \
3655 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3656then
Tim Rice4cec93f2002-02-26 08:40:48 -08003657 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003658 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3659 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003660 [
Tim Rice648f8762011-01-26 12:38:57 -08003661 AC_DEFINE([HAVE_U_INT64_T])
3662 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003663 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003664 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003665fi
3666
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003667if test -z "$have_u_intxx_t" ; then
3668 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003669 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003670#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003671 ]], [[
3672 uint8_t a;
3673 uint16_t b;
3674 uint32_t c;
3675 a = b = c = 1;
3676 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003677 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003678 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003679 ])
3680 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003681 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003682 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003683 fi
3684fi
3685
Damien Millerc2868192014-01-30 10:21:19 +11003686if (test -z "$have_uintxx_t" && \
3687 test "x$ac_cv_header_stdint_h" = "xyes")
3688then
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003689 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003690 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3691 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003692 [
Tim Rice648f8762011-01-26 12:38:57 -08003693 AC_DEFINE([HAVE_UINTXX_T])
3694 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003695 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003696 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003697fi
3698
Damien Millerc2868192014-01-30 10:21:19 +11003699if (test -z "$have_uintxx_t" && \
3700 test "x$ac_cv_header_inttypes_h" = "xyes")
3701then
Darren Tucker6d725682014-01-17 19:17:34 +11003702 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3703 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3704 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3705 [
3706 AC_DEFINE([HAVE_UINTXX_T])
3707 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003708 ], [ AC_MSG_RESULT([no])
Darren Tucker6d725682014-01-17 19:17:34 +11003709 ])
3710fi
3711
Damien Milleredb82922000-06-20 13:25:52 +10003712if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003713 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003714then
3715 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003716 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003717#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003718 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003719 int8_t a; int16_t b; int32_t c;
3720 u_int8_t e; u_int16_t f; u_int32_t g;
3721 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003722 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003723 [
Tim Rice648f8762011-01-26 12:38:57 -08003724 AC_DEFINE([HAVE_U_INTXX_T])
3725 AC_DEFINE([HAVE_INTXX_T])
3726 AC_MSG_RESULT([yes])
3727 ], [AC_MSG_RESULT([no])
3728 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003729fi
3730
Damien Miller58be7382001-09-15 21:31:54 +10003731
3732AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003733 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3734 [[ u_char foo; foo = 125; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003735 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
Tim Rice648f8762011-01-26 12:38:57 -08003736 ])
Damien Miller58be7382001-09-15 21:31:54 +10003737])
3738if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003739 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003740fi
3741
Darren Tucker007e3b32013-11-03 18:43:55 +11003742AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3743#include <sys/types.h>
3744#include <stdint.h>
3745])
3746
Tim Rice13aae5e2001-10-21 17:53:58 -07003747TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003748
Tim Rice648f8762011-01-26 12:38:57 -08003749AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3750AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003751#include <sys/types.h>
3752#ifdef HAVE_SYS_BITYPES_H
3753#include <sys/bitypes.h>
3754#endif
3755#ifdef HAVE_SYS_STATFS_H
3756#include <sys/statfs.h>
3757#endif
3758#ifdef HAVE_SYS_STATVFS_H
3759#include <sys/statvfs.h>
3760#endif
3761])
Tim Rice4cec93f2002-02-26 08:40:48 -08003762
Darren Tucker11057562018-02-25 11:22:57 +11003763AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
3764#include <sys/types.h>
3765#ifdef HAVE_SYS_BITYPES_H
3766#include <sys/bitypes.h>
3767#endif
3768#ifdef HAVE_SYS_STATFS_H
3769#include <sys/statfs.h>
3770#endif
3771#ifdef HAVE_SYS_STATVFS_H
3772#include <sys/statvfs.h>
3773#endif
3774#ifdef HAVE_SYS_VFS_H
3775#include <sys/vfs.h>
3776#endif
3777]])
3778
3779
Tim Rice648f8762011-01-26 12:38:57 -08003780AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003781[#include <sys/types.h>
3782#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003783
Damien Miller61e50f12000-05-08 20:49:37 +10003784AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003785 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3786 [[ size_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003787 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003788 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003789])
3790if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003791 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003792fi
Damien Miller95058511999-12-29 10:36:45 +11003793
Damien Miller615f9392000-05-17 22:53:33 +10003794AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003795 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3796 [[ ssize_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003797 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003798 ])
Damien Miller615f9392000-05-17 22:53:33 +10003799])
3800if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003801 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003802fi
3803
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003804AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003805 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3806 [[ clock_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003807 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003808 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003809])
3810if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003811 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003812fi
3813
Damien Millerb54b40e2000-06-23 08:23:34 +10003814AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003815 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003816#include <sys/types.h>
3817#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003818 ]], [[ sa_family_t foo; foo = 1235; ]])],
3819 [ ac_cv_have_sa_family_t="yes" ],
3820 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003821#include <sys/types.h>
3822#include <sys/socket.h>
3823#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003824 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003825 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003826 [ ac_cv_have_sa_family_t="no" ]
3827 )
Tim Rice648f8762011-01-26 12:38:57 -08003828 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003829])
3830if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003831 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003832 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003833fi
3834
Damien Miller0f91b4e2000-06-18 15:43:25 +10003835AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003836 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3837 [[ pid_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003838 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003839 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003840])
3841if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003842 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003843fi
3844
3845AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3847 [[ mode_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003848 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003849 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003850])
3851if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003852 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003853fi
3854
Damien Miller61e50f12000-05-08 20:49:37 +10003855
3856AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003857 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003858#include <sys/types.h>
3859#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003860 ]], [[ struct sockaddr_storage s; ]])],
3861 [ ac_cv_have_struct_sockaddr_storage="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003862 [ ac_cv_have_struct_sockaddr_storage="no"
Tim Rice648f8762011-01-26 12:38:57 -08003863 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003864])
3865if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003866 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003867 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003868fi
Damien Miller34132e52000-01-14 15:45:46 +11003869
Damien Miller61e50f12000-05-08 20:49:37 +10003870AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003871 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003872#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003873#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003874 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3875 [ ac_cv_have_struct_sockaddr_in6="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003876 [ ac_cv_have_struct_sockaddr_in6="no"
Tim Rice648f8762011-01-26 12:38:57 -08003877 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003878])
3879if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003880 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003881 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003882fi
Damien Miller34132e52000-01-14 15:45:46 +11003883
Damien Miller61e50f12000-05-08 20:49:37 +10003884AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003885 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003886#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003887#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003888 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3889 [ ac_cv_have_struct_in6_addr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003890 [ ac_cv_have_struct_in6_addr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003891 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003892])
3893if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003894 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003895 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003896
3897dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003898 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003899 [
3900#ifdef HAVE_SYS_TYPES_H
3901#include <sys/types.h>
3902#endif
3903#include <netinet/in.h>
3904 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003905fi
Damien Miller34132e52000-01-14 15:45:46 +11003906
Damien Miller61e50f12000-05-08 20:49:37 +10003907AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003908 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003909#include <sys/types.h>
3910#include <sys/socket.h>
3911#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003912 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3913 [ ac_cv_have_struct_addrinfo="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003914 [ ac_cv_have_struct_addrinfo="no"
Tim Rice648f8762011-01-26 12:38:57 -08003915 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003916])
3917if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003918 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003919 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003920fi
3921
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003922AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003923 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3924 [[ struct timeval tv; tv.tv_sec = 1;]])],
3925 [ ac_cv_have_struct_timeval="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003926 [ ac_cv_have_struct_timeval="no"
Tim Rice648f8762011-01-26 12:38:57 -08003927 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003928])
3929if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003930 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003931 have_struct_timeval=1
3932fi
3933
Tim Rice648f8762011-01-26 12:38:57 -08003934AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003935
Damien Miller10479cc2018-04-10 10:19:02 +10003936# We need int64_t or else certain parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003937if test "x$ac_cv_have_int64_t" = "xno" && \
3938 test "x$ac_cv_sizeof_long_int" != "x8" && \
3939 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003940 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3941 echo "an alternative compiler (I.E., GCC) before continuing."
3942 echo ""
3943 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003944else
3945dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003946 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003947 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003948#include <stdio.h>
3949#include <string.h>
3950#ifdef HAVE_SNPRINTF
3951main()
3952{
3953 char buf[50];
3954 char expected_out[50];
3955 int mazsize = 50 ;
3956#if (SIZEOF_LONG_INT == 8)
3957 long int num = 0x7fffffffffffffff;
3958#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003959 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003960#endif
3961 strcpy(expected_out, "9223372036854775807");
3962 snprintf(buf, mazsize, "%lld", num);
3963 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003964 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003965 exit(0);
3966}
3967#else
3968main() { exit(0); }
3969#endif
Tim Rice648f8762011-01-26 12:38:57 -08003970 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003971 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003972 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003973fi
3974
Damien Miller78315eb2000-09-29 23:01:36 +11003975dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003976OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3977OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3978OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3979OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3980OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3981OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3982OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3983OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3984OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3985OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3986OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3987OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3988OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3989OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3990OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3991OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3992OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003993
3994AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Millerbcd14852017-06-10 23:41:25 +10003995AC_CHECK_MEMBERS([struct stat.st_mtim])
3996AC_CHECK_MEMBERS([struct stat.st_mtime])
Damien Miller6332da22013-04-23 14:25:52 +10003997AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3998struct passwd.pw_change, struct passwd.pw_expire],
3999[], [], [[
4000#include <sys/types.h>
4001#include <pwd.h>
4002]])
4003
Tim Rice648f8762011-01-26 12:38:57 -08004004AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11004005 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10004006[[
Darren Tucker58e298d2005-11-25 13:14:58 +11004007#include <stdio.h>
4008#if HAVE_SYS_TYPES_H
4009# include <sys/types.h>
4010#endif
4011#include <netinet/in.h>
4012#include <arpa/nameser.h>
4013#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10004014]])
andre2ff7b5d2000-06-03 14:57:40 +00004015
Damien Miller61e50f12000-05-08 20:49:37 +10004016AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
4017 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004018 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004019#include <sys/types.h>
4020#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004021 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
4022 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
4023 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10004024])
4025if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004026 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004027fi
4028
Damien Miller61e50f12000-05-08 20:49:37 +10004029AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
4030 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004031 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004032#include <sys/types.h>
4033#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004034 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
4035 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004036 [ ac_cv_have___ss_family_in_struct_ss="no"
Tim Rice648f8762011-01-26 12:38:57 -08004037 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004038])
4039if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004040 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004041 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004042fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11004043
Tim Rice28bbb0c2002-05-27 17:37:32 -07004044dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00004045AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
4046 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004047 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004048#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00004049#include <sys/socket.h>
4050#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004051 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004052#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10004053#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004054exit(1);
4055#endif
4056struct msghdr m;
4057m.msg_accrights = 0;
4058exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004059 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00004060 [ ac_cv_have_accrights_in_msghdr="yes" ],
4061 [ ac_cv_have_accrights_in_msghdr="no" ]
4062 )
4063])
4064if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004065 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004066 [Define if your system uses access rights style
4067 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00004068fi
4069
Tim Rice648f8762011-01-26 12:38:57 -08004070AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
4071AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10004072#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10004073#include <sys/stat.h>
4074#ifdef HAVE_SYS_TIME_H
4075# include <sys/time.h>
4076#endif
4077#ifdef HAVE_SYS_MOUNT_H
4078#include <sys/mount.h>
4079#endif
4080#ifdef HAVE_SYS_STATVFS_H
4081#include <sys/statvfs.h>
4082#endif
Tim Rice648f8762011-01-26 12:38:57 -08004083 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
4084 [ AC_MSG_RESULT([yes]) ],
4085 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10004086
Tim Rice648f8762011-01-26 12:38:57 -08004087 AC_MSG_CHECKING([if fsid_t has member val])
4088 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004089#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004090#include <sys/statvfs.h>
4091 ]], [[ fsid_t t; t.val[0] = 0; ]])],
4092 [ AC_MSG_RESULT([yes])
4093 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
4094 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004095
Tim Rice648f8762011-01-26 12:38:57 -08004096 AC_MSG_CHECKING([if f_fsid has member __val])
4097 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004098#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004099#include <sys/statvfs.h>
4100 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
4101 [ AC_MSG_RESULT([yes])
4102 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
4103 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004104])
Darren Tucker77001382008-06-09 06:17:53 +10004105
Kevin Stevesa44e0352002-04-07 16:18:03 +00004106AC_CACHE_CHECK([for msg_control field in struct msghdr],
4107 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004108 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004109#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00004110#include <sys/socket.h>
4111#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004112 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004113#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10004114#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004115exit(1);
4116#endif
4117struct msghdr m;
4118m.msg_control = 0;
4119exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004120 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00004121 [ ac_cv_have_control_in_msghdr="yes" ],
4122 [ ac_cv_have_control_in_msghdr="no" ]
4123 )
4124])
4125if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004126 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004127 [Define if your system uses ancillary data style
4128 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00004129fi
4130
Damien Miller61e50f12000-05-08 20:49:37 +10004131AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08004132 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4133 [[ extern char *__progname; printf("%s", __progname); ]])],
4134 [ ac_cv_libc_defines___progname="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004135 [ ac_cv_libc_defines___progname="no"
Tim Rice648f8762011-01-26 12:38:57 -08004136 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004137])
4138if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004139 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10004140fi
4141
Kevin Steves4846f4a2002-03-22 18:19:53 +00004142AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08004143 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4144 [[ printf("%s", __FUNCTION__); ]])],
4145 [ ac_cv_cc_implements___FUNCTION__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004146 [ ac_cv_cc_implements___FUNCTION__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004147 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004148])
4149if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004150 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004151 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004152fi
4153
4154AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08004155 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4156 [[ printf("%s", __func__); ]])],
4157 [ ac_cv_cc_implements___func__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004158 [ ac_cv_cc_implements___func__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004159 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004160])
4161if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004162 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004163fi
4164
Damien Miller57f39152005-11-24 19:58:19 +11004165AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004166 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4167#include <stdarg.h>
4168va_list x,y;
4169 ]], [[ va_copy(x,y); ]])],
4170 [ ac_cv_have_va_copy="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004171 [ ac_cv_have_va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004172 ])
Damien Miller57f39152005-11-24 19:58:19 +11004173])
4174if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004175 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004176fi
4177
4178AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004179 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4180#include <stdarg.h>
4181va_list x,y;
4182 ]], [[ __va_copy(x,y); ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07004183 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004184 ])
Damien Miller57f39152005-11-24 19:58:19 +11004185])
4186if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004187 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004188fi
4189
Damien Miller4f8e6692001-07-14 13:22:53 +10004190AC_CACHE_CHECK([whether getopt has optreset support],
4191 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08004192 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
4193 [[ extern int optreset; optreset = 0; ]])],
4194 [ ac_cv_have_getopt_optreset="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004195 [ ac_cv_have_getopt_optreset="no"
Tim Rice648f8762011-01-26 12:38:57 -08004196 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10004197])
4198if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004199 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004200 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10004201fi
Damien Millera22ba012000-03-02 23:09:20 +11004202
Damien Millerecbb26d2000-07-15 14:59:14 +10004203AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08004204 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4205[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
4206 [ ac_cv_libc_defines_sys_errlist="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004207 [ ac_cv_libc_defines_sys_errlist="no"
Tim Rice648f8762011-01-26 12:38:57 -08004208 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10004209])
4210if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004211 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004212 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10004213fi
4214
4215
Damien Miller11fa2cc2000-08-16 10:35:58 +10004216AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08004217 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4218[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
4219 [ ac_cv_libc_defines_sys_nerr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004220 [ ac_cv_libc_defines_sys_nerr="no"
Tim Rice648f8762011-01-26 12:38:57 -08004221 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004222])
4223if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004224 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004225fi
4226
Darren Tucker5f88d342003-10-15 16:57:57 +10004227# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08004228AC_SEARCH_LIBS([getrrsetbyname], [resolv],
4229 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004230 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10004231 [
Darren Tucker5f88d342003-10-15 16:57:57 +10004232 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08004233 AC_SEARCH_LIBS([res_query], [resolv])
4234 AC_SEARCH_LIBS([dn_expand], [resolv])
4235 AC_MSG_CHECKING([if res_query will link])
4236 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004237#include <sys/types.h>
4238#include <netinet/in.h>
4239#include <arpa/nameser.h>
4240#include <netdb.h>
4241#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004242 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004243 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004244 ]])],
4245 AC_MSG_RESULT([yes]),
4246 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10004247 saved_LIBS="$LIBS"
4248 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08004249 AC_MSG_CHECKING([for res_query in -lresolv])
4250 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004251#include <sys/types.h>
4252#include <netinet/in.h>
4253#include <arpa/nameser.h>
4254#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10004255#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004256 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10004257 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004258 ]])],
4259 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10004260 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004261 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10004262 ])
Tim Rice648f8762011-01-26 12:38:57 -08004263 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10004264 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07004265 [#include <sys/types.h>
4266 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08004267 AC_CHECK_MEMBER([HEADER.ad],
4268 [AC_DEFINE([HAVE_HEADER_AD], [1],
4269 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10004270 [#include <arpa/nameser.h>])
4271 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10004272
Tim Rice648f8762011-01-26 12:38:57 -08004273AC_MSG_CHECKING([if struct __res_state _res is an extern])
4274AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004275#include <stdio.h>
4276#if HAVE_SYS_TYPES_H
4277# include <sys/types.h>
4278#endif
4279#include <netinet/in.h>
4280#include <arpa/nameser.h>
4281#include <resolv.h>
4282extern struct __res_state _res;
Darren Tucker7ad8b282015-09-11 13:11:02 +10004283 ]], [[
4284struct __res_state *volatile p = &_res; /* force resolution of _res */
4285return 0;
4286 ]],)],
Tim Rice648f8762011-01-26 12:38:57 -08004287 [AC_MSG_RESULT([yes])
4288 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004289 [Define if you have struct __res_state _res as an extern])
4290 ],
Tim Rice648f8762011-01-26 12:38:57 -08004291 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004292)
4293
Damien Miller73b42d22006-04-22 21:26:08 +10004294# Check whether user wants SELinux support
4295SELINUX_MSG="no"
4296LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08004297AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11004298 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10004299 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10004300 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004301 AC_DEFINE([WITH_SELINUX], [1],
4302 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10004303 SELINUX_MSG="yes"
4304 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08004305 AC_MSG_ERROR([SELinux support requires selinux.h header]))
4306 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11004307 [ LIBSELINUX="-lselinux"
4308 LIBS="$LIBS -lselinux"
4309 ],
Tim Rice648f8762011-01-26 12:38:57 -08004310 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11004311 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10004312 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08004313 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10004314 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10004315 fi ]
4316)
Tim Rice648f8762011-01-26 12:38:57 -08004317AC_SUBST([SSHLIBS])
4318AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10004319
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004320# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11004321KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004322AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11004323 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11004324 [ if test "x$withval" != "xno" ; then
4325 if test "x$withval" = "xyes" ; then
4326 KRB5ROOT="/usr/local"
4327 else
4328 KRB5ROOT=${withval}
4329 fi
4330
Tim Rice648f8762011-01-26 12:38:57 -08004331 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004332 KRB5_MSG="yes"
4333
Darren Tucker4089fc12016-12-08 12:57:24 +11004334 AC_PATH_TOOL([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10004335 [$KRB5ROOT/bin/krb5-config],
4336 [$KRB5ROOT/bin:$PATH])
4337 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11004338 K5CFLAGS="`$KRB5CONF --cflags`"
4339 K5LIBS="`$KRB5CONF --libs`"
4340 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004341
Tim Rice648f8762011-01-26 12:38:57 -08004342 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004343 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08004344 AC_MSG_RESULT([yes])
4345 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004346 [Define this if you want GSSAPI
4347 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11004348 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
4349 GSSLIBS="`$KRB5CONF --libs gssapi`"
4350 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11004351 else
Tim Rice648f8762011-01-26 12:38:57 -08004352 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004353 fi
Tim Rice648f8762011-01-26 12:38:57 -08004354 AC_MSG_CHECKING([whether we are using Heimdal])
4355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4356 ]], [[ char *tmp = heimdal_version; ]])],
4357 [ AC_MSG_RESULT([yes])
4358 AC_DEFINE([HEIMDAL], [1],
4359 [Define this if you are using the Heimdal
4360 version of Kerberos V5]) ],
4361 [AC_MSG_RESULT([no])
4362 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004363 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004364 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11004365 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08004366 AC_MSG_CHECKING([whether we are using Heimdal])
4367 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4368 ]], [[ char *tmp = heimdal_version; ]])],
4369 [ AC_MSG_RESULT([yes])
4370 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11004371 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10004372 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08004373 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10004374 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08004375 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11004376 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08004377 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004378 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08004379 ])
4380 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004381
Tim Rice648f8762011-01-26 12:38:57 -08004382 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
4383 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004384 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08004385 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
4386 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004387 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11004388 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
4389 [ AC_DEFINE([GSSAPI])
4390 GSSLIBS="-lgss" ],
4391 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
4392 ])
Darren Tucker964de182013-02-22 10:39:59 +11004393 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08004394
Tim Rice648f8762011-01-26 12:38:57 -08004395 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004396 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11004397 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004398 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004399 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11004400 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004401 ]
4402 )
4403
4404 oldCPP="$CPPFLAGS"
4405 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004406 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004407 [ CPPFLAGS="$oldCPP" ])
4408
Damien Millera8e06ce2003-11-21 23:48:55 +11004409 fi
Darren Tucker2f0bad22019-01-21 21:28:27 +11004410 if test -n "${rpath_opt}" ; then
4411 LDFLAGS="$LDFLAGS ${rpath_opt}${KRB5ROOT}/lib"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004412 fi
4413 if test ! -z "$blibpath" ; then
4414 blibpath="$blibpath:${KRB5ROOT}/lib"
4415 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004416
Tim Rice648f8762011-01-26 12:38:57 -08004417 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4418 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4419 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004420
Tim Rice648f8762011-01-26 12:38:57 -08004421 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4422 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004423
4424 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4425#ifdef HAVE_GSSAPI_H
4426# include <gssapi.h>
4427#elif defined(HAVE_GSSAPI_GSSAPI_H)
4428# include <gssapi/gssapi.h>
4429#endif
4430
4431#ifdef HAVE_GSSAPI_GENERIC_H
4432# include <gssapi_generic.h>
4433#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4434# include <gssapi/gssapi_generic.h>
4435#endif
4436 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004437 saved_LIBS="$LIBS"
4438 LIBS="$LIBS $K5LIBS"
4439 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4440 LIBS="$saved_LIBS"
4441
Darren Tucker0d27ed12004-02-24 10:37:33 +11004442 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004443 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004444)
Darren Tucker964de182013-02-22 10:39:59 +11004445AC_SUBST([GSSLIBS])
4446AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004447
Damien Millera22ba012000-03-02 23:09:20 +11004448# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004449
Damien Millerf58c6722002-05-13 13:15:42 +10004450PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004451AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004452 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004453 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004454 if test -n "$withval" && test "x$withval" != "xno" && \
4455 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004456 PRIVSEP_PATH=$withval
4457 fi
4458 ]
4459)
Tim Rice648f8762011-01-26 12:38:57 -08004460AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004461
Tim Rice648f8762011-01-26 12:38:57 -08004462AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004463 [ --with-xauth=PATH Specify path to xauth program ],
4464 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004465 if test -n "$withval" && test "x$withval" != "xno" && \
4466 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004467 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004468 fi
4469 ],
4470 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004471 TestPath="$PATH"
4472 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4473 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4474 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4475 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004476 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004477 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004478 xauth_path="/usr/openwin/bin/xauth"
4479 fi
4480 ]
4481)
4482
Damien Miller7d901272003-01-13 16:55:22 +11004483STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004484AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004485 [ --disable-strip Disable calling strip(1) on install],
4486 [
4487 if test "x$enableval" = "xno" ; then
4488 STRIP_OPT=
4489 fi
4490 ]
4491)
Tim Rice648f8762011-01-26 12:38:57 -08004492AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004493
Damien Millera19cf472000-11-29 13:28:50 +11004494if test -z "$xauth_path" ; then
4495 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004496 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004497else
Tim Rice648f8762011-01-26 12:38:57 -08004498 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004499 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004500 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004501 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004502fi
Damien Millera22ba012000-03-02 23:09:20 +11004503
Tim Rice90f42b02011-06-02 18:17:49 -07004504dnl # --with-maildir=/path/to/mail gets top priority.
4505dnl # if maildir is set in the platform case statement above we use that.
4506dnl # Otherwise we run a program to get the dir from system headers.
4507dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4508dnl # If we find _PATH_MAILDIR we do nothing because that is what
4509dnl # session.c expects anyway. Otherwise we set to the value found
4510dnl # stripping any trailing slash. If for some strage reason our program
4511dnl # does not find what it needs, we default to /var/spool/mail.
4512# Check for mail directory
4513AC_ARG_WITH([maildir],
4514 [ --with-maildir=/path/to/mail Specify your system mail directory],
4515 [
4516 if test "X$withval" != X && test "x$withval" != xno && \
4517 test "x${withval}" != xyes; then
4518 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4519 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4520 fi
4521 ],[
4522 if test "X$maildir" != "X"; then
4523 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4524 else
4525 AC_MSG_CHECKING([Discovering system mail directory])
4526 AC_RUN_IFELSE(
4527 [AC_LANG_PROGRAM([[
4528#include <stdio.h>
4529#include <string.h>
4530#ifdef HAVE_PATHS_H
4531#include <paths.h>
4532#endif
4533#ifdef HAVE_MAILLOCK_H
4534#include <maillock.h>
4535#endif
4536#define DATA "conftest.maildir"
4537 ]], [[
4538 FILE *fd;
4539 int rc;
4540
4541 fd = fopen(DATA,"w");
4542 if(fd == NULL)
4543 exit(1);
4544
4545#if defined (_PATH_MAILDIR)
4546 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4547 exit(1);
4548#elif defined (MAILDIR)
4549 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4550 exit(1);
4551#elif defined (_PATH_MAIL)
4552 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4553 exit(1);
4554#else
4555 exit (2);
4556#endif
4557
4558 exit(0);
4559 ]])],
4560 [
Tim Ricee1d93702016-05-31 11:13:22 -07004561 maildir_what=`awk -F: '{print $1}' conftest.maildir`
Tim Rice90f42b02011-06-02 18:17:49 -07004562 maildir=`awk -F: '{print $2}' conftest.maildir \
4563 | sed 's|/$||'`
4564 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4565 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4566 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4567 fi
4568 ],
4569 [
4570 if test "X$ac_status" = "X2";then
4571# our test program didn't find it. Default to /var/spool/mail
4572 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4573 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4574 else
4575 AC_MSG_RESULT([*** not found ***])
4576 fi
4577 ],
4578 [
4579 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4580 ]
4581 )
4582 fi
4583 ]
4584) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004585
Darren Tucker623d92f2004-09-12 22:36:15 +10004586if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004587 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4588 disable_ptmx_check=yes
4589fi
Damien Millera22ba012000-03-02 23:09:20 +11004590if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004591 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004592 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004593 [
Tim Rice648f8762011-01-26 12:38:57 -08004594 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004595 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004596 have_dev_ptmx=1
4597 ]
4598 )
4599 fi
Damien Millera22ba012000-03-02 23:09:20 +11004600fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004601
Darren Tucker623d92f2004-09-12 22:36:15 +10004602if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004603 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004604 [
Tim Rice648f8762011-01-26 12:38:57 -08004605 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004606 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004607 have_dev_ptc=1
4608 ]
4609 )
4610else
4611 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4612fi
Damien Miller204ad072000-03-02 23:56:12 +11004613
Damien Millera22ba012000-03-02 23:09:20 +11004614# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004615AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004616 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004617 [
Damien Miller897741e2001-04-16 10:41:46 +10004618 case "$withval" in
4619 man|cat|doc)
4620 MANTYPE=$withval
4621 ;;
4622 *)
Tim Rice648f8762011-01-26 12:38:57 -08004623 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004624 ;;
4625 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004626 ]
4627)
Ben Lindstrombc709922001-04-18 18:04:21 +00004628if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004629 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004630 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004631 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4632 MANTYPE=doc
4633 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4634 MANTYPE=man
4635 else
4636 MANTYPE=cat
4637 fi
4638fi
Tim Rice648f8762011-01-26 12:38:57 -08004639AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004640if test "$MANTYPE" = "doc"; then
4641 mansubdir=man;
4642else
4643 mansubdir=$MANTYPE;
4644fi
Tim Rice648f8762011-01-26 12:38:57 -08004645AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004646
Damien Millera22ba012000-03-02 23:09:20 +11004647# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004648MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004649AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004650 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004651 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004652 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004653 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004654 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004655 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004656 fi
4657 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004658)
4659
Damien Millera22ba012000-03-02 23:09:20 +11004660# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004661AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004662 [ --without-shadow Disable shadow password support],
4663 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004664 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004665 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004666 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004667 fi
4668 ]
4669)
4670
Damien Miller1f335fb2000-06-26 11:31:33 +10004671if test -z "$disable_shadow" ; then
4672 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004673 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004674#include <sys/types.h>
4675#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004676struct spwd sp;
4677 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4678 [ sp_expire_available=yes ], [
4679 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004680
4681 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004682 AC_MSG_RESULT([yes])
4683 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004684 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004685 else
Tim Rice648f8762011-01-26 12:38:57 -08004686 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004687 fi
4688fi
4689
Damien Millera22ba012000-03-02 23:09:20 +11004690# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004691if test ! -z "$IPADDR_IN_DISPLAY" ; then
4692 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004693 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004694 [Define if you need to use IP address
4695 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004696else
Damien Millera8e06ce2003-11-21 23:48:55 +11004697 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004698 AC_ARG_WITH([ipaddr-display],
Tim Rice6397eed2015-06-03 21:41:11 -07004699 [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY],
Damien Miller9a947342000-08-30 10:03:33 +11004700 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004701 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004702 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004703 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004704 fi
4705 ]
4706 )
4707fi
Damien Miller76112de1999-12-21 11:18:08 +11004708
Darren Tuckere1a790d2003-09-16 11:52:19 +10004709# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004710AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004711 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004712 [ if test "x$enableval" = "xno"; then
4713 AC_MSG_NOTICE([/etc/default/login handling disabled])
4714 etc_default_login=no
4715 else
4716 etc_default_login=yes
4717 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004718 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4719 then
4720 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4721 etc_default_login=no
4722 else
4723 etc_default_login=yes
4724 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004725)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004726
Darren Tucker2f9573d2005-02-10 22:28:54 +11004727if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004728 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004729 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004730 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004731 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004732 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004733 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004734fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004735
Tim Rice43a1c132002-04-17 21:19:14 -07004736dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004737if test $ac_cv_func_login_getcapbool = "yes" && \
4738 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004739 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004740fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004741
Damien Millera22ba012000-03-02 23:09:20 +11004742# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004743SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004744AC_ARG_WITH([default-path],
Tim Rice6397eed2015-06-03 21:41:11 -07004745 [ --with-default-path= Specify default $PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004746 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004747 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004748 AC_MSG_WARN([
4749--with-default-path=PATH has no effect on this system.
4750Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004751 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004752 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004753 AC_MSG_WARN([
4754--with-default-path=PATH will only be used if PATH is not defined in
4755$external_path_file .])
4756 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004757 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004758 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004759 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004760 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004761 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4762 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004763 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004764 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004765 AC_MSG_WARN([
4766If PATH is defined in $external_path_file, ensure the path to scp is included,
4767otherwise scp will not work.])
4768 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004769 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004770 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004771/* find out what STDPATH is */
4772#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004773#ifdef HAVE_PATHS_H
4774# include <paths.h>
4775#endif
4776#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004777# ifdef _PATH_USERPATH /* Irix */
4778# define _PATH_STDPATH _PATH_USERPATH
4779# else
4780# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4781# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004782#endif
4783#include <sys/types.h>
4784#include <sys/stat.h>
4785#include <fcntl.h>
4786#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004787 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004788 FILE *fd;
4789 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004790
Tim Rice59ea0a02001-03-10 13:50:45 -08004791 fd = fopen(DATA,"w");
4792 if(fd == NULL)
4793 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004794
Tim Rice59ea0a02001-03-10 13:50:45 -08004795 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4796 exit(1);
4797
4798 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004799 ]])],
4800 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004801 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4802 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4803 )
4804# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004805 t_bindir="${bindir}"
4806 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4807 t_bindir=`eval echo ${t_bindir}`
4808 case $t_bindir in
4809 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4810 esac
4811 case $t_bindir in
4812 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4813 esac
4814 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004815 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4816 if test $? -ne 0 ; then
4817 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4818 if test $? -ne 0 ; then
4819 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004820 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004821 fi
4822 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004823 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004824)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004825if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004826 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4827 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004828fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004829
Damien Millera18bbd32002-05-13 10:48:57 +10004830# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004831AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004832 [ --with-superuser-path= Specify different path for super-user],
4833 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004834 if test -n "$withval" && test "x$withval" != "xno" && \
4835 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004836 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004837 [Define if you want a different $PATH
4838 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004839 superuser_path=$withval
4840 fi
4841 ]
4842)
4843
4844
Damien Miller61e50f12000-05-08 20:49:37 +10004845AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004846IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004847AC_ARG_WITH(4in6,
4848 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4849 [
4850 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004851 AC_MSG_RESULT([yes])
4852 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004853 [Detect IPv4 in IPv6 mapped addresses
4854 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004855 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004856 else
Tim Rice648f8762011-01-26 12:38:57 -08004857 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004858 fi
Tim Rice648f8762011-01-26 12:38:57 -08004859 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004860 if test "x$inet6_default_4in6" = "xyes"; then
4861 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004862 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004863 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004864 else
4865 AC_MSG_RESULT([no (default)])
4866 fi
4867 ]
4868)
4869
Damien Miller60396b02001-02-18 17:01:00 +11004870# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004871BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004872AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004873 [ --with-bsd-auth Enable BSD auth support],
4874 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004875 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004876 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004877 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004878 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004879 fi
4880 ]
4881)
4882
Damien Millera22ba012000-03-02 23:09:20 +11004883# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004884piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004885# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004886if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004887 piddir=`eval echo ${sysconfdir}`
4888 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004889 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004890 esac
4891fi
4892
Tim Rice648f8762011-01-26 12:38:57 -08004893AC_ARG_WITH([pid-dir],
Darren Tucker075e2582018-02-13 17:36:43 +11004894 [ --with-pid-dir=PATH Specify location of sshd.pid file],
Tim Rice88f2ab52002-03-17 12:17:34 -08004895 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004896 if test -n "$withval" && test "x$withval" != "xno" && \
4897 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004898 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004899 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004900 AC_MSG_WARN([** no $piddir directory on this system **])
4901 fi
4902 fi
4903 ]
4904)
4905
Tim Ricee1d93702016-05-31 11:13:22 -07004906AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
Tim Rice648f8762011-01-26 12:38:57 -08004907 [Specify location of ssh.pid])
4908AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004909
andre2ff7b5d2000-06-03 14:57:40 +00004910dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004911AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004912 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004913 [
4914 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004915 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004916 fi
4917 ]
andre2ff7b5d2000-06-03 14:57:40 +00004918)
Tim Rice648f8762011-01-26 12:38:57 -08004919AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004920 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004921 [
4922 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004923 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004924 fi
4925 ]
andre2ff7b5d2000-06-03 14:57:40 +00004926)
Tim Rice648f8762011-01-26 12:38:57 -08004927AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004928 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004929 [
4930 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004931 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004932 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004933 fi
4934 ]
andre2ff7b5d2000-06-03 14:57:40 +00004935)
Tim Rice648f8762011-01-26 12:38:57 -08004936AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004937 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004938 [
4939 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004940 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004941 fi
4942 ]
andre2ff7b5d2000-06-03 14:57:40 +00004943)
Tim Rice648f8762011-01-26 12:38:57 -08004944AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004945 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004946 [
4947 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004948 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004949 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004950 fi
4951 ]
andre2ff7b5d2000-06-03 14:57:40 +00004952)
Tim Rice648f8762011-01-26 12:38:57 -08004953AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004954 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004955 [
4956 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004957 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004958 fi
4959 ]
andre2ff7b5d2000-06-03 14:57:40 +00004960)
Tim Rice648f8762011-01-26 12:38:57 -08004961AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004962 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004963 [
4964 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004965 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004966 [Define if you don't want to use pututline()
4967 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004968 fi
4969 ]
andre2ff7b5d2000-06-03 14:57:40 +00004970)
Tim Rice648f8762011-01-26 12:38:57 -08004971AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004972 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004973 [
4974 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004975 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004976 [Define if you don't want to use pututxline()
4977 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004978 fi
4979 ]
andre2ff7b5d2000-06-03 14:57:40 +00004980)
Tim Rice648f8762011-01-26 12:38:57 -08004981AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004982 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004983 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004984 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004985 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004986 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004987 conf_lastlog_location=$withval
4988 fi
4989 ]
4990)
andre2ff7b5d2000-06-03 14:57:40 +00004991
4992dnl lastlog, [uw]tmpx? detection
4993dnl NOTE: set the paths in the platform section to avoid the
4994dnl need for command-line parameters
4995dnl lastlog and [uw]tmp are subject to a file search if all else fails
4996
4997dnl lastlog detection
4998dnl NOTE: the code itself will detect if lastlog is a directory
4999AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005000AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005001#include <sys/types.h>
5002#include <utmp.h>
5003#ifdef HAVE_LASTLOG_H
5004# include <lastlog.h>
5005#endif
Damien Miller2994e082000-06-04 15:51:47 +10005006#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005007# include <paths.h>
5008#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00005009#ifdef HAVE_LOGIN_H
5010# include <login.h>
5011#endif
Tim Rice648f8762011-01-26 12:38:57 -08005012 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
5013 [ AC_MSG_RESULT([yes]) ],
5014 [
5015 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005016 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08005017 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10005018#include <sys/types.h>
5019#include <utmp.h>
5020#ifdef HAVE_LASTLOG_H
5021# include <lastlog.h>
5022#endif
5023#ifdef HAVE_PATHS_H
5024# include <paths.h>
5025#endif
Tim Rice648f8762011-01-26 12:38:57 -08005026 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
5027 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10005028 [
Tim Rice648f8762011-01-26 12:38:57 -08005029 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005030 system_lastlog_path=no
5031 ])
Tim Rice648f8762011-01-26 12:38:57 -08005032])
Damien Miller2994e082000-06-04 15:51:47 +10005033
andre2ff7b5d2000-06-03 14:57:40 +00005034if test -z "$conf_lastlog_location"; then
5035 if test x"$system_lastlog_path" = x"no" ; then
5036 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10005037 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00005038 conf_lastlog_location=$f
5039 fi
5040 done
5041 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00005042 AC_MSG_WARN([** Cannot find lastlog **])
5043 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00005044 fi
5045 fi
5046fi
5047
5048if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005049 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005050 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005051fi
andre2ff7b5d2000-06-03 14:57:40 +00005052
5053dnl utmp detection
5054AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005055AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005056#include <sys/types.h>
5057#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005058#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005059# include <paths.h>
5060#endif
Tim Rice648f8762011-01-26 12:38:57 -08005061 ]], [[ char *utmp = UTMP_FILE; ]])],
5062 [ AC_MSG_RESULT([yes]) ],
5063 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005064 system_utmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005065])
andre2ff7b5d2000-06-03 14:57:40 +00005066if test -z "$conf_utmp_location"; then
5067 if test x"$system_utmp_path" = x"no" ; then
5068 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
5069 if test -f $f ; then
5070 conf_utmp_location=$f
5071 fi
5072 done
5073 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005074 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005075 fi
5076 fi
5077fi
5078if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005079 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005080 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005081fi
andre2ff7b5d2000-06-03 14:57:40 +00005082
5083dnl wtmp detection
5084AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005085AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005086#include <sys/types.h>
5087#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005088#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005089# include <paths.h>
5090#endif
Tim Rice648f8762011-01-26 12:38:57 -08005091 ]], [[ char *wtmp = WTMP_FILE; ]])],
5092 [ AC_MSG_RESULT([yes]) ],
5093 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005094 system_wtmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005095])
andre2ff7b5d2000-06-03 14:57:40 +00005096if test -z "$conf_wtmp_location"; then
5097 if test x"$system_wtmp_path" = x"no" ; then
5098 for f in /usr/adm/wtmp /var/log/wtmp; do
5099 if test -f $f ; then
5100 conf_wtmp_location=$f
5101 fi
5102 done
5103 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005104 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005105 fi
5106 fi
5107fi
5108if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005109 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005110 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005111fi
andre2ff7b5d2000-06-03 14:57:40 +00005112
andre2ff7b5d2000-06-03 14:57:40 +00005113dnl wtmpx detection
5114AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005115AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005116#include <sys/types.h>
5117#include <utmp.h>
5118#ifdef HAVE_UTMPX_H
5119#include <utmpx.h>
5120#endif
Damien Miller2994e082000-06-04 15:51:47 +10005121#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005122# include <paths.h>
5123#endif
Tim Rice648f8762011-01-26 12:38:57 -08005124 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
5125 [ AC_MSG_RESULT([yes]) ],
5126 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005127 system_wtmpx_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005128])
andre2ff7b5d2000-06-03 14:57:40 +00005129if test -z "$conf_wtmpx_location"; then
5130 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005131 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00005132 fi
5133else
Tim Rice648f8762011-01-26 12:38:57 -08005134 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005135 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005136fi
andre2ff7b5d2000-06-03 14:57:40 +00005137
Damien Miller4018c192000-04-30 09:30:44 +10005138
Damien Miller29ea30d2000-03-17 10:54:15 +11005139if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10005140 LDFLAGS="$LDFLAGS $blibflags$blibpath"
5141 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11005142fi
5143
Damien Millera2438bb2013-03-15 10:23:07 +11005144AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07005145 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11005146 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07005147 fi
Damien Millera2438bb2013-03-15 10:23:07 +11005148 ], [
5149#ifdef HAVE_SYS_TYPES_H
5150#include <sys/types.h>
5151#endif
5152#ifdef HAVE_UTMP_H
5153#include <utmp.h>
5154#endif
5155#ifdef HAVE_UTMPX_H
5156#include <utmpx.h>
5157#endif
5158#ifdef HAVE_LASTLOG_H
5159#include <lastlog.h>
5160#endif
5161 ])
5162
5163AC_CHECK_MEMBER([struct utmp.ut_line], [], [
5164 AC_DEFINE([DISABLE_UTMP])
5165 AC_DEFINE([DISABLE_WTMP])
5166 ], [
5167#ifdef HAVE_SYS_TYPES_H
5168#include <sys/types.h>
5169#endif
5170#ifdef HAVE_UTMP_H
5171#include <utmp.h>
5172#endif
5173#ifdef HAVE_UTMPX_H
5174#include <utmpx.h>
5175#endif
5176#ifdef HAVE_LASTLOG_H
5177#include <lastlog.h>
5178#endif
5179 ])
5180
Darren Tucker7da23cb2005-08-03 00:20:15 +10005181dnl Adding -Werror to CFLAGS early prevents configure tests from running.
5182dnl Add now.
5183CFLAGS="$CFLAGS $werror_flags"
5184
Darren Tucker627337d2010-04-10 22:58:01 +10005185if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
5186 TEST_SSH_IPV6=no
5187else
5188 TEST_SSH_IPV6=yes
5189fi
Tim Rice648f8762011-01-26 12:38:57 -08005190AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
5191AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker47b8c992016-12-08 15:48:34 +11005192AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8])
Darren Tucker882abfd2013-11-09 00:17:41 +11005193AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10005194AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker79c0e1d2017-12-11 14:38:33 +11005195AC_SUBST([DEPEND], [$(cat $srcdir/.depend)])
Darren Tucker5d376902008-06-11 04:15:05 +10005196
Damien Millerde35c382017-09-08 12:38:31 +10005197CFLAGS="${CFLAGS} ${CFLAGS_AFTER}"
5198LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}"
5199
Damien Millerbac2d8a2000-09-05 16:13:06 +11005200AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10005201AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
5202 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10005203 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07005204AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10005205
Damien Miller7b22d652000-06-18 14:07:04 +10005206# Print summary of options
5207
Damien Miller7b22d652000-06-18 14:07:04 +10005208# Someone please show me a better way :)
5209A=`eval echo ${prefix}` ; A=`eval echo ${A}`
5210B=`eval echo ${bindir}` ; B=`eval echo ${B}`
5211C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
5212D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00005213E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00005214F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10005215G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10005216H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
5217I=`eval echo ${user_path}` ; I=`eval echo ${I}`
5218J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10005219
5220echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00005221echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10005222echo " User binaries: $B"
5223echo " System binaries: $C"
5224echo " Configuration files: $D"
5225echo " Askpass program: $E"
5226echo " Manual pages: $F"
5227echo " PID file: $G"
5228echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10005229if test "x$external_path_file" = "x/etc/login.conf" ; then
5230echo " At runtime, sshd will use the path defined in $external_path_file"
5231echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07005232else
Damien Millerf58c6722002-05-13 13:15:42 +10005233echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07005234 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10005235echo " (If PATH is set in $external_path_file it will be used instead. If"
5236echo " used, ensure the path to scp is present, otherwise scp will not work.)"
5237 fi
Tim Rice43a1c132002-04-17 21:19:14 -07005238fi
Damien Millera18bbd32002-05-13 10:48:57 +10005239if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10005240echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10005241fi
Damien Millerf58c6722002-05-13 13:15:42 +10005242echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10005243echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005244echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005245echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10005246echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005247echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11005248echo " libedit support: $LIBEDIT_MSG"
Damien Miller523db852017-02-03 16:01:22 +11005249echo " libldns support: $LDNS_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005250echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11005251echo " Solaris project support: $SP_MSG"
Damien Miller4626cba2016-01-08 14:24:56 +11005252echo " Solaris privilege support: $SPP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10005253echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005254echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5255echo " BSD Auth support: $BSD_AUTH_MSG"
5256echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10005257echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11005258
Damien Miller7b22d652000-06-18 14:07:04 +10005259echo ""
5260
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00005261echo " Host: ${host}"
5262echo " Compiler: ${CC}"
5263echo " Compiler flags: ${CFLAGS}"
5264echo "Preprocessor flags: ${CPPFLAGS}"
5265echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10005266echo " Libraries: ${LIBS}"
5267if test ! -z "${SSHDLIBS}"; then
5268echo " +for sshd: ${SSHDLIBS}"
5269fi
Damien Miller71adf122011-01-25 12:16:15 +11005270if test ! -z "${SSHLIBS}"; then
5271echo " +for ssh: ${SSHLIBS}"
5272fi
Damien Miller7b22d652000-06-18 14:07:04 +10005273
5274echo ""
5275
Tim Rice6f1f7582004-05-30 21:38:51 -07005276if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10005277 echo "SVR4 style packages are supported with \"make package\""
5278 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07005279fi
5280
Damien Miller82cf0ce2000-12-20 13:34:48 +11005281if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11005282 echo "PAM is enabled. You may need to install a PAM control file "
5283 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11005284 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11005285 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11005286 echo ""
5287fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00005288
Damien Millerb4097182004-05-23 14:09:40 +10005289if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11005290 echo "WARNING: the operating system that you are using does not"
5291 echo "appear to support getpeereid(), getpeerucred() or the"
5292 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
5293 echo "enforce security checks to prevent unauthorised connections to"
5294 echo "ssh-agent. Their absence increases the risk that a malicious"
5295 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10005296 echo ""
5297fi
5298
Darren Tuckerd9f88912005-02-20 21:01:48 +11005299if test "$AUDIT_MODULE" = "bsm" ; then
5300 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
5301 echo "See the Solaris section in README.platform for details."
5302fi