blob: c0e120fe93dae4e9c9fadfe7cfc76fd3045dbf1d [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])
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Darren Tucker6c8a2462017-12-01 17:11:47 +110032AC_PROG_MKDIR_P
Darren Tucker408f4c22015-04-17 09:39:58 +100033AC_CHECK_TOOLS([AR], [ar])
Tim Rice648f8762011-01-26 12:38:57 -080034AC_PATH_PROG([CAT], [cat])
35AC_PATH_PROG([KILL], [kill])
Tim Rice648f8762011-01-26 12:38:57 -080036AC_PATH_PROG([SED], [sed])
Tim Rice648f8762011-01-26 12:38:57 -080037AC_PATH_PROG([ENT], [ent])
38AC_SUBST([ENT])
39AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
40AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
41AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
42AC_PATH_PROG([SH], [sh])
43AC_PATH_PROG([GROFF], [groff])
44AC_PATH_PROG([NROFF], [nroff])
45AC_PATH_PROG([MANDOC], [mandoc])
46AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110047
Damien Miller30a69e72011-01-04 08:16:27 +110048dnl select manpage formatter
49if test "x$MANDOC" != "x" ; then
50 MANFMT="$MANDOC"
51elif test "x$NROFF" != "x" ; then
52 MANFMT="$NROFF -mandoc"
53elif test "x$GROFF" != "x" ; then
54 MANFMT="$GROFF -mandoc -Tascii"
55else
56 AC_MSG_WARN([no manpage formatted found])
57 MANFMT="false"
58fi
Tim Rice648f8762011-01-26 12:38:57 -080059AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110060
Tim Rice6f1f7582004-05-30 21:38:51 -070061dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080062AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070063 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080064AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070065 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080066AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110067if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080068 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110069else
Tim Rice648f8762011-01-26 12:38:57 -080070 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110071fi
Tim Rice6f1f7582004-05-30 21:38:51 -070072
Damien Millere8bb4502001-09-25 16:39:35 +100073# System features
74AC_SYS_LARGEFILE
75
Damien Miller3f62aba2000-11-29 11:56:35 +110076if test -z "$AR" ; then
77 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
78fi
79
Tim Rice648f8762011-01-26 12:38:57 -080080AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +110081if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -080082 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -070083 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110084fi
85
Darren Tuckerf2c06ab2018-06-08 17:43:36 +100086dnl Since autoconf doesn't support it very well, we no longer allow users to
87dnl override LD, however keeping the hook here for now in case there's a use
88dnl use case we overlooked and someone needs to re-enable it. Unless a good
89dnl reason is found we'll be removing this in future.
90LD="$CC"
Tim Rice648f8762011-01-26 12:38:57 -080091AC_SUBST([LD])
Tim Riceeae17cc2005-03-17 16:52:20 -080092
Damien Miller166bd442000-03-16 10:48:25 +110093AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100094
Tim Rice648f8762011-01-26 12:38:57 -080095AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
Damien Miller69ff1df2011-06-23 08:30:03 +100096AC_CHECK_DECL([SYSTR_POLICY_KILL], [have_systr_policy_kill=1], , [
97 #include <sys/types.h>
98 #include <sys/param.h>
99 #include <dev/systrace.h>
100])
101AC_CHECK_DECL([RLIMIT_NPROC],
102 [AC_DEFINE([HAVE_RLIMIT_NPROC], [], [sys/resource.h has RLIMIT_NPROC])], , [
103 #include <sys/types.h>
104 #include <sys/resource.h>
105])
Damien Millere0956e32012-04-04 11:27:54 +1000106AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [
107 #include <sys/types.h>
108 #include <linux/prctl.h>
109])
Damien Miller868ea1e2014-01-17 16:47:04 +1100110
Damien Miller72ef7c12015-01-15 02:21:31 +1100111openssl=yes
Damien Miller72ef7c12015-01-15 02:21:31 +1100112AC_ARG_WITH([openssl],
113 [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ],
Damien Miller76c04802015-01-13 19:38:18 +1100114 [ if test "x$withval" = "xno" ; then
Damien Miller72ef7c12015-01-15 02:21:31 +1100115 openssl=no
Damien Miller76c04802015-01-13 19:38:18 +1100116 fi
117 ]
118)
Damien Miller72ef7c12015-01-15 02:21:31 +1100119AC_MSG_CHECKING([whether OpenSSL will be used for cryptography])
120if test "x$openssl" = "xyes" ; then
121 AC_MSG_RESULT([yes])
122 AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography])
123else
124 AC_MSG_RESULT([no])
125fi
126
Darren Tuckerb7918af2008-03-09 11:34:23 +1100127use_stack_protector=1
Darren Tuckerfd994372014-01-17 09:53:24 +1100128use_toolchain_hardening=1
Tim Rice648f8762011-01-26 12:38:57 -0800129AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100130 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100131 if test "x$withval" = "xno"; then
132 use_stack_protector=0
133 fi ])
Darren Tuckerfd994372014-01-17 09:53:24 +1100134AC_ARG_WITH([hardening],
135 [ --without-hardening Don't use toolchain hardening flags], [
136 if test "x$withval" = "xno"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100137 use_toolchain_hardening=0
138 fi ])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100139
Darren Tuckerfd994372014-01-17 09:53:24 +1100140# We use -Werror for the tests only so that we catch warnings like "this is
141# on by default" for things like -fPIE.
142AC_MSG_CHECKING([if $CC supports -Werror])
143saved_CFLAGS="$CFLAGS"
144CFLAGS="$CFLAGS -Werror"
145AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
146 [ AC_MSG_RESULT([yes])
147 WERROR="-Werror"],
148 [ AC_MSG_RESULT([no])
149 WERROR="" ]
150)
151CFLAGS="$saved_CFLAGS"
Damien Miller134d02a2011-01-12 16:00:37 +1100152
Damien Millera8e06ce2003-11-21 23:48:55 +1100153if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerd9048862017-03-31 11:04:43 +1100154 OSSH_CHECK_CFLAG_COMPILE([-pipe])
Darren Tuckerfd994372014-01-17 09:53:24 +1100155 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
156 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option])
Damien Millerb1763622011-05-20 11:45:25 +1000157 OSSH_CHECK_CFLAG_COMPILE([-Wall])
158 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
159 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
160 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
161 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000162 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000163 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
164 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
165 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tuckerfd994372014-01-17 09:53:24 +1100166 if test "x$use_toolchain_hardening" = "x1"; then
Corinna Vinschen477b49a2018-08-13 17:08:51 +0200167 # Cygwin GCC 7.x allows thunking on the CLI, but produces non-working
168 # code. Unfortunately you only notice this at link time.
169 case "$host" in
170 *-*-cygwin*) ;;
171 *)
172 OSSH_CHECK_CFLAG_COMPILE([-mfunction-return=thunk]) # gcc
173 OSSH_CHECK_CFLAG_COMPILE([-mindirect-branch=thunk]) # gcc
174 ;;
175 esac
Darren Tucker3377df02018-02-11 09:32:37 +1100176 OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang
Darren Tucker174bed62018-02-13 18:12:47 +1100177 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt])
Damien Miller161af8f2017-09-19 10:18:56 +1000178 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100179 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
180 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
181 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
Damien Miller5c2ff5e2014-01-22 21:30:12 +1100182 # NB. -ftrapv expects certain support functions to be present in
183 # the compiler library (libgcc or similar) to detect integer operations
184 # that can overflow. We must check that the result of enabling it
185 # actually links. The test program compiled/linked includes a number
186 # of integer operations that should exercise this.
187 OSSH_CHECK_CFLAG_LINK([-ftrapv])
Darren Tuckerfd994372014-01-17 09:53:24 +1100188 fi
Tim Rice648f8762011-01-26 12:38:57 -0800189 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100190 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700191 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000192 1.*) no_attrib_nonnull=1 ;;
193 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000194 no_attrib_nonnull=1
195 ;;
196 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100197 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700198 esac
Tim Rice648f8762011-01-26 12:38:57 -0800199 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000200
Tim Rice648f8762011-01-26 12:38:57 -0800201 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000202 saved_CFLAGS="$CFLAGS"
203 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800204 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
205 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
206 [ AC_MSG_RESULT([yes]) ],
207 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000208 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800209 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000210
Darren Tuckerb7918af2008-03-09 11:34:23 +1100211 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100212 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100213 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100214 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100215 for t in -fstack-protector-strong -fstack-protector-all \
216 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800217 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100218 saved_CFLAGS="$CFLAGS"
219 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100220 CFLAGS="$CFLAGS $t -Werror"
221 LDFLAGS="$LDFLAGS $t -Werror"
222 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800223 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
224 [[
225 char x[256];
226 snprintf(x, sizeof(x), "XXX");
227 ]])],
228 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100229 CFLAGS="$saved_CFLAGS $t"
230 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800231 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100232 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800233 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
234 [[
235 char x[256];
236 snprintf(x, sizeof(x), "XXX");
237 ]])],
238 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100239 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800240 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100241 [ AC_MSG_WARN([cross compiling: cannot test])
242 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100243 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100244 ],
Tim Rice648f8762011-01-26 12:38:57 -0800245 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100246 )
247 CFLAGS="$saved_CFLAGS"
248 LDFLAGS="$saved_LDFLAGS"
249 done
250 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100251
Darren Tucker67b37032005-06-03 17:58:31 +1000252 if test -z "$have_llong_max"; then
253 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
254 unset ac_cv_have_decl_LLONG_MAX
255 saved_CFLAGS="$CFLAGS"
256 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800257 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000258 [have_llong_max=1],
259 [CFLAGS="$saved_CFLAGS"],
260 [#include <limits.h>]
261 )
262 fi
Damien Miller166bd442000-03-16 10:48:25 +1100263fi
264
Darren Tucker951b53b2013-02-08 11:50:09 +1100265AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
266AC_COMPILE_IFELSE(
267 [AC_LANG_PROGRAM([[
268#include <stdlib.h>
269__attribute__((__unused__)) static void foo(void){return;}]],
270 [[ exit(0); ]])],
271 [ AC_MSG_RESULT([yes]) ],
272 [ AC_MSG_RESULT([no])
273 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
274 [compiler does not accept __attribute__ on return types]) ]
275)
276
Darren Tucker1323f122018-02-27 08:41:25 +1100277AC_MSG_CHECKING([if compiler allows __attribute__ prototype args])
278AC_COMPILE_IFELSE(
279 [AC_LANG_PROGRAM([[
280#include <stdlib.h>
281typedef void foo(const char *, ...) __attribute__((format(printf, 1, 2)));]],
282 [[ exit(0); ]])],
283 [ AC_MSG_RESULT([yes]) ],
284 [ AC_MSG_RESULT([no])
285 AC_DEFINE(NO_ATTRIBUTE_ON_PROTOTYPE_ARGS, 1,
Damien Miller10479cc2018-04-10 10:19:02 +1000286 [compiler does not accept __attribute__ on prototype args]) ]
Darren Tucker1323f122018-02-27 08:41:25 +1100287)
288
Darren Tucker391de5c2007-04-29 14:49:21 +1000289if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800290 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000291fi
292
Tim Rice648f8762011-01-26 12:38:57 -0800293AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800294 [ --without-rpath Disable auto-added -R linker paths],
295 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800296 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800297 need_dash_r=""
298 fi
299 if test "x$withval" = "xyes" ; then
300 need_dash_r=1
301 fi
302 ]
303)
304
Tim Rice1cfab232006-10-03 09:34:35 -0700305# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800306AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700307 [ --with-cflags Specify additional flags to pass to compiler],
308 [
309 if test -n "$withval" && test "x$withval" != "xno" && \
310 test "x${withval}" != "xyes"; then
311 CFLAGS="$CFLAGS $withval"
312 fi
313 ]
314)
Damien Millerde35c382017-09-08 12:38:31 +1000315
316AC_ARG_WITH([cflags-after],
317 [ --with-cflags-after Specify additional flags to pass to compiler after configure],
318 [
319 if test -n "$withval" && test "x$withval" != "xno" && \
320 test "x${withval}" != "xyes"; then
321 CFLAGS_AFTER="$withval"
322 fi
323 ]
324)
Tim Rice648f8762011-01-26 12:38:57 -0800325AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700326 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
327 [
328 if test -n "$withval" && test "x$withval" != "xno" && \
329 test "x${withval}" != "xyes"; then
330 CPPFLAGS="$CPPFLAGS $withval"
331 fi
332 ]
333)
Tim Rice648f8762011-01-26 12:38:57 -0800334AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700335 [ --with-ldflags Specify additional flags to pass to linker],
336 [
337 if test -n "$withval" && test "x$withval" != "xno" && \
338 test "x${withval}" != "xyes"; then
339 LDFLAGS="$LDFLAGS $withval"
340 fi
341 ]
342)
Damien Millerde35c382017-09-08 12:38:31 +1000343AC_ARG_WITH([ldflags-after],
344 [ --with-ldflags-after Specify additional flags to pass to linker after configure],
345 [
346 if test -n "$withval" && test "x$withval" != "xno" && \
347 test "x${withval}" != "xyes"; then
348 LDFLAGS_AFTER="$withval"
349 fi
350 ]
351)
Tim Rice648f8762011-01-26 12:38:57 -0800352AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700353 [ --with-libs Specify additional libraries to link with],
354 [
355 if test -n "$withval" && test "x$withval" != "xno" && \
356 test "x${withval}" != "xyes"; then
357 LIBS="$LIBS $withval"
358 fi
359 ]
360)
Tim Rice648f8762011-01-26 12:38:57 -0800361AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700362 [ --with-Werror Build main code with -Werror],
363 [
364 if test -n "$withval" && test "x$withval" != "xno"; then
365 werror_flags="-Werror"
366 if test "x${withval}" != "xyes"; then
367 werror_flags="$withval"
368 fi
369 fi
370 ]
371)
372
Tim Rice648f8762011-01-26 12:38:57 -0800373AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100374 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700375 bstring.h \
376 crypt.h \
377 crypto/sha2.h \
378 dirent.h \
379 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100380 elf.h \
Darren Tucker6310ef22016-07-13 14:42:35 +1000381 err.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700382 features.h \
383 fcntl.h \
384 floatingpoint.h \
385 getopt.h \
386 glob.h \
387 ia.h \
388 iaf.h \
Darren Tuckerb59162d2018-02-23 15:20:42 +1100389 ifaddrs.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100390 inttypes.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000391 langinfo.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700392 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000393 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700394 login.h \
395 maillock.h \
396 ndir.h \
397 net/if_tun.h \
398 netdb.h \
399 netgroup.h \
400 pam/pam_appl.h \
401 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000402 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700403 pty.h \
404 readpassphrase.h \
405 rpc/types.h \
406 security/pam_appl.h \
407 sha2.h \
408 shadow.h \
409 stddef.h \
410 stdint.h \
411 string.h \
412 strings.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700413 sys/bitypes.h \
414 sys/bsdtty.h \
415 sys/cdefs.h \
416 sys/dir.h \
Damien Millerf8854742018-02-26 12:18:14 +1100417 sys/file.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700418 sys/mman.h \
Darren Tuckerce066f62018-02-22 20:45:09 +1100419 sys/label.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700420 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000421 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700422 sys/prctl.h \
423 sys/pstat.h \
Darren Tucker5ee3fb52016-11-01 08:12:33 +1100424 sys/ptrace.h \
Damien Millerafa6e792018-04-13 13:31:42 +1000425 sys/random.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700426 sys/select.h \
427 sys/stat.h \
428 sys/stream.h \
429 sys/stropts.h \
430 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000431 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700432 sys/sysmacros.h \
433 sys/time.h \
434 sys/timers.h \
Darren Tucker11057562018-02-25 11:22:57 +1100435 sys/vfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700436 time.h \
437 tmpdir.h \
438 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700439 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700440 unistd.h \
441 usersec.h \
442 util.h \
443 utime.h \
444 utmp.h \
445 utmpx.h \
446 vis.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000447 wchar.h \
Tim Rice648f8762011-01-26 12:38:57 -0800448])
Tim Rice1cfab232006-10-03 09:34:35 -0700449
Darren Tuckerce066f62018-02-22 20:45:09 +1100450# On some platforms (eg SunOS4) sys/audit.h requires sys/[time|types|label.h]
451# to be included first.
452AC_CHECK_HEADERS([sys/audit.h], [], [], [
453#ifdef HAVE_SYS_TIME_H
454# include <sys/time.h>
455#endif
456#ifdef HAVE_SYS_TYPES_H
457# include <sys/types.h>
458#endif
459#ifdef HAVE_SYS_LABEL_H
460# include <sys/label.h>
461#endif
462])
463
Darren Tuckerdd9d9b32017-08-28 16:48:27 +1000464# sys/capsicum.h requires sys/types.h
465AC_CHECK_HEADERS([sys/capsicum.h], [], [], [
466#ifdef HAVE_SYS_TYPES_H
467# include <sys/types.h>
468#endif
469])
470
Darren Tuckerfa1b8342017-11-03 14:09:45 +1100471# net/route.h requires sys/socket.h and sys/types.h.
472# sys/sysctl.h also requires sys/param.h
473AC_CHECK_HEADERS([net/route.h sys/sysctl.h], [], [], [
474#ifdef HAVE_SYS_TYPES_H
475# include <sys/types.h>
476#endif
477#include <sys/param.h>
Damien Miller32354732017-10-25 11:25:43 +1100478#include <sys/socket.h>
479])
480
Tim Rice1cfab232006-10-03 09:34:35 -0700481# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800482AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700483#ifdef HAVE_SYS_TIME_H
484# include <sys/time.h>
485#endif
486])
487
488# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800489AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700490#ifdef HAVE_SYS_STREAM_H
491# include <sys/stream.h>
492#endif
493])
494
495# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800496AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700497#include <sys/types.h>
498])
499
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000500# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800501AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000502#include <sys/param.h>
503])
504
Darren Tuckeref4901c2013-06-03 01:59:13 +1000505# Android requires sys/socket.h to be included before sys/un.h
506AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000507#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000508#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000509])
510
Damien Miller1b06dc32006-08-31 03:24:41 +1000511# Messages for features tested for in target-specific section
512SIA_MSG="no"
513SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100514SP_MSG="no"
Damien Miller4626cba2016-01-08 14:24:56 +1100515SPP_MSG="no"
516
517# Support for Solaris/Illumos privileges (this test is used by both
518# the --with-solaris-privs option and --with-sandbox=solaris).
519SOLARIS_PRIVS="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000520
Damien Millera22ba012000-03-02 23:09:20 +1100521# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100522case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100523*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000524 # Some versions of VAC won't allow macro redefinitions at
525 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
526 # particularly with older versions of vac or xlc.
Damien Miller10479cc2018-04-10 10:19:02 +1000527 # It also throws errors about null macro arguments, but these are
Darren Tucker9216c372006-09-18 23:17:40 +1000528 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800529 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000530 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800531 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000532#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800533#define testmacro bar]],
534 [[ exit(0); ]])],
535 [ AC_MSG_RESULT([yes]) ],
536 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000537 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
Darren Tucker9216c372006-09-18 23:17:40 +1000538 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
539 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
540 ]
541 )
542
Damien Millera8e06ce2003-11-21 23:48:55 +1100543 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000544 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800545 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100546 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000547 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000548 if test "$GCC" = "yes"; then
549 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
550 else
551 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
552 fi
553 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000554 if (test -z "$blibflags"); then
555 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800556 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
557 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000558 fi
559 done
560 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800561 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000562 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
563 else
Tim Rice648f8762011-01-26 12:38:57 -0800564 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000565 fi
566 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000567 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800568 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700569 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800570 [AC_CHECK_LIB([s], [authenticate],
571 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700572 LIBS="$LIBS -ls"
573 ])
574 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100575 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100576 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100577 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000578 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800579 AC_CHECK_DECLS([loginfailed],
580 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
581 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
582 [[ (void)loginfailed("user","host","tty",0); ]])],
583 [AC_MSG_RESULT([yes])
584 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
585 [Define if your AIX loginfailed() function
586 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
587 ])],
588 [],
589 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000590 )
Tim Rice648f8762011-01-26 12:38:57 -0800591 AC_CHECK_FUNCS([getgrset setauthdb])
592 AC_CHECK_DECL([F_CLOSEM],
593 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000594 [],
595 [ #include <limits.h>
596 #include <fcntl.h> ]
597 )
Darren Tucker691d5232005-02-15 21:45:57 +1100598 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
600 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700601 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800602 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
603 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000604 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800605 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
606 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700607 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800608 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700609 [Define to a Set Process Title type if your system is
610 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800611 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100612 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800613 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100614 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Darren Tucker2c71ca12018-03-30 18:23:07 +1100615 AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211])
616 AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551])
Damien Miller75b1d102000-01-07 14:01:41 +1100617 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000618*-*-android*)
619 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
620 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
621 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100622*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100623 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100624 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800625 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
626 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
Damien Miller4626cba2016-01-08 14:24:56 +1100627 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
628 [Define to disable UID restoration test])
Tim Rice648f8762011-01-26 12:38:57 -0800629 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700630 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800631 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700632 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800633 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700634 [Define if your platform needs to skip post auth
635 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800636 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100637 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
638 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
639 # reasons which cause compile warnings, so we disable those warnings.
640 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100641 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000642*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800643 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700644 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800645 AC_DEFINE([SETEUID_BREAKS_SETUID])
646 AC_DEFINE([BROKEN_SETREUID])
647 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000648 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000649*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100650 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800651 AC_MSG_CHECKING([if we have working getaddrinfo])
652 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000653main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
654 exit(0);
655 else
656 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800657}
658 ]])],
659 [AC_MSG_RESULT([working])],
660 [AC_MSG_RESULT([buggy])
661 AC_DEFINE([BROKEN_GETADDRINFO], [1],
662 [getaddrinfo is broken (if present)])
663 ],
664 [AC_MSG_RESULT([assume it is working])])
665 AC_DEFINE([SETEUID_BREAKS_SETUID])
666 AC_DEFINE([BROKEN_SETREUID])
667 AC_DEFINE([BROKEN_SETREGID])
668 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
669 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700670 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800671 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
672 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000673 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800674 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000675 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800676 m4_pattern_allow([AU_IPv])
Tim Ricee1d93702016-05-31 11:13:22 -0700677 AC_CHECK_DECL([AU_IPv4], [],
Tim Rice648f8762011-01-26 12:38:57 -0800678 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100679 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800680 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100681 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100682 )
Damien Millerc09182f2011-06-03 12:11:38 +1000683 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
684 [Define to a Set Process Title type if your system is
685 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000686 AC_CHECK_FUNCS([sandbox_init])
687 AC_CHECK_HEADERS([sandbox.h])
Damien Miller39f303b2016-02-23 12:56:59 +1100688 AC_CHECK_LIB([sandbox], [sandbox_apply], [
689 SSHDLIBS="$SSHDLIBS -lsandbox"
690 ])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000691 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000692*-*-dragonfly*)
693 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100694 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000695 ;;
Tim Ricee1d93702016-05-31 11:13:22 -0700696*-*-haiku*)
Darren Tucker5faa52d2016-08-02 15:22:40 +1000697 LIBS="$LIBS -lbsd "
698 AC_CHECK_LIB([network], [socket])
699 AC_DEFINE([HAVE_U_INT64_T])
700 MANTYPE=man
701 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000702*-*-hpux*)
703 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000704 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100705 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800706 AC_DEFINE([USE_PIPES])
Tim Rice648f8762011-01-26 12:38:57 -0800707 AC_DEFINE([LOGIN_NEEDS_UTMPX])
708 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700709 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800710 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100711 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700712 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700713 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800714 AC_CHECK_LIB([xnet], [t_error], ,
715 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000716
717 # next, we define all of the options specific to major releases
718 case "$host" in
719 *-*-hpux10*)
720 if test -z "$GCC"; then
721 CFLAGS="$CFLAGS -Ae"
722 fi
723 ;;
724 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800725 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700726 [Define if you are using Solaris-derived PAM which
727 passes pam_messages to the conversation function
728 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800729 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700730 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800731 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000732 check_for_hpux_broken_getaddrinfo=1
733 check_for_conflicting_getspnam=1
734 ;;
735 esac
736
737 # lastly, we define options specific to minor releases
738 case "$host" in
739 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800740 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700741 [Define if you have SecureWare-based
742 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000743 disable_ptmx_check=yes
744 LIBS="$LIBS -lsecpw"
745 ;;
746 esac
Damien Miller1bead332000-04-30 00:47:29 +1000747 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100748*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100749 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800750 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700751 [Define if you system's inet_ntoa is busted
752 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800753 AC_DEFINE([SETEUID_BREAKS_SETUID])
754 AC_DEFINE([BROKEN_SETREUID])
755 AC_DEFINE([BROKEN_SETREGID])
756 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700757 [Define if you shouldn't strip 'tty' from your
758 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800759 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100760 ;;
761*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100762 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800763 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700764 [Define if you have/want arrays
Damien Miller10479cc2018-04-10 10:19:02 +1000765 (cluster-wide session management, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800766 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700767 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700769 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800770 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700771 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800772 AC_DEFINE([BROKEN_INET_NTOA])
773 AC_DEFINE([SETEUID_BREAKS_SETUID])
774 AC_DEFINE([BROKEN_SETREUID])
775 AC_DEFINE([BROKEN_SETREGID])
776 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
777 AC_DEFINE([WITH_ABBREV_NO_TTY])
778 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100779 ;;
Damien Miller90551722009-02-16 15:37:03 +1100780*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
781 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800782 AC_DEFINE([PAM_TTY_KLUDGE])
783 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
784 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
785 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
786 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100787 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100788*-*-linux*)
789 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100790 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100791 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000792 check_for_openpty_ctty_bug=1
Darren Tuckerc61d5ec2017-02-03 14:10:34 +1100793 dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
794 dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
795 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800796 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700797 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800798 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700799 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800800 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
801 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700802 [Define to whatever link() returns for "not supported"
803 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800804 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
805 AC_DEFINE([USE_BTMP])
806 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100807 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000808 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000809 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800810 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700811 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000812 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000813 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100814 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800815 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100816 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800817 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100818 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800819 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100820 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800821 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100822 [Prepend the address family to IP tunnel traffic])
823 fi
Darren Tucker81c9ccd2017-11-03 14:52:51 +1100824 AC_CHECK_HEADER([linux/if.h],
825 AC_DEFINE([SYS_RDOMAIN_LINUX], [1],
Darren Tucker24d2a332018-02-11 21:20:39 +1300826 [Support routing domains using Linux VRF]), [], [
827#ifdef HAVE_SYS_TYPES_H
828# include <sys/types.H>
829#endif
830 ])
Darren Tucker60395f92012-07-03 14:31:18 +1000831 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
832 [], [#include <linux/types.h>])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100833 # Obtain MIPS ABI
834 case "$host" in
835 mips*)
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100836 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100837#if _MIPS_SIM != _ABIO32
838#error
839#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100840 ]])],[mips_abi="o32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100841#if _MIPS_SIM != _ABIN32
842#error
843#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100844 ]])],[mips_abi="n32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100845#if _MIPS_SIM != _ABI64
846#error
847#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100848 ]])],[mips_abi="n64"],[AC_MSG_ERROR([unknown MIPS ABI])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100849 ])
850 ])
851 ])
852 ;;
853 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100854 AC_MSG_CHECKING([for seccomp architecture])
855 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000856 case "$host" in
857 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100858 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000859 ;;
860 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100861 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000862 ;;
Damien Miller99f33d72015-06-17 10:50:51 +1000863 arm*-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100864 seccomp_audit_arch=AUDIT_ARCH_ARM
Damien Miller99f33d72015-06-17 10:50:51 +1000865 ;;
866 aarch64*-*)
867 seccomp_audit_arch=AUDIT_ARCH_AARCH64
Damien Miller5c15e222015-06-18 15:07:56 +1000868 ;;
Damien Millerb9c50612016-07-08 13:59:13 +1000869 s390x-*)
870 seccomp_audit_arch=AUDIT_ARCH_S390X
871 ;;
872 s390-*)
873 seccomp_audit_arch=AUDIT_ARCH_S390
874 ;;
875 powerpc64-*)
876 seccomp_audit_arch=AUDIT_ARCH_PPC64
877 ;;
878 powerpc64le-*)
879 seccomp_audit_arch=AUDIT_ARCH_PPC64LE
880 ;;
881 mips-*)
882 seccomp_audit_arch=AUDIT_ARCH_MIPS
883 ;;
884 mipsel-*)
885 seccomp_audit_arch=AUDIT_ARCH_MIPSEL
886 ;;
887 mips64-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100888 case "$mips_abi" in
889 "n32")
890 seccomp_audit_arch=AUDIT_ARCH_MIPS64N32
891 ;;
892 "n64")
893 seccomp_audit_arch=AUDIT_ARCH_MIPS64
894 ;;
895 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000896 ;;
897 mips64el-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100898 case "$mips_abi" in
899 "n32")
900 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64N32
901 ;;
902 "n64")
903 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
904 ;;
905 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000906 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000907 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100908 if test "x$seccomp_audit_arch" != "x" ; then
909 AC_MSG_RESULT(["$seccomp_audit_arch"])
Damien Miller99f33d72015-06-17 10:50:51 +1000910 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
911 [Specify the system call convention in use])
Damien Miller91f40d82013-02-22 11:37:00 +1100912 else
913 AC_MSG_RESULT([architecture not supported])
914 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100915 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000916mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800917 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000918 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000919 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100920*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000921 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800922 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800923 need_dash_r=1
924 fi
Damien Miller99522ba2016-07-28 08:54:27 +1000925 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800926 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100927 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800928 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
929 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100930 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100931 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerf5bbd3b2014-01-30 11:26:46 +1100932 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
933 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
Damien Milleree1c0b32000-01-21 00:18:15 +1100934 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100935*-*-freebsd*)
936 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800937 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
938 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100939 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800940 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
941 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100942 TEST_MALLOC_OPTIONS="AJRX"
Damien Miller2035b222014-01-26 09:39:53 +1100943 # Preauth crypto occasionally uses file descriptors for crypto offload
944 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100945 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
Tim Rice03ae0812014-02-21 09:09:34 -0800946 [define if setrlimit RLIMIT_NOFILE breaks things])
Damien Millerfbd884a2001-02-27 08:39:07 +1100947 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000948*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800949 AC_DEFINE([SETEUID_BREAKS_SETUID])
950 AC_DEFINE([BROKEN_SETREUID])
951 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000952 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000953*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000954 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100955 conf_utmp_location=/etc/utmp
956 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700957 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800958 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
959 AC_DEFINE([BROKEN_REALPATH])
960 AC_DEFINE([USE_PIPES])
961 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000962 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000963*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100964 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800965 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
966 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
967 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
968 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000969 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100970 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000971 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100972*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800973 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800974 need_dash_r=1
975 fi
Tim Rice648f8762011-01-26 12:38:57 -0800976 AC_DEFINE([PAM_SUN_CODEBASE])
977 AC_DEFINE([LOGIN_NEEDS_UTMPX])
Tim Rice648f8762011-01-26 12:38:57 -0800978 AC_DEFINE([PAM_TTY_KLUDGE])
979 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700980 [Define if pam_chauthtok wants real uid set
981 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800982 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000983 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800984 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700985 [Define if sshd somehow reacquires a controlling TTY
986 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800987 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000988 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800989 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000990 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000991 # hardwire lastlog location (can't detect it on some versions)
992 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800993 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000994 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
995 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800996 AC_MSG_RESULT([yes])
997 AC_DEFINE([DISABLE_UTMP])
998 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700999 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +10001000 else
Tim Rice648f8762011-01-26 12:38:57 -08001001 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +10001002 fi
Darren Tuckera86ec4d2016-06-14 10:48:27 +10001003 AC_CHECK_FUNCS([setpflags])
Darren Tucker907091a2016-02-19 09:05:39 +11001004 AC_CHECK_FUNCS([setppriv])
1005 AC_CHECK_FUNCS([priv_basicset])
1006 AC_CHECK_HEADERS([priv.h])
Tim Rice648f8762011-01-26 12:38:57 -08001007 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +10001008 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
1009 [
Tim Rice648f8762011-01-26 12:38:57 -08001010 AC_CHECK_LIB([contract], [ct_tmpl_activate],
1011 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +10001012 [Define if you have Solaris process contracts])
Damien Miller4626cba2016-01-08 14:24:56 +11001013 LIBS="$LIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +10001014 SPC_MSG="yes" ], )
1015 ],
1016 )
Tim Rice648f8762011-01-26 12:38:57 -08001017 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +11001018 [ --with-solaris-projects Enable Solaris projects (experimental)],
1019 [
Tim Rice648f8762011-01-26 12:38:57 -08001020 AC_CHECK_LIB([project], [setproject],
1021 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +11001022 [Define if you have Solaris projects])
Damien Miller4626cba2016-01-08 14:24:56 +11001023 LIBS="$LIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +11001024 SP_MSG="yes" ], )
1025 ],
1026 )
Damien Miller4626cba2016-01-08 14:24:56 +11001027 AC_ARG_WITH([solaris-privs],
1028 [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)],
1029 [
1030 AC_MSG_CHECKING([for Solaris/Illumos privilege support])
Darren Tucker907091a2016-02-19 09:05:39 +11001031 if test "x$ac_cv_func_setppriv" = "xyes" -a \
1032 "x$ac_cv_header_priv_h" = "xyes" ; then
1033 SOLARIS_PRIVS=yes
Damien Miller4626cba2016-01-08 14:24:56 +11001034 AC_MSG_RESULT([found])
1035 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
1036 [Define to disable UID restoration test])
1037 AC_DEFINE([USE_SOLARIS_PRIVS], [1],
1038 [Define if you have Solaris privileges])
1039 SPP_MSG="yes"
1040 else
1041 AC_MSG_RESULT([not found])
1042 AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs])
1043 fi
1044 ],
1045 )
Tim Rice5ab9b632013-06-02 14:05:48 -07001046 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +11001047 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +10001048*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001049 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -08001050 AC_CHECK_FUNCS([getpwanam])
1051 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +10001052 conf_utmp_location=/etc/utmp
1053 conf_wtmp_location=/var/adm/wtmp
1054 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -08001055 AC_DEFINE([USE_PIPES])
Darren Tuckerc0a0c3f2018-03-05 20:03:07 +11001056 AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx])
Damien Millerdfc83f42000-05-20 15:02:59 +10001057 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001058*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -07001059 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -08001060 AC_DEFINE([USE_PIPES])
1061 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1062 AC_DEFINE([SETEUID_BREAKS_SETUID])
1063 AC_DEFINE([BROKEN_SETREUID])
1064 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001065 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +10001066*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -07001067 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -08001068 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +11001069 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -08001070 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +11001071 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -08001072 AC_DEFINE([USE_PIPES])
1073 AC_DEFINE([IP_TOS_IS_BROKEN])
1074 AC_DEFINE([SETEUID_BREAKS_SETUID])
1075 AC_DEFINE([BROKEN_SETREUID])
1076 AC_DEFINE([BROKEN_SETREGID])
1077 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +10001078 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -07001079 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
1080 # Attention: always take care to bind libsocket and libnsl before libc,
1081 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +10001082 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001083# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +11001084*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -08001085 AC_DEFINE([USE_PIPES])
1086 AC_DEFINE([SETEUID_BREAKS_SETUID])
1087 AC_DEFINE([BROKEN_SETREUID])
1088 AC_DEFINE([BROKEN_SETREGID])
1089 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
1090 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -07001091 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +11001092 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001093# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +11001094*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -08001095 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -08001096 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
1097 AC_DEFINE([USE_PIPES])
1098 AC_DEFINE([SETEUID_BREAKS_SETUID])
1099 AC_DEFINE([BROKEN_GETADDRINFO])
1100 AC_DEFINE([BROKEN_SETREUID])
1101 AC_DEFINE([BROKEN_SETREGID])
1102 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice8433d512017-07-11 18:47:56 -07001103 AC_DEFINE([BROKEN_TCGETATTR_ICANON])
Tim Rice5ab9b632013-06-02 14:05:48 -07001104 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4afeaf32018-03-25 10:00:21 -07001105 check_for_libcrypt_later=1
Tim Rice4dbacff2005-06-01 20:09:28 -07001106 case "$host" in
1107 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -07001108 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -08001109 AC_DEFINE([BROKEN_UPDWTMPX])
1110 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
1111 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
Tim Rice648f8762011-01-26 12:38:57 -08001112 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -07001113 ;;
Tim Rice648f8762011-01-26 12:38:57 -08001114 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice46259d82005-11-28 18:40:34 -08001115 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -07001116 esac
Damien Miller78315eb2000-09-29 23:01:36 +11001117 ;;
Damien Miller75b1d102000-01-07 14:01:41 +11001118*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +11001119 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001120# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +11001121*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -08001122 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +11001123 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001124# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +11001125*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -08001126 if test -z "$GCC"; then
1127 CFLAGS="$CFLAGS -belf"
1128 fi
Damien Miller5dfe9762001-02-16 12:05:39 +11001129 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +10001130 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -08001131 AC_DEFINE([USE_PIPES])
1132 AC_DEFINE([HAVE_SECUREWARE])
1133 AC_DEFINE([DISABLE_SHADOW])
1134 AC_DEFINE([DISABLE_FD_PASSING])
1135 AC_DEFINE([SETEUID_BREAKS_SETUID])
1136 AC_DEFINE([BROKEN_GETADDRINFO])
1137 AC_DEFINE([BROKEN_SETREUID])
1138 AC_DEFINE([BROKEN_SETREGID])
1139 AC_DEFINE([WITH_ABBREV_NO_TTY])
1140 AC_DEFINE([BROKEN_UPDWTMPX])
1141 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1142 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -07001143 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -07001144 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -07001145 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +10001146 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001147*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001148 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001149 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001150 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001151 [ --with-osfsia Enable Digital Unix SIA],
1152 [
1153 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001154 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001155 no_osfsia=1
1156 fi
1157 ],
1158 )
1159 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001160 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001161 AC_MSG_RESULT([yes])
1162 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001163 [Define if you have Digital Unix Security
1164 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001165 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001166 [Define if you don't want to use your
1167 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001168 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001169 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001170 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001171 else
Tim Rice648f8762011-01-26 12:38:57 -08001172 AC_MSG_RESULT([no])
1173 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001174 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001175 fi
1176 fi
Tim Rice648f8762011-01-26 12:38:57 -08001177 AC_DEFINE([BROKEN_GETADDRINFO])
1178 AC_DEFINE([SETEUID_BREAKS_SETUID])
1179 AC_DEFINE([BROKEN_SETREUID])
1180 AC_DEFINE([BROKEN_SETREGID])
1181 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001182 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001183
Tim Rice70335a62006-02-04 17:42:58 -08001184*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001185 AC_DEFINE([USE_PIPES])
1186 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001187 AC_DEFINE([DISABLE_LASTLOG])
1188 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1189 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001190 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001191 case "$host" in
1192 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001193 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001194 ;;
1195 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001196 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001197
1198*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001199 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
Tim Rice648f8762011-01-26 12:38:57 -08001200 AC_DEFINE([NEED_SETPGRP])
1201 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001202 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001203
1204*-*-lynxos)
Darren Tucker5faa52d2016-08-02 15:22:40 +10001205 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
1206 AC_DEFINE([BROKEN_SETVBUF], [1],
1207 [LynxOS has broken setvbuf() implementation])
1208 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001209esac
1210
Tim Rice648f8762011-01-26 12:38:57 -08001211AC_MSG_CHECKING([compiler and flags for sanity])
1212AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1213 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001214 [
Tim Rice648f8762011-01-26 12:38:57 -08001215 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001216 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001217 ],
1218 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001219)
1220
Darren Tucker0c9653f2005-05-28 15:58:14 +10001221dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001222# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001223AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001224
Tim Rice1e1ef642003-09-11 22:19:31 -07001225dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001226AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1227 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001228 AC_CACHE_CHECK([for broken dirname],
1229 ac_cv_have_broken_dirname, [
1230 save_LIBS="$LIBS"
1231 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001232 AC_RUN_IFELSE(
1233 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001234#include <libgen.h>
1235#include <string.h>
1236
1237int main(int argc, char **argv) {
1238 char *s, buf[32];
1239
1240 strncpy(buf,"/etc", 32);
1241 s = dirname(buf);
1242 if (!s || strncmp(s, "/", 32) != 0) {
1243 exit(1);
1244 } else {
1245 exit(0);
1246 }
1247}
Darren Tucker314d89e2005-10-17 23:29:23 +10001248 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001249 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001250 [ ac_cv_have_broken_dirname="yes" ],
1251 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001252 )
1253 LIBS="$save_LIBS"
1254 ])
1255 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1256 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001257 AC_DEFINE([HAVE_DIRNAME])
1258 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001259 fi
1260 ])
1261])
1262
Tim Rice648f8762011-01-26 12:38:57 -08001263AC_CHECK_FUNC([getspnam], ,
1264 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1265AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1266 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001267
Tim Rice13aae5e2001-10-21 17:53:58 -07001268dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001269AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001270 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001271 [ if test "x$withval" = "xno" ; then
1272 AC_MSG_ERROR([*** zlib is required ***])
1273 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001274 if test -d "$withval/lib"; then
1275 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001276 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001277 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001278 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001279 fi
1280 else
1281 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001282 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001283 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001284 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001285 fi
1286 fi
1287 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001288 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001289 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001290 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001291 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001292 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001293)
1294
Tim Rice648f8762011-01-26 12:38:57 -08001295AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1296AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001297 [
1298 saved_CPPFLAGS="$CPPFLAGS"
1299 saved_LDFLAGS="$LDFLAGS"
1300 save_LIBS="$LIBS"
1301 dnl Check default zlib install dir
1302 if test -n "${need_dash_r}"; then
1303 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1304 else
1305 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1306 fi
1307 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1308 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001309 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001310 [
1311 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1312 ]
1313 )
1314 ]
1315)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001316
Tim Rice648f8762011-01-26 12:38:57 -08001317AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001318 [ --without-zlib-version-check Disable zlib version check],
1319 [ if test "x$withval" = "xno" ; then
1320 zlib_check_nonfatal=1
1321 fi
1322 ]
1323)
1324
Tim Rice648f8762011-01-26 12:38:57 -08001325AC_MSG_CHECKING([for possibly buggy zlib])
1326AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001327#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001328#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001329#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001330 ]],
1331 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001332 int a=0, b=0, c=0, d=0, n, v;
1333 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1334 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001335 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001336 v = a*1000000 + b*10000 + c*100 + d;
1337 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1338
1339 /* 1.1.4 is OK */
1340 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001341 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001342
Darren Tucker41097ed2005-07-25 15:24:21 +10001343 /* 1.2.3 and up are OK */
1344 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001345 exit(0);
1346
Darren Tucker2dcd2392004-01-23 17:13:33 +11001347 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001348 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001349 AC_MSG_RESULT([no]),
1350 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001351 if test -z "$zlib_check_nonfatal" ; then
1352 AC_MSG_ERROR([*** zlib too old - check config.log ***
1353Your reported zlib version has known security problems. It's possible your
1354vendor has fixed these problems without changing the version number. If you
1355are sure this is the case, you can disable the check by running
1356"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001357If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001358See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001359 else
1360 AC_MSG_WARN([zlib version may have security problems])
1361 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001362 ],
1363 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001364)
Damien Miller6f9c3372000-10-25 10:06:04 +11001365
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001366dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001367AC_CHECK_FUNC([strcasecmp],
1368 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001369)
Tim Rice648f8762011-01-26 12:38:57 -08001370AC_CHECK_FUNCS([utimes],
1371 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001372 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001373)
Damien Millerab18c411999-11-11 10:40:23 +11001374
Tim Ricee589a292001-11-03 11:09:32 -08001375dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001376AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001377AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001378AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001379AC_SEARCH_LIBS([login], [util bsd])
1380AC_SEARCH_LIBS([logout], [util bsd])
1381AC_SEARCH_LIBS([logwtmp], [util bsd])
1382AC_SEARCH_LIBS([openpty], [util bsd])
1383AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001384AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001385
Darren Tucker2fee9092016-02-17 09:48:15 +11001386# On some platforms, inet_ntop and gethostbyname may be found in libresolv
1387# or libnsl.
Damien Millerab039492014-01-28 15:07:10 +11001388AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
Darren Tucker2fee9092016-02-17 09:48:15 +11001389AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
Damien Millerab039492014-01-28 15:07:10 +11001390
Darren Tucker74c1c362017-09-27 07:44:41 +10001391# "Particular Function Checks"
1392# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html
Ben Lindstrom8697e082001-02-24 21:41:10 +00001393AC_FUNC_STRFTIME
Darren Tucker74c1c362017-09-27 07:44:41 +10001394AC_FUNC_MALLOC
1395AC_FUNC_REALLOC
1396# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL;
Darren Tuckere9dede02018-02-25 10:20:31 +11001397AC_MSG_CHECKING([if calloc(0, N) returns non-null])
1398AC_RUN_IFELSE(
1399 [AC_LANG_PROGRAM(
1400 [[ #include <stdlib.h> ]],
1401 [[ void *p = calloc(0, 1); exit(p == NULL); ]]
1402 )],
1403 [ func_calloc_0_nonnull=yes ],
1404 [ func_calloc_0_nonnull=no ],
1405 [ AC_MSG_WARN([cross compiling: assuming same as malloc])
1406 func_calloc_0_nonnull="$ac_cv_func_malloc_0_nonnull"]
1407)
1408AC_MSG_RESULT([$func_calloc_0_nonnull])
1409
Darren Tuckerd97874c2018-04-13 13:43:55 +10001410if test "x$func_calloc_0_nonnull" = "xyes"; then
Darren Tuckere9dede02018-02-25 10:20:31 +11001411 AC_DEFINE(HAVE_CALLOC, 1, [calloc(0, x) returns non-null])
1412else
1413 AC_DEFINE(HAVE_CALLOC, 0, [calloc(0, x) returns NULL])
Darren Tucker74c1c362017-09-27 07:44:41 +10001414 AC_DEFINE(calloc, rpl_calloc,
1415 [Define to rpl_calloc if the replacement function should be used.])
1416fi
Ben Lindstrom8697e082001-02-24 21:41:10 +00001417
Damien Miller3c027682001-03-14 11:39:45 +11001418# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001419AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1420AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001421 [
1422 #include <glob.h>
1423 #ifdef GLOB_ALTDIRFUNC
1424 FOUNDIT
1425 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001426 ],
Damien Miller3c027682001-03-14 11:39:45 +11001427 [
Tim Rice648f8762011-01-26 12:38:57 -08001428 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001429 [Define if your system glob() function has
1430 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001431 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001432 ],
1433 [
Tim Rice648f8762011-01-26 12:38:57 -08001434 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001435 ]
1436)
Damien Millerab18c411999-11-11 10:40:23 +11001437
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001438# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001439AC_MSG_CHECKING([for gl_matchc field in glob_t])
1440AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1441 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001442 [
Tim Rice648f8762011-01-26 12:38:57 -08001443 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001444 [Define if your system glob() function has
1445 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001446 AC_MSG_RESULT([yes])
1447 ], [
1448 AC_MSG_RESULT([no])
1449])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001450
Damien Millera6e121a2010-10-07 21:39:17 +11001451# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001452AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1453AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001454#ifndef GLOB_KEEPSTAT
1455#error "glob does not support GLOB_KEEPSTAT extension"
1456#endif
1457glob_t g;
1458g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001459]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001460 [
Tim Rice648f8762011-01-26 12:38:57 -08001461 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001462 [Define if your system glob() function has
1463 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001464 AC_MSG_RESULT([yes])
1465 ], [
1466 AC_MSG_RESULT([no])
Damien Miller72ef7c12015-01-15 02:21:31 +11001467
Tim Rice648f8762011-01-26 12:38:57 -08001468])
Damien Millera6e121a2010-10-07 21:39:17 +11001469
Tim Rice648f8762011-01-26 12:38:57 -08001470AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001471
Darren Tucker7df91b02016-07-14 12:25:24 +10001472AC_CHECK_DECL([VIS_ALL], ,
1473 AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
1474
Damien Miller18bb4732001-03-28 14:35:30 +10001475AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001476AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001477 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001478#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001479#include <dirent.h>]],
1480 [[
1481 struct dirent d;
1482 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001483 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001484 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001485 [
Tim Rice648f8762011-01-26 12:38:57 -08001486 AC_MSG_RESULT([no])
1487 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001488 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001489 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001490 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001491 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001492 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001493 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001494 ]
1495)
1496
Damien Miller36f49652004-08-15 18:40:59 +10001497AC_MSG_CHECKING([for /proc/pid/fd directory])
1498if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001499 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1500 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001501else
Tim Rice648f8762011-01-26 12:38:57 -08001502 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001503fi
1504
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001505# Check whether user wants to use ldns
1506LDNS_MSG="no"
1507AC_ARG_WITH(ldns,
1508 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
Damien Miller523db852017-02-03 16:01:22 +11001509 [
1510 ldns=""
1511 if test "x$withval" = "xyes" ; then
1512 AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no])
Darren Tuckerf001de82017-12-11 13:42:51 +11001513 if test "x$LDNSCONFIG" = "xno"; then
Damien Miller523db852017-02-03 16:01:22 +11001514 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1515 LDFLAGS="$LDFLAGS -L${withval}/lib"
1516 LIBS="-lldns $LIBS"
1517 ldns=yes
1518 else
1519 LIBS="$LIBS `$LDNSCONFIG --libs`"
1520 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`"
Darren Tucker7af27bf2017-03-24 09:44:56 +11001521 ldns=yes
Damien Miller523db852017-02-03 16:01:22 +11001522 fi
1523 elif test "x$withval" != "xno" ; then
1524 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1525 LDFLAGS="$LDFLAGS -L${withval}/lib"
1526 LIBS="-lldns $LIBS"
1527 ldns=yes
1528 fi
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001529
Damien Miller523db852017-02-03 16:01:22 +11001530 # Verify that it works.
1531 if test "x$ldns" = "xyes" ; then
1532 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1533 LDNS_MSG="yes"
1534 AC_MSG_CHECKING([for ldns support])
1535 AC_LINK_IFELSE(
1536 [AC_LANG_SOURCE([[
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001537#include <stdio.h>
1538#include <stdlib.h>
1539#include <stdint.h>
1540#include <ldns/ldns.h>
1541int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
Damien Miller523db852017-02-03 16:01:22 +11001542 ]])
1543 ],
1544 [AC_MSG_RESULT(yes)],
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001545 [
1546 AC_MSG_RESULT(no)
1547 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1548 ])
Damien Miller523db852017-02-03 16:01:22 +11001549 fi
1550])
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001551
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001552# Check whether user wants libedit support
1553LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001554AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001555 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001556 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001557 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001558 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001559 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001560 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Tim Ricee1d93702016-05-31 11:13:22 -07001561 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001562 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001563 use_pkgconfig_for_libedit=yes
1564 else
Tim Rice648f8762011-01-26 12:38:57 -08001565 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001566 fi
1567 fi
1568 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001569 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1570 if test -n "${need_dash_r}"; then
1571 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1572 else
1573 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1574 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001575 fi
Damien Miller1f789802010-10-11 22:35:22 +11001576 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001577 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001578 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1579 else
1580 LIBEDIT="-ledit -lcurses"
1581 fi
1582 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001583 AC_CHECK_LIB([edit], [el_init],
1584 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001585 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001586 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001587 ],
Tim Rice648f8762011-01-26 12:38:57 -08001588 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001589 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001590 )
Tim Rice648f8762011-01-26 12:38:57 -08001591 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001592 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001593 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1594 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001595 int i = H_SETSIZE;
1596 el_init("", NULL, NULL, NULL);
1597 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001598 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001599 [ AC_MSG_RESULT([yes]) ],
1600 [ AC_MSG_RESULT([no])
1601 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001602 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001603 fi ]
1604)
1605
Darren Tuckerd9f88912005-02-20 21:01:48 +11001606AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001607AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001608 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001609 [
Tim Rice648f8762011-01-26 12:38:57 -08001610 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001611 case "$withval" in
1612 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001613 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001614 AUDIT_MODULE=bsm
1615 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001616 AC_CHECK_HEADERS([bsm/audit.h], [],
1617 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001618 [
1619#ifdef HAVE_TIME_H
1620# include <time.h>
1621#endif
1622 ]
1623)
Tim Rice648f8762011-01-26 12:38:57 -08001624 AC_CHECK_LIB([bsm], [getaudit], [],
1625 [AC_MSG_ERROR([BSM enabled and required library not found])])
1626 AC_CHECK_FUNCS([getaudit], [],
1627 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001628 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001629 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1630 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001631 if test "$sol2ver" -ge 11; then
Tim Ricee1d93702016-05-31 11:13:22 -07001632 SSHDLIBS="$SSHDLIBS -lscf"
1633 AC_DEFINE([BROKEN_BSM_API], [1],
1634 [The system has incomplete BSM API])
Darren Tucker93a2d412012-02-24 10:40:41 +11001635 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001636 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001637 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001638 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001639 AUDIT_MODULE=linux
1640 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001641 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001642 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001643 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001644 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001645 debug)
1646 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001647 AC_MSG_RESULT([debug])
1648 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001649 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001650 no)
Tim Rice648f8762011-01-26 12:38:57 -08001651 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001652 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001653 *)
1654 AC_MSG_ERROR([Unknown audit module $withval])
1655 ;;
1656 esac ]
1657)
1658
Darren Tucker096118d2014-01-21 12:48:51 +11001659AC_ARG_WITH([pie],
Damien Miller76c04802015-01-13 19:38:18 +11001660 [ --with-pie Build Position Independent Executables if possible], [
Darren Tucker096118d2014-01-21 12:48:51 +11001661 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001662 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001663 fi
1664 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001665 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001666 fi
1667 ]
1668)
Damien Miller852472a2014-01-22 16:31:18 +11001669if test "x$use_pie" = "x"; then
1670 use_pie=no
1671fi
1672if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1673 # Turn off automatic PIE when toolchain hardening is off.
1674 use_pie=no
1675fi
Damien Millerc161fc92014-01-29 21:01:33 +11001676if test "x$use_pie" = "xauto"; then
Damien Miller852472a2014-01-22 16:31:18 +11001677 # Automatic PIE requires gcc >= 4.x
1678 AC_MSG_CHECKING([for gcc >= 4.x])
1679 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1680#if !defined(__GNUC__) || __GNUC__ < 4
1681#error gcc is too old
1682#endif
1683]])],
1684 [ AC_MSG_RESULT([yes]) ],
1685 [ AC_MSG_RESULT([no])
1686 use_pie=no ]
1687)
1688fi
1689if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001690 SAVED_CFLAGS="$CFLAGS"
1691 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001692 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1693 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001694 # We use both -fPIE and -pie or neither.
1695 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1696 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1697 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1698 AC_MSG_RESULT([yes])
1699 else
1700 AC_MSG_RESULT([no])
1701 CFLAGS="$SAVED_CFLAGS"
1702 LDFLAGS="$SAVED_LDFLAGS"
1703 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001704fi
1705
Damien Millerfe1f1432003-02-24 15:45:42 +11001706dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001707AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001708 Blowfish_initstate \
1709 Blowfish_expandstate \
1710 Blowfish_expand0state \
1711 Blowfish_stream2word \
Damien Miller57f39152005-11-24 19:58:19 +11001712 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001713 b64_ntop \
1714 __b64_ntop \
1715 b64_pton \
1716 __b64_pton \
1717 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001718 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001719 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001720 blf_enc \
Darren Tuckera9004422018-02-24 20:25:22 +11001721 bzero \
Damien Millerc96d8532014-01-25 13:12:28 +11001722 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001723 clock \
1724 closefrom \
1725 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001726 endgrent \
Darren Tucker6310ef22016-07-13 14:42:35 +10001727 err \
1728 errx \
Damien Miller1d2c4562014-02-04 11:18:20 +11001729 explicit_bzero \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001730 fchmod \
1731 fchown \
Darren Tuckercd3ab572018-02-26 14:37:06 +11001732 flock \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001733 freeaddrinfo \
Damien Millerb7956912017-09-19 12:29:23 +10001734 freezero \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001735 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001736 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001737 futimes \
1738 getaddrinfo \
1739 getcwd \
1740 getgrouplist \
Darren Tucker6301e6c2018-07-02 21:16:58 +10001741 getline \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001742 getnameinfo \
1743 getopt \
Damien Miller151c6e42017-06-01 15:25:13 +10001744 getpagesize \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001745 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001746 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001747 getpgid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001748 _getpty \
1749 getrlimit \
Damien Millerafa6e792018-04-13 13:31:42 +10001750 getrandom \
Darren Tuckerb39593a2018-02-25 13:25:15 +11001751 getsid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001752 getttyent \
1753 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001754 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001755 inet_aton \
1756 inet_ntoa \
1757 inet_ntop \
1758 innetgr \
Darren Tuckerd38f05d2017-03-20 13:38:27 +11001759 llabs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001760 login_getcapbool \
1761 md5_crypt \
1762 memmove \
Damien Miller3d673d12014-08-27 06:32:01 +10001763 memset_s \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001764 mkdtemp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001765 ngetaddrinfo \
1766 nsleep \
1767 ogetaddrinfo \
1768 openlog_r \
Darren Tucker3ddd15e2015-11-30 07:23:53 +11001769 pledge \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001770 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001771 prctl \
1772 pstat \
Darren Tucker6c8c9a62018-02-24 20:46:37 +11001773 raise \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001774 readpassphrase \
Darren Tucker642652d2014-12-10 01:32:23 +11001775 reallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001776 recvmsg \
Damien Miller151c6e42017-06-01 15:25:13 +10001777 recallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001778 rresvport_af \
1779 sendmsg \
1780 setdtablesize \
1781 setegid \
1782 setenv \
1783 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001784 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001785 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001786 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001787 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001788 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001789 setpcred \
1790 setproctitle \
1791 setregid \
1792 setreuid \
1793 setrlimit \
1794 setsid \
1795 setvbuf \
1796 sigaction \
1797 sigvec \
1798 snprintf \
1799 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001800 statfs \
1801 statvfs \
Darren Tuckerafec0772016-12-13 10:23:03 +11001802 strcasestr \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001803 strdup \
1804 strerror \
1805 strlcat \
1806 strlcpy \
1807 strmode \
Darren Tucker33561e62018-03-03 14:56:09 +11001808 strndup \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001809 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001810 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001811 strptime \
Darren Tucker44fc3342017-09-25 09:48:10 +10001812 strsignal \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001813 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001814 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001815 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001816 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001817 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001818 sysconf \
1819 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001820 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001821 truncate \
1822 unsetenv \
1823 updwtmpx \
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 Tuckerd3e2aee2015-07-17 12:52:34 +10002032AC_CHECK_FUNCS([realpath], [
2033 dnl the sftp v3 spec says SSH_FXP_REALPATH will "canonicalize any given
2034 dnl path name", however some implementations of realpath (and some
2035 dnl versions of the POSIX spec) do not work on non-existent files,
2036 dnl so we use the OpenBSD implementation on those platforms.
2037 AC_MSG_CHECKING([if realpath works with non-existent files])
2038 AC_RUN_IFELSE(
2039 [AC_LANG_PROGRAM([[
2040#include <limits.h>
2041#include <stdlib.h>
2042#include <errno.h>
2043 ]], [[
2044 char buf[PATH_MAX];
2045 if (realpath("/opensshnonexistentfilename1234", buf) == NULL)
2046 if (errno == ENOENT)
2047 exit(1);
2048 exit(0);
2049 ]])],
2050 [AC_MSG_RESULT([yes])],
2051 [AC_DEFINE([BROKEN_REALPATH], [1],
2052 [realpath does not work with nonexistent files])
2053 AC_MSG_RESULT([no])],
2054 [AC_MSG_WARN([cross compiling: assuming working])]
2055 )
2056])
2057
Darren Tucker58fd4c52018-03-05 19:28:08 +11002058AC_MSG_CHECKING([for working fflush(NULL)])
2059AC_RUN_IFELSE(
2060 [AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(NULL); exit(0);]])],
2061 AC_MSG_RESULT([yes]),
2062 [AC_MSG_RESULT([no])
2063 AC_DEFINE([FFLUSH_NULL_BUG], [1],
2064 [define if fflush(NULL) does not work])],
2065 AC_MSG_WARN([cross compiling: assuming working])
2066)
2067
Damien Millerad833b32000-08-23 10:46:23 +10002068dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08002069AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10002070dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08002071AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
2072AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10002073dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08002074AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
2075AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11002076dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08002077AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11002078
Tim Rice648f8762011-01-26 12:38:57 -08002079AC_CHECK_FUNC([daemon],
2080 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
2081 [AC_CHECK_LIB([bsd], [daemon],
2082 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11002083)
2084
Tim Rice648f8762011-01-26 12:38:57 -08002085AC_CHECK_FUNC([getpagesize],
2086 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002087 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08002088 [AC_CHECK_LIB([ucb], [getpagesize],
2089 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11002090)
2091
Damien Millercb170cb2000-07-01 16:52:55 +10002092# Check for broken snprintf
2093if test "x$ac_cv_func_snprintf" = "xyes" ; then
2094 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002095 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002096 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
2097 [[
2098 char b[5];
2099 snprintf(b,5,"123456789");
Tim Ricee1d93702016-05-31 11:13:22 -07002100 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10002101 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002102 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10002103 [
Tim Rice648f8762011-01-26 12:38:57 -08002104 AC_MSG_RESULT([no])
2105 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002106 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10002107 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002108 ],
2109 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10002110 )
2111fi
2112
Damien Millerd244a582014-08-23 17:06:49 +10002113# We depend on vsnprintf returning the right thing on overflow: the
2114# number of characters it tried to create (as per SUSv3)
2115if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
Damien Miller57f39152005-11-24 19:58:19 +11002116 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
2117 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002118 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11002119#include <sys/types.h>
2120#include <stdio.h>
2121#include <stdarg.h>
2122
Damien Millerd244a582014-08-23 17:06:49 +10002123int x_snprintf(char *str, size_t count, const char *fmt, ...)
Damien Miller57f39152005-11-24 19:58:19 +11002124{
Damien Millerd244a582014-08-23 17:06:49 +10002125 size_t ret;
2126 va_list ap;
2127
2128 va_start(ap, fmt);
2129 ret = vsnprintf(str, count, fmt, ap);
2130 va_end(ap);
Damien Miller57f39152005-11-24 19:58:19 +11002131 return ret;
2132}
Tim Rice648f8762011-01-26 12:38:57 -08002133 ]], [[
Damien Millerd244a582014-08-23 17:06:49 +10002134char x[1];
2135if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11)
2136 return 1;
2137if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11)
2138 return 1;
2139return 0;
Tim Rice648f8762011-01-26 12:38:57 -08002140 ]])],
2141 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11002142 [
Tim Rice648f8762011-01-26 12:38:57 -08002143 AC_MSG_RESULT([no])
2144 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11002145 [Define if your snprintf is busted])
2146 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
2147 ],
2148 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
2149 )
2150fi
2151
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002152# On systems where [v]snprintf is broken, but is declared in stdio,
2153# check that the fmt argument is const char * or just char *.
2154# This is only useful for when BROKEN_SNPRINTF
2155AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08002156AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2157#include <stdio.h>
2158int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
2159 ]], [[
2160 snprintf(0, 0, 0);
2161 ]])],
2162 [AC_MSG_RESULT([yes])
2163 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002164 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08002165 [AC_MSG_RESULT([no])
2166 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002167
Damien Millerb4097182004-05-23 14:09:40 +10002168# Check for missing getpeereid (or equiv) support
2169NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11002170if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10002171 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08002172 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2173#include <sys/types.h>
2174#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2175 [ AC_MSG_RESULT([yes])
2176 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2177 ], [AC_MSG_RESULT([no])
2178 NO_PEERCHECK=1
2179 ])
Damien Millerb4097182004-05-23 14:09:40 +10002180fi
2181
Damien Millere8328192003-01-07 15:18:32 +11002182dnl see whether mkstemp() requires XXXXXX
2183if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2184AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002185AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002186 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002187#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002188 ]], [[
2189 char template[]="conftest.mkstemp-test";
2190 if (mkstemp(template) == -1)
2191 exit(1);
2192 unlink(template);
2193 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002194 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002195 [
Tim Rice648f8762011-01-26 12:38:57 -08002196 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002197 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002198 [
Tim Rice648f8762011-01-26 12:38:57 -08002199 AC_MSG_RESULT([yes])
2200 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002201 ],
2202 [
Tim Rice648f8762011-01-26 12:38:57 -08002203 AC_MSG_RESULT([yes])
2204 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002205 ]
Damien Millere8328192003-01-07 15:18:32 +11002206)
2207fi
2208
Darren Tucker70a3d552003-08-21 17:58:29 +10002209dnl make sure that openpty does not reacquire controlling terminal
2210if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002211 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002212 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002213 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002214#include <stdio.h>
2215#include <sys/fcntl.h>
2216#include <sys/types.h>
2217#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002218 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002219 pid_t pid;
2220 int fd, ptyfd, ttyfd, status;
2221
2222 pid = fork();
2223 if (pid < 0) { /* failed */
2224 exit(1);
2225 } else if (pid > 0) { /* parent */
2226 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002227 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002228 exit(WEXITSTATUS(status));
2229 else
2230 exit(2);
2231 } else { /* child */
2232 close(0); close(1); close(2);
2233 setsid();
2234 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2235 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2236 if (fd >= 0)
2237 exit(3); /* Acquired ctty: broken */
2238 else
2239 exit(0); /* Did not acquire ctty: OK */
2240 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002241 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002242 [
Tim Rice648f8762011-01-26 12:38:57 -08002243 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002244 ],
2245 [
Tim Rice648f8762011-01-26 12:38:57 -08002246 AC_MSG_RESULT([no])
2247 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002248 ],
2249 [
Tim Rice648f8762011-01-26 12:38:57 -08002250 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002251 ]
2252 )
2253fi
2254
Tim Rice8bb561b2005-03-17 16:23:19 -08002255if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2256 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002257 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002258 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002259 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002260#include <stdio.h>
2261#include <sys/socket.h>
2262#include <netdb.h>
2263#include <errno.h>
2264#include <netinet/in.h>
2265
2266#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002267 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002268 int err, sock;
2269 struct addrinfo *gai_ai, *ai, hints;
2270 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2271
2272 memset(&hints, 0, sizeof(hints));
2273 hints.ai_family = PF_UNSPEC;
2274 hints.ai_socktype = SOCK_STREAM;
2275 hints.ai_flags = AI_PASSIVE;
2276
2277 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2278 if (err != 0) {
2279 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2280 exit(1);
2281 }
2282
2283 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2284 if (ai->ai_family != AF_INET6)
2285 continue;
2286
2287 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2288 sizeof(ntop), strport, sizeof(strport),
2289 NI_NUMERICHOST|NI_NUMERICSERV);
2290
2291 if (err != 0) {
2292 if (err == EAI_SYSTEM)
2293 perror("getnameinfo EAI_SYSTEM");
2294 else
2295 fprintf(stderr, "getnameinfo failed: %s\n",
2296 gai_strerror(err));
2297 exit(2);
2298 }
2299
2300 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2301 if (sock < 0)
2302 perror("socket");
2303 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2304 if (errno == EBADF)
2305 exit(3);
2306 }
2307 }
2308 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002309 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002310 [
Tim Rice648f8762011-01-26 12:38:57 -08002311 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002312 ],
2313 [
Tim Rice648f8762011-01-26 12:38:57 -08002314 AC_MSG_RESULT([no])
2315 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002316 ],
2317 [
Tim Rice648f8762011-01-26 12:38:57 -08002318 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002319 ]
2320 )
2321fi
2322
Tim Rice8bb561b2005-03-17 16:23:19 -08002323if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2324 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002325 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002326 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002327 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002328#include <stdio.h>
2329#include <sys/socket.h>
2330#include <netdb.h>
2331#include <errno.h>
2332#include <netinet/in.h>
2333
2334#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002335 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002336 int err, sock;
2337 struct addrinfo *gai_ai, *ai, hints;
2338 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2339
2340 memset(&hints, 0, sizeof(hints));
2341 hints.ai_family = PF_UNSPEC;
2342 hints.ai_socktype = SOCK_STREAM;
2343 hints.ai_flags = AI_PASSIVE;
2344
2345 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2346 if (err != 0) {
2347 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2348 exit(1);
2349 }
2350
2351 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2352 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2353 continue;
2354
2355 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2356 sizeof(ntop), strport, sizeof(strport),
2357 NI_NUMERICHOST|NI_NUMERICSERV);
2358
2359 if (ai->ai_family == AF_INET && err != 0) {
2360 perror("getnameinfo");
2361 exit(2);
2362 }
2363 }
2364 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002365 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002366 [
Tim Rice648f8762011-01-26 12:38:57 -08002367 AC_MSG_RESULT([yes])
2368 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002369 [Define if you have a getaddrinfo that fails
2370 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002371 ],
2372 [
Tim Rice648f8762011-01-26 12:38:57 -08002373 AC_MSG_RESULT([no])
2374 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002375 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002376 [
Tim Rice648f8762011-01-26 12:38:57 -08002377 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002378 ]
2379 )
2380fi
2381
Darren Tuckere50e8c92015-02-21 15:10:33 +11002382if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2383 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2384 [#include <sys/types.h>
2385 #include <sys/socket.h>
2386 #include <netdb.h>])
2387fi
2388
Darren Tuckera56f1912004-11-02 20:30:54 +11002389if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002390 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2392 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002393 [
Tim Rice648f8762011-01-26 12:38:57 -08002394 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002395 ],
2396 [
Tim Rice648f8762011-01-26 12:38:57 -08002397 AC_MSG_RESULT([yes])
2398 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002399 [Conflicting defs for getspnam])
2400 ]
2401 )
2402fi
2403
Darren Tucker20e5e8b2016-08-02 12:16:34 +10002404dnl NetBSD added an strnvis and unfortunately made it incompatible with the
2405dnl existing one in OpenBSD and Linux's libbsd (the former having existed
2406dnl for over ten years). Despite this incompatibility being reported during
2407dnl development (see http://gnats.netbsd.org/44977) they still shipped it.
2408dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible
2409dnl implementation. Try to detect this mess, and assume the only safe option
2410dnl if we're cross compiling.
2411dnl
2412dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
2413dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
2414if test "x$ac_cv_func_strnvis" = "xyes"; then
2415 AC_MSG_CHECKING([for working strnvis])
2416 AC_RUN_IFELSE(
2417 [AC_LANG_PROGRAM([[
2418#include <signal.h>
2419#include <stdlib.h>
2420#include <string.h>
2421#include <vis.h>
2422static void sighandler(int sig) { _exit(1); }
2423 ]], [[
2424 char dst[16];
2425
2426 signal(SIGSEGV, sighandler);
2427 if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0)
2428 exit(0);
2429 exit(1)
2430 ]])],
2431 [AC_MSG_RESULT([yes])],
2432 [AC_MSG_RESULT([no])
2433 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])],
2434 [AC_MSG_WARN([cross compiling: assuming broken])
2435 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])]
2436 )
2437fi
2438
Darren Tuckerc7b5a472018-02-25 23:55:41 +11002439AC_CHECK_FUNCS([getpgrp],[
2440 AC_MSG_CHECKING([if getpgrp accepts zero args])
2441 AC_COMPILE_IFELSE(
2442 [AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])],
2443 [ AC_MSG_RESULT([yes])
2444 AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])],
2445 [ AC_MSG_RESULT([no])
2446 AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])]
2447 )
2448])
Damien Miller606f8802000-09-16 15:39:56 +11002449
Tim Riceaef73712002-05-11 13:17:42 -07002450# Search for OpenSSL
2451saved_CPPFLAGS="$CPPFLAGS"
2452saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002453AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002454 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2455 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002456 if test "x$openssl" = "xno" ; then
2457 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2458 fi
Ben Lindstrom23e13712000-10-29 22:49:19 +00002459 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002460 case "$withval" in
2461 # Relative paths
2462 ./*|../*) withval="`pwd`/$withval"
2463 esac
Tim Riceaef73712002-05-11 13:17:42 -07002464 if test -d "$withval/lib"; then
2465 if test -n "${need_dash_r}"; then
2466 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2467 else
2468 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2469 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002470 elif test -d "$withval/lib64"; then
2471 if test -n "${need_dash_r}"; then
2472 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2473 else
2474 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2475 fi
Tim Riceaef73712002-05-11 13:17:42 -07002476 else
2477 if test -n "${need_dash_r}"; then
2478 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2479 else
2480 LDFLAGS="-L${withval} ${LDFLAGS}"
2481 fi
2482 fi
2483 if test -d "$withval/include"; then
2484 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2485 else
2486 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2487 fi
Damien Millera22ba012000-03-02 23:09:20 +11002488 fi
2489 ]
2490)
Damien Millerb9c56672014-05-15 14:43:37 +10002491
Tim Rice648f8762011-01-26 12:38:57 -08002492AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002493 [ --without-openssl-header-check Disable OpenSSL version consistency check],
Damien Millerec932372002-01-22 22:16:03 +11002494 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002495 if test "x$withval" = "xno" ; then
2496 openssl_check_nonfatal=1
Damien Miller9975e482007-03-05 11:51:27 +11002497 fi
Damien Millerec932372002-01-22 22:16:03 +11002498 ]
2499)
2500
Damien Miller72ef7c12015-01-15 02:21:31 +11002501openssl_engine=no
Tim Rice648f8762011-01-26 12:38:57 -08002502AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002503 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
Damien Miller72ef7c12015-01-15 02:21:31 +11002504 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002505 if test "x$withval" != "xno" ; then
Darren Tuckerb5fa0cd2015-12-15 15:10:32 +11002506 if test "x$openssl" = "xno" ; then
2507 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2508 fi
Damien Miller72ef7c12015-01-15 02:21:31 +11002509 openssl_engine=yes
2510 fi
2511 ]
2512)
2513
2514if test "x$openssl" = "xyes" ; then
2515 LIBS="-lcrypto $LIBS"
2516 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
2517 [Define if your ssl headers are included
2518 with #include <openssl/header.h>])],
2519 [
2520 dnl Check default openssl install dir
2521 if test -n "${need_dash_r}"; then
2522 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2523 else
2524 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2525 fi
2526 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2527 AC_CHECK_HEADER([openssl/opensslv.h], ,
2528 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2529 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2530 [
2531 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2532 ]
2533 )
2534 ]
2535 )
2536
2537 # Determine OpenSSL header version
2538 AC_MSG_CHECKING([OpenSSL header version])
2539 AC_RUN_IFELSE(
2540 [AC_LANG_PROGRAM([[
Darren Tucker15605962015-11-10 11:14:47 +11002541 #include <stdlib.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002542 #include <stdio.h>
2543 #include <string.h>
2544 #include <openssl/opensslv.h>
2545 #define DATA "conftest.sslincver"
2546 ]], [[
2547 FILE *fd;
2548 int rc;
2549
2550 fd = fopen(DATA,"w");
2551 if(fd == NULL)
2552 exit(1);
2553
Darren Tuckerb3413532016-04-04 11:09:21 +10002554 if ((rc = fprintf(fd, "%08lx (%s)\n",
2555 (unsigned long)OPENSSL_VERSION_NUMBER,
2556 OPENSSL_VERSION_TEXT)) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002557 exit(1);
2558
2559 exit(0);
2560 ]])],
2561 [
2562 ssl_header_ver=`cat conftest.sslincver`
2563 AC_MSG_RESULT([$ssl_header_ver])
2564 ],
2565 [
2566 AC_MSG_RESULT([not found])
2567 AC_MSG_ERROR([OpenSSL version header not found.])
2568 ],
2569 [
2570 AC_MSG_WARN([cross compiling: not checking])
2571 ]
2572 )
2573
2574 # Determine OpenSSL library version
2575 AC_MSG_CHECKING([OpenSSL library version])
2576 AC_RUN_IFELSE(
2577 [AC_LANG_PROGRAM([[
2578 #include <stdio.h>
2579 #include <string.h>
2580 #include <openssl/opensslv.h>
2581 #include <openssl/crypto.h>
2582 #define DATA "conftest.ssllibver"
2583 ]], [[
2584 FILE *fd;
2585 int rc;
2586
2587 fd = fopen(DATA,"w");
2588 if(fd == NULL)
2589 exit(1);
2590
Darren Tucker815bcac2016-04-04 11:07:59 +10002591 if ((rc = fprintf(fd, "%08lx (%s)\n", (unsigned long)SSLeay(),
2592 SSLeay_version(SSLEAY_VERSION))) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002593 exit(1);
2594
2595 exit(0);
2596 ]])],
2597 [
2598 ssl_library_ver=`cat conftest.ssllibver`
2599 # Check version is supported.
2600 case "$ssl_library_ver" in
Damien Miller2429cf72017-03-14 18:01:52 +11002601 10000*|0*)
2602 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
Damien Miller72ef7c12015-01-15 02:21:31 +11002603 ;;
Damien Miller04dc0702017-09-28 14:54:34 -07002604 100*) ;; # 1.0.x
Damien Miller48f54b92018-09-13 12:13:50 +10002605 101*) ;; # 1.1.x
Damien Millerbba69c22017-09-28 16:06:21 -07002606 200*) ;; # LibreSSL
Damien Miller04dc0702017-09-28 14:54:34 -07002607 *)
Damien Miller48f54b92018-09-13 12:13:50 +10002608 AC_MSG_ERROR([OpenSSL > 1.1.x is not yet supported (have "$ssl_library_ver")])
Damien Miller04dc0702017-09-28 14:54:34 -07002609 ;;
Damien Miller72ef7c12015-01-15 02:21:31 +11002610 esac
2611 AC_MSG_RESULT([$ssl_library_ver])
2612 ],
2613 [
2614 AC_MSG_RESULT([not found])
2615 AC_MSG_ERROR([OpenSSL library not found.])
2616 ],
2617 [
2618 AC_MSG_WARN([cross compiling: not checking])
2619 ]
2620 )
2621
2622 # Sanity check OpenSSL headers
2623 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2624 AC_RUN_IFELSE(
2625 [AC_LANG_PROGRAM([[
2626 #include <string.h>
2627 #include <openssl/opensslv.h>
Darren Tuckerc1d7e542015-12-15 14:27:09 +11002628 #include <openssl/crypto.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002629 ]], [[
2630 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2631 ]])],
2632 [
2633 AC_MSG_RESULT([yes])
2634 ],
2635 [
2636 AC_MSG_RESULT([no])
2637 if test "x$openssl_check_nonfatal" = "x"; then
2638 AC_MSG_ERROR([Your OpenSSL headers do not match your
2639 library. Check config.log for details.
2640 If you are sure your installation is consistent, you can disable the check
2641 by running "./configure --without-openssl-header-check".
2642 Also see contrib/findssl.sh for help identifying header/library mismatches.
2643 ])
2644 else
2645 AC_MSG_WARN([Your OpenSSL headers do not match your
2646 library. Check config.log for details.
2647 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2648 fi
2649 ],
2650 [
2651 AC_MSG_WARN([cross compiling: not checking])
2652 ]
2653 )
2654
2655 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2656 AC_LINK_IFELSE(
2657 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2658 [[ SSLeay_add_all_algorithms(); ]])],
2659 [
2660 AC_MSG_RESULT([yes])
2661 ],
2662 [
2663 AC_MSG_RESULT([no])
2664 saved_LIBS="$LIBS"
2665 LIBS="$LIBS -ldl"
2666 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2667 AC_LINK_IFELSE(
2668 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2669 [[ SSLeay_add_all_algorithms(); ]])],
2670 [
2671 AC_MSG_RESULT([yes])
2672 ],
2673 [
2674 AC_MSG_RESULT([no])
2675 LIBS="$saved_LIBS"
2676 ]
2677 )
2678 ]
2679 )
2680
2681 AC_CHECK_FUNCS([ \
2682 BN_is_prime_ex \
2683 DSA_generate_parameters_ex \
2684 EVP_DigestInit_ex \
2685 EVP_DigestFinal_ex \
2686 EVP_MD_CTX_init \
2687 EVP_MD_CTX_cleanup \
2688 EVP_MD_CTX_copy_ex \
2689 HMAC_CTX_init \
2690 RSA_generate_key_ex \
2691 RSA_get_default_method \
2692 ])
2693
2694 if test "x$openssl_engine" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002695 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2696 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002697 #include <openssl/engine.h>
Tim Rice648f8762011-01-26 12:38:57 -08002698 ]], [[
Damien Miller72ef7c12015-01-15 02:21:31 +11002699 ENGINE_load_builtin_engines();
2700 ENGINE_register_all_complete();
Tim Rice648f8762011-01-26 12:38:57 -08002701 ]])],
2702 [ AC_MSG_RESULT([yes])
2703 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002704 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002705 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2706 ])
Damien Miller72ef7c12015-01-15 02:21:31 +11002707 fi
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002708
Damien Miller72ef7c12015-01-15 02:21:31 +11002709 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2710 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2711 AC_LINK_IFELSE(
Darren Tucker37bcef52013-11-09 18:39:25 +11002712 [AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002713 #include <string.h>
2714 #include <openssl/evp.h>
2715 ]], [[
2716 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2717 ]])],
2718 [
2719 AC_MSG_RESULT([no])
2720 ],
2721 [
2722 AC_MSG_RESULT([yes])
2723 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2724 [libcrypto is missing AES 192 and 256 bit functions])
2725 ]
2726 )
2727
2728 # Check for OpenSSL with EVP_aes_*ctr
2729 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2730 AC_LINK_IFELSE(
2731 [AC_LANG_PROGRAM([[
2732 #include <string.h>
2733 #include <openssl/evp.h>
2734 ]], [[
2735 exit(EVP_aes_128_ctr() == NULL ||
2736 EVP_aes_192_cbc() == NULL ||
2737 EVP_aes_256_cbc() == NULL);
2738 ]])],
2739 [
2740 AC_MSG_RESULT([yes])
2741 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2742 [libcrypto has EVP AES CTR])
2743 ],
2744 [
2745 AC_MSG_RESULT([no])
2746 ]
2747 )
2748
2749 # Check for OpenSSL with EVP_aes_*gcm
2750 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2751 AC_LINK_IFELSE(
2752 [AC_LANG_PROGRAM([[
2753 #include <string.h>
2754 #include <openssl/evp.h>
2755 ]], [[
2756 exit(EVP_aes_128_gcm() == NULL ||
2757 EVP_aes_256_gcm() == NULL ||
2758 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2759 EVP_CTRL_GCM_IV_GEN == 0 ||
2760 EVP_CTRL_GCM_SET_TAG == 0 ||
2761 EVP_CTRL_GCM_GET_TAG == 0 ||
2762 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2763 ]])],
2764 [
2765 AC_MSG_RESULT([yes])
2766 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2767 [libcrypto has EVP AES GCM])
2768 ],
2769 [
2770 AC_MSG_RESULT([no])
2771 unsupported_algorithms="$unsupported_cipers \
Damien Miller679ce882016-07-15 13:44:38 +10002772 aes128-gcm@openssh.com \
2773 aes256-gcm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002774 ]
2775 )
2776
2777 AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2778 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2779 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2780
Damien Miller48f54b92018-09-13 12:13:50 +10002781 # LibreSSL/OpenSSL 1.1x API
2782 AC_SEARCH_LIBS([DH_get0_key], [crypto],
2783 [AC_DEFINE([HAVE_DH_GET0_KEY], [1],
2784 [Define if libcrypto has DH_get0_key])])
2785 AC_SEARCH_LIBS([DH_get0_pqg], [crypto],
2786 [AC_DEFINE([HAVE_DH_GET0_PQG], [1],
2787 [Define if libcrypto has DH_get0_pqg])])
2788 AC_SEARCH_LIBS([DH_set0_key], [crypto],
2789 [AC_DEFINE([HAVE_DH_SET0_KEY], [1],
2790 [Define if libcrypto has DH_set0_key])])
2791 AC_SEARCH_LIBS([DH_set_length], [crypto],
2792 [AC_DEFINE([HAVE_DH_SET_LENGTH], [1],
2793 [Define if libcrypto has DH_set_length])])
2794 AC_SEARCH_LIBS([DH_set0_pqg], [crypto],
2795 [AC_DEFINE([HAVE_DH_SET0_PQG], [1],
2796 [Define if libcrypto has DH_set0_pqg])])
2797
2798 AC_SEARCH_LIBS([DSA_get0_key], [crypto],
2799 [AC_DEFINE([HAVE_DSA_GET0_KEY], [1],
2800 [Define if libcrypto has DSA_get0_key])])
2801 AC_SEARCH_LIBS([DSA_get0_pqg], [crypto],
2802 [AC_DEFINE([HAVE_DSA_GET0_PQG], [1],
2803 [Define if libcrypto has DSA_get0_pqg])])
2804 AC_SEARCH_LIBS([DSA_set0_key], [crypto],
2805 [AC_DEFINE([HAVE_DSA_SET0_KEY], [1],
2806 [Define if libcrypto has DSA_set0_key])])
2807 AC_SEARCH_LIBS([DSA_set0_pqg], [crypto],
2808 [AC_DEFINE([HAVE_DSA_SET0_PQG], [1],
2809 [Define if libcrypto has DSA_set0_pqg])])
2810
2811 AC_SEARCH_LIBS([DSA_SIG_get0], [crypto],
2812 [AC_DEFINE([HAVE_DSA_SIG_GET0], [1],
2813 [Define if libcrypto has DSA_SIG_get0])])
2814 AC_SEARCH_LIBS([DSA_SIG_set0], [crypto],
2815 [AC_DEFINE([HAVE_DSA_SIG_SET0], [1],
2816 [Define if libcrypto has DSA_SIG_set0])])
2817
2818 AC_SEARCH_LIBS([ECDSA_SIG_get0], [crypto],
2819 [AC_DEFINE([HAVE_ECDSA_SIG_GET0], [1],
2820 [Define if libcrypto has ECDSA_SIG_get0])])
2821 AC_SEARCH_LIBS([ECDSA_SIG_set0], [crypto],
2822 [AC_DEFINE([HAVE_ECDSA_SIG_SET0], [1],
2823 [Define if libcrypto has ECDSA_SIG_set0])])
2824
2825 AC_SEARCH_LIBS([EVP_CIPHER_CTX_iv], [crypto],
2826 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_IV], [1],
2827 [Define if libcrypto has EVP_CIPHER_CTX_iv])])
2828 AC_SEARCH_LIBS([EVP_CIPHER_CTX_iv_noconst], [crypto],
2829 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_IV_NOCONST], [1],
2830 [Define if libcrypto has EVP_CIPHER_CTX_iv_noconst])])
2831 AC_SEARCH_LIBS([EVP_CIPHER_CTX_get_iv], [crypto],
2832 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
2833 [Define if libcrypto has EVP_CIPHER_CTX_get_iv])])
2834 AC_SEARCH_LIBS([EVP_CIPHER_CTX_set_iv], [crypto],
2835 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
2836 [Define if libcrypto has EVP_CIPHER_CTX_set_iv])])
2837
2838 AC_SEARCH_LIBS([RSA_get0_crt_params], [crypto],
2839 [AC_DEFINE([HAVE_RSA_GET0_CRT_PARAMS], [1],
2840 [Define if libcrypto has RSA_get0_crt_params])])
2841 AC_SEARCH_LIBS([RSA_get0_factors], [crypto],
2842 [AC_DEFINE([HAVE_RSA_GET0_FACTORS], [1],
2843 [Define if libcrypto has RSA_get0_factors])])
2844 AC_SEARCH_LIBS([RSA_get0_key], [crypto],
2845 [AC_DEFINE([HAVE_RSA_GET0_KEY], [1],
2846 [Define if libcrypto has RSA_get0_key])])
2847 AC_SEARCH_LIBS([RSA_set0_crt_params], [crypto],
2848 [AC_DEFINE([HAVE_RSA_SET0_CRT_PARAMS], [1],
2849 [Define if libcrypto has RSA_get0_srt_params])])
2850 AC_SEARCH_LIBS([RSA_set0_factors], [crypto],
2851 [AC_DEFINE([HAVE_RSA_SET0_FACTORS], [1],
2852 [Define if libcrypto has RSA_set0_factors])])
2853 AC_SEARCH_LIBS([RSA_set0_key], [crypto],
2854 [AC_DEFINE([HAVE_RSA_SET0_KEY], [1],
2855 [Define if libcrypto has RSA_set0_key])])
2856
2857 AC_SEARCH_LIBS([RSA_meth_free], [crypto],
2858 [AC_DEFINE([HAVE_RSA_METH_FREE], [1],
2859 [Define if libcrypto has RSA_meth_free])])
2860 AC_SEARCH_LIBS([RSA_meth_dup], [crypto],
2861 [AC_DEFINE([HAVE_RSA_METH_DUP], [1],
2862 [Define if libcrypto has RSA_meth_dup])])
2863 AC_SEARCH_LIBS([RSA_meth_set1_name], [crypto],
2864 [AC_DEFINE([HAVE_RSA_METH_SET1_NAME], [1],
2865 [Define if libcrypto has RSA_meth_set1_name])])
2866 AC_SEARCH_LIBS([RSA_meth_get_finish], [crypto],
2867 [AC_DEFINE([HAVE_RSA_METH_GET_FINISH], [1],
2868 [Define if libcrypto has RSA_meth_get_finish])])
2869 AC_SEARCH_LIBS([RSA_meth_set_priv_enc], [crypto],
2870 [AC_DEFINE([HAVE_RSA_METH_SET_PRIV_ENC], [1],
2871 [Define if libcrypto has RSA_meth_set_priv_enc])])
2872 AC_SEARCH_LIBS([RSA_meth_set_priv_dec], [crypto],
2873 [AC_DEFINE([HAVE_RSA_METH_SET_PRIV_DEC], [1],
2874 [Define if libcrypto has RSA_meth_set_priv_dec])])
2875 AC_SEARCH_LIBS([RSA_meth_set_finish], [crypto],
2876 [AC_DEFINE([HAVE_RSA_METH_SET_FINISH], [1],
2877 [Define if libcrypto has RSA_meth_set_finish])])
2878
2879 AC_SEARCH_LIBS([EVP_PKEY_get0_RSA], [crypto],
2880 [AC_DEFINE([HAVE_EVP_PKEY_GET0_RSA], [1],
2881 [Define if libcrypto has EVP_PKEY_get0_RSA])])
2882
2883 AC_SEARCH_LIBS([EVP_MD_CTX_new], [crypto],
2884 [AC_DEFINE([HAVE_EVP_MD_CTX_NEW], [1],
2885 [Define if libcrypto has EVP_MD_CTX_new])])
2886 AC_SEARCH_LIBS([EVP_MD_CTX_free], [crypto],
2887 [AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [1],
2888 [Define if libcrypto has EVP_MD_CTX_free])])
2889
Damien Miller72ef7c12015-01-15 02:21:31 +11002890 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2891 AC_LINK_IFELSE(
2892 [AC_LANG_PROGRAM([[
2893 #include <string.h>
2894 #include <openssl/evp.h>
2895 ]], [[
2896 if(EVP_DigestUpdate(NULL, NULL,0))
2897 exit(0);
2898 ]])],
2899 [
2900 AC_MSG_RESULT([yes])
2901 ],
2902 [
2903 AC_MSG_RESULT([no])
2904 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2905 [Define if EVP_DigestUpdate returns void])
2906 ]
2907 )
2908
2909 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2910 # because the system crypt() is more featureful.
2911 if test "x$check_for_libcrypt_before" = "x1"; then
2912 AC_CHECK_LIB([crypt], [crypt])
2913 fi
2914
2915 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2916 # version in OpenSSL.
2917 if test "x$check_for_libcrypt_later" = "x1"; then
2918 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2919 fi
Damien Miller00797e82015-03-04 05:02:45 +11002920 AC_CHECK_FUNCS([crypt DES_crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002921
2922 # Search for SHA256 support in libc and/or OpenSSL
2923 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2924 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002925 hmac-sha2-256 \
2926 hmac-sha2-512 \
Damien Miller72ef7c12015-01-15 02:21:31 +11002927 diffie-hellman-group-exchange-sha256 \
Damien Miller679ce882016-07-15 13:44:38 +10002928 hmac-sha2-256-etm@openssh.com \
2929 hmac-sha2-512-etm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002930 ]
2931 )
2932 # Search for RIPE-MD support in OpenSSL
2933 AC_CHECK_FUNCS([EVP_ripemd160], ,
2934 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002935 hmac-ripemd160 \
2936 hmac-ripemd160@openssh.com \
Damien Miller72ef7c12015-01-15 02:21:31 +11002937 hmac-ripemd160-etm@openssh.com"
2938 ]
2939 )
2940
2941 # Check complete ECC support in OpenSSL
2942 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2943 AC_LINK_IFELSE(
2944 [AC_LANG_PROGRAM([[
2945 #include <openssl/ec.h>
2946 #include <openssl/ecdh.h>
2947 #include <openssl/ecdsa.h>
2948 #include <openssl/evp.h>
2949 #include <openssl/objects.h>
2950 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002951 ]], [[
2952 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2953 const EVP_MD *m = EVP_sha256(); /* We need this too */
Darren Tucker37bcef52013-11-09 18:39:25 +11002954 ]])],
2955 [ AC_MSG_RESULT([yes])
Damien Miller72ef7c12015-01-15 02:21:31 +11002956 enable_nistp256=1 ],
2957 [ AC_MSG_RESULT([no]) ]
2958 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002959
Damien Miller72ef7c12015-01-15 02:21:31 +11002960 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2961 AC_LINK_IFELSE(
2962 [AC_LANG_PROGRAM([[
2963 #include <openssl/ec.h>
2964 #include <openssl/ecdh.h>
2965 #include <openssl/ecdsa.h>
2966 #include <openssl/evp.h>
2967 #include <openssl/objects.h>
2968 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002969 ]], [[
2970 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2971 const EVP_MD *m = EVP_sha384(); /* We need this too */
2972 ]])],
2973 [ AC_MSG_RESULT([yes])
2974 enable_nistp384=1 ],
2975 [ AC_MSG_RESULT([no]) ]
2976 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002977
Damien Miller72ef7c12015-01-15 02:21:31 +11002978 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2979 AC_LINK_IFELSE(
2980 [AC_LANG_PROGRAM([[
2981 #include <openssl/ec.h>
2982 #include <openssl/ecdh.h>
2983 #include <openssl/ecdsa.h>
2984 #include <openssl/evp.h>
2985 #include <openssl/objects.h>
2986 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002987 ]], [[
2988 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2989 const EVP_MD *m = EVP_sha512(); /* We need this too */
2990 ]])],
2991 [ AC_MSG_RESULT([yes])
2992 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2993 AC_RUN_IFELSE(
2994 [AC_LANG_PROGRAM([[
2995 #include <openssl/ec.h>
2996 #include <openssl/ecdh.h>
2997 #include <openssl/ecdsa.h>
2998 #include <openssl/evp.h>
2999 #include <openssl/objects.h>
3000 #include <openssl/opensslv.h>
3001 ]],[[
3002 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
3003 const EVP_MD *m = EVP_sha512(); /* We need this too */
3004 exit(e == NULL || m == NULL);
3005 ]])],
3006 [ AC_MSG_RESULT([yes])
3007 enable_nistp521=1 ],
3008 [ AC_MSG_RESULT([no]) ],
3009 [ AC_MSG_WARN([cross-compiling: assuming yes])
3010 enable_nistp521=1 ]
3011 )],
3012 AC_MSG_RESULT([no])
3013 )
Darren Tucker37bcef52013-11-09 18:39:25 +11003014
Damien Miller72ef7c12015-01-15 02:21:31 +11003015 COMMENT_OUT_ECC="#no ecc#"
3016 TEST_SSH_ECC=no
3017
3018 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
3019 test x$enable_nistp521 = x1; then
3020 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
3021 fi
3022 if test x$enable_nistp256 = x1; then
3023 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
3024 [libcrypto has NID_X9_62_prime256v1])
3025 TEST_SSH_ECC=yes
3026 COMMENT_OUT_ECC=""
3027 else
Damien Miller679ce882016-07-15 13:44:38 +10003028 unsupported_algorithms="$unsupported_algorithms \
3029 ecdsa-sha2-nistp256 \
3030 ecdh-sha2-nistp256 \
3031 ecdsa-sha2-nistp256-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003032 fi
3033 if test x$enable_nistp384 = x1; then
3034 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
3035 TEST_SSH_ECC=yes
3036 COMMENT_OUT_ECC=""
3037 else
Damien Miller679ce882016-07-15 13:44:38 +10003038 unsupported_algorithms="$unsupported_algorithms \
3039 ecdsa-sha2-nistp384 \
3040 ecdh-sha2-nistp384 \
3041 ecdsa-sha2-nistp384-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003042 fi
3043 if test x$enable_nistp521 = x1; then
3044 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
3045 TEST_SSH_ECC=yes
3046 COMMENT_OUT_ECC=""
3047 else
Damien Miller679ce882016-07-15 13:44:38 +10003048 unsupported_algorithms="$unsupported_algorithms \
3049 ecdh-sha2-nistp521 \
3050 ecdsa-sha2-nistp521 \
3051 ecdsa-sha2-nistp521-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003052 fi
3053
3054 AC_SUBST([TEST_SSH_ECC])
3055 AC_SUBST([COMMENT_OUT_ECC])
3056else
3057 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Miller00797e82015-03-04 05:02:45 +11003058 AC_CHECK_FUNCS([crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11003059fi
Damien Miller6af914a2010-09-10 11:39:26 +10003060
Damien Miller00f9cd22014-07-15 10:41:38 +10003061AC_CHECK_FUNCS([ \
3062 arc4random \
3063 arc4random_buf \
3064 arc4random_stir \
3065 arc4random_uniform \
3066])
3067
Tim Rice99203ec2007-03-26 09:35:28 -07003068saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003069AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07003070 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08003071 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
3072 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Ricee1d93702016-05-31 11:13:22 -07003073 [Define if system has libiaf that supports set_id])
Tim Rice0eeaf122007-09-10 16:24:17 -07003074 ])
Tim Rice99203ec2007-03-26 09:35:28 -07003075])
3076LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11003077
3078### Configure cryptographic random number support
3079
Damien Miller10479cc2018-04-10 10:19:02 +10003080# Check whether OpenSSL seeds itself
Damien Miller72ef7c12015-01-15 02:21:31 +11003081if test "x$openssl" = "xyes" ; then
3082 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
3083 AC_RUN_IFELSE(
3084 [AC_LANG_PROGRAM([[
3085 #include <string.h>
3086 #include <openssl/rand.h>
3087 ]], [[
3088 exit(RAND_status() == 1 ? 0 : 1);
3089 ]])],
3090 [
3091 OPENSSL_SEEDS_ITSELF=yes
3092 AC_MSG_RESULT([yes])
3093 ],
3094 [
3095 AC_MSG_RESULT([no])
3096 ],
3097 [
3098 AC_MSG_WARN([cross compiling: assuming yes])
3099 # This is safe, since we will fatal() at runtime if
3100 # OpenSSL is not seeded correctly.
3101 OPENSSL_SEEDS_ITSELF=yes
3102 ]
3103 )
3104fi
Damien Miller6c21c512002-01-22 21:57:53 +11003105
Damien Millerf22019b2011-05-05 13:48:37 +10003106# PRNGD TCP socket
3107AC_ARG_WITH([prngd-port],
3108 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
3109 [
3110 case "$withval" in
3111 no)
3112 withval=""
3113 ;;
3114 [[0-9]]*)
3115 ;;
3116 *)
3117 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
3118 ;;
3119 esac
3120 if test ! -z "$withval" ; then
3121 PRNGD_PORT="$withval"
3122 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
3123 [Port number of PRNGD/EGD random number socket])
3124 fi
3125 ]
3126)
3127
3128# PRNGD Unix domain socket
3129AC_ARG_WITH([prngd-socket],
3130 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
3131 [
3132 case "$withval" in
3133 yes)
3134 withval="/var/run/egd-pool"
3135 ;;
3136 no)
3137 withval=""
3138 ;;
3139 /*)
3140 ;;
3141 *)
3142 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
3143 ;;
3144 esac
3145
3146 if test ! -z "$withval" ; then
3147 if test ! -z "$PRNGD_PORT" ; then
3148 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
3149 fi
3150 if test ! -r "$withval" ; then
3151 AC_MSG_WARN([Entropy socket is not readable])
3152 fi
3153 PRNGD_SOCKET="$withval"
3154 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
3155 [Location of PRNGD/EGD random number socket])
3156 fi
3157 ],
3158 [
3159 # Check for existing socket only if we don't have a random device already
3160 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
3161 AC_MSG_CHECKING([for PRNGD/EGD socket])
3162 # Insert other locations here
3163 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
3164 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
3165 PRNGD_SOCKET="$sock"
3166 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
3167 break;
3168 fi
3169 done
3170 if test ! -z "$PRNGD_SOCKET" ; then
3171 AC_MSG_RESULT([$PRNGD_SOCKET])
3172 else
3173 AC_MSG_RESULT([not found])
3174 fi
3175 fi
3176 ]
3177)
3178
3179# Which randomness source do we use?
3180if test ! -z "$PRNGD_PORT" ; then
3181 RAND_MSG="PRNGd port $PRNGD_PORT"
3182elif test ! -z "$PRNGD_SOCKET" ; then
3183 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
3184elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
3185 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Damien Miller72ef7c12015-01-15 02:21:31 +11003186 [Define if you want the OpenSSL internally seeded PRNG only])
Damien Millerf22019b2011-05-05 13:48:37 +10003187 RAND_MSG="OpenSSL internal ONLY"
Damien Miller72ef7c12015-01-15 02:21:31 +11003188elif test "x$openssl" = "xno" ; then
3189 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 +10003190else
3191 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])
3192fi
3193
Darren Tucker3e6bde42006-08-20 20:03:50 +10003194# Check for PAM libs
3195PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003196AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003197 [ --with-pam Enable PAM support ],
3198 [
3199 if test "x$withval" != "xno" ; then
3200 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
3201 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
3202 AC_MSG_ERROR([PAM headers not found])
3203 fi
3204
3205 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003206 AC_CHECK_LIB([dl], [dlopen], , )
3207 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
3208 AC_CHECK_FUNCS([pam_getenvlist])
3209 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003210 LIBS="$saved_LIBS"
3211
3212 PAM_MSG="yes"
3213
Darren Tucker20e9f972007-03-25 18:26:01 +10003214 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08003215 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003216 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10003217
Darren Tucker3e6bde42006-08-20 20:03:50 +10003218 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10003219 case "$LIBS" in
3220 *-ldl*)
3221 # libdl already in LIBS
3222 ;;
3223 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10003224 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10003225 ;;
3226 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10003227 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10003228 fi
3229 ]
3230)
3231
Damien Miller8bd81e12016-08-16 13:30:56 +10003232AC_ARG_WITH([pam-service],
3233 [ --with-pam-service=name Specify PAM service name ],
3234 [
3235 if test "x$withval" != "xno" && \
3236 test "x$withval" != "xyes" ; then
3237 AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE],
3238 ["$withval"], [sshd PAM service name])
3239 fi
3240 ]
3241)
3242
Darren Tucker3e6bde42006-08-20 20:03:50 +10003243# Check for older PAM
3244if test "x$PAM_MSG" = "xyes" ; then
3245 # Check PAM strerror arguments (old PAM)
3246 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08003247 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10003248#include <stdlib.h>
3249#if defined(HAVE_SECURITY_PAM_APPL_H)
3250#include <security/pam_appl.h>
3251#elif defined (HAVE_PAM_PAM_APPL_H)
3252#include <pam/pam_appl.h>
3253#endif
Tim Rice648f8762011-01-26 12:38:57 -08003254 ]], [[
3255(void)pam_strerror((pam_handle_t *)NULL, -1);
3256 ]])], [AC_MSG_RESULT([no])], [
3257 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003258 [Define if you have an old version of PAM
3259 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08003260 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003261 PAM_MSG="yes (old library)"
Damien Miller72ef7c12015-01-15 02:21:31 +11003262
Tim Rice648f8762011-01-26 12:38:57 -08003263 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003264fi
Damien Miller6c21c512002-01-22 21:57:53 +11003265
Damien Miller6482d902014-05-27 14:34:42 +10003266case "$host" in
3267*-*-cygwin*)
3268 SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER
3269 ;;
3270*)
3271 SSH_PRIVSEP_USER=sshd
3272 ;;
3273esac
Tim Rice648f8762011-01-26 12:38:57 -08003274AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00003275 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00003276 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003277 if test -n "$withval" && test "x$withval" != "xno" && \
3278 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10003279 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00003280 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08003281 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00003282)
Damien Miller6482d902014-05-27 14:34:42 +10003283if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then
3284 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER],
3285 [Cygwin function to fetch non-privileged user for privilege separation])
3286else
3287 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
3288 [non-privileged user for privilege separation])
3289fi
Tim Rice648f8762011-01-26 12:38:57 -08003290AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00003291
Damien Miller91f40d82013-02-22 11:37:00 +11003292if test "x$have_linux_no_new_privs" = "x1" ; then
3293AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
3294 #include <sys/types.h>
3295 #include <linux/seccomp.h>
3296])
3297fi
3298if test "x$have_seccomp_filter" = "x1" ; then
3299AC_MSG_CHECKING([kernel for seccomp_filter support])
3300AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3301 #include <errno.h>
3302 #include <elf.h>
3303 #include <linux/audit.h>
3304 #include <linux/seccomp.h>
3305 #include <stdlib.h>
3306 #include <sys/prctl.h>
3307 ]],
3308 [[ int i = $seccomp_audit_arch;
3309 errno = 0;
3310 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
3311 exit(errno == EFAULT ? 0 : 1); ]])],
3312 [ AC_MSG_RESULT([yes]) ], [
3313 AC_MSG_RESULT([no])
3314 # Disable seccomp filter as a target
3315 have_seccomp_filter=0
3316 ]
3317)
3318fi
3319
Damien Miller69ff1df2011-06-23 08:30:03 +10003320# Decide which sandbox style to use
3321sandbox_arg=""
3322AC_ARG_WITH([sandbox],
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003323 [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)],
Damien Miller69ff1df2011-06-23 08:30:03 +10003324 [
3325 if test "x$withval" = "xyes" ; then
3326 sandbox_arg=""
3327 else
3328 sandbox_arg="$withval"
3329 fi
3330 ]
3331)
Darren Tucker60395f92012-07-03 14:31:18 +10003332
3333# Some platforms (seems to be the ones that have a kernel poll(2)-type
3334# function with which they implement select(2)) use an extra file descriptor
3335# when calling select(2), which means we can't use the rlimit sandbox.
3336AC_MSG_CHECKING([if select works with descriptor rlimit])
3337AC_RUN_IFELSE(
3338 [AC_LANG_PROGRAM([[
3339#include <sys/types.h>
3340#ifdef HAVE_SYS_TIME_H
3341# include <sys/time.h>
3342#endif
3343#include <sys/resource.h>
3344#ifdef HAVE_SYS_SELECT_H
3345# include <sys/select.h>
3346#endif
3347#include <errno.h>
3348#include <fcntl.h>
3349#include <stdlib.h>
3350 ]],[[
3351 struct rlimit rl_zero;
3352 int fd, r;
3353 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11003354 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10003355
3356 fd = open("/dev/null", O_RDONLY);
3357 FD_ZERO(&fds);
3358 FD_SET(fd, &fds);
3359 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3360 setrlimit(RLIMIT_FSIZE, &rl_zero);
3361 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11003362 tv.tv_sec = 1;
3363 tv.tv_usec = 0;
3364 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10003365 exit (r == -1 ? 1 : 0);
3366 ]])],
3367 [AC_MSG_RESULT([yes])
3368 select_works_with_rlimit=yes],
3369 [AC_MSG_RESULT([no])
3370 select_works_with_rlimit=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003371 [AC_MSG_WARN([cross compiling: assuming yes])
3372 select_works_with_rlimit=yes]
Darren Tucker60395f92012-07-03 14:31:18 +10003373)
3374
Darren Tuckerff008de2013-03-06 17:48:48 +11003375AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
3376AC_RUN_IFELSE(
3377 [AC_LANG_PROGRAM([[
3378#include <sys/types.h>
3379#ifdef HAVE_SYS_TIME_H
3380# include <sys/time.h>
3381#endif
3382#include <sys/resource.h>
3383#include <errno.h>
3384#include <stdlib.h>
3385 ]],[[
3386 struct rlimit rl_zero;
3387 int fd, r;
3388 fd_set fds;
3389
3390 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3391 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
3392 exit (r == -1 ? 1 : 0);
3393 ]])],
3394 [AC_MSG_RESULT([yes])
3395 rlimit_nofile_zero_works=yes],
3396 [AC_MSG_RESULT([no])
3397 rlimit_nofile_zero_works=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003398 [AC_MSG_WARN([cross compiling: assuming yes])
3399 rlimit_nofile_zero_works=yes]
Darren Tuckerff008de2013-03-06 17:48:48 +11003400)
3401
Darren Tuckerd545a4b2012-07-03 22:48:31 +10003402AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
3403AC_RUN_IFELSE(
3404 [AC_LANG_PROGRAM([[
3405#include <sys/types.h>
3406#include <sys/resource.h>
3407#include <stdlib.h>
3408 ]],[[
3409 struct rlimit rl_zero;
3410
3411 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3412 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
3413 ]])],
3414 [AC_MSG_RESULT([yes])],
3415 [AC_MSG_RESULT([no])
3416 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3417 [setrlimit RLIMIT_FSIZE works])],
3418 [AC_MSG_WARN([cross compiling: assuming yes])]
3419)
3420
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003421if test "x$sandbox_arg" = "xpledge" || \
3422 ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then
3423 test "x$ac_cv_func_pledge" != "xyes" && \
3424 AC_MSG_ERROR([pledge sandbox requires pledge(2) support])
3425 SANDBOX_STYLE="pledge"
Damien Millerfafe1d82015-10-14 09:22:15 -07003426 AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)])
Damien Miller9846a2f2015-10-08 04:30:48 +11003427elif test "x$sandbox_arg" = "xsystrace" || \
Damien Miller69ff1df2011-06-23 08:30:03 +10003428 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003429 test "x$have_systr_policy_kill" != "x1" && \
3430 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003431 SANDBOX_STYLE="systrace"
3432 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003433elif test "x$sandbox_arg" = "xdarwin" || \
3434 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3435 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003436 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3437 "x$ac_cv_header_sandbox_h" != "xyes" && \
3438 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003439 SANDBOX_STYLE="darwin"
3440 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003441elif test "x$sandbox_arg" = "xseccomp_filter" || \
3442 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003443 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003444 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003445 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003446 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3447 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003448 test "x$have_linux_no_new_privs" = "x1" && \
3449 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003450 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003451 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3452 test "x$have_linux_no_new_privs" != "x1" && \
3453 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3454 test "x$have_seccomp_filter" != "x1" && \
3455 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3456 test "x$ac_cv_func_prctl" != "xyes" && \
3457 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3458 SANDBOX_STYLE="seccomp_filter"
3459 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003460elif test "x$sandbox_arg" = "xcapsicum" || \
3461 ( test -z "$sandbox_arg" && \
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003462 test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003463 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003464 test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \
3465 AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003466 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003467 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003468 SANDBOX_STYLE="capsicum"
3469 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003470elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003471 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003472 test "x$select_works_with_rlimit" = "xyes" && \
3473 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003474 test "x$ac_cv_func_setrlimit" != "xyes" && \
3475 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003476 test "x$select_works_with_rlimit" != "xyes" && \
3477 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003478 SANDBOX_STYLE="rlimit"
3479 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller4626cba2016-01-08 14:24:56 +11003480elif test "x$sandbox_arg" = "xsolaris" || \
3481 ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then
3482 SANDBOX_STYLE="solaris"
3483 AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges])
Damien Miller69ff1df2011-06-23 08:30:03 +10003484elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3485 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3486 SANDBOX_STYLE="none"
3487 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3488else
Tim Ricea6e60612011-08-17 21:48:22 -07003489 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003490fi
3491
Ben Lindstromb5628642000-10-18 00:02:25 +00003492# Cheap hack to ensure NEWS-OS libraries are arranged right.
3493if test ! -z "$SONY" ; then
3494 LIBS="$LIBS -liberty";
3495fi
3496
Damien Miller57f39152005-11-24 19:58:19 +11003497# Check for long long datatypes
3498AC_CHECK_TYPES([long long, unsigned long long, long double])
3499
3500# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003501AC_CHECK_SIZEOF([short int], [2])
3502AC_CHECK_SIZEOF([int], [4])
3503AC_CHECK_SIZEOF([long int], [4])
3504AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003505
Damien Millerfa2bb692002-04-23 23:22:25 +10003506# Sanity check long long for some platforms (AIX)
3507if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3508 ac_cv_sizeof_long_long_int=0
3509fi
3510
Darren Tucker537f1ed2005-10-25 18:38:33 +10003511# compute LLONG_MIN and LLONG_MAX if we don't know them.
3512if test -z "$have_llong_max"; then
3513 AC_MSG_CHECKING([for max value of long long])
3514 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003515 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003516#include <stdio.h>
3517/* Why is this so damn hard? */
3518#ifdef __GNUC__
3519# undef __GNUC__
3520#endif
3521#define __USE_ISOC99
3522#include <limits.h>
3523#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003524#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3525
3526/*
3527 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3528 * we do this the hard way.
3529 */
3530static int
3531fprint_ll(FILE *f, long long n)
3532{
3533 unsigned int i;
3534 int l[sizeof(long long) * 8];
3535
3536 if (n < 0)
3537 if (fprintf(f, "-") < 0)
3538 return -1;
3539 for (i = 0; n != 0; i++) {
3540 l[i] = my_abs(n % 10);
3541 n /= 10;
3542 }
3543 do {
3544 if (fprintf(f, "%d", l[--i]) < 0)
3545 return -1;
3546 } while (i != 0);
3547 if (fprintf(f, " ") < 0)
3548 return -1;
3549 return 0;
3550}
Tim Rice648f8762011-01-26 12:38:57 -08003551 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003552 FILE *f;
3553 long long i, llmin, llmax = 0;
3554
3555 if((f = fopen(DATA,"w")) == NULL)
3556 exit(1);
3557
3558#if defined(LLONG_MIN) && defined(LLONG_MAX)
3559 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3560 llmin = LLONG_MIN;
3561 llmax = LLONG_MAX;
3562#else
3563 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3564 /* This will work on one's complement and two's complement */
3565 for (i = 1; i > llmax; i <<= 1, i++)
3566 llmax = i;
3567 llmin = llmax + 1LL; /* wrap */
3568#endif
3569
3570 /* Sanity check */
3571 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003572 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3573 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003574 fprintf(f, "unknown unknown\n");
3575 exit(2);
3576 }
3577
Darren Tuckerd1450db2006-03-13 19:06:51 +11003578 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003579 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003580 if (fprint_ll(f, llmax) < 0)
3581 exit(4);
3582 if (fclose(f) < 0)
3583 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003584 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003585 ]])],
3586 [
3587 llong_min=`$AWK '{print $1}' conftest.llminmax`
3588 llong_max=`$AWK '{print $2}' conftest.llminmax`
3589
Tim Rice648f8762011-01-26 12:38:57 -08003590 AC_MSG_RESULT([$llong_max])
3591 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003592 [max value of long long calculated by configure])
3593 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003594 AC_MSG_RESULT([$llong_min])
3595 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003596 [min value of long long calculated by configure])
3597 ],
3598 [
Tim Rice648f8762011-01-26 12:38:57 -08003599 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003600 ],
3601 [
3602 AC_MSG_WARN([cross compiling: not checking])
3603 ]
3604 )
3605fi
3606
3607
Damien Millera22ba012000-03-02 23:09:20 +11003608# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003609AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3611 [[ u_int a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003612 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
Tim Rice648f8762011-01-26 12:38:57 -08003613 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003614])
3615if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003616 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003617 have_u_int=1
3618fi
3619
Damien Miller61e50f12000-05-08 20:49:37 +10003620AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003621 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3622 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003623 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003624 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003625])
3626if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003627 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003628 have_intxx_t=1
3629fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003630
3631if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003632 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003633then
3634 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3636 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003637 [
Tim Rice648f8762011-01-26 12:38:57 -08003638 AC_DEFINE([HAVE_INTXX_T])
3639 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003640 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003641 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003642fi
3643
Damien Miller578783e2000-09-23 14:12:24 +11003644AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003646#include <sys/types.h>
3647#ifdef HAVE_STDINT_H
3648# include <stdint.h>
3649#endif
3650#include <sys/socket.h>
3651#ifdef HAVE_SYS_BITYPES_H
3652# include <sys/bitypes.h>
3653#endif
Tim Rice648f8762011-01-26 12:38:57 -08003654 ]], [[
3655int64_t a; a = 1;
3656 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003657 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003658 ])
Damien Miller578783e2000-09-23 14:12:24 +11003659])
3660if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003661 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003662fi
3663
Damien Miller61e50f12000-05-08 20:49:37 +10003664AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003665 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3666 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003667 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003668 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003669])
3670if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003671 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003672 have_u_intxx_t=1
3673fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003674
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003675if test -z "$have_u_intxx_t" ; then
3676 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003677 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3678 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003679 [
Tim Rice648f8762011-01-26 12:38:57 -08003680 AC_DEFINE([HAVE_U_INTXX_T])
3681 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003682 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003683 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003684fi
3685
Damien Miller578783e2000-09-23 14:12:24 +11003686AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003687 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3688 [[ u_int64_t a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003689 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003690 ])
Damien Miller578783e2000-09-23 14:12:24 +11003691])
3692if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003693 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003694 have_u_int64_t=1
3695fi
3696
Damien Millerc2868192014-01-30 10:21:19 +11003697if (test -z "$have_u_int64_t" && \
3698 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3699then
Tim Rice4cec93f2002-02-26 08:40:48 -08003700 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3702 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003703 [
Tim Rice648f8762011-01-26 12:38:57 -08003704 AC_DEFINE([HAVE_U_INT64_T])
3705 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003706 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003707 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003708fi
3709
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003710if test -z "$have_u_intxx_t" ; then
3711 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003712 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003713#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003714 ]], [[
3715 uint8_t a;
3716 uint16_t b;
3717 uint32_t c;
3718 a = b = c = 1;
3719 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003720 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003721 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003722 ])
3723 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003724 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003725 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003726 fi
3727fi
3728
Damien Millerc2868192014-01-30 10:21:19 +11003729if (test -z "$have_uintxx_t" && \
3730 test "x$ac_cv_header_stdint_h" = "xyes")
3731then
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003732 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003733 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3734 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003735 [
Tim Rice648f8762011-01-26 12:38:57 -08003736 AC_DEFINE([HAVE_UINTXX_T])
3737 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003738 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003739 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003740fi
3741
Damien Millerc2868192014-01-30 10:21:19 +11003742if (test -z "$have_uintxx_t" && \
3743 test "x$ac_cv_header_inttypes_h" = "xyes")
3744then
Darren Tucker6d725682014-01-17 19:17:34 +11003745 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3747 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3748 [
3749 AC_DEFINE([HAVE_UINTXX_T])
3750 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003751 ], [ AC_MSG_RESULT([no])
Darren Tucker6d725682014-01-17 19:17:34 +11003752 ])
3753fi
3754
Damien Milleredb82922000-06-20 13:25:52 +10003755if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003756 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003757then
3758 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003759 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003760#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003761 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003762 int8_t a; int16_t b; int32_t c;
3763 u_int8_t e; u_int16_t f; u_int32_t g;
3764 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003765 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003766 [
Tim Rice648f8762011-01-26 12:38:57 -08003767 AC_DEFINE([HAVE_U_INTXX_T])
3768 AC_DEFINE([HAVE_INTXX_T])
3769 AC_MSG_RESULT([yes])
3770 ], [AC_MSG_RESULT([no])
3771 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003772fi
3773
Damien Miller58be7382001-09-15 21:31:54 +10003774
3775AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003776 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3777 [[ u_char foo; foo = 125; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003778 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
Tim Rice648f8762011-01-26 12:38:57 -08003779 ])
Damien Miller58be7382001-09-15 21:31:54 +10003780])
3781if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003782 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003783fi
3784
Darren Tucker007e3b32013-11-03 18:43:55 +11003785AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3786#include <sys/types.h>
3787#include <stdint.h>
3788])
3789
Tim Rice13aae5e2001-10-21 17:53:58 -07003790TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003791
Tim Rice648f8762011-01-26 12:38:57 -08003792AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3793AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003794#include <sys/types.h>
3795#ifdef HAVE_SYS_BITYPES_H
3796#include <sys/bitypes.h>
3797#endif
3798#ifdef HAVE_SYS_STATFS_H
3799#include <sys/statfs.h>
3800#endif
3801#ifdef HAVE_SYS_STATVFS_H
3802#include <sys/statvfs.h>
3803#endif
3804])
Tim Rice4cec93f2002-02-26 08:40:48 -08003805
Darren Tucker11057562018-02-25 11:22:57 +11003806AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
3807#include <sys/types.h>
3808#ifdef HAVE_SYS_BITYPES_H
3809#include <sys/bitypes.h>
3810#endif
3811#ifdef HAVE_SYS_STATFS_H
3812#include <sys/statfs.h>
3813#endif
3814#ifdef HAVE_SYS_STATVFS_H
3815#include <sys/statvfs.h>
3816#endif
3817#ifdef HAVE_SYS_VFS_H
3818#include <sys/vfs.h>
3819#endif
3820]])
3821
3822
Tim Rice648f8762011-01-26 12:38:57 -08003823AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003824[#include <sys/types.h>
3825#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003826
Damien Miller61e50f12000-05-08 20:49:37 +10003827AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003828 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3829 [[ size_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003830 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003831 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003832])
3833if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003834 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003835fi
Damien Miller95058511999-12-29 10:36:45 +11003836
Damien Miller615f9392000-05-17 22:53:33 +10003837AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003838 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3839 [[ ssize_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003840 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003841 ])
Damien Miller615f9392000-05-17 22:53:33 +10003842])
3843if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003844 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003845fi
3846
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003847AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003848 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3849 [[ clock_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003850 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003851 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003852])
3853if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003854 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003855fi
3856
Damien Millerb54b40e2000-06-23 08:23:34 +10003857AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003858 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003859#include <sys/types.h>
3860#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003861 ]], [[ sa_family_t foo; foo = 1235; ]])],
3862 [ ac_cv_have_sa_family_t="yes" ],
3863 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003864#include <sys/types.h>
3865#include <sys/socket.h>
3866#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003867 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003868 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003869 [ ac_cv_have_sa_family_t="no" ]
3870 )
Tim Rice648f8762011-01-26 12:38:57 -08003871 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003872])
3873if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003874 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003875 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003876fi
3877
Damien Miller0f91b4e2000-06-18 15:43:25 +10003878AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003879 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3880 [[ pid_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003881 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003882 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003883])
3884if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003885 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003886fi
3887
3888AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003889 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3890 [[ mode_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003891 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003892 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003893])
3894if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003895 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003896fi
3897
Damien Miller61e50f12000-05-08 20:49:37 +10003898
3899AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003900 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003901#include <sys/types.h>
3902#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003903 ]], [[ struct sockaddr_storage s; ]])],
3904 [ ac_cv_have_struct_sockaddr_storage="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003905 [ ac_cv_have_struct_sockaddr_storage="no"
Tim Rice648f8762011-01-26 12:38:57 -08003906 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003907])
3908if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003909 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003910 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003911fi
Damien Miller34132e52000-01-14 15:45:46 +11003912
Damien Miller61e50f12000-05-08 20:49:37 +10003913AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003914 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003915#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003916#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003917 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3918 [ ac_cv_have_struct_sockaddr_in6="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003919 [ ac_cv_have_struct_sockaddr_in6="no"
Tim Rice648f8762011-01-26 12:38:57 -08003920 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003921])
3922if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003923 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003924 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003925fi
Damien Miller34132e52000-01-14 15:45:46 +11003926
Damien Miller61e50f12000-05-08 20:49:37 +10003927AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003928 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003929#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003930#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003931 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3932 [ ac_cv_have_struct_in6_addr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003933 [ ac_cv_have_struct_in6_addr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003934 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003935])
3936if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003937 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003938 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003939
3940dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003941 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003942 [
3943#ifdef HAVE_SYS_TYPES_H
3944#include <sys/types.h>
3945#endif
3946#include <netinet/in.h>
3947 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003948fi
Damien Miller34132e52000-01-14 15:45:46 +11003949
Damien Miller61e50f12000-05-08 20:49:37 +10003950AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003951 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003952#include <sys/types.h>
3953#include <sys/socket.h>
3954#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003955 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3956 [ ac_cv_have_struct_addrinfo="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003957 [ ac_cv_have_struct_addrinfo="no"
Tim Rice648f8762011-01-26 12:38:57 -08003958 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003959])
3960if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003961 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003962 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003963fi
3964
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003965AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003966 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3967 [[ struct timeval tv; tv.tv_sec = 1;]])],
3968 [ ac_cv_have_struct_timeval="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003969 [ ac_cv_have_struct_timeval="no"
Tim Rice648f8762011-01-26 12:38:57 -08003970 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003971])
3972if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003973 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003974 have_struct_timeval=1
3975fi
3976
Tim Rice648f8762011-01-26 12:38:57 -08003977AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003978
Damien Miller10479cc2018-04-10 10:19:02 +10003979# We need int64_t or else certain parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003980if test "x$ac_cv_have_int64_t" = "xno" && \
3981 test "x$ac_cv_sizeof_long_int" != "x8" && \
3982 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003983 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3984 echo "an alternative compiler (I.E., GCC) before continuing."
3985 echo ""
3986 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003987else
3988dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003989 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003990 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003991#include <stdio.h>
3992#include <string.h>
3993#ifdef HAVE_SNPRINTF
3994main()
3995{
3996 char buf[50];
3997 char expected_out[50];
3998 int mazsize = 50 ;
3999#if (SIZEOF_LONG_INT == 8)
4000 long int num = 0x7fffffffffffffff;
4001#else
Kevin Steves6482ec82001-07-15 02:09:28 +00004002 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08004003#endif
4004 strcpy(expected_out, "9223372036854775807");
4005 snprintf(buf, mazsize, "%lld", num);
4006 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11004007 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08004008 exit(0);
4009}
4010#else
4011main() { exit(0); }
4012#endif
Tim Rice648f8762011-01-26 12:38:57 -08004013 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004014 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08004015 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004016fi
4017
Damien Miller78315eb2000-09-29 23:01:36 +11004018dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08004019OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
4020OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
4021OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
4022OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
4023OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
4024OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
4025OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
4026OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
4027OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
4028OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
4029OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
4030OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
4031OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
4032OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
4033OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
4034OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
4035OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07004036
4037AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Millerbcd14852017-06-10 23:41:25 +10004038AC_CHECK_MEMBERS([struct stat.st_mtim])
4039AC_CHECK_MEMBERS([struct stat.st_mtime])
Damien Miller6332da22013-04-23 14:25:52 +10004040AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
4041struct passwd.pw_change, struct passwd.pw_expire],
4042[], [], [[
4043#include <sys/types.h>
4044#include <pwd.h>
4045]])
4046
Tim Rice648f8762011-01-26 12:38:57 -08004047AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11004048 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10004049[[
Darren Tucker58e298d2005-11-25 13:14:58 +11004050#include <stdio.h>
4051#if HAVE_SYS_TYPES_H
4052# include <sys/types.h>
4053#endif
4054#include <netinet/in.h>
4055#include <arpa/nameser.h>
4056#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10004057]])
andre2ff7b5d2000-06-03 14:57:40 +00004058
Damien Miller61e50f12000-05-08 20:49:37 +10004059AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
4060 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004061 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004062#include <sys/types.h>
4063#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004064 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
4065 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
4066 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10004067])
4068if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004069 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004070fi
4071
Damien Miller61e50f12000-05-08 20:49:37 +10004072AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
4073 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004074 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004075#include <sys/types.h>
4076#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004077 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
4078 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004079 [ ac_cv_have___ss_family_in_struct_ss="no"
Tim Rice648f8762011-01-26 12:38:57 -08004080 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004081])
4082if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004083 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004084 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004085fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11004086
Tim Rice28bbb0c2002-05-27 17:37:32 -07004087dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00004088AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
4089 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004090 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004091#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00004092#include <sys/socket.h>
4093#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004094 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004095#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10004096#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004097exit(1);
4098#endif
4099struct msghdr m;
4100m.msg_accrights = 0;
4101exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004102 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00004103 [ ac_cv_have_accrights_in_msghdr="yes" ],
4104 [ ac_cv_have_accrights_in_msghdr="no" ]
4105 )
4106])
4107if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004108 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004109 [Define if your system uses access rights style
4110 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00004111fi
4112
Tim Rice648f8762011-01-26 12:38:57 -08004113AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
4114AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10004115#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10004116#include <sys/stat.h>
4117#ifdef HAVE_SYS_TIME_H
4118# include <sys/time.h>
4119#endif
4120#ifdef HAVE_SYS_MOUNT_H
4121#include <sys/mount.h>
4122#endif
4123#ifdef HAVE_SYS_STATVFS_H
4124#include <sys/statvfs.h>
4125#endif
Tim Rice648f8762011-01-26 12:38:57 -08004126 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
4127 [ AC_MSG_RESULT([yes]) ],
4128 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10004129
Tim Rice648f8762011-01-26 12:38:57 -08004130 AC_MSG_CHECKING([if fsid_t has member val])
4131 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004132#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004133#include <sys/statvfs.h>
4134 ]], [[ fsid_t t; t.val[0] = 0; ]])],
4135 [ AC_MSG_RESULT([yes])
4136 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
4137 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004138
Tim Rice648f8762011-01-26 12:38:57 -08004139 AC_MSG_CHECKING([if f_fsid has member __val])
4140 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004141#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004142#include <sys/statvfs.h>
4143 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
4144 [ AC_MSG_RESULT([yes])
4145 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
4146 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004147])
Darren Tucker77001382008-06-09 06:17:53 +10004148
Kevin Stevesa44e0352002-04-07 16:18:03 +00004149AC_CACHE_CHECK([for msg_control field in struct msghdr],
4150 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004151 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004152#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00004153#include <sys/socket.h>
4154#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004155 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004156#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10004157#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004158exit(1);
4159#endif
4160struct msghdr m;
4161m.msg_control = 0;
4162exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004163 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00004164 [ ac_cv_have_control_in_msghdr="yes" ],
4165 [ ac_cv_have_control_in_msghdr="no" ]
4166 )
4167])
4168if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004169 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004170 [Define if your system uses ancillary data style
4171 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00004172fi
4173
Damien Miller61e50f12000-05-08 20:49:37 +10004174AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08004175 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4176 [[ extern char *__progname; printf("%s", __progname); ]])],
4177 [ ac_cv_libc_defines___progname="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004178 [ ac_cv_libc_defines___progname="no"
Tim Rice648f8762011-01-26 12:38:57 -08004179 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004180])
4181if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004182 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10004183fi
4184
Kevin Steves4846f4a2002-03-22 18:19:53 +00004185AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08004186 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4187 [[ printf("%s", __FUNCTION__); ]])],
4188 [ ac_cv_cc_implements___FUNCTION__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004189 [ ac_cv_cc_implements___FUNCTION__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004190 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004191])
4192if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004193 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004194 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004195fi
4196
4197AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08004198 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4199 [[ printf("%s", __func__); ]])],
4200 [ ac_cv_cc_implements___func__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004201 [ ac_cv_cc_implements___func__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004202 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004203])
4204if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004205 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004206fi
4207
Damien Miller57f39152005-11-24 19:58:19 +11004208AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004209 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4210#include <stdarg.h>
4211va_list x,y;
4212 ]], [[ va_copy(x,y); ]])],
4213 [ ac_cv_have_va_copy="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004214 [ ac_cv_have_va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004215 ])
Damien Miller57f39152005-11-24 19:58:19 +11004216])
4217if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004218 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004219fi
4220
4221AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004222 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4223#include <stdarg.h>
4224va_list x,y;
4225 ]], [[ __va_copy(x,y); ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07004226 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004227 ])
Damien Miller57f39152005-11-24 19:58:19 +11004228])
4229if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004230 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004231fi
4232
Damien Miller4f8e6692001-07-14 13:22:53 +10004233AC_CACHE_CHECK([whether getopt has optreset support],
4234 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08004235 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
4236 [[ extern int optreset; optreset = 0; ]])],
4237 [ ac_cv_have_getopt_optreset="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004238 [ ac_cv_have_getopt_optreset="no"
Tim Rice648f8762011-01-26 12:38:57 -08004239 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10004240])
4241if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004242 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004243 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10004244fi
Damien Millera22ba012000-03-02 23:09:20 +11004245
Damien Millerecbb26d2000-07-15 14:59:14 +10004246AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08004247 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4248[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
4249 [ ac_cv_libc_defines_sys_errlist="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004250 [ ac_cv_libc_defines_sys_errlist="no"
Tim Rice648f8762011-01-26 12:38:57 -08004251 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10004252])
4253if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004254 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004255 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10004256fi
4257
4258
Damien Miller11fa2cc2000-08-16 10:35:58 +10004259AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08004260 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4261[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
4262 [ ac_cv_libc_defines_sys_nerr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004263 [ ac_cv_libc_defines_sys_nerr="no"
Tim Rice648f8762011-01-26 12:38:57 -08004264 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004265])
4266if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004267 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004268fi
4269
Darren Tucker5f88d342003-10-15 16:57:57 +10004270# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08004271AC_SEARCH_LIBS([getrrsetbyname], [resolv],
4272 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004273 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10004274 [
Darren Tucker5f88d342003-10-15 16:57:57 +10004275 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08004276 AC_SEARCH_LIBS([res_query], [resolv])
4277 AC_SEARCH_LIBS([dn_expand], [resolv])
4278 AC_MSG_CHECKING([if res_query will link])
4279 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004280#include <sys/types.h>
4281#include <netinet/in.h>
4282#include <arpa/nameser.h>
4283#include <netdb.h>
4284#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004285 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004286 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004287 ]])],
4288 AC_MSG_RESULT([yes]),
4289 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10004290 saved_LIBS="$LIBS"
4291 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08004292 AC_MSG_CHECKING([for res_query in -lresolv])
4293 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004294#include <sys/types.h>
4295#include <netinet/in.h>
4296#include <arpa/nameser.h>
4297#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10004298#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004299 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10004300 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004301 ]])],
4302 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10004303 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004304 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10004305 ])
Tim Rice648f8762011-01-26 12:38:57 -08004306 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10004307 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07004308 [#include <sys/types.h>
4309 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08004310 AC_CHECK_MEMBER([HEADER.ad],
4311 [AC_DEFINE([HAVE_HEADER_AD], [1],
4312 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10004313 [#include <arpa/nameser.h>])
4314 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10004315
Tim Rice648f8762011-01-26 12:38:57 -08004316AC_MSG_CHECKING([if struct __res_state _res is an extern])
4317AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004318#include <stdio.h>
4319#if HAVE_SYS_TYPES_H
4320# include <sys/types.h>
4321#endif
4322#include <netinet/in.h>
4323#include <arpa/nameser.h>
4324#include <resolv.h>
4325extern struct __res_state _res;
Darren Tucker7ad8b282015-09-11 13:11:02 +10004326 ]], [[
4327struct __res_state *volatile p = &_res; /* force resolution of _res */
4328return 0;
4329 ]],)],
Tim Rice648f8762011-01-26 12:38:57 -08004330 [AC_MSG_RESULT([yes])
4331 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004332 [Define if you have struct __res_state _res as an extern])
4333 ],
Tim Rice648f8762011-01-26 12:38:57 -08004334 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004335)
4336
Damien Miller73b42d22006-04-22 21:26:08 +10004337# Check whether user wants SELinux support
4338SELINUX_MSG="no"
4339LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08004340AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11004341 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10004342 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10004343 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004344 AC_DEFINE([WITH_SELINUX], [1],
4345 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10004346 SELINUX_MSG="yes"
4347 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08004348 AC_MSG_ERROR([SELinux support requires selinux.h header]))
4349 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11004350 [ LIBSELINUX="-lselinux"
4351 LIBS="$LIBS -lselinux"
4352 ],
Tim Rice648f8762011-01-26 12:38:57 -08004353 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11004354 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10004355 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08004356 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10004357 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10004358 fi ]
4359)
Tim Rice648f8762011-01-26 12:38:57 -08004360AC_SUBST([SSHLIBS])
4361AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10004362
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004363# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11004364KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004365AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11004366 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11004367 [ if test "x$withval" != "xno" ; then
4368 if test "x$withval" = "xyes" ; then
4369 KRB5ROOT="/usr/local"
4370 else
4371 KRB5ROOT=${withval}
4372 fi
4373
Tim Rice648f8762011-01-26 12:38:57 -08004374 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004375 KRB5_MSG="yes"
4376
Darren Tucker4089fc12016-12-08 12:57:24 +11004377 AC_PATH_TOOL([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10004378 [$KRB5ROOT/bin/krb5-config],
4379 [$KRB5ROOT/bin:$PATH])
4380 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11004381 K5CFLAGS="`$KRB5CONF --cflags`"
4382 K5LIBS="`$KRB5CONF --libs`"
4383 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004384
Tim Rice648f8762011-01-26 12:38:57 -08004385 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004386 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08004387 AC_MSG_RESULT([yes])
4388 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004389 [Define this if you want GSSAPI
4390 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11004391 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
4392 GSSLIBS="`$KRB5CONF --libs gssapi`"
4393 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11004394 else
Tim Rice648f8762011-01-26 12:38:57 -08004395 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004396 fi
Tim Rice648f8762011-01-26 12:38:57 -08004397 AC_MSG_CHECKING([whether we are using Heimdal])
4398 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4399 ]], [[ char *tmp = heimdal_version; ]])],
4400 [ AC_MSG_RESULT([yes])
4401 AC_DEFINE([HEIMDAL], [1],
4402 [Define this if you are using the Heimdal
4403 version of Kerberos V5]) ],
4404 [AC_MSG_RESULT([no])
4405 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004406 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004407 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11004408 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08004409 AC_MSG_CHECKING([whether we are using Heimdal])
4410 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4411 ]], [[ char *tmp = heimdal_version; ]])],
4412 [ AC_MSG_RESULT([yes])
4413 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11004414 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10004415 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08004416 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10004417 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08004418 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11004419 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08004420 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004421 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08004422 ])
4423 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004424
Tim Rice648f8762011-01-26 12:38:57 -08004425 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
4426 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004427 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08004428 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
4429 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004430 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11004431 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
4432 [ AC_DEFINE([GSSAPI])
4433 GSSLIBS="-lgss" ],
4434 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
4435 ])
Darren Tucker964de182013-02-22 10:39:59 +11004436 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08004437
Tim Rice648f8762011-01-26 12:38:57 -08004438 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004439 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11004440 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004441 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004442 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11004443 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004444 ]
4445 )
4446
4447 oldCPP="$CPPFLAGS"
4448 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004449 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004450 [ CPPFLAGS="$oldCPP" ])
4451
Damien Millera8e06ce2003-11-21 23:48:55 +11004452 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11004453 if test ! -z "$need_dash_r" ; then
4454 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
4455 fi
4456 if test ! -z "$blibpath" ; then
4457 blibpath="$blibpath:${KRB5ROOT}/lib"
4458 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004459
Tim Rice648f8762011-01-26 12:38:57 -08004460 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4461 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4462 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004463
Tim Rice648f8762011-01-26 12:38:57 -08004464 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4465 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004466
4467 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4468#ifdef HAVE_GSSAPI_H
4469# include <gssapi.h>
4470#elif defined(HAVE_GSSAPI_GSSAPI_H)
4471# include <gssapi/gssapi.h>
4472#endif
4473
4474#ifdef HAVE_GSSAPI_GENERIC_H
4475# include <gssapi_generic.h>
4476#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4477# include <gssapi/gssapi_generic.h>
4478#endif
4479 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004480 saved_LIBS="$LIBS"
4481 LIBS="$LIBS $K5LIBS"
4482 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4483 LIBS="$saved_LIBS"
4484
Darren Tucker0d27ed12004-02-24 10:37:33 +11004485 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004486 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004487)
Darren Tucker964de182013-02-22 10:39:59 +11004488AC_SUBST([GSSLIBS])
4489AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004490
Damien Millera22ba012000-03-02 23:09:20 +11004491# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004492
Damien Millerf58c6722002-05-13 13:15:42 +10004493PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004494AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004495 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004496 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004497 if test -n "$withval" && test "x$withval" != "xno" && \
4498 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004499 PRIVSEP_PATH=$withval
4500 fi
4501 ]
4502)
Tim Rice648f8762011-01-26 12:38:57 -08004503AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004504
Tim Rice648f8762011-01-26 12:38:57 -08004505AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004506 [ --with-xauth=PATH Specify path to xauth program ],
4507 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004508 if test -n "$withval" && test "x$withval" != "xno" && \
4509 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004510 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004511 fi
4512 ],
4513 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004514 TestPath="$PATH"
4515 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4516 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4517 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4518 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004519 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004520 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004521 xauth_path="/usr/openwin/bin/xauth"
4522 fi
4523 ]
4524)
4525
Damien Miller7d901272003-01-13 16:55:22 +11004526STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004527AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004528 [ --disable-strip Disable calling strip(1) on install],
4529 [
4530 if test "x$enableval" = "xno" ; then
4531 STRIP_OPT=
4532 fi
4533 ]
4534)
Tim Rice648f8762011-01-26 12:38:57 -08004535AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004536
Damien Millera19cf472000-11-29 13:28:50 +11004537if test -z "$xauth_path" ; then
4538 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004539 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004540else
Tim Rice648f8762011-01-26 12:38:57 -08004541 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004542 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004543 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004544 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004545fi
Damien Millera22ba012000-03-02 23:09:20 +11004546
Tim Rice90f42b02011-06-02 18:17:49 -07004547dnl # --with-maildir=/path/to/mail gets top priority.
4548dnl # if maildir is set in the platform case statement above we use that.
4549dnl # Otherwise we run a program to get the dir from system headers.
4550dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4551dnl # If we find _PATH_MAILDIR we do nothing because that is what
4552dnl # session.c expects anyway. Otherwise we set to the value found
4553dnl # stripping any trailing slash. If for some strage reason our program
4554dnl # does not find what it needs, we default to /var/spool/mail.
4555# Check for mail directory
4556AC_ARG_WITH([maildir],
4557 [ --with-maildir=/path/to/mail Specify your system mail directory],
4558 [
4559 if test "X$withval" != X && test "x$withval" != xno && \
4560 test "x${withval}" != xyes; then
4561 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4562 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4563 fi
4564 ],[
4565 if test "X$maildir" != "X"; then
4566 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4567 else
4568 AC_MSG_CHECKING([Discovering system mail directory])
4569 AC_RUN_IFELSE(
4570 [AC_LANG_PROGRAM([[
4571#include <stdio.h>
4572#include <string.h>
4573#ifdef HAVE_PATHS_H
4574#include <paths.h>
4575#endif
4576#ifdef HAVE_MAILLOCK_H
4577#include <maillock.h>
4578#endif
4579#define DATA "conftest.maildir"
4580 ]], [[
4581 FILE *fd;
4582 int rc;
4583
4584 fd = fopen(DATA,"w");
4585 if(fd == NULL)
4586 exit(1);
4587
4588#if defined (_PATH_MAILDIR)
4589 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4590 exit(1);
4591#elif defined (MAILDIR)
4592 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4593 exit(1);
4594#elif defined (_PATH_MAIL)
4595 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4596 exit(1);
4597#else
4598 exit (2);
4599#endif
4600
4601 exit(0);
4602 ]])],
4603 [
Tim Ricee1d93702016-05-31 11:13:22 -07004604 maildir_what=`awk -F: '{print $1}' conftest.maildir`
Tim Rice90f42b02011-06-02 18:17:49 -07004605 maildir=`awk -F: '{print $2}' conftest.maildir \
4606 | sed 's|/$||'`
4607 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4608 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4609 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4610 fi
4611 ],
4612 [
4613 if test "X$ac_status" = "X2";then
4614# our test program didn't find it. Default to /var/spool/mail
4615 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4616 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4617 else
4618 AC_MSG_RESULT([*** not found ***])
4619 fi
4620 ],
4621 [
4622 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4623 ]
4624 )
4625 fi
4626 ]
4627) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004628
Darren Tucker623d92f2004-09-12 22:36:15 +10004629if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004630 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4631 disable_ptmx_check=yes
4632fi
Damien Millera22ba012000-03-02 23:09:20 +11004633if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004634 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004635 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004636 [
Tim Rice648f8762011-01-26 12:38:57 -08004637 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004638 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004639 have_dev_ptmx=1
4640 ]
4641 )
4642 fi
Damien Millera22ba012000-03-02 23:09:20 +11004643fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004644
Darren Tucker623d92f2004-09-12 22:36:15 +10004645if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004646 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004647 [
Tim Rice648f8762011-01-26 12:38:57 -08004648 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004649 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004650 have_dev_ptc=1
4651 ]
4652 )
4653else
4654 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4655fi
Damien Miller204ad072000-03-02 23:56:12 +11004656
Damien Millera22ba012000-03-02 23:09:20 +11004657# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004658AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004659 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004660 [
Damien Miller897741e2001-04-16 10:41:46 +10004661 case "$withval" in
4662 man|cat|doc)
4663 MANTYPE=$withval
4664 ;;
4665 *)
Tim Rice648f8762011-01-26 12:38:57 -08004666 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004667 ;;
4668 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004669 ]
4670)
Ben Lindstrombc709922001-04-18 18:04:21 +00004671if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004672 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004673 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004674 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4675 MANTYPE=doc
4676 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4677 MANTYPE=man
4678 else
4679 MANTYPE=cat
4680 fi
4681fi
Tim Rice648f8762011-01-26 12:38:57 -08004682AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004683if test "$MANTYPE" = "doc"; then
4684 mansubdir=man;
4685else
4686 mansubdir=$MANTYPE;
4687fi
Tim Rice648f8762011-01-26 12:38:57 -08004688AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004689
Damien Millera22ba012000-03-02 23:09:20 +11004690# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004691MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004692AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004693 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004694 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004695 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004696 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004697 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004698 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004699 fi
4700 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004701)
4702
Damien Millera22ba012000-03-02 23:09:20 +11004703# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004704AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004705 [ --without-shadow Disable shadow password support],
4706 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004707 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004708 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004709 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004710 fi
4711 ]
4712)
4713
Damien Miller1f335fb2000-06-26 11:31:33 +10004714if test -z "$disable_shadow" ; then
4715 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004716 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004717#include <sys/types.h>
4718#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004719struct spwd sp;
4720 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4721 [ sp_expire_available=yes ], [
4722 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004723
4724 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004725 AC_MSG_RESULT([yes])
4726 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004727 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004728 else
Tim Rice648f8762011-01-26 12:38:57 -08004729 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004730 fi
4731fi
4732
Damien Millera22ba012000-03-02 23:09:20 +11004733# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004734if test ! -z "$IPADDR_IN_DISPLAY" ; then
4735 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004736 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004737 [Define if you need to use IP address
4738 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004739else
Damien Millera8e06ce2003-11-21 23:48:55 +11004740 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004741 AC_ARG_WITH([ipaddr-display],
Tim Rice6397eed2015-06-03 21:41:11 -07004742 [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY],
Damien Miller9a947342000-08-30 10:03:33 +11004743 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004744 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004745 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004746 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004747 fi
4748 ]
4749 )
4750fi
Damien Miller76112de1999-12-21 11:18:08 +11004751
Darren Tuckere1a790d2003-09-16 11:52:19 +10004752# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004753AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004754 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004755 [ if test "x$enableval" = "xno"; then
4756 AC_MSG_NOTICE([/etc/default/login handling disabled])
4757 etc_default_login=no
4758 else
4759 etc_default_login=yes
4760 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004761 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4762 then
4763 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4764 etc_default_login=no
4765 else
4766 etc_default_login=yes
4767 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004768)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004769
Darren Tucker2f9573d2005-02-10 22:28:54 +11004770if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004771 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004772 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004773 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004774 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004775 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004776 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004777fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004778
Tim Rice43a1c132002-04-17 21:19:14 -07004779dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004780if test $ac_cv_func_login_getcapbool = "yes" && \
4781 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004782 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004783fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004784
Damien Millera22ba012000-03-02 23:09:20 +11004785# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004786SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004787AC_ARG_WITH([default-path],
Tim Rice6397eed2015-06-03 21:41:11 -07004788 [ --with-default-path= Specify default $PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004789 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004790 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004791 AC_MSG_WARN([
4792--with-default-path=PATH has no effect on this system.
4793Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004794 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004795 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004796 AC_MSG_WARN([
4797--with-default-path=PATH will only be used if PATH is not defined in
4798$external_path_file .])
4799 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004800 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004801 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004802 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004803 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004804 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4805 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004806 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004807 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004808 AC_MSG_WARN([
4809If PATH is defined in $external_path_file, ensure the path to scp is included,
4810otherwise scp will not work.])
4811 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004812 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004813 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004814/* find out what STDPATH is */
4815#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004816#ifdef HAVE_PATHS_H
4817# include <paths.h>
4818#endif
4819#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004820# ifdef _PATH_USERPATH /* Irix */
4821# define _PATH_STDPATH _PATH_USERPATH
4822# else
4823# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4824# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004825#endif
4826#include <sys/types.h>
4827#include <sys/stat.h>
4828#include <fcntl.h>
4829#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004830 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004831 FILE *fd;
4832 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004833
Tim Rice59ea0a02001-03-10 13:50:45 -08004834 fd = fopen(DATA,"w");
4835 if(fd == NULL)
4836 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004837
Tim Rice59ea0a02001-03-10 13:50:45 -08004838 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4839 exit(1);
4840
4841 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004842 ]])],
4843 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004844 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4845 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4846 )
4847# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004848 t_bindir="${bindir}"
4849 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4850 t_bindir=`eval echo ${t_bindir}`
4851 case $t_bindir in
4852 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4853 esac
4854 case $t_bindir in
4855 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4856 esac
4857 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004858 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4859 if test $? -ne 0 ; then
4860 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4861 if test $? -ne 0 ; then
4862 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004863 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004864 fi
4865 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004866 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004867)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004868if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004869 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4870 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004871fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004872
Damien Millera18bbd32002-05-13 10:48:57 +10004873# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004874AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004875 [ --with-superuser-path= Specify different path for super-user],
4876 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004877 if test -n "$withval" && test "x$withval" != "xno" && \
4878 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004879 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004880 [Define if you want a different $PATH
4881 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004882 superuser_path=$withval
4883 fi
4884 ]
4885)
4886
4887
Damien Miller61e50f12000-05-08 20:49:37 +10004888AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004889IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004890AC_ARG_WITH(4in6,
4891 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4892 [
4893 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004894 AC_MSG_RESULT([yes])
4895 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004896 [Detect IPv4 in IPv6 mapped addresses
4897 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004898 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004899 else
Tim Rice648f8762011-01-26 12:38:57 -08004900 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004901 fi
Tim Rice648f8762011-01-26 12:38:57 -08004902 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004903 if test "x$inet6_default_4in6" = "xyes"; then
4904 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004905 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004906 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004907 else
4908 AC_MSG_RESULT([no (default)])
4909 fi
4910 ]
4911)
4912
Damien Miller60396b02001-02-18 17:01:00 +11004913# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004914BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004915AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004916 [ --with-bsd-auth Enable BSD auth support],
4917 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004918 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004919 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004920 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004921 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004922 fi
4923 ]
4924)
4925
Damien Millera22ba012000-03-02 23:09:20 +11004926# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004927piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004928# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004929if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004930 piddir=`eval echo ${sysconfdir}`
4931 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004932 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004933 esac
4934fi
4935
Tim Rice648f8762011-01-26 12:38:57 -08004936AC_ARG_WITH([pid-dir],
Darren Tucker075e2582018-02-13 17:36:43 +11004937 [ --with-pid-dir=PATH Specify location of sshd.pid file],
Tim Rice88f2ab52002-03-17 12:17:34 -08004938 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004939 if test -n "$withval" && test "x$withval" != "xno" && \
4940 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004941 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004942 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004943 AC_MSG_WARN([** no $piddir directory on this system **])
4944 fi
4945 fi
4946 ]
4947)
4948
Tim Ricee1d93702016-05-31 11:13:22 -07004949AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
Tim Rice648f8762011-01-26 12:38:57 -08004950 [Specify location of ssh.pid])
4951AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004952
andre2ff7b5d2000-06-03 14:57:40 +00004953dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004954AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004955 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004956 [
4957 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004958 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004959 fi
4960 ]
andre2ff7b5d2000-06-03 14:57:40 +00004961)
Tim Rice648f8762011-01-26 12:38:57 -08004962AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004963 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004964 [
4965 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004966 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004967 fi
4968 ]
andre2ff7b5d2000-06-03 14:57:40 +00004969)
Tim Rice648f8762011-01-26 12:38:57 -08004970AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004971 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004972 [
4973 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004974 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004975 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004976 fi
4977 ]
andre2ff7b5d2000-06-03 14:57:40 +00004978)
Tim Rice648f8762011-01-26 12:38:57 -08004979AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004980 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004981 [
4982 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004983 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004984 fi
4985 ]
andre2ff7b5d2000-06-03 14:57:40 +00004986)
Tim Rice648f8762011-01-26 12:38:57 -08004987AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004988 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004989 [
4990 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004991 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004992 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004993 fi
4994 ]
andre2ff7b5d2000-06-03 14:57:40 +00004995)
Tim Rice648f8762011-01-26 12:38:57 -08004996AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004997 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004998 [
4999 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005000 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10005001 fi
5002 ]
andre2ff7b5d2000-06-03 14:57:40 +00005003)
Tim Rice648f8762011-01-26 12:38:57 -08005004AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00005005 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10005006 [
5007 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005008 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07005009 [Define if you don't want to use pututline()
5010 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10005011 fi
5012 ]
andre2ff7b5d2000-06-03 14:57:40 +00005013)
Tim Rice648f8762011-01-26 12:38:57 -08005014AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00005015 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10005016 [
5017 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005018 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07005019 [Define if you don't want to use pututxline()
5020 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10005021 fi
5022 ]
andre2ff7b5d2000-06-03 14:57:40 +00005023)
Tim Rice648f8762011-01-26 12:38:57 -08005024AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00005025 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11005026 [
Tim Riceeae17cc2005-03-17 16:52:20 -08005027 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005028 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08005029 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11005030 conf_lastlog_location=$withval
5031 fi
5032 ]
5033)
andre2ff7b5d2000-06-03 14:57:40 +00005034
5035dnl lastlog, [uw]tmpx? detection
5036dnl NOTE: set the paths in the platform section to avoid the
5037dnl need for command-line parameters
5038dnl lastlog and [uw]tmp are subject to a file search if all else fails
5039
5040dnl lastlog detection
5041dnl NOTE: the code itself will detect if lastlog is a directory
5042AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005043AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005044#include <sys/types.h>
5045#include <utmp.h>
5046#ifdef HAVE_LASTLOG_H
5047# include <lastlog.h>
5048#endif
Damien Miller2994e082000-06-04 15:51:47 +10005049#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005050# include <paths.h>
5051#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00005052#ifdef HAVE_LOGIN_H
5053# include <login.h>
5054#endif
Tim Rice648f8762011-01-26 12:38:57 -08005055 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
5056 [ AC_MSG_RESULT([yes]) ],
5057 [
5058 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005059 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08005060 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10005061#include <sys/types.h>
5062#include <utmp.h>
5063#ifdef HAVE_LASTLOG_H
5064# include <lastlog.h>
5065#endif
5066#ifdef HAVE_PATHS_H
5067# include <paths.h>
5068#endif
Tim Rice648f8762011-01-26 12:38:57 -08005069 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
5070 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10005071 [
Tim Rice648f8762011-01-26 12:38:57 -08005072 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005073 system_lastlog_path=no
5074 ])
Tim Rice648f8762011-01-26 12:38:57 -08005075])
Damien Miller2994e082000-06-04 15:51:47 +10005076
andre2ff7b5d2000-06-03 14:57:40 +00005077if test -z "$conf_lastlog_location"; then
5078 if test x"$system_lastlog_path" = x"no" ; then
5079 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10005080 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00005081 conf_lastlog_location=$f
5082 fi
5083 done
5084 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00005085 AC_MSG_WARN([** Cannot find lastlog **])
5086 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00005087 fi
5088 fi
5089fi
5090
5091if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005092 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005093 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005094fi
andre2ff7b5d2000-06-03 14:57:40 +00005095
5096dnl utmp detection
5097AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005098AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005099#include <sys/types.h>
5100#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005101#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005102# include <paths.h>
5103#endif
Tim Rice648f8762011-01-26 12:38:57 -08005104 ]], [[ char *utmp = UTMP_FILE; ]])],
5105 [ AC_MSG_RESULT([yes]) ],
5106 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005107 system_utmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005108])
andre2ff7b5d2000-06-03 14:57:40 +00005109if test -z "$conf_utmp_location"; then
5110 if test x"$system_utmp_path" = x"no" ; then
5111 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
5112 if test -f $f ; then
5113 conf_utmp_location=$f
5114 fi
5115 done
5116 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005117 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005118 fi
5119 fi
5120fi
5121if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005122 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005123 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005124fi
andre2ff7b5d2000-06-03 14:57:40 +00005125
5126dnl wtmp detection
5127AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005128AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005129#include <sys/types.h>
5130#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005131#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005132# include <paths.h>
5133#endif
Tim Rice648f8762011-01-26 12:38:57 -08005134 ]], [[ char *wtmp = WTMP_FILE; ]])],
5135 [ AC_MSG_RESULT([yes]) ],
5136 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005137 system_wtmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005138])
andre2ff7b5d2000-06-03 14:57:40 +00005139if test -z "$conf_wtmp_location"; then
5140 if test x"$system_wtmp_path" = x"no" ; then
5141 for f in /usr/adm/wtmp /var/log/wtmp; do
5142 if test -f $f ; then
5143 conf_wtmp_location=$f
5144 fi
5145 done
5146 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005147 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005148 fi
5149 fi
5150fi
5151if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005152 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005153 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005154fi
andre2ff7b5d2000-06-03 14:57:40 +00005155
andre2ff7b5d2000-06-03 14:57:40 +00005156dnl wtmpx detection
5157AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005158AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005159#include <sys/types.h>
5160#include <utmp.h>
5161#ifdef HAVE_UTMPX_H
5162#include <utmpx.h>
5163#endif
Damien Miller2994e082000-06-04 15:51:47 +10005164#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005165# include <paths.h>
5166#endif
Tim Rice648f8762011-01-26 12:38:57 -08005167 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
5168 [ AC_MSG_RESULT([yes]) ],
5169 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005170 system_wtmpx_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005171])
andre2ff7b5d2000-06-03 14:57:40 +00005172if test -z "$conf_wtmpx_location"; then
5173 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005174 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00005175 fi
5176else
Tim Rice648f8762011-01-26 12:38:57 -08005177 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005178 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005179fi
andre2ff7b5d2000-06-03 14:57:40 +00005180
Damien Miller4018c192000-04-30 09:30:44 +10005181
Damien Miller29ea30d2000-03-17 10:54:15 +11005182if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10005183 LDFLAGS="$LDFLAGS $blibflags$blibpath"
5184 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11005185fi
5186
Damien Millera2438bb2013-03-15 10:23:07 +11005187AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07005188 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11005189 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07005190 fi
Damien Millera2438bb2013-03-15 10:23:07 +11005191 ], [
5192#ifdef HAVE_SYS_TYPES_H
5193#include <sys/types.h>
5194#endif
5195#ifdef HAVE_UTMP_H
5196#include <utmp.h>
5197#endif
5198#ifdef HAVE_UTMPX_H
5199#include <utmpx.h>
5200#endif
5201#ifdef HAVE_LASTLOG_H
5202#include <lastlog.h>
5203#endif
5204 ])
5205
5206AC_CHECK_MEMBER([struct utmp.ut_line], [], [
5207 AC_DEFINE([DISABLE_UTMP])
5208 AC_DEFINE([DISABLE_WTMP])
5209 ], [
5210#ifdef HAVE_SYS_TYPES_H
5211#include <sys/types.h>
5212#endif
5213#ifdef HAVE_UTMP_H
5214#include <utmp.h>
5215#endif
5216#ifdef HAVE_UTMPX_H
5217#include <utmpx.h>
5218#endif
5219#ifdef HAVE_LASTLOG_H
5220#include <lastlog.h>
5221#endif
5222 ])
5223
Darren Tucker7da23cb2005-08-03 00:20:15 +10005224dnl Adding -Werror to CFLAGS early prevents configure tests from running.
5225dnl Add now.
5226CFLAGS="$CFLAGS $werror_flags"
5227
Darren Tucker627337d2010-04-10 22:58:01 +10005228if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
5229 TEST_SSH_IPV6=no
5230else
5231 TEST_SSH_IPV6=yes
5232fi
Tim Rice648f8762011-01-26 12:38:57 -08005233AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
5234AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker47b8c992016-12-08 15:48:34 +11005235AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8])
Darren Tucker882abfd2013-11-09 00:17:41 +11005236AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10005237AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker79c0e1d2017-12-11 14:38:33 +11005238AC_SUBST([DEPEND], [$(cat $srcdir/.depend)])
Darren Tucker5d376902008-06-11 04:15:05 +10005239
Damien Millerde35c382017-09-08 12:38:31 +10005240CFLAGS="${CFLAGS} ${CFLAGS_AFTER}"
5241LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}"
5242
Damien Millerbac2d8a2000-09-05 16:13:06 +11005243AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10005244AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
5245 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10005246 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07005247AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10005248
Damien Miller7b22d652000-06-18 14:07:04 +10005249# Print summary of options
5250
Damien Miller7b22d652000-06-18 14:07:04 +10005251# Someone please show me a better way :)
5252A=`eval echo ${prefix}` ; A=`eval echo ${A}`
5253B=`eval echo ${bindir}` ; B=`eval echo ${B}`
5254C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
5255D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00005256E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00005257F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10005258G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10005259H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
5260I=`eval echo ${user_path}` ; I=`eval echo ${I}`
5261J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10005262
5263echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00005264echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10005265echo " User binaries: $B"
5266echo " System binaries: $C"
5267echo " Configuration files: $D"
5268echo " Askpass program: $E"
5269echo " Manual pages: $F"
5270echo " PID file: $G"
5271echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10005272if test "x$external_path_file" = "x/etc/login.conf" ; then
5273echo " At runtime, sshd will use the path defined in $external_path_file"
5274echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07005275else
Damien Millerf58c6722002-05-13 13:15:42 +10005276echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07005277 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10005278echo " (If PATH is set in $external_path_file it will be used instead. If"
5279echo " used, ensure the path to scp is present, otherwise scp will not work.)"
5280 fi
Tim Rice43a1c132002-04-17 21:19:14 -07005281fi
Damien Millera18bbd32002-05-13 10:48:57 +10005282if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10005283echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10005284fi
Damien Millerf58c6722002-05-13 13:15:42 +10005285echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10005286echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005287echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005288echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10005289echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005290echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11005291echo " libedit support: $LIBEDIT_MSG"
Damien Miller523db852017-02-03 16:01:22 +11005292echo " libldns support: $LDNS_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005293echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11005294echo " Solaris project support: $SP_MSG"
Damien Miller4626cba2016-01-08 14:24:56 +11005295echo " Solaris privilege support: $SPP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10005296echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005297echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5298echo " BSD Auth support: $BSD_AUTH_MSG"
5299echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10005300echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11005301
Damien Miller7b22d652000-06-18 14:07:04 +10005302echo ""
5303
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00005304echo " Host: ${host}"
5305echo " Compiler: ${CC}"
5306echo " Compiler flags: ${CFLAGS}"
5307echo "Preprocessor flags: ${CPPFLAGS}"
5308echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10005309echo " Libraries: ${LIBS}"
5310if test ! -z "${SSHDLIBS}"; then
5311echo " +for sshd: ${SSHDLIBS}"
5312fi
Damien Miller71adf122011-01-25 12:16:15 +11005313if test ! -z "${SSHLIBS}"; then
5314echo " +for ssh: ${SSHLIBS}"
5315fi
Damien Miller7b22d652000-06-18 14:07:04 +10005316
5317echo ""
5318
Tim Rice6f1f7582004-05-30 21:38:51 -07005319if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10005320 echo "SVR4 style packages are supported with \"make package\""
5321 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07005322fi
5323
Damien Miller82cf0ce2000-12-20 13:34:48 +11005324if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11005325 echo "PAM is enabled. You may need to install a PAM control file "
5326 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11005327 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11005328 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11005329 echo ""
5330fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00005331
Damien Millerb4097182004-05-23 14:09:40 +10005332if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11005333 echo "WARNING: the operating system that you are using does not"
5334 echo "appear to support getpeereid(), getpeerucred() or the"
5335 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
5336 echo "enforce security checks to prevent unauthorised connections to"
5337 echo "ssh-agent. Their absence increases the risk that a malicious"
5338 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10005339 echo ""
5340fi
5341
Darren Tuckerd9f88912005-02-20 21:01:48 +11005342if test "$AUDIT_MODULE" = "bsm" ; then
5343 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
5344 echo "See the Solaris section in README.platform for details."
5345fi