blob: 8c6c4637c9cff0c8eb052cbee8993902730189fe [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])
Darren Tucker285546b2019-05-10 15:04:42 +100044AC_PATH_PROG([NROFF], [nroff awf])
Tim Rice648f8762011-01-26 12:38:57 -080045AC_PATH_PROG([MANDOC], [mandoc])
46AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110047
Darren Tucker285546b2019-05-10 15:04:42 +100048dnl select manpage formatter to be used to build "cat" format pages.
Damien Miller30a69e72011-01-04 08:16:27 +110049if 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
Darren Tucker6fd4aa22019-05-15 16:19:14 +100056 AC_MSG_WARN([no manpage formatter found])
Damien Miller30a69e72011-01-04 08:16:27 +110057 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([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700592 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800593 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
594 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000595 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800596 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
597 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700598 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700600 [Define to a Set Process Title type if your system is
601 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800602 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100603 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800604 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100605 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Darren Tucker2c71ca12018-03-30 18:23:07 +1100606 AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211])
607 AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551])
Damien Miller75b1d102000-01-07 14:01:41 +1100608 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000609*-*-android*)
610 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
611 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
612 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100613*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100614 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100615 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800616 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
617 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
Damien Miller4626cba2016-01-08 14:24:56 +1100618 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
619 [Define to disable UID restoration test])
Tim Rice648f8762011-01-26 12:38:57 -0800620 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700621 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800622 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700623 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800624 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700625 [Define if your platform needs to skip post auth
626 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800627 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100628 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
629 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
630 # reasons which cause compile warnings, so we disable those warnings.
631 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100632 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000633*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800634 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700635 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800636 AC_DEFINE([SETEUID_BREAKS_SETUID])
637 AC_DEFINE([BROKEN_SETREUID])
638 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000639 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000640*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100641 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800642 AC_MSG_CHECKING([if we have working getaddrinfo])
643 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000644main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
645 exit(0);
646 else
647 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800648}
649 ]])],
650 [AC_MSG_RESULT([working])],
651 [AC_MSG_RESULT([buggy])
652 AC_DEFINE([BROKEN_GETADDRINFO], [1],
653 [getaddrinfo is broken (if present)])
654 ],
655 [AC_MSG_RESULT([assume it is working])])
656 AC_DEFINE([SETEUID_BREAKS_SETUID])
657 AC_DEFINE([BROKEN_SETREUID])
658 AC_DEFINE([BROKEN_SETREGID])
659 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
660 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700661 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800662 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
663 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000664 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000666 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800667 m4_pattern_allow([AU_IPv])
Tim Ricee1d93702016-05-31 11:13:22 -0700668 AC_CHECK_DECL([AU_IPv4], [],
Tim Rice648f8762011-01-26 12:38:57 -0800669 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100670 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800671 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100672 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100673 )
Damien Millerc09182f2011-06-03 12:11:38 +1000674 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
675 [Define to a Set Process Title type if your system is
676 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000677 AC_CHECK_FUNCS([sandbox_init])
678 AC_CHECK_HEADERS([sandbox.h])
Damien Miller39f303b2016-02-23 12:56:59 +1100679 AC_CHECK_LIB([sandbox], [sandbox_apply], [
680 SSHDLIBS="$SSHDLIBS -lsandbox"
681 ])
Damien Miller28744182019-08-30 13:21:38 +1000682 # proc_pidinfo()-based closefrom() replacement.
683 AC_CHECK_HEADERS([libproc.h])
684 AC_CHECK_FUNCS([proc_pidinfo])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000685 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000686*-*-dragonfly*)
687 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100688 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000689 ;;
Tim Ricee1d93702016-05-31 11:13:22 -0700690*-*-haiku*)
Darren Tucker5faa52d2016-08-02 15:22:40 +1000691 LIBS="$LIBS -lbsd "
692 AC_CHECK_LIB([network], [socket])
693 AC_DEFINE([HAVE_U_INT64_T])
694 MANTYPE=man
695 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000696*-*-hpux*)
697 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000698 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100699 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800700 AC_DEFINE([USE_PIPES])
Tim Rice648f8762011-01-26 12:38:57 -0800701 AC_DEFINE([LOGIN_NEEDS_UTMPX])
702 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700703 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800704 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100705 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700706 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700707 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800708 AC_CHECK_LIB([xnet], [t_error], ,
709 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000710
711 # next, we define all of the options specific to major releases
712 case "$host" in
713 *-*-hpux10*)
714 if test -z "$GCC"; then
715 CFLAGS="$CFLAGS -Ae"
716 fi
717 ;;
718 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800719 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700720 [Define if you are using Solaris-derived PAM which
721 passes pam_messages to the conversation function
722 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800723 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700724 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800725 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000726 check_for_hpux_broken_getaddrinfo=1
727 check_for_conflicting_getspnam=1
728 ;;
729 esac
730
731 # lastly, we define options specific to minor releases
732 case "$host" in
733 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800734 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700735 [Define if you have SecureWare-based
736 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000737 disable_ptmx_check=yes
738 LIBS="$LIBS -lsecpw"
739 ;;
740 esac
Damien Miller1bead332000-04-30 00:47:29 +1000741 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100742*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100743 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800744 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700745 [Define if you system's inet_ntoa is busted
746 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800747 AC_DEFINE([SETEUID_BREAKS_SETUID])
748 AC_DEFINE([BROKEN_SETREUID])
749 AC_DEFINE([BROKEN_SETREGID])
750 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700751 [Define if you shouldn't strip 'tty' from your
752 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800753 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100754 ;;
755*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100756 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800757 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700758 [Define if you have/want arrays
Damien Miller10479cc2018-04-10 10:19:02 +1000759 (cluster-wide session management, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800760 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700761 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800762 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700763 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700765 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800766 AC_DEFINE([BROKEN_INET_NTOA])
767 AC_DEFINE([SETEUID_BREAKS_SETUID])
768 AC_DEFINE([BROKEN_SETREUID])
769 AC_DEFINE([BROKEN_SETREGID])
770 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
771 AC_DEFINE([WITH_ABBREV_NO_TTY])
772 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100773 ;;
Damien Miller90551722009-02-16 15:37:03 +1100774*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
775 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800776 AC_DEFINE([PAM_TTY_KLUDGE])
777 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
778 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
779 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
780 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100781 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100782*-*-linux*)
783 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100784 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100785 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000786 check_for_openpty_ctty_bug=1
Darren Tuckerc61d5ec2017-02-03 14:10:34 +1100787 dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
788 dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
789 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800790 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700791 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800792 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700793 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800794 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
795 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700796 [Define to whatever link() returns for "not supported"
797 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800798 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
799 AC_DEFINE([USE_BTMP])
800 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100801 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000802 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000803 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800804 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700805 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000806 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000807 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100808 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800809 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100810 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800811 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100812 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800813 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100814 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800815 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100816 [Prepend the address family to IP tunnel traffic])
817 fi
Darren Tucker81c9ccd2017-11-03 14:52:51 +1100818 AC_CHECK_HEADER([linux/if.h],
819 AC_DEFINE([SYS_RDOMAIN_LINUX], [1],
Darren Tucker24d2a332018-02-11 21:20:39 +1300820 [Support routing domains using Linux VRF]), [], [
821#ifdef HAVE_SYS_TYPES_H
Damien Miller87294982019-07-10 09:43:19 +1000822# include <sys/types.h>
Darren Tucker24d2a332018-02-11 21:20:39 +1300823#endif
824 ])
Darren Tucker60395f92012-07-03 14:31:18 +1000825 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
826 [], [#include <linux/types.h>])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100827 # Obtain MIPS ABI
828 case "$host" in
829 mips*)
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100830 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100831#if _MIPS_SIM != _ABIO32
832#error
833#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100834 ]])],[mips_abi="o32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100835#if _MIPS_SIM != _ABIN32
836#error
837#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100838 ]])],[mips_abi="n32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100839#if _MIPS_SIM != _ABI64
840#error
841#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100842 ]])],[mips_abi="n64"],[AC_MSG_ERROR([unknown MIPS ABI])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100843 ])
844 ])
845 ])
846 ;;
847 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100848 AC_MSG_CHECKING([for seccomp architecture])
849 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000850 case "$host" in
851 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100852 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000853 ;;
854 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100855 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000856 ;;
Damien Miller99f33d72015-06-17 10:50:51 +1000857 arm*-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100858 seccomp_audit_arch=AUDIT_ARCH_ARM
Damien Miller99f33d72015-06-17 10:50:51 +1000859 ;;
860 aarch64*-*)
861 seccomp_audit_arch=AUDIT_ARCH_AARCH64
Damien Miller5c15e222015-06-18 15:07:56 +1000862 ;;
Damien Millerb9c50612016-07-08 13:59:13 +1000863 s390x-*)
864 seccomp_audit_arch=AUDIT_ARCH_S390X
865 ;;
866 s390-*)
867 seccomp_audit_arch=AUDIT_ARCH_S390
868 ;;
869 powerpc64-*)
870 seccomp_audit_arch=AUDIT_ARCH_PPC64
871 ;;
872 powerpc64le-*)
873 seccomp_audit_arch=AUDIT_ARCH_PPC64LE
874 ;;
875 mips-*)
876 seccomp_audit_arch=AUDIT_ARCH_MIPS
877 ;;
878 mipsel-*)
879 seccomp_audit_arch=AUDIT_ARCH_MIPSEL
880 ;;
881 mips64-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100882 case "$mips_abi" in
883 "n32")
884 seccomp_audit_arch=AUDIT_ARCH_MIPS64N32
885 ;;
886 "n64")
887 seccomp_audit_arch=AUDIT_ARCH_MIPS64
888 ;;
889 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000890 ;;
891 mips64el-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100892 case "$mips_abi" in
893 "n32")
894 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64N32
895 ;;
896 "n64")
897 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
898 ;;
899 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000900 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000901 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100902 if test "x$seccomp_audit_arch" != "x" ; then
903 AC_MSG_RESULT(["$seccomp_audit_arch"])
Damien Miller99f33d72015-06-17 10:50:51 +1000904 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
905 [Specify the system call convention in use])
Damien Miller91f40d82013-02-22 11:37:00 +1100906 else
907 AC_MSG_RESULT([architecture not supported])
908 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100909 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000910mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800911 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000912 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000913 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100914*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000915 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800916 if test "x$withval" != "xno" ; then
Darren Tucker2f0bad22019-01-21 21:28:27 +1100917 rpath_opt="-R"
Tim Rice88368a32003-12-08 12:35:59 -0800918 fi
Damien Miller99522ba2016-07-28 08:54:27 +1000919 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800920 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100921 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800922 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
923 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100924 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100925 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerf5bbd3b2014-01-30 11:26:46 +1100926 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
927 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
Damien Milleree1c0b32000-01-21 00:18:15 +1100928 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100929*-*-freebsd*)
930 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800931 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
932 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100933 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800934 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
935 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100936 TEST_MALLOC_OPTIONS="AJRX"
Damien Miller2035b222014-01-26 09:39:53 +1100937 # Preauth crypto occasionally uses file descriptors for crypto offload
938 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100939 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
Tim Rice03ae0812014-02-21 09:09:34 -0800940 [define if setrlimit RLIMIT_NOFILE breaks things])
Damien Millerfbd884a2001-02-27 08:39:07 +1100941 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000942*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800943 AC_DEFINE([SETEUID_BREAKS_SETUID])
944 AC_DEFINE([BROKEN_SETREUID])
945 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000946 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000947*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000948 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100949 conf_utmp_location=/etc/utmp
950 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700951 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800952 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
Tim Rice648f8762011-01-26 12:38:57 -0800953 AC_DEFINE([USE_PIPES])
954 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000955 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000956*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100957 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800958 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
959 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
960 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
961 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000962 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100963 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000964 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100965*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800966 if test "x$withval" != "xno" ; then
Darren Tucker2f0bad22019-01-21 21:28:27 +1100967 rpath_opt="-R"
Tim Ricead4a1882004-02-29 15:53:37 -0800968 fi
Tim Rice648f8762011-01-26 12:38:57 -0800969 AC_DEFINE([PAM_SUN_CODEBASE])
970 AC_DEFINE([LOGIN_NEEDS_UTMPX])
Tim Rice648f8762011-01-26 12:38:57 -0800971 AC_DEFINE([PAM_TTY_KLUDGE])
972 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700973 [Define if pam_chauthtok wants real uid set
974 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800975 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000976 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800977 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700978 [Define if sshd somehow reacquires a controlling TTY
979 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800980 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000981 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800982 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000983 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000984 # hardwire lastlog location (can't detect it on some versions)
985 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800986 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000987 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
988 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800989 AC_MSG_RESULT([yes])
990 AC_DEFINE([DISABLE_UTMP])
991 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700992 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000993 else
Tim Rice648f8762011-01-26 12:38:57 -0800994 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000995 fi
Darren Tuckera86ec4d2016-06-14 10:48:27 +1000996 AC_CHECK_FUNCS([setpflags])
Darren Tucker907091a2016-02-19 09:05:39 +1100997 AC_CHECK_FUNCS([setppriv])
998 AC_CHECK_FUNCS([priv_basicset])
999 AC_CHECK_HEADERS([priv.h])
Tim Rice648f8762011-01-26 12:38:57 -08001000 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +10001001 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
1002 [
Tim Rice648f8762011-01-26 12:38:57 -08001003 AC_CHECK_LIB([contract], [ct_tmpl_activate],
1004 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +10001005 [Define if you have Solaris process contracts])
Damien Miller4626cba2016-01-08 14:24:56 +11001006 LIBS="$LIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +10001007 SPC_MSG="yes" ], )
1008 ],
1009 )
Tim Rice648f8762011-01-26 12:38:57 -08001010 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +11001011 [ --with-solaris-projects Enable Solaris projects (experimental)],
1012 [
Tim Rice648f8762011-01-26 12:38:57 -08001013 AC_CHECK_LIB([project], [setproject],
1014 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +11001015 [Define if you have Solaris projects])
Damien Miller4626cba2016-01-08 14:24:56 +11001016 LIBS="$LIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +11001017 SP_MSG="yes" ], )
1018 ],
1019 )
Damien Miller4626cba2016-01-08 14:24:56 +11001020 AC_ARG_WITH([solaris-privs],
1021 [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)],
1022 [
1023 AC_MSG_CHECKING([for Solaris/Illumos privilege support])
Darren Tucker907091a2016-02-19 09:05:39 +11001024 if test "x$ac_cv_func_setppriv" = "xyes" -a \
1025 "x$ac_cv_header_priv_h" = "xyes" ; then
1026 SOLARIS_PRIVS=yes
Damien Miller4626cba2016-01-08 14:24:56 +11001027 AC_MSG_RESULT([found])
1028 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
1029 [Define to disable UID restoration test])
1030 AC_DEFINE([USE_SOLARIS_PRIVS], [1],
1031 [Define if you have Solaris privileges])
1032 SPP_MSG="yes"
1033 else
1034 AC_MSG_RESULT([not found])
1035 AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs])
1036 fi
1037 ],
1038 )
Tim Rice5ab9b632013-06-02 14:05:48 -07001039 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +11001040 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +10001041*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001042 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -08001043 AC_CHECK_FUNCS([getpwanam])
1044 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +10001045 conf_utmp_location=/etc/utmp
1046 conf_wtmp_location=/var/adm/wtmp
1047 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -08001048 AC_DEFINE([USE_PIPES])
Darren Tuckerc0a0c3f2018-03-05 20:03:07 +11001049 AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx])
Damien Millerdfc83f42000-05-20 15:02:59 +10001050 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001051*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -07001052 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -08001053 AC_DEFINE([USE_PIPES])
1054 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1055 AC_DEFINE([SETEUID_BREAKS_SETUID])
1056 AC_DEFINE([BROKEN_SETREUID])
1057 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001058 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +10001059*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -07001060 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -08001061 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +11001062 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -08001063 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +11001064 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -08001065 AC_DEFINE([USE_PIPES])
1066 AC_DEFINE([IP_TOS_IS_BROKEN])
1067 AC_DEFINE([SETEUID_BREAKS_SETUID])
1068 AC_DEFINE([BROKEN_SETREUID])
1069 AC_DEFINE([BROKEN_SETREGID])
1070 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +10001071 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -07001072 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
1073 # Attention: always take care to bind libsocket and libnsl before libc,
1074 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +10001075 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001076# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +11001077*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -08001078 AC_DEFINE([USE_PIPES])
1079 AC_DEFINE([SETEUID_BREAKS_SETUID])
1080 AC_DEFINE([BROKEN_SETREUID])
1081 AC_DEFINE([BROKEN_SETREGID])
1082 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
1083 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -07001084 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +11001085 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001086# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +11001087*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -08001088 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -08001089 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
1090 AC_DEFINE([USE_PIPES])
1091 AC_DEFINE([SETEUID_BREAKS_SETUID])
1092 AC_DEFINE([BROKEN_GETADDRINFO])
1093 AC_DEFINE([BROKEN_SETREUID])
1094 AC_DEFINE([BROKEN_SETREGID])
1095 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice8433d512017-07-11 18:47:56 -07001096 AC_DEFINE([BROKEN_TCGETATTR_ICANON])
Tim Rice5ab9b632013-06-02 14:05:48 -07001097 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4afeaf32018-03-25 10:00:21 -07001098 check_for_libcrypt_later=1
Tim Rice4dbacff2005-06-01 20:09:28 -07001099 case "$host" in
1100 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -07001101 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -08001102 AC_DEFINE([BROKEN_UPDWTMPX])
1103 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
1104 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
Tim Rice648f8762011-01-26 12:38:57 -08001105 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -07001106 ;;
Tim Rice648f8762011-01-26 12:38:57 -08001107 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice46259d82005-11-28 18:40:34 -08001108 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -07001109 esac
Damien Miller78315eb2000-09-29 23:01:36 +11001110 ;;
Damien Miller75b1d102000-01-07 14:01:41 +11001111*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +11001112 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001113# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +11001114*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -08001115 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +11001116 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001117# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +11001118*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -08001119 if test -z "$GCC"; then
1120 CFLAGS="$CFLAGS -belf"
1121 fi
Damien Miller5dfe9762001-02-16 12:05:39 +11001122 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +10001123 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -08001124 AC_DEFINE([USE_PIPES])
1125 AC_DEFINE([HAVE_SECUREWARE])
1126 AC_DEFINE([DISABLE_SHADOW])
1127 AC_DEFINE([DISABLE_FD_PASSING])
1128 AC_DEFINE([SETEUID_BREAKS_SETUID])
1129 AC_DEFINE([BROKEN_GETADDRINFO])
1130 AC_DEFINE([BROKEN_SETREUID])
1131 AC_DEFINE([BROKEN_SETREGID])
1132 AC_DEFINE([WITH_ABBREV_NO_TTY])
1133 AC_DEFINE([BROKEN_UPDWTMPX])
1134 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1135 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -07001136 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -07001137 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -07001138 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +10001139 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001140*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001141 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001142 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001143 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001144 [ --with-osfsia Enable Digital Unix SIA],
1145 [
1146 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001147 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001148 no_osfsia=1
1149 fi
1150 ],
1151 )
1152 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001153 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001154 AC_MSG_RESULT([yes])
1155 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001156 [Define if you have Digital Unix Security
1157 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001158 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001159 [Define if you don't want to use your
1160 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001161 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001162 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001163 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001164 else
Tim Rice648f8762011-01-26 12:38:57 -08001165 AC_MSG_RESULT([no])
1166 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001167 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001168 fi
1169 fi
Tim Rice648f8762011-01-26 12:38:57 -08001170 AC_DEFINE([BROKEN_GETADDRINFO])
1171 AC_DEFINE([SETEUID_BREAKS_SETUID])
1172 AC_DEFINE([BROKEN_SETREUID])
1173 AC_DEFINE([BROKEN_SETREGID])
1174 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001175 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001176
Tim Rice70335a62006-02-04 17:42:58 -08001177*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001178 AC_DEFINE([USE_PIPES])
1179 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001180 AC_DEFINE([DISABLE_LASTLOG])
1181 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1182 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001183 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001184 case "$host" in
1185 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001186 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001187 ;;
1188 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001189 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001190
1191*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001192 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
Tim Rice648f8762011-01-26 12:38:57 -08001193 AC_DEFINE([NEED_SETPGRP])
1194 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001195 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001196
1197*-*-lynxos)
Darren Tucker5faa52d2016-08-02 15:22:40 +10001198 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
1199 AC_DEFINE([BROKEN_SETVBUF], [1],
1200 [LynxOS has broken setvbuf() implementation])
1201 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001202esac
1203
Tim Rice648f8762011-01-26 12:38:57 -08001204AC_MSG_CHECKING([compiler and flags for sanity])
1205AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1206 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001207 [
Tim Rice648f8762011-01-26 12:38:57 -08001208 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001209 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001210 ],
1211 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001212)
1213
Darren Tucker0c9653f2005-05-28 15:58:14 +10001214dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001215# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001216AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001217
Tim Rice1e1ef642003-09-11 22:19:31 -07001218dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001219AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1220 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001221 AC_CACHE_CHECK([for broken dirname],
1222 ac_cv_have_broken_dirname, [
1223 save_LIBS="$LIBS"
1224 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001225 AC_RUN_IFELSE(
1226 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001227#include <libgen.h>
1228#include <string.h>
1229
1230int main(int argc, char **argv) {
1231 char *s, buf[32];
1232
1233 strncpy(buf,"/etc", 32);
1234 s = dirname(buf);
1235 if (!s || strncmp(s, "/", 32) != 0) {
1236 exit(1);
1237 } else {
1238 exit(0);
1239 }
1240}
Darren Tucker314d89e2005-10-17 23:29:23 +10001241 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001242 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001243 [ ac_cv_have_broken_dirname="yes" ],
1244 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001245 )
1246 LIBS="$save_LIBS"
1247 ])
1248 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1249 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001250 AC_DEFINE([HAVE_DIRNAME])
1251 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001252 fi
1253 ])
1254])
1255
Tim Rice648f8762011-01-26 12:38:57 -08001256AC_CHECK_FUNC([getspnam], ,
1257 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1258AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1259 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001260
Tim Rice13aae5e2001-10-21 17:53:58 -07001261dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001262AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001263 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001264 [ if test "x$withval" = "xno" ; then
1265 AC_MSG_ERROR([*** zlib is required ***])
1266 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001267 if test -d "$withval/lib"; then
Darren Tucker2f0bad22019-01-21 21:28:27 +11001268 if test -n "${rpath_opt}"; then
1269 LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001270 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001271 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001272 fi
1273 else
Darren Tucker2f0bad22019-01-21 21:28:27 +11001274 if test -n "${rpath_opt}"; then
1275 LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001276 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001277 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001278 fi
1279 fi
1280 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001281 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001282 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001283 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001284 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001285 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001286)
1287
Tim Rice648f8762011-01-26 12:38:57 -08001288AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1289AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001290 [
1291 saved_CPPFLAGS="$CPPFLAGS"
1292 saved_LDFLAGS="$LDFLAGS"
1293 save_LIBS="$LIBS"
1294 dnl Check default zlib install dir
Darren Tucker2f0bad22019-01-21 21:28:27 +11001295 if test -n "${rpath_opt}"; then
1296 LDFLAGS="-L/usr/local/lib ${rpath_opt}/usr/local/lib ${saved_LDFLAGS}"
Tim Ricefcb62202004-01-23 18:35:16 -08001297 else
1298 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1299 fi
1300 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1301 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001302 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001303 [
1304 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1305 ]
1306 )
1307 ]
1308)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001309
Tim Rice648f8762011-01-26 12:38:57 -08001310AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001311 [ --without-zlib-version-check Disable zlib version check],
1312 [ if test "x$withval" = "xno" ; then
1313 zlib_check_nonfatal=1
1314 fi
1315 ]
1316)
1317
Tim Rice648f8762011-01-26 12:38:57 -08001318AC_MSG_CHECKING([for possibly buggy zlib])
1319AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001320#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001321#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001322#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001323 ]],
1324 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001325 int a=0, b=0, c=0, d=0, n, v;
1326 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1327 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001328 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001329 v = a*1000000 + b*10000 + c*100 + d;
1330 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1331
1332 /* 1.1.4 is OK */
1333 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001334 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001335
Darren Tucker41097ed2005-07-25 15:24:21 +10001336 /* 1.2.3 and up are OK */
1337 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001338 exit(0);
1339
Darren Tucker2dcd2392004-01-23 17:13:33 +11001340 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001341 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001342 AC_MSG_RESULT([no]),
1343 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001344 if test -z "$zlib_check_nonfatal" ; then
1345 AC_MSG_ERROR([*** zlib too old - check config.log ***
1346Your reported zlib version has known security problems. It's possible your
1347vendor has fixed these problems without changing the version number. If you
1348are sure this is the case, you can disable the check by running
1349"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001350If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001351See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001352 else
1353 AC_MSG_WARN([zlib version may have security problems])
1354 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001355 ],
1356 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001357)
Damien Miller6f9c3372000-10-25 10:06:04 +11001358
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001359dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001360AC_CHECK_FUNC([strcasecmp],
1361 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001362)
Tim Rice648f8762011-01-26 12:38:57 -08001363AC_CHECK_FUNCS([utimes],
1364 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001365 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001366)
Damien Millerab18c411999-11-11 10:40:23 +11001367
Tim Ricee589a292001-11-03 11:09:32 -08001368dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001369AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001370AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001371AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001372AC_SEARCH_LIBS([login], [util bsd])
1373AC_SEARCH_LIBS([logout], [util bsd])
1374AC_SEARCH_LIBS([logwtmp], [util bsd])
1375AC_SEARCH_LIBS([openpty], [util bsd])
1376AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001377AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001378
Darren Tucker2fee9092016-02-17 09:48:15 +11001379# On some platforms, inet_ntop and gethostbyname may be found in libresolv
1380# or libnsl.
Damien Millerab039492014-01-28 15:07:10 +11001381AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
Darren Tucker2fee9092016-02-17 09:48:15 +11001382AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
Damien Millerab039492014-01-28 15:07:10 +11001383
Darren Tucker74c1c362017-09-27 07:44:41 +10001384# "Particular Function Checks"
1385# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html
Ben Lindstrom8697e082001-02-24 21:41:10 +00001386AC_FUNC_STRFTIME
Darren Tucker74c1c362017-09-27 07:44:41 +10001387AC_FUNC_MALLOC
1388AC_FUNC_REALLOC
1389# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL;
Darren Tuckere9dede02018-02-25 10:20:31 +11001390AC_MSG_CHECKING([if calloc(0, N) returns non-null])
1391AC_RUN_IFELSE(
1392 [AC_LANG_PROGRAM(
1393 [[ #include <stdlib.h> ]],
1394 [[ void *p = calloc(0, 1); exit(p == NULL); ]]
1395 )],
1396 [ func_calloc_0_nonnull=yes ],
1397 [ func_calloc_0_nonnull=no ],
1398 [ AC_MSG_WARN([cross compiling: assuming same as malloc])
1399 func_calloc_0_nonnull="$ac_cv_func_malloc_0_nonnull"]
1400)
1401AC_MSG_RESULT([$func_calloc_0_nonnull])
1402
Darren Tuckerd97874c2018-04-13 13:43:55 +10001403if test "x$func_calloc_0_nonnull" = "xyes"; then
Darren Tuckere9dede02018-02-25 10:20:31 +11001404 AC_DEFINE(HAVE_CALLOC, 1, [calloc(0, x) returns non-null])
1405else
1406 AC_DEFINE(HAVE_CALLOC, 0, [calloc(0, x) returns NULL])
Darren Tucker74c1c362017-09-27 07:44:41 +10001407 AC_DEFINE(calloc, rpl_calloc,
1408 [Define to rpl_calloc if the replacement function should be used.])
1409fi
Ben Lindstrom8697e082001-02-24 21:41:10 +00001410
Damien Miller3c027682001-03-14 11:39:45 +11001411# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001412AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1413AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001414 [
1415 #include <glob.h>
1416 #ifdef GLOB_ALTDIRFUNC
1417 FOUNDIT
1418 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001419 ],
Damien Miller3c027682001-03-14 11:39:45 +11001420 [
Tim Rice648f8762011-01-26 12:38:57 -08001421 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001422 [Define if your system glob() function has
1423 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001424 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001425 ],
1426 [
Tim Rice648f8762011-01-26 12:38:57 -08001427 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001428 ]
1429)
Damien Millerab18c411999-11-11 10:40:23 +11001430
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001431# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001432AC_MSG_CHECKING([for gl_matchc field in glob_t])
1433AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1434 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001435 [
Tim Rice648f8762011-01-26 12:38:57 -08001436 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001437 [Define if your system glob() function has
1438 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001439 AC_MSG_RESULT([yes])
1440 ], [
1441 AC_MSG_RESULT([no])
1442])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001443
Damien Millera6e121a2010-10-07 21:39:17 +11001444# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001445AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1446AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001447#ifndef GLOB_KEEPSTAT
1448#error "glob does not support GLOB_KEEPSTAT extension"
1449#endif
1450glob_t g;
1451g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001452]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001453 [
Tim Rice648f8762011-01-26 12:38:57 -08001454 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001455 [Define if your system glob() function has
1456 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001457 AC_MSG_RESULT([yes])
1458 ], [
1459 AC_MSG_RESULT([no])
Damien Miller72ef7c12015-01-15 02:21:31 +11001460
Tim Rice648f8762011-01-26 12:38:57 -08001461])
Damien Millera6e121a2010-10-07 21:39:17 +11001462
Tim Rice648f8762011-01-26 12:38:57 -08001463AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001464
Darren Tucker7df91b02016-07-14 12:25:24 +10001465AC_CHECK_DECL([VIS_ALL], ,
1466 AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
1467
Damien Miller18bb4732001-03-28 14:35:30 +10001468AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001469AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001470 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001471#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001472#include <dirent.h>]],
1473 [[
1474 struct dirent d;
1475 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001476 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001477 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001478 [
Tim Rice648f8762011-01-26 12:38:57 -08001479 AC_MSG_RESULT([no])
1480 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001481 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001482 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001483 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001484 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001485 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001486 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001487 ]
1488)
1489
Damien Miller36f49652004-08-15 18:40:59 +10001490AC_MSG_CHECKING([for /proc/pid/fd directory])
1491if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001492 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1493 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001494else
Tim Rice648f8762011-01-26 12:38:57 -08001495 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001496fi
1497
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001498# Check whether user wants to use ldns
1499LDNS_MSG="no"
1500AC_ARG_WITH(ldns,
1501 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
Damien Miller523db852017-02-03 16:01:22 +11001502 [
1503 ldns=""
1504 if test "x$withval" = "xyes" ; then
1505 AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no])
Darren Tuckerf001de82017-12-11 13:42:51 +11001506 if test "x$LDNSCONFIG" = "xno"; then
Damien Miller523db852017-02-03 16:01:22 +11001507 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1508 LDFLAGS="$LDFLAGS -L${withval}/lib"
1509 LIBS="-lldns $LIBS"
1510 ldns=yes
1511 else
1512 LIBS="$LIBS `$LDNSCONFIG --libs`"
1513 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`"
Darren Tucker7af27bf2017-03-24 09:44:56 +11001514 ldns=yes
Damien Miller523db852017-02-03 16:01:22 +11001515 fi
1516 elif test "x$withval" != "xno" ; then
1517 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1518 LDFLAGS="$LDFLAGS -L${withval}/lib"
1519 LIBS="-lldns $LIBS"
1520 ldns=yes
1521 fi
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001522
Damien Miller523db852017-02-03 16:01:22 +11001523 # Verify that it works.
1524 if test "x$ldns" = "xyes" ; then
1525 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1526 LDNS_MSG="yes"
1527 AC_MSG_CHECKING([for ldns support])
1528 AC_LINK_IFELSE(
1529 [AC_LANG_SOURCE([[
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001530#include <stdio.h>
1531#include <stdlib.h>
1532#include <stdint.h>
1533#include <ldns/ldns.h>
1534int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
Damien Miller523db852017-02-03 16:01:22 +11001535 ]])
1536 ],
1537 [AC_MSG_RESULT(yes)],
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001538 [
1539 AC_MSG_RESULT(no)
1540 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1541 ])
Damien Miller523db852017-02-03 16:01:22 +11001542 fi
1543])
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001544
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001545# Check whether user wants libedit support
1546LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001547AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001548 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001549 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001550 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001551 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001552 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001553 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Tim Ricee1d93702016-05-31 11:13:22 -07001554 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001555 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001556 use_pkgconfig_for_libedit=yes
1557 else
Tim Rice648f8762011-01-26 12:38:57 -08001558 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001559 fi
1560 fi
1561 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001562 CPPFLAGS="$CPPFLAGS -I${withval}/include"
Darren Tucker2f0bad22019-01-21 21:28:27 +11001563 if test -n "${rpath_opt}"; then
1564 LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}"
Darren Tuckerc373a562005-09-22 20:15:08 +10001565 else
1566 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1567 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001568 fi
Damien Miller1f789802010-10-11 22:35:22 +11001569 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001570 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001571 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1572 else
1573 LIBEDIT="-ledit -lcurses"
1574 fi
1575 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001576 AC_CHECK_LIB([edit], [el_init],
1577 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001578 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001579 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001580 ],
Tim Rice648f8762011-01-26 12:38:57 -08001581 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001582 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001583 )
Tim Rice648f8762011-01-26 12:38:57 -08001584 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001585 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001586 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1587 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001588 int i = H_SETSIZE;
1589 el_init("", NULL, NULL, NULL);
1590 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001591 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001592 [ AC_MSG_RESULT([yes]) ],
1593 [ AC_MSG_RESULT([no])
1594 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001595 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001596 fi ]
1597)
1598
Darren Tuckerd9f88912005-02-20 21:01:48 +11001599AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001600AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001601 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001602 [
Tim Rice648f8762011-01-26 12:38:57 -08001603 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001604 case "$withval" in
1605 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001606 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001607 AUDIT_MODULE=bsm
1608 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001609 AC_CHECK_HEADERS([bsm/audit.h], [],
1610 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001611 [
1612#ifdef HAVE_TIME_H
1613# include <time.h>
1614#endif
1615 ]
1616)
Tim Rice648f8762011-01-26 12:38:57 -08001617 AC_CHECK_LIB([bsm], [getaudit], [],
1618 [AC_MSG_ERROR([BSM enabled and required library not found])])
1619 AC_CHECK_FUNCS([getaudit], [],
1620 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001621 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001622 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1623 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001624 if test "$sol2ver" -ge 11; then
Tim Ricee1d93702016-05-31 11:13:22 -07001625 SSHDLIBS="$SSHDLIBS -lscf"
1626 AC_DEFINE([BROKEN_BSM_API], [1],
1627 [The system has incomplete BSM API])
Darren Tucker93a2d412012-02-24 10:40:41 +11001628 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001629 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001630 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001631 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001632 AUDIT_MODULE=linux
1633 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001634 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001635 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001636 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001637 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001638 debug)
1639 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001640 AC_MSG_RESULT([debug])
1641 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001642 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001643 no)
Tim Rice648f8762011-01-26 12:38:57 -08001644 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001645 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001646 *)
1647 AC_MSG_ERROR([Unknown audit module $withval])
1648 ;;
1649 esac ]
1650)
1651
Darren Tucker096118d2014-01-21 12:48:51 +11001652AC_ARG_WITH([pie],
Damien Miller76c04802015-01-13 19:38:18 +11001653 [ --with-pie Build Position Independent Executables if possible], [
Darren Tucker096118d2014-01-21 12:48:51 +11001654 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001655 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001656 fi
1657 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001658 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001659 fi
1660 ]
1661)
Damien Miller852472a2014-01-22 16:31:18 +11001662if test "x$use_pie" = "x"; then
1663 use_pie=no
1664fi
1665if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1666 # Turn off automatic PIE when toolchain hardening is off.
1667 use_pie=no
1668fi
Damien Millerc161fc92014-01-29 21:01:33 +11001669if test "x$use_pie" = "xauto"; then
Damien Miller852472a2014-01-22 16:31:18 +11001670 # Automatic PIE requires gcc >= 4.x
1671 AC_MSG_CHECKING([for gcc >= 4.x])
1672 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1673#if !defined(__GNUC__) || __GNUC__ < 4
1674#error gcc is too old
1675#endif
1676]])],
1677 [ AC_MSG_RESULT([yes]) ],
1678 [ AC_MSG_RESULT([no])
1679 use_pie=no ]
1680)
1681fi
1682if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001683 SAVED_CFLAGS="$CFLAGS"
1684 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001685 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1686 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001687 # We use both -fPIE and -pie or neither.
1688 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1689 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1690 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1691 AC_MSG_RESULT([yes])
1692 else
1693 AC_MSG_RESULT([no])
1694 CFLAGS="$SAVED_CFLAGS"
1695 LDFLAGS="$SAVED_LDFLAGS"
1696 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001697fi
1698
Damien Millerfe1f1432003-02-24 15:45:42 +11001699dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001700AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001701 Blowfish_initstate \
1702 Blowfish_expandstate \
1703 Blowfish_expand0state \
1704 Blowfish_stream2word \
Darren Tucker11cba2a2019-07-23 21:51:22 +10001705 SHA256Update \
1706 SHA384Update \
1707 SHA512Update \
Damien Miller57f39152005-11-24 19:58:19 +11001708 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001709 b64_ntop \
1710 __b64_ntop \
1711 b64_pton \
1712 __b64_pton \
1713 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001714 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001715 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001716 blf_enc \
Darren Tuckera9004422018-02-24 20:25:22 +11001717 bzero \
Damien Millerc96d8532014-01-25 13:12:28 +11001718 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001719 clock \
1720 closefrom \
1721 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001722 endgrent \
Darren Tucker6310ef22016-07-13 14:42:35 +10001723 err \
1724 errx \
Damien Miller1d2c4562014-02-04 11:18:20 +11001725 explicit_bzero \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001726 fchmod \
Darren Tuckera6258e52019-01-18 11:09:01 +11001727 fchmodat \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001728 fchown \
Darren Tuckera6258e52019-01-18 11:09:01 +11001729 fchownat \
Darren Tuckercd3ab572018-02-26 14:37:06 +11001730 flock \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001731 freeaddrinfo \
Damien Millerb7956912017-09-19 12:29:23 +10001732 freezero \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001733 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001734 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001735 futimes \
1736 getaddrinfo \
1737 getcwd \
1738 getgrouplist \
Darren Tucker6301e6c2018-07-02 21:16:58 +10001739 getline \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001740 getnameinfo \
1741 getopt \
Damien Miller151c6e42017-06-01 15:25:13 +10001742 getpagesize \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001743 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001744 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001745 getpgid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001746 _getpty \
1747 getrlimit \
Damien Millerafa6e792018-04-13 13:31:42 +10001748 getrandom \
Darren Tuckerb39593a2018-02-25 13:25:15 +11001749 getsid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001750 getttyent \
1751 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001752 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001753 inet_aton \
1754 inet_ntoa \
1755 inet_ntop \
1756 innetgr \
Darren Tuckerd38f05d2017-03-20 13:38:27 +11001757 llabs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001758 login_getcapbool \
1759 md5_crypt \
Darren Tucker45478892019-07-16 09:20:23 +10001760 memmem \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001761 memmove \
Damien Miller3d673d12014-08-27 06:32:01 +10001762 memset_s \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001763 mkdtemp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001764 ngetaddrinfo \
1765 nsleep \
1766 ogetaddrinfo \
1767 openlog_r \
Darren Tucker3ddd15e2015-11-30 07:23:53 +11001768 pledge \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001769 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001770 prctl \
1771 pstat \
Darren Tucker6c8c9a62018-02-24 20:46:37 +11001772 raise \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001773 readpassphrase \
Darren Tucker642652d2014-12-10 01:32:23 +11001774 reallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001775 recvmsg \
Damien Miller151c6e42017-06-01 15:25:13 +10001776 recallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001777 rresvport_af \
1778 sendmsg \
1779 setdtablesize \
1780 setegid \
1781 setenv \
1782 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001783 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001784 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001785 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001786 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001787 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001788 setpcred \
1789 setproctitle \
1790 setregid \
1791 setreuid \
1792 setrlimit \
1793 setsid \
1794 setvbuf \
1795 sigaction \
1796 sigvec \
1797 snprintf \
1798 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001799 statfs \
1800 statvfs \
Darren Tuckerafec0772016-12-13 10:23:03 +11001801 strcasestr \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001802 strdup \
1803 strerror \
1804 strlcat \
1805 strlcpy \
1806 strmode \
Darren Tucker33561e62018-03-03 14:56:09 +11001807 strndup \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001808 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001809 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001810 strptime \
Darren Tucker44fc3342017-09-25 09:48:10 +10001811 strsignal \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001812 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001813 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001814 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001815 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001816 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001817 sysconf \
1818 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001819 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001820 truncate \
1821 unsetenv \
1822 updwtmpx \
Darren Tucker091093d2019-01-18 12:11:42 +13001823 utimensat \
Darren Tucker909a3902010-01-15 12:38:30 +11001824 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001825 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001826 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001827 vsnprintf \
1828 waitpid \
Darren Tucker6310ef22016-07-13 14:42:35 +10001829 warn \
Tim Rice648f8762011-01-26 12:38:57 -08001830])
Tim Rice13aae5e2001-10-21 17:53:58 -07001831
Darren Tuckera9004422018-02-24 20:25:22 +11001832AC_CHECK_DECLS([bzero])
1833
Darren Tuckerc61d5ec2017-02-03 14:10:34 +11001834dnl Wide character support.
Darren Tuckera2333582016-07-14 10:59:09 +10001835AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth])
Darren Tuckera2333582016-07-14 10:59:09 +10001836
Darren Tucker10e290e2016-12-13 13:51:32 +11001837TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes}
Darren Tucker47b8c992016-12-08 15:48:34 +11001838AC_MSG_CHECKING([for utf8 locale support])
1839AC_RUN_IFELSE(
1840 [AC_LANG_PROGRAM([[
1841#include <locale.h>
Darren Tuckerc3599502016-12-09 12:52:02 +11001842#include <stdlib.h>
Darren Tucker47b8c992016-12-08 15:48:34 +11001843 ]], [[
1844 char *loc = setlocale(LC_CTYPE, "en_US.UTF-8");
1845 if (loc != NULL)
1846 exit(0);
1847 exit(1);
1848 ]])],
1849 AC_MSG_RESULT(yes),
1850 [AC_MSG_RESULT(no)
1851 TEST_SSH_UTF8=no],
1852 AC_MSG_WARN([cross compiling: assuming yes])
1853)
1854
Tim Ricec7a8af02010-11-08 14:26:23 -08001855AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001856 [AC_LANG_PROGRAM(
1857 [[ #include <ctype.h> ]],
1858 [[ return (isblank('a')); ]])],
1859 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001860])
1861
Damien Miller5fbe93f2016-07-15 13:54:31 +10001862disable_pkcs11=
1863AC_ARG_ENABLE([pkcs11],
1864 [ --disable-pkcs11 disable PKCS#11 support code [no]],
1865 [
1866 if test "x$enableval" = "xno" ; then
1867 disable_pkcs11=1
1868 fi
1869 ]
1870)
1871
Damien Miller72ef7c12015-01-15 02:21:31 +11001872# PKCS11 depends on OpenSSL.
Damien Miller5fbe93f2016-07-15 13:54:31 +10001873if test "x$openssl" = "xyes" && test "x$disable_pkcs11" = "x"; then
Damien Miller72ef7c12015-01-15 02:21:31 +11001874 # PKCS#11 support requires dlopen() and co
1875 AC_SEARCH_LIBS([dlopen], [dl],
Darren Tucker146c3bd2018-02-26 12:51:29 +11001876 AC_CHECK_DECL([RTLD_NOW],
1877 AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support]),
1878 [], [#include <dlfcn.h>]
1879 )
Damien Miller72ef7c12015-01-15 02:21:31 +11001880 )
1881fi
Damien Millerb3c9f782010-02-12 10:11:34 +11001882
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001883# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001884AC_CHECK_FUNCS([gai_strerror], [
1885 AC_DEFINE([HAVE_GAI_STRERROR])
1886 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001887#include <sys/types.h>
1888#include <sys/socket.h>
1889#include <netdb.h>
1890
Tim Rice648f8762011-01-26 12:38:57 -08001891const char *gai_strerror(int);
1892 ]], [[
1893 char *str;
1894 str = gai_strerror(0);
1895 ]])], [
1896 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1897 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001898
Tim Rice648f8762011-01-26 12:38:57 -08001899AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1900 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001901
Darren Tuckera7108912013-06-02 08:18:31 +10001902AC_SEARCH_LIBS([clock_gettime], [rt],
1903 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1904
Darren Tuckerf1159b52003-07-07 19:44:01 +10001905dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001906AC_CHECK_DECL([strsep],
1907 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001908 [],
1909 [
1910#ifdef HAVE_STRING_H
1911# include <string.h>
1912#endif
1913 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001914
Darren Tuckerb2427c82003-09-10 15:22:44 +10001915dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001916AC_CHECK_DECL([tcsendbreak],
1917 [AC_DEFINE([HAVE_TCSENDBREAK])],
1918 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001919 [#include <termios.h>]
1920)
1921
Tim Rice648f8762011-01-26 12:38:57 -08001922AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001923
Tim Rice648f8762011-01-26 12:38:57 -08001924AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001925 [
1926#include <sys/types.h>
1927#include <sys/socket.h>
1928 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001929
Tim Rice648f8762011-01-26 12:38:57 -08001930AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001931 [
1932#include <sys/types.h>
1933#ifdef HAVE_SYS_STAT_H
1934# include <sys/stat.h>
1935#endif
1936#ifdef HAVE_FCNTL_H
1937# include <fcntl.h>
1938#endif
1939 ])
1940
Darren Tucker2eb40412018-02-24 21:06:48 +11001941AC_CHECK_DECLS([readv, writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001942#include <sys/types.h>
1943#include <sys/uio.h>
1944#include <unistd.h>
1945 ])
1946
Tim Rice648f8762011-01-26 12:38:57 -08001947AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001948#include <sys/param.h>
1949 ])
1950
Tim Rice648f8762011-01-26 12:38:57 -08001951AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001952#include <stddef.h>
1953 ])
1954
Darren Tuckerc7aad002013-06-02 07:18:47 +10001955# extra bits for select(2)
1956AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1957#include <sys/param.h>
1958#include <sys/types.h>
1959#ifdef HAVE_SYS_SYSMACROS_H
1960#include <sys/sysmacros.h>
1961#endif
1962#ifdef HAVE_SYS_SELECT_H
1963#include <sys/select.h>
1964#endif
1965#ifdef HAVE_SYS_TIME_H
1966#include <sys/time.h>
1967#endif
1968#ifdef HAVE_UNISTD_H
1969#include <unistd.h>
1970#endif
1971 ]])
1972AC_CHECK_TYPES([fd_mask], [], [], [[
1973#include <sys/param.h>
1974#include <sys/types.h>
1975#ifdef HAVE_SYS_SELECT_H
1976#include <sys/select.h>
1977#endif
1978#ifdef HAVE_SYS_TIME_H
1979#include <sys/time.h>
1980#endif
1981#ifdef HAVE_UNISTD_H
1982#include <unistd.h>
1983#endif
1984 ]])
1985
Tim Rice648f8762011-01-26 12:38:57 -08001986AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001987 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001988 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001989 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001990 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001991#include <stdlib.h>
1992#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001993 ]], [[
1994 errno=0;
1995 setresuid(0,0,0);
1996 if (errno==ENOSYS)
1997 exit(1);
1998 else
1999 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002000 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002001 [AC_MSG_RESULT([yes])],
2002 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002003 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08002004 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002005 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11002006 )
2007])
Darren Tuckere937be32003-12-17 18:53:26 +11002008
Tim Rice648f8762011-01-26 12:38:57 -08002009AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11002010 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08002011 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10002012 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002013 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11002014#include <stdlib.h>
2015#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08002016 ]], [[
2017 errno=0;
2018 setresgid(0,0,0);
2019 if (errno==ENOSYS)
2020 exit(1);
2021 else
2022 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002023 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002024 [AC_MSG_RESULT([yes])],
2025 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002026 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08002027 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002028 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11002029 )
2030])
Darren Tuckere937be32003-12-17 18:53:26 +11002031
Darren Tucker58fd4c52018-03-05 19:28:08 +11002032AC_MSG_CHECKING([for working fflush(NULL)])
2033AC_RUN_IFELSE(
2034 [AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(NULL); exit(0);]])],
2035 AC_MSG_RESULT([yes]),
2036 [AC_MSG_RESULT([no])
2037 AC_DEFINE([FFLUSH_NULL_BUG], [1],
2038 [define if fflush(NULL) does not work])],
2039 AC_MSG_WARN([cross compiling: assuming working])
2040)
2041
Damien Millerad833b32000-08-23 10:46:23 +10002042dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08002043AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10002044dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08002045AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
2046AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10002047dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08002048AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
2049AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11002050dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08002051AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11002052
Tim Rice648f8762011-01-26 12:38:57 -08002053AC_CHECK_FUNC([daemon],
2054 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
2055 [AC_CHECK_LIB([bsd], [daemon],
2056 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11002057)
2058
Tim Rice648f8762011-01-26 12:38:57 -08002059AC_CHECK_FUNC([getpagesize],
2060 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002061 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08002062 [AC_CHECK_LIB([ucb], [getpagesize],
2063 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11002064)
2065
Damien Millercb170cb2000-07-01 16:52:55 +10002066# Check for broken snprintf
2067if test "x$ac_cv_func_snprintf" = "xyes" ; then
2068 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002069 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002070 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
2071 [[
2072 char b[5];
2073 snprintf(b,5,"123456789");
Tim Ricee1d93702016-05-31 11:13:22 -07002074 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10002075 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002076 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10002077 [
Tim Rice648f8762011-01-26 12:38:57 -08002078 AC_MSG_RESULT([no])
2079 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002080 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10002081 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002082 ],
2083 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10002084 )
2085fi
2086
Darren Tuckere5261272018-10-12 16:43:35 +11002087if test "x$ac_cv_func_snprintf" = "xyes" ; then
2088 AC_MSG_CHECKING([whether snprintf understands %zu])
2089 AC_RUN_IFELSE(
2090 [AC_LANG_PROGRAM([[
2091#include <sys/types.h>
2092#include <stdio.h>
2093 ]],
2094 [[
2095 size_t a = 1, b = 2;
2096 char z[128];
2097 snprintf(z, sizeof z, "%zu%zu", a, b);
2098 exit(strcmp(z, "12"));
2099 ]])],
2100 [AC_MSG_RESULT([yes])],
2101 [
2102 AC_MSG_RESULT([no])
2103 AC_DEFINE([BROKEN_SNPRINTF], [1],
2104 [snprintf does not understand %zu])
2105 ],
2106 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
2107 )
2108fi
2109
Damien Millerd244a582014-08-23 17:06:49 +10002110# We depend on vsnprintf returning the right thing on overflow: the
2111# number of characters it tried to create (as per SUSv3)
2112if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
Damien Miller57f39152005-11-24 19:58:19 +11002113 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
2114 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002115 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11002116#include <sys/types.h>
2117#include <stdio.h>
2118#include <stdarg.h>
2119
Damien Millerd244a582014-08-23 17:06:49 +10002120int x_snprintf(char *str, size_t count, const char *fmt, ...)
Damien Miller57f39152005-11-24 19:58:19 +11002121{
Damien Millerd244a582014-08-23 17:06:49 +10002122 size_t ret;
2123 va_list ap;
2124
2125 va_start(ap, fmt);
2126 ret = vsnprintf(str, count, fmt, ap);
2127 va_end(ap);
Damien Miller57f39152005-11-24 19:58:19 +11002128 return ret;
2129}
Tim Rice648f8762011-01-26 12:38:57 -08002130 ]], [[
Damien Millerd244a582014-08-23 17:06:49 +10002131char x[1];
2132if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11)
2133 return 1;
2134if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11)
2135 return 1;
2136return 0;
Tim Rice648f8762011-01-26 12:38:57 -08002137 ]])],
2138 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11002139 [
Tim Rice648f8762011-01-26 12:38:57 -08002140 AC_MSG_RESULT([no])
2141 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11002142 [Define if your snprintf is busted])
2143 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
2144 ],
2145 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
2146 )
2147fi
2148
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002149# On systems where [v]snprintf is broken, but is declared in stdio,
2150# check that the fmt argument is const char * or just char *.
2151# This is only useful for when BROKEN_SNPRINTF
2152AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08002153AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2154#include <stdio.h>
2155int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
2156 ]], [[
2157 snprintf(0, 0, 0);
2158 ]])],
2159 [AC_MSG_RESULT([yes])
2160 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002161 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08002162 [AC_MSG_RESULT([no])
2163 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002164
Damien Millerb4097182004-05-23 14:09:40 +10002165# Check for missing getpeereid (or equiv) support
2166NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11002167if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10002168 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08002169 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2170#include <sys/types.h>
2171#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2172 [ AC_MSG_RESULT([yes])
2173 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2174 ], [AC_MSG_RESULT([no])
2175 NO_PEERCHECK=1
2176 ])
Damien Millerb4097182004-05-23 14:09:40 +10002177fi
2178
Damien Millere8328192003-01-07 15:18:32 +11002179dnl see whether mkstemp() requires XXXXXX
2180if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2181AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002182AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002183 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002184#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002185 ]], [[
2186 char template[]="conftest.mkstemp-test";
2187 if (mkstemp(template) == -1)
2188 exit(1);
2189 unlink(template);
2190 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002191 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002192 [
Tim Rice648f8762011-01-26 12:38:57 -08002193 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002194 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002195 [
Tim Rice648f8762011-01-26 12:38:57 -08002196 AC_MSG_RESULT([yes])
2197 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002198 ],
2199 [
Tim Rice648f8762011-01-26 12:38:57 -08002200 AC_MSG_RESULT([yes])
2201 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002202 ]
Damien Millere8328192003-01-07 15:18:32 +11002203)
2204fi
2205
Darren Tucker70a3d552003-08-21 17:58:29 +10002206dnl make sure that openpty does not reacquire controlling terminal
2207if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002208 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002209 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002210 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002211#include <stdio.h>
2212#include <sys/fcntl.h>
2213#include <sys/types.h>
2214#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002215 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002216 pid_t pid;
2217 int fd, ptyfd, ttyfd, status;
2218
2219 pid = fork();
2220 if (pid < 0) { /* failed */
2221 exit(1);
2222 } else if (pid > 0) { /* parent */
2223 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002224 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002225 exit(WEXITSTATUS(status));
2226 else
2227 exit(2);
2228 } else { /* child */
2229 close(0); close(1); close(2);
2230 setsid();
2231 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2232 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2233 if (fd >= 0)
2234 exit(3); /* Acquired ctty: broken */
2235 else
2236 exit(0); /* Did not acquire ctty: OK */
2237 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002238 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002239 [
Tim Rice648f8762011-01-26 12:38:57 -08002240 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002241 ],
2242 [
Tim Rice648f8762011-01-26 12:38:57 -08002243 AC_MSG_RESULT([no])
2244 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002245 ],
2246 [
Tim Rice648f8762011-01-26 12:38:57 -08002247 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002248 ]
2249 )
2250fi
2251
Tim Rice8bb561b2005-03-17 16:23:19 -08002252if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2253 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002254 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002255 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002256 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002257#include <stdio.h>
2258#include <sys/socket.h>
2259#include <netdb.h>
2260#include <errno.h>
2261#include <netinet/in.h>
2262
2263#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002264 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002265 int err, sock;
2266 struct addrinfo *gai_ai, *ai, hints;
2267 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2268
2269 memset(&hints, 0, sizeof(hints));
2270 hints.ai_family = PF_UNSPEC;
2271 hints.ai_socktype = SOCK_STREAM;
2272 hints.ai_flags = AI_PASSIVE;
2273
2274 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2275 if (err != 0) {
2276 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2277 exit(1);
2278 }
2279
2280 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2281 if (ai->ai_family != AF_INET6)
2282 continue;
2283
2284 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2285 sizeof(ntop), strport, sizeof(strport),
2286 NI_NUMERICHOST|NI_NUMERICSERV);
2287
2288 if (err != 0) {
2289 if (err == EAI_SYSTEM)
2290 perror("getnameinfo EAI_SYSTEM");
2291 else
2292 fprintf(stderr, "getnameinfo failed: %s\n",
2293 gai_strerror(err));
2294 exit(2);
2295 }
2296
2297 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2298 if (sock < 0)
2299 perror("socket");
2300 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2301 if (errno == EBADF)
2302 exit(3);
2303 }
2304 }
2305 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002306 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002307 [
Tim Rice648f8762011-01-26 12:38:57 -08002308 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002309 ],
2310 [
Tim Rice648f8762011-01-26 12:38:57 -08002311 AC_MSG_RESULT([no])
2312 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002313 ],
2314 [
Tim Rice648f8762011-01-26 12:38:57 -08002315 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002316 ]
2317 )
2318fi
2319
Tim Rice8bb561b2005-03-17 16:23:19 -08002320if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2321 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002322 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002323 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002324 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002325#include <stdio.h>
2326#include <sys/socket.h>
2327#include <netdb.h>
2328#include <errno.h>
2329#include <netinet/in.h>
2330
2331#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002332 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002333 int err, sock;
2334 struct addrinfo *gai_ai, *ai, hints;
2335 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2336
2337 memset(&hints, 0, sizeof(hints));
2338 hints.ai_family = PF_UNSPEC;
2339 hints.ai_socktype = SOCK_STREAM;
2340 hints.ai_flags = AI_PASSIVE;
2341
2342 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2343 if (err != 0) {
2344 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2345 exit(1);
2346 }
2347
2348 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2349 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2350 continue;
2351
2352 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2353 sizeof(ntop), strport, sizeof(strport),
2354 NI_NUMERICHOST|NI_NUMERICSERV);
2355
2356 if (ai->ai_family == AF_INET && err != 0) {
2357 perror("getnameinfo");
2358 exit(2);
2359 }
2360 }
2361 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002362 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002363 [
Tim Rice648f8762011-01-26 12:38:57 -08002364 AC_MSG_RESULT([yes])
2365 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002366 [Define if you have a getaddrinfo that fails
2367 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002368 ],
2369 [
Tim Rice648f8762011-01-26 12:38:57 -08002370 AC_MSG_RESULT([no])
2371 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002372 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002373 [
Tim Rice648f8762011-01-26 12:38:57 -08002374 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002375 ]
2376 )
2377fi
2378
Darren Tuckere50e8c92015-02-21 15:10:33 +11002379if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2380 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2381 [#include <sys/types.h>
2382 #include <sys/socket.h>
2383 #include <netdb.h>])
2384fi
2385
Darren Tuckera56f1912004-11-02 20:30:54 +11002386if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002387 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2388 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2389 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002390 [
Tim Rice648f8762011-01-26 12:38:57 -08002391 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002392 ],
2393 [
Tim Rice648f8762011-01-26 12:38:57 -08002394 AC_MSG_RESULT([yes])
2395 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002396 [Conflicting defs for getspnam])
2397 ]
2398 )
2399fi
2400
Darren Tucker20e5e8b2016-08-02 12:16:34 +10002401dnl NetBSD added an strnvis and unfortunately made it incompatible with the
2402dnl existing one in OpenBSD and Linux's libbsd (the former having existed
2403dnl for over ten years). Despite this incompatibility being reported during
2404dnl development (see http://gnats.netbsd.org/44977) they still shipped it.
2405dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible
2406dnl implementation. Try to detect this mess, and assume the only safe option
2407dnl if we're cross compiling.
2408dnl
2409dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
2410dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
2411if test "x$ac_cv_func_strnvis" = "xyes"; then
2412 AC_MSG_CHECKING([for working strnvis])
2413 AC_RUN_IFELSE(
2414 [AC_LANG_PROGRAM([[
2415#include <signal.h>
2416#include <stdlib.h>
2417#include <string.h>
2418#include <vis.h>
2419static void sighandler(int sig) { _exit(1); }
2420 ]], [[
2421 char dst[16];
2422
2423 signal(SIGSEGV, sighandler);
2424 if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0)
2425 exit(0);
2426 exit(1)
2427 ]])],
2428 [AC_MSG_RESULT([yes])],
2429 [AC_MSG_RESULT([no])
2430 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])],
2431 [AC_MSG_WARN([cross compiling: assuming broken])
2432 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])]
2433 )
2434fi
2435
Darren Tuckerc7b5a472018-02-25 23:55:41 +11002436AC_CHECK_FUNCS([getpgrp],[
2437 AC_MSG_CHECKING([if getpgrp accepts zero args])
2438 AC_COMPILE_IFELSE(
2439 [AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])],
2440 [ AC_MSG_RESULT([yes])
2441 AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])],
2442 [ AC_MSG_RESULT([no])
2443 AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])]
2444 )
2445])
Damien Miller606f8802000-09-16 15:39:56 +11002446
Tim Riceaef73712002-05-11 13:17:42 -07002447# Search for OpenSSL
2448saved_CPPFLAGS="$CPPFLAGS"
2449saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002450AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002451 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2452 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002453 if test "x$openssl" = "xno" ; then
2454 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2455 fi
Ben Lindstrom23e13712000-10-29 22:49:19 +00002456 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002457 case "$withval" in
2458 # Relative paths
2459 ./*|../*) withval="`pwd`/$withval"
2460 esac
Tim Riceaef73712002-05-11 13:17:42 -07002461 if test -d "$withval/lib"; then
Darren Tucker2f0bad22019-01-21 21:28:27 +11002462 if test -n "${rpath_opt}"; then
2463 LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}"
Tim Riceaef73712002-05-11 13:17:42 -07002464 else
2465 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2466 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002467 elif test -d "$withval/lib64"; then
Darren Tucker2f0bad22019-01-21 21:28:27 +11002468 if test -n "${rpath_opt}"; then
2469 LDFLAGS="-L${withval}/lib64 ${rpath_opt}${withval}/lib64 ${LDFLAGS}"
Darren Tucker9f8703b2010-04-23 11:12:06 +10002470 else
2471 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2472 fi
Tim Riceaef73712002-05-11 13:17:42 -07002473 else
Darren Tucker2f0bad22019-01-21 21:28:27 +11002474 if test -n "${rpath_opt}"; then
2475 LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}"
Tim Riceaef73712002-05-11 13:17:42 -07002476 else
2477 LDFLAGS="-L${withval} ${LDFLAGS}"
2478 fi
2479 fi
2480 if test -d "$withval/include"; then
2481 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2482 else
2483 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2484 fi
Damien Millera22ba012000-03-02 23:09:20 +11002485 fi
2486 ]
2487)
Damien Millerb9c56672014-05-15 14:43:37 +10002488
Tim Rice648f8762011-01-26 12:38:57 -08002489AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002490 [ --without-openssl-header-check Disable OpenSSL version consistency check],
Damien Millerec932372002-01-22 22:16:03 +11002491 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002492 if test "x$withval" = "xno" ; then
2493 openssl_check_nonfatal=1
Damien Miller9975e482007-03-05 11:51:27 +11002494 fi
Damien Millerec932372002-01-22 22:16:03 +11002495 ]
2496)
2497
Damien Miller72ef7c12015-01-15 02:21:31 +11002498openssl_engine=no
Tim Rice648f8762011-01-26 12:38:57 -08002499AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002500 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
Damien Miller72ef7c12015-01-15 02:21:31 +11002501 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002502 if test "x$withval" != "xno" ; then
Darren Tuckerb5fa0cd2015-12-15 15:10:32 +11002503 if test "x$openssl" = "xno" ; then
2504 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2505 fi
Damien Miller72ef7c12015-01-15 02:21:31 +11002506 openssl_engine=yes
2507 fi
2508 ]
2509)
2510
2511if test "x$openssl" = "xyes" ; then
2512 LIBS="-lcrypto $LIBS"
Darren Tucker8d8340e2018-11-16 13:32:13 +11002513 AC_TRY_LINK_FUNC([RAND_add], ,
2514 [AC_MSG_ERROR([*** working libcrypto not found, check config.log])])
2515 AC_CHECK_HEADER([openssl/opensslv.h], ,
2516 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
Damien Miller72ef7c12015-01-15 02:21:31 +11002517
2518 # Determine OpenSSL header version
2519 AC_MSG_CHECKING([OpenSSL header version])
2520 AC_RUN_IFELSE(
2521 [AC_LANG_PROGRAM([[
Darren Tucker15605962015-11-10 11:14:47 +11002522 #include <stdlib.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002523 #include <stdio.h>
2524 #include <string.h>
2525 #include <openssl/opensslv.h>
2526 #define DATA "conftest.sslincver"
2527 ]], [[
2528 FILE *fd;
2529 int rc;
2530
2531 fd = fopen(DATA,"w");
2532 if(fd == NULL)
2533 exit(1);
2534
Darren Tuckerb3413532016-04-04 11:09:21 +10002535 if ((rc = fprintf(fd, "%08lx (%s)\n",
2536 (unsigned long)OPENSSL_VERSION_NUMBER,
2537 OPENSSL_VERSION_TEXT)) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002538 exit(1);
2539
2540 exit(0);
2541 ]])],
2542 [
2543 ssl_header_ver=`cat conftest.sslincver`
2544 AC_MSG_RESULT([$ssl_header_ver])
2545 ],
2546 [
2547 AC_MSG_RESULT([not found])
2548 AC_MSG_ERROR([OpenSSL version header not found.])
2549 ],
2550 [
2551 AC_MSG_WARN([cross compiling: not checking])
2552 ]
2553 )
2554
Darren Tucker262d81a2018-10-27 16:45:59 +11002555 # Determining OpenSSL library version is version dependent.
2556 AC_CHECK_FUNCS([OpenSSL_version OpenSSL_version_num])
2557
Damien Miller72ef7c12015-01-15 02:21:31 +11002558 # Determine OpenSSL library version
2559 AC_MSG_CHECKING([OpenSSL library version])
2560 AC_RUN_IFELSE(
2561 [AC_LANG_PROGRAM([[
2562 #include <stdio.h>
2563 #include <string.h>
2564 #include <openssl/opensslv.h>
2565 #include <openssl/crypto.h>
2566 #define DATA "conftest.ssllibver"
2567 ]], [[
2568 FILE *fd;
2569 int rc;
2570
2571 fd = fopen(DATA,"w");
2572 if(fd == NULL)
2573 exit(1);
Darren Tucker262d81a2018-10-27 16:45:59 +11002574#ifndef OPENSSL_VERSION
2575# define OPENSSL_VERSION SSLEAY_VERSION
2576#endif
2577#ifndef HAVE_OPENSSL_VERSION
Damien Miller406a24b2018-10-26 13:43:28 +11002578# define OpenSSL_version SSLeay_version
Darren Tucker262d81a2018-10-27 16:45:59 +11002579#endif
2580#ifndef HAVE_OPENSSL_VERSION_NUM
2581# define OpenSSL_version_num SSLeay
Damien Miller406a24b2018-10-26 13:43:28 +11002582#endif
Damien Miller859754b2018-10-23 17:10:41 +11002583 if ((rc = fprintf(fd, "%08lx (%s)\n",
2584 (unsigned long)OpenSSL_version_num(),
2585 OpenSSL_version(OPENSSL_VERSION))) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002586 exit(1);
2587
2588 exit(0);
2589 ]])],
2590 [
2591 ssl_library_ver=`cat conftest.ssllibver`
2592 # Check version is supported.
2593 case "$ssl_library_ver" in
Damien Milleraede1c32018-10-17 11:01:20 +11002594 10000*|0*)
2595 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
2596 ;;
2597 100*) ;; # 1.0.x
Damien Miller28c7b2c2018-11-23 10:45:20 +11002598 101000[[0123456]]*)
Damien Milleraede1c32018-10-17 11:01:20 +11002599 # https://github.com/openssl/openssl/pull/4613
2600 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")])
2601 ;;
2602 101*) ;; # 1.1.x
2603 200*) ;; # LibreSSL
Darren Tuckerc882d742019-01-22 20:38:40 +11002604 300*) ;; # OpenSSL development branch.
Damien Milleraede1c32018-10-17 11:01:20 +11002605 *)
Darren Tuckerc882d742019-01-22 20:38:40 +11002606 AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_library_ver")])
Damien Milleraede1c32018-10-17 11:01:20 +11002607 ;;
Damien Miller72ef7c12015-01-15 02:21:31 +11002608 esac
2609 AC_MSG_RESULT([$ssl_library_ver])
2610 ],
2611 [
2612 AC_MSG_RESULT([not found])
2613 AC_MSG_ERROR([OpenSSL library not found.])
2614 ],
2615 [
2616 AC_MSG_WARN([cross compiling: not checking])
2617 ]
2618 )
2619
2620 # Sanity check OpenSSL headers
2621 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2622 AC_RUN_IFELSE(
2623 [AC_LANG_PROGRAM([[
2624 #include <string.h>
2625 #include <openssl/opensslv.h>
Darren Tuckerc1d7e542015-12-15 14:27:09 +11002626 #include <openssl/crypto.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002627 ]], [[
Darren Tucker262d81a2018-10-27 16:45:59 +11002628#ifndef HAVE_OPENSSL_VERSION_NUM
2629# define OpenSSL_version_num SSLeay
Damien Miller406a24b2018-10-26 13:43:28 +11002630#endif
Damien Miller859754b2018-10-23 17:10:41 +11002631 exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Damien Miller72ef7c12015-01-15 02:21:31 +11002632 ]])],
2633 [
2634 AC_MSG_RESULT([yes])
2635 ],
2636 [
2637 AC_MSG_RESULT([no])
2638 if test "x$openssl_check_nonfatal" = "x"; then
2639 AC_MSG_ERROR([Your OpenSSL headers do not match your
2640 library. Check config.log for details.
2641 If you are sure your installation is consistent, you can disable the check
2642 by running "./configure --without-openssl-header-check".
2643 Also see contrib/findssl.sh for help identifying header/library mismatches.
2644 ])
2645 else
2646 AC_MSG_WARN([Your OpenSSL headers do not match your
2647 library. Check config.log for details.
2648 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2649 fi
2650 ],
2651 [
2652 AC_MSG_WARN([cross compiling: not checking])
2653 ]
2654 )
2655
2656 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2657 AC_LINK_IFELSE(
Damien Miller42c5ec42018-11-23 10:40:06 +11002658 [AC_LANG_PROGRAM([[ #include <openssl/err.h> ]],
2659 [[ ERR_load_crypto_strings(); ]])],
Damien Miller72ef7c12015-01-15 02:21:31 +11002660 [
2661 AC_MSG_RESULT([yes])
2662 ],
2663 [
2664 AC_MSG_RESULT([no])
2665 saved_LIBS="$LIBS"
2666 LIBS="$LIBS -ldl"
2667 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2668 AC_LINK_IFELSE(
Damien Miller42c5ec42018-11-23 10:40:06 +11002669 [AC_LANG_PROGRAM([[ #include <openssl/err.h> ]],
2670 [[ ERR_load_crypto_strings(); ]])],
Damien Miller72ef7c12015-01-15 02:21:31 +11002671 [
2672 AC_MSG_RESULT([yes])
2673 ],
2674 [
2675 AC_MSG_RESULT([no])
2676 LIBS="$saved_LIBS"
2677 ]
2678 )
2679 ]
2680 )
2681
2682 AC_CHECK_FUNCS([ \
2683 BN_is_prime_ex \
2684 DSA_generate_parameters_ex \
Damien Miller42c5ec42018-11-23 10:40:06 +11002685 EVP_CIPHER_CTX_ctrl \
Damien Miller72ef7c12015-01-15 02:21:31 +11002686 EVP_DigestFinal_ex \
Damien Miller42c5ec42018-11-23 10:40:06 +11002687 EVP_DigestInit_ex \
Damien Miller72ef7c12015-01-15 02:21:31 +11002688 EVP_MD_CTX_cleanup \
2689 EVP_MD_CTX_copy_ex \
Damien Miller42c5ec42018-11-23 10:40:06 +11002690 EVP_MD_CTX_init \
Damien Miller72ef7c12015-01-15 02:21:31 +11002691 HMAC_CTX_init \
2692 RSA_generate_key_ex \
2693 RSA_get_default_method \
Darren Tucker1801cd12018-11-08 15:03:11 +11002694 ])
Darren Tucker98f878d2018-11-25 14:05:08 +11002695
2696 # OpenSSL_add_all_algorithms may be a macro.
2697 AC_CHECK_FUNC(OpenSSL_add_all_algorithms,
2698 AC_DEFINE(HAVE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [as a function]),
2699 AC_CHECK_DECL(OpenSSL_add_all_algorithms,
2700 AC_DEFINE(HAVE_OPENSSL_ADD_ALL_ALGORITHMS, 1, [as a macro]), ,
2701 [[#include <openssl/evp.h>]]
2702 )
2703 )
2704
Darren Tucker1801cd12018-11-08 15:03:11 +11002705 # LibreSSL/OpenSSL 1.1x API
2706 AC_CHECK_FUNCS([ \
Darren Tuckerd0d1dfa2018-11-16 14:11:44 +11002707 OPENSSL_init_crypto \
Darren Tucker1801cd12018-11-08 15:03:11 +11002708 DH_get0_key \
2709 DH_get0_pqg \
2710 DH_set0_key \
2711 DH_set_length \
2712 DH_set0_pqg \
2713 DSA_get0_key \
2714 DSA_get0_pqg \
2715 DSA_set0_key \
2716 DSA_set0_pqg \
2717 DSA_SIG_get0 \
2718 DSA_SIG_set0 \
2719 ECDSA_SIG_get0 \
2720 ECDSA_SIG_set0 \
2721 EVP_CIPHER_CTX_iv \
2722 EVP_CIPHER_CTX_iv_noconst \
2723 EVP_CIPHER_CTX_get_iv \
2724 EVP_CIPHER_CTX_set_iv \
2725 RSA_get0_crt_params \
2726 RSA_get0_factors \
2727 RSA_get0_key \
2728 RSA_set0_crt_params \
2729 RSA_set0_factors \
2730 RSA_set0_key \
2731 RSA_meth_free \
2732 RSA_meth_dup \
2733 RSA_meth_set1_name \
2734 RSA_meth_get_finish \
2735 RSA_meth_set_priv_enc \
2736 RSA_meth_set_priv_dec \
2737 RSA_meth_set_finish \
2738 EVP_PKEY_get0_RSA \
2739 EVP_MD_CTX_new \
2740 EVP_MD_CTX_free \
Damien Miller72ef7c12015-01-15 02:21:31 +11002741 ])
2742
2743 if test "x$openssl_engine" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002744 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2745 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002746 #include <openssl/engine.h>
Tim Rice648f8762011-01-26 12:38:57 -08002747 ]], [[
Damien Miller72ef7c12015-01-15 02:21:31 +11002748 ENGINE_load_builtin_engines();
2749 ENGINE_register_all_complete();
Tim Rice648f8762011-01-26 12:38:57 -08002750 ]])],
2751 [ AC_MSG_RESULT([yes])
2752 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002753 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002754 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2755 ])
Damien Miller72ef7c12015-01-15 02:21:31 +11002756 fi
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002757
Damien Miller72ef7c12015-01-15 02:21:31 +11002758 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2759 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2760 AC_LINK_IFELSE(
Darren Tucker37bcef52013-11-09 18:39:25 +11002761 [AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002762 #include <string.h>
2763 #include <openssl/evp.h>
2764 ]], [[
2765 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2766 ]])],
2767 [
2768 AC_MSG_RESULT([no])
2769 ],
2770 [
2771 AC_MSG_RESULT([yes])
2772 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2773 [libcrypto is missing AES 192 and 256 bit functions])
2774 ]
2775 )
2776
2777 # Check for OpenSSL with EVP_aes_*ctr
2778 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2779 AC_LINK_IFELSE(
2780 [AC_LANG_PROGRAM([[
2781 #include <string.h>
2782 #include <openssl/evp.h>
2783 ]], [[
2784 exit(EVP_aes_128_ctr() == NULL ||
2785 EVP_aes_192_cbc() == NULL ||
2786 EVP_aes_256_cbc() == NULL);
2787 ]])],
2788 [
2789 AC_MSG_RESULT([yes])
2790 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2791 [libcrypto has EVP AES CTR])
2792 ],
2793 [
2794 AC_MSG_RESULT([no])
2795 ]
2796 )
2797
2798 # Check for OpenSSL with EVP_aes_*gcm
2799 AC_MSG_CHECKING([whether OpenSSL has AES GCM 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_gcm() == NULL ||
2806 EVP_aes_256_gcm() == NULL ||
2807 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2808 EVP_CTRL_GCM_IV_GEN == 0 ||
2809 EVP_CTRL_GCM_SET_TAG == 0 ||
2810 EVP_CTRL_GCM_GET_TAG == 0 ||
2811 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2812 ]])],
2813 [
2814 AC_MSG_RESULT([yes])
2815 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2816 [libcrypto has EVP AES GCM])
2817 ],
2818 [
2819 AC_MSG_RESULT([no])
2820 unsupported_algorithms="$unsupported_cipers \
Damien Miller679ce882016-07-15 13:44:38 +10002821 aes128-gcm@openssh.com \
2822 aes256-gcm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002823 ]
2824 )
2825
Damien Miller72ef7c12015-01-15 02:21:31 +11002826 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2827 AC_LINK_IFELSE(
2828 [AC_LANG_PROGRAM([[
2829 #include <string.h>
2830 #include <openssl/evp.h>
2831 ]], [[
2832 if(EVP_DigestUpdate(NULL, NULL,0))
2833 exit(0);
2834 ]])],
2835 [
2836 AC_MSG_RESULT([yes])
2837 ],
2838 [
2839 AC_MSG_RESULT([no])
2840 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2841 [Define if EVP_DigestUpdate returns void])
2842 ]
2843 )
2844
2845 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2846 # because the system crypt() is more featureful.
2847 if test "x$check_for_libcrypt_before" = "x1"; then
2848 AC_CHECK_LIB([crypt], [crypt])
2849 fi
2850
2851 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2852 # version in OpenSSL.
2853 if test "x$check_for_libcrypt_later" = "x1"; then
2854 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2855 fi
Damien Miller00797e82015-03-04 05:02:45 +11002856 AC_CHECK_FUNCS([crypt DES_crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002857
Darren Tucker11cba2a2019-07-23 21:51:22 +10002858 # Check for SHA256, SHA384 and SHA512 support in OpenSSL
2859 AC_CHECK_FUNCS([EVP_sha256 EVP_sha384 EVP_sha512])
2860
Damien Miller72ef7c12015-01-15 02:21:31 +11002861 # Search for RIPE-MD support in OpenSSL
2862 AC_CHECK_FUNCS([EVP_ripemd160], ,
2863 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002864 hmac-ripemd160 \
2865 hmac-ripemd160@openssh.com \
Damien Miller72ef7c12015-01-15 02:21:31 +11002866 hmac-ripemd160-etm@openssh.com"
2867 ]
2868 )
2869
2870 # Check complete ECC support in OpenSSL
2871 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2872 AC_LINK_IFELSE(
2873 [AC_LANG_PROGRAM([[
2874 #include <openssl/ec.h>
2875 #include <openssl/ecdh.h>
2876 #include <openssl/ecdsa.h>
2877 #include <openssl/evp.h>
2878 #include <openssl/objects.h>
2879 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002880 ]], [[
2881 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2882 const EVP_MD *m = EVP_sha256(); /* We need this too */
Darren Tucker37bcef52013-11-09 18:39:25 +11002883 ]])],
2884 [ AC_MSG_RESULT([yes])
Damien Miller72ef7c12015-01-15 02:21:31 +11002885 enable_nistp256=1 ],
2886 [ AC_MSG_RESULT([no]) ]
2887 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002888
Damien Miller72ef7c12015-01-15 02:21:31 +11002889 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2890 AC_LINK_IFELSE(
2891 [AC_LANG_PROGRAM([[
2892 #include <openssl/ec.h>
2893 #include <openssl/ecdh.h>
2894 #include <openssl/ecdsa.h>
2895 #include <openssl/evp.h>
2896 #include <openssl/objects.h>
2897 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002898 ]], [[
2899 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2900 const EVP_MD *m = EVP_sha384(); /* We need this too */
2901 ]])],
2902 [ AC_MSG_RESULT([yes])
2903 enable_nistp384=1 ],
2904 [ AC_MSG_RESULT([no]) ]
2905 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002906
Damien Miller72ef7c12015-01-15 02:21:31 +11002907 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2908 AC_LINK_IFELSE(
2909 [AC_LANG_PROGRAM([[
2910 #include <openssl/ec.h>
2911 #include <openssl/ecdh.h>
2912 #include <openssl/ecdsa.h>
2913 #include <openssl/evp.h>
2914 #include <openssl/objects.h>
2915 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002916 ]], [[
2917 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2918 const EVP_MD *m = EVP_sha512(); /* We need this too */
2919 ]])],
2920 [ AC_MSG_RESULT([yes])
2921 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2922 AC_RUN_IFELSE(
2923 [AC_LANG_PROGRAM([[
2924 #include <openssl/ec.h>
2925 #include <openssl/ecdh.h>
2926 #include <openssl/ecdsa.h>
2927 #include <openssl/evp.h>
2928 #include <openssl/objects.h>
2929 #include <openssl/opensslv.h>
2930 ]],[[
2931 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2932 const EVP_MD *m = EVP_sha512(); /* We need this too */
2933 exit(e == NULL || m == NULL);
2934 ]])],
2935 [ AC_MSG_RESULT([yes])
2936 enable_nistp521=1 ],
2937 [ AC_MSG_RESULT([no]) ],
2938 [ AC_MSG_WARN([cross-compiling: assuming yes])
2939 enable_nistp521=1 ]
2940 )],
2941 AC_MSG_RESULT([no])
2942 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002943
Damien Miller72ef7c12015-01-15 02:21:31 +11002944 COMMENT_OUT_ECC="#no ecc#"
2945 TEST_SSH_ECC=no
2946
2947 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2948 test x$enable_nistp521 = x1; then
2949 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
Damien Millere2cb4452019-01-21 11:32:28 +11002950 AC_CHECK_FUNCS([EC_KEY_METHOD_new])
Damien Miller72ef7c12015-01-15 02:21:31 +11002951 fi
2952 if test x$enable_nistp256 = x1; then
2953 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2954 [libcrypto has NID_X9_62_prime256v1])
2955 TEST_SSH_ECC=yes
2956 COMMENT_OUT_ECC=""
2957 else
Damien Miller679ce882016-07-15 13:44:38 +10002958 unsupported_algorithms="$unsupported_algorithms \
2959 ecdsa-sha2-nistp256 \
2960 ecdh-sha2-nistp256 \
2961 ecdsa-sha2-nistp256-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002962 fi
2963 if test x$enable_nistp384 = x1; then
2964 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2965 TEST_SSH_ECC=yes
2966 COMMENT_OUT_ECC=""
2967 else
Damien Miller679ce882016-07-15 13:44:38 +10002968 unsupported_algorithms="$unsupported_algorithms \
2969 ecdsa-sha2-nistp384 \
2970 ecdh-sha2-nistp384 \
2971 ecdsa-sha2-nistp384-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002972 fi
2973 if test x$enable_nistp521 = x1; then
2974 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2975 TEST_SSH_ECC=yes
2976 COMMENT_OUT_ECC=""
2977 else
Damien Miller679ce882016-07-15 13:44:38 +10002978 unsupported_algorithms="$unsupported_algorithms \
2979 ecdh-sha2-nistp521 \
2980 ecdsa-sha2-nistp521 \
2981 ecdsa-sha2-nistp521-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002982 fi
2983
2984 AC_SUBST([TEST_SSH_ECC])
2985 AC_SUBST([COMMENT_OUT_ECC])
2986else
2987 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Miller00797e82015-03-04 05:02:45 +11002988 AC_CHECK_FUNCS([crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002989fi
Damien Miller6af914a2010-09-10 11:39:26 +10002990
Damien Miller00f9cd22014-07-15 10:41:38 +10002991AC_CHECK_FUNCS([ \
2992 arc4random \
2993 arc4random_buf \
2994 arc4random_stir \
2995 arc4random_uniform \
2996])
2997
Tim Rice99203ec2007-03-26 09:35:28 -07002998saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002999AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07003000 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08003001 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
3002 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Ricee1d93702016-05-31 11:13:22 -07003003 [Define if system has libiaf that supports set_id])
Tim Rice0eeaf122007-09-10 16:24:17 -07003004 ])
Tim Rice99203ec2007-03-26 09:35:28 -07003005])
3006LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11003007
3008### Configure cryptographic random number support
3009
Damien Miller10479cc2018-04-10 10:19:02 +10003010# Check whether OpenSSL seeds itself
Damien Miller72ef7c12015-01-15 02:21:31 +11003011if test "x$openssl" = "xyes" ; then
3012 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
3013 AC_RUN_IFELSE(
3014 [AC_LANG_PROGRAM([[
3015 #include <string.h>
3016 #include <openssl/rand.h>
3017 ]], [[
3018 exit(RAND_status() == 1 ? 0 : 1);
3019 ]])],
3020 [
3021 OPENSSL_SEEDS_ITSELF=yes
3022 AC_MSG_RESULT([yes])
3023 ],
3024 [
3025 AC_MSG_RESULT([no])
3026 ],
3027 [
3028 AC_MSG_WARN([cross compiling: assuming yes])
3029 # This is safe, since we will fatal() at runtime if
3030 # OpenSSL is not seeded correctly.
3031 OPENSSL_SEEDS_ITSELF=yes
3032 ]
3033 )
3034fi
Damien Miller6c21c512002-01-22 21:57:53 +11003035
Damien Millerf22019b2011-05-05 13:48:37 +10003036# PRNGD TCP socket
3037AC_ARG_WITH([prngd-port],
3038 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
3039 [
3040 case "$withval" in
3041 no)
3042 withval=""
3043 ;;
3044 [[0-9]]*)
3045 ;;
3046 *)
3047 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
3048 ;;
3049 esac
3050 if test ! -z "$withval" ; then
3051 PRNGD_PORT="$withval"
3052 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
3053 [Port number of PRNGD/EGD random number socket])
3054 fi
3055 ]
3056)
3057
3058# PRNGD Unix domain socket
3059AC_ARG_WITH([prngd-socket],
3060 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
3061 [
3062 case "$withval" in
3063 yes)
3064 withval="/var/run/egd-pool"
3065 ;;
3066 no)
3067 withval=""
3068 ;;
3069 /*)
3070 ;;
3071 *)
3072 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
3073 ;;
3074 esac
3075
3076 if test ! -z "$withval" ; then
3077 if test ! -z "$PRNGD_PORT" ; then
3078 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
3079 fi
3080 if test ! -r "$withval" ; then
3081 AC_MSG_WARN([Entropy socket is not readable])
3082 fi
3083 PRNGD_SOCKET="$withval"
3084 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
3085 [Location of PRNGD/EGD random number socket])
3086 fi
3087 ],
3088 [
3089 # Check for existing socket only if we don't have a random device already
3090 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
3091 AC_MSG_CHECKING([for PRNGD/EGD socket])
3092 # Insert other locations here
3093 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
3094 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
3095 PRNGD_SOCKET="$sock"
3096 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
3097 break;
3098 fi
3099 done
3100 if test ! -z "$PRNGD_SOCKET" ; then
3101 AC_MSG_RESULT([$PRNGD_SOCKET])
3102 else
3103 AC_MSG_RESULT([not found])
3104 fi
3105 fi
3106 ]
3107)
3108
3109# Which randomness source do we use?
3110if test ! -z "$PRNGD_PORT" ; then
3111 RAND_MSG="PRNGd port $PRNGD_PORT"
3112elif test ! -z "$PRNGD_SOCKET" ; then
3113 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
3114elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
3115 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Damien Miller72ef7c12015-01-15 02:21:31 +11003116 [Define if you want the OpenSSL internally seeded PRNG only])
Damien Millerf22019b2011-05-05 13:48:37 +10003117 RAND_MSG="OpenSSL internal ONLY"
Damien Miller72ef7c12015-01-15 02:21:31 +11003118elif test "x$openssl" = "xno" ; then
3119 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 +10003120else
3121 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])
3122fi
3123
Darren Tucker3e6bde42006-08-20 20:03:50 +10003124# Check for PAM libs
3125PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003126AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003127 [ --with-pam Enable PAM support ],
3128 [
3129 if test "x$withval" != "xno" ; then
3130 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
3131 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
3132 AC_MSG_ERROR([PAM headers not found])
3133 fi
3134
3135 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003136 AC_CHECK_LIB([dl], [dlopen], , )
3137 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
3138 AC_CHECK_FUNCS([pam_getenvlist])
3139 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003140 LIBS="$saved_LIBS"
3141
3142 PAM_MSG="yes"
3143
Darren Tucker20e9f972007-03-25 18:26:01 +10003144 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08003145 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003146 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10003147
Darren Tucker3e6bde42006-08-20 20:03:50 +10003148 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10003149 case "$LIBS" in
3150 *-ldl*)
3151 # libdl already in LIBS
3152 ;;
3153 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10003154 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10003155 ;;
3156 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10003157 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10003158 fi
3159 ]
3160)
3161
Damien Miller8bd81e12016-08-16 13:30:56 +10003162AC_ARG_WITH([pam-service],
3163 [ --with-pam-service=name Specify PAM service name ],
3164 [
3165 if test "x$withval" != "xno" && \
3166 test "x$withval" != "xyes" ; then
3167 AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE],
3168 ["$withval"], [sshd PAM service name])
3169 fi
3170 ]
3171)
3172
Darren Tucker3e6bde42006-08-20 20:03:50 +10003173# Check for older PAM
3174if test "x$PAM_MSG" = "xyes" ; then
3175 # Check PAM strerror arguments (old PAM)
3176 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08003177 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10003178#include <stdlib.h>
3179#if defined(HAVE_SECURITY_PAM_APPL_H)
3180#include <security/pam_appl.h>
3181#elif defined (HAVE_PAM_PAM_APPL_H)
3182#include <pam/pam_appl.h>
3183#endif
Tim Rice648f8762011-01-26 12:38:57 -08003184 ]], [[
3185(void)pam_strerror((pam_handle_t *)NULL, -1);
3186 ]])], [AC_MSG_RESULT([no])], [
3187 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003188 [Define if you have an old version of PAM
3189 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08003190 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003191 PAM_MSG="yes (old library)"
Damien Miller72ef7c12015-01-15 02:21:31 +11003192
Tim Rice648f8762011-01-26 12:38:57 -08003193 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003194fi
Damien Miller6c21c512002-01-22 21:57:53 +11003195
Damien Miller6482d902014-05-27 14:34:42 +10003196case "$host" in
3197*-*-cygwin*)
3198 SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER
3199 ;;
3200*)
3201 SSH_PRIVSEP_USER=sshd
3202 ;;
3203esac
Tim Rice648f8762011-01-26 12:38:57 -08003204AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00003205 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00003206 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003207 if test -n "$withval" && test "x$withval" != "xno" && \
3208 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10003209 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00003210 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08003211 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00003212)
Damien Miller6482d902014-05-27 14:34:42 +10003213if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then
3214 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER],
3215 [Cygwin function to fetch non-privileged user for privilege separation])
3216else
3217 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
3218 [non-privileged user for privilege separation])
3219fi
Tim Rice648f8762011-01-26 12:38:57 -08003220AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00003221
Damien Miller91f40d82013-02-22 11:37:00 +11003222if test "x$have_linux_no_new_privs" = "x1" ; then
3223AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
3224 #include <sys/types.h>
3225 #include <linux/seccomp.h>
3226])
3227fi
3228if test "x$have_seccomp_filter" = "x1" ; then
3229AC_MSG_CHECKING([kernel for seccomp_filter support])
3230AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3231 #include <errno.h>
3232 #include <elf.h>
3233 #include <linux/audit.h>
3234 #include <linux/seccomp.h>
3235 #include <stdlib.h>
3236 #include <sys/prctl.h>
3237 ]],
3238 [[ int i = $seccomp_audit_arch;
3239 errno = 0;
3240 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
3241 exit(errno == EFAULT ? 0 : 1); ]])],
3242 [ AC_MSG_RESULT([yes]) ], [
3243 AC_MSG_RESULT([no])
3244 # Disable seccomp filter as a target
3245 have_seccomp_filter=0
3246 ]
3247)
3248fi
3249
Damien Miller69ff1df2011-06-23 08:30:03 +10003250# Decide which sandbox style to use
3251sandbox_arg=""
3252AC_ARG_WITH([sandbox],
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003253 [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)],
Damien Miller69ff1df2011-06-23 08:30:03 +10003254 [
3255 if test "x$withval" = "xyes" ; then
3256 sandbox_arg=""
3257 else
3258 sandbox_arg="$withval"
3259 fi
3260 ]
3261)
Darren Tucker60395f92012-07-03 14:31:18 +10003262
3263# Some platforms (seems to be the ones that have a kernel poll(2)-type
3264# function with which they implement select(2)) use an extra file descriptor
3265# when calling select(2), which means we can't use the rlimit sandbox.
3266AC_MSG_CHECKING([if select works with descriptor rlimit])
3267AC_RUN_IFELSE(
3268 [AC_LANG_PROGRAM([[
3269#include <sys/types.h>
3270#ifdef HAVE_SYS_TIME_H
3271# include <sys/time.h>
3272#endif
3273#include <sys/resource.h>
3274#ifdef HAVE_SYS_SELECT_H
3275# include <sys/select.h>
3276#endif
3277#include <errno.h>
3278#include <fcntl.h>
3279#include <stdlib.h>
3280 ]],[[
3281 struct rlimit rl_zero;
3282 int fd, r;
3283 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11003284 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10003285
3286 fd = open("/dev/null", O_RDONLY);
3287 FD_ZERO(&fds);
3288 FD_SET(fd, &fds);
3289 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3290 setrlimit(RLIMIT_FSIZE, &rl_zero);
3291 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11003292 tv.tv_sec = 1;
3293 tv.tv_usec = 0;
3294 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10003295 exit (r == -1 ? 1 : 0);
3296 ]])],
3297 [AC_MSG_RESULT([yes])
3298 select_works_with_rlimit=yes],
3299 [AC_MSG_RESULT([no])
3300 select_works_with_rlimit=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003301 [AC_MSG_WARN([cross compiling: assuming yes])
3302 select_works_with_rlimit=yes]
Darren Tucker60395f92012-07-03 14:31:18 +10003303)
3304
Darren Tuckerff008de2013-03-06 17:48:48 +11003305AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
3306AC_RUN_IFELSE(
3307 [AC_LANG_PROGRAM([[
3308#include <sys/types.h>
3309#ifdef HAVE_SYS_TIME_H
3310# include <sys/time.h>
3311#endif
3312#include <sys/resource.h>
3313#include <errno.h>
3314#include <stdlib.h>
3315 ]],[[
3316 struct rlimit rl_zero;
Darren Tucker34e87fb2019-04-30 12:27:57 +10003317 int r;
Darren Tuckerff008de2013-03-06 17:48:48 +11003318
3319 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3320 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
3321 exit (r == -1 ? 1 : 0);
3322 ]])],
3323 [AC_MSG_RESULT([yes])
3324 rlimit_nofile_zero_works=yes],
3325 [AC_MSG_RESULT([no])
3326 rlimit_nofile_zero_works=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003327 [AC_MSG_WARN([cross compiling: assuming yes])
3328 rlimit_nofile_zero_works=yes]
Darren Tuckerff008de2013-03-06 17:48:48 +11003329)
3330
Darren Tuckerd545a4b2012-07-03 22:48:31 +10003331AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
3332AC_RUN_IFELSE(
3333 [AC_LANG_PROGRAM([[
3334#include <sys/types.h>
3335#include <sys/resource.h>
3336#include <stdlib.h>
3337 ]],[[
3338 struct rlimit rl_zero;
3339
3340 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3341 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
3342 ]])],
3343 [AC_MSG_RESULT([yes])],
3344 [AC_MSG_RESULT([no])
3345 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3346 [setrlimit RLIMIT_FSIZE works])],
3347 [AC_MSG_WARN([cross compiling: assuming yes])]
3348)
3349
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003350if test "x$sandbox_arg" = "xpledge" || \
3351 ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then
3352 test "x$ac_cv_func_pledge" != "xyes" && \
3353 AC_MSG_ERROR([pledge sandbox requires pledge(2) support])
3354 SANDBOX_STYLE="pledge"
Damien Millerfafe1d82015-10-14 09:22:15 -07003355 AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)])
Damien Miller9846a2f2015-10-08 04:30:48 +11003356elif test "x$sandbox_arg" = "xsystrace" || \
Damien Miller69ff1df2011-06-23 08:30:03 +10003357 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003358 test "x$have_systr_policy_kill" != "x1" && \
3359 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003360 SANDBOX_STYLE="systrace"
3361 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003362elif test "x$sandbox_arg" = "xdarwin" || \
3363 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3364 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003365 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3366 "x$ac_cv_header_sandbox_h" != "xyes" && \
3367 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003368 SANDBOX_STYLE="darwin"
3369 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003370elif test "x$sandbox_arg" = "xseccomp_filter" || \
3371 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003372 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003373 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003374 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003375 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3376 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003377 test "x$have_linux_no_new_privs" = "x1" && \
3378 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003379 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003380 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3381 test "x$have_linux_no_new_privs" != "x1" && \
3382 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3383 test "x$have_seccomp_filter" != "x1" && \
3384 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3385 test "x$ac_cv_func_prctl" != "xyes" && \
3386 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3387 SANDBOX_STYLE="seccomp_filter"
3388 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003389elif test "x$sandbox_arg" = "xcapsicum" || \
3390 ( test -z "$sandbox_arg" && \
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003391 test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003392 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003393 test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \
3394 AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003395 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003396 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003397 SANDBOX_STYLE="capsicum"
3398 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003399elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003400 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003401 test "x$select_works_with_rlimit" = "xyes" && \
3402 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003403 test "x$ac_cv_func_setrlimit" != "xyes" && \
3404 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003405 test "x$select_works_with_rlimit" != "xyes" && \
3406 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003407 SANDBOX_STYLE="rlimit"
3408 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller4626cba2016-01-08 14:24:56 +11003409elif test "x$sandbox_arg" = "xsolaris" || \
3410 ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then
3411 SANDBOX_STYLE="solaris"
3412 AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges])
Damien Miller69ff1df2011-06-23 08:30:03 +10003413elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3414 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3415 SANDBOX_STYLE="none"
3416 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3417else
Tim Ricea6e60612011-08-17 21:48:22 -07003418 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003419fi
3420
Ben Lindstromb5628642000-10-18 00:02:25 +00003421# Cheap hack to ensure NEWS-OS libraries are arranged right.
3422if test ! -z "$SONY" ; then
3423 LIBS="$LIBS -liberty";
3424fi
3425
Damien Miller57f39152005-11-24 19:58:19 +11003426# Check for long long datatypes
3427AC_CHECK_TYPES([long long, unsigned long long, long double])
3428
3429# Check datatype sizes
Dag-Erling Smørgravd0153c72018-10-09 23:03:40 +02003430AC_CHECK_SIZEOF([short int])
3431AC_CHECK_SIZEOF([int])
3432AC_CHECK_SIZEOF([long int])
3433AC_CHECK_SIZEOF([long long int])
Damien Millerc6398ef1999-11-20 12:18:40 +11003434
Damien Millerfa2bb692002-04-23 23:22:25 +10003435# Sanity check long long for some platforms (AIX)
3436if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3437 ac_cv_sizeof_long_long_int=0
3438fi
3439
Darren Tucker537f1ed2005-10-25 18:38:33 +10003440# compute LLONG_MIN and LLONG_MAX if we don't know them.
3441if test -z "$have_llong_max"; then
3442 AC_MSG_CHECKING([for max value of long long])
3443 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003444 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003445#include <stdio.h>
3446/* Why is this so damn hard? */
3447#ifdef __GNUC__
3448# undef __GNUC__
3449#endif
3450#define __USE_ISOC99
3451#include <limits.h>
3452#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003453#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3454
3455/*
3456 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3457 * we do this the hard way.
3458 */
3459static int
3460fprint_ll(FILE *f, long long n)
3461{
3462 unsigned int i;
3463 int l[sizeof(long long) * 8];
3464
3465 if (n < 0)
3466 if (fprintf(f, "-") < 0)
3467 return -1;
3468 for (i = 0; n != 0; i++) {
3469 l[i] = my_abs(n % 10);
3470 n /= 10;
3471 }
3472 do {
3473 if (fprintf(f, "%d", l[--i]) < 0)
3474 return -1;
3475 } while (i != 0);
3476 if (fprintf(f, " ") < 0)
3477 return -1;
3478 return 0;
3479}
Tim Rice648f8762011-01-26 12:38:57 -08003480 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003481 FILE *f;
3482 long long i, llmin, llmax = 0;
3483
3484 if((f = fopen(DATA,"w")) == NULL)
3485 exit(1);
3486
3487#if defined(LLONG_MIN) && defined(LLONG_MAX)
3488 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3489 llmin = LLONG_MIN;
3490 llmax = LLONG_MAX;
3491#else
3492 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3493 /* This will work on one's complement and two's complement */
3494 for (i = 1; i > llmax; i <<= 1, i++)
3495 llmax = i;
3496 llmin = llmax + 1LL; /* wrap */
3497#endif
3498
3499 /* Sanity check */
3500 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003501 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3502 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003503 fprintf(f, "unknown unknown\n");
3504 exit(2);
3505 }
3506
Darren Tuckerd1450db2006-03-13 19:06:51 +11003507 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003508 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003509 if (fprint_ll(f, llmax) < 0)
3510 exit(4);
3511 if (fclose(f) < 0)
3512 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003513 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003514 ]])],
3515 [
3516 llong_min=`$AWK '{print $1}' conftest.llminmax`
3517 llong_max=`$AWK '{print $2}' conftest.llminmax`
3518
Tim Rice648f8762011-01-26 12:38:57 -08003519 AC_MSG_RESULT([$llong_max])
3520 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003521 [max value of long long calculated by configure])
3522 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003523 AC_MSG_RESULT([$llong_min])
3524 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003525 [min value of long long calculated by configure])
3526 ],
3527 [
Tim Rice648f8762011-01-26 12:38:57 -08003528 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003529 ],
3530 [
3531 AC_MSG_WARN([cross compiling: not checking])
3532 ]
3533 )
3534fi
3535
3536
Damien Millera22ba012000-03-02 23:09:20 +11003537# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003538AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003539 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3540 [[ u_int a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003541 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
Tim Rice648f8762011-01-26 12:38:57 -08003542 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003543])
3544if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003545 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003546 have_u_int=1
3547fi
3548
Damien Miller61e50f12000-05-08 20:49:37 +10003549AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003550 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3551 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003552 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003553 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003554])
3555if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003556 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003557 have_intxx_t=1
3558fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003559
3560if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003561 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003562then
3563 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003564 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3565 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003566 [
Tim Rice648f8762011-01-26 12:38:57 -08003567 AC_DEFINE([HAVE_INTXX_T])
3568 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003569 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003570 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003571fi
3572
Damien Miller578783e2000-09-23 14:12:24 +11003573AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003574 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003575#include <sys/types.h>
3576#ifdef HAVE_STDINT_H
3577# include <stdint.h>
3578#endif
3579#include <sys/socket.h>
3580#ifdef HAVE_SYS_BITYPES_H
3581# include <sys/bitypes.h>
3582#endif
Tim Rice648f8762011-01-26 12:38:57 -08003583 ]], [[
3584int64_t a; a = 1;
3585 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003586 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003587 ])
Damien Miller578783e2000-09-23 14:12:24 +11003588])
3589if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003590 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003591fi
3592
Damien Miller61e50f12000-05-08 20:49:37 +10003593AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003594 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3595 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003596 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003597 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003598])
3599if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003600 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003601 have_u_intxx_t=1
3602fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003603
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003604if test -z "$have_u_intxx_t" ; then
3605 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003606 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3607 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003608 [
Tim Rice648f8762011-01-26 12:38:57 -08003609 AC_DEFINE([HAVE_U_INTXX_T])
3610 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003611 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003612 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003613fi
3614
Damien Miller578783e2000-09-23 14:12:24 +11003615AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3617 [[ u_int64_t a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003618 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003619 ])
Damien Miller578783e2000-09-23 14:12:24 +11003620])
3621if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003622 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003623 have_u_int64_t=1
3624fi
3625
Damien Millerc2868192014-01-30 10:21:19 +11003626if (test -z "$have_u_int64_t" && \
3627 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3628then
Tim Rice4cec93f2002-02-26 08:40:48 -08003629 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003630 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3631 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003632 [
Tim Rice648f8762011-01-26 12:38:57 -08003633 AC_DEFINE([HAVE_U_INT64_T])
3634 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003635 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003636 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003637fi
3638
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003639if test -z "$have_u_intxx_t" ; then
3640 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003641 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003642#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003643 ]], [[
3644 uint8_t a;
3645 uint16_t b;
3646 uint32_t c;
3647 a = b = c = 1;
3648 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003649 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003650 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003651 ])
3652 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003653 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003654 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003655 fi
3656fi
3657
Damien Millerc2868192014-01-30 10:21:19 +11003658if (test -z "$have_uintxx_t" && \
3659 test "x$ac_cv_header_stdint_h" = "xyes")
3660then
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003661 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003662 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3663 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003664 [
Tim Rice648f8762011-01-26 12:38:57 -08003665 AC_DEFINE([HAVE_UINTXX_T])
3666 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003667 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003668 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003669fi
3670
Damien Millerc2868192014-01-30 10:21:19 +11003671if (test -z "$have_uintxx_t" && \
3672 test "x$ac_cv_header_inttypes_h" = "xyes")
3673then
Darren Tucker6d725682014-01-17 19:17:34 +11003674 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3675 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3676 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3677 [
3678 AC_DEFINE([HAVE_UINTXX_T])
3679 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003680 ], [ AC_MSG_RESULT([no])
Darren Tucker6d725682014-01-17 19:17:34 +11003681 ])
3682fi
3683
Damien Milleredb82922000-06-20 13:25:52 +10003684if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003685 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003686then
3687 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003688 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003689#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003690 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003691 int8_t a; int16_t b; int32_t c;
3692 u_int8_t e; u_int16_t f; u_int32_t g;
3693 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003694 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003695 [
Tim Rice648f8762011-01-26 12:38:57 -08003696 AC_DEFINE([HAVE_U_INTXX_T])
3697 AC_DEFINE([HAVE_INTXX_T])
3698 AC_MSG_RESULT([yes])
3699 ], [AC_MSG_RESULT([no])
3700 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003701fi
3702
Damien Miller58be7382001-09-15 21:31:54 +10003703
3704AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003705 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3706 [[ u_char foo; foo = 125; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003707 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
Tim Rice648f8762011-01-26 12:38:57 -08003708 ])
Damien Miller58be7382001-09-15 21:31:54 +10003709])
3710if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003711 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003712fi
3713
Darren Tucker007e3b32013-11-03 18:43:55 +11003714AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3715#include <sys/types.h>
3716#include <stdint.h>
3717])
3718
Tim Rice13aae5e2001-10-21 17:53:58 -07003719TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003720
Tim Rice648f8762011-01-26 12:38:57 -08003721AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3722AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003723#include <sys/types.h>
3724#ifdef HAVE_SYS_BITYPES_H
3725#include <sys/bitypes.h>
3726#endif
3727#ifdef HAVE_SYS_STATFS_H
3728#include <sys/statfs.h>
3729#endif
3730#ifdef HAVE_SYS_STATVFS_H
3731#include <sys/statvfs.h>
3732#endif
3733])
Tim Rice4cec93f2002-02-26 08:40:48 -08003734
Darren Tucker11057562018-02-25 11:22:57 +11003735AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
3736#include <sys/types.h>
3737#ifdef HAVE_SYS_BITYPES_H
3738#include <sys/bitypes.h>
3739#endif
3740#ifdef HAVE_SYS_STATFS_H
3741#include <sys/statfs.h>
3742#endif
3743#ifdef HAVE_SYS_STATVFS_H
3744#include <sys/statvfs.h>
3745#endif
3746#ifdef HAVE_SYS_VFS_H
3747#include <sys/vfs.h>
3748#endif
3749]])
3750
3751
Tim Rice648f8762011-01-26 12:38:57 -08003752AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003753[#include <sys/types.h>
3754#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003755
Damien Miller61e50f12000-05-08 20:49:37 +10003756AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003757 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3758 [[ size_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003759 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003760 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003761])
3762if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003763 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003764fi
Damien Miller95058511999-12-29 10:36:45 +11003765
Damien Miller615f9392000-05-17 22:53:33 +10003766AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003767 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3768 [[ ssize_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003769 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003770 ])
Damien Miller615f9392000-05-17 22:53:33 +10003771])
3772if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003773 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003774fi
3775
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003776AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003777 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3778 [[ clock_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003779 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003780 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003781])
3782if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003783 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003784fi
3785
Damien Millerb54b40e2000-06-23 08:23:34 +10003786AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003787 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003788#include <sys/types.h>
3789#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003790 ]], [[ sa_family_t foo; foo = 1235; ]])],
3791 [ ac_cv_have_sa_family_t="yes" ],
3792 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003793#include <sys/types.h>
3794#include <sys/socket.h>
3795#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003796 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003797 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003798 [ ac_cv_have_sa_family_t="no" ]
3799 )
Tim Rice648f8762011-01-26 12:38:57 -08003800 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003801])
3802if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003803 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003804 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003805fi
3806
Damien Miller0f91b4e2000-06-18 15:43:25 +10003807AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003808 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3809 [[ pid_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003810 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003811 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003812])
3813if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003814 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003815fi
3816
3817AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003818 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3819 [[ mode_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003820 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003821 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003822])
3823if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003824 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003825fi
3826
Damien Miller61e50f12000-05-08 20:49:37 +10003827
3828AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003829 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003830#include <sys/types.h>
3831#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003832 ]], [[ struct sockaddr_storage s; ]])],
3833 [ ac_cv_have_struct_sockaddr_storage="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003834 [ ac_cv_have_struct_sockaddr_storage="no"
Tim Rice648f8762011-01-26 12:38:57 -08003835 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003836])
3837if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003838 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003839 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003840fi
Damien Miller34132e52000-01-14 15:45:46 +11003841
Damien Miller61e50f12000-05-08 20:49:37 +10003842AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003843 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003844#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003845#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003846 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3847 [ ac_cv_have_struct_sockaddr_in6="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003848 [ ac_cv_have_struct_sockaddr_in6="no"
Tim Rice648f8762011-01-26 12:38:57 -08003849 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003850])
3851if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003852 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003853 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003854fi
Damien Miller34132e52000-01-14 15:45:46 +11003855
Damien Miller61e50f12000-05-08 20:49:37 +10003856AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003857 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003858#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003859#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003860 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3861 [ ac_cv_have_struct_in6_addr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003862 [ ac_cv_have_struct_in6_addr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003863 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003864])
3865if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003866 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003867 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003868
3869dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003870 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003871 [
3872#ifdef HAVE_SYS_TYPES_H
3873#include <sys/types.h>
3874#endif
3875#include <netinet/in.h>
3876 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003877fi
Damien Miller34132e52000-01-14 15:45:46 +11003878
Damien Miller61e50f12000-05-08 20:49:37 +10003879AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003880 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003881#include <sys/types.h>
3882#include <sys/socket.h>
3883#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003884 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3885 [ ac_cv_have_struct_addrinfo="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003886 [ ac_cv_have_struct_addrinfo="no"
Tim Rice648f8762011-01-26 12:38:57 -08003887 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003888])
3889if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003890 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003891 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003892fi
3893
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003894AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3896 [[ struct timeval tv; tv.tv_sec = 1;]])],
3897 [ ac_cv_have_struct_timeval="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003898 [ ac_cv_have_struct_timeval="no"
Tim Rice648f8762011-01-26 12:38:57 -08003899 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003900])
3901if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003902 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003903 have_struct_timeval=1
3904fi
3905
Tim Rice648f8762011-01-26 12:38:57 -08003906AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003907
Damien Miller10479cc2018-04-10 10:19:02 +10003908# We need int64_t or else certain parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003909if test "x$ac_cv_have_int64_t" = "xno" && \
3910 test "x$ac_cv_sizeof_long_int" != "x8" && \
3911 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003912 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3913 echo "an alternative compiler (I.E., GCC) before continuing."
3914 echo ""
3915 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003916else
3917dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003918 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003919 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003920#include <stdio.h>
3921#include <string.h>
3922#ifdef HAVE_SNPRINTF
3923main()
3924{
3925 char buf[50];
3926 char expected_out[50];
3927 int mazsize = 50 ;
3928#if (SIZEOF_LONG_INT == 8)
3929 long int num = 0x7fffffffffffffff;
3930#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003931 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003932#endif
3933 strcpy(expected_out, "9223372036854775807");
3934 snprintf(buf, mazsize, "%lld", num);
3935 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003936 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003937 exit(0);
3938}
3939#else
3940main() { exit(0); }
3941#endif
Tim Rice648f8762011-01-26 12:38:57 -08003942 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003943 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003944 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003945fi
3946
Damien Miller78315eb2000-09-29 23:01:36 +11003947dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003948OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3949OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3950OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3951OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3952OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3953OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3954OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3955OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3956OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3957OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3958OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3959OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3960OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3961OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3962OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3963OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3964OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003965
3966AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Millerbcd14852017-06-10 23:41:25 +10003967AC_CHECK_MEMBERS([struct stat.st_mtim])
3968AC_CHECK_MEMBERS([struct stat.st_mtime])
Damien Miller6332da22013-04-23 14:25:52 +10003969AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3970struct passwd.pw_change, struct passwd.pw_expire],
3971[], [], [[
3972#include <sys/types.h>
3973#include <pwd.h>
3974]])
3975
Tim Rice648f8762011-01-26 12:38:57 -08003976AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003977 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003978[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003979#include <stdio.h>
3980#if HAVE_SYS_TYPES_H
3981# include <sys/types.h>
3982#endif
3983#include <netinet/in.h>
3984#include <arpa/nameser.h>
3985#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003986]])
andre2ff7b5d2000-06-03 14:57:40 +00003987
Damien Miller61e50f12000-05-08 20:49:37 +10003988AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3989 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003990 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003991#include <sys/types.h>
3992#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003993 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3994 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3995 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003996])
3997if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003998 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003999fi
4000
Damien Miller61e50f12000-05-08 20:49:37 +10004001AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
4002 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004003 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004004#include <sys/types.h>
4005#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004006 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
4007 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004008 [ ac_cv_have___ss_family_in_struct_ss="no"
Tim Rice648f8762011-01-26 12:38:57 -08004009 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004010])
4011if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004012 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004013 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004014fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11004015
Tim Rice28bbb0c2002-05-27 17:37:32 -07004016dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00004017AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
4018 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004019 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004020#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00004021#include <sys/socket.h>
4022#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004023 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004024#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10004025#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004026exit(1);
4027#endif
4028struct msghdr m;
4029m.msg_accrights = 0;
4030exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004031 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00004032 [ ac_cv_have_accrights_in_msghdr="yes" ],
4033 [ ac_cv_have_accrights_in_msghdr="no" ]
4034 )
4035])
4036if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004037 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004038 [Define if your system uses access rights style
4039 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00004040fi
4041
Tim Rice648f8762011-01-26 12:38:57 -08004042AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
4043AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10004044#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10004045#include <sys/stat.h>
4046#ifdef HAVE_SYS_TIME_H
4047# include <sys/time.h>
4048#endif
4049#ifdef HAVE_SYS_MOUNT_H
4050#include <sys/mount.h>
4051#endif
4052#ifdef HAVE_SYS_STATVFS_H
4053#include <sys/statvfs.h>
4054#endif
Tim Rice648f8762011-01-26 12:38:57 -08004055 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
4056 [ AC_MSG_RESULT([yes]) ],
4057 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10004058
Tim Rice648f8762011-01-26 12:38:57 -08004059 AC_MSG_CHECKING([if fsid_t has member val])
4060 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004061#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004062#include <sys/statvfs.h>
4063 ]], [[ fsid_t t; t.val[0] = 0; ]])],
4064 [ AC_MSG_RESULT([yes])
4065 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
4066 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004067
Tim Rice648f8762011-01-26 12:38:57 -08004068 AC_MSG_CHECKING([if f_fsid has member __val])
4069 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004070#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004071#include <sys/statvfs.h>
4072 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
4073 [ AC_MSG_RESULT([yes])
4074 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
4075 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004076])
Darren Tucker77001382008-06-09 06:17:53 +10004077
Kevin Stevesa44e0352002-04-07 16:18:03 +00004078AC_CACHE_CHECK([for msg_control field in struct msghdr],
4079 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004080 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004081#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00004082#include <sys/socket.h>
4083#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004084 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004085#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10004086#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004087exit(1);
4088#endif
4089struct msghdr m;
4090m.msg_control = 0;
4091exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004092 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00004093 [ ac_cv_have_control_in_msghdr="yes" ],
4094 [ ac_cv_have_control_in_msghdr="no" ]
4095 )
4096])
4097if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004098 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004099 [Define if your system uses ancillary data style
4100 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00004101fi
4102
Damien Miller61e50f12000-05-08 20:49:37 +10004103AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08004104 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4105 [[ extern char *__progname; printf("%s", __progname); ]])],
4106 [ ac_cv_libc_defines___progname="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004107 [ ac_cv_libc_defines___progname="no"
Tim Rice648f8762011-01-26 12:38:57 -08004108 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004109])
4110if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004111 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10004112fi
4113
Kevin Steves4846f4a2002-03-22 18:19:53 +00004114AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08004115 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4116 [[ printf("%s", __FUNCTION__); ]])],
4117 [ ac_cv_cc_implements___FUNCTION__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004118 [ ac_cv_cc_implements___FUNCTION__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004119 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004120])
4121if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004122 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004123 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004124fi
4125
4126AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08004127 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4128 [[ printf("%s", __func__); ]])],
4129 [ ac_cv_cc_implements___func__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004130 [ ac_cv_cc_implements___func__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004131 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004132])
4133if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004134 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004135fi
4136
Damien Miller57f39152005-11-24 19:58:19 +11004137AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004138 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4139#include <stdarg.h>
4140va_list x,y;
4141 ]], [[ va_copy(x,y); ]])],
4142 [ ac_cv_have_va_copy="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004143 [ ac_cv_have_va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004144 ])
Damien Miller57f39152005-11-24 19:58:19 +11004145])
4146if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004147 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004148fi
4149
4150AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004151 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4152#include <stdarg.h>
4153va_list x,y;
4154 ]], [[ __va_copy(x,y); ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07004155 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004156 ])
Damien Miller57f39152005-11-24 19:58:19 +11004157])
4158if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004159 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004160fi
4161
Damien Miller4f8e6692001-07-14 13:22:53 +10004162AC_CACHE_CHECK([whether getopt has optreset support],
4163 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08004164 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
4165 [[ extern int optreset; optreset = 0; ]])],
4166 [ ac_cv_have_getopt_optreset="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004167 [ ac_cv_have_getopt_optreset="no"
Tim Rice648f8762011-01-26 12:38:57 -08004168 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10004169])
4170if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004171 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004172 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10004173fi
Damien Millera22ba012000-03-02 23:09:20 +11004174
Damien Millerecbb26d2000-07-15 14:59:14 +10004175AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08004176 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4177[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
4178 [ ac_cv_libc_defines_sys_errlist="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004179 [ ac_cv_libc_defines_sys_errlist="no"
Tim Rice648f8762011-01-26 12:38:57 -08004180 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10004181])
4182if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004183 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004184 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10004185fi
4186
4187
Damien Miller11fa2cc2000-08-16 10:35:58 +10004188AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08004189 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4190[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
4191 [ ac_cv_libc_defines_sys_nerr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004192 [ ac_cv_libc_defines_sys_nerr="no"
Tim Rice648f8762011-01-26 12:38:57 -08004193 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004194])
4195if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004196 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004197fi
4198
Darren Tucker5f88d342003-10-15 16:57:57 +10004199# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08004200AC_SEARCH_LIBS([getrrsetbyname], [resolv],
4201 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004202 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10004203 [
Darren Tucker5f88d342003-10-15 16:57:57 +10004204 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08004205 AC_SEARCH_LIBS([res_query], [resolv])
4206 AC_SEARCH_LIBS([dn_expand], [resolv])
4207 AC_MSG_CHECKING([if res_query will link])
4208 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004209#include <sys/types.h>
4210#include <netinet/in.h>
4211#include <arpa/nameser.h>
4212#include <netdb.h>
4213#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004214 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004215 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004216 ]])],
4217 AC_MSG_RESULT([yes]),
4218 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10004219 saved_LIBS="$LIBS"
4220 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08004221 AC_MSG_CHECKING([for res_query in -lresolv])
4222 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004223#include <sys/types.h>
4224#include <netinet/in.h>
4225#include <arpa/nameser.h>
4226#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10004227#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004228 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10004229 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004230 ]])],
4231 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10004232 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004233 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10004234 ])
Tim Rice648f8762011-01-26 12:38:57 -08004235 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10004236 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07004237 [#include <sys/types.h>
4238 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08004239 AC_CHECK_MEMBER([HEADER.ad],
4240 [AC_DEFINE([HAVE_HEADER_AD], [1],
4241 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10004242 [#include <arpa/nameser.h>])
4243 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10004244
Tim Rice648f8762011-01-26 12:38:57 -08004245AC_MSG_CHECKING([if struct __res_state _res is an extern])
4246AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004247#include <stdio.h>
4248#if HAVE_SYS_TYPES_H
4249# include <sys/types.h>
4250#endif
4251#include <netinet/in.h>
4252#include <arpa/nameser.h>
4253#include <resolv.h>
4254extern struct __res_state _res;
Darren Tucker7ad8b282015-09-11 13:11:02 +10004255 ]], [[
4256struct __res_state *volatile p = &_res; /* force resolution of _res */
4257return 0;
4258 ]],)],
Tim Rice648f8762011-01-26 12:38:57 -08004259 [AC_MSG_RESULT([yes])
4260 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004261 [Define if you have struct __res_state _res as an extern])
4262 ],
Tim Rice648f8762011-01-26 12:38:57 -08004263 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004264)
4265
Damien Miller73b42d22006-04-22 21:26:08 +10004266# Check whether user wants SELinux support
4267SELINUX_MSG="no"
4268LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08004269AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11004270 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10004271 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10004272 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004273 AC_DEFINE([WITH_SELINUX], [1],
4274 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10004275 SELINUX_MSG="yes"
4276 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08004277 AC_MSG_ERROR([SELinux support requires selinux.h header]))
4278 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11004279 [ LIBSELINUX="-lselinux"
4280 LIBS="$LIBS -lselinux"
4281 ],
Tim Rice648f8762011-01-26 12:38:57 -08004282 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11004283 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10004284 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08004285 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10004286 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10004287 fi ]
4288)
Tim Rice648f8762011-01-26 12:38:57 -08004289AC_SUBST([SSHLIBS])
4290AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10004291
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004292# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11004293KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004294AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11004295 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11004296 [ if test "x$withval" != "xno" ; then
4297 if test "x$withval" = "xyes" ; then
4298 KRB5ROOT="/usr/local"
4299 else
4300 KRB5ROOT=${withval}
4301 fi
4302
Tim Rice648f8762011-01-26 12:38:57 -08004303 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004304 KRB5_MSG="yes"
4305
Darren Tucker4089fc12016-12-08 12:57:24 +11004306 AC_PATH_TOOL([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10004307 [$KRB5ROOT/bin/krb5-config],
4308 [$KRB5ROOT/bin:$PATH])
4309 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11004310 K5CFLAGS="`$KRB5CONF --cflags`"
4311 K5LIBS="`$KRB5CONF --libs`"
4312 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004313
Tim Rice648f8762011-01-26 12:38:57 -08004314 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004315 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08004316 AC_MSG_RESULT([yes])
4317 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004318 [Define this if you want GSSAPI
4319 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11004320 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
4321 GSSLIBS="`$KRB5CONF --libs gssapi`"
4322 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11004323 else
Tim Rice648f8762011-01-26 12:38:57 -08004324 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004325 fi
Tim Rice648f8762011-01-26 12:38:57 -08004326 AC_MSG_CHECKING([whether we are using Heimdal])
4327 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4328 ]], [[ char *tmp = heimdal_version; ]])],
4329 [ AC_MSG_RESULT([yes])
4330 AC_DEFINE([HEIMDAL], [1],
4331 [Define this if you are using the Heimdal
4332 version of Kerberos V5]) ],
4333 [AC_MSG_RESULT([no])
4334 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004335 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004336 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11004337 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08004338 AC_MSG_CHECKING([whether we are using Heimdal])
4339 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4340 ]], [[ char *tmp = heimdal_version; ]])],
4341 [ AC_MSG_RESULT([yes])
4342 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11004343 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10004344 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08004345 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10004346 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08004347 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11004348 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08004349 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004350 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08004351 ])
4352 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004353
Tim Rice648f8762011-01-26 12:38:57 -08004354 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
4355 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004356 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08004357 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
4358 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004359 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11004360 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
4361 [ AC_DEFINE([GSSAPI])
4362 GSSLIBS="-lgss" ],
4363 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
4364 ])
Darren Tucker964de182013-02-22 10:39:59 +11004365 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08004366
Tim Rice648f8762011-01-26 12:38:57 -08004367 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004368 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11004369 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004370 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004371 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11004372 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004373 ]
4374 )
4375
4376 oldCPP="$CPPFLAGS"
4377 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004378 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004379 [ CPPFLAGS="$oldCPP" ])
4380
Damien Millera8e06ce2003-11-21 23:48:55 +11004381 fi
Darren Tucker2f0bad22019-01-21 21:28:27 +11004382 if test -n "${rpath_opt}" ; then
4383 LDFLAGS="$LDFLAGS ${rpath_opt}${KRB5ROOT}/lib"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004384 fi
4385 if test ! -z "$blibpath" ; then
4386 blibpath="$blibpath:${KRB5ROOT}/lib"
4387 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004388
Tim Rice648f8762011-01-26 12:38:57 -08004389 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4390 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4391 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004392
Tim Rice648f8762011-01-26 12:38:57 -08004393 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4394 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004395
4396 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4397#ifdef HAVE_GSSAPI_H
4398# include <gssapi.h>
4399#elif defined(HAVE_GSSAPI_GSSAPI_H)
4400# include <gssapi/gssapi.h>
4401#endif
4402
4403#ifdef HAVE_GSSAPI_GENERIC_H
4404# include <gssapi_generic.h>
4405#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4406# include <gssapi/gssapi_generic.h>
4407#endif
4408 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004409 saved_LIBS="$LIBS"
4410 LIBS="$LIBS $K5LIBS"
4411 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4412 LIBS="$saved_LIBS"
4413
Darren Tucker0d27ed12004-02-24 10:37:33 +11004414 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004415 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004416)
Darren Tucker964de182013-02-22 10:39:59 +11004417AC_SUBST([GSSLIBS])
4418AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004419
Damien Millera22ba012000-03-02 23:09:20 +11004420# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004421
Damien Millerf58c6722002-05-13 13:15:42 +10004422PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004423AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004424 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004425 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004426 if test -n "$withval" && test "x$withval" != "xno" && \
4427 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004428 PRIVSEP_PATH=$withval
4429 fi
4430 ]
4431)
Tim Rice648f8762011-01-26 12:38:57 -08004432AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004433
Tim Rice648f8762011-01-26 12:38:57 -08004434AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004435 [ --with-xauth=PATH Specify path to xauth program ],
4436 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004437 if test -n "$withval" && test "x$withval" != "xno" && \
4438 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004439 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004440 fi
4441 ],
4442 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004443 TestPath="$PATH"
4444 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4445 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4446 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4447 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004448 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004449 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004450 xauth_path="/usr/openwin/bin/xauth"
4451 fi
4452 ]
4453)
4454
Damien Miller7d901272003-01-13 16:55:22 +11004455STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004456AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004457 [ --disable-strip Disable calling strip(1) on install],
4458 [
4459 if test "x$enableval" = "xno" ; then
4460 STRIP_OPT=
4461 fi
4462 ]
4463)
Tim Rice648f8762011-01-26 12:38:57 -08004464AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004465
Damien Millera19cf472000-11-29 13:28:50 +11004466if test -z "$xauth_path" ; then
4467 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004468 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004469else
Tim Rice648f8762011-01-26 12:38:57 -08004470 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004471 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004472 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004473 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004474fi
Damien Millera22ba012000-03-02 23:09:20 +11004475
Tim Rice90f42b02011-06-02 18:17:49 -07004476dnl # --with-maildir=/path/to/mail gets top priority.
4477dnl # if maildir is set in the platform case statement above we use that.
4478dnl # Otherwise we run a program to get the dir from system headers.
4479dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4480dnl # If we find _PATH_MAILDIR we do nothing because that is what
4481dnl # session.c expects anyway. Otherwise we set to the value found
4482dnl # stripping any trailing slash. If for some strage reason our program
4483dnl # does not find what it needs, we default to /var/spool/mail.
4484# Check for mail directory
4485AC_ARG_WITH([maildir],
4486 [ --with-maildir=/path/to/mail Specify your system mail directory],
4487 [
4488 if test "X$withval" != X && test "x$withval" != xno && \
4489 test "x${withval}" != xyes; then
4490 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4491 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4492 fi
4493 ],[
4494 if test "X$maildir" != "X"; then
4495 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4496 else
4497 AC_MSG_CHECKING([Discovering system mail directory])
4498 AC_RUN_IFELSE(
4499 [AC_LANG_PROGRAM([[
4500#include <stdio.h>
4501#include <string.h>
4502#ifdef HAVE_PATHS_H
4503#include <paths.h>
4504#endif
4505#ifdef HAVE_MAILLOCK_H
4506#include <maillock.h>
4507#endif
4508#define DATA "conftest.maildir"
4509 ]], [[
4510 FILE *fd;
4511 int rc;
4512
4513 fd = fopen(DATA,"w");
4514 if(fd == NULL)
4515 exit(1);
4516
4517#if defined (_PATH_MAILDIR)
4518 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4519 exit(1);
4520#elif defined (MAILDIR)
4521 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4522 exit(1);
4523#elif defined (_PATH_MAIL)
4524 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4525 exit(1);
4526#else
4527 exit (2);
4528#endif
4529
4530 exit(0);
4531 ]])],
4532 [
Tim Ricee1d93702016-05-31 11:13:22 -07004533 maildir_what=`awk -F: '{print $1}' conftest.maildir`
Tim Rice90f42b02011-06-02 18:17:49 -07004534 maildir=`awk -F: '{print $2}' conftest.maildir \
4535 | sed 's|/$||'`
4536 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4537 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4538 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4539 fi
4540 ],
4541 [
4542 if test "X$ac_status" = "X2";then
4543# our test program didn't find it. Default to /var/spool/mail
4544 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4545 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4546 else
4547 AC_MSG_RESULT([*** not found ***])
4548 fi
4549 ],
4550 [
4551 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4552 ]
4553 )
4554 fi
4555 ]
4556) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004557
Darren Tucker623d92f2004-09-12 22:36:15 +10004558if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004559 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4560 disable_ptmx_check=yes
4561fi
Damien Millera22ba012000-03-02 23:09:20 +11004562if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004563 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004564 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004565 [
Tim Rice648f8762011-01-26 12:38:57 -08004566 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004567 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004568 have_dev_ptmx=1
4569 ]
4570 )
4571 fi
Damien Millera22ba012000-03-02 23:09:20 +11004572fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004573
Darren Tucker623d92f2004-09-12 22:36:15 +10004574if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004575 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004576 [
Tim Rice648f8762011-01-26 12:38:57 -08004577 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004578 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004579 have_dev_ptc=1
4580 ]
4581 )
4582else
4583 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4584fi
Damien Miller204ad072000-03-02 23:56:12 +11004585
Damien Millera22ba012000-03-02 23:09:20 +11004586# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004587AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004588 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004589 [
Damien Miller897741e2001-04-16 10:41:46 +10004590 case "$withval" in
4591 man|cat|doc)
4592 MANTYPE=$withval
4593 ;;
4594 *)
Tim Rice648f8762011-01-26 12:38:57 -08004595 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004596 ;;
4597 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004598 ]
4599)
Ben Lindstrombc709922001-04-18 18:04:21 +00004600if test -z "$MANTYPE"; then
Darren Tucker285546b2019-05-10 15:04:42 +10004601 if ${MANDOC} ${srcdir}/ssh.1 >/dev/null 2>&1; then
4602 MANTYPE=doc
4603 elif ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
Ben Lindstrombc709922001-04-18 18:04:21 +00004604 MANTYPE=doc
4605 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4606 MANTYPE=man
4607 else
4608 MANTYPE=cat
4609 fi
4610fi
Tim Rice648f8762011-01-26 12:38:57 -08004611AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004612if test "$MANTYPE" = "doc"; then
4613 mansubdir=man;
4614else
4615 mansubdir=$MANTYPE;
4616fi
Tim Rice648f8762011-01-26 12:38:57 -08004617AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004618
Damien Millera22ba012000-03-02 23:09:20 +11004619# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004620MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004621AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004622 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004623 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004624 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004625 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004626 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004627 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004628 fi
4629 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004630)
4631
Damien Millera22ba012000-03-02 23:09:20 +11004632# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004633AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004634 [ --without-shadow Disable shadow password support],
4635 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004636 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004637 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004638 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004639 fi
4640 ]
4641)
4642
Damien Miller1f335fb2000-06-26 11:31:33 +10004643if test -z "$disable_shadow" ; then
4644 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004646#include <sys/types.h>
4647#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004648struct spwd sp;
4649 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4650 [ sp_expire_available=yes ], [
4651 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004652
4653 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004654 AC_MSG_RESULT([yes])
4655 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004656 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004657 else
Tim Rice648f8762011-01-26 12:38:57 -08004658 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004659 fi
4660fi
4661
Damien Millera22ba012000-03-02 23:09:20 +11004662# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004663if test ! -z "$IPADDR_IN_DISPLAY" ; then
4664 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004665 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004666 [Define if you need to use IP address
4667 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004668else
Damien Millera8e06ce2003-11-21 23:48:55 +11004669 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004670 AC_ARG_WITH([ipaddr-display],
Tim Rice6397eed2015-06-03 21:41:11 -07004671 [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY],
Damien Miller9a947342000-08-30 10:03:33 +11004672 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004673 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004674 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004675 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004676 fi
4677 ]
4678 )
4679fi
Damien Miller76112de1999-12-21 11:18:08 +11004680
Darren Tuckere1a790d2003-09-16 11:52:19 +10004681# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004682AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004683 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004684 [ if test "x$enableval" = "xno"; then
4685 AC_MSG_NOTICE([/etc/default/login handling disabled])
4686 etc_default_login=no
4687 else
4688 etc_default_login=yes
4689 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004690 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4691 then
4692 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4693 etc_default_login=no
4694 else
4695 etc_default_login=yes
4696 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004697)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004698
Darren Tucker2f9573d2005-02-10 22:28:54 +11004699if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004700 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004701 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004702 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004703 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004704 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004705 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004706fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004707
Tim Rice43a1c132002-04-17 21:19:14 -07004708dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004709if test $ac_cv_func_login_getcapbool = "yes" && \
4710 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004711 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004712fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004713
Damien Millera22ba012000-03-02 23:09:20 +11004714# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004715SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004716AC_ARG_WITH([default-path],
Tim Rice6397eed2015-06-03 21:41:11 -07004717 [ --with-default-path= Specify default $PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004718 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004719 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004720 AC_MSG_WARN([
4721--with-default-path=PATH has no effect on this system.
4722Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004723 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004724 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004725 AC_MSG_WARN([
4726--with-default-path=PATH will only be used if PATH is not defined in
4727$external_path_file .])
4728 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004729 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004730 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004731 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004732 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004733 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4734 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004735 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004736 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004737 AC_MSG_WARN([
4738If PATH is defined in $external_path_file, ensure the path to scp is included,
4739otherwise scp will not work.])
4740 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004741 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004742 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004743/* find out what STDPATH is */
4744#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004745#ifdef HAVE_PATHS_H
4746# include <paths.h>
4747#endif
4748#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004749# ifdef _PATH_USERPATH /* Irix */
4750# define _PATH_STDPATH _PATH_USERPATH
4751# else
4752# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4753# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004754#endif
4755#include <sys/types.h>
4756#include <sys/stat.h>
4757#include <fcntl.h>
4758#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004759 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004760 FILE *fd;
4761 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004762
Tim Rice59ea0a02001-03-10 13:50:45 -08004763 fd = fopen(DATA,"w");
4764 if(fd == NULL)
4765 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004766
Tim Rice59ea0a02001-03-10 13:50:45 -08004767 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4768 exit(1);
4769
4770 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004771 ]])],
4772 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004773 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4774 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4775 )
4776# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004777 t_bindir="${bindir}"
4778 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4779 t_bindir=`eval echo ${t_bindir}`
4780 case $t_bindir in
4781 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4782 esac
4783 case $t_bindir in
4784 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4785 esac
4786 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004787 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4788 if test $? -ne 0 ; then
4789 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4790 if test $? -ne 0 ; then
4791 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004792 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004793 fi
4794 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004795 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004796)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004797if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004798 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4799 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004800fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004801
Damien Millera18bbd32002-05-13 10:48:57 +10004802# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004803AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004804 [ --with-superuser-path= Specify different path for super-user],
4805 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004806 if test -n "$withval" && test "x$withval" != "xno" && \
4807 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004808 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004809 [Define if you want a different $PATH
4810 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004811 superuser_path=$withval
4812 fi
4813 ]
4814)
4815
4816
Damien Miller61e50f12000-05-08 20:49:37 +10004817AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004818IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004819AC_ARG_WITH(4in6,
4820 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4821 [
4822 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004823 AC_MSG_RESULT([yes])
4824 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004825 [Detect IPv4 in IPv6 mapped addresses
4826 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004827 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004828 else
Tim Rice648f8762011-01-26 12:38:57 -08004829 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004830 fi
Tim Rice648f8762011-01-26 12:38:57 -08004831 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004832 if test "x$inet6_default_4in6" = "xyes"; then
4833 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004834 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004835 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004836 else
4837 AC_MSG_RESULT([no (default)])
4838 fi
4839 ]
4840)
4841
Damien Miller60396b02001-02-18 17:01:00 +11004842# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004843BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004844AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004845 [ --with-bsd-auth Enable BSD auth support],
4846 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004847 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004848 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004849 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004850 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004851 fi
4852 ]
4853)
4854
Damien Millera22ba012000-03-02 23:09:20 +11004855# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004856piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004857# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004858if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004859 piddir=`eval echo ${sysconfdir}`
4860 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004861 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004862 esac
4863fi
4864
Tim Rice648f8762011-01-26 12:38:57 -08004865AC_ARG_WITH([pid-dir],
Darren Tucker075e2582018-02-13 17:36:43 +11004866 [ --with-pid-dir=PATH Specify location of sshd.pid file],
Tim Rice88f2ab52002-03-17 12:17:34 -08004867 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004868 if test -n "$withval" && test "x$withval" != "xno" && \
4869 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004870 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004871 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004872 AC_MSG_WARN([** no $piddir directory on this system **])
4873 fi
4874 fi
4875 ]
4876)
4877
Tim Ricee1d93702016-05-31 11:13:22 -07004878AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
Tim Rice648f8762011-01-26 12:38:57 -08004879 [Specify location of ssh.pid])
4880AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004881
andre2ff7b5d2000-06-03 14:57:40 +00004882dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004883AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004884 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004885 [
4886 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004887 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004888 fi
4889 ]
andre2ff7b5d2000-06-03 14:57:40 +00004890)
Tim Rice648f8762011-01-26 12:38:57 -08004891AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004892 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004893 [
4894 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004895 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004896 fi
4897 ]
andre2ff7b5d2000-06-03 14:57:40 +00004898)
Tim Rice648f8762011-01-26 12:38:57 -08004899AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004900 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004901 [
4902 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004903 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004904 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004905 fi
4906 ]
andre2ff7b5d2000-06-03 14:57:40 +00004907)
Tim Rice648f8762011-01-26 12:38:57 -08004908AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004909 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004910 [
4911 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004912 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004913 fi
4914 ]
andre2ff7b5d2000-06-03 14:57:40 +00004915)
Tim Rice648f8762011-01-26 12:38:57 -08004916AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004917 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004918 [
4919 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004920 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004921 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004922 fi
4923 ]
andre2ff7b5d2000-06-03 14:57:40 +00004924)
Tim Rice648f8762011-01-26 12:38:57 -08004925AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004926 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004927 [
4928 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004929 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004930 fi
4931 ]
andre2ff7b5d2000-06-03 14:57:40 +00004932)
Tim Rice648f8762011-01-26 12:38:57 -08004933AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004934 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004935 [
4936 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004937 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004938 [Define if you don't want to use pututline()
4939 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004940 fi
4941 ]
andre2ff7b5d2000-06-03 14:57:40 +00004942)
Tim Rice648f8762011-01-26 12:38:57 -08004943AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004944 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004945 [
4946 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004947 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004948 [Define if you don't want to use pututxline()
4949 etc. to write [uw]tmpx])
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_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004954 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004955 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004956 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004957 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004958 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004959 conf_lastlog_location=$withval
4960 fi
4961 ]
4962)
andre2ff7b5d2000-06-03 14:57:40 +00004963
4964dnl lastlog, [uw]tmpx? detection
4965dnl NOTE: set the paths in the platform section to avoid the
4966dnl need for command-line parameters
4967dnl lastlog and [uw]tmp are subject to a file search if all else fails
4968
4969dnl lastlog detection
4970dnl NOTE: the code itself will detect if lastlog is a directory
4971AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004972AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004973#include <sys/types.h>
4974#include <utmp.h>
4975#ifdef HAVE_LASTLOG_H
4976# include <lastlog.h>
4977#endif
Damien Miller2994e082000-06-04 15:51:47 +10004978#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004979# include <paths.h>
4980#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004981#ifdef HAVE_LOGIN_H
4982# include <login.h>
4983#endif
Tim Rice648f8762011-01-26 12:38:57 -08004984 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4985 [ AC_MSG_RESULT([yes]) ],
4986 [
4987 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004988 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004989 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004990#include <sys/types.h>
4991#include <utmp.h>
4992#ifdef HAVE_LASTLOG_H
4993# include <lastlog.h>
4994#endif
4995#ifdef HAVE_PATHS_H
4996# include <paths.h>
4997#endif
Tim Rice648f8762011-01-26 12:38:57 -08004998 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4999 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10005000 [
Tim Rice648f8762011-01-26 12:38:57 -08005001 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005002 system_lastlog_path=no
5003 ])
Tim Rice648f8762011-01-26 12:38:57 -08005004])
Damien Miller2994e082000-06-04 15:51:47 +10005005
andre2ff7b5d2000-06-03 14:57:40 +00005006if test -z "$conf_lastlog_location"; then
5007 if test x"$system_lastlog_path" = x"no" ; then
5008 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10005009 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00005010 conf_lastlog_location=$f
5011 fi
5012 done
5013 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00005014 AC_MSG_WARN([** Cannot find lastlog **])
5015 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00005016 fi
5017 fi
5018fi
5019
5020if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005021 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005022 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005023fi
andre2ff7b5d2000-06-03 14:57:40 +00005024
5025dnl utmp detection
5026AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005027AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005028#include <sys/types.h>
5029#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005030#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005031# include <paths.h>
5032#endif
Tim Rice648f8762011-01-26 12:38:57 -08005033 ]], [[ char *utmp = UTMP_FILE; ]])],
5034 [ AC_MSG_RESULT([yes]) ],
5035 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005036 system_utmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005037])
andre2ff7b5d2000-06-03 14:57:40 +00005038if test -z "$conf_utmp_location"; then
5039 if test x"$system_utmp_path" = x"no" ; then
5040 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
5041 if test -f $f ; then
5042 conf_utmp_location=$f
5043 fi
5044 done
5045 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005046 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005047 fi
5048 fi
5049fi
5050if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005051 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005052 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005053fi
andre2ff7b5d2000-06-03 14:57:40 +00005054
5055dnl wtmp detection
5056AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005057AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005058#include <sys/types.h>
5059#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005060#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005061# include <paths.h>
5062#endif
Tim Rice648f8762011-01-26 12:38:57 -08005063 ]], [[ char *wtmp = WTMP_FILE; ]])],
5064 [ AC_MSG_RESULT([yes]) ],
5065 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005066 system_wtmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005067])
andre2ff7b5d2000-06-03 14:57:40 +00005068if test -z "$conf_wtmp_location"; then
5069 if test x"$system_wtmp_path" = x"no" ; then
5070 for f in /usr/adm/wtmp /var/log/wtmp; do
5071 if test -f $f ; then
5072 conf_wtmp_location=$f
5073 fi
5074 done
5075 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005076 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005077 fi
5078 fi
5079fi
5080if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005081 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005082 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005083fi
andre2ff7b5d2000-06-03 14:57:40 +00005084
andre2ff7b5d2000-06-03 14:57:40 +00005085dnl wtmpx detection
5086AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005087AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005088#include <sys/types.h>
5089#include <utmp.h>
5090#ifdef HAVE_UTMPX_H
5091#include <utmpx.h>
5092#endif
Damien Miller2994e082000-06-04 15:51:47 +10005093#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005094# include <paths.h>
5095#endif
Tim Rice648f8762011-01-26 12:38:57 -08005096 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
5097 [ AC_MSG_RESULT([yes]) ],
5098 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005099 system_wtmpx_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005100])
andre2ff7b5d2000-06-03 14:57:40 +00005101if test -z "$conf_wtmpx_location"; then
5102 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005103 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00005104 fi
5105else
Tim Rice648f8762011-01-26 12:38:57 -08005106 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005107 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005108fi
andre2ff7b5d2000-06-03 14:57:40 +00005109
Damien Miller4018c192000-04-30 09:30:44 +10005110
Damien Miller29ea30d2000-03-17 10:54:15 +11005111if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10005112 LDFLAGS="$LDFLAGS $blibflags$blibpath"
5113 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11005114fi
5115
Damien Millera2438bb2013-03-15 10:23:07 +11005116AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07005117 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11005118 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07005119 fi
Damien Millera2438bb2013-03-15 10:23:07 +11005120 ], [
5121#ifdef HAVE_SYS_TYPES_H
5122#include <sys/types.h>
5123#endif
5124#ifdef HAVE_UTMP_H
5125#include <utmp.h>
5126#endif
5127#ifdef HAVE_UTMPX_H
5128#include <utmpx.h>
5129#endif
5130#ifdef HAVE_LASTLOG_H
5131#include <lastlog.h>
5132#endif
5133 ])
5134
5135AC_CHECK_MEMBER([struct utmp.ut_line], [], [
5136 AC_DEFINE([DISABLE_UTMP])
5137 AC_DEFINE([DISABLE_WTMP])
5138 ], [
5139#ifdef HAVE_SYS_TYPES_H
5140#include <sys/types.h>
5141#endif
5142#ifdef HAVE_UTMP_H
5143#include <utmp.h>
5144#endif
5145#ifdef HAVE_UTMPX_H
5146#include <utmpx.h>
5147#endif
5148#ifdef HAVE_LASTLOG_H
5149#include <lastlog.h>
5150#endif
5151 ])
5152
Darren Tucker7da23cb2005-08-03 00:20:15 +10005153dnl Adding -Werror to CFLAGS early prevents configure tests from running.
5154dnl Add now.
5155CFLAGS="$CFLAGS $werror_flags"
5156
Darren Tucker627337d2010-04-10 22:58:01 +10005157if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
5158 TEST_SSH_IPV6=no
5159else
5160 TEST_SSH_IPV6=yes
5161fi
Tim Rice648f8762011-01-26 12:38:57 -08005162AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
5163AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker47b8c992016-12-08 15:48:34 +11005164AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8])
Darren Tucker882abfd2013-11-09 00:17:41 +11005165AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10005166AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker79c0e1d2017-12-11 14:38:33 +11005167AC_SUBST([DEPEND], [$(cat $srcdir/.depend)])
Darren Tucker5d376902008-06-11 04:15:05 +10005168
Damien Millerde35c382017-09-08 12:38:31 +10005169CFLAGS="${CFLAGS} ${CFLAGS_AFTER}"
5170LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}"
5171
Damien Millerbac2d8a2000-09-05 16:13:06 +11005172AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10005173AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
5174 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10005175 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07005176AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10005177
Damien Miller7b22d652000-06-18 14:07:04 +10005178# Print summary of options
5179
Damien Miller7b22d652000-06-18 14:07:04 +10005180# Someone please show me a better way :)
5181A=`eval echo ${prefix}` ; A=`eval echo ${A}`
5182B=`eval echo ${bindir}` ; B=`eval echo ${B}`
5183C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
5184D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00005185E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00005186F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10005187G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10005188H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
5189I=`eval echo ${user_path}` ; I=`eval echo ${I}`
5190J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10005191
5192echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00005193echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10005194echo " User binaries: $B"
5195echo " System binaries: $C"
5196echo " Configuration files: $D"
5197echo " Askpass program: $E"
5198echo " Manual pages: $F"
5199echo " PID file: $G"
5200echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10005201if test "x$external_path_file" = "x/etc/login.conf" ; then
5202echo " At runtime, sshd will use the path defined in $external_path_file"
5203echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07005204else
Damien Millerf58c6722002-05-13 13:15:42 +10005205echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07005206 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10005207echo " (If PATH is set in $external_path_file it will be used instead. If"
5208echo " used, ensure the path to scp is present, otherwise scp will not work.)"
5209 fi
Tim Rice43a1c132002-04-17 21:19:14 -07005210fi
Damien Millera18bbd32002-05-13 10:48:57 +10005211if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10005212echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10005213fi
Damien Millerf58c6722002-05-13 13:15:42 +10005214echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10005215echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005216echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005217echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10005218echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005219echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11005220echo " libedit support: $LIBEDIT_MSG"
Damien Miller523db852017-02-03 16:01:22 +11005221echo " libldns support: $LDNS_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005222echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11005223echo " Solaris project support: $SP_MSG"
Damien Miller4626cba2016-01-08 14:24:56 +11005224echo " Solaris privilege support: $SPP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10005225echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005226echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5227echo " BSD Auth support: $BSD_AUTH_MSG"
5228echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10005229echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11005230
Damien Miller7b22d652000-06-18 14:07:04 +10005231echo ""
5232
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00005233echo " Host: ${host}"
5234echo " Compiler: ${CC}"
5235echo " Compiler flags: ${CFLAGS}"
5236echo "Preprocessor flags: ${CPPFLAGS}"
5237echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10005238echo " Libraries: ${LIBS}"
5239if test ! -z "${SSHDLIBS}"; then
5240echo " +for sshd: ${SSHDLIBS}"
5241fi
Damien Miller71adf122011-01-25 12:16:15 +11005242if test ! -z "${SSHLIBS}"; then
5243echo " +for ssh: ${SSHLIBS}"
5244fi
Damien Miller7b22d652000-06-18 14:07:04 +10005245
5246echo ""
5247
Tim Rice6f1f7582004-05-30 21:38:51 -07005248if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10005249 echo "SVR4 style packages are supported with \"make package\""
5250 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07005251fi
5252
Damien Miller82cf0ce2000-12-20 13:34:48 +11005253if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11005254 echo "PAM is enabled. You may need to install a PAM control file "
5255 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11005256 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11005257 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11005258 echo ""
5259fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00005260
Damien Millerb4097182004-05-23 14:09:40 +10005261if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11005262 echo "WARNING: the operating system that you are using does not"
5263 echo "appear to support getpeereid(), getpeerucred() or the"
5264 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
5265 echo "enforce security checks to prevent unauthorised connections to"
5266 echo "ssh-agent. Their absence increases the risk that a malicious"
5267 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10005268 echo ""
5269fi
5270
Darren Tuckerd9f88912005-02-20 21:01:48 +11005271if test "$AUDIT_MODULE" = "bsm" ; then
5272 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
5273 echo "See the Solaris section in README.platform for details."
5274fi