blob: 7379ab3589e16b36a33701b1c46189a71efabc6c [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
Darren Tucker3377df02018-02-11 09:32:37 +1100167 OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang
Darren Tucker174bed62018-02-13 18:12:47 +1100168 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt])
Damien Miller161af8f2017-09-19 10:18:56 +1000169 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100170 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
171 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
172 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
Damien Miller5c2ff5e2014-01-22 21:30:12 +1100173 # NB. -ftrapv expects certain support functions to be present in
174 # the compiler library (libgcc or similar) to detect integer operations
175 # that can overflow. We must check that the result of enabling it
176 # actually links. The test program compiled/linked includes a number
177 # of integer operations that should exercise this.
178 OSSH_CHECK_CFLAG_LINK([-ftrapv])
Darren Tuckerfd994372014-01-17 09:53:24 +1100179 fi
Tim Rice648f8762011-01-26 12:38:57 -0800180 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100181 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700182 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000183 1.*) no_attrib_nonnull=1 ;;
184 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000185 no_attrib_nonnull=1
186 ;;
187 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100188 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700189 esac
Tim Rice648f8762011-01-26 12:38:57 -0800190 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000191
Tim Rice648f8762011-01-26 12:38:57 -0800192 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000193 saved_CFLAGS="$CFLAGS"
194 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800195 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
196 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
197 [ AC_MSG_RESULT([yes]) ],
198 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000199 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800200 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000201
Darren Tuckerb7918af2008-03-09 11:34:23 +1100202 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100203 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100204 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100205 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100206 for t in -fstack-protector-strong -fstack-protector-all \
207 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800208 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100209 saved_CFLAGS="$CFLAGS"
210 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100211 CFLAGS="$CFLAGS $t -Werror"
212 LDFLAGS="$LDFLAGS $t -Werror"
213 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800214 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
215 [[
216 char x[256];
217 snprintf(x, sizeof(x), "XXX");
218 ]])],
219 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100220 CFLAGS="$saved_CFLAGS $t"
221 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800222 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100223 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800224 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
225 [[
226 char x[256];
227 snprintf(x, sizeof(x), "XXX");
228 ]])],
229 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100230 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800231 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100232 [ AC_MSG_WARN([cross compiling: cannot test])
233 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100234 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100235 ],
Tim Rice648f8762011-01-26 12:38:57 -0800236 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100237 )
238 CFLAGS="$saved_CFLAGS"
239 LDFLAGS="$saved_LDFLAGS"
240 done
241 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100242
Darren Tucker67b37032005-06-03 17:58:31 +1000243 if test -z "$have_llong_max"; then
244 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
245 unset ac_cv_have_decl_LLONG_MAX
246 saved_CFLAGS="$CFLAGS"
247 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800248 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000249 [have_llong_max=1],
250 [CFLAGS="$saved_CFLAGS"],
251 [#include <limits.h>]
252 )
253 fi
Damien Miller166bd442000-03-16 10:48:25 +1100254fi
255
Darren Tucker951b53b2013-02-08 11:50:09 +1100256AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
257AC_COMPILE_IFELSE(
258 [AC_LANG_PROGRAM([[
259#include <stdlib.h>
260__attribute__((__unused__)) static void foo(void){return;}]],
261 [[ exit(0); ]])],
262 [ AC_MSG_RESULT([yes]) ],
263 [ AC_MSG_RESULT([no])
264 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
265 [compiler does not accept __attribute__ on return types]) ]
266)
267
Darren Tucker1323f122018-02-27 08:41:25 +1100268AC_MSG_CHECKING([if compiler allows __attribute__ prototype args])
269AC_COMPILE_IFELSE(
270 [AC_LANG_PROGRAM([[
271#include <stdlib.h>
272typedef void foo(const char *, ...) __attribute__((format(printf, 1, 2)));]],
273 [[ exit(0); ]])],
274 [ AC_MSG_RESULT([yes]) ],
275 [ AC_MSG_RESULT([no])
276 AC_DEFINE(NO_ATTRIBUTE_ON_PROTOTYPE_ARGS, 1,
Damien Miller10479cc2018-04-10 10:19:02 +1000277 [compiler does not accept __attribute__ on prototype args]) ]
Darren Tucker1323f122018-02-27 08:41:25 +1100278)
279
Darren Tucker391de5c2007-04-29 14:49:21 +1000280if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800281 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000282fi
283
Tim Rice648f8762011-01-26 12:38:57 -0800284AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800285 [ --without-rpath Disable auto-added -R linker paths],
286 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800287 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800288 need_dash_r=""
289 fi
290 if test "x$withval" = "xyes" ; then
291 need_dash_r=1
292 fi
293 ]
294)
295
Tim Rice1cfab232006-10-03 09:34:35 -0700296# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800297AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700298 [ --with-cflags Specify additional flags to pass to compiler],
299 [
300 if test -n "$withval" && test "x$withval" != "xno" && \
301 test "x${withval}" != "xyes"; then
302 CFLAGS="$CFLAGS $withval"
303 fi
304 ]
305)
Damien Millerde35c382017-09-08 12:38:31 +1000306
307AC_ARG_WITH([cflags-after],
308 [ --with-cflags-after Specify additional flags to pass to compiler after configure],
309 [
310 if test -n "$withval" && test "x$withval" != "xno" && \
311 test "x${withval}" != "xyes"; then
312 CFLAGS_AFTER="$withval"
313 fi
314 ]
315)
Tim Rice648f8762011-01-26 12:38:57 -0800316AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700317 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
318 [
319 if test -n "$withval" && test "x$withval" != "xno" && \
320 test "x${withval}" != "xyes"; then
321 CPPFLAGS="$CPPFLAGS $withval"
322 fi
323 ]
324)
Tim Rice648f8762011-01-26 12:38:57 -0800325AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700326 [ --with-ldflags Specify additional flags to pass to linker],
327 [
328 if test -n "$withval" && test "x$withval" != "xno" && \
329 test "x${withval}" != "xyes"; then
330 LDFLAGS="$LDFLAGS $withval"
331 fi
332 ]
333)
Damien Millerde35c382017-09-08 12:38:31 +1000334AC_ARG_WITH([ldflags-after],
335 [ --with-ldflags-after Specify additional flags to pass to linker after configure],
336 [
337 if test -n "$withval" && test "x$withval" != "xno" && \
338 test "x${withval}" != "xyes"; then
339 LDFLAGS_AFTER="$withval"
340 fi
341 ]
342)
Tim Rice648f8762011-01-26 12:38:57 -0800343AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700344 [ --with-libs Specify additional libraries to link with],
345 [
346 if test -n "$withval" && test "x$withval" != "xno" && \
347 test "x${withval}" != "xyes"; then
348 LIBS="$LIBS $withval"
349 fi
350 ]
351)
Tim Rice648f8762011-01-26 12:38:57 -0800352AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700353 [ --with-Werror Build main code with -Werror],
354 [
355 if test -n "$withval" && test "x$withval" != "xno"; then
356 werror_flags="-Werror"
357 if test "x${withval}" != "xyes"; then
358 werror_flags="$withval"
359 fi
360 fi
361 ]
362)
363
Tim Rice648f8762011-01-26 12:38:57 -0800364AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100365 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700366 bstring.h \
367 crypt.h \
368 crypto/sha2.h \
369 dirent.h \
370 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100371 elf.h \
Darren Tucker6310ef22016-07-13 14:42:35 +1000372 err.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700373 features.h \
374 fcntl.h \
375 floatingpoint.h \
376 getopt.h \
377 glob.h \
378 ia.h \
379 iaf.h \
Darren Tuckerb59162d2018-02-23 15:20:42 +1100380 ifaddrs.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100381 inttypes.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000382 langinfo.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700383 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000384 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700385 login.h \
386 maillock.h \
387 ndir.h \
388 net/if_tun.h \
389 netdb.h \
390 netgroup.h \
391 pam/pam_appl.h \
392 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000393 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700394 pty.h \
395 readpassphrase.h \
396 rpc/types.h \
397 security/pam_appl.h \
398 sha2.h \
399 shadow.h \
400 stddef.h \
401 stdint.h \
402 string.h \
403 strings.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700404 sys/bitypes.h \
405 sys/bsdtty.h \
406 sys/cdefs.h \
407 sys/dir.h \
Damien Millerf8854742018-02-26 12:18:14 +1100408 sys/file.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700409 sys/mman.h \
Darren Tuckerce066f62018-02-22 20:45:09 +1100410 sys/label.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700411 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000412 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700413 sys/prctl.h \
414 sys/pstat.h \
Darren Tucker5ee3fb52016-11-01 08:12:33 +1100415 sys/ptrace.h \
Damien Millerafa6e792018-04-13 13:31:42 +1000416 sys/random.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700417 sys/select.h \
418 sys/stat.h \
419 sys/stream.h \
420 sys/stropts.h \
421 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000422 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700423 sys/sysmacros.h \
424 sys/time.h \
425 sys/timers.h \
Darren Tucker11057562018-02-25 11:22:57 +1100426 sys/vfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700427 time.h \
428 tmpdir.h \
429 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700430 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700431 unistd.h \
432 usersec.h \
433 util.h \
434 utime.h \
435 utmp.h \
436 utmpx.h \
437 vis.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000438 wchar.h \
Tim Rice648f8762011-01-26 12:38:57 -0800439])
Tim Rice1cfab232006-10-03 09:34:35 -0700440
Darren Tuckerce066f62018-02-22 20:45:09 +1100441# On some platforms (eg SunOS4) sys/audit.h requires sys/[time|types|label.h]
442# to be included first.
443AC_CHECK_HEADERS([sys/audit.h], [], [], [
444#ifdef HAVE_SYS_TIME_H
445# include <sys/time.h>
446#endif
447#ifdef HAVE_SYS_TYPES_H
448# include <sys/types.h>
449#endif
450#ifdef HAVE_SYS_LABEL_H
451# include <sys/label.h>
452#endif
453])
454
Darren Tuckerdd9d9b32017-08-28 16:48:27 +1000455# sys/capsicum.h requires sys/types.h
456AC_CHECK_HEADERS([sys/capsicum.h], [], [], [
457#ifdef HAVE_SYS_TYPES_H
458# include <sys/types.h>
459#endif
460])
461
Darren Tuckerfa1b8342017-11-03 14:09:45 +1100462# net/route.h requires sys/socket.h and sys/types.h.
463# sys/sysctl.h also requires sys/param.h
464AC_CHECK_HEADERS([net/route.h sys/sysctl.h], [], [], [
465#ifdef HAVE_SYS_TYPES_H
466# include <sys/types.h>
467#endif
468#include <sys/param.h>
Damien Miller32354732017-10-25 11:25:43 +1100469#include <sys/socket.h>
470])
471
Tim Rice1cfab232006-10-03 09:34:35 -0700472# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800473AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700474#ifdef HAVE_SYS_TIME_H
475# include <sys/time.h>
476#endif
477])
478
479# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800480AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700481#ifdef HAVE_SYS_STREAM_H
482# include <sys/stream.h>
483#endif
484])
485
486# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800487AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700488#include <sys/types.h>
489])
490
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000491# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800492AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000493#include <sys/param.h>
494])
495
Darren Tuckeref4901c2013-06-03 01:59:13 +1000496# Android requires sys/socket.h to be included before sys/un.h
497AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000498#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000499#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000500])
501
Damien Miller1b06dc32006-08-31 03:24:41 +1000502# Messages for features tested for in target-specific section
503SIA_MSG="no"
504SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100505SP_MSG="no"
Damien Miller4626cba2016-01-08 14:24:56 +1100506SPP_MSG="no"
507
508# Support for Solaris/Illumos privileges (this test is used by both
509# the --with-solaris-privs option and --with-sandbox=solaris).
510SOLARIS_PRIVS="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000511
Damien Millera22ba012000-03-02 23:09:20 +1100512# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100513case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100514*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000515 # Some versions of VAC won't allow macro redefinitions at
516 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
517 # particularly with older versions of vac or xlc.
Damien Miller10479cc2018-04-10 10:19:02 +1000518 # It also throws errors about null macro arguments, but these are
Darren Tucker9216c372006-09-18 23:17:40 +1000519 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800520 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000521 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800522 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000523#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800524#define testmacro bar]],
525 [[ exit(0); ]])],
526 [ AC_MSG_RESULT([yes]) ],
527 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000528 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
Darren Tucker9216c372006-09-18 23:17:40 +1000529 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
530 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
531 ]
532 )
533
Damien Millera8e06ce2003-11-21 23:48:55 +1100534 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000535 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800536 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100537 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000538 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000539 if test "$GCC" = "yes"; then
540 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
541 else
542 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
543 fi
544 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000545 if (test -z "$blibflags"); then
546 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800547 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
548 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000549 fi
550 done
551 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800552 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000553 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
554 else
Tim Rice648f8762011-01-26 12:38:57 -0800555 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000556 fi
557 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000558 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800559 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700560 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800561 [AC_CHECK_LIB([s], [authenticate],
562 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700563 LIBS="$LIBS -ls"
564 ])
565 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100566 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100567 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100568 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000569 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800570 AC_CHECK_DECLS([loginfailed],
571 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
572 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
573 [[ (void)loginfailed("user","host","tty",0); ]])],
574 [AC_MSG_RESULT([yes])
575 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
576 [Define if your AIX loginfailed() function
577 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
578 ])],
579 [],
580 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000581 )
Tim Rice648f8762011-01-26 12:38:57 -0800582 AC_CHECK_FUNCS([getgrset setauthdb])
583 AC_CHECK_DECL([F_CLOSEM],
584 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000585 [],
586 [ #include <limits.h>
587 #include <fcntl.h> ]
588 )
Darren Tucker691d5232005-02-15 21:45:57 +1100589 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
591 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700592 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800593 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
594 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000595 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800596 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
597 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700598 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700600 [Define to a Set Process Title type if your system is
601 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800602 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100603 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800604 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100605 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Darren Tucker2c71ca12018-03-30 18:23:07 +1100606 AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211])
607 AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551])
Damien Miller75b1d102000-01-07 14:01:41 +1100608 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000609*-*-android*)
610 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
611 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
612 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100613*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100614 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100615 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800616 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
617 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
Damien Miller4626cba2016-01-08 14:24:56 +1100618 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
619 [Define to disable UID restoration test])
Tim Rice648f8762011-01-26 12:38:57 -0800620 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700621 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800622 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700623 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800624 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700625 [Define if your platform needs to skip post auth
626 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800627 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100628 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
629 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
630 # reasons which cause compile warnings, so we disable those warnings.
631 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100632 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000633*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800634 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700635 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800636 AC_DEFINE([SETEUID_BREAKS_SETUID])
637 AC_DEFINE([BROKEN_SETREUID])
638 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000639 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000640*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100641 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800642 AC_MSG_CHECKING([if we have working getaddrinfo])
643 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000644main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
645 exit(0);
646 else
647 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800648}
649 ]])],
650 [AC_MSG_RESULT([working])],
651 [AC_MSG_RESULT([buggy])
652 AC_DEFINE([BROKEN_GETADDRINFO], [1],
653 [getaddrinfo is broken (if present)])
654 ],
655 [AC_MSG_RESULT([assume it is working])])
656 AC_DEFINE([SETEUID_BREAKS_SETUID])
657 AC_DEFINE([BROKEN_SETREUID])
658 AC_DEFINE([BROKEN_SETREGID])
659 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
660 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700661 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800662 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
663 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000664 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000666 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800667 m4_pattern_allow([AU_IPv])
Tim Ricee1d93702016-05-31 11:13:22 -0700668 AC_CHECK_DECL([AU_IPv4], [],
Tim Rice648f8762011-01-26 12:38:57 -0800669 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100670 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800671 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100672 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100673 )
Damien Millerc09182f2011-06-03 12:11:38 +1000674 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
675 [Define to a Set Process Title type if your system is
676 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000677 AC_CHECK_FUNCS([sandbox_init])
678 AC_CHECK_HEADERS([sandbox.h])
Damien Miller39f303b2016-02-23 12:56:59 +1100679 AC_CHECK_LIB([sandbox], [sandbox_apply], [
680 SSHDLIBS="$SSHDLIBS -lsandbox"
681 ])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000682 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000683*-*-dragonfly*)
684 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100685 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000686 ;;
Tim Ricee1d93702016-05-31 11:13:22 -0700687*-*-haiku*)
Darren Tucker5faa52d2016-08-02 15:22:40 +1000688 LIBS="$LIBS -lbsd "
689 AC_CHECK_LIB([network], [socket])
690 AC_DEFINE([HAVE_U_INT64_T])
691 MANTYPE=man
692 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000693*-*-hpux*)
694 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000695 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100696 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800697 AC_DEFINE([USE_PIPES])
Tim Rice648f8762011-01-26 12:38:57 -0800698 AC_DEFINE([LOGIN_NEEDS_UTMPX])
699 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700700 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800701 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100702 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700703 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700704 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800705 AC_CHECK_LIB([xnet], [t_error], ,
706 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000707
708 # next, we define all of the options specific to major releases
709 case "$host" in
710 *-*-hpux10*)
711 if test -z "$GCC"; then
712 CFLAGS="$CFLAGS -Ae"
713 fi
714 ;;
715 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800716 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700717 [Define if you are using Solaris-derived PAM which
718 passes pam_messages to the conversation function
719 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800720 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700721 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800722 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000723 check_for_hpux_broken_getaddrinfo=1
724 check_for_conflicting_getspnam=1
725 ;;
726 esac
727
728 # lastly, we define options specific to minor releases
729 case "$host" in
730 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800731 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700732 [Define if you have SecureWare-based
733 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000734 disable_ptmx_check=yes
735 LIBS="$LIBS -lsecpw"
736 ;;
737 esac
Damien Miller1bead332000-04-30 00:47:29 +1000738 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100739*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100740 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800741 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700742 [Define if you system's inet_ntoa is busted
743 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800744 AC_DEFINE([SETEUID_BREAKS_SETUID])
745 AC_DEFINE([BROKEN_SETREUID])
746 AC_DEFINE([BROKEN_SETREGID])
747 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700748 [Define if you shouldn't strip 'tty' from your
749 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800750 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100751 ;;
752*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100753 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800754 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700755 [Define if you have/want arrays
Damien Miller10479cc2018-04-10 10:19:02 +1000756 (cluster-wide session management, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800757 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700758 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800759 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700760 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800761 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700762 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800763 AC_DEFINE([BROKEN_INET_NTOA])
764 AC_DEFINE([SETEUID_BREAKS_SETUID])
765 AC_DEFINE([BROKEN_SETREUID])
766 AC_DEFINE([BROKEN_SETREGID])
767 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
768 AC_DEFINE([WITH_ABBREV_NO_TTY])
769 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100770 ;;
Damien Miller90551722009-02-16 15:37:03 +1100771*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
772 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800773 AC_DEFINE([PAM_TTY_KLUDGE])
774 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
775 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
776 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
777 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100778 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100779*-*-linux*)
780 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100781 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100782 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000783 check_for_openpty_ctty_bug=1
Darren Tuckerc61d5ec2017-02-03 14:10:34 +1100784 dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
785 dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
786 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800787 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700788 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800789 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700790 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800791 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
792 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700793 [Define to whatever link() returns for "not supported"
794 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800795 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
796 AC_DEFINE([USE_BTMP])
797 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100798 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000799 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000800 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800801 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700802 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000803 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000804 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100805 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800806 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100807 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800808 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100809 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800810 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100811 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800812 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100813 [Prepend the address family to IP tunnel traffic])
814 fi
Darren Tucker81c9ccd2017-11-03 14:52:51 +1100815 AC_CHECK_HEADER([linux/if.h],
816 AC_DEFINE([SYS_RDOMAIN_LINUX], [1],
Darren Tucker24d2a332018-02-11 21:20:39 +1300817 [Support routing domains using Linux VRF]), [], [
818#ifdef HAVE_SYS_TYPES_H
819# include <sys/types.H>
820#endif
821 ])
Darren Tucker60395f92012-07-03 14:31:18 +1000822 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
823 [], [#include <linux/types.h>])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100824 # Obtain MIPS ABI
825 case "$host" in
826 mips*)
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100827 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100828#if _MIPS_SIM != _ABIO32
829#error
830#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100831 ]])],[mips_abi="o32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100832#if _MIPS_SIM != _ABIN32
833#error
834#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100835 ]])],[mips_abi="n32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100836#if _MIPS_SIM != _ABI64
837#error
838#endif
Darren Tuckerfbd733a2018-03-12 19:17:26 +1100839 ]])],[mips_abi="n64"],[AC_MSG_ERROR([unknown MIPS ABI])
Vicente Olivert Riera58008672017-06-20 16:42:11 +0100840 ])
841 ])
842 ])
843 ;;
844 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100845 AC_MSG_CHECKING([for seccomp architecture])
846 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000847 case "$host" in
848 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100849 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000850 ;;
851 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100852 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000853 ;;
Damien Miller99f33d72015-06-17 10:50:51 +1000854 arm*-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100855 seccomp_audit_arch=AUDIT_ARCH_ARM
Damien Miller99f33d72015-06-17 10:50:51 +1000856 ;;
857 aarch64*-*)
858 seccomp_audit_arch=AUDIT_ARCH_AARCH64
Damien Miller5c15e222015-06-18 15:07:56 +1000859 ;;
Damien Millerb9c50612016-07-08 13:59:13 +1000860 s390x-*)
861 seccomp_audit_arch=AUDIT_ARCH_S390X
862 ;;
863 s390-*)
864 seccomp_audit_arch=AUDIT_ARCH_S390
865 ;;
866 powerpc64-*)
867 seccomp_audit_arch=AUDIT_ARCH_PPC64
868 ;;
869 powerpc64le-*)
870 seccomp_audit_arch=AUDIT_ARCH_PPC64LE
871 ;;
872 mips-*)
873 seccomp_audit_arch=AUDIT_ARCH_MIPS
874 ;;
875 mipsel-*)
876 seccomp_audit_arch=AUDIT_ARCH_MIPSEL
877 ;;
878 mips64-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100879 case "$mips_abi" in
880 "n32")
881 seccomp_audit_arch=AUDIT_ARCH_MIPS64N32
882 ;;
883 "n64")
884 seccomp_audit_arch=AUDIT_ARCH_MIPS64
885 ;;
886 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000887 ;;
888 mips64el-*)
Vicente Olivert Riera45011512017-06-20 16:42:28 +0100889 case "$mips_abi" in
890 "n32")
891 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64N32
892 ;;
893 "n64")
894 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
895 ;;
896 esac
Damien Millerb9c50612016-07-08 13:59:13 +1000897 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000898 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100899 if test "x$seccomp_audit_arch" != "x" ; then
900 AC_MSG_RESULT(["$seccomp_audit_arch"])
Damien Miller99f33d72015-06-17 10:50:51 +1000901 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
902 [Specify the system call convention in use])
Damien Miller91f40d82013-02-22 11:37:00 +1100903 else
904 AC_MSG_RESULT([architecture not supported])
905 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100906 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000907mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800908 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000909 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000910 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100911*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000912 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800913 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800914 need_dash_r=1
915 fi
Damien Miller99522ba2016-07-28 08:54:27 +1000916 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800917 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100918 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800919 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
920 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100921 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100922 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerf5bbd3b2014-01-30 11:26:46 +1100923 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
924 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
Damien Milleree1c0b32000-01-21 00:18:15 +1100925 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100926*-*-freebsd*)
927 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800928 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
929 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100930 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800931 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
932 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100933 TEST_MALLOC_OPTIONS="AJRX"
Damien Miller2035b222014-01-26 09:39:53 +1100934 # Preauth crypto occasionally uses file descriptors for crypto offload
935 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100936 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
Tim Rice03ae0812014-02-21 09:09:34 -0800937 [define if setrlimit RLIMIT_NOFILE breaks things])
Damien Millerfbd884a2001-02-27 08:39:07 +1100938 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000939*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800940 AC_DEFINE([SETEUID_BREAKS_SETUID])
941 AC_DEFINE([BROKEN_SETREUID])
942 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000943 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000944*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000945 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100946 conf_utmp_location=/etc/utmp
947 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700948 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800949 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
950 AC_DEFINE([BROKEN_REALPATH])
951 AC_DEFINE([USE_PIPES])
952 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000953 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000954*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100955 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800956 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
957 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
958 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
959 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000960 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100961 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000962 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100963*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800964 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800965 need_dash_r=1
966 fi
Tim Rice648f8762011-01-26 12:38:57 -0800967 AC_DEFINE([PAM_SUN_CODEBASE])
968 AC_DEFINE([LOGIN_NEEDS_UTMPX])
Tim Rice648f8762011-01-26 12:38:57 -0800969 AC_DEFINE([PAM_TTY_KLUDGE])
970 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700971 [Define if pam_chauthtok wants real uid set
972 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800973 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000974 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800975 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700976 [Define if sshd somehow reacquires a controlling TTY
977 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800978 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000979 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800980 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000981 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000982 # hardwire lastlog location (can't detect it on some versions)
983 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800984 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000985 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
986 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800987 AC_MSG_RESULT([yes])
988 AC_DEFINE([DISABLE_UTMP])
989 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700990 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000991 else
Tim Rice648f8762011-01-26 12:38:57 -0800992 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000993 fi
Darren Tuckera86ec4d2016-06-14 10:48:27 +1000994 AC_CHECK_FUNCS([setpflags])
Darren Tucker907091a2016-02-19 09:05:39 +1100995 AC_CHECK_FUNCS([setppriv])
996 AC_CHECK_FUNCS([priv_basicset])
997 AC_CHECK_HEADERS([priv.h])
Tim Rice648f8762011-01-26 12:38:57 -0800998 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000999 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
1000 [
Tim Rice648f8762011-01-26 12:38:57 -08001001 AC_CHECK_LIB([contract], [ct_tmpl_activate],
1002 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +10001003 [Define if you have Solaris process contracts])
Damien Miller4626cba2016-01-08 14:24:56 +11001004 LIBS="$LIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +10001005 SPC_MSG="yes" ], )
1006 ],
1007 )
Tim Rice648f8762011-01-26 12:38:57 -08001008 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +11001009 [ --with-solaris-projects Enable Solaris projects (experimental)],
1010 [
Tim Rice648f8762011-01-26 12:38:57 -08001011 AC_CHECK_LIB([project], [setproject],
1012 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +11001013 [Define if you have Solaris projects])
Damien Miller4626cba2016-01-08 14:24:56 +11001014 LIBS="$LIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +11001015 SP_MSG="yes" ], )
1016 ],
1017 )
Damien Miller4626cba2016-01-08 14:24:56 +11001018 AC_ARG_WITH([solaris-privs],
1019 [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)],
1020 [
1021 AC_MSG_CHECKING([for Solaris/Illumos privilege support])
Darren Tucker907091a2016-02-19 09:05:39 +11001022 if test "x$ac_cv_func_setppriv" = "xyes" -a \
1023 "x$ac_cv_header_priv_h" = "xyes" ; then
1024 SOLARIS_PRIVS=yes
Damien Miller4626cba2016-01-08 14:24:56 +11001025 AC_MSG_RESULT([found])
1026 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
1027 [Define to disable UID restoration test])
1028 AC_DEFINE([USE_SOLARIS_PRIVS], [1],
1029 [Define if you have Solaris privileges])
1030 SPP_MSG="yes"
1031 else
1032 AC_MSG_RESULT([not found])
1033 AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs])
1034 fi
1035 ],
1036 )
Tim Rice5ab9b632013-06-02 14:05:48 -07001037 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +11001038 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +10001039*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00001040 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -08001041 AC_CHECK_FUNCS([getpwanam])
1042 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +10001043 conf_utmp_location=/etc/utmp
1044 conf_wtmp_location=/var/adm/wtmp
1045 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -08001046 AC_DEFINE([USE_PIPES])
Darren Tuckerc0a0c3f2018-03-05 20:03:07 +11001047 AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx])
Damien Millerdfc83f42000-05-20 15:02:59 +10001048 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001049*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -07001050 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -08001051 AC_DEFINE([USE_PIPES])
1052 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1053 AC_DEFINE([SETEUID_BREAKS_SETUID])
1054 AC_DEFINE([BROKEN_SETREUID])
1055 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +00001056 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +10001057*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -07001058 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -08001059 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +11001060 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -08001061 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +11001062 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -08001063 AC_DEFINE([USE_PIPES])
1064 AC_DEFINE([IP_TOS_IS_BROKEN])
1065 AC_DEFINE([SETEUID_BREAKS_SETUID])
1066 AC_DEFINE([BROKEN_SETREUID])
1067 AC_DEFINE([BROKEN_SETREGID])
1068 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +10001069 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -07001070 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
1071 # Attention: always take care to bind libsocket and libnsl before libc,
1072 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +10001073 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001074# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +11001075*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -08001076 AC_DEFINE([USE_PIPES])
1077 AC_DEFINE([SETEUID_BREAKS_SETUID])
1078 AC_DEFINE([BROKEN_SETREUID])
1079 AC_DEFINE([BROKEN_SETREGID])
1080 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
1081 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -07001082 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +11001083 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001084# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +11001085*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -08001086 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -08001087 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
1088 AC_DEFINE([USE_PIPES])
1089 AC_DEFINE([SETEUID_BREAKS_SETUID])
1090 AC_DEFINE([BROKEN_GETADDRINFO])
1091 AC_DEFINE([BROKEN_SETREUID])
1092 AC_DEFINE([BROKEN_SETREGID])
1093 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice8433d512017-07-11 18:47:56 -07001094 AC_DEFINE([BROKEN_TCGETATTR_ICANON])
Tim Rice5ab9b632013-06-02 14:05:48 -07001095 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4afeaf32018-03-25 10:00:21 -07001096 check_for_libcrypt_later=1
Tim Rice4dbacff2005-06-01 20:09:28 -07001097 case "$host" in
1098 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -07001099 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -08001100 AC_DEFINE([BROKEN_UPDWTMPX])
1101 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
1102 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
Tim Rice648f8762011-01-26 12:38:57 -08001103 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -07001104 ;;
Tim Rice648f8762011-01-26 12:38:57 -08001105 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice46259d82005-11-28 18:40:34 -08001106 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -07001107 esac
Damien Miller78315eb2000-09-29 23:01:36 +11001108 ;;
Damien Miller75b1d102000-01-07 14:01:41 +11001109*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +11001110 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001111# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +11001112*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -08001113 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +11001114 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001115# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +11001116*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -08001117 if test -z "$GCC"; then
1118 CFLAGS="$CFLAGS -belf"
1119 fi
Damien Miller5dfe9762001-02-16 12:05:39 +11001120 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +10001121 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -08001122 AC_DEFINE([USE_PIPES])
1123 AC_DEFINE([HAVE_SECUREWARE])
1124 AC_DEFINE([DISABLE_SHADOW])
1125 AC_DEFINE([DISABLE_FD_PASSING])
1126 AC_DEFINE([SETEUID_BREAKS_SETUID])
1127 AC_DEFINE([BROKEN_GETADDRINFO])
1128 AC_DEFINE([BROKEN_SETREUID])
1129 AC_DEFINE([BROKEN_SETREGID])
1130 AC_DEFINE([WITH_ABBREV_NO_TTY])
1131 AC_DEFINE([BROKEN_UPDWTMPX])
1132 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1133 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -07001134 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -07001135 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -07001136 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +10001137 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001138*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001139 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001140 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001141 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001142 [ --with-osfsia Enable Digital Unix SIA],
1143 [
1144 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001145 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001146 no_osfsia=1
1147 fi
1148 ],
1149 )
1150 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001151 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001152 AC_MSG_RESULT([yes])
1153 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001154 [Define if you have Digital Unix Security
1155 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001156 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001157 [Define if you don't want to use your
1158 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001159 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001160 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001161 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001162 else
Tim Rice648f8762011-01-26 12:38:57 -08001163 AC_MSG_RESULT([no])
1164 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001165 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001166 fi
1167 fi
Tim Rice648f8762011-01-26 12:38:57 -08001168 AC_DEFINE([BROKEN_GETADDRINFO])
1169 AC_DEFINE([SETEUID_BREAKS_SETUID])
1170 AC_DEFINE([BROKEN_SETREUID])
1171 AC_DEFINE([BROKEN_SETREGID])
1172 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001173 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001174
Tim Rice70335a62006-02-04 17:42:58 -08001175*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001176 AC_DEFINE([USE_PIPES])
1177 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001178 AC_DEFINE([DISABLE_LASTLOG])
1179 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1180 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001181 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001182 case "$host" in
1183 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001184 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001185 ;;
1186 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001187 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001188
1189*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001190 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
Tim Rice648f8762011-01-26 12:38:57 -08001191 AC_DEFINE([NEED_SETPGRP])
1192 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001193 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001194
1195*-*-lynxos)
Darren Tucker5faa52d2016-08-02 15:22:40 +10001196 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
1197 AC_DEFINE([BROKEN_SETVBUF], [1],
1198 [LynxOS has broken setvbuf() implementation])
1199 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001200esac
1201
Tim Rice648f8762011-01-26 12:38:57 -08001202AC_MSG_CHECKING([compiler and flags for sanity])
1203AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1204 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001205 [
Tim Rice648f8762011-01-26 12:38:57 -08001206 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001207 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001208 ],
1209 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001210)
1211
Darren Tucker0c9653f2005-05-28 15:58:14 +10001212dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001213# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001214AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001215
Tim Rice1e1ef642003-09-11 22:19:31 -07001216dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001217AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1218 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001219 AC_CACHE_CHECK([for broken dirname],
1220 ac_cv_have_broken_dirname, [
1221 save_LIBS="$LIBS"
1222 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001223 AC_RUN_IFELSE(
1224 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001225#include <libgen.h>
1226#include <string.h>
1227
1228int main(int argc, char **argv) {
1229 char *s, buf[32];
1230
1231 strncpy(buf,"/etc", 32);
1232 s = dirname(buf);
1233 if (!s || strncmp(s, "/", 32) != 0) {
1234 exit(1);
1235 } else {
1236 exit(0);
1237 }
1238}
Darren Tucker314d89e2005-10-17 23:29:23 +10001239 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001240 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001241 [ ac_cv_have_broken_dirname="yes" ],
1242 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001243 )
1244 LIBS="$save_LIBS"
1245 ])
1246 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1247 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001248 AC_DEFINE([HAVE_DIRNAME])
1249 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001250 fi
1251 ])
1252])
1253
Tim Rice648f8762011-01-26 12:38:57 -08001254AC_CHECK_FUNC([getspnam], ,
1255 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1256AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1257 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001258
Tim Rice13aae5e2001-10-21 17:53:58 -07001259dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001260AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001261 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001262 [ if test "x$withval" = "xno" ; then
1263 AC_MSG_ERROR([*** zlib is required ***])
1264 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001265 if test -d "$withval/lib"; then
1266 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001267 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001268 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001269 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001270 fi
1271 else
1272 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001273 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001274 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001275 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001276 fi
1277 fi
1278 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001279 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001280 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001281 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001282 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001283 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001284)
1285
Tim Rice648f8762011-01-26 12:38:57 -08001286AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1287AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001288 [
1289 saved_CPPFLAGS="$CPPFLAGS"
1290 saved_LDFLAGS="$LDFLAGS"
1291 save_LIBS="$LIBS"
1292 dnl Check default zlib install dir
1293 if test -n "${need_dash_r}"; then
1294 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1295 else
1296 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1297 fi
1298 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1299 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001300 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001301 [
1302 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1303 ]
1304 )
1305 ]
1306)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001307
Tim Rice648f8762011-01-26 12:38:57 -08001308AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001309 [ --without-zlib-version-check Disable zlib version check],
1310 [ if test "x$withval" = "xno" ; then
1311 zlib_check_nonfatal=1
1312 fi
1313 ]
1314)
1315
Tim Rice648f8762011-01-26 12:38:57 -08001316AC_MSG_CHECKING([for possibly buggy zlib])
1317AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001318#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001319#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001320#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001321 ]],
1322 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001323 int a=0, b=0, c=0, d=0, n, v;
1324 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1325 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001326 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001327 v = a*1000000 + b*10000 + c*100 + d;
1328 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1329
1330 /* 1.1.4 is OK */
1331 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001332 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001333
Darren Tucker41097ed2005-07-25 15:24:21 +10001334 /* 1.2.3 and up are OK */
1335 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001336 exit(0);
1337
Darren Tucker2dcd2392004-01-23 17:13:33 +11001338 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001339 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001340 AC_MSG_RESULT([no]),
1341 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001342 if test -z "$zlib_check_nonfatal" ; then
1343 AC_MSG_ERROR([*** zlib too old - check config.log ***
1344Your reported zlib version has known security problems. It's possible your
1345vendor has fixed these problems without changing the version number. If you
1346are sure this is the case, you can disable the check by running
1347"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001348If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001349See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001350 else
1351 AC_MSG_WARN([zlib version may have security problems])
1352 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001353 ],
1354 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001355)
Damien Miller6f9c3372000-10-25 10:06:04 +11001356
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001357dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001358AC_CHECK_FUNC([strcasecmp],
1359 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001360)
Tim Rice648f8762011-01-26 12:38:57 -08001361AC_CHECK_FUNCS([utimes],
1362 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001363 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001364)
Damien Millerab18c411999-11-11 10:40:23 +11001365
Tim Ricee589a292001-11-03 11:09:32 -08001366dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001367AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001368AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001369AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001370AC_SEARCH_LIBS([login], [util bsd])
1371AC_SEARCH_LIBS([logout], [util bsd])
1372AC_SEARCH_LIBS([logwtmp], [util bsd])
1373AC_SEARCH_LIBS([openpty], [util bsd])
1374AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001375AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001376
Darren Tucker2fee9092016-02-17 09:48:15 +11001377# On some platforms, inet_ntop and gethostbyname may be found in libresolv
1378# or libnsl.
Damien Millerab039492014-01-28 15:07:10 +11001379AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
Darren Tucker2fee9092016-02-17 09:48:15 +11001380AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
Damien Millerab039492014-01-28 15:07:10 +11001381
Darren Tucker74c1c362017-09-27 07:44:41 +10001382# "Particular Function Checks"
1383# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html
Ben Lindstrom8697e082001-02-24 21:41:10 +00001384AC_FUNC_STRFTIME
Darren Tucker74c1c362017-09-27 07:44:41 +10001385AC_FUNC_MALLOC
1386AC_FUNC_REALLOC
1387# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL;
Darren Tuckere9dede02018-02-25 10:20:31 +11001388AC_MSG_CHECKING([if calloc(0, N) returns non-null])
1389AC_RUN_IFELSE(
1390 [AC_LANG_PROGRAM(
1391 [[ #include <stdlib.h> ]],
1392 [[ void *p = calloc(0, 1); exit(p == NULL); ]]
1393 )],
1394 [ func_calloc_0_nonnull=yes ],
1395 [ func_calloc_0_nonnull=no ],
1396 [ AC_MSG_WARN([cross compiling: assuming same as malloc])
1397 func_calloc_0_nonnull="$ac_cv_func_malloc_0_nonnull"]
1398)
1399AC_MSG_RESULT([$func_calloc_0_nonnull])
1400
Darren Tuckerd97874c2018-04-13 13:43:55 +10001401if test "x$func_calloc_0_nonnull" = "xyes"; then
Darren Tuckere9dede02018-02-25 10:20:31 +11001402 AC_DEFINE(HAVE_CALLOC, 1, [calloc(0, x) returns non-null])
1403else
1404 AC_DEFINE(HAVE_CALLOC, 0, [calloc(0, x) returns NULL])
Darren Tucker74c1c362017-09-27 07:44:41 +10001405 AC_DEFINE(calloc, rpl_calloc,
1406 [Define to rpl_calloc if the replacement function should be used.])
1407fi
Ben Lindstrom8697e082001-02-24 21:41:10 +00001408
Damien Miller3c027682001-03-14 11:39:45 +11001409# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001410AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1411AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001412 [
1413 #include <glob.h>
1414 #ifdef GLOB_ALTDIRFUNC
1415 FOUNDIT
1416 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001417 ],
Damien Miller3c027682001-03-14 11:39:45 +11001418 [
Tim Rice648f8762011-01-26 12:38:57 -08001419 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001420 [Define if your system glob() function has
1421 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001422 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001423 ],
1424 [
Tim Rice648f8762011-01-26 12:38:57 -08001425 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001426 ]
1427)
Damien Millerab18c411999-11-11 10:40:23 +11001428
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001429# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001430AC_MSG_CHECKING([for gl_matchc field in glob_t])
1431AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1432 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001433 [
Tim Rice648f8762011-01-26 12:38:57 -08001434 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001435 [Define if your system glob() function has
1436 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001437 AC_MSG_RESULT([yes])
1438 ], [
1439 AC_MSG_RESULT([no])
1440])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001441
Damien Millera6e121a2010-10-07 21:39:17 +11001442# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001443AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1444AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001445#ifndef GLOB_KEEPSTAT
1446#error "glob does not support GLOB_KEEPSTAT extension"
1447#endif
1448glob_t g;
1449g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001450]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001451 [
Tim Rice648f8762011-01-26 12:38:57 -08001452 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001453 [Define if your system glob() function has
1454 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001455 AC_MSG_RESULT([yes])
1456 ], [
1457 AC_MSG_RESULT([no])
Damien Miller72ef7c12015-01-15 02:21:31 +11001458
Tim Rice648f8762011-01-26 12:38:57 -08001459])
Damien Millera6e121a2010-10-07 21:39:17 +11001460
Tim Rice648f8762011-01-26 12:38:57 -08001461AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001462
Darren Tucker7df91b02016-07-14 12:25:24 +10001463AC_CHECK_DECL([VIS_ALL], ,
1464 AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
1465
Damien Miller18bb4732001-03-28 14:35:30 +10001466AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001467AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001468 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001469#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001470#include <dirent.h>]],
1471 [[
1472 struct dirent d;
1473 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001474 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001475 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001476 [
Tim Rice648f8762011-01-26 12:38:57 -08001477 AC_MSG_RESULT([no])
1478 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001479 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001480 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001481 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001482 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001483 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001484 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001485 ]
1486)
1487
Damien Miller36f49652004-08-15 18:40:59 +10001488AC_MSG_CHECKING([for /proc/pid/fd directory])
1489if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001490 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1491 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001492else
Tim Rice648f8762011-01-26 12:38:57 -08001493 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001494fi
1495
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001496# Check whether user wants to use ldns
1497LDNS_MSG="no"
1498AC_ARG_WITH(ldns,
1499 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
Damien Miller523db852017-02-03 16:01:22 +11001500 [
1501 ldns=""
1502 if test "x$withval" = "xyes" ; then
1503 AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no])
Darren Tuckerf001de82017-12-11 13:42:51 +11001504 if test "x$LDNSCONFIG" = "xno"; then
Damien Miller523db852017-02-03 16:01:22 +11001505 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1506 LDFLAGS="$LDFLAGS -L${withval}/lib"
1507 LIBS="-lldns $LIBS"
1508 ldns=yes
1509 else
1510 LIBS="$LIBS `$LDNSCONFIG --libs`"
1511 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`"
Darren Tucker7af27bf2017-03-24 09:44:56 +11001512 ldns=yes
Damien Miller523db852017-02-03 16:01:22 +11001513 fi
1514 elif test "x$withval" != "xno" ; then
1515 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1516 LDFLAGS="$LDFLAGS -L${withval}/lib"
1517 LIBS="-lldns $LIBS"
1518 ldns=yes
1519 fi
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001520
Damien Miller523db852017-02-03 16:01:22 +11001521 # Verify that it works.
1522 if test "x$ldns" = "xyes" ; then
1523 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1524 LDNS_MSG="yes"
1525 AC_MSG_CHECKING([for ldns support])
1526 AC_LINK_IFELSE(
1527 [AC_LANG_SOURCE([[
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001528#include <stdio.h>
1529#include <stdlib.h>
1530#include <stdint.h>
1531#include <ldns/ldns.h>
1532int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
Damien Miller523db852017-02-03 16:01:22 +11001533 ]])
1534 ],
1535 [AC_MSG_RESULT(yes)],
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001536 [
1537 AC_MSG_RESULT(no)
1538 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1539 ])
Damien Miller523db852017-02-03 16:01:22 +11001540 fi
1541])
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001542
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001543# Check whether user wants libedit support
1544LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001545AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001546 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001547 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001548 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001549 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001550 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001551 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Tim Ricee1d93702016-05-31 11:13:22 -07001552 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001553 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001554 use_pkgconfig_for_libedit=yes
1555 else
Tim Rice648f8762011-01-26 12:38:57 -08001556 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001557 fi
1558 fi
1559 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001560 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1561 if test -n "${need_dash_r}"; then
1562 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1563 else
1564 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1565 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001566 fi
Damien Miller1f789802010-10-11 22:35:22 +11001567 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001568 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001569 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1570 else
1571 LIBEDIT="-ledit -lcurses"
1572 fi
1573 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001574 AC_CHECK_LIB([edit], [el_init],
1575 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001576 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001577 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001578 ],
Tim Rice648f8762011-01-26 12:38:57 -08001579 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001580 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001581 )
Tim Rice648f8762011-01-26 12:38:57 -08001582 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001583 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001584 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1585 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001586 int i = H_SETSIZE;
1587 el_init("", NULL, NULL, NULL);
1588 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001589 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001590 [ AC_MSG_RESULT([yes]) ],
1591 [ AC_MSG_RESULT([no])
1592 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001593 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001594 fi ]
1595)
1596
Darren Tuckerd9f88912005-02-20 21:01:48 +11001597AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001598AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001599 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001600 [
Tim Rice648f8762011-01-26 12:38:57 -08001601 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001602 case "$withval" in
1603 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001604 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001605 AUDIT_MODULE=bsm
1606 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001607 AC_CHECK_HEADERS([bsm/audit.h], [],
1608 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001609 [
1610#ifdef HAVE_TIME_H
1611# include <time.h>
1612#endif
1613 ]
1614)
Tim Rice648f8762011-01-26 12:38:57 -08001615 AC_CHECK_LIB([bsm], [getaudit], [],
1616 [AC_MSG_ERROR([BSM enabled and required library not found])])
1617 AC_CHECK_FUNCS([getaudit], [],
1618 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001619 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001620 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1621 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001622 if test "$sol2ver" -ge 11; then
Tim Ricee1d93702016-05-31 11:13:22 -07001623 SSHDLIBS="$SSHDLIBS -lscf"
1624 AC_DEFINE([BROKEN_BSM_API], [1],
1625 [The system has incomplete BSM API])
Darren Tucker93a2d412012-02-24 10:40:41 +11001626 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001627 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001628 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001629 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001630 AUDIT_MODULE=linux
1631 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001632 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001633 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001634 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001635 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001636 debug)
1637 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001638 AC_MSG_RESULT([debug])
1639 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001640 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001641 no)
Tim Rice648f8762011-01-26 12:38:57 -08001642 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001643 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001644 *)
1645 AC_MSG_ERROR([Unknown audit module $withval])
1646 ;;
1647 esac ]
1648)
1649
Darren Tucker096118d2014-01-21 12:48:51 +11001650AC_ARG_WITH([pie],
Damien Miller76c04802015-01-13 19:38:18 +11001651 [ --with-pie Build Position Independent Executables if possible], [
Darren Tucker096118d2014-01-21 12:48:51 +11001652 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001653 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001654 fi
1655 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001656 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001657 fi
1658 ]
1659)
Damien Miller852472a2014-01-22 16:31:18 +11001660if test "x$use_pie" = "x"; then
1661 use_pie=no
1662fi
1663if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1664 # Turn off automatic PIE when toolchain hardening is off.
1665 use_pie=no
1666fi
Damien Millerc161fc92014-01-29 21:01:33 +11001667if test "x$use_pie" = "xauto"; then
Damien Miller852472a2014-01-22 16:31:18 +11001668 # Automatic PIE requires gcc >= 4.x
1669 AC_MSG_CHECKING([for gcc >= 4.x])
1670 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1671#if !defined(__GNUC__) || __GNUC__ < 4
1672#error gcc is too old
1673#endif
1674]])],
1675 [ AC_MSG_RESULT([yes]) ],
1676 [ AC_MSG_RESULT([no])
1677 use_pie=no ]
1678)
1679fi
1680if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001681 SAVED_CFLAGS="$CFLAGS"
1682 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001683 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1684 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001685 # We use both -fPIE and -pie or neither.
1686 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1687 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1688 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1689 AC_MSG_RESULT([yes])
1690 else
1691 AC_MSG_RESULT([no])
1692 CFLAGS="$SAVED_CFLAGS"
1693 LDFLAGS="$SAVED_LDFLAGS"
1694 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001695fi
1696
Damien Millerfe1f1432003-02-24 15:45:42 +11001697dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001698AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001699 Blowfish_initstate \
1700 Blowfish_expandstate \
1701 Blowfish_expand0state \
1702 Blowfish_stream2word \
Damien Miller57f39152005-11-24 19:58:19 +11001703 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001704 b64_ntop \
1705 __b64_ntop \
1706 b64_pton \
1707 __b64_pton \
1708 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001709 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001710 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001711 blf_enc \
Darren Tuckera9004422018-02-24 20:25:22 +11001712 bzero \
Damien Millerc96d8532014-01-25 13:12:28 +11001713 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001714 clock \
1715 closefrom \
1716 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001717 endgrent \
Darren Tucker6310ef22016-07-13 14:42:35 +10001718 err \
1719 errx \
Damien Miller1d2c4562014-02-04 11:18:20 +11001720 explicit_bzero \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001721 fchmod \
1722 fchown \
Darren Tuckercd3ab572018-02-26 14:37:06 +11001723 flock \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001724 freeaddrinfo \
Damien Millerb7956912017-09-19 12:29:23 +10001725 freezero \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001726 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001727 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001728 futimes \
1729 getaddrinfo \
1730 getcwd \
1731 getgrouplist \
Darren Tucker6301e6c2018-07-02 21:16:58 +10001732 getline \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001733 getnameinfo \
1734 getopt \
Damien Miller151c6e42017-06-01 15:25:13 +10001735 getpagesize \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001736 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001737 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001738 getpgid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001739 _getpty \
1740 getrlimit \
Damien Millerafa6e792018-04-13 13:31:42 +10001741 getrandom \
Darren Tuckerb39593a2018-02-25 13:25:15 +11001742 getsid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001743 getttyent \
1744 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001745 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001746 inet_aton \
1747 inet_ntoa \
1748 inet_ntop \
1749 innetgr \
Darren Tuckerd38f05d2017-03-20 13:38:27 +11001750 llabs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001751 login_getcapbool \
1752 md5_crypt \
1753 memmove \
Damien Miller3d673d12014-08-27 06:32:01 +10001754 memset_s \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001755 mkdtemp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001756 ngetaddrinfo \
1757 nsleep \
1758 ogetaddrinfo \
1759 openlog_r \
Darren Tucker3ddd15e2015-11-30 07:23:53 +11001760 pledge \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001761 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001762 prctl \
1763 pstat \
Darren Tucker6c8c9a62018-02-24 20:46:37 +11001764 raise \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001765 readpassphrase \
Darren Tucker642652d2014-12-10 01:32:23 +11001766 reallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001767 recvmsg \
Damien Miller151c6e42017-06-01 15:25:13 +10001768 recallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001769 rresvport_af \
1770 sendmsg \
1771 setdtablesize \
1772 setegid \
1773 setenv \
1774 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001775 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001776 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001777 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001778 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001779 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001780 setpcred \
1781 setproctitle \
1782 setregid \
1783 setreuid \
1784 setrlimit \
1785 setsid \
1786 setvbuf \
1787 sigaction \
1788 sigvec \
1789 snprintf \
1790 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001791 statfs \
1792 statvfs \
Darren Tuckerafec0772016-12-13 10:23:03 +11001793 strcasestr \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001794 strdup \
1795 strerror \
1796 strlcat \
1797 strlcpy \
1798 strmode \
Darren Tucker33561e62018-03-03 14:56:09 +11001799 strndup \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001800 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001801 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001802 strptime \
Darren Tucker44fc3342017-09-25 09:48:10 +10001803 strsignal \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001804 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001805 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001806 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001807 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001808 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001809 sysconf \
1810 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001811 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001812 truncate \
1813 unsetenv \
1814 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001815 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001816 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001817 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001818 vsnprintf \
1819 waitpid \
Darren Tucker6310ef22016-07-13 14:42:35 +10001820 warn \
Tim Rice648f8762011-01-26 12:38:57 -08001821])
Tim Rice13aae5e2001-10-21 17:53:58 -07001822
Darren Tuckera9004422018-02-24 20:25:22 +11001823AC_CHECK_DECLS([bzero])
1824
Darren Tuckerc61d5ec2017-02-03 14:10:34 +11001825dnl Wide character support.
Darren Tuckera2333582016-07-14 10:59:09 +10001826AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth])
Darren Tuckera2333582016-07-14 10:59:09 +10001827
Darren Tucker10e290e2016-12-13 13:51:32 +11001828TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes}
Darren Tucker47b8c992016-12-08 15:48:34 +11001829AC_MSG_CHECKING([for utf8 locale support])
1830AC_RUN_IFELSE(
1831 [AC_LANG_PROGRAM([[
1832#include <locale.h>
Darren Tuckerc3599502016-12-09 12:52:02 +11001833#include <stdlib.h>
Darren Tucker47b8c992016-12-08 15:48:34 +11001834 ]], [[
1835 char *loc = setlocale(LC_CTYPE, "en_US.UTF-8");
1836 if (loc != NULL)
1837 exit(0);
1838 exit(1);
1839 ]])],
1840 AC_MSG_RESULT(yes),
1841 [AC_MSG_RESULT(no)
1842 TEST_SSH_UTF8=no],
1843 AC_MSG_WARN([cross compiling: assuming yes])
1844)
1845
Tim Ricec7a8af02010-11-08 14:26:23 -08001846AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001847 [AC_LANG_PROGRAM(
1848 [[ #include <ctype.h> ]],
1849 [[ return (isblank('a')); ]])],
1850 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001851])
1852
Damien Miller5fbe93f2016-07-15 13:54:31 +10001853disable_pkcs11=
1854AC_ARG_ENABLE([pkcs11],
1855 [ --disable-pkcs11 disable PKCS#11 support code [no]],
1856 [
1857 if test "x$enableval" = "xno" ; then
1858 disable_pkcs11=1
1859 fi
1860 ]
1861)
1862
Damien Miller72ef7c12015-01-15 02:21:31 +11001863# PKCS11 depends on OpenSSL.
Damien Miller5fbe93f2016-07-15 13:54:31 +10001864if test "x$openssl" = "xyes" && test "x$disable_pkcs11" = "x"; then
Damien Miller72ef7c12015-01-15 02:21:31 +11001865 # PKCS#11 support requires dlopen() and co
1866 AC_SEARCH_LIBS([dlopen], [dl],
Darren Tucker146c3bd2018-02-26 12:51:29 +11001867 AC_CHECK_DECL([RTLD_NOW],
1868 AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support]),
1869 [], [#include <dlfcn.h>]
1870 )
Damien Miller72ef7c12015-01-15 02:21:31 +11001871 )
1872fi
Damien Millerb3c9f782010-02-12 10:11:34 +11001873
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001874# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001875AC_CHECK_FUNCS([gai_strerror], [
1876 AC_DEFINE([HAVE_GAI_STRERROR])
1877 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001878#include <sys/types.h>
1879#include <sys/socket.h>
1880#include <netdb.h>
1881
Tim Rice648f8762011-01-26 12:38:57 -08001882const char *gai_strerror(int);
1883 ]], [[
1884 char *str;
1885 str = gai_strerror(0);
1886 ]])], [
1887 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1888 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001889
Tim Rice648f8762011-01-26 12:38:57 -08001890AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1891 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001892
Darren Tuckera7108912013-06-02 08:18:31 +10001893AC_SEARCH_LIBS([clock_gettime], [rt],
1894 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1895
Darren Tuckerf1159b52003-07-07 19:44:01 +10001896dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001897AC_CHECK_DECL([strsep],
1898 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001899 [],
1900 [
1901#ifdef HAVE_STRING_H
1902# include <string.h>
1903#endif
1904 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001905
Darren Tuckerb2427c82003-09-10 15:22:44 +10001906dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001907AC_CHECK_DECL([tcsendbreak],
1908 [AC_DEFINE([HAVE_TCSENDBREAK])],
1909 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001910 [#include <termios.h>]
1911)
1912
Tim Rice648f8762011-01-26 12:38:57 -08001913AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001914
Tim Rice648f8762011-01-26 12:38:57 -08001915AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001916 [
1917#include <sys/types.h>
1918#include <sys/socket.h>
1919 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001920
Tim Rice648f8762011-01-26 12:38:57 -08001921AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001922 [
1923#include <sys/types.h>
1924#ifdef HAVE_SYS_STAT_H
1925# include <sys/stat.h>
1926#endif
1927#ifdef HAVE_FCNTL_H
1928# include <fcntl.h>
1929#endif
1930 ])
1931
Darren Tucker2eb40412018-02-24 21:06:48 +11001932AC_CHECK_DECLS([readv, writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001933#include <sys/types.h>
1934#include <sys/uio.h>
1935#include <unistd.h>
1936 ])
1937
Tim Rice648f8762011-01-26 12:38:57 -08001938AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001939#include <sys/param.h>
1940 ])
1941
Tim Rice648f8762011-01-26 12:38:57 -08001942AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001943#include <stddef.h>
1944 ])
1945
Darren Tuckerc7aad002013-06-02 07:18:47 +10001946# extra bits for select(2)
1947AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1948#include <sys/param.h>
1949#include <sys/types.h>
1950#ifdef HAVE_SYS_SYSMACROS_H
1951#include <sys/sysmacros.h>
1952#endif
1953#ifdef HAVE_SYS_SELECT_H
1954#include <sys/select.h>
1955#endif
1956#ifdef HAVE_SYS_TIME_H
1957#include <sys/time.h>
1958#endif
1959#ifdef HAVE_UNISTD_H
1960#include <unistd.h>
1961#endif
1962 ]])
1963AC_CHECK_TYPES([fd_mask], [], [], [[
1964#include <sys/param.h>
1965#include <sys/types.h>
1966#ifdef HAVE_SYS_SELECT_H
1967#include <sys/select.h>
1968#endif
1969#ifdef HAVE_SYS_TIME_H
1970#include <sys/time.h>
1971#endif
1972#ifdef HAVE_UNISTD_H
1973#include <unistd.h>
1974#endif
1975 ]])
1976
Tim Rice648f8762011-01-26 12:38:57 -08001977AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001978 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001979 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001980 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001981 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001982#include <stdlib.h>
1983#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001984 ]], [[
1985 errno=0;
1986 setresuid(0,0,0);
1987 if (errno==ENOSYS)
1988 exit(1);
1989 else
1990 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001991 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001992 [AC_MSG_RESULT([yes])],
1993 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001994 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001995 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001996 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001997 )
1998])
Darren Tuckere937be32003-12-17 18:53:26 +11001999
Tim Rice648f8762011-01-26 12:38:57 -08002000AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11002001 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08002002 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10002003 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002004 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11002005#include <stdlib.h>
2006#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08002007 ]], [[
2008 errno=0;
2009 setresgid(0,0,0);
2010 if (errno==ENOSYS)
2011 exit(1);
2012 else
2013 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002014 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002015 [AC_MSG_RESULT([yes])],
2016 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002017 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08002018 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002019 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11002020 )
2021])
Darren Tuckere937be32003-12-17 18:53:26 +11002022
Darren Tuckerd3e2aee2015-07-17 12:52:34 +10002023AC_CHECK_FUNCS([realpath], [
2024 dnl the sftp v3 spec says SSH_FXP_REALPATH will "canonicalize any given
2025 dnl path name", however some implementations of realpath (and some
2026 dnl versions of the POSIX spec) do not work on non-existent files,
2027 dnl so we use the OpenBSD implementation on those platforms.
2028 AC_MSG_CHECKING([if realpath works with non-existent files])
2029 AC_RUN_IFELSE(
2030 [AC_LANG_PROGRAM([[
2031#include <limits.h>
2032#include <stdlib.h>
2033#include <errno.h>
2034 ]], [[
2035 char buf[PATH_MAX];
2036 if (realpath("/opensshnonexistentfilename1234", buf) == NULL)
2037 if (errno == ENOENT)
2038 exit(1);
2039 exit(0);
2040 ]])],
2041 [AC_MSG_RESULT([yes])],
2042 [AC_DEFINE([BROKEN_REALPATH], [1],
2043 [realpath does not work with nonexistent files])
2044 AC_MSG_RESULT([no])],
2045 [AC_MSG_WARN([cross compiling: assuming working])]
2046 )
2047])
2048
Darren Tucker58fd4c52018-03-05 19:28:08 +11002049AC_MSG_CHECKING([for working fflush(NULL)])
2050AC_RUN_IFELSE(
2051 [AC_LANG_PROGRAM([[#include <stdio.h>]], [[fflush(NULL); exit(0);]])],
2052 AC_MSG_RESULT([yes]),
2053 [AC_MSG_RESULT([no])
2054 AC_DEFINE([FFLUSH_NULL_BUG], [1],
2055 [define if fflush(NULL) does not work])],
2056 AC_MSG_WARN([cross compiling: assuming working])
2057)
2058
Damien Millerad833b32000-08-23 10:46:23 +10002059dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08002060AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10002061dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08002062AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
2063AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10002064dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08002065AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
2066AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11002067dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08002068AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11002069
Tim Rice648f8762011-01-26 12:38:57 -08002070AC_CHECK_FUNC([daemon],
2071 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
2072 [AC_CHECK_LIB([bsd], [daemon],
2073 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11002074)
2075
Tim Rice648f8762011-01-26 12:38:57 -08002076AC_CHECK_FUNC([getpagesize],
2077 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002078 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08002079 [AC_CHECK_LIB([ucb], [getpagesize],
2080 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11002081)
2082
Damien Millercb170cb2000-07-01 16:52:55 +10002083# Check for broken snprintf
2084if test "x$ac_cv_func_snprintf" = "xyes" ; then
2085 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002086 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002087 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
2088 [[
2089 char b[5];
2090 snprintf(b,5,"123456789");
Tim Ricee1d93702016-05-31 11:13:22 -07002091 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10002092 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002093 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10002094 [
Tim Rice648f8762011-01-26 12:38:57 -08002095 AC_MSG_RESULT([no])
2096 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002097 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10002098 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002099 ],
2100 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10002101 )
2102fi
2103
Darren Tuckere5261272018-10-12 16:43:35 +11002104if test "x$ac_cv_func_snprintf" = "xyes" ; then
2105 AC_MSG_CHECKING([whether snprintf understands %zu])
2106 AC_RUN_IFELSE(
2107 [AC_LANG_PROGRAM([[
2108#include <sys/types.h>
2109#include <stdio.h>
2110 ]],
2111 [[
2112 size_t a = 1, b = 2;
2113 char z[128];
2114 snprintf(z, sizeof z, "%zu%zu", a, b);
2115 exit(strcmp(z, "12"));
2116 ]])],
2117 [AC_MSG_RESULT([yes])],
2118 [
2119 AC_MSG_RESULT([no])
2120 AC_DEFINE([BROKEN_SNPRINTF], [1],
2121 [snprintf does not understand %zu])
2122 ],
2123 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
2124 )
2125fi
2126
Damien Millerd244a582014-08-23 17:06:49 +10002127# We depend on vsnprintf returning the right thing on overflow: the
2128# number of characters it tried to create (as per SUSv3)
2129if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
Damien Miller57f39152005-11-24 19:58:19 +11002130 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
2131 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002132 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11002133#include <sys/types.h>
2134#include <stdio.h>
2135#include <stdarg.h>
2136
Damien Millerd244a582014-08-23 17:06:49 +10002137int x_snprintf(char *str, size_t count, const char *fmt, ...)
Damien Miller57f39152005-11-24 19:58:19 +11002138{
Damien Millerd244a582014-08-23 17:06:49 +10002139 size_t ret;
2140 va_list ap;
2141
2142 va_start(ap, fmt);
2143 ret = vsnprintf(str, count, fmt, ap);
2144 va_end(ap);
Damien Miller57f39152005-11-24 19:58:19 +11002145 return ret;
2146}
Tim Rice648f8762011-01-26 12:38:57 -08002147 ]], [[
Damien Millerd244a582014-08-23 17:06:49 +10002148char x[1];
2149if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11)
2150 return 1;
2151if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11)
2152 return 1;
2153return 0;
Tim Rice648f8762011-01-26 12:38:57 -08002154 ]])],
2155 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11002156 [
Tim Rice648f8762011-01-26 12:38:57 -08002157 AC_MSG_RESULT([no])
2158 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11002159 [Define if your snprintf is busted])
2160 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
2161 ],
2162 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
2163 )
2164fi
2165
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002166# On systems where [v]snprintf is broken, but is declared in stdio,
2167# check that the fmt argument is const char * or just char *.
2168# This is only useful for when BROKEN_SNPRINTF
2169AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08002170AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2171#include <stdio.h>
2172int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
2173 ]], [[
2174 snprintf(0, 0, 0);
2175 ]])],
2176 [AC_MSG_RESULT([yes])
2177 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002178 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08002179 [AC_MSG_RESULT([no])
2180 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002181
Damien Millerb4097182004-05-23 14:09:40 +10002182# Check for missing getpeereid (or equiv) support
2183NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11002184if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10002185 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08002186 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2187#include <sys/types.h>
2188#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2189 [ AC_MSG_RESULT([yes])
2190 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2191 ], [AC_MSG_RESULT([no])
2192 NO_PEERCHECK=1
2193 ])
Damien Millerb4097182004-05-23 14:09:40 +10002194fi
2195
Damien Millere8328192003-01-07 15:18:32 +11002196dnl see whether mkstemp() requires XXXXXX
2197if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2198AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002199AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002200 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002201#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002202 ]], [[
2203 char template[]="conftest.mkstemp-test";
2204 if (mkstemp(template) == -1)
2205 exit(1);
2206 unlink(template);
2207 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002208 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002209 [
Tim Rice648f8762011-01-26 12:38:57 -08002210 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002211 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002212 [
Tim Rice648f8762011-01-26 12:38:57 -08002213 AC_MSG_RESULT([yes])
2214 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002215 ],
2216 [
Tim Rice648f8762011-01-26 12:38:57 -08002217 AC_MSG_RESULT([yes])
2218 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002219 ]
Damien Millere8328192003-01-07 15:18:32 +11002220)
2221fi
2222
Darren Tucker70a3d552003-08-21 17:58:29 +10002223dnl make sure that openpty does not reacquire controlling terminal
2224if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002225 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002226 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002227 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002228#include <stdio.h>
2229#include <sys/fcntl.h>
2230#include <sys/types.h>
2231#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002232 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002233 pid_t pid;
2234 int fd, ptyfd, ttyfd, status;
2235
2236 pid = fork();
2237 if (pid < 0) { /* failed */
2238 exit(1);
2239 } else if (pid > 0) { /* parent */
2240 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002241 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002242 exit(WEXITSTATUS(status));
2243 else
2244 exit(2);
2245 } else { /* child */
2246 close(0); close(1); close(2);
2247 setsid();
2248 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2249 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2250 if (fd >= 0)
2251 exit(3); /* Acquired ctty: broken */
2252 else
2253 exit(0); /* Did not acquire ctty: OK */
2254 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002255 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002256 [
Tim Rice648f8762011-01-26 12:38:57 -08002257 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002258 ],
2259 [
Tim Rice648f8762011-01-26 12:38:57 -08002260 AC_MSG_RESULT([no])
2261 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002262 ],
2263 [
Tim Rice648f8762011-01-26 12:38:57 -08002264 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002265 ]
2266 )
2267fi
2268
Tim Rice8bb561b2005-03-17 16:23:19 -08002269if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2270 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002271 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002272 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002273 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002274#include <stdio.h>
2275#include <sys/socket.h>
2276#include <netdb.h>
2277#include <errno.h>
2278#include <netinet/in.h>
2279
2280#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002281 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002282 int err, sock;
2283 struct addrinfo *gai_ai, *ai, hints;
2284 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2285
2286 memset(&hints, 0, sizeof(hints));
2287 hints.ai_family = PF_UNSPEC;
2288 hints.ai_socktype = SOCK_STREAM;
2289 hints.ai_flags = AI_PASSIVE;
2290
2291 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2292 if (err != 0) {
2293 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2294 exit(1);
2295 }
2296
2297 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2298 if (ai->ai_family != AF_INET6)
2299 continue;
2300
2301 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2302 sizeof(ntop), strport, sizeof(strport),
2303 NI_NUMERICHOST|NI_NUMERICSERV);
2304
2305 if (err != 0) {
2306 if (err == EAI_SYSTEM)
2307 perror("getnameinfo EAI_SYSTEM");
2308 else
2309 fprintf(stderr, "getnameinfo failed: %s\n",
2310 gai_strerror(err));
2311 exit(2);
2312 }
2313
2314 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2315 if (sock < 0)
2316 perror("socket");
2317 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2318 if (errno == EBADF)
2319 exit(3);
2320 }
2321 }
2322 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002323 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002324 [
Tim Rice648f8762011-01-26 12:38:57 -08002325 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002326 ],
2327 [
Tim Rice648f8762011-01-26 12:38:57 -08002328 AC_MSG_RESULT([no])
2329 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002330 ],
2331 [
Tim Rice648f8762011-01-26 12:38:57 -08002332 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002333 ]
2334 )
2335fi
2336
Tim Rice8bb561b2005-03-17 16:23:19 -08002337if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2338 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002339 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002340 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002341 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002342#include <stdio.h>
2343#include <sys/socket.h>
2344#include <netdb.h>
2345#include <errno.h>
2346#include <netinet/in.h>
2347
2348#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002349 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002350 int err, sock;
2351 struct addrinfo *gai_ai, *ai, hints;
2352 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2353
2354 memset(&hints, 0, sizeof(hints));
2355 hints.ai_family = PF_UNSPEC;
2356 hints.ai_socktype = SOCK_STREAM;
2357 hints.ai_flags = AI_PASSIVE;
2358
2359 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2360 if (err != 0) {
2361 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2362 exit(1);
2363 }
2364
2365 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2366 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2367 continue;
2368
2369 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2370 sizeof(ntop), strport, sizeof(strport),
2371 NI_NUMERICHOST|NI_NUMERICSERV);
2372
2373 if (ai->ai_family == AF_INET && err != 0) {
2374 perror("getnameinfo");
2375 exit(2);
2376 }
2377 }
2378 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002379 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002380 [
Tim Rice648f8762011-01-26 12:38:57 -08002381 AC_MSG_RESULT([yes])
2382 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002383 [Define if you have a getaddrinfo that fails
2384 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002385 ],
2386 [
Tim Rice648f8762011-01-26 12:38:57 -08002387 AC_MSG_RESULT([no])
2388 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002389 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002390 [
Tim Rice648f8762011-01-26 12:38:57 -08002391 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002392 ]
2393 )
2394fi
2395
Darren Tuckere50e8c92015-02-21 15:10:33 +11002396if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2397 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2398 [#include <sys/types.h>
2399 #include <sys/socket.h>
2400 #include <netdb.h>])
2401fi
2402
Darren Tuckera56f1912004-11-02 20:30:54 +11002403if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002404 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2406 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002407 [
Tim Rice648f8762011-01-26 12:38:57 -08002408 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002409 ],
2410 [
Tim Rice648f8762011-01-26 12:38:57 -08002411 AC_MSG_RESULT([yes])
2412 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002413 [Conflicting defs for getspnam])
2414 ]
2415 )
2416fi
2417
Darren Tucker20e5e8b2016-08-02 12:16:34 +10002418dnl NetBSD added an strnvis and unfortunately made it incompatible with the
2419dnl existing one in OpenBSD and Linux's libbsd (the former having existed
2420dnl for over ten years). Despite this incompatibility being reported during
2421dnl development (see http://gnats.netbsd.org/44977) they still shipped it.
2422dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible
2423dnl implementation. Try to detect this mess, and assume the only safe option
2424dnl if we're cross compiling.
2425dnl
2426dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
2427dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
2428if test "x$ac_cv_func_strnvis" = "xyes"; then
2429 AC_MSG_CHECKING([for working strnvis])
2430 AC_RUN_IFELSE(
2431 [AC_LANG_PROGRAM([[
2432#include <signal.h>
2433#include <stdlib.h>
2434#include <string.h>
2435#include <vis.h>
2436static void sighandler(int sig) { _exit(1); }
2437 ]], [[
2438 char dst[16];
2439
2440 signal(SIGSEGV, sighandler);
2441 if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0)
2442 exit(0);
2443 exit(1)
2444 ]])],
2445 [AC_MSG_RESULT([yes])],
2446 [AC_MSG_RESULT([no])
2447 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])],
2448 [AC_MSG_WARN([cross compiling: assuming broken])
2449 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])]
2450 )
2451fi
2452
Darren Tuckerc7b5a472018-02-25 23:55:41 +11002453AC_CHECK_FUNCS([getpgrp],[
2454 AC_MSG_CHECKING([if getpgrp accepts zero args])
2455 AC_COMPILE_IFELSE(
2456 [AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])],
2457 [ AC_MSG_RESULT([yes])
2458 AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])],
2459 [ AC_MSG_RESULT([no])
2460 AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])]
2461 )
2462])
Damien Miller606f8802000-09-16 15:39:56 +11002463
Tim Riceaef73712002-05-11 13:17:42 -07002464# Search for OpenSSL
2465saved_CPPFLAGS="$CPPFLAGS"
2466saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002467AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002468 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2469 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002470 if test "x$openssl" = "xno" ; then
2471 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2472 fi
Ben Lindstrom23e13712000-10-29 22:49:19 +00002473 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002474 case "$withval" in
2475 # Relative paths
2476 ./*|../*) withval="`pwd`/$withval"
2477 esac
Tim Riceaef73712002-05-11 13:17:42 -07002478 if test -d "$withval/lib"; then
2479 if test -n "${need_dash_r}"; then
2480 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2481 else
2482 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2483 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002484 elif test -d "$withval/lib64"; then
2485 if test -n "${need_dash_r}"; then
2486 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2487 else
2488 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2489 fi
Tim Riceaef73712002-05-11 13:17:42 -07002490 else
2491 if test -n "${need_dash_r}"; then
2492 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2493 else
2494 LDFLAGS="-L${withval} ${LDFLAGS}"
2495 fi
2496 fi
2497 if test -d "$withval/include"; then
2498 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2499 else
2500 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2501 fi
Damien Millera22ba012000-03-02 23:09:20 +11002502 fi
2503 ]
2504)
Damien Millerb9c56672014-05-15 14:43:37 +10002505
Tim Rice648f8762011-01-26 12:38:57 -08002506AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002507 [ --without-openssl-header-check Disable OpenSSL version consistency check],
Damien Millerec932372002-01-22 22:16:03 +11002508 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002509 if test "x$withval" = "xno" ; then
2510 openssl_check_nonfatal=1
Damien Miller9975e482007-03-05 11:51:27 +11002511 fi
Damien Millerec932372002-01-22 22:16:03 +11002512 ]
2513)
2514
Damien Miller72ef7c12015-01-15 02:21:31 +11002515openssl_engine=no
Tim Rice648f8762011-01-26 12:38:57 -08002516AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002517 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
Damien Miller72ef7c12015-01-15 02:21:31 +11002518 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002519 if test "x$withval" != "xno" ; then
Darren Tuckerb5fa0cd2015-12-15 15:10:32 +11002520 if test "x$openssl" = "xno" ; then
2521 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2522 fi
Damien Miller72ef7c12015-01-15 02:21:31 +11002523 openssl_engine=yes
2524 fi
2525 ]
2526)
2527
2528if test "x$openssl" = "xyes" ; then
2529 LIBS="-lcrypto $LIBS"
2530 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
2531 [Define if your ssl headers are included
2532 with #include <openssl/header.h>])],
2533 [
2534 dnl Check default openssl install dir
2535 if test -n "${need_dash_r}"; then
2536 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2537 else
2538 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2539 fi
2540 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2541 AC_CHECK_HEADER([openssl/opensslv.h], ,
2542 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2543 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2544 [
2545 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2546 ]
2547 )
2548 ]
2549 )
2550
2551 # Determine OpenSSL header version
2552 AC_MSG_CHECKING([OpenSSL header version])
2553 AC_RUN_IFELSE(
2554 [AC_LANG_PROGRAM([[
Darren Tucker15605962015-11-10 11:14:47 +11002555 #include <stdlib.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002556 #include <stdio.h>
2557 #include <string.h>
2558 #include <openssl/opensslv.h>
2559 #define DATA "conftest.sslincver"
2560 ]], [[
2561 FILE *fd;
2562 int rc;
2563
2564 fd = fopen(DATA,"w");
2565 if(fd == NULL)
2566 exit(1);
2567
Darren Tuckerb3413532016-04-04 11:09:21 +10002568 if ((rc = fprintf(fd, "%08lx (%s)\n",
2569 (unsigned long)OPENSSL_VERSION_NUMBER,
2570 OPENSSL_VERSION_TEXT)) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002571 exit(1);
2572
2573 exit(0);
2574 ]])],
2575 [
2576 ssl_header_ver=`cat conftest.sslincver`
2577 AC_MSG_RESULT([$ssl_header_ver])
2578 ],
2579 [
2580 AC_MSG_RESULT([not found])
2581 AC_MSG_ERROR([OpenSSL version header not found.])
2582 ],
2583 [
2584 AC_MSG_WARN([cross compiling: not checking])
2585 ]
2586 )
2587
2588 # Determine OpenSSL library version
2589 AC_MSG_CHECKING([OpenSSL library version])
2590 AC_RUN_IFELSE(
2591 [AC_LANG_PROGRAM([[
2592 #include <stdio.h>
2593 #include <string.h>
2594 #include <openssl/opensslv.h>
2595 #include <openssl/crypto.h>
2596 #define DATA "conftest.ssllibver"
2597 ]], [[
2598 FILE *fd;
2599 int rc;
2600
2601 fd = fopen(DATA,"w");
2602 if(fd == NULL)
2603 exit(1);
2604
Darren Tucker815bcac2016-04-04 11:07:59 +10002605 if ((rc = fprintf(fd, "%08lx (%s)\n", (unsigned long)SSLeay(),
2606 SSLeay_version(SSLEAY_VERSION))) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002607 exit(1);
2608
2609 exit(0);
2610 ]])],
2611 [
2612 ssl_library_ver=`cat conftest.ssllibver`
2613 # Check version is supported.
2614 case "$ssl_library_ver" in
Damien Milleraede1c32018-10-17 11:01:20 +11002615 10000*|0*)
2616 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
2617 ;;
2618 100*) ;; # 1.0.x
2619 101000[0123456]*)
2620 # https://github.com/openssl/openssl/pull/4613
2621 AC_MSG_ERROR([OpenSSL 1.1.x versions prior to 1.1.0g have a bug that breaks their use with OpenSSH (have "$ssl_library_ver")])
2622 ;;
2623 101*) ;; # 1.1.x
2624 200*) ;; # LibreSSL
2625 *)
2626 AC_MSG_ERROR([OpenSSL > 1.1.x is not yet supported (have "$ssl_library_ver")])
2627 ;;
Damien Miller72ef7c12015-01-15 02:21:31 +11002628 esac
2629 AC_MSG_RESULT([$ssl_library_ver])
2630 ],
2631 [
2632 AC_MSG_RESULT([not found])
2633 AC_MSG_ERROR([OpenSSL library not found.])
2634 ],
2635 [
2636 AC_MSG_WARN([cross compiling: not checking])
2637 ]
2638 )
2639
2640 # Sanity check OpenSSL headers
2641 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2642 AC_RUN_IFELSE(
2643 [AC_LANG_PROGRAM([[
2644 #include <string.h>
2645 #include <openssl/opensslv.h>
Darren Tuckerc1d7e542015-12-15 14:27:09 +11002646 #include <openssl/crypto.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002647 ]], [[
2648 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2649 ]])],
2650 [
2651 AC_MSG_RESULT([yes])
2652 ],
2653 [
2654 AC_MSG_RESULT([no])
2655 if test "x$openssl_check_nonfatal" = "x"; then
2656 AC_MSG_ERROR([Your OpenSSL headers do not match your
2657 library. Check config.log for details.
2658 If you are sure your installation is consistent, you can disable the check
2659 by running "./configure --without-openssl-header-check".
2660 Also see contrib/findssl.sh for help identifying header/library mismatches.
2661 ])
2662 else
2663 AC_MSG_WARN([Your OpenSSL headers do not match your
2664 library. Check config.log for details.
2665 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2666 fi
2667 ],
2668 [
2669 AC_MSG_WARN([cross compiling: not checking])
2670 ]
2671 )
2672
2673 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2674 AC_LINK_IFELSE(
2675 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2676 [[ SSLeay_add_all_algorithms(); ]])],
2677 [
2678 AC_MSG_RESULT([yes])
2679 ],
2680 [
2681 AC_MSG_RESULT([no])
2682 saved_LIBS="$LIBS"
2683 LIBS="$LIBS -ldl"
2684 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2685 AC_LINK_IFELSE(
2686 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2687 [[ SSLeay_add_all_algorithms(); ]])],
2688 [
2689 AC_MSG_RESULT([yes])
2690 ],
2691 [
2692 AC_MSG_RESULT([no])
2693 LIBS="$saved_LIBS"
2694 ]
2695 )
2696 ]
2697 )
2698
2699 AC_CHECK_FUNCS([ \
2700 BN_is_prime_ex \
2701 DSA_generate_parameters_ex \
2702 EVP_DigestInit_ex \
2703 EVP_DigestFinal_ex \
2704 EVP_MD_CTX_init \
2705 EVP_MD_CTX_cleanup \
2706 EVP_MD_CTX_copy_ex \
2707 HMAC_CTX_init \
2708 RSA_generate_key_ex \
2709 RSA_get_default_method \
2710 ])
2711
2712 if test "x$openssl_engine" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002713 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2714 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002715 #include <openssl/engine.h>
Tim Rice648f8762011-01-26 12:38:57 -08002716 ]], [[
Damien Miller72ef7c12015-01-15 02:21:31 +11002717 ENGINE_load_builtin_engines();
2718 ENGINE_register_all_complete();
Tim Rice648f8762011-01-26 12:38:57 -08002719 ]])],
2720 [ AC_MSG_RESULT([yes])
2721 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002722 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002723 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2724 ])
Damien Miller72ef7c12015-01-15 02:21:31 +11002725 fi
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002726
Damien Miller72ef7c12015-01-15 02:21:31 +11002727 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2728 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2729 AC_LINK_IFELSE(
Darren Tucker37bcef52013-11-09 18:39:25 +11002730 [AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002731 #include <string.h>
2732 #include <openssl/evp.h>
2733 ]], [[
2734 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2735 ]])],
2736 [
2737 AC_MSG_RESULT([no])
2738 ],
2739 [
2740 AC_MSG_RESULT([yes])
2741 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2742 [libcrypto is missing AES 192 and 256 bit functions])
2743 ]
2744 )
2745
2746 # Check for OpenSSL with EVP_aes_*ctr
2747 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2748 AC_LINK_IFELSE(
2749 [AC_LANG_PROGRAM([[
2750 #include <string.h>
2751 #include <openssl/evp.h>
2752 ]], [[
2753 exit(EVP_aes_128_ctr() == NULL ||
2754 EVP_aes_192_cbc() == NULL ||
2755 EVP_aes_256_cbc() == NULL);
2756 ]])],
2757 [
2758 AC_MSG_RESULT([yes])
2759 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2760 [libcrypto has EVP AES CTR])
2761 ],
2762 [
2763 AC_MSG_RESULT([no])
2764 ]
2765 )
2766
2767 # Check for OpenSSL with EVP_aes_*gcm
2768 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2769 AC_LINK_IFELSE(
2770 [AC_LANG_PROGRAM([[
2771 #include <string.h>
2772 #include <openssl/evp.h>
2773 ]], [[
2774 exit(EVP_aes_128_gcm() == NULL ||
2775 EVP_aes_256_gcm() == NULL ||
2776 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2777 EVP_CTRL_GCM_IV_GEN == 0 ||
2778 EVP_CTRL_GCM_SET_TAG == 0 ||
2779 EVP_CTRL_GCM_GET_TAG == 0 ||
2780 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2781 ]])],
2782 [
2783 AC_MSG_RESULT([yes])
2784 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2785 [libcrypto has EVP AES GCM])
2786 ],
2787 [
2788 AC_MSG_RESULT([no])
2789 unsupported_algorithms="$unsupported_cipers \
Damien Miller679ce882016-07-15 13:44:38 +10002790 aes128-gcm@openssh.com \
2791 aes256-gcm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002792 ]
2793 )
2794
2795 AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2796 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2797 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2798
Damien Miller48f54b92018-09-13 12:13:50 +10002799 # LibreSSL/OpenSSL 1.1x API
2800 AC_SEARCH_LIBS([DH_get0_key], [crypto],
2801 [AC_DEFINE([HAVE_DH_GET0_KEY], [1],
2802 [Define if libcrypto has DH_get0_key])])
2803 AC_SEARCH_LIBS([DH_get0_pqg], [crypto],
2804 [AC_DEFINE([HAVE_DH_GET0_PQG], [1],
2805 [Define if libcrypto has DH_get0_pqg])])
2806 AC_SEARCH_LIBS([DH_set0_key], [crypto],
2807 [AC_DEFINE([HAVE_DH_SET0_KEY], [1],
2808 [Define if libcrypto has DH_set0_key])])
2809 AC_SEARCH_LIBS([DH_set_length], [crypto],
2810 [AC_DEFINE([HAVE_DH_SET_LENGTH], [1],
2811 [Define if libcrypto has DH_set_length])])
2812 AC_SEARCH_LIBS([DH_set0_pqg], [crypto],
2813 [AC_DEFINE([HAVE_DH_SET0_PQG], [1],
2814 [Define if libcrypto has DH_set0_pqg])])
2815
2816 AC_SEARCH_LIBS([DSA_get0_key], [crypto],
2817 [AC_DEFINE([HAVE_DSA_GET0_KEY], [1],
2818 [Define if libcrypto has DSA_get0_key])])
2819 AC_SEARCH_LIBS([DSA_get0_pqg], [crypto],
2820 [AC_DEFINE([HAVE_DSA_GET0_PQG], [1],
2821 [Define if libcrypto has DSA_get0_pqg])])
2822 AC_SEARCH_LIBS([DSA_set0_key], [crypto],
2823 [AC_DEFINE([HAVE_DSA_SET0_KEY], [1],
2824 [Define if libcrypto has DSA_set0_key])])
2825 AC_SEARCH_LIBS([DSA_set0_pqg], [crypto],
2826 [AC_DEFINE([HAVE_DSA_SET0_PQG], [1],
2827 [Define if libcrypto has DSA_set0_pqg])])
2828
2829 AC_SEARCH_LIBS([DSA_SIG_get0], [crypto],
2830 [AC_DEFINE([HAVE_DSA_SIG_GET0], [1],
2831 [Define if libcrypto has DSA_SIG_get0])])
2832 AC_SEARCH_LIBS([DSA_SIG_set0], [crypto],
2833 [AC_DEFINE([HAVE_DSA_SIG_SET0], [1],
2834 [Define if libcrypto has DSA_SIG_set0])])
2835
2836 AC_SEARCH_LIBS([ECDSA_SIG_get0], [crypto],
2837 [AC_DEFINE([HAVE_ECDSA_SIG_GET0], [1],
2838 [Define if libcrypto has ECDSA_SIG_get0])])
2839 AC_SEARCH_LIBS([ECDSA_SIG_set0], [crypto],
2840 [AC_DEFINE([HAVE_ECDSA_SIG_SET0], [1],
2841 [Define if libcrypto has ECDSA_SIG_set0])])
2842
2843 AC_SEARCH_LIBS([EVP_CIPHER_CTX_iv], [crypto],
2844 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_IV], [1],
2845 [Define if libcrypto has EVP_CIPHER_CTX_iv])])
2846 AC_SEARCH_LIBS([EVP_CIPHER_CTX_iv_noconst], [crypto],
2847 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_IV_NOCONST], [1],
2848 [Define if libcrypto has EVP_CIPHER_CTX_iv_noconst])])
2849 AC_SEARCH_LIBS([EVP_CIPHER_CTX_get_iv], [crypto],
2850 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
2851 [Define if libcrypto has EVP_CIPHER_CTX_get_iv])])
2852 AC_SEARCH_LIBS([EVP_CIPHER_CTX_set_iv], [crypto],
2853 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_GET_IV], [1],
2854 [Define if libcrypto has EVP_CIPHER_CTX_set_iv])])
2855
2856 AC_SEARCH_LIBS([RSA_get0_crt_params], [crypto],
2857 [AC_DEFINE([HAVE_RSA_GET0_CRT_PARAMS], [1],
2858 [Define if libcrypto has RSA_get0_crt_params])])
2859 AC_SEARCH_LIBS([RSA_get0_factors], [crypto],
2860 [AC_DEFINE([HAVE_RSA_GET0_FACTORS], [1],
2861 [Define if libcrypto has RSA_get0_factors])])
2862 AC_SEARCH_LIBS([RSA_get0_key], [crypto],
2863 [AC_DEFINE([HAVE_RSA_GET0_KEY], [1],
2864 [Define if libcrypto has RSA_get0_key])])
2865 AC_SEARCH_LIBS([RSA_set0_crt_params], [crypto],
2866 [AC_DEFINE([HAVE_RSA_SET0_CRT_PARAMS], [1],
2867 [Define if libcrypto has RSA_get0_srt_params])])
2868 AC_SEARCH_LIBS([RSA_set0_factors], [crypto],
2869 [AC_DEFINE([HAVE_RSA_SET0_FACTORS], [1],
2870 [Define if libcrypto has RSA_set0_factors])])
2871 AC_SEARCH_LIBS([RSA_set0_key], [crypto],
2872 [AC_DEFINE([HAVE_RSA_SET0_KEY], [1],
2873 [Define if libcrypto has RSA_set0_key])])
2874
2875 AC_SEARCH_LIBS([RSA_meth_free], [crypto],
2876 [AC_DEFINE([HAVE_RSA_METH_FREE], [1],
2877 [Define if libcrypto has RSA_meth_free])])
2878 AC_SEARCH_LIBS([RSA_meth_dup], [crypto],
2879 [AC_DEFINE([HAVE_RSA_METH_DUP], [1],
2880 [Define if libcrypto has RSA_meth_dup])])
2881 AC_SEARCH_LIBS([RSA_meth_set1_name], [crypto],
2882 [AC_DEFINE([HAVE_RSA_METH_SET1_NAME], [1],
2883 [Define if libcrypto has RSA_meth_set1_name])])
2884 AC_SEARCH_LIBS([RSA_meth_get_finish], [crypto],
2885 [AC_DEFINE([HAVE_RSA_METH_GET_FINISH], [1],
2886 [Define if libcrypto has RSA_meth_get_finish])])
2887 AC_SEARCH_LIBS([RSA_meth_set_priv_enc], [crypto],
2888 [AC_DEFINE([HAVE_RSA_METH_SET_PRIV_ENC], [1],
2889 [Define if libcrypto has RSA_meth_set_priv_enc])])
2890 AC_SEARCH_LIBS([RSA_meth_set_priv_dec], [crypto],
2891 [AC_DEFINE([HAVE_RSA_METH_SET_PRIV_DEC], [1],
2892 [Define if libcrypto has RSA_meth_set_priv_dec])])
2893 AC_SEARCH_LIBS([RSA_meth_set_finish], [crypto],
2894 [AC_DEFINE([HAVE_RSA_METH_SET_FINISH], [1],
2895 [Define if libcrypto has RSA_meth_set_finish])])
2896
2897 AC_SEARCH_LIBS([EVP_PKEY_get0_RSA], [crypto],
2898 [AC_DEFINE([HAVE_EVP_PKEY_GET0_RSA], [1],
2899 [Define if libcrypto has EVP_PKEY_get0_RSA])])
2900
2901 AC_SEARCH_LIBS([EVP_MD_CTX_new], [crypto],
2902 [AC_DEFINE([HAVE_EVP_MD_CTX_NEW], [1],
2903 [Define if libcrypto has EVP_MD_CTX_new])])
2904 AC_SEARCH_LIBS([EVP_MD_CTX_free], [crypto],
2905 [AC_DEFINE([HAVE_EVP_MD_CTX_FREE], [1],
2906 [Define if libcrypto has EVP_MD_CTX_free])])
2907
Damien Miller72ef7c12015-01-15 02:21:31 +11002908 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2909 AC_LINK_IFELSE(
2910 [AC_LANG_PROGRAM([[
2911 #include <string.h>
2912 #include <openssl/evp.h>
2913 ]], [[
2914 if(EVP_DigestUpdate(NULL, NULL,0))
2915 exit(0);
2916 ]])],
2917 [
2918 AC_MSG_RESULT([yes])
2919 ],
2920 [
2921 AC_MSG_RESULT([no])
2922 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2923 [Define if EVP_DigestUpdate returns void])
2924 ]
2925 )
2926
2927 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2928 # because the system crypt() is more featureful.
2929 if test "x$check_for_libcrypt_before" = "x1"; then
2930 AC_CHECK_LIB([crypt], [crypt])
2931 fi
2932
2933 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2934 # version in OpenSSL.
2935 if test "x$check_for_libcrypt_later" = "x1"; then
2936 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2937 fi
Damien Miller00797e82015-03-04 05:02:45 +11002938 AC_CHECK_FUNCS([crypt DES_crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002939
2940 # Search for SHA256 support in libc and/or OpenSSL
2941 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2942 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002943 hmac-sha2-256 \
2944 hmac-sha2-512 \
Damien Miller72ef7c12015-01-15 02:21:31 +11002945 diffie-hellman-group-exchange-sha256 \
Damien Miller679ce882016-07-15 13:44:38 +10002946 hmac-sha2-256-etm@openssh.com \
2947 hmac-sha2-512-etm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002948 ]
2949 )
2950 # Search for RIPE-MD support in OpenSSL
2951 AC_CHECK_FUNCS([EVP_ripemd160], ,
2952 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002953 hmac-ripemd160 \
2954 hmac-ripemd160@openssh.com \
Damien Miller72ef7c12015-01-15 02:21:31 +11002955 hmac-ripemd160-etm@openssh.com"
2956 ]
2957 )
2958
2959 # Check complete ECC support in OpenSSL
2960 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
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_X9_62_prime256v1);
2971 const EVP_MD *m = EVP_sha256(); /* We need this too */
Darren Tucker37bcef52013-11-09 18:39:25 +11002972 ]])],
2973 [ AC_MSG_RESULT([yes])
Damien Miller72ef7c12015-01-15 02:21:31 +11002974 enable_nistp256=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_secp384r1])
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_secp384r1);
2989 const EVP_MD *m = EVP_sha384(); /* We need this too */
2990 ]])],
2991 [ AC_MSG_RESULT([yes])
2992 enable_nistp384=1 ],
2993 [ AC_MSG_RESULT([no]) ]
2994 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002995
Damien Miller72ef7c12015-01-15 02:21:31 +11002996 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2997 AC_LINK_IFELSE(
2998 [AC_LANG_PROGRAM([[
2999 #include <openssl/ec.h>
3000 #include <openssl/ecdh.h>
3001 #include <openssl/ecdsa.h>
3002 #include <openssl/evp.h>
3003 #include <openssl/objects.h>
3004 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11003005 ]], [[
3006 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
3007 const EVP_MD *m = EVP_sha512(); /* We need this too */
3008 ]])],
3009 [ AC_MSG_RESULT([yes])
3010 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
3011 AC_RUN_IFELSE(
3012 [AC_LANG_PROGRAM([[
3013 #include <openssl/ec.h>
3014 #include <openssl/ecdh.h>
3015 #include <openssl/ecdsa.h>
3016 #include <openssl/evp.h>
3017 #include <openssl/objects.h>
3018 #include <openssl/opensslv.h>
3019 ]],[[
3020 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
3021 const EVP_MD *m = EVP_sha512(); /* We need this too */
3022 exit(e == NULL || m == NULL);
3023 ]])],
3024 [ AC_MSG_RESULT([yes])
3025 enable_nistp521=1 ],
3026 [ AC_MSG_RESULT([no]) ],
3027 [ AC_MSG_WARN([cross-compiling: assuming yes])
3028 enable_nistp521=1 ]
3029 )],
3030 AC_MSG_RESULT([no])
3031 )
Darren Tucker37bcef52013-11-09 18:39:25 +11003032
Damien Miller72ef7c12015-01-15 02:21:31 +11003033 COMMENT_OUT_ECC="#no ecc#"
3034 TEST_SSH_ECC=no
3035
3036 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
3037 test x$enable_nistp521 = x1; then
3038 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
3039 fi
3040 if test x$enable_nistp256 = x1; then
3041 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
3042 [libcrypto has NID_X9_62_prime256v1])
3043 TEST_SSH_ECC=yes
3044 COMMENT_OUT_ECC=""
3045 else
Damien Miller679ce882016-07-15 13:44:38 +10003046 unsupported_algorithms="$unsupported_algorithms \
3047 ecdsa-sha2-nistp256 \
3048 ecdh-sha2-nistp256 \
3049 ecdsa-sha2-nistp256-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003050 fi
3051 if test x$enable_nistp384 = x1; then
3052 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
3053 TEST_SSH_ECC=yes
3054 COMMENT_OUT_ECC=""
3055 else
Damien Miller679ce882016-07-15 13:44:38 +10003056 unsupported_algorithms="$unsupported_algorithms \
3057 ecdsa-sha2-nistp384 \
3058 ecdh-sha2-nistp384 \
3059 ecdsa-sha2-nistp384-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003060 fi
3061 if test x$enable_nistp521 = x1; then
3062 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
3063 TEST_SSH_ECC=yes
3064 COMMENT_OUT_ECC=""
3065 else
Damien Miller679ce882016-07-15 13:44:38 +10003066 unsupported_algorithms="$unsupported_algorithms \
3067 ecdh-sha2-nistp521 \
3068 ecdsa-sha2-nistp521 \
3069 ecdsa-sha2-nistp521-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11003070 fi
3071
3072 AC_SUBST([TEST_SSH_ECC])
3073 AC_SUBST([COMMENT_OUT_ECC])
3074else
3075 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Miller00797e82015-03-04 05:02:45 +11003076 AC_CHECK_FUNCS([crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11003077fi
Damien Miller6af914a2010-09-10 11:39:26 +10003078
Damien Miller00f9cd22014-07-15 10:41:38 +10003079AC_CHECK_FUNCS([ \
3080 arc4random \
3081 arc4random_buf \
3082 arc4random_stir \
3083 arc4random_uniform \
3084])
3085
Tim Rice99203ec2007-03-26 09:35:28 -07003086saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003087AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07003088 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08003089 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
3090 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Ricee1d93702016-05-31 11:13:22 -07003091 [Define if system has libiaf that supports set_id])
Tim Rice0eeaf122007-09-10 16:24:17 -07003092 ])
Tim Rice99203ec2007-03-26 09:35:28 -07003093])
3094LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11003095
3096### Configure cryptographic random number support
3097
Damien Miller10479cc2018-04-10 10:19:02 +10003098# Check whether OpenSSL seeds itself
Damien Miller72ef7c12015-01-15 02:21:31 +11003099if test "x$openssl" = "xyes" ; then
3100 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
3101 AC_RUN_IFELSE(
3102 [AC_LANG_PROGRAM([[
3103 #include <string.h>
3104 #include <openssl/rand.h>
3105 ]], [[
3106 exit(RAND_status() == 1 ? 0 : 1);
3107 ]])],
3108 [
3109 OPENSSL_SEEDS_ITSELF=yes
3110 AC_MSG_RESULT([yes])
3111 ],
3112 [
3113 AC_MSG_RESULT([no])
3114 ],
3115 [
3116 AC_MSG_WARN([cross compiling: assuming yes])
3117 # This is safe, since we will fatal() at runtime if
3118 # OpenSSL is not seeded correctly.
3119 OPENSSL_SEEDS_ITSELF=yes
3120 ]
3121 )
3122fi
Damien Miller6c21c512002-01-22 21:57:53 +11003123
Damien Millerf22019b2011-05-05 13:48:37 +10003124# PRNGD TCP socket
3125AC_ARG_WITH([prngd-port],
3126 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
3127 [
3128 case "$withval" in
3129 no)
3130 withval=""
3131 ;;
3132 [[0-9]]*)
3133 ;;
3134 *)
3135 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
3136 ;;
3137 esac
3138 if test ! -z "$withval" ; then
3139 PRNGD_PORT="$withval"
3140 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
3141 [Port number of PRNGD/EGD random number socket])
3142 fi
3143 ]
3144)
3145
3146# PRNGD Unix domain socket
3147AC_ARG_WITH([prngd-socket],
3148 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
3149 [
3150 case "$withval" in
3151 yes)
3152 withval="/var/run/egd-pool"
3153 ;;
3154 no)
3155 withval=""
3156 ;;
3157 /*)
3158 ;;
3159 *)
3160 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
3161 ;;
3162 esac
3163
3164 if test ! -z "$withval" ; then
3165 if test ! -z "$PRNGD_PORT" ; then
3166 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
3167 fi
3168 if test ! -r "$withval" ; then
3169 AC_MSG_WARN([Entropy socket is not readable])
3170 fi
3171 PRNGD_SOCKET="$withval"
3172 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
3173 [Location of PRNGD/EGD random number socket])
3174 fi
3175 ],
3176 [
3177 # Check for existing socket only if we don't have a random device already
3178 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
3179 AC_MSG_CHECKING([for PRNGD/EGD socket])
3180 # Insert other locations here
3181 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
3182 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
3183 PRNGD_SOCKET="$sock"
3184 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
3185 break;
3186 fi
3187 done
3188 if test ! -z "$PRNGD_SOCKET" ; then
3189 AC_MSG_RESULT([$PRNGD_SOCKET])
3190 else
3191 AC_MSG_RESULT([not found])
3192 fi
3193 fi
3194 ]
3195)
3196
3197# Which randomness source do we use?
3198if test ! -z "$PRNGD_PORT" ; then
3199 RAND_MSG="PRNGd port $PRNGD_PORT"
3200elif test ! -z "$PRNGD_SOCKET" ; then
3201 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
3202elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
3203 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Damien Miller72ef7c12015-01-15 02:21:31 +11003204 [Define if you want the OpenSSL internally seeded PRNG only])
Damien Millerf22019b2011-05-05 13:48:37 +10003205 RAND_MSG="OpenSSL internal ONLY"
Damien Miller72ef7c12015-01-15 02:21:31 +11003206elif test "x$openssl" = "xno" ; then
3207 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 +10003208else
3209 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])
3210fi
3211
Darren Tucker3e6bde42006-08-20 20:03:50 +10003212# Check for PAM libs
3213PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003214AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003215 [ --with-pam Enable PAM support ],
3216 [
3217 if test "x$withval" != "xno" ; then
3218 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
3219 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
3220 AC_MSG_ERROR([PAM headers not found])
3221 fi
3222
3223 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003224 AC_CHECK_LIB([dl], [dlopen], , )
3225 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
3226 AC_CHECK_FUNCS([pam_getenvlist])
3227 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003228 LIBS="$saved_LIBS"
3229
3230 PAM_MSG="yes"
3231
Darren Tucker20e9f972007-03-25 18:26:01 +10003232 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08003233 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003234 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10003235
Darren Tucker3e6bde42006-08-20 20:03:50 +10003236 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10003237 case "$LIBS" in
3238 *-ldl*)
3239 # libdl already in LIBS
3240 ;;
3241 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10003242 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10003243 ;;
3244 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10003245 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10003246 fi
3247 ]
3248)
3249
Damien Miller8bd81e12016-08-16 13:30:56 +10003250AC_ARG_WITH([pam-service],
3251 [ --with-pam-service=name Specify PAM service name ],
3252 [
3253 if test "x$withval" != "xno" && \
3254 test "x$withval" != "xyes" ; then
3255 AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE],
3256 ["$withval"], [sshd PAM service name])
3257 fi
3258 ]
3259)
3260
Darren Tucker3e6bde42006-08-20 20:03:50 +10003261# Check for older PAM
3262if test "x$PAM_MSG" = "xyes" ; then
3263 # Check PAM strerror arguments (old PAM)
3264 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08003265 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10003266#include <stdlib.h>
3267#if defined(HAVE_SECURITY_PAM_APPL_H)
3268#include <security/pam_appl.h>
3269#elif defined (HAVE_PAM_PAM_APPL_H)
3270#include <pam/pam_appl.h>
3271#endif
Tim Rice648f8762011-01-26 12:38:57 -08003272 ]], [[
3273(void)pam_strerror((pam_handle_t *)NULL, -1);
3274 ]])], [AC_MSG_RESULT([no])], [
3275 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003276 [Define if you have an old version of PAM
3277 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08003278 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003279 PAM_MSG="yes (old library)"
Damien Miller72ef7c12015-01-15 02:21:31 +11003280
Tim Rice648f8762011-01-26 12:38:57 -08003281 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003282fi
Damien Miller6c21c512002-01-22 21:57:53 +11003283
Damien Miller6482d902014-05-27 14:34:42 +10003284case "$host" in
3285*-*-cygwin*)
3286 SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER
3287 ;;
3288*)
3289 SSH_PRIVSEP_USER=sshd
3290 ;;
3291esac
Tim Rice648f8762011-01-26 12:38:57 -08003292AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00003293 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00003294 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003295 if test -n "$withval" && test "x$withval" != "xno" && \
3296 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10003297 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00003298 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08003299 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00003300)
Damien Miller6482d902014-05-27 14:34:42 +10003301if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then
3302 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER],
3303 [Cygwin function to fetch non-privileged user for privilege separation])
3304else
3305 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
3306 [non-privileged user for privilege separation])
3307fi
Tim Rice648f8762011-01-26 12:38:57 -08003308AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00003309
Damien Miller91f40d82013-02-22 11:37:00 +11003310if test "x$have_linux_no_new_privs" = "x1" ; then
3311AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
3312 #include <sys/types.h>
3313 #include <linux/seccomp.h>
3314])
3315fi
3316if test "x$have_seccomp_filter" = "x1" ; then
3317AC_MSG_CHECKING([kernel for seccomp_filter support])
3318AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3319 #include <errno.h>
3320 #include <elf.h>
3321 #include <linux/audit.h>
3322 #include <linux/seccomp.h>
3323 #include <stdlib.h>
3324 #include <sys/prctl.h>
3325 ]],
3326 [[ int i = $seccomp_audit_arch;
3327 errno = 0;
3328 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
3329 exit(errno == EFAULT ? 0 : 1); ]])],
3330 [ AC_MSG_RESULT([yes]) ], [
3331 AC_MSG_RESULT([no])
3332 # Disable seccomp filter as a target
3333 have_seccomp_filter=0
3334 ]
3335)
3336fi
3337
Damien Miller69ff1df2011-06-23 08:30:03 +10003338# Decide which sandbox style to use
3339sandbox_arg=""
3340AC_ARG_WITH([sandbox],
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003341 [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)],
Damien Miller69ff1df2011-06-23 08:30:03 +10003342 [
3343 if test "x$withval" = "xyes" ; then
3344 sandbox_arg=""
3345 else
3346 sandbox_arg="$withval"
3347 fi
3348 ]
3349)
Darren Tucker60395f92012-07-03 14:31:18 +10003350
3351# Some platforms (seems to be the ones that have a kernel poll(2)-type
3352# function with which they implement select(2)) use an extra file descriptor
3353# when calling select(2), which means we can't use the rlimit sandbox.
3354AC_MSG_CHECKING([if select works with descriptor rlimit])
3355AC_RUN_IFELSE(
3356 [AC_LANG_PROGRAM([[
3357#include <sys/types.h>
3358#ifdef HAVE_SYS_TIME_H
3359# include <sys/time.h>
3360#endif
3361#include <sys/resource.h>
3362#ifdef HAVE_SYS_SELECT_H
3363# include <sys/select.h>
3364#endif
3365#include <errno.h>
3366#include <fcntl.h>
3367#include <stdlib.h>
3368 ]],[[
3369 struct rlimit rl_zero;
3370 int fd, r;
3371 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11003372 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10003373
3374 fd = open("/dev/null", O_RDONLY);
3375 FD_ZERO(&fds);
3376 FD_SET(fd, &fds);
3377 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3378 setrlimit(RLIMIT_FSIZE, &rl_zero);
3379 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11003380 tv.tv_sec = 1;
3381 tv.tv_usec = 0;
3382 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10003383 exit (r == -1 ? 1 : 0);
3384 ]])],
3385 [AC_MSG_RESULT([yes])
3386 select_works_with_rlimit=yes],
3387 [AC_MSG_RESULT([no])
3388 select_works_with_rlimit=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003389 [AC_MSG_WARN([cross compiling: assuming yes])
3390 select_works_with_rlimit=yes]
Darren Tucker60395f92012-07-03 14:31:18 +10003391)
3392
Darren Tuckerff008de2013-03-06 17:48:48 +11003393AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
3394AC_RUN_IFELSE(
3395 [AC_LANG_PROGRAM([[
3396#include <sys/types.h>
3397#ifdef HAVE_SYS_TIME_H
3398# include <sys/time.h>
3399#endif
3400#include <sys/resource.h>
3401#include <errno.h>
3402#include <stdlib.h>
3403 ]],[[
3404 struct rlimit rl_zero;
3405 int fd, r;
3406 fd_set fds;
3407
3408 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3409 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
3410 exit (r == -1 ? 1 : 0);
3411 ]])],
3412 [AC_MSG_RESULT([yes])
3413 rlimit_nofile_zero_works=yes],
3414 [AC_MSG_RESULT([no])
3415 rlimit_nofile_zero_works=no],
Mike Frysingerdcc714c2017-05-24 23:21:19 -04003416 [AC_MSG_WARN([cross compiling: assuming yes])
3417 rlimit_nofile_zero_works=yes]
Darren Tuckerff008de2013-03-06 17:48:48 +11003418)
3419
Darren Tuckerd545a4b2012-07-03 22:48:31 +10003420AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
3421AC_RUN_IFELSE(
3422 [AC_LANG_PROGRAM([[
3423#include <sys/types.h>
3424#include <sys/resource.h>
3425#include <stdlib.h>
3426 ]],[[
3427 struct rlimit rl_zero;
3428
3429 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3430 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
3431 ]])],
3432 [AC_MSG_RESULT([yes])],
3433 [AC_MSG_RESULT([no])
3434 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3435 [setrlimit RLIMIT_FSIZE works])],
3436 [AC_MSG_WARN([cross compiling: assuming yes])]
3437)
3438
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003439if test "x$sandbox_arg" = "xpledge" || \
3440 ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then
3441 test "x$ac_cv_func_pledge" != "xyes" && \
3442 AC_MSG_ERROR([pledge sandbox requires pledge(2) support])
3443 SANDBOX_STYLE="pledge"
Damien Millerfafe1d82015-10-14 09:22:15 -07003444 AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)])
Damien Miller9846a2f2015-10-08 04:30:48 +11003445elif test "x$sandbox_arg" = "xsystrace" || \
Damien Miller69ff1df2011-06-23 08:30:03 +10003446 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003447 test "x$have_systr_policy_kill" != "x1" && \
3448 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003449 SANDBOX_STYLE="systrace"
3450 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003451elif test "x$sandbox_arg" = "xdarwin" || \
3452 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3453 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003454 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3455 "x$ac_cv_header_sandbox_h" != "xyes" && \
3456 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003457 SANDBOX_STYLE="darwin"
3458 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003459elif test "x$sandbox_arg" = "xseccomp_filter" || \
3460 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003461 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003462 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003463 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003464 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3465 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003466 test "x$have_linux_no_new_privs" = "x1" && \
3467 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003468 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003469 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3470 test "x$have_linux_no_new_privs" != "x1" && \
3471 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3472 test "x$have_seccomp_filter" != "x1" && \
3473 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3474 test "x$ac_cv_func_prctl" != "xyes" && \
3475 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3476 SANDBOX_STYLE="seccomp_filter"
3477 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003478elif test "x$sandbox_arg" = "xcapsicum" || \
3479 ( test -z "$sandbox_arg" && \
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003480 test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003481 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
Darren Tuckerdd9d9b32017-08-28 16:48:27 +10003482 test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \
3483 AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003484 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003485 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003486 SANDBOX_STYLE="capsicum"
3487 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003488elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003489 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003490 test "x$select_works_with_rlimit" = "xyes" && \
3491 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003492 test "x$ac_cv_func_setrlimit" != "xyes" && \
3493 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003494 test "x$select_works_with_rlimit" != "xyes" && \
3495 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003496 SANDBOX_STYLE="rlimit"
3497 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller4626cba2016-01-08 14:24:56 +11003498elif test "x$sandbox_arg" = "xsolaris" || \
3499 ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then
3500 SANDBOX_STYLE="solaris"
3501 AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges])
Damien Miller69ff1df2011-06-23 08:30:03 +10003502elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3503 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3504 SANDBOX_STYLE="none"
3505 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3506else
Tim Ricea6e60612011-08-17 21:48:22 -07003507 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003508fi
3509
Ben Lindstromb5628642000-10-18 00:02:25 +00003510# Cheap hack to ensure NEWS-OS libraries are arranged right.
3511if test ! -z "$SONY" ; then
3512 LIBS="$LIBS -liberty";
3513fi
3514
Damien Miller57f39152005-11-24 19:58:19 +11003515# Check for long long datatypes
3516AC_CHECK_TYPES([long long, unsigned long long, long double])
3517
3518# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003519AC_CHECK_SIZEOF([short int], [2])
3520AC_CHECK_SIZEOF([int], [4])
3521AC_CHECK_SIZEOF([long int], [4])
3522AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003523
Damien Millerfa2bb692002-04-23 23:22:25 +10003524# Sanity check long long for some platforms (AIX)
3525if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3526 ac_cv_sizeof_long_long_int=0
3527fi
3528
Darren Tucker537f1ed2005-10-25 18:38:33 +10003529# compute LLONG_MIN and LLONG_MAX if we don't know them.
3530if test -z "$have_llong_max"; then
3531 AC_MSG_CHECKING([for max value of long long])
3532 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003533 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003534#include <stdio.h>
3535/* Why is this so damn hard? */
3536#ifdef __GNUC__
3537# undef __GNUC__
3538#endif
3539#define __USE_ISOC99
3540#include <limits.h>
3541#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003542#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3543
3544/*
3545 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3546 * we do this the hard way.
3547 */
3548static int
3549fprint_ll(FILE *f, long long n)
3550{
3551 unsigned int i;
3552 int l[sizeof(long long) * 8];
3553
3554 if (n < 0)
3555 if (fprintf(f, "-") < 0)
3556 return -1;
3557 for (i = 0; n != 0; i++) {
3558 l[i] = my_abs(n % 10);
3559 n /= 10;
3560 }
3561 do {
3562 if (fprintf(f, "%d", l[--i]) < 0)
3563 return -1;
3564 } while (i != 0);
3565 if (fprintf(f, " ") < 0)
3566 return -1;
3567 return 0;
3568}
Tim Rice648f8762011-01-26 12:38:57 -08003569 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003570 FILE *f;
3571 long long i, llmin, llmax = 0;
3572
3573 if((f = fopen(DATA,"w")) == NULL)
3574 exit(1);
3575
3576#if defined(LLONG_MIN) && defined(LLONG_MAX)
3577 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3578 llmin = LLONG_MIN;
3579 llmax = LLONG_MAX;
3580#else
3581 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3582 /* This will work on one's complement and two's complement */
3583 for (i = 1; i > llmax; i <<= 1, i++)
3584 llmax = i;
3585 llmin = llmax + 1LL; /* wrap */
3586#endif
3587
3588 /* Sanity check */
3589 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003590 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3591 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003592 fprintf(f, "unknown unknown\n");
3593 exit(2);
3594 }
3595
Darren Tuckerd1450db2006-03-13 19:06:51 +11003596 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003597 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003598 if (fprint_ll(f, llmax) < 0)
3599 exit(4);
3600 if (fclose(f) < 0)
3601 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003602 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003603 ]])],
3604 [
3605 llong_min=`$AWK '{print $1}' conftest.llminmax`
3606 llong_max=`$AWK '{print $2}' conftest.llminmax`
3607
Tim Rice648f8762011-01-26 12:38:57 -08003608 AC_MSG_RESULT([$llong_max])
3609 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003610 [max value of long long calculated by configure])
3611 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003612 AC_MSG_RESULT([$llong_min])
3613 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003614 [min value of long long calculated by configure])
3615 ],
3616 [
Tim Rice648f8762011-01-26 12:38:57 -08003617 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003618 ],
3619 [
3620 AC_MSG_WARN([cross compiling: not checking])
3621 ]
3622 )
3623fi
3624
3625
Damien Millera22ba012000-03-02 23:09:20 +11003626# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003627AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3629 [[ u_int a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003630 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
Tim Rice648f8762011-01-26 12:38:57 -08003631 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003632])
3633if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003634 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003635 have_u_int=1
3636fi
3637
Damien Miller61e50f12000-05-08 20:49:37 +10003638AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003639 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3640 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003641 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003642 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003643])
3644if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003645 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003646 have_intxx_t=1
3647fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003648
3649if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003650 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003651then
3652 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003653 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3654 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003655 [
Tim Rice648f8762011-01-26 12:38:57 -08003656 AC_DEFINE([HAVE_INTXX_T])
3657 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003658 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003659 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003660fi
3661
Damien Miller578783e2000-09-23 14:12:24 +11003662AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003663 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003664#include <sys/types.h>
3665#ifdef HAVE_STDINT_H
3666# include <stdint.h>
3667#endif
3668#include <sys/socket.h>
3669#ifdef HAVE_SYS_BITYPES_H
3670# include <sys/bitypes.h>
3671#endif
Tim Rice648f8762011-01-26 12:38:57 -08003672 ]], [[
3673int64_t a; a = 1;
3674 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003675 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003676 ])
Damien Miller578783e2000-09-23 14:12:24 +11003677])
3678if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003679 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003680fi
3681
Damien Miller61e50f12000-05-08 20:49:37 +10003682AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3684 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003685 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003686 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003687])
3688if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003689 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003690 have_u_intxx_t=1
3691fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003692
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003693if test -z "$have_u_intxx_t" ; then
3694 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003695 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3696 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003697 [
Tim Rice648f8762011-01-26 12:38:57 -08003698 AC_DEFINE([HAVE_U_INTXX_T])
3699 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003700 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003701 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003702fi
3703
Damien Miller578783e2000-09-23 14:12:24 +11003704AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003705 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3706 [[ u_int64_t a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003707 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003708 ])
Damien Miller578783e2000-09-23 14:12:24 +11003709])
3710if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003711 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003712 have_u_int64_t=1
3713fi
3714
Damien Millerc2868192014-01-30 10:21:19 +11003715if (test -z "$have_u_int64_t" && \
3716 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3717then
Tim Rice4cec93f2002-02-26 08:40:48 -08003718 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003719 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3720 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003721 [
Tim Rice648f8762011-01-26 12:38:57 -08003722 AC_DEFINE([HAVE_U_INT64_T])
3723 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003724 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003725 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003726fi
3727
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003728if test -z "$have_u_intxx_t" ; then
3729 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003730 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003731#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003732 ]], [[
3733 uint8_t a;
3734 uint16_t b;
3735 uint32_t c;
3736 a = b = c = 1;
3737 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003738 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003739 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003740 ])
3741 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003742 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003743 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003744 fi
3745fi
3746
Damien Millerc2868192014-01-30 10:21:19 +11003747if (test -z "$have_uintxx_t" && \
3748 test "x$ac_cv_header_stdint_h" = "xyes")
3749then
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003750 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003751 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3752 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003753 [
Tim Rice648f8762011-01-26 12:38:57 -08003754 AC_DEFINE([HAVE_UINTXX_T])
3755 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003756 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003757 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003758fi
3759
Damien Millerc2868192014-01-30 10:21:19 +11003760if (test -z "$have_uintxx_t" && \
3761 test "x$ac_cv_header_inttypes_h" = "xyes")
3762then
Darren Tucker6d725682014-01-17 19:17:34 +11003763 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3764 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3765 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3766 [
3767 AC_DEFINE([HAVE_UINTXX_T])
3768 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003769 ], [ AC_MSG_RESULT([no])
Darren Tucker6d725682014-01-17 19:17:34 +11003770 ])
3771fi
3772
Damien Milleredb82922000-06-20 13:25:52 +10003773if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003774 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003775then
3776 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003777 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003778#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003779 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003780 int8_t a; int16_t b; int32_t c;
3781 u_int8_t e; u_int16_t f; u_int32_t g;
3782 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003783 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003784 [
Tim Rice648f8762011-01-26 12:38:57 -08003785 AC_DEFINE([HAVE_U_INTXX_T])
3786 AC_DEFINE([HAVE_INTXX_T])
3787 AC_MSG_RESULT([yes])
3788 ], [AC_MSG_RESULT([no])
3789 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003790fi
3791
Damien Miller58be7382001-09-15 21:31:54 +10003792
3793AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003794 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3795 [[ u_char foo; foo = 125; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003796 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
Tim Rice648f8762011-01-26 12:38:57 -08003797 ])
Damien Miller58be7382001-09-15 21:31:54 +10003798])
3799if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003800 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003801fi
3802
Darren Tucker007e3b32013-11-03 18:43:55 +11003803AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3804#include <sys/types.h>
3805#include <stdint.h>
3806])
3807
Tim Rice13aae5e2001-10-21 17:53:58 -07003808TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003809
Tim Rice648f8762011-01-26 12:38:57 -08003810AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3811AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003812#include <sys/types.h>
3813#ifdef HAVE_SYS_BITYPES_H
3814#include <sys/bitypes.h>
3815#endif
3816#ifdef HAVE_SYS_STATFS_H
3817#include <sys/statfs.h>
3818#endif
3819#ifdef HAVE_SYS_STATVFS_H
3820#include <sys/statvfs.h>
3821#endif
3822])
Tim Rice4cec93f2002-02-26 08:40:48 -08003823
Darren Tucker11057562018-02-25 11:22:57 +11003824AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[
3825#include <sys/types.h>
3826#ifdef HAVE_SYS_BITYPES_H
3827#include <sys/bitypes.h>
3828#endif
3829#ifdef HAVE_SYS_STATFS_H
3830#include <sys/statfs.h>
3831#endif
3832#ifdef HAVE_SYS_STATVFS_H
3833#include <sys/statvfs.h>
3834#endif
3835#ifdef HAVE_SYS_VFS_H
3836#include <sys/vfs.h>
3837#endif
3838]])
3839
3840
Tim Rice648f8762011-01-26 12:38:57 -08003841AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003842[#include <sys/types.h>
3843#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003844
Damien Miller61e50f12000-05-08 20:49:37 +10003845AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003846 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3847 [[ size_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003848 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003849 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003850])
3851if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003852 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003853fi
Damien Miller95058511999-12-29 10:36:45 +11003854
Damien Miller615f9392000-05-17 22:53:33 +10003855AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003856 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3857 [[ ssize_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003858 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003859 ])
Damien Miller615f9392000-05-17 22:53:33 +10003860])
3861if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003862 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003863fi
3864
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003865AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3867 [[ clock_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003868 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003869 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003870])
3871if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003872 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003873fi
3874
Damien Millerb54b40e2000-06-23 08:23:34 +10003875AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003876 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003877#include <sys/types.h>
3878#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003879 ]], [[ sa_family_t foo; foo = 1235; ]])],
3880 [ ac_cv_have_sa_family_t="yes" ],
3881 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003882#include <sys/types.h>
3883#include <sys/socket.h>
3884#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003885 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003886 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003887 [ ac_cv_have_sa_family_t="no" ]
3888 )
Tim Rice648f8762011-01-26 12:38:57 -08003889 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003890])
3891if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003892 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003893 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003894fi
3895
Damien Miller0f91b4e2000-06-18 15:43:25 +10003896AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003897 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3898 [[ pid_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003899 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003900 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003901])
3902if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003903 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003904fi
3905
3906AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003907 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3908 [[ mode_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003909 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003910 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003911])
3912if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003913 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003914fi
3915
Damien Miller61e50f12000-05-08 20:49:37 +10003916
3917AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003918 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003919#include <sys/types.h>
3920#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003921 ]], [[ struct sockaddr_storage s; ]])],
3922 [ ac_cv_have_struct_sockaddr_storage="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003923 [ ac_cv_have_struct_sockaddr_storage="no"
Tim Rice648f8762011-01-26 12:38:57 -08003924 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003925])
3926if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003927 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003928 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003929fi
Damien Miller34132e52000-01-14 15:45:46 +11003930
Damien Miller61e50f12000-05-08 20:49:37 +10003931AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003932 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003933#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003934#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003935 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3936 [ ac_cv_have_struct_sockaddr_in6="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003937 [ ac_cv_have_struct_sockaddr_in6="no"
Tim Rice648f8762011-01-26 12:38:57 -08003938 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003939])
3940if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003941 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003942 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003943fi
Damien Miller34132e52000-01-14 15:45:46 +11003944
Damien Miller61e50f12000-05-08 20:49:37 +10003945AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003946 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003947#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003948#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003949 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3950 [ ac_cv_have_struct_in6_addr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003951 [ ac_cv_have_struct_in6_addr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003952 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003953])
3954if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003955 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003956 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003957
3958dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003959 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003960 [
3961#ifdef HAVE_SYS_TYPES_H
3962#include <sys/types.h>
3963#endif
3964#include <netinet/in.h>
3965 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003966fi
Damien Miller34132e52000-01-14 15:45:46 +11003967
Damien Miller61e50f12000-05-08 20:49:37 +10003968AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003969 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003970#include <sys/types.h>
3971#include <sys/socket.h>
3972#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003973 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3974 [ ac_cv_have_struct_addrinfo="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003975 [ ac_cv_have_struct_addrinfo="no"
Tim Rice648f8762011-01-26 12:38:57 -08003976 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003977])
3978if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003979 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003980 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003981fi
3982
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003983AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3985 [[ struct timeval tv; tv.tv_sec = 1;]])],
3986 [ ac_cv_have_struct_timeval="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003987 [ ac_cv_have_struct_timeval="no"
Tim Rice648f8762011-01-26 12:38:57 -08003988 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003989])
3990if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003991 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003992 have_struct_timeval=1
3993fi
3994
Tim Rice648f8762011-01-26 12:38:57 -08003995AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003996
Damien Miller10479cc2018-04-10 10:19:02 +10003997# We need int64_t or else certain parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003998if test "x$ac_cv_have_int64_t" = "xno" && \
3999 test "x$ac_cv_sizeof_long_int" != "x8" && \
4000 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00004001 echo "OpenSSH requires int64_t support. Contact your vendor or install"
4002 echo "an alternative compiler (I.E., GCC) before continuing."
4003 echo ""
4004 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08004005else
4006dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10004007 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10004008 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08004009#include <stdio.h>
4010#include <string.h>
4011#ifdef HAVE_SNPRINTF
4012main()
4013{
4014 char buf[50];
4015 char expected_out[50];
4016 int mazsize = 50 ;
4017#if (SIZEOF_LONG_INT == 8)
4018 long int num = 0x7fffffffffffffff;
4019#else
Kevin Steves6482ec82001-07-15 02:09:28 +00004020 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08004021#endif
4022 strcpy(expected_out, "9223372036854775807");
4023 snprintf(buf, mazsize, "%lld", num);
4024 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11004025 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08004026 exit(0);
4027}
4028#else
4029main() { exit(0); }
4030#endif
Tim Rice648f8762011-01-26 12:38:57 -08004031 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004032 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08004033 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004034fi
4035
Damien Miller78315eb2000-09-29 23:01:36 +11004036dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08004037OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
4038OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
4039OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
4040OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
4041OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
4042OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
4043OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
4044OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
4045OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
4046OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
4047OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
4048OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
4049OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
4050OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
4051OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
4052OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
4053OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07004054
4055AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Millerbcd14852017-06-10 23:41:25 +10004056AC_CHECK_MEMBERS([struct stat.st_mtim])
4057AC_CHECK_MEMBERS([struct stat.st_mtime])
Damien Miller6332da22013-04-23 14:25:52 +10004058AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
4059struct passwd.pw_change, struct passwd.pw_expire],
4060[], [], [[
4061#include <sys/types.h>
4062#include <pwd.h>
4063]])
4064
Tim Rice648f8762011-01-26 12:38:57 -08004065AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11004066 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10004067[[
Darren Tucker58e298d2005-11-25 13:14:58 +11004068#include <stdio.h>
4069#if HAVE_SYS_TYPES_H
4070# include <sys/types.h>
4071#endif
4072#include <netinet/in.h>
4073#include <arpa/nameser.h>
4074#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10004075]])
andre2ff7b5d2000-06-03 14:57:40 +00004076
Damien Miller61e50f12000-05-08 20:49:37 +10004077AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
4078 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004079 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004080#include <sys/types.h>
4081#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004082 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
4083 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
4084 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10004085])
4086if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004087 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004088fi
4089
Damien Miller61e50f12000-05-08 20:49:37 +10004090AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
4091 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08004092 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10004093#include <sys/types.h>
4094#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08004095 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
4096 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004097 [ ac_cv_have___ss_family_in_struct_ss="no"
Tim Rice648f8762011-01-26 12:38:57 -08004098 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004099])
4100if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004101 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004102 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10004103fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11004104
Tim Rice28bbb0c2002-05-27 17:37:32 -07004105dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00004106AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
4107 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004108 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004109#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00004110#include <sys/socket.h>
4111#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004112 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004113#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10004114#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004115exit(1);
4116#endif
4117struct msghdr m;
4118m.msg_accrights = 0;
4119exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004120 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00004121 [ ac_cv_have_accrights_in_msghdr="yes" ],
4122 [ ac_cv_have_accrights_in_msghdr="no" ]
4123 )
4124])
4125if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004126 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004127 [Define if your system uses access rights style
4128 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00004129fi
4130
Tim Rice648f8762011-01-26 12:38:57 -08004131AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
4132AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10004133#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10004134#include <sys/stat.h>
4135#ifdef HAVE_SYS_TIME_H
4136# include <sys/time.h>
4137#endif
4138#ifdef HAVE_SYS_MOUNT_H
4139#include <sys/mount.h>
4140#endif
4141#ifdef HAVE_SYS_STATVFS_H
4142#include <sys/statvfs.h>
4143#endif
Tim Rice648f8762011-01-26 12:38:57 -08004144 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
4145 [ AC_MSG_RESULT([yes]) ],
4146 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10004147
Tim Rice648f8762011-01-26 12:38:57 -08004148 AC_MSG_CHECKING([if fsid_t has member val])
4149 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004150#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004151#include <sys/statvfs.h>
4152 ]], [[ fsid_t t; t.val[0] = 0; ]])],
4153 [ AC_MSG_RESULT([yes])
4154 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
4155 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004156
Tim Rice648f8762011-01-26 12:38:57 -08004157 AC_MSG_CHECKING([if f_fsid has member __val])
4158 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10004159#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08004160#include <sys/statvfs.h>
4161 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
4162 [ AC_MSG_RESULT([yes])
4163 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
4164 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10004165])
Darren Tucker77001382008-06-09 06:17:53 +10004166
Kevin Stevesa44e0352002-04-07 16:18:03 +00004167AC_CACHE_CHECK([for msg_control field in struct msghdr],
4168 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08004169 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07004170#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00004171#include <sys/socket.h>
4172#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08004173 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07004174#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10004175#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07004176exit(1);
4177#endif
4178struct msghdr m;
4179m.msg_control = 0;
4180exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08004181 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00004182 [ ac_cv_have_control_in_msghdr="yes" ],
4183 [ ac_cv_have_control_in_msghdr="no" ]
4184 )
4185])
4186if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004187 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004188 [Define if your system uses ancillary data style
4189 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00004190fi
4191
Damien Miller61e50f12000-05-08 20:49:37 +10004192AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08004193 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4194 [[ extern char *__progname; printf("%s", __progname); ]])],
4195 [ ac_cv_libc_defines___progname="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004196 [ ac_cv_libc_defines___progname="no"
Tim Rice648f8762011-01-26 12:38:57 -08004197 ])
Damien Miller61e50f12000-05-08 20:49:37 +10004198])
4199if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004200 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10004201fi
4202
Kevin Steves4846f4a2002-03-22 18:19:53 +00004203AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08004204 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4205 [[ printf("%s", __FUNCTION__); ]])],
4206 [ ac_cv_cc_implements___FUNCTION__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004207 [ ac_cv_cc_implements___FUNCTION__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004208 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004209])
4210if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004211 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004212 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004213fi
4214
4215AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08004216 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
4217 [[ printf("%s", __func__); ]])],
4218 [ ac_cv_cc_implements___func__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004219 [ ac_cv_cc_implements___func__="no"
Tim Rice648f8762011-01-26 12:38:57 -08004220 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004221])
4222if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004223 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00004224fi
4225
Damien Miller57f39152005-11-24 19:58:19 +11004226AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004227 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4228#include <stdarg.h>
4229va_list x,y;
4230 ]], [[ va_copy(x,y); ]])],
4231 [ ac_cv_have_va_copy="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004232 [ ac_cv_have_va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004233 ])
Damien Miller57f39152005-11-24 19:58:19 +11004234])
4235if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004236 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004237fi
4238
4239AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08004240 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
4241#include <stdarg.h>
4242va_list x,y;
4243 ]], [[ __va_copy(x,y); ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07004244 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004245 ])
Damien Miller57f39152005-11-24 19:58:19 +11004246])
4247if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004248 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004249fi
4250
Damien Miller4f8e6692001-07-14 13:22:53 +10004251AC_CACHE_CHECK([whether getopt has optreset support],
4252 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08004253 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
4254 [[ extern int optreset; optreset = 0; ]])],
4255 [ ac_cv_have_getopt_optreset="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004256 [ ac_cv_have_getopt_optreset="no"
Tim Rice648f8762011-01-26 12:38:57 -08004257 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10004258])
4259if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004260 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004261 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10004262fi
Damien Millera22ba012000-03-02 23:09:20 +11004263
Damien Millerecbb26d2000-07-15 14:59:14 +10004264AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08004265 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4266[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
4267 [ ac_cv_libc_defines_sys_errlist="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004268 [ ac_cv_libc_defines_sys_errlist="no"
Tim Rice648f8762011-01-26 12:38:57 -08004269 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10004270])
4271if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004272 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004273 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10004274fi
4275
4276
Damien Miller11fa2cc2000-08-16 10:35:58 +10004277AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08004278 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4279[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
4280 [ ac_cv_libc_defines_sys_nerr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004281 [ ac_cv_libc_defines_sys_nerr="no"
Tim Rice648f8762011-01-26 12:38:57 -08004282 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004283])
4284if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004285 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004286fi
4287
Darren Tucker5f88d342003-10-15 16:57:57 +10004288# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08004289AC_SEARCH_LIBS([getrrsetbyname], [resolv],
4290 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004291 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10004292 [
Darren Tucker5f88d342003-10-15 16:57:57 +10004293 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08004294 AC_SEARCH_LIBS([res_query], [resolv])
4295 AC_SEARCH_LIBS([dn_expand], [resolv])
4296 AC_MSG_CHECKING([if res_query will link])
4297 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004298#include <sys/types.h>
4299#include <netinet/in.h>
4300#include <arpa/nameser.h>
4301#include <netdb.h>
4302#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004303 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004304 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004305 ]])],
4306 AC_MSG_RESULT([yes]),
4307 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10004308 saved_LIBS="$LIBS"
4309 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08004310 AC_MSG_CHECKING([for res_query in -lresolv])
4311 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004312#include <sys/types.h>
4313#include <netinet/in.h>
4314#include <arpa/nameser.h>
4315#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10004316#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004317 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10004318 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004319 ]])],
4320 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10004321 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004322 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10004323 ])
Tim Rice648f8762011-01-26 12:38:57 -08004324 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10004325 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07004326 [#include <sys/types.h>
4327 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08004328 AC_CHECK_MEMBER([HEADER.ad],
4329 [AC_DEFINE([HAVE_HEADER_AD], [1],
4330 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10004331 [#include <arpa/nameser.h>])
4332 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10004333
Tim Rice648f8762011-01-26 12:38:57 -08004334AC_MSG_CHECKING([if struct __res_state _res is an extern])
4335AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004336#include <stdio.h>
4337#if HAVE_SYS_TYPES_H
4338# include <sys/types.h>
4339#endif
4340#include <netinet/in.h>
4341#include <arpa/nameser.h>
4342#include <resolv.h>
4343extern struct __res_state _res;
Darren Tucker7ad8b282015-09-11 13:11:02 +10004344 ]], [[
4345struct __res_state *volatile p = &_res; /* force resolution of _res */
4346return 0;
4347 ]],)],
Tim Rice648f8762011-01-26 12:38:57 -08004348 [AC_MSG_RESULT([yes])
4349 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004350 [Define if you have struct __res_state _res as an extern])
4351 ],
Tim Rice648f8762011-01-26 12:38:57 -08004352 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004353)
4354
Damien Miller73b42d22006-04-22 21:26:08 +10004355# Check whether user wants SELinux support
4356SELINUX_MSG="no"
4357LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08004358AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11004359 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10004360 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10004361 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004362 AC_DEFINE([WITH_SELINUX], [1],
4363 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10004364 SELINUX_MSG="yes"
4365 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08004366 AC_MSG_ERROR([SELinux support requires selinux.h header]))
4367 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11004368 [ LIBSELINUX="-lselinux"
4369 LIBS="$LIBS -lselinux"
4370 ],
Tim Rice648f8762011-01-26 12:38:57 -08004371 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11004372 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10004373 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08004374 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10004375 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10004376 fi ]
4377)
Tim Rice648f8762011-01-26 12:38:57 -08004378AC_SUBST([SSHLIBS])
4379AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10004380
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004381# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11004382KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004383AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11004384 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11004385 [ if test "x$withval" != "xno" ; then
4386 if test "x$withval" = "xyes" ; then
4387 KRB5ROOT="/usr/local"
4388 else
4389 KRB5ROOT=${withval}
4390 fi
4391
Tim Rice648f8762011-01-26 12:38:57 -08004392 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004393 KRB5_MSG="yes"
4394
Darren Tucker4089fc12016-12-08 12:57:24 +11004395 AC_PATH_TOOL([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10004396 [$KRB5ROOT/bin/krb5-config],
4397 [$KRB5ROOT/bin:$PATH])
4398 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11004399 K5CFLAGS="`$KRB5CONF --cflags`"
4400 K5LIBS="`$KRB5CONF --libs`"
4401 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004402
Tim Rice648f8762011-01-26 12:38:57 -08004403 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004404 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08004405 AC_MSG_RESULT([yes])
4406 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004407 [Define this if you want GSSAPI
4408 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11004409 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
4410 GSSLIBS="`$KRB5CONF --libs gssapi`"
4411 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11004412 else
Tim Rice648f8762011-01-26 12:38:57 -08004413 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004414 fi
Tim Rice648f8762011-01-26 12:38:57 -08004415 AC_MSG_CHECKING([whether we are using Heimdal])
4416 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4417 ]], [[ char *tmp = heimdal_version; ]])],
4418 [ AC_MSG_RESULT([yes])
4419 AC_DEFINE([HEIMDAL], [1],
4420 [Define this if you are using the Heimdal
4421 version of Kerberos V5]) ],
4422 [AC_MSG_RESULT([no])
4423 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004424 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004425 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11004426 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08004427 AC_MSG_CHECKING([whether we are using Heimdal])
4428 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4429 ]], [[ char *tmp = heimdal_version; ]])],
4430 [ AC_MSG_RESULT([yes])
4431 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11004432 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10004433 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08004434 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10004435 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08004436 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11004437 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08004438 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004439 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08004440 ])
4441 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004442
Tim Rice648f8762011-01-26 12:38:57 -08004443 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
4444 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004445 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08004446 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
4447 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004448 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11004449 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
4450 [ AC_DEFINE([GSSAPI])
4451 GSSLIBS="-lgss" ],
4452 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
4453 ])
Darren Tucker964de182013-02-22 10:39:59 +11004454 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08004455
Tim Rice648f8762011-01-26 12:38:57 -08004456 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004457 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11004458 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004459 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004460 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11004461 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004462 ]
4463 )
4464
4465 oldCPP="$CPPFLAGS"
4466 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004467 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004468 [ CPPFLAGS="$oldCPP" ])
4469
Damien Millera8e06ce2003-11-21 23:48:55 +11004470 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11004471 if test ! -z "$need_dash_r" ; then
4472 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
4473 fi
4474 if test ! -z "$blibpath" ; then
4475 blibpath="$blibpath:${KRB5ROOT}/lib"
4476 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004477
Tim Rice648f8762011-01-26 12:38:57 -08004478 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4479 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4480 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004481
Tim Rice648f8762011-01-26 12:38:57 -08004482 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4483 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004484
4485 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4486#ifdef HAVE_GSSAPI_H
4487# include <gssapi.h>
4488#elif defined(HAVE_GSSAPI_GSSAPI_H)
4489# include <gssapi/gssapi.h>
4490#endif
4491
4492#ifdef HAVE_GSSAPI_GENERIC_H
4493# include <gssapi_generic.h>
4494#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4495# include <gssapi/gssapi_generic.h>
4496#endif
4497 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004498 saved_LIBS="$LIBS"
4499 LIBS="$LIBS $K5LIBS"
4500 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4501 LIBS="$saved_LIBS"
4502
Darren Tucker0d27ed12004-02-24 10:37:33 +11004503 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004504 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004505)
Darren Tucker964de182013-02-22 10:39:59 +11004506AC_SUBST([GSSLIBS])
4507AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004508
Damien Millera22ba012000-03-02 23:09:20 +11004509# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004510
Damien Millerf58c6722002-05-13 13:15:42 +10004511PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004512AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004513 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004514 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004515 if test -n "$withval" && test "x$withval" != "xno" && \
4516 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004517 PRIVSEP_PATH=$withval
4518 fi
4519 ]
4520)
Tim Rice648f8762011-01-26 12:38:57 -08004521AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004522
Tim Rice648f8762011-01-26 12:38:57 -08004523AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004524 [ --with-xauth=PATH Specify path to xauth program ],
4525 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004526 if test -n "$withval" && test "x$withval" != "xno" && \
4527 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004528 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004529 fi
4530 ],
4531 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004532 TestPath="$PATH"
4533 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4534 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4535 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4536 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004537 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004538 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004539 xauth_path="/usr/openwin/bin/xauth"
4540 fi
4541 ]
4542)
4543
Damien Miller7d901272003-01-13 16:55:22 +11004544STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004545AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004546 [ --disable-strip Disable calling strip(1) on install],
4547 [
4548 if test "x$enableval" = "xno" ; then
4549 STRIP_OPT=
4550 fi
4551 ]
4552)
Tim Rice648f8762011-01-26 12:38:57 -08004553AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004554
Damien Millera19cf472000-11-29 13:28:50 +11004555if test -z "$xauth_path" ; then
4556 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004557 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004558else
Tim Rice648f8762011-01-26 12:38:57 -08004559 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004560 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004561 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004562 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004563fi
Damien Millera22ba012000-03-02 23:09:20 +11004564
Tim Rice90f42b02011-06-02 18:17:49 -07004565dnl # --with-maildir=/path/to/mail gets top priority.
4566dnl # if maildir is set in the platform case statement above we use that.
4567dnl # Otherwise we run a program to get the dir from system headers.
4568dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4569dnl # If we find _PATH_MAILDIR we do nothing because that is what
4570dnl # session.c expects anyway. Otherwise we set to the value found
4571dnl # stripping any trailing slash. If for some strage reason our program
4572dnl # does not find what it needs, we default to /var/spool/mail.
4573# Check for mail directory
4574AC_ARG_WITH([maildir],
4575 [ --with-maildir=/path/to/mail Specify your system mail directory],
4576 [
4577 if test "X$withval" != X && test "x$withval" != xno && \
4578 test "x${withval}" != xyes; then
4579 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4580 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4581 fi
4582 ],[
4583 if test "X$maildir" != "X"; then
4584 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4585 else
4586 AC_MSG_CHECKING([Discovering system mail directory])
4587 AC_RUN_IFELSE(
4588 [AC_LANG_PROGRAM([[
4589#include <stdio.h>
4590#include <string.h>
4591#ifdef HAVE_PATHS_H
4592#include <paths.h>
4593#endif
4594#ifdef HAVE_MAILLOCK_H
4595#include <maillock.h>
4596#endif
4597#define DATA "conftest.maildir"
4598 ]], [[
4599 FILE *fd;
4600 int rc;
4601
4602 fd = fopen(DATA,"w");
4603 if(fd == NULL)
4604 exit(1);
4605
4606#if defined (_PATH_MAILDIR)
4607 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4608 exit(1);
4609#elif defined (MAILDIR)
4610 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4611 exit(1);
4612#elif defined (_PATH_MAIL)
4613 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4614 exit(1);
4615#else
4616 exit (2);
4617#endif
4618
4619 exit(0);
4620 ]])],
4621 [
Tim Ricee1d93702016-05-31 11:13:22 -07004622 maildir_what=`awk -F: '{print $1}' conftest.maildir`
Tim Rice90f42b02011-06-02 18:17:49 -07004623 maildir=`awk -F: '{print $2}' conftest.maildir \
4624 | sed 's|/$||'`
4625 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4626 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4627 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4628 fi
4629 ],
4630 [
4631 if test "X$ac_status" = "X2";then
4632# our test program didn't find it. Default to /var/spool/mail
4633 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4634 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4635 else
4636 AC_MSG_RESULT([*** not found ***])
4637 fi
4638 ],
4639 [
4640 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4641 ]
4642 )
4643 fi
4644 ]
4645) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004646
Darren Tucker623d92f2004-09-12 22:36:15 +10004647if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004648 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4649 disable_ptmx_check=yes
4650fi
Damien Millera22ba012000-03-02 23:09:20 +11004651if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004652 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004653 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004654 [
Tim Rice648f8762011-01-26 12:38:57 -08004655 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004656 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004657 have_dev_ptmx=1
4658 ]
4659 )
4660 fi
Damien Millera22ba012000-03-02 23:09:20 +11004661fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004662
Darren Tucker623d92f2004-09-12 22:36:15 +10004663if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004664 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004665 [
Tim Rice648f8762011-01-26 12:38:57 -08004666 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004667 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004668 have_dev_ptc=1
4669 ]
4670 )
4671else
4672 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4673fi
Damien Miller204ad072000-03-02 23:56:12 +11004674
Damien Millera22ba012000-03-02 23:09:20 +11004675# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004676AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004677 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004678 [
Damien Miller897741e2001-04-16 10:41:46 +10004679 case "$withval" in
4680 man|cat|doc)
4681 MANTYPE=$withval
4682 ;;
4683 *)
Tim Rice648f8762011-01-26 12:38:57 -08004684 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004685 ;;
4686 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004687 ]
4688)
Ben Lindstrombc709922001-04-18 18:04:21 +00004689if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004690 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004691 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004692 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4693 MANTYPE=doc
4694 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4695 MANTYPE=man
4696 else
4697 MANTYPE=cat
4698 fi
4699fi
Tim Rice648f8762011-01-26 12:38:57 -08004700AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004701if test "$MANTYPE" = "doc"; then
4702 mansubdir=man;
4703else
4704 mansubdir=$MANTYPE;
4705fi
Tim Rice648f8762011-01-26 12:38:57 -08004706AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004707
Damien Millera22ba012000-03-02 23:09:20 +11004708# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004709MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004710AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004711 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004712 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004713 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004714 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004715 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004716 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004717 fi
4718 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004719)
4720
Damien Millera22ba012000-03-02 23:09:20 +11004721# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004722AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004723 [ --without-shadow Disable shadow password support],
4724 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004725 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004726 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004727 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004728 fi
4729 ]
4730)
4731
Damien Miller1f335fb2000-06-26 11:31:33 +10004732if test -z "$disable_shadow" ; then
4733 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004734 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004735#include <sys/types.h>
4736#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004737struct spwd sp;
4738 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4739 [ sp_expire_available=yes ], [
4740 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004741
4742 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004743 AC_MSG_RESULT([yes])
4744 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004745 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004746 else
Tim Rice648f8762011-01-26 12:38:57 -08004747 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004748 fi
4749fi
4750
Damien Millera22ba012000-03-02 23:09:20 +11004751# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004752if test ! -z "$IPADDR_IN_DISPLAY" ; then
4753 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004754 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004755 [Define if you need to use IP address
4756 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004757else
Damien Millera8e06ce2003-11-21 23:48:55 +11004758 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004759 AC_ARG_WITH([ipaddr-display],
Tim Rice6397eed2015-06-03 21:41:11 -07004760 [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY],
Damien Miller9a947342000-08-30 10:03:33 +11004761 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004762 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004763 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004764 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004765 fi
4766 ]
4767 )
4768fi
Damien Miller76112de1999-12-21 11:18:08 +11004769
Darren Tuckere1a790d2003-09-16 11:52:19 +10004770# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004771AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004772 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004773 [ if test "x$enableval" = "xno"; then
4774 AC_MSG_NOTICE([/etc/default/login handling disabled])
4775 etc_default_login=no
4776 else
4777 etc_default_login=yes
4778 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004779 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4780 then
4781 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4782 etc_default_login=no
4783 else
4784 etc_default_login=yes
4785 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004786)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004787
Darren Tucker2f9573d2005-02-10 22:28:54 +11004788if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004789 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004790 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004791 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004792 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004793 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004794 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004795fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004796
Tim Rice43a1c132002-04-17 21:19:14 -07004797dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004798if test $ac_cv_func_login_getcapbool = "yes" && \
4799 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004800 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004801fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004802
Damien Millera22ba012000-03-02 23:09:20 +11004803# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004804SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004805AC_ARG_WITH([default-path],
Tim Rice6397eed2015-06-03 21:41:11 -07004806 [ --with-default-path= Specify default $PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004807 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004808 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004809 AC_MSG_WARN([
4810--with-default-path=PATH has no effect on this system.
4811Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004812 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004813 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004814 AC_MSG_WARN([
4815--with-default-path=PATH will only be used if PATH is not defined in
4816$external_path_file .])
4817 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004818 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004819 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004820 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004821 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004822 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4823 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004824 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004825 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004826 AC_MSG_WARN([
4827If PATH is defined in $external_path_file, ensure the path to scp is included,
4828otherwise scp will not work.])
4829 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004830 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004831 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004832/* find out what STDPATH is */
4833#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004834#ifdef HAVE_PATHS_H
4835# include <paths.h>
4836#endif
4837#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004838# ifdef _PATH_USERPATH /* Irix */
4839# define _PATH_STDPATH _PATH_USERPATH
4840# else
4841# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4842# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004843#endif
4844#include <sys/types.h>
4845#include <sys/stat.h>
4846#include <fcntl.h>
4847#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004848 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004849 FILE *fd;
4850 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004851
Tim Rice59ea0a02001-03-10 13:50:45 -08004852 fd = fopen(DATA,"w");
4853 if(fd == NULL)
4854 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004855
Tim Rice59ea0a02001-03-10 13:50:45 -08004856 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4857 exit(1);
4858
4859 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004860 ]])],
4861 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004862 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4863 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4864 )
4865# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004866 t_bindir="${bindir}"
4867 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4868 t_bindir=`eval echo ${t_bindir}`
4869 case $t_bindir in
4870 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4871 esac
4872 case $t_bindir in
4873 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4874 esac
4875 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004876 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4877 if test $? -ne 0 ; then
4878 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4879 if test $? -ne 0 ; then
4880 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004881 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004882 fi
4883 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004884 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004885)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004886if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004887 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4888 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004889fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004890
Damien Millera18bbd32002-05-13 10:48:57 +10004891# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004892AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004893 [ --with-superuser-path= Specify different path for super-user],
4894 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004895 if test -n "$withval" && test "x$withval" != "xno" && \
4896 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004897 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004898 [Define if you want a different $PATH
4899 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004900 superuser_path=$withval
4901 fi
4902 ]
4903)
4904
4905
Damien Miller61e50f12000-05-08 20:49:37 +10004906AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004907IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004908AC_ARG_WITH(4in6,
4909 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4910 [
4911 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004912 AC_MSG_RESULT([yes])
4913 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004914 [Detect IPv4 in IPv6 mapped addresses
4915 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004916 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004917 else
Tim Rice648f8762011-01-26 12:38:57 -08004918 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004919 fi
Tim Rice648f8762011-01-26 12:38:57 -08004920 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004921 if test "x$inet6_default_4in6" = "xyes"; then
4922 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004923 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004924 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004925 else
4926 AC_MSG_RESULT([no (default)])
4927 fi
4928 ]
4929)
4930
Damien Miller60396b02001-02-18 17:01:00 +11004931# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004932BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004933AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004934 [ --with-bsd-auth Enable BSD auth support],
4935 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004936 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004937 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004938 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004939 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004940 fi
4941 ]
4942)
4943
Damien Millera22ba012000-03-02 23:09:20 +11004944# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004945piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004946# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004947if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004948 piddir=`eval echo ${sysconfdir}`
4949 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004950 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004951 esac
4952fi
4953
Tim Rice648f8762011-01-26 12:38:57 -08004954AC_ARG_WITH([pid-dir],
Darren Tucker075e2582018-02-13 17:36:43 +11004955 [ --with-pid-dir=PATH Specify location of sshd.pid file],
Tim Rice88f2ab52002-03-17 12:17:34 -08004956 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004957 if test -n "$withval" && test "x$withval" != "xno" && \
4958 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004959 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004960 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004961 AC_MSG_WARN([** no $piddir directory on this system **])
4962 fi
4963 fi
4964 ]
4965)
4966
Tim Ricee1d93702016-05-31 11:13:22 -07004967AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
Tim Rice648f8762011-01-26 12:38:57 -08004968 [Specify location of ssh.pid])
4969AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004970
andre2ff7b5d2000-06-03 14:57:40 +00004971dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004972AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004973 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004974 [
4975 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004976 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004977 fi
4978 ]
andre2ff7b5d2000-06-03 14:57:40 +00004979)
Tim Rice648f8762011-01-26 12:38:57 -08004980AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004981 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004982 [
4983 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004984 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004985 fi
4986 ]
andre2ff7b5d2000-06-03 14:57:40 +00004987)
Tim Rice648f8762011-01-26 12:38:57 -08004988AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004989 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004990 [
4991 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004992 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004993 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004994 fi
4995 ]
andre2ff7b5d2000-06-03 14:57:40 +00004996)
Tim Rice648f8762011-01-26 12:38:57 -08004997AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004998 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004999 [
5000 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005001 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10005002 fi
5003 ]
andre2ff7b5d2000-06-03 14:57:40 +00005004)
Tim Rice648f8762011-01-26 12:38:57 -08005005AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00005006 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10005007 [
5008 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005009 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07005010 [Define if you don't want to use wtmpx])
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([libutil],
andre43ca7e22000-06-19 08:23:46 +00005015 [ --disable-libutil disable use of libutil (login() etc.) [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_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10005019 fi
5020 ]
andre2ff7b5d2000-06-03 14:57:40 +00005021)
Tim Rice648f8762011-01-26 12:38:57 -08005022AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00005023 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10005024 [
5025 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005026 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07005027 [Define if you don't want to use pututline()
5028 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10005029 fi
5030 ]
andre2ff7b5d2000-06-03 14:57:40 +00005031)
Tim Rice648f8762011-01-26 12:38:57 -08005032AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00005033 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10005034 [
5035 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005036 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07005037 [Define if you don't want to use pututxline()
5038 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10005039 fi
5040 ]
andre2ff7b5d2000-06-03 14:57:40 +00005041)
Tim Rice648f8762011-01-26 12:38:57 -08005042AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00005043 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11005044 [
Tim Riceeae17cc2005-03-17 16:52:20 -08005045 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005046 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08005047 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11005048 conf_lastlog_location=$withval
5049 fi
5050 ]
5051)
andre2ff7b5d2000-06-03 14:57:40 +00005052
5053dnl lastlog, [uw]tmpx? detection
5054dnl NOTE: set the paths in the platform section to avoid the
5055dnl need for command-line parameters
5056dnl lastlog and [uw]tmp are subject to a file search if all else fails
5057
5058dnl lastlog detection
5059dnl NOTE: the code itself will detect if lastlog is a directory
5060AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005061AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005062#include <sys/types.h>
5063#include <utmp.h>
5064#ifdef HAVE_LASTLOG_H
5065# include <lastlog.h>
5066#endif
Damien Miller2994e082000-06-04 15:51:47 +10005067#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005068# include <paths.h>
5069#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00005070#ifdef HAVE_LOGIN_H
5071# include <login.h>
5072#endif
Tim Rice648f8762011-01-26 12:38:57 -08005073 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
5074 [ AC_MSG_RESULT([yes]) ],
5075 [
5076 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005077 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08005078 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10005079#include <sys/types.h>
5080#include <utmp.h>
5081#ifdef HAVE_LASTLOG_H
5082# include <lastlog.h>
5083#endif
5084#ifdef HAVE_PATHS_H
5085# include <paths.h>
5086#endif
Tim Rice648f8762011-01-26 12:38:57 -08005087 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
5088 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10005089 [
Tim Rice648f8762011-01-26 12:38:57 -08005090 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10005091 system_lastlog_path=no
5092 ])
Tim Rice648f8762011-01-26 12:38:57 -08005093])
Damien Miller2994e082000-06-04 15:51:47 +10005094
andre2ff7b5d2000-06-03 14:57:40 +00005095if test -z "$conf_lastlog_location"; then
5096 if test x"$system_lastlog_path" = x"no" ; then
5097 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10005098 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00005099 conf_lastlog_location=$f
5100 fi
5101 done
5102 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00005103 AC_MSG_WARN([** Cannot find lastlog **])
5104 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00005105 fi
5106 fi
5107fi
5108
5109if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005110 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005111 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005112fi
andre2ff7b5d2000-06-03 14:57:40 +00005113
5114dnl utmp detection
5115AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005116AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005117#include <sys/types.h>
5118#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005119#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005120# include <paths.h>
5121#endif
Tim Rice648f8762011-01-26 12:38:57 -08005122 ]], [[ char *utmp = UTMP_FILE; ]])],
5123 [ AC_MSG_RESULT([yes]) ],
5124 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005125 system_utmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005126])
andre2ff7b5d2000-06-03 14:57:40 +00005127if test -z "$conf_utmp_location"; then
5128 if test x"$system_utmp_path" = x"no" ; then
5129 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
5130 if test -f $f ; then
5131 conf_utmp_location=$f
5132 fi
5133 done
5134 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005135 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005136 fi
5137 fi
5138fi
5139if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005140 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005141 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005142fi
andre2ff7b5d2000-06-03 14:57:40 +00005143
5144dnl wtmp detection
5145AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005146AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005147#include <sys/types.h>
5148#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10005149#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005150# include <paths.h>
5151#endif
Tim Rice648f8762011-01-26 12:38:57 -08005152 ]], [[ char *wtmp = WTMP_FILE; ]])],
5153 [ AC_MSG_RESULT([yes]) ],
5154 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005155 system_wtmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005156])
andre2ff7b5d2000-06-03 14:57:40 +00005157if test -z "$conf_wtmp_location"; then
5158 if test x"$system_wtmp_path" = x"no" ; then
5159 for f in /usr/adm/wtmp /var/log/wtmp; do
5160 if test -f $f ; then
5161 conf_wtmp_location=$f
5162 fi
5163 done
5164 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005165 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00005166 fi
5167 fi
5168fi
5169if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08005170 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005171 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005172fi
andre2ff7b5d2000-06-03 14:57:40 +00005173
andre2ff7b5d2000-06-03 14:57:40 +00005174dnl wtmpx detection
5175AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08005176AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00005177#include <sys/types.h>
5178#include <utmp.h>
5179#ifdef HAVE_UTMPX_H
5180#include <utmpx.h>
5181#endif
Damien Miller2994e082000-06-04 15:51:47 +10005182#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00005183# include <paths.h>
5184#endif
Tim Rice648f8762011-01-26 12:38:57 -08005185 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
5186 [ AC_MSG_RESULT([yes]) ],
5187 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07005188 system_wtmpx_path=no
Tim Rice648f8762011-01-26 12:38:57 -08005189])
andre2ff7b5d2000-06-03 14:57:40 +00005190if test -z "$conf_wtmpx_location"; then
5191 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08005192 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00005193 fi
5194else
Tim Rice648f8762011-01-26 12:38:57 -08005195 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07005196 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08005197fi
andre2ff7b5d2000-06-03 14:57:40 +00005198
Damien Miller4018c192000-04-30 09:30:44 +10005199
Damien Miller29ea30d2000-03-17 10:54:15 +11005200if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10005201 LDFLAGS="$LDFLAGS $blibflags$blibpath"
5202 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11005203fi
5204
Damien Millera2438bb2013-03-15 10:23:07 +11005205AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07005206 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11005207 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07005208 fi
Damien Millera2438bb2013-03-15 10:23:07 +11005209 ], [
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
5224AC_CHECK_MEMBER([struct utmp.ut_line], [], [
5225 AC_DEFINE([DISABLE_UTMP])
5226 AC_DEFINE([DISABLE_WTMP])
5227 ], [
5228#ifdef HAVE_SYS_TYPES_H
5229#include <sys/types.h>
5230#endif
5231#ifdef HAVE_UTMP_H
5232#include <utmp.h>
5233#endif
5234#ifdef HAVE_UTMPX_H
5235#include <utmpx.h>
5236#endif
5237#ifdef HAVE_LASTLOG_H
5238#include <lastlog.h>
5239#endif
5240 ])
5241
Darren Tucker7da23cb2005-08-03 00:20:15 +10005242dnl Adding -Werror to CFLAGS early prevents configure tests from running.
5243dnl Add now.
5244CFLAGS="$CFLAGS $werror_flags"
5245
Darren Tucker627337d2010-04-10 22:58:01 +10005246if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
5247 TEST_SSH_IPV6=no
5248else
5249 TEST_SSH_IPV6=yes
5250fi
Tim Rice648f8762011-01-26 12:38:57 -08005251AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
5252AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker47b8c992016-12-08 15:48:34 +11005253AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8])
Darren Tucker882abfd2013-11-09 00:17:41 +11005254AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10005255AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker79c0e1d2017-12-11 14:38:33 +11005256AC_SUBST([DEPEND], [$(cat $srcdir/.depend)])
Darren Tucker5d376902008-06-11 04:15:05 +10005257
Damien Millerde35c382017-09-08 12:38:31 +10005258CFLAGS="${CFLAGS} ${CFLAGS_AFTER}"
5259LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}"
5260
Damien Millerbac2d8a2000-09-05 16:13:06 +11005261AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10005262AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
5263 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10005264 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07005265AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10005266
Damien Miller7b22d652000-06-18 14:07:04 +10005267# Print summary of options
5268
Damien Miller7b22d652000-06-18 14:07:04 +10005269# Someone please show me a better way :)
5270A=`eval echo ${prefix}` ; A=`eval echo ${A}`
5271B=`eval echo ${bindir}` ; B=`eval echo ${B}`
5272C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
5273D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00005274E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00005275F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10005276G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10005277H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
5278I=`eval echo ${user_path}` ; I=`eval echo ${I}`
5279J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10005280
5281echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00005282echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10005283echo " User binaries: $B"
5284echo " System binaries: $C"
5285echo " Configuration files: $D"
5286echo " Askpass program: $E"
5287echo " Manual pages: $F"
5288echo " PID file: $G"
5289echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10005290if test "x$external_path_file" = "x/etc/login.conf" ; then
5291echo " At runtime, sshd will use the path defined in $external_path_file"
5292echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07005293else
Damien Millerf58c6722002-05-13 13:15:42 +10005294echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07005295 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10005296echo " (If PATH is set in $external_path_file it will be used instead. If"
5297echo " used, ensure the path to scp is present, otherwise scp will not work.)"
5298 fi
Tim Rice43a1c132002-04-17 21:19:14 -07005299fi
Damien Millera18bbd32002-05-13 10:48:57 +10005300if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10005301echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10005302fi
Damien Millerf58c6722002-05-13 13:15:42 +10005303echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10005304echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005305echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005306echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10005307echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005308echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11005309echo " libedit support: $LIBEDIT_MSG"
Damien Miller523db852017-02-03 16:01:22 +11005310echo " libldns support: $LDNS_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005311echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11005312echo " Solaris project support: $SP_MSG"
Damien Miller4626cba2016-01-08 14:24:56 +11005313echo " Solaris privilege support: $SPP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10005314echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005315echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5316echo " BSD Auth support: $BSD_AUTH_MSG"
5317echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10005318echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11005319
Damien Miller7b22d652000-06-18 14:07:04 +10005320echo ""
5321
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00005322echo " Host: ${host}"
5323echo " Compiler: ${CC}"
5324echo " Compiler flags: ${CFLAGS}"
5325echo "Preprocessor flags: ${CPPFLAGS}"
5326echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10005327echo " Libraries: ${LIBS}"
5328if test ! -z "${SSHDLIBS}"; then
5329echo " +for sshd: ${SSHDLIBS}"
5330fi
Damien Miller71adf122011-01-25 12:16:15 +11005331if test ! -z "${SSHLIBS}"; then
5332echo " +for ssh: ${SSHLIBS}"
5333fi
Damien Miller7b22d652000-06-18 14:07:04 +10005334
5335echo ""
5336
Tim Rice6f1f7582004-05-30 21:38:51 -07005337if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10005338 echo "SVR4 style packages are supported with \"make package\""
5339 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07005340fi
5341
Damien Miller82cf0ce2000-12-20 13:34:48 +11005342if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11005343 echo "PAM is enabled. You may need to install a PAM control file "
5344 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11005345 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11005346 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11005347 echo ""
5348fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00005349
Damien Millerb4097182004-05-23 14:09:40 +10005350if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11005351 echo "WARNING: the operating system that you are using does not"
5352 echo "appear to support getpeereid(), getpeerucred() or the"
5353 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
5354 echo "enforce security checks to prevent unauthorised connections to"
5355 echo "ssh-agent. Their absence increases the risk that a malicious"
5356 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10005357 echo ""
5358fi
5359
Darren Tuckerd9f88912005-02-20 21:01:48 +11005360if test "$AUDIT_MODULE" = "bsm" ; then
5361 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
5362 echo "See the Solaris section in README.platform for details."
5363fi