blob: 5cfea38c0a6c79fd15c163a4fc21811f92c727fe [file] [log] [blame]
Damien Miller3d673d12014-08-27 06:32:01 +10001# $Id: configure.ac,v 1.583 2014/08/26 20:32:01 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Damien Miller3d673d12014-08-27 06:32:01 +100018AC_REVISION($Revision: 1.583 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Tim Rice648f8762011-01-26 12:38:57 -080020AC_LANG([C])
Damien Miller7f6ea021999-10-28 13:25:17 +100021
Tim Rice648f8762011-01-26 12:38:57 -080022AC_CONFIG_HEADER([config.h])
Damien Miller856799b2000-03-15 21:18:10 +110023AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110024AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110025AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100026
Damien Millera22ba012000-03-02 23:09:20 +110027# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100028AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110029AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100030AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110031AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080032AC_PROG_EGREP
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])
36AC_PATH_PROGS([PERL], [perl5 perl])
37AC_PATH_PROG([SED], [sed])
38AC_SUBST([PERL])
39AC_PATH_PROG([ENT], [ent])
40AC_SUBST([ENT])
41AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
42AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
43AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
44AC_PATH_PROG([SH], [sh])
45AC_PATH_PROG([GROFF], [groff])
46AC_PATH_PROG([NROFF], [nroff])
47AC_PATH_PROG([MANDOC], [mandoc])
48AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110049
Damien Miller30a69e72011-01-04 08:16:27 +110050dnl select manpage formatter
51if test "x$MANDOC" != "x" ; then
52 MANFMT="$MANDOC"
53elif test "x$NROFF" != "x" ; then
54 MANFMT="$NROFF -mandoc"
55elif test "x$GROFF" != "x" ; then
56 MANFMT="$GROFF -mandoc -Tascii"
57else
58 AC_MSG_WARN([no manpage formatted found])
59 MANFMT="false"
60fi
Tim Rice648f8762011-01-26 12:38:57 -080061AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110062
Tim Rice6f1f7582004-05-30 21:38:51 -070063dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080064AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070065 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080066AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070067 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080068AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110069if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080070 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110071else
Tim Rice648f8762011-01-26 12:38:57 -080072 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110073fi
Tim Rice6f1f7582004-05-30 21:38:51 -070074
Damien Millere8bb4502001-09-25 16:39:35 +100075# System features
76AC_SYS_LARGEFILE
77
Damien Miller3f62aba2000-11-29 11:56:35 +110078if test -z "$AR" ; then
79 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
80fi
81
Tim Rice648f8762011-01-26 12:38:57 -080082AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +110083if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -080084 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -070085 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110086fi
87
Damien Miller166bd442000-03-16 10:48:25 +110088if test -z "$LD" ; then
89 LD=$CC
90fi
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 Tucker4a725ef2011-11-21 16:38:48 +1100166 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100167 if test "x$use_toolchain_hardening" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100168 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
169 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
170 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
Damien Miller5c2ff5e2014-01-22 21:30:12 +1100171 # NB. -ftrapv expects certain support functions to be present in
172 # the compiler library (libgcc or similar) to detect integer operations
173 # that can overflow. We must check that the result of enabling it
174 # actually links. The test program compiled/linked includes a number
175 # of integer operations that should exercise this.
176 OSSH_CHECK_CFLAG_LINK([-ftrapv])
Darren Tuckerfd994372014-01-17 09:53:24 +1100177 fi
Tim Rice648f8762011-01-26 12:38:57 -0800178 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100179 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700180 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000181 1.*) no_attrib_nonnull=1 ;;
182 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000183 no_attrib_nonnull=1
184 ;;
185 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100186 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700187 esac
Tim Rice648f8762011-01-26 12:38:57 -0800188 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000189
Tim Rice648f8762011-01-26 12:38:57 -0800190 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000191 saved_CFLAGS="$CFLAGS"
192 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800193 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
194 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
195 [ AC_MSG_RESULT([yes]) ],
196 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000197 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800198 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000199
Darren Tuckerb7918af2008-03-09 11:34:23 +1100200 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100201 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100202 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100203 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100204 for t in -fstack-protector-strong -fstack-protector-all \
205 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800206 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100207 saved_CFLAGS="$CFLAGS"
208 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100209 CFLAGS="$CFLAGS $t -Werror"
210 LDFLAGS="$LDFLAGS $t -Werror"
211 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800212 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
213 [[
214 char x[256];
215 snprintf(x, sizeof(x), "XXX");
216 ]])],
217 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100218 CFLAGS="$saved_CFLAGS $t"
219 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800220 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100221 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800222 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
223 [[
224 char x[256];
225 snprintf(x, sizeof(x), "XXX");
226 ]])],
227 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100228 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800229 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100230 [ AC_MSG_WARN([cross compiling: cannot test])
231 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100232 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100233 ],
Tim Rice648f8762011-01-26 12:38:57 -0800234 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100235 )
236 CFLAGS="$saved_CFLAGS"
237 LDFLAGS="$saved_LDFLAGS"
238 done
239 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100240
Darren Tucker67b37032005-06-03 17:58:31 +1000241 if test -z "$have_llong_max"; then
242 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
243 unset ac_cv_have_decl_LLONG_MAX
244 saved_CFLAGS="$CFLAGS"
245 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800246 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000247 [have_llong_max=1],
248 [CFLAGS="$saved_CFLAGS"],
249 [#include <limits.h>]
250 )
251 fi
Damien Miller166bd442000-03-16 10:48:25 +1100252fi
253
Darren Tucker951b53b2013-02-08 11:50:09 +1100254AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
255AC_COMPILE_IFELSE(
256 [AC_LANG_PROGRAM([[
257#include <stdlib.h>
258__attribute__((__unused__)) static void foo(void){return;}]],
259 [[ exit(0); ]])],
260 [ AC_MSG_RESULT([yes]) ],
261 [ AC_MSG_RESULT([no])
262 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
263 [compiler does not accept __attribute__ on return types]) ]
264)
265
Darren Tucker391de5c2007-04-29 14:49:21 +1000266if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800267 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000268fi
269
Tim Rice648f8762011-01-26 12:38:57 -0800270AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800271 [ --without-rpath Disable auto-added -R linker paths],
272 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800273 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800274 need_dash_r=""
275 fi
276 if test "x$withval" = "xyes" ; then
277 need_dash_r=1
278 fi
279 ]
280)
281
Tim Rice1cfab232006-10-03 09:34:35 -0700282# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800283AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700284 [ --with-cflags Specify additional flags to pass to compiler],
285 [
286 if test -n "$withval" && test "x$withval" != "xno" && \
287 test "x${withval}" != "xyes"; then
288 CFLAGS="$CFLAGS $withval"
289 fi
290 ]
291)
Tim Rice648f8762011-01-26 12:38:57 -0800292AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700293 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
294 [
295 if test -n "$withval" && test "x$withval" != "xno" && \
296 test "x${withval}" != "xyes"; then
297 CPPFLAGS="$CPPFLAGS $withval"
298 fi
299 ]
300)
Tim Rice648f8762011-01-26 12:38:57 -0800301AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700302 [ --with-ldflags Specify additional flags to pass to linker],
303 [
304 if test -n "$withval" && test "x$withval" != "xno" && \
305 test "x${withval}" != "xyes"; then
306 LDFLAGS="$LDFLAGS $withval"
307 fi
308 ]
309)
Tim Rice648f8762011-01-26 12:38:57 -0800310AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700311 [ --with-libs Specify additional libraries to link with],
312 [
313 if test -n "$withval" && test "x$withval" != "xno" && \
314 test "x${withval}" != "xyes"; then
315 LIBS="$LIBS $withval"
316 fi
317 ]
318)
Tim Rice648f8762011-01-26 12:38:57 -0800319AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700320 [ --with-Werror Build main code with -Werror],
321 [
322 if test -n "$withval" && test "x$withval" != "xno"; then
323 werror_flags="-Werror"
324 if test "x${withval}" != "xyes"; then
325 werror_flags="$withval"
326 fi
327 fi
328 ]
329)
330
Tim Rice648f8762011-01-26 12:38:57 -0800331AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100332 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700333 bstring.h \
334 crypt.h \
335 crypto/sha2.h \
336 dirent.h \
337 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100338 elf.h \
Darren Tucker6310ef22016-07-13 14:42:35 +1000339 err.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700340 features.h \
341 fcntl.h \
342 floatingpoint.h \
343 getopt.h \
344 glob.h \
345 ia.h \
346 iaf.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100347 inttypes.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000348 langinfo.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700349 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000350 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700351 login.h \
352 maillock.h \
353 ndir.h \
354 net/if_tun.h \
355 netdb.h \
356 netgroup.h \
357 pam/pam_appl.h \
358 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000359 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700360 pty.h \
361 readpassphrase.h \
362 rpc/types.h \
363 security/pam_appl.h \
364 sha2.h \
365 shadow.h \
366 stddef.h \
367 stdint.h \
368 string.h \
369 strings.h \
370 sys/audit.h \
371 sys/bitypes.h \
372 sys/bsdtty.h \
Damien Millerc96d8532014-01-25 13:12:28 +1100373 sys/capability.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700374 sys/cdefs.h \
375 sys/dir.h \
376 sys/mman.h \
377 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000378 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700379 sys/prctl.h \
380 sys/pstat.h \
Darren Tucker5ee3fb52016-11-01 08:12:33 +1100381 sys/ptrace.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700382 sys/select.h \
383 sys/stat.h \
384 sys/stream.h \
385 sys/stropts.h \
386 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000387 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700388 sys/sysmacros.h \
389 sys/time.h \
390 sys/timers.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700391 time.h \
392 tmpdir.h \
393 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700394 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700395 unistd.h \
396 usersec.h \
397 util.h \
398 utime.h \
399 utmp.h \
400 utmpx.h \
401 vis.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000402 wchar.h \
Tim Rice648f8762011-01-26 12:38:57 -0800403])
Tim Rice1cfab232006-10-03 09:34:35 -0700404
405# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800406AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700407#ifdef HAVE_SYS_TIME_H
408# include <sys/time.h>
409#endif
410])
411
412# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800413AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700414#ifdef HAVE_SYS_STREAM_H
415# include <sys/stream.h>
416#endif
417])
418
419# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800420AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700421#include <sys/types.h>
422])
423
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000424# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800425AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000426#include <sys/param.h>
427])
428
Darren Tuckeref4901c2013-06-03 01:59:13 +1000429# Android requires sys/socket.h to be included before sys/un.h
430AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000431#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000432#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000433])
434
Damien Miller1b06dc32006-08-31 03:24:41 +1000435# Messages for features tested for in target-specific section
436SIA_MSG="no"
437SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100438SP_MSG="no"
Damien Miller4626cba2016-01-08 14:24:56 +1100439SPP_MSG="no"
440
441# Support for Solaris/Illumos privileges (this test is used by both
442# the --with-solaris-privs option and --with-sandbox=solaris).
443SOLARIS_PRIVS="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000444
Damien Millera22ba012000-03-02 23:09:20 +1100445# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100446case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100447*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000448 # Some versions of VAC won't allow macro redefinitions at
449 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
450 # particularly with older versions of vac or xlc.
451 # It also throws errors about null macro argments, but these are
452 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800453 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000454 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800455 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000456#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800457#define testmacro bar]],
458 [[ exit(0); ]])],
459 [ AC_MSG_RESULT([yes]) ],
460 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000461 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
462 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
463 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
464 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
465 ]
466 )
467
Damien Millera8e06ce2003-11-21 23:48:55 +1100468 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000469 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800470 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100471 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000472 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000473 if test "$GCC" = "yes"; then
474 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
475 else
476 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
477 fi
478 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000479 if (test -z "$blibflags"); then
480 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800481 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
482 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000483 fi
484 done
485 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800486 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000487 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
488 else
Tim Rice648f8762011-01-26 12:38:57 -0800489 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000490 fi
491 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000492 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800493 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700494 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800495 [AC_CHECK_LIB([s], [authenticate],
496 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700497 LIBS="$LIBS -ls"
498 ])
499 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100500 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100501 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100502 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000503 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800504 AC_CHECK_DECLS([loginfailed],
505 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
506 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
507 [[ (void)loginfailed("user","host","tty",0); ]])],
508 [AC_MSG_RESULT([yes])
509 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
510 [Define if your AIX loginfailed() function
511 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
512 ])],
513 [],
514 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000515 )
Tim Rice648f8762011-01-26 12:38:57 -0800516 AC_CHECK_FUNCS([getgrset setauthdb])
517 AC_CHECK_DECL([F_CLOSEM],
518 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000519 [],
520 [ #include <limits.h>
521 #include <fcntl.h> ]
522 )
Darren Tucker691d5232005-02-15 21:45:57 +1100523 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800524 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
525 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700526 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800527 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
528 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000529 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800530 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
531 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700532 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800533 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700534 [Define to a Set Process Title type if your system is
535 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800536 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100537 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800538 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100539 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100540 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000541*-*-android*)
542 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
543 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
544 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100545*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100546 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100547 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800548 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
549 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
Damien Miller4626cba2016-01-08 14:24:56 +1100550 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
551 [Define to disable UID restoration test])
Tim Rice648f8762011-01-26 12:38:57 -0800552 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700553 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800554 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700555 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800556 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700557 [Define if your platform needs to skip post auth
558 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800559 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100560 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
561 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
562 # reasons which cause compile warnings, so we disable those warnings.
563 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100564 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000565*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800566 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700567 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800568 AC_DEFINE([SETEUID_BREAKS_SETUID])
569 AC_DEFINE([BROKEN_SETREUID])
570 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000571 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000572*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100573 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800574 AC_MSG_CHECKING([if we have working getaddrinfo])
575 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000576main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
577 exit(0);
578 else
579 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800580}
581 ]])],
582 [AC_MSG_RESULT([working])],
583 [AC_MSG_RESULT([buggy])
584 AC_DEFINE([BROKEN_GETADDRINFO], [1],
585 [getaddrinfo is broken (if present)])
586 ],
587 [AC_MSG_RESULT([assume it is working])])
588 AC_DEFINE([SETEUID_BREAKS_SETUID])
589 AC_DEFINE([BROKEN_SETREUID])
590 AC_DEFINE([BROKEN_SETREGID])
591 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
592 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700593 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800594 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
595 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000596 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800597 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000598 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800599 m4_pattern_allow([AU_IPv])
Tim Ricee1d93702016-05-31 11:13:22 -0700600 AC_CHECK_DECL([AU_IPv4], [],
Tim Rice648f8762011-01-26 12:38:57 -0800601 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100602 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800603 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100604 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100605 )
Damien Millerc09182f2011-06-03 12:11:38 +1000606 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
607 [Define to a Set Process Title type if your system is
608 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000609 AC_CHECK_FUNCS([sandbox_init])
610 AC_CHECK_HEADERS([sandbox.h])
Damien Miller39f303b2016-02-23 12:56:59 +1100611 AC_CHECK_LIB([sandbox], [sandbox_apply], [
612 SSHDLIBS="$SSHDLIBS -lsandbox"
613 ])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000614 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000615*-*-dragonfly*)
616 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100617 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000618 ;;
Tim Ricee1d93702016-05-31 11:13:22 -0700619*-*-haiku*)
Darren Tucker5faa52d2016-08-02 15:22:40 +1000620 LIBS="$LIBS -lbsd "
621 AC_CHECK_LIB([network], [socket])
622 AC_DEFINE([HAVE_U_INT64_T])
623 MANTYPE=man
624 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000625*-*-hpux*)
626 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000627 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100628 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800629 AC_DEFINE([USE_PIPES])
Tim Rice648f8762011-01-26 12:38:57 -0800630 AC_DEFINE([LOGIN_NEEDS_UTMPX])
631 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700632 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800633 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100634 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700635 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700636 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800637 AC_CHECK_LIB([xnet], [t_error], ,
638 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000639
640 # next, we define all of the options specific to major releases
641 case "$host" in
642 *-*-hpux10*)
643 if test -z "$GCC"; then
644 CFLAGS="$CFLAGS -Ae"
645 fi
646 ;;
647 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800648 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700649 [Define if you are using Solaris-derived PAM which
650 passes pam_messages to the conversation function
651 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800652 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700653 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800654 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000655 check_for_hpux_broken_getaddrinfo=1
656 check_for_conflicting_getspnam=1
657 ;;
658 esac
659
660 # lastly, we define options specific to minor releases
661 case "$host" in
662 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800663 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700664 [Define if you have SecureWare-based
665 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000666 disable_ptmx_check=yes
667 LIBS="$LIBS -lsecpw"
668 ;;
669 esac
Damien Miller1bead332000-04-30 00:47:29 +1000670 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100671*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100672 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800673 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700674 [Define if you system's inet_ntoa is busted
675 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800676 AC_DEFINE([SETEUID_BREAKS_SETUID])
677 AC_DEFINE([BROKEN_SETREUID])
678 AC_DEFINE([BROKEN_SETREGID])
679 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700680 [Define if you shouldn't strip 'tty' from your
681 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800682 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100683 ;;
684*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100685 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800686 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700687 [Define if you have/want arrays
688 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800689 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700690 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800691 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700692 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800693 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700694 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800695 AC_DEFINE([BROKEN_INET_NTOA])
696 AC_DEFINE([SETEUID_BREAKS_SETUID])
697 AC_DEFINE([BROKEN_SETREUID])
698 AC_DEFINE([BROKEN_SETREGID])
699 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
700 AC_DEFINE([WITH_ABBREV_NO_TTY])
701 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100702 ;;
Damien Miller90551722009-02-16 15:37:03 +1100703*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
704 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800705 AC_DEFINE([PAM_TTY_KLUDGE])
706 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
707 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
708 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
709 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100710 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100711*-*-linux*)
712 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100713 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100714 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000715 check_for_openpty_ctty_bug=1
Darren Tuckerc61d5ec2017-02-03 14:10:34 +1100716 dnl Target SUSv3/POSIX.1-2001 plus BSD specifics.
717 dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE
718 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800719 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700720 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800721 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700722 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800723 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
724 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700725 [Define to whatever link() returns for "not supported"
726 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800727 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
728 AC_DEFINE([USE_BTMP])
729 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100730 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000731 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000732 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800733 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700734 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000735 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000736 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100737 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800738 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100739 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800740 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100741 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800742 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100743 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800744 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100745 [Prepend the address family to IP tunnel traffic])
746 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000747 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
748 [], [#include <linux/types.h>])
Damien Miller91f40d82013-02-22 11:37:00 +1100749 AC_MSG_CHECKING([for seccomp architecture])
750 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000751 case "$host" in
752 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100753 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000754 ;;
755 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100756 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000757 ;;
Damien Miller99f33d72015-06-17 10:50:51 +1000758 arm*-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100759 seccomp_audit_arch=AUDIT_ARCH_ARM
Damien Miller99f33d72015-06-17 10:50:51 +1000760 ;;
761 aarch64*-*)
762 seccomp_audit_arch=AUDIT_ARCH_AARCH64
Damien Miller5c15e222015-06-18 15:07:56 +1000763 ;;
Damien Millerb9c50612016-07-08 13:59:13 +1000764 s390x-*)
765 seccomp_audit_arch=AUDIT_ARCH_S390X
766 ;;
767 s390-*)
768 seccomp_audit_arch=AUDIT_ARCH_S390
769 ;;
770 powerpc64-*)
771 seccomp_audit_arch=AUDIT_ARCH_PPC64
772 ;;
773 powerpc64le-*)
774 seccomp_audit_arch=AUDIT_ARCH_PPC64LE
775 ;;
776 mips-*)
777 seccomp_audit_arch=AUDIT_ARCH_MIPS
778 ;;
779 mipsel-*)
780 seccomp_audit_arch=AUDIT_ARCH_MIPSEL
781 ;;
782 mips64-*)
783 seccomp_audit_arch=AUDIT_ARCH_MIPS64
784 ;;
785 mips64el-*)
786 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
787 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000788 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100789 if test "x$seccomp_audit_arch" != "x" ; then
790 AC_MSG_RESULT(["$seccomp_audit_arch"])
Damien Miller99f33d72015-06-17 10:50:51 +1000791 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
792 [Specify the system call convention in use])
Damien Miller91f40d82013-02-22 11:37:00 +1100793 else
794 AC_MSG_RESULT([architecture not supported])
795 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100796 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000797mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800798 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000799 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000800 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100801*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000802 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800803 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800804 need_dash_r=1
805 fi
Damien Miller99522ba2016-07-28 08:54:27 +1000806 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
Tim Rice648f8762011-01-26 12:38:57 -0800807 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100808 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800809 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
810 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100811 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100812 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerf5bbd3b2014-01-30 11:26:46 +1100813 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
814 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
Damien Milleree1c0b32000-01-21 00:18:15 +1100815 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100816*-*-freebsd*)
817 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800818 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
819 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100820 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800821 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
822 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100823 TEST_MALLOC_OPTIONS="AJRX"
Damien Miller2035b222014-01-26 09:39:53 +1100824 # Preauth crypto occasionally uses file descriptors for crypto offload
825 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100826 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
Tim Rice03ae0812014-02-21 09:09:34 -0800827 [define if setrlimit RLIMIT_NOFILE breaks things])
Damien Millerfbd884a2001-02-27 08:39:07 +1100828 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000829*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800830 AC_DEFINE([SETEUID_BREAKS_SETUID])
831 AC_DEFINE([BROKEN_SETREUID])
832 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000833 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000834*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000835 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100836 conf_utmp_location=/etc/utmp
837 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700838 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800839 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
840 AC_DEFINE([BROKEN_REALPATH])
841 AC_DEFINE([USE_PIPES])
842 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000843 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000844*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100845 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800846 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
847 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
848 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
849 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000850 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100851 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000852 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100853*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800854 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800855 need_dash_r=1
856 fi
Tim Rice648f8762011-01-26 12:38:57 -0800857 AC_DEFINE([PAM_SUN_CODEBASE])
858 AC_DEFINE([LOGIN_NEEDS_UTMPX])
Tim Rice648f8762011-01-26 12:38:57 -0800859 AC_DEFINE([PAM_TTY_KLUDGE])
860 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700861 [Define if pam_chauthtok wants real uid set
862 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800863 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000864 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800865 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700866 [Define if sshd somehow reacquires a controlling TTY
867 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800868 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000869 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800870 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000871 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000872 # hardwire lastlog location (can't detect it on some versions)
873 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800874 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000875 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
876 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800877 AC_MSG_RESULT([yes])
878 AC_DEFINE([DISABLE_UTMP])
879 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700880 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000881 else
Tim Rice648f8762011-01-26 12:38:57 -0800882 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000883 fi
Darren Tuckera86ec4d2016-06-14 10:48:27 +1000884 AC_CHECK_FUNCS([setpflags])
Darren Tucker907091a2016-02-19 09:05:39 +1100885 AC_CHECK_FUNCS([setppriv])
886 AC_CHECK_FUNCS([priv_basicset])
887 AC_CHECK_HEADERS([priv.h])
Tim Rice648f8762011-01-26 12:38:57 -0800888 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000889 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
890 [
Tim Rice648f8762011-01-26 12:38:57 -0800891 AC_CHECK_LIB([contract], [ct_tmpl_activate],
892 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000893 [Define if you have Solaris process contracts])
Damien Miller4626cba2016-01-08 14:24:56 +1100894 LIBS="$LIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000895 SPC_MSG="yes" ], )
896 ],
897 )
Tim Rice648f8762011-01-26 12:38:57 -0800898 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100899 [ --with-solaris-projects Enable Solaris projects (experimental)],
900 [
Tim Rice648f8762011-01-26 12:38:57 -0800901 AC_CHECK_LIB([project], [setproject],
902 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100903 [Define if you have Solaris projects])
Damien Miller4626cba2016-01-08 14:24:56 +1100904 LIBS="$LIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100905 SP_MSG="yes" ], )
906 ],
907 )
Damien Miller4626cba2016-01-08 14:24:56 +1100908 AC_ARG_WITH([solaris-privs],
909 [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)],
910 [
911 AC_MSG_CHECKING([for Solaris/Illumos privilege support])
Darren Tucker907091a2016-02-19 09:05:39 +1100912 if test "x$ac_cv_func_setppriv" = "xyes" -a \
913 "x$ac_cv_header_priv_h" = "xyes" ; then
914 SOLARIS_PRIVS=yes
Damien Miller4626cba2016-01-08 14:24:56 +1100915 AC_MSG_RESULT([found])
916 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
917 [Define to disable UID restoration test])
918 AC_DEFINE([USE_SOLARIS_PRIVS], [1],
919 [Define if you have Solaris privileges])
920 SPP_MSG="yes"
921 else
922 AC_MSG_RESULT([not found])
923 AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs])
924 fi
925 ],
926 )
Tim Rice5ab9b632013-06-02 14:05:48 -0700927 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +1100928 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000929*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000930 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800931 AC_CHECK_FUNCS([getpwanam])
932 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000933 conf_utmp_location=/etc/utmp
934 conf_wtmp_location=/var/adm/wtmp
935 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800936 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000937 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000938*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700939 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800940 AC_DEFINE([USE_PIPES])
941 AC_DEFINE([SSHD_ACQUIRES_CTTY])
942 AC_DEFINE([SETEUID_BREAKS_SETUID])
943 AC_DEFINE([BROKEN_SETREUID])
944 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000945 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000946*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700947 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800948 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100949 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800950 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100951 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800952 AC_DEFINE([USE_PIPES])
953 AC_DEFINE([IP_TOS_IS_BROKEN])
954 AC_DEFINE([SETEUID_BREAKS_SETUID])
955 AC_DEFINE([BROKEN_SETREUID])
956 AC_DEFINE([BROKEN_SETREGID])
957 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000958 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700959 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
960 # Attention: always take care to bind libsocket and libnsl before libc,
961 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000962 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800963# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100964*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800965 AC_DEFINE([USE_PIPES])
966 AC_DEFINE([SETEUID_BREAKS_SETUID])
967 AC_DEFINE([BROKEN_SETREUID])
968 AC_DEFINE([BROKEN_SETREGID])
969 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
970 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -0700971 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +1100972 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800973# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100974*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800975 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800976 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
977 AC_DEFINE([USE_PIPES])
978 AC_DEFINE([SETEUID_BREAKS_SETUID])
979 AC_DEFINE([BROKEN_GETADDRINFO])
980 AC_DEFINE([BROKEN_SETREUID])
981 AC_DEFINE([BROKEN_SETREGID])
982 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice5ab9b632013-06-02 14:05:48 -0700983 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4dbacff2005-06-01 20:09:28 -0700984 case "$host" in
985 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700986 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800987 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700988 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800989 AC_DEFINE([BROKEN_UPDWTMPX])
990 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
991 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
992 AC_DEFINE([HAVE_SECUREWARE])
993 AC_DEFINE([DISABLE_SHADOW])
994 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700995 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800996 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800997 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800998 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700999 esac
Damien Miller78315eb2000-09-29 23:01:36 +11001000 ;;
Damien Miller75b1d102000-01-07 14:01:41 +11001001*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +11001002 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001003# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +11001004*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -08001005 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +11001006 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001007# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +11001008*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -08001009 if test -z "$GCC"; then
1010 CFLAGS="$CFLAGS -belf"
1011 fi
Damien Miller5dfe9762001-02-16 12:05:39 +11001012 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +10001013 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -08001014 AC_DEFINE([USE_PIPES])
1015 AC_DEFINE([HAVE_SECUREWARE])
1016 AC_DEFINE([DISABLE_SHADOW])
1017 AC_DEFINE([DISABLE_FD_PASSING])
1018 AC_DEFINE([SETEUID_BREAKS_SETUID])
1019 AC_DEFINE([BROKEN_GETADDRINFO])
1020 AC_DEFINE([BROKEN_SETREUID])
1021 AC_DEFINE([BROKEN_SETREGID])
1022 AC_DEFINE([WITH_ABBREV_NO_TTY])
1023 AC_DEFINE([BROKEN_UPDWTMPX])
1024 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1025 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -07001026 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -07001027 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -07001028 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +10001029 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001030*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -08001031 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001032 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -08001033 AC_DEFINE([SETEUID_BREAKS_SETUID])
1034 AC_DEFINE([BROKEN_SETREUID])
1035 AC_DEFINE([BROKEN_SETREGID])
1036 AC_DEFINE([USE_PIPES])
1037 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001038 LDFLAGS="$LDFLAGS"
1039 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
1040 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +00001041 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001042*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -08001043 AC_DEFINE([SETEUID_BREAKS_SETUID])
1044 AC_DEFINE([BROKEN_SETREUID])
1045 AC_DEFINE([BROKEN_SETREGID])
1046 AC_DEFINE([WITH_ABBREV_NO_TTY])
1047 AC_DEFINE([USE_PIPES])
1048 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001049 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +11001050 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001051 MANTYPE=cat
1052 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +00001053*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -08001054 AC_DEFINE([SETEUID_BREAKS_SETUID])
1055 AC_DEFINE([BROKEN_SETREUID])
1056 AC_DEFINE([BROKEN_SETREGID])
1057 AC_DEFINE([USE_PIPES])
1058 AC_DEFINE([DISABLE_FD_PASSING])
1059 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001060 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
1061 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
1062 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -07001063 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001064*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001065 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001066 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001067 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001068 [ --with-osfsia Enable Digital Unix SIA],
1069 [
1070 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001071 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001072 no_osfsia=1
1073 fi
1074 ],
1075 )
1076 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001077 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001078 AC_MSG_RESULT([yes])
1079 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001080 [Define if you have Digital Unix Security
1081 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001082 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001083 [Define if you don't want to use your
1084 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001085 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001086 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001087 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001088 else
Tim Rice648f8762011-01-26 12:38:57 -08001089 AC_MSG_RESULT([no])
1090 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001091 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001092 fi
1093 fi
Tim Rice648f8762011-01-26 12:38:57 -08001094 AC_DEFINE([BROKEN_GETADDRINFO])
1095 AC_DEFINE([SETEUID_BREAKS_SETUID])
1096 AC_DEFINE([BROKEN_SETREUID])
1097 AC_DEFINE([BROKEN_SETREGID])
1098 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001099 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001100
Tim Rice70335a62006-02-04 17:42:58 -08001101*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001102 AC_DEFINE([USE_PIPES])
1103 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001104 AC_DEFINE([DISABLE_LASTLOG])
1105 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1106 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001107 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001108 case "$host" in
1109 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001110 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001111 ;;
1112 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001113 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001114
1115*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001116 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
Tim Rice648f8762011-01-26 12:38:57 -08001117 AC_DEFINE([NEED_SETPGRP])
1118 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001119 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001120
1121*-*-lynxos)
Darren Tucker5faa52d2016-08-02 15:22:40 +10001122 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
1123 AC_DEFINE([BROKEN_SETVBUF], [1],
1124 [LynxOS has broken setvbuf() implementation])
1125 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001126esac
1127
Tim Rice648f8762011-01-26 12:38:57 -08001128AC_MSG_CHECKING([compiler and flags for sanity])
1129AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1130 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001131 [
Tim Rice648f8762011-01-26 12:38:57 -08001132 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001133 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001134 ],
1135 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001136)
1137
Darren Tucker0c9653f2005-05-28 15:58:14 +10001138dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001139# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001140AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001141
Tim Rice1e1ef642003-09-11 22:19:31 -07001142dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001143AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1144 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001145 AC_CACHE_CHECK([for broken dirname],
1146 ac_cv_have_broken_dirname, [
1147 save_LIBS="$LIBS"
1148 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001149 AC_RUN_IFELSE(
1150 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001151#include <libgen.h>
1152#include <string.h>
1153
1154int main(int argc, char **argv) {
1155 char *s, buf[32];
1156
1157 strncpy(buf,"/etc", 32);
1158 s = dirname(buf);
1159 if (!s || strncmp(s, "/", 32) != 0) {
1160 exit(1);
1161 } else {
1162 exit(0);
1163 }
1164}
Darren Tucker314d89e2005-10-17 23:29:23 +10001165 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001166 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001167 [ ac_cv_have_broken_dirname="yes" ],
1168 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001169 )
1170 LIBS="$save_LIBS"
1171 ])
1172 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1173 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001174 AC_DEFINE([HAVE_DIRNAME])
1175 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001176 fi
1177 ])
1178])
1179
Tim Rice648f8762011-01-26 12:38:57 -08001180AC_CHECK_FUNC([getspnam], ,
1181 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1182AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1183 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001184
Tim Rice13aae5e2001-10-21 17:53:58 -07001185dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001186AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001187 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001188 [ if test "x$withval" = "xno" ; then
1189 AC_MSG_ERROR([*** zlib is required ***])
1190 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001191 if test -d "$withval/lib"; then
1192 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001193 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001194 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001195 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001196 fi
1197 else
1198 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001199 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001200 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001201 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001202 fi
1203 fi
1204 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001205 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001206 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001207 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001208 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001209 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001210)
1211
Tim Rice648f8762011-01-26 12:38:57 -08001212AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1213AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001214 [
1215 saved_CPPFLAGS="$CPPFLAGS"
1216 saved_LDFLAGS="$LDFLAGS"
1217 save_LIBS="$LIBS"
1218 dnl Check default zlib install dir
1219 if test -n "${need_dash_r}"; then
1220 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1221 else
1222 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1223 fi
1224 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1225 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001226 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001227 [
1228 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1229 ]
1230 )
1231 ]
1232)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001233
Tim Rice648f8762011-01-26 12:38:57 -08001234AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001235 [ --without-zlib-version-check Disable zlib version check],
1236 [ if test "x$withval" = "xno" ; then
1237 zlib_check_nonfatal=1
1238 fi
1239 ]
1240)
1241
Tim Rice648f8762011-01-26 12:38:57 -08001242AC_MSG_CHECKING([for possibly buggy zlib])
1243AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001244#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001245#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001246#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001247 ]],
1248 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001249 int a=0, b=0, c=0, d=0, n, v;
1250 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1251 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001252 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001253 v = a*1000000 + b*10000 + c*100 + d;
1254 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1255
1256 /* 1.1.4 is OK */
1257 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001258 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001259
Darren Tucker41097ed2005-07-25 15:24:21 +10001260 /* 1.2.3 and up are OK */
1261 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001262 exit(0);
1263
Darren Tucker2dcd2392004-01-23 17:13:33 +11001264 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001265 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001266 AC_MSG_RESULT([no]),
1267 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001268 if test -z "$zlib_check_nonfatal" ; then
1269 AC_MSG_ERROR([*** zlib too old - check config.log ***
1270Your reported zlib version has known security problems. It's possible your
1271vendor has fixed these problems without changing the version number. If you
1272are sure this is the case, you can disable the check by running
1273"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001274If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001275See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001276 else
1277 AC_MSG_WARN([zlib version may have security problems])
1278 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001279 ],
1280 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001281)
Damien Miller6f9c3372000-10-25 10:06:04 +11001282
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001283dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001284AC_CHECK_FUNC([strcasecmp],
1285 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001286)
Tim Rice648f8762011-01-26 12:38:57 -08001287AC_CHECK_FUNCS([utimes],
1288 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001289 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001290)
Damien Millerab18c411999-11-11 10:40:23 +11001291
Tim Ricee589a292001-11-03 11:09:32 -08001292dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001293AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001294AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001295AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001296AC_SEARCH_LIBS([login], [util bsd])
1297AC_SEARCH_LIBS([logout], [util bsd])
1298AC_SEARCH_LIBS([logwtmp], [util bsd])
1299AC_SEARCH_LIBS([openpty], [util bsd])
1300AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001301AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001302
Darren Tucker2fee9092016-02-17 09:48:15 +11001303# On some platforms, inet_ntop and gethostbyname may be found in libresolv
1304# or libnsl.
Damien Millerab039492014-01-28 15:07:10 +11001305AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
Darren Tucker2fee9092016-02-17 09:48:15 +11001306AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
Damien Millerab039492014-01-28 15:07:10 +11001307
Ben Lindstrom8697e082001-02-24 21:41:10 +00001308AC_FUNC_STRFTIME
1309
Damien Miller3c027682001-03-14 11:39:45 +11001310# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001311AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1312AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001313 [
1314 #include <glob.h>
1315 #ifdef GLOB_ALTDIRFUNC
1316 FOUNDIT
1317 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001318 ],
Damien Miller3c027682001-03-14 11:39:45 +11001319 [
Tim Rice648f8762011-01-26 12:38:57 -08001320 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001321 [Define if your system glob() function has
1322 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001323 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001324 ],
1325 [
Tim Rice648f8762011-01-26 12:38:57 -08001326 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001327 ]
1328)
Damien Millerab18c411999-11-11 10:40:23 +11001329
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001330# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001331AC_MSG_CHECKING([for gl_matchc field in glob_t])
1332AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1333 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001334 [
Tim Rice648f8762011-01-26 12:38:57 -08001335 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001336 [Define if your system glob() function has
1337 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001338 AC_MSG_RESULT([yes])
1339 ], [
1340 AC_MSG_RESULT([no])
1341])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001342
Damien Millera6e121a2010-10-07 21:39:17 +11001343# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001344AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1345AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001346#ifndef GLOB_KEEPSTAT
1347#error "glob does not support GLOB_KEEPSTAT extension"
1348#endif
1349glob_t g;
1350g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001351]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001352 [
Tim Rice648f8762011-01-26 12:38:57 -08001353 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001354 [Define if your system glob() function has
1355 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001356 AC_MSG_RESULT([yes])
1357 ], [
1358 AC_MSG_RESULT([no])
Damien Miller72ef7c12015-01-15 02:21:31 +11001359
Tim Rice648f8762011-01-26 12:38:57 -08001360])
Damien Millera6e121a2010-10-07 21:39:17 +11001361
Tim Rice648f8762011-01-26 12:38:57 -08001362AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001363
Darren Tucker7df91b02016-07-14 12:25:24 +10001364AC_CHECK_DECL([VIS_ALL], ,
1365 AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
1366
Damien Miller18bb4732001-03-28 14:35:30 +10001367AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001368AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001369 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001370#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001371#include <dirent.h>]],
1372 [[
1373 struct dirent d;
1374 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001375 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001376 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001377 [
Tim Rice648f8762011-01-26 12:38:57 -08001378 AC_MSG_RESULT([no])
1379 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001380 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001381 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001382 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001383 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001384 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001385 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001386 ]
1387)
1388
Damien Miller36f49652004-08-15 18:40:59 +10001389AC_MSG_CHECKING([for /proc/pid/fd directory])
1390if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001391 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1392 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001393else
Tim Rice648f8762011-01-26 12:38:57 -08001394 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001395fi
1396
Damien Millerc547bf12001-02-16 10:18:12 +11001397# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001398SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001399AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001400 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001401 [
1402 if test "x$withval" != "xno" ; then
1403
1404 if test "x$withval" != "xyes" ; then
1405 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1406 LDFLAGS="$LDFLAGS -L${withval}/lib"
1407 fi
1408
Tim Rice648f8762011-01-26 12:38:57 -08001409 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001410 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001411 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001412
Tim Rice4cec93f2002-02-26 08:40:48 -08001413 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001414 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001415 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001416#include <stdio.h>
1417#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001418 ]], [[
1419 char *ff = skey_keyinfo(""); ff="";
1420 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001421 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001422 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001423 [
Tim Rice648f8762011-01-26 12:38:57 -08001424 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001425 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1426 ])
Tim Ricee1d93702016-05-31 11:13:22 -07001427 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
Tim Rice648f8762011-01-26 12:38:57 -08001428 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1429#include <stdio.h>
1430#include <skey.h>
1431 ]], [[
1432 (void)skeychallenge(NULL,"name","",0);
1433 ]])],
1434 [
1435 AC_MSG_RESULT([yes])
1436 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001437 [Define if your skeychallenge()
1438 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001439 [
1440 AC_MSG_RESULT([no])
1441 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001442 fi
1443 ]
1444)
1445
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001446# Check whether user wants to use ldns
1447LDNS_MSG="no"
1448AC_ARG_WITH(ldns,
1449 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
Damien Miller523db852017-02-03 16:01:22 +11001450 [
1451 ldns=""
1452 if test "x$withval" = "xyes" ; then
1453 AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no])
1454 if test "x$PKGCONFIG" = "xno"; then
1455 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1456 LDFLAGS="$LDFLAGS -L${withval}/lib"
1457 LIBS="-lldns $LIBS"
1458 ldns=yes
1459 else
1460 LIBS="$LIBS `$LDNSCONFIG --libs`"
1461 CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`"
Darren Tucker7af27bf2017-03-24 09:44:56 +11001462 ldns=yes
Damien Miller523db852017-02-03 16:01:22 +11001463 fi
1464 elif test "x$withval" != "xno" ; then
1465 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1466 LDFLAGS="$LDFLAGS -L${withval}/lib"
1467 LIBS="-lldns $LIBS"
1468 ldns=yes
1469 fi
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001470
Damien Miller523db852017-02-03 16:01:22 +11001471 # Verify that it works.
1472 if test "x$ldns" = "xyes" ; then
1473 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1474 LDNS_MSG="yes"
1475 AC_MSG_CHECKING([for ldns support])
1476 AC_LINK_IFELSE(
1477 [AC_LANG_SOURCE([[
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001478#include <stdio.h>
1479#include <stdlib.h>
1480#include <stdint.h>
1481#include <ldns/ldns.h>
1482int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
Damien Miller523db852017-02-03 16:01:22 +11001483 ]])
1484 ],
1485 [AC_MSG_RESULT(yes)],
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001486 [
1487 AC_MSG_RESULT(no)
1488 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1489 ])
Damien Miller523db852017-02-03 16:01:22 +11001490 fi
1491])
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001492
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001493# Check whether user wants libedit support
1494LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001495AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001496 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001497 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001498 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001499 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001500 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001501 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Tim Ricee1d93702016-05-31 11:13:22 -07001502 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001503 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001504 use_pkgconfig_for_libedit=yes
1505 else
Tim Rice648f8762011-01-26 12:38:57 -08001506 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001507 fi
1508 fi
1509 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001510 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1511 if test -n "${need_dash_r}"; then
1512 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1513 else
1514 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1515 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001516 fi
Damien Miller1f789802010-10-11 22:35:22 +11001517 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001518 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001519 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1520 else
1521 LIBEDIT="-ledit -lcurses"
1522 fi
1523 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001524 AC_CHECK_LIB([edit], [el_init],
1525 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001526 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001527 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001528 ],
Tim Rice648f8762011-01-26 12:38:57 -08001529 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001530 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001531 )
Tim Rice648f8762011-01-26 12:38:57 -08001532 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001533 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001534 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1535 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001536 int i = H_SETSIZE;
1537 el_init("", NULL, NULL, NULL);
1538 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001539 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001540 [ AC_MSG_RESULT([yes]) ],
1541 [ AC_MSG_RESULT([no])
1542 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001543 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001544 fi ]
1545)
1546
Darren Tuckerd9f88912005-02-20 21:01:48 +11001547AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001548AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001549 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001550 [
Tim Rice648f8762011-01-26 12:38:57 -08001551 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001552 case "$withval" in
1553 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001554 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001555 AUDIT_MODULE=bsm
1556 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001557 AC_CHECK_HEADERS([bsm/audit.h], [],
1558 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001559 [
1560#ifdef HAVE_TIME_H
1561# include <time.h>
1562#endif
1563 ]
1564)
Tim Rice648f8762011-01-26 12:38:57 -08001565 AC_CHECK_LIB([bsm], [getaudit], [],
1566 [AC_MSG_ERROR([BSM enabled and required library not found])])
1567 AC_CHECK_FUNCS([getaudit], [],
1568 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001569 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001570 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1571 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001572 if test "$sol2ver" -ge 11; then
Tim Ricee1d93702016-05-31 11:13:22 -07001573 SSHDLIBS="$SSHDLIBS -lscf"
1574 AC_DEFINE([BROKEN_BSM_API], [1],
1575 [The system has incomplete BSM API])
Darren Tucker93a2d412012-02-24 10:40:41 +11001576 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001577 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001578 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001579 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001580 AUDIT_MODULE=linux
1581 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001582 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001583 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001584 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001585 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001586 debug)
1587 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001588 AC_MSG_RESULT([debug])
1589 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001590 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001591 no)
Tim Rice648f8762011-01-26 12:38:57 -08001592 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001593 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001594 *)
1595 AC_MSG_ERROR([Unknown audit module $withval])
1596 ;;
1597 esac ]
1598)
1599
Darren Tucker096118d2014-01-21 12:48:51 +11001600AC_ARG_WITH([pie],
Damien Miller76c04802015-01-13 19:38:18 +11001601 [ --with-pie Build Position Independent Executables if possible], [
Darren Tucker096118d2014-01-21 12:48:51 +11001602 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001603 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001604 fi
1605 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001606 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001607 fi
1608 ]
1609)
Damien Miller852472a2014-01-22 16:31:18 +11001610if test "x$use_pie" = "x"; then
1611 use_pie=no
1612fi
1613if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1614 # Turn off automatic PIE when toolchain hardening is off.
1615 use_pie=no
1616fi
Damien Millerc161fc92014-01-29 21:01:33 +11001617if test "x$use_pie" = "xauto"; then
Damien Miller852472a2014-01-22 16:31:18 +11001618 # Automatic PIE requires gcc >= 4.x
1619 AC_MSG_CHECKING([for gcc >= 4.x])
1620 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1621#if !defined(__GNUC__) || __GNUC__ < 4
1622#error gcc is too old
1623#endif
1624]])],
1625 [ AC_MSG_RESULT([yes]) ],
1626 [ AC_MSG_RESULT([no])
1627 use_pie=no ]
1628)
1629fi
1630if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001631 SAVED_CFLAGS="$CFLAGS"
1632 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001633 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1634 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001635 # We use both -fPIE and -pie or neither.
1636 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1637 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1638 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1639 AC_MSG_RESULT([yes])
1640 else
1641 AC_MSG_RESULT([no])
1642 CFLAGS="$SAVED_CFLAGS"
1643 LDFLAGS="$SAVED_LDFLAGS"
1644 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001645fi
1646
Damien Millerfe1f1432003-02-24 15:45:42 +11001647dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001648AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001649 Blowfish_initstate \
1650 Blowfish_expandstate \
1651 Blowfish_expand0state \
1652 Blowfish_stream2word \
Damien Miller57f39152005-11-24 19:58:19 +11001653 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001654 b64_ntop \
1655 __b64_ntop \
1656 b64_pton \
1657 __b64_pton \
1658 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001659 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001660 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001661 blf_enc \
Damien Millerc96d8532014-01-25 13:12:28 +11001662 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001663 clock \
1664 closefrom \
1665 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001666 endgrent \
Darren Tucker6310ef22016-07-13 14:42:35 +10001667 err \
1668 errx \
Damien Miller1d2c4562014-02-04 11:18:20 +11001669 explicit_bzero \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001670 fchmod \
1671 fchown \
1672 freeaddrinfo \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001673 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001674 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001675 futimes \
1676 getaddrinfo \
1677 getcwd \
1678 getgrouplist \
1679 getnameinfo \
1680 getopt \
1681 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001682 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001683 getpgid \
1684 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001685 _getpty \
1686 getrlimit \
1687 getttyent \
1688 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001689 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001690 inet_aton \
1691 inet_ntoa \
1692 inet_ntop \
1693 innetgr \
Darren Tuckerd38f05d2017-03-20 13:38:27 +11001694 llabs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001695 login_getcapbool \
1696 md5_crypt \
1697 memmove \
Damien Miller3d673d12014-08-27 06:32:01 +10001698 memset_s \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001699 mkdtemp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001700 ngetaddrinfo \
1701 nsleep \
1702 ogetaddrinfo \
1703 openlog_r \
Darren Tucker3ddd15e2015-11-30 07:23:53 +11001704 pledge \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001705 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001706 prctl \
1707 pstat \
1708 readpassphrase \
Darren Tucker642652d2014-12-10 01:32:23 +11001709 reallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001710 recvmsg \
1711 rresvport_af \
1712 sendmsg \
1713 setdtablesize \
1714 setegid \
1715 setenv \
1716 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001717 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001718 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001719 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001720 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001721 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001722 setpcred \
1723 setproctitle \
1724 setregid \
1725 setreuid \
1726 setrlimit \
1727 setsid \
1728 setvbuf \
1729 sigaction \
1730 sigvec \
1731 snprintf \
1732 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001733 statfs \
1734 statvfs \
Darren Tuckerafec0772016-12-13 10:23:03 +11001735 strcasestr \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001736 strdup \
1737 strerror \
1738 strlcat \
1739 strlcpy \
1740 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001741 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001742 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001743 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001744 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001745 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001746 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001747 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001748 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001749 sysconf \
1750 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001751 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001752 truncate \
1753 unsetenv \
1754 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001755 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001756 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001757 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001758 vsnprintf \
1759 waitpid \
Darren Tucker6310ef22016-07-13 14:42:35 +10001760 warn \
Tim Rice648f8762011-01-26 12:38:57 -08001761])
Tim Rice13aae5e2001-10-21 17:53:58 -07001762
Darren Tuckerc61d5ec2017-02-03 14:10:34 +11001763dnl Wide character support.
Darren Tuckera2333582016-07-14 10:59:09 +10001764AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth])
Darren Tuckera2333582016-07-14 10:59:09 +10001765
Darren Tucker10e290e2016-12-13 13:51:32 +11001766TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes}
Darren Tucker47b8c992016-12-08 15:48:34 +11001767AC_MSG_CHECKING([for utf8 locale support])
1768AC_RUN_IFELSE(
1769 [AC_LANG_PROGRAM([[
1770#include <locale.h>
Darren Tuckerc3599502016-12-09 12:52:02 +11001771#include <stdlib.h>
Darren Tucker47b8c992016-12-08 15:48:34 +11001772 ]], [[
1773 char *loc = setlocale(LC_CTYPE, "en_US.UTF-8");
1774 if (loc != NULL)
1775 exit(0);
1776 exit(1);
1777 ]])],
1778 AC_MSG_RESULT(yes),
1779 [AC_MSG_RESULT(no)
1780 TEST_SSH_UTF8=no],
1781 AC_MSG_WARN([cross compiling: assuming yes])
1782)
1783
Tim Ricec7a8af02010-11-08 14:26:23 -08001784AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001785 [AC_LANG_PROGRAM(
1786 [[ #include <ctype.h> ]],
1787 [[ return (isblank('a')); ]])],
1788 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001789])
1790
Damien Miller5fbe93f2016-07-15 13:54:31 +10001791disable_pkcs11=
1792AC_ARG_ENABLE([pkcs11],
1793 [ --disable-pkcs11 disable PKCS#11 support code [no]],
1794 [
1795 if test "x$enableval" = "xno" ; then
1796 disable_pkcs11=1
1797 fi
1798 ]
1799)
1800
Damien Miller72ef7c12015-01-15 02:21:31 +11001801# PKCS11 depends on OpenSSL.
Damien Miller5fbe93f2016-07-15 13:54:31 +10001802if test "x$openssl" = "xyes" && test "x$disable_pkcs11" = "x"; then
Damien Miller72ef7c12015-01-15 02:21:31 +11001803 # PKCS#11 support requires dlopen() and co
1804 AC_SEARCH_LIBS([dlopen], [dl],
1805 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
1806 )
1807fi
Damien Millerb3c9f782010-02-12 10:11:34 +11001808
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001809# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001810AC_CHECK_FUNCS([gai_strerror], [
1811 AC_DEFINE([HAVE_GAI_STRERROR])
1812 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001813#include <sys/types.h>
1814#include <sys/socket.h>
1815#include <netdb.h>
1816
Tim Rice648f8762011-01-26 12:38:57 -08001817const char *gai_strerror(int);
1818 ]], [[
1819 char *str;
1820 str = gai_strerror(0);
1821 ]])], [
1822 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1823 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001824
Tim Rice648f8762011-01-26 12:38:57 -08001825AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1826 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001827
Darren Tuckera7108912013-06-02 08:18:31 +10001828AC_SEARCH_LIBS([clock_gettime], [rt],
1829 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1830
Darren Tuckerf1159b52003-07-07 19:44:01 +10001831dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001832AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1833AC_CHECK_DECL([strsep],
1834 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001835 [],
1836 [
1837#ifdef HAVE_STRING_H
1838# include <string.h>
1839#endif
1840 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001841
Darren Tuckerb2427c82003-09-10 15:22:44 +10001842dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001843AC_CHECK_DECL([tcsendbreak],
1844 [AC_DEFINE([HAVE_TCSENDBREAK])],
1845 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001846 [#include <termios.h>]
1847)
1848
Tim Rice648f8762011-01-26 12:38:57 -08001849AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001850
Tim Rice648f8762011-01-26 12:38:57 -08001851AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001852 [
1853#include <sys/types.h>
1854#include <sys/socket.h>
1855 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001856
Tim Rice648f8762011-01-26 12:38:57 -08001857AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001858 [
1859#include <sys/types.h>
1860#ifdef HAVE_SYS_STAT_H
1861# include <sys/stat.h>
1862#endif
1863#ifdef HAVE_FCNTL_H
1864# include <fcntl.h>
1865#endif
1866 ])
1867
Tim Rice648f8762011-01-26 12:38:57 -08001868AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001869#include <sys/types.h>
1870#include <sys/uio.h>
1871#include <unistd.h>
1872 ])
1873
Tim Rice648f8762011-01-26 12:38:57 -08001874AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001875#include <sys/param.h>
1876 ])
1877
Tim Rice648f8762011-01-26 12:38:57 -08001878AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001879#include <stddef.h>
1880 ])
1881
Darren Tuckerc7aad002013-06-02 07:18:47 +10001882# extra bits for select(2)
1883AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1884#include <sys/param.h>
1885#include <sys/types.h>
1886#ifdef HAVE_SYS_SYSMACROS_H
1887#include <sys/sysmacros.h>
1888#endif
1889#ifdef HAVE_SYS_SELECT_H
1890#include <sys/select.h>
1891#endif
1892#ifdef HAVE_SYS_TIME_H
1893#include <sys/time.h>
1894#endif
1895#ifdef HAVE_UNISTD_H
1896#include <unistd.h>
1897#endif
1898 ]])
1899AC_CHECK_TYPES([fd_mask], [], [], [[
1900#include <sys/param.h>
1901#include <sys/types.h>
1902#ifdef HAVE_SYS_SELECT_H
1903#include <sys/select.h>
1904#endif
1905#ifdef HAVE_SYS_TIME_H
1906#include <sys/time.h>
1907#endif
1908#ifdef HAVE_UNISTD_H
1909#include <unistd.h>
1910#endif
1911 ]])
1912
Tim Rice648f8762011-01-26 12:38:57 -08001913AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001914 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001915 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001916 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001917 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001918#include <stdlib.h>
1919#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001920 ]], [[
1921 errno=0;
1922 setresuid(0,0,0);
1923 if (errno==ENOSYS)
1924 exit(1);
1925 else
1926 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001927 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001928 [AC_MSG_RESULT([yes])],
1929 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001930 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001931 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001932 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001933 )
1934])
Darren Tuckere937be32003-12-17 18:53:26 +11001935
Tim Rice648f8762011-01-26 12:38:57 -08001936AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001937 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001938 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001939 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001940 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001941#include <stdlib.h>
1942#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001943 ]], [[
1944 errno=0;
1945 setresgid(0,0,0);
1946 if (errno==ENOSYS)
1947 exit(1);
1948 else
1949 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001950 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001951 [AC_MSG_RESULT([yes])],
1952 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001953 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001954 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001955 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001956 )
1957])
Darren Tuckere937be32003-12-17 18:53:26 +11001958
Darren Tuckerd3e2aee2015-07-17 12:52:34 +10001959AC_CHECK_FUNCS([realpath], [
1960 dnl the sftp v3 spec says SSH_FXP_REALPATH will "canonicalize any given
1961 dnl path name", however some implementations of realpath (and some
1962 dnl versions of the POSIX spec) do not work on non-existent files,
1963 dnl so we use the OpenBSD implementation on those platforms.
1964 AC_MSG_CHECKING([if realpath works with non-existent files])
1965 AC_RUN_IFELSE(
1966 [AC_LANG_PROGRAM([[
1967#include <limits.h>
1968#include <stdlib.h>
1969#include <errno.h>
1970 ]], [[
1971 char buf[PATH_MAX];
1972 if (realpath("/opensshnonexistentfilename1234", buf) == NULL)
1973 if (errno == ENOENT)
1974 exit(1);
1975 exit(0);
1976 ]])],
1977 [AC_MSG_RESULT([yes])],
1978 [AC_DEFINE([BROKEN_REALPATH], [1],
1979 [realpath does not work with nonexistent files])
1980 AC_MSG_RESULT([no])],
1981 [AC_MSG_WARN([cross compiling: assuming working])]
1982 )
1983])
1984
Damien Millerad833b32000-08-23 10:46:23 +10001985dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001986AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001987dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001988AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1989AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001990dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001991AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1992AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001993dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001994AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001995
Tim Rice648f8762011-01-26 12:38:57 -08001996AC_CHECK_FUNC([daemon],
1997 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1998 [AC_CHECK_LIB([bsd], [daemon],
1999 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11002000)
2001
Tim Rice648f8762011-01-26 12:38:57 -08002002AC_CHECK_FUNC([getpagesize],
2003 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002004 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08002005 [AC_CHECK_LIB([ucb], [getpagesize],
2006 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11002007)
2008
Damien Millercb170cb2000-07-01 16:52:55 +10002009# Check for broken snprintf
2010if test "x$ac_cv_func_snprintf" = "xyes" ; then
2011 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002012 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002013 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
2014 [[
2015 char b[5];
2016 snprintf(b,5,"123456789");
Tim Ricee1d93702016-05-31 11:13:22 -07002017 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10002018 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002019 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10002020 [
Tim Rice648f8762011-01-26 12:38:57 -08002021 AC_MSG_RESULT([no])
2022 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002023 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10002024 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002025 ],
2026 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10002027 )
2028fi
2029
Damien Millerd244a582014-08-23 17:06:49 +10002030# We depend on vsnprintf returning the right thing on overflow: the
2031# number of characters it tried to create (as per SUSv3)
2032if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
Damien Miller57f39152005-11-24 19:58:19 +11002033 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
2034 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002035 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11002036#include <sys/types.h>
2037#include <stdio.h>
2038#include <stdarg.h>
2039
Damien Millerd244a582014-08-23 17:06:49 +10002040int x_snprintf(char *str, size_t count, const char *fmt, ...)
Damien Miller57f39152005-11-24 19:58:19 +11002041{
Damien Millerd244a582014-08-23 17:06:49 +10002042 size_t ret;
2043 va_list ap;
2044
2045 va_start(ap, fmt);
2046 ret = vsnprintf(str, count, fmt, ap);
2047 va_end(ap);
Damien Miller57f39152005-11-24 19:58:19 +11002048 return ret;
2049}
Tim Rice648f8762011-01-26 12:38:57 -08002050 ]], [[
Damien Millerd244a582014-08-23 17:06:49 +10002051char x[1];
2052if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11)
2053 return 1;
2054if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11)
2055 return 1;
2056return 0;
Tim Rice648f8762011-01-26 12:38:57 -08002057 ]])],
2058 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11002059 [
Tim Rice648f8762011-01-26 12:38:57 -08002060 AC_MSG_RESULT([no])
2061 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11002062 [Define if your snprintf is busted])
2063 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
2064 ],
2065 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
2066 )
2067fi
2068
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002069# On systems where [v]snprintf is broken, but is declared in stdio,
2070# check that the fmt argument is const char * or just char *.
2071# This is only useful for when BROKEN_SNPRINTF
2072AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08002073AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2074#include <stdio.h>
2075int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
2076 ]], [[
2077 snprintf(0, 0, 0);
2078 ]])],
2079 [AC_MSG_RESULT([yes])
2080 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002081 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08002082 [AC_MSG_RESULT([no])
2083 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002084
Damien Millerb4097182004-05-23 14:09:40 +10002085# Check for missing getpeereid (or equiv) support
2086NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11002087if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10002088 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08002089 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2090#include <sys/types.h>
2091#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2092 [ AC_MSG_RESULT([yes])
2093 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2094 ], [AC_MSG_RESULT([no])
2095 NO_PEERCHECK=1
2096 ])
Damien Millerb4097182004-05-23 14:09:40 +10002097fi
2098
Damien Millere8328192003-01-07 15:18:32 +11002099dnl see whether mkstemp() requires XXXXXX
2100if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2101AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002102AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002103 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002104#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002105 ]], [[
2106 char template[]="conftest.mkstemp-test";
2107 if (mkstemp(template) == -1)
2108 exit(1);
2109 unlink(template);
2110 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002111 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002112 [
Tim Rice648f8762011-01-26 12:38:57 -08002113 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002114 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002115 [
Tim Rice648f8762011-01-26 12:38:57 -08002116 AC_MSG_RESULT([yes])
2117 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002118 ],
2119 [
Tim Rice648f8762011-01-26 12:38:57 -08002120 AC_MSG_RESULT([yes])
2121 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002122 ]
Damien Millere8328192003-01-07 15:18:32 +11002123)
2124fi
2125
Darren Tucker70a3d552003-08-21 17:58:29 +10002126dnl make sure that openpty does not reacquire controlling terminal
2127if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002128 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002129 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002130 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002131#include <stdio.h>
2132#include <sys/fcntl.h>
2133#include <sys/types.h>
2134#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002135 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002136 pid_t pid;
2137 int fd, ptyfd, ttyfd, status;
2138
2139 pid = fork();
2140 if (pid < 0) { /* failed */
2141 exit(1);
2142 } else if (pid > 0) { /* parent */
2143 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002144 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002145 exit(WEXITSTATUS(status));
2146 else
2147 exit(2);
2148 } else { /* child */
2149 close(0); close(1); close(2);
2150 setsid();
2151 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2152 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2153 if (fd >= 0)
2154 exit(3); /* Acquired ctty: broken */
2155 else
2156 exit(0); /* Did not acquire ctty: OK */
2157 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002158 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002159 [
Tim Rice648f8762011-01-26 12:38:57 -08002160 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002161 ],
2162 [
Tim Rice648f8762011-01-26 12:38:57 -08002163 AC_MSG_RESULT([no])
2164 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002165 ],
2166 [
Tim Rice648f8762011-01-26 12:38:57 -08002167 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002168 ]
2169 )
2170fi
2171
Tim Rice8bb561b2005-03-17 16:23:19 -08002172if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2173 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002174 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002175 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002176 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002177#include <stdio.h>
2178#include <sys/socket.h>
2179#include <netdb.h>
2180#include <errno.h>
2181#include <netinet/in.h>
2182
2183#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002184 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002185 int err, sock;
2186 struct addrinfo *gai_ai, *ai, hints;
2187 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2188
2189 memset(&hints, 0, sizeof(hints));
2190 hints.ai_family = PF_UNSPEC;
2191 hints.ai_socktype = SOCK_STREAM;
2192 hints.ai_flags = AI_PASSIVE;
2193
2194 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2195 if (err != 0) {
2196 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2197 exit(1);
2198 }
2199
2200 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2201 if (ai->ai_family != AF_INET6)
2202 continue;
2203
2204 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2205 sizeof(ntop), strport, sizeof(strport),
2206 NI_NUMERICHOST|NI_NUMERICSERV);
2207
2208 if (err != 0) {
2209 if (err == EAI_SYSTEM)
2210 perror("getnameinfo EAI_SYSTEM");
2211 else
2212 fprintf(stderr, "getnameinfo failed: %s\n",
2213 gai_strerror(err));
2214 exit(2);
2215 }
2216
2217 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2218 if (sock < 0)
2219 perror("socket");
2220 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2221 if (errno == EBADF)
2222 exit(3);
2223 }
2224 }
2225 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002226 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002227 [
Tim Rice648f8762011-01-26 12:38:57 -08002228 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002229 ],
2230 [
Tim Rice648f8762011-01-26 12:38:57 -08002231 AC_MSG_RESULT([no])
2232 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002233 ],
2234 [
Tim Rice648f8762011-01-26 12:38:57 -08002235 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002236 ]
2237 )
2238fi
2239
Tim Rice8bb561b2005-03-17 16:23:19 -08002240if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2241 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002242 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002243 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002244 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002245#include <stdio.h>
2246#include <sys/socket.h>
2247#include <netdb.h>
2248#include <errno.h>
2249#include <netinet/in.h>
2250
2251#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002252 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002253 int err, sock;
2254 struct addrinfo *gai_ai, *ai, hints;
2255 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2256
2257 memset(&hints, 0, sizeof(hints));
2258 hints.ai_family = PF_UNSPEC;
2259 hints.ai_socktype = SOCK_STREAM;
2260 hints.ai_flags = AI_PASSIVE;
2261
2262 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2263 if (err != 0) {
2264 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2265 exit(1);
2266 }
2267
2268 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2269 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2270 continue;
2271
2272 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2273 sizeof(ntop), strport, sizeof(strport),
2274 NI_NUMERICHOST|NI_NUMERICSERV);
2275
2276 if (ai->ai_family == AF_INET && err != 0) {
2277 perror("getnameinfo");
2278 exit(2);
2279 }
2280 }
2281 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002282 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002283 [
Tim Rice648f8762011-01-26 12:38:57 -08002284 AC_MSG_RESULT([yes])
2285 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002286 [Define if you have a getaddrinfo that fails
2287 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002288 ],
2289 [
Tim Rice648f8762011-01-26 12:38:57 -08002290 AC_MSG_RESULT([no])
2291 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002292 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002293 [
Tim Rice648f8762011-01-26 12:38:57 -08002294 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002295 ]
2296 )
2297fi
2298
Darren Tuckere50e8c92015-02-21 15:10:33 +11002299if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2300 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2301 [#include <sys/types.h>
2302 #include <sys/socket.h>
2303 #include <netdb.h>])
2304fi
2305
Darren Tuckera56f1912004-11-02 20:30:54 +11002306if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002307 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2308 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2309 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002310 [
Tim Rice648f8762011-01-26 12:38:57 -08002311 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002312 ],
2313 [
Tim Rice648f8762011-01-26 12:38:57 -08002314 AC_MSG_RESULT([yes])
2315 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002316 [Conflicting defs for getspnam])
2317 ]
2318 )
2319fi
2320
Darren Tucker20e5e8b2016-08-02 12:16:34 +10002321dnl NetBSD added an strnvis and unfortunately made it incompatible with the
2322dnl existing one in OpenBSD and Linux's libbsd (the former having existed
2323dnl for over ten years). Despite this incompatibility being reported during
2324dnl development (see http://gnats.netbsd.org/44977) they still shipped it.
2325dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible
2326dnl implementation. Try to detect this mess, and assume the only safe option
2327dnl if we're cross compiling.
2328dnl
2329dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag);
2330dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag);
2331if test "x$ac_cv_func_strnvis" = "xyes"; then
2332 AC_MSG_CHECKING([for working strnvis])
2333 AC_RUN_IFELSE(
2334 [AC_LANG_PROGRAM([[
2335#include <signal.h>
2336#include <stdlib.h>
2337#include <string.h>
2338#include <vis.h>
2339static void sighandler(int sig) { _exit(1); }
2340 ]], [[
2341 char dst[16];
2342
2343 signal(SIGSEGV, sighandler);
2344 if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0)
2345 exit(0);
2346 exit(1)
2347 ]])],
2348 [AC_MSG_RESULT([yes])],
2349 [AC_MSG_RESULT([no])
2350 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])],
2351 [AC_MSG_WARN([cross compiling: assuming broken])
2352 AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])]
2353 )
2354fi
2355
Damien Miller606f8802000-09-16 15:39:56 +11002356AC_FUNC_GETPGRP
2357
Tim Riceaef73712002-05-11 13:17:42 -07002358# Search for OpenSSL
2359saved_CPPFLAGS="$CPPFLAGS"
2360saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002361AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002362 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2363 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002364 if test "x$openssl" = "xno" ; then
2365 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2366 fi
Ben Lindstrom23e13712000-10-29 22:49:19 +00002367 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002368 case "$withval" in
2369 # Relative paths
2370 ./*|../*) withval="`pwd`/$withval"
2371 esac
Tim Riceaef73712002-05-11 13:17:42 -07002372 if test -d "$withval/lib"; then
2373 if test -n "${need_dash_r}"; then
2374 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2375 else
2376 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2377 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002378 elif test -d "$withval/lib64"; then
2379 if test -n "${need_dash_r}"; then
2380 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2381 else
2382 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2383 fi
Tim Riceaef73712002-05-11 13:17:42 -07002384 else
2385 if test -n "${need_dash_r}"; then
2386 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2387 else
2388 LDFLAGS="-L${withval} ${LDFLAGS}"
2389 fi
2390 fi
2391 if test -d "$withval/include"; then
2392 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2393 else
2394 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2395 fi
Damien Millera22ba012000-03-02 23:09:20 +11002396 fi
2397 ]
2398)
Damien Millerb9c56672014-05-15 14:43:37 +10002399
Tim Rice648f8762011-01-26 12:38:57 -08002400AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002401 [ --without-openssl-header-check Disable OpenSSL version consistency check],
Damien Millerec932372002-01-22 22:16:03 +11002402 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002403 if test "x$withval" = "xno" ; then
2404 openssl_check_nonfatal=1
Damien Miller9975e482007-03-05 11:51:27 +11002405 fi
Damien Millerec932372002-01-22 22:16:03 +11002406 ]
2407)
2408
Damien Miller72ef7c12015-01-15 02:21:31 +11002409openssl_engine=no
Tim Rice648f8762011-01-26 12:38:57 -08002410AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002411 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
Damien Miller72ef7c12015-01-15 02:21:31 +11002412 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002413 if test "x$withval" != "xno" ; then
Darren Tuckerb5fa0cd2015-12-15 15:10:32 +11002414 if test "x$openssl" = "xno" ; then
2415 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2416 fi
Damien Miller72ef7c12015-01-15 02:21:31 +11002417 openssl_engine=yes
2418 fi
2419 ]
2420)
2421
2422if test "x$openssl" = "xyes" ; then
2423 LIBS="-lcrypto $LIBS"
2424 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
2425 [Define if your ssl headers are included
2426 with #include <openssl/header.h>])],
2427 [
2428 dnl Check default openssl install dir
2429 if test -n "${need_dash_r}"; then
2430 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2431 else
2432 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2433 fi
2434 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2435 AC_CHECK_HEADER([openssl/opensslv.h], ,
2436 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2437 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2438 [
2439 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2440 ]
2441 )
2442 ]
2443 )
2444
2445 # Determine OpenSSL header version
2446 AC_MSG_CHECKING([OpenSSL header version])
2447 AC_RUN_IFELSE(
2448 [AC_LANG_PROGRAM([[
Darren Tucker15605962015-11-10 11:14:47 +11002449 #include <stdlib.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002450 #include <stdio.h>
2451 #include <string.h>
2452 #include <openssl/opensslv.h>
2453 #define DATA "conftest.sslincver"
2454 ]], [[
2455 FILE *fd;
2456 int rc;
2457
2458 fd = fopen(DATA,"w");
2459 if(fd == NULL)
2460 exit(1);
2461
Darren Tuckerb3413532016-04-04 11:09:21 +10002462 if ((rc = fprintf(fd, "%08lx (%s)\n",
2463 (unsigned long)OPENSSL_VERSION_NUMBER,
2464 OPENSSL_VERSION_TEXT)) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002465 exit(1);
2466
2467 exit(0);
2468 ]])],
2469 [
2470 ssl_header_ver=`cat conftest.sslincver`
2471 AC_MSG_RESULT([$ssl_header_ver])
2472 ],
2473 [
2474 AC_MSG_RESULT([not found])
2475 AC_MSG_ERROR([OpenSSL version header not found.])
2476 ],
2477 [
2478 AC_MSG_WARN([cross compiling: not checking])
2479 ]
2480 )
2481
2482 # Determine OpenSSL library version
2483 AC_MSG_CHECKING([OpenSSL library version])
2484 AC_RUN_IFELSE(
2485 [AC_LANG_PROGRAM([[
2486 #include <stdio.h>
2487 #include <string.h>
2488 #include <openssl/opensslv.h>
2489 #include <openssl/crypto.h>
2490 #define DATA "conftest.ssllibver"
2491 ]], [[
2492 FILE *fd;
2493 int rc;
2494
2495 fd = fopen(DATA,"w");
2496 if(fd == NULL)
2497 exit(1);
2498
Darren Tucker815bcac2016-04-04 11:07:59 +10002499 if ((rc = fprintf(fd, "%08lx (%s)\n", (unsigned long)SSLeay(),
2500 SSLeay_version(SSLEAY_VERSION))) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002501 exit(1);
2502
2503 exit(0);
2504 ]])],
2505 [
2506 ssl_library_ver=`cat conftest.ssllibver`
2507 # Check version is supported.
2508 case "$ssl_library_ver" in
Damien Miller2429cf72017-03-14 18:01:52 +11002509 10000*|0*)
2510 AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
Damien Miller72ef7c12015-01-15 02:21:31 +11002511 ;;
2512 *) ;;
2513 esac
2514 AC_MSG_RESULT([$ssl_library_ver])
2515 ],
2516 [
2517 AC_MSG_RESULT([not found])
2518 AC_MSG_ERROR([OpenSSL library not found.])
2519 ],
2520 [
2521 AC_MSG_WARN([cross compiling: not checking])
2522 ]
2523 )
2524
2525 # Sanity check OpenSSL headers
2526 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2527 AC_RUN_IFELSE(
2528 [AC_LANG_PROGRAM([[
2529 #include <string.h>
2530 #include <openssl/opensslv.h>
Darren Tuckerc1d7e542015-12-15 14:27:09 +11002531 #include <openssl/crypto.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002532 ]], [[
2533 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2534 ]])],
2535 [
2536 AC_MSG_RESULT([yes])
2537 ],
2538 [
2539 AC_MSG_RESULT([no])
2540 if test "x$openssl_check_nonfatal" = "x"; then
2541 AC_MSG_ERROR([Your OpenSSL headers do not match your
2542 library. Check config.log for details.
2543 If you are sure your installation is consistent, you can disable the check
2544 by running "./configure --without-openssl-header-check".
2545 Also see contrib/findssl.sh for help identifying header/library mismatches.
2546 ])
2547 else
2548 AC_MSG_WARN([Your OpenSSL headers do not match your
2549 library. Check config.log for details.
2550 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2551 fi
2552 ],
2553 [
2554 AC_MSG_WARN([cross compiling: not checking])
2555 ]
2556 )
2557
2558 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2559 AC_LINK_IFELSE(
2560 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2561 [[ SSLeay_add_all_algorithms(); ]])],
2562 [
2563 AC_MSG_RESULT([yes])
2564 ],
2565 [
2566 AC_MSG_RESULT([no])
2567 saved_LIBS="$LIBS"
2568 LIBS="$LIBS -ldl"
2569 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2570 AC_LINK_IFELSE(
2571 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2572 [[ SSLeay_add_all_algorithms(); ]])],
2573 [
2574 AC_MSG_RESULT([yes])
2575 ],
2576 [
2577 AC_MSG_RESULT([no])
2578 LIBS="$saved_LIBS"
2579 ]
2580 )
2581 ]
2582 )
2583
2584 AC_CHECK_FUNCS([ \
2585 BN_is_prime_ex \
2586 DSA_generate_parameters_ex \
2587 EVP_DigestInit_ex \
2588 EVP_DigestFinal_ex \
2589 EVP_MD_CTX_init \
2590 EVP_MD_CTX_cleanup \
2591 EVP_MD_CTX_copy_ex \
2592 HMAC_CTX_init \
2593 RSA_generate_key_ex \
2594 RSA_get_default_method \
2595 ])
2596
2597 if test "x$openssl_engine" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002598 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002600 #include <openssl/engine.h>
Tim Rice648f8762011-01-26 12:38:57 -08002601 ]], [[
Damien Miller72ef7c12015-01-15 02:21:31 +11002602 ENGINE_load_builtin_engines();
2603 ENGINE_register_all_complete();
Tim Rice648f8762011-01-26 12:38:57 -08002604 ]])],
2605 [ AC_MSG_RESULT([yes])
2606 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002607 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002608 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2609 ])
Damien Miller72ef7c12015-01-15 02:21:31 +11002610 fi
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002611
Damien Miller72ef7c12015-01-15 02:21:31 +11002612 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2613 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2614 AC_LINK_IFELSE(
Darren Tucker37bcef52013-11-09 18:39:25 +11002615 [AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002616 #include <string.h>
2617 #include <openssl/evp.h>
2618 ]], [[
2619 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2620 ]])],
2621 [
2622 AC_MSG_RESULT([no])
2623 ],
2624 [
2625 AC_MSG_RESULT([yes])
2626 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2627 [libcrypto is missing AES 192 and 256 bit functions])
2628 ]
2629 )
2630
2631 # Check for OpenSSL with EVP_aes_*ctr
2632 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2633 AC_LINK_IFELSE(
2634 [AC_LANG_PROGRAM([[
2635 #include <string.h>
2636 #include <openssl/evp.h>
2637 ]], [[
2638 exit(EVP_aes_128_ctr() == NULL ||
2639 EVP_aes_192_cbc() == NULL ||
2640 EVP_aes_256_cbc() == NULL);
2641 ]])],
2642 [
2643 AC_MSG_RESULT([yes])
2644 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2645 [libcrypto has EVP AES CTR])
2646 ],
2647 [
2648 AC_MSG_RESULT([no])
2649 ]
2650 )
2651
2652 # Check for OpenSSL with EVP_aes_*gcm
2653 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2654 AC_LINK_IFELSE(
2655 [AC_LANG_PROGRAM([[
2656 #include <string.h>
2657 #include <openssl/evp.h>
2658 ]], [[
2659 exit(EVP_aes_128_gcm() == NULL ||
2660 EVP_aes_256_gcm() == NULL ||
2661 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2662 EVP_CTRL_GCM_IV_GEN == 0 ||
2663 EVP_CTRL_GCM_SET_TAG == 0 ||
2664 EVP_CTRL_GCM_GET_TAG == 0 ||
2665 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2666 ]])],
2667 [
2668 AC_MSG_RESULT([yes])
2669 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2670 [libcrypto has EVP AES GCM])
2671 ],
2672 [
2673 AC_MSG_RESULT([no])
2674 unsupported_algorithms="$unsupported_cipers \
Damien Miller679ce882016-07-15 13:44:38 +10002675 aes128-gcm@openssh.com \
2676 aes256-gcm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002677 ]
2678 )
2679
2680 AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2681 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2682 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2683
2684 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2685 AC_LINK_IFELSE(
2686 [AC_LANG_PROGRAM([[
2687 #include <string.h>
2688 #include <openssl/evp.h>
2689 ]], [[
2690 if(EVP_DigestUpdate(NULL, NULL,0))
2691 exit(0);
2692 ]])],
2693 [
2694 AC_MSG_RESULT([yes])
2695 ],
2696 [
2697 AC_MSG_RESULT([no])
2698 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2699 [Define if EVP_DigestUpdate returns void])
2700 ]
2701 )
2702
2703 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2704 # because the system crypt() is more featureful.
2705 if test "x$check_for_libcrypt_before" = "x1"; then
2706 AC_CHECK_LIB([crypt], [crypt])
2707 fi
2708
2709 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2710 # version in OpenSSL.
2711 if test "x$check_for_libcrypt_later" = "x1"; then
2712 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2713 fi
Damien Miller00797e82015-03-04 05:02:45 +11002714 AC_CHECK_FUNCS([crypt DES_crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002715
2716 # Search for SHA256 support in libc and/or OpenSSL
2717 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2718 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002719 hmac-sha2-256 \
2720 hmac-sha2-512 \
Damien Miller72ef7c12015-01-15 02:21:31 +11002721 diffie-hellman-group-exchange-sha256 \
Damien Miller679ce882016-07-15 13:44:38 +10002722 hmac-sha2-256-etm@openssh.com \
2723 hmac-sha2-512-etm@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002724 ]
2725 )
2726 # Search for RIPE-MD support in OpenSSL
2727 AC_CHECK_FUNCS([EVP_ripemd160], ,
2728 [unsupported_algorithms="$unsupported_algorithms \
Damien Miller679ce882016-07-15 13:44:38 +10002729 hmac-ripemd160 \
2730 hmac-ripemd160@openssh.com \
Damien Miller72ef7c12015-01-15 02:21:31 +11002731 hmac-ripemd160-etm@openssh.com"
2732 ]
2733 )
2734
2735 # Check complete ECC support in OpenSSL
2736 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2737 AC_LINK_IFELSE(
2738 [AC_LANG_PROGRAM([[
2739 #include <openssl/ec.h>
2740 #include <openssl/ecdh.h>
2741 #include <openssl/ecdsa.h>
2742 #include <openssl/evp.h>
2743 #include <openssl/objects.h>
2744 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002745 ]], [[
2746 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2747 const EVP_MD *m = EVP_sha256(); /* We need this too */
Darren Tucker37bcef52013-11-09 18:39:25 +11002748 ]])],
2749 [ AC_MSG_RESULT([yes])
Damien Miller72ef7c12015-01-15 02:21:31 +11002750 enable_nistp256=1 ],
2751 [ AC_MSG_RESULT([no]) ]
2752 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002753
Damien Miller72ef7c12015-01-15 02:21:31 +11002754 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2755 AC_LINK_IFELSE(
2756 [AC_LANG_PROGRAM([[
2757 #include <openssl/ec.h>
2758 #include <openssl/ecdh.h>
2759 #include <openssl/ecdsa.h>
2760 #include <openssl/evp.h>
2761 #include <openssl/objects.h>
2762 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002763 ]], [[
2764 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2765 const EVP_MD *m = EVP_sha384(); /* We need this too */
2766 ]])],
2767 [ AC_MSG_RESULT([yes])
2768 enable_nistp384=1 ],
2769 [ AC_MSG_RESULT([no]) ]
2770 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002771
Damien Miller72ef7c12015-01-15 02:21:31 +11002772 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2773 AC_LINK_IFELSE(
2774 [AC_LANG_PROGRAM([[
2775 #include <openssl/ec.h>
2776 #include <openssl/ecdh.h>
2777 #include <openssl/ecdsa.h>
2778 #include <openssl/evp.h>
2779 #include <openssl/objects.h>
2780 #include <openssl/opensslv.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002781 ]], [[
2782 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2783 const EVP_MD *m = EVP_sha512(); /* We need this too */
2784 ]])],
2785 [ AC_MSG_RESULT([yes])
2786 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2787 AC_RUN_IFELSE(
2788 [AC_LANG_PROGRAM([[
2789 #include <openssl/ec.h>
2790 #include <openssl/ecdh.h>
2791 #include <openssl/ecdsa.h>
2792 #include <openssl/evp.h>
2793 #include <openssl/objects.h>
2794 #include <openssl/opensslv.h>
2795 ]],[[
2796 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2797 const EVP_MD *m = EVP_sha512(); /* We need this too */
2798 exit(e == NULL || m == NULL);
2799 ]])],
2800 [ AC_MSG_RESULT([yes])
2801 enable_nistp521=1 ],
2802 [ AC_MSG_RESULT([no]) ],
2803 [ AC_MSG_WARN([cross-compiling: assuming yes])
2804 enable_nistp521=1 ]
2805 )],
2806 AC_MSG_RESULT([no])
2807 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002808
Damien Miller72ef7c12015-01-15 02:21:31 +11002809 COMMENT_OUT_ECC="#no ecc#"
2810 TEST_SSH_ECC=no
2811
2812 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2813 test x$enable_nistp521 = x1; then
2814 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2815 fi
2816 if test x$enable_nistp256 = x1; then
2817 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2818 [libcrypto has NID_X9_62_prime256v1])
2819 TEST_SSH_ECC=yes
2820 COMMENT_OUT_ECC=""
2821 else
Damien Miller679ce882016-07-15 13:44:38 +10002822 unsupported_algorithms="$unsupported_algorithms \
2823 ecdsa-sha2-nistp256 \
2824 ecdh-sha2-nistp256 \
2825 ecdsa-sha2-nistp256-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002826 fi
2827 if test x$enable_nistp384 = x1; then
2828 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2829 TEST_SSH_ECC=yes
2830 COMMENT_OUT_ECC=""
2831 else
Damien Miller679ce882016-07-15 13:44:38 +10002832 unsupported_algorithms="$unsupported_algorithms \
2833 ecdsa-sha2-nistp384 \
2834 ecdh-sha2-nistp384 \
2835 ecdsa-sha2-nistp384-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002836 fi
2837 if test x$enable_nistp521 = x1; then
2838 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2839 TEST_SSH_ECC=yes
2840 COMMENT_OUT_ECC=""
2841 else
Damien Miller679ce882016-07-15 13:44:38 +10002842 unsupported_algorithms="$unsupported_algorithms \
2843 ecdh-sha2-nistp521 \
2844 ecdsa-sha2-nistp521 \
2845 ecdsa-sha2-nistp521-cert-v01@openssh.com"
Damien Miller72ef7c12015-01-15 02:21:31 +11002846 fi
2847
2848 AC_SUBST([TEST_SSH_ECC])
2849 AC_SUBST([COMMENT_OUT_ECC])
2850else
2851 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Miller00797e82015-03-04 05:02:45 +11002852 AC_CHECK_FUNCS([crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002853fi
Damien Miller6af914a2010-09-10 11:39:26 +10002854
Damien Miller00f9cd22014-07-15 10:41:38 +10002855AC_CHECK_FUNCS([ \
2856 arc4random \
2857 arc4random_buf \
2858 arc4random_stir \
2859 arc4random_uniform \
2860])
2861
Tim Rice99203ec2007-03-26 09:35:28 -07002862saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002863AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002864 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002865 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2866 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Ricee1d93702016-05-31 11:13:22 -07002867 [Define if system has libiaf that supports set_id])
Tim Rice0eeaf122007-09-10 16:24:17 -07002868 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002869])
2870LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002871
2872### Configure cryptographic random number support
2873
2874# Check wheter OpenSSL seeds itself
Damien Miller72ef7c12015-01-15 02:21:31 +11002875if test "x$openssl" = "xyes" ; then
2876 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2877 AC_RUN_IFELSE(
2878 [AC_LANG_PROGRAM([[
2879 #include <string.h>
2880 #include <openssl/rand.h>
2881 ]], [[
2882 exit(RAND_status() == 1 ? 0 : 1);
2883 ]])],
2884 [
2885 OPENSSL_SEEDS_ITSELF=yes
2886 AC_MSG_RESULT([yes])
2887 ],
2888 [
2889 AC_MSG_RESULT([no])
2890 ],
2891 [
2892 AC_MSG_WARN([cross compiling: assuming yes])
2893 # This is safe, since we will fatal() at runtime if
2894 # OpenSSL is not seeded correctly.
2895 OPENSSL_SEEDS_ITSELF=yes
2896 ]
2897 )
2898fi
Damien Miller6c21c512002-01-22 21:57:53 +11002899
Damien Millerf22019b2011-05-05 13:48:37 +10002900# PRNGD TCP socket
2901AC_ARG_WITH([prngd-port],
2902 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2903 [
2904 case "$withval" in
2905 no)
2906 withval=""
2907 ;;
2908 [[0-9]]*)
2909 ;;
2910 *)
2911 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2912 ;;
2913 esac
2914 if test ! -z "$withval" ; then
2915 PRNGD_PORT="$withval"
2916 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2917 [Port number of PRNGD/EGD random number socket])
2918 fi
2919 ]
2920)
2921
2922# PRNGD Unix domain socket
2923AC_ARG_WITH([prngd-socket],
2924 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2925 [
2926 case "$withval" in
2927 yes)
2928 withval="/var/run/egd-pool"
2929 ;;
2930 no)
2931 withval=""
2932 ;;
2933 /*)
2934 ;;
2935 *)
2936 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2937 ;;
2938 esac
2939
2940 if test ! -z "$withval" ; then
2941 if test ! -z "$PRNGD_PORT" ; then
2942 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2943 fi
2944 if test ! -r "$withval" ; then
2945 AC_MSG_WARN([Entropy socket is not readable])
2946 fi
2947 PRNGD_SOCKET="$withval"
2948 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2949 [Location of PRNGD/EGD random number socket])
2950 fi
2951 ],
2952 [
2953 # Check for existing socket only if we don't have a random device already
2954 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2955 AC_MSG_CHECKING([for PRNGD/EGD socket])
2956 # Insert other locations here
2957 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2958 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2959 PRNGD_SOCKET="$sock"
2960 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2961 break;
2962 fi
2963 done
2964 if test ! -z "$PRNGD_SOCKET" ; then
2965 AC_MSG_RESULT([$PRNGD_SOCKET])
2966 else
2967 AC_MSG_RESULT([not found])
2968 fi
2969 fi
2970 ]
2971)
2972
2973# Which randomness source do we use?
2974if test ! -z "$PRNGD_PORT" ; then
2975 RAND_MSG="PRNGd port $PRNGD_PORT"
2976elif test ! -z "$PRNGD_SOCKET" ; then
2977 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2978elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2979 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Damien Miller72ef7c12015-01-15 02:21:31 +11002980 [Define if you want the OpenSSL internally seeded PRNG only])
Damien Millerf22019b2011-05-05 13:48:37 +10002981 RAND_MSG="OpenSSL internal ONLY"
Damien Miller72ef7c12015-01-15 02:21:31 +11002982elif test "x$openssl" = "xno" ; then
2983 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 +10002984else
2985 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])
2986fi
2987
Darren Tucker3e6bde42006-08-20 20:03:50 +10002988# Check for PAM libs
2989PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002990AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002991 [ --with-pam Enable PAM support ],
2992 [
2993 if test "x$withval" != "xno" ; then
2994 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2995 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2996 AC_MSG_ERROR([PAM headers not found])
2997 fi
2998
2999 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003000 AC_CHECK_LIB([dl], [dlopen], , )
3001 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
3002 AC_CHECK_FUNCS([pam_getenvlist])
3003 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003004 LIBS="$saved_LIBS"
3005
3006 PAM_MSG="yes"
3007
Darren Tucker20e9f972007-03-25 18:26:01 +10003008 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08003009 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003010 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10003011
Darren Tucker3e6bde42006-08-20 20:03:50 +10003012 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10003013 case "$LIBS" in
3014 *-ldl*)
3015 # libdl already in LIBS
3016 ;;
3017 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10003018 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10003019 ;;
3020 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10003021 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10003022 fi
3023 ]
3024)
3025
Damien Miller8bd81e12016-08-16 13:30:56 +10003026AC_ARG_WITH([pam-service],
3027 [ --with-pam-service=name Specify PAM service name ],
3028 [
3029 if test "x$withval" != "xno" && \
3030 test "x$withval" != "xyes" ; then
3031 AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE],
3032 ["$withval"], [sshd PAM service name])
3033 fi
3034 ]
3035)
3036
Darren Tucker3e6bde42006-08-20 20:03:50 +10003037# Check for older PAM
3038if test "x$PAM_MSG" = "xyes" ; then
3039 # Check PAM strerror arguments (old PAM)
3040 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08003041 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10003042#include <stdlib.h>
3043#if defined(HAVE_SECURITY_PAM_APPL_H)
3044#include <security/pam_appl.h>
3045#elif defined (HAVE_PAM_PAM_APPL_H)
3046#include <pam/pam_appl.h>
3047#endif
Tim Rice648f8762011-01-26 12:38:57 -08003048 ]], [[
3049(void)pam_strerror((pam_handle_t *)NULL, -1);
3050 ]])], [AC_MSG_RESULT([no])], [
3051 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003052 [Define if you have an old version of PAM
3053 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08003054 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003055 PAM_MSG="yes (old library)"
Damien Miller72ef7c12015-01-15 02:21:31 +11003056
Tim Rice648f8762011-01-26 12:38:57 -08003057 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003058fi
Damien Miller6c21c512002-01-22 21:57:53 +11003059
Damien Miller6482d902014-05-27 14:34:42 +10003060case "$host" in
3061*-*-cygwin*)
3062 SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER
3063 ;;
3064*)
3065 SSH_PRIVSEP_USER=sshd
3066 ;;
3067esac
Tim Rice648f8762011-01-26 12:38:57 -08003068AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00003069 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00003070 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003071 if test -n "$withval" && test "x$withval" != "xno" && \
3072 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10003073 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00003074 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08003075 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00003076)
Damien Miller6482d902014-05-27 14:34:42 +10003077if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then
3078 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER],
3079 [Cygwin function to fetch non-privileged user for privilege separation])
3080else
3081 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
3082 [non-privileged user for privilege separation])
3083fi
Tim Rice648f8762011-01-26 12:38:57 -08003084AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00003085
Damien Miller91f40d82013-02-22 11:37:00 +11003086if test "x$have_linux_no_new_privs" = "x1" ; then
3087AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
3088 #include <sys/types.h>
3089 #include <linux/seccomp.h>
3090])
3091fi
3092if test "x$have_seccomp_filter" = "x1" ; then
3093AC_MSG_CHECKING([kernel for seccomp_filter support])
3094AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3095 #include <errno.h>
3096 #include <elf.h>
3097 #include <linux/audit.h>
3098 #include <linux/seccomp.h>
3099 #include <stdlib.h>
3100 #include <sys/prctl.h>
3101 ]],
3102 [[ int i = $seccomp_audit_arch;
3103 errno = 0;
3104 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
3105 exit(errno == EFAULT ? 0 : 1); ]])],
3106 [ AC_MSG_RESULT([yes]) ], [
3107 AC_MSG_RESULT([no])
3108 # Disable seccomp filter as a target
3109 have_seccomp_filter=0
3110 ]
3111)
3112fi
3113
Damien Miller69ff1df2011-06-23 08:30:03 +10003114# Decide which sandbox style to use
3115sandbox_arg=""
3116AC_ARG_WITH([sandbox],
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003117 [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)],
Damien Miller69ff1df2011-06-23 08:30:03 +10003118 [
3119 if test "x$withval" = "xyes" ; then
3120 sandbox_arg=""
3121 else
3122 sandbox_arg="$withval"
3123 fi
3124 ]
3125)
Darren Tucker60395f92012-07-03 14:31:18 +10003126
3127# Some platforms (seems to be the ones that have a kernel poll(2)-type
3128# function with which they implement select(2)) use an extra file descriptor
3129# when calling select(2), which means we can't use the rlimit sandbox.
3130AC_MSG_CHECKING([if select works with descriptor rlimit])
3131AC_RUN_IFELSE(
3132 [AC_LANG_PROGRAM([[
3133#include <sys/types.h>
3134#ifdef HAVE_SYS_TIME_H
3135# include <sys/time.h>
3136#endif
3137#include <sys/resource.h>
3138#ifdef HAVE_SYS_SELECT_H
3139# include <sys/select.h>
3140#endif
3141#include <errno.h>
3142#include <fcntl.h>
3143#include <stdlib.h>
3144 ]],[[
3145 struct rlimit rl_zero;
3146 int fd, r;
3147 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11003148 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10003149
3150 fd = open("/dev/null", O_RDONLY);
3151 FD_ZERO(&fds);
3152 FD_SET(fd, &fds);
3153 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3154 setrlimit(RLIMIT_FSIZE, &rl_zero);
3155 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11003156 tv.tv_sec = 1;
3157 tv.tv_usec = 0;
3158 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10003159 exit (r == -1 ? 1 : 0);
3160 ]])],
3161 [AC_MSG_RESULT([yes])
3162 select_works_with_rlimit=yes],
3163 [AC_MSG_RESULT([no])
3164 select_works_with_rlimit=no],
3165 [AC_MSG_WARN([cross compiling: assuming yes])]
3166)
3167
Darren Tuckerff008de2013-03-06 17:48:48 +11003168AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
3169AC_RUN_IFELSE(
3170 [AC_LANG_PROGRAM([[
3171#include <sys/types.h>
3172#ifdef HAVE_SYS_TIME_H
3173# include <sys/time.h>
3174#endif
3175#include <sys/resource.h>
3176#include <errno.h>
3177#include <stdlib.h>
3178 ]],[[
3179 struct rlimit rl_zero;
3180 int fd, r;
3181 fd_set fds;
3182
3183 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3184 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
3185 exit (r == -1 ? 1 : 0);
3186 ]])],
3187 [AC_MSG_RESULT([yes])
3188 rlimit_nofile_zero_works=yes],
3189 [AC_MSG_RESULT([no])
3190 rlimit_nofile_zero_works=no],
3191 [AC_MSG_WARN([cross compiling: assuming yes])]
3192)
3193
Darren Tuckerd545a4b2012-07-03 22:48:31 +10003194AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
3195AC_RUN_IFELSE(
3196 [AC_LANG_PROGRAM([[
3197#include <sys/types.h>
3198#include <sys/resource.h>
3199#include <stdlib.h>
3200 ]],[[
3201 struct rlimit rl_zero;
3202
3203 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3204 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
3205 ]])],
3206 [AC_MSG_RESULT([yes])],
3207 [AC_MSG_RESULT([no])
3208 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3209 [setrlimit RLIMIT_FSIZE works])],
3210 [AC_MSG_WARN([cross compiling: assuming yes])]
3211)
3212
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003213if test "x$sandbox_arg" = "xpledge" || \
3214 ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then
3215 test "x$ac_cv_func_pledge" != "xyes" && \
3216 AC_MSG_ERROR([pledge sandbox requires pledge(2) support])
3217 SANDBOX_STYLE="pledge"
Damien Millerfafe1d82015-10-14 09:22:15 -07003218 AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)])
Damien Miller9846a2f2015-10-08 04:30:48 +11003219elif test "x$sandbox_arg" = "xsystrace" || \
Damien Miller69ff1df2011-06-23 08:30:03 +10003220 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003221 test "x$have_systr_policy_kill" != "x1" && \
3222 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003223 SANDBOX_STYLE="systrace"
3224 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003225elif test "x$sandbox_arg" = "xdarwin" || \
3226 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3227 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003228 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3229 "x$ac_cv_header_sandbox_h" != "xyes" && \
3230 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003231 SANDBOX_STYLE="darwin"
3232 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003233elif test "x$sandbox_arg" = "xseccomp_filter" || \
3234 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003235 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003236 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003237 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003238 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3239 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003240 test "x$have_linux_no_new_privs" = "x1" && \
3241 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003242 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003243 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3244 test "x$have_linux_no_new_privs" != "x1" && \
3245 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3246 test "x$have_seccomp_filter" != "x1" && \
3247 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3248 test "x$ac_cv_func_prctl" != "xyes" && \
3249 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3250 SANDBOX_STYLE="seccomp_filter"
3251 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003252elif test "x$sandbox_arg" = "xcapsicum" || \
3253 ( test -z "$sandbox_arg" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003254 test "x$ac_cv_header_sys_capability_h" = "xyes" && \
3255 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
3256 test "x$ac_cv_header_sys_capability_h" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003257 AC_MSG_ERROR([capsicum sandbox requires sys/capability.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003258 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003259 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003260 SANDBOX_STYLE="capsicum"
3261 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003262elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003263 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003264 test "x$select_works_with_rlimit" = "xyes" && \
3265 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003266 test "x$ac_cv_func_setrlimit" != "xyes" && \
3267 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003268 test "x$select_works_with_rlimit" != "xyes" && \
3269 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003270 SANDBOX_STYLE="rlimit"
3271 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller4626cba2016-01-08 14:24:56 +11003272elif test "x$sandbox_arg" = "xsolaris" || \
3273 ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then
3274 SANDBOX_STYLE="solaris"
3275 AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges])
Damien Miller69ff1df2011-06-23 08:30:03 +10003276elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3277 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3278 SANDBOX_STYLE="none"
3279 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3280else
Tim Ricea6e60612011-08-17 21:48:22 -07003281 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003282fi
3283
Ben Lindstromb5628642000-10-18 00:02:25 +00003284# Cheap hack to ensure NEWS-OS libraries are arranged right.
3285if test ! -z "$SONY" ; then
3286 LIBS="$LIBS -liberty";
3287fi
3288
Damien Miller57f39152005-11-24 19:58:19 +11003289# Check for long long datatypes
3290AC_CHECK_TYPES([long long, unsigned long long, long double])
3291
3292# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003293AC_CHECK_SIZEOF([short int], [2])
3294AC_CHECK_SIZEOF([int], [4])
3295AC_CHECK_SIZEOF([long int], [4])
3296AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003297
Damien Millerfa2bb692002-04-23 23:22:25 +10003298# Sanity check long long for some platforms (AIX)
3299if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3300 ac_cv_sizeof_long_long_int=0
3301fi
3302
Darren Tucker537f1ed2005-10-25 18:38:33 +10003303# compute LLONG_MIN and LLONG_MAX if we don't know them.
3304if test -z "$have_llong_max"; then
3305 AC_MSG_CHECKING([for max value of long long])
3306 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003307 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003308#include <stdio.h>
3309/* Why is this so damn hard? */
3310#ifdef __GNUC__
3311# undef __GNUC__
3312#endif
3313#define __USE_ISOC99
3314#include <limits.h>
3315#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003316#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3317
3318/*
3319 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3320 * we do this the hard way.
3321 */
3322static int
3323fprint_ll(FILE *f, long long n)
3324{
3325 unsigned int i;
3326 int l[sizeof(long long) * 8];
3327
3328 if (n < 0)
3329 if (fprintf(f, "-") < 0)
3330 return -1;
3331 for (i = 0; n != 0; i++) {
3332 l[i] = my_abs(n % 10);
3333 n /= 10;
3334 }
3335 do {
3336 if (fprintf(f, "%d", l[--i]) < 0)
3337 return -1;
3338 } while (i != 0);
3339 if (fprintf(f, " ") < 0)
3340 return -1;
3341 return 0;
3342}
Tim Rice648f8762011-01-26 12:38:57 -08003343 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003344 FILE *f;
3345 long long i, llmin, llmax = 0;
3346
3347 if((f = fopen(DATA,"w")) == NULL)
3348 exit(1);
3349
3350#if defined(LLONG_MIN) && defined(LLONG_MAX)
3351 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3352 llmin = LLONG_MIN;
3353 llmax = LLONG_MAX;
3354#else
3355 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3356 /* This will work on one's complement and two's complement */
3357 for (i = 1; i > llmax; i <<= 1, i++)
3358 llmax = i;
3359 llmin = llmax + 1LL; /* wrap */
3360#endif
3361
3362 /* Sanity check */
3363 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003364 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3365 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003366 fprintf(f, "unknown unknown\n");
3367 exit(2);
3368 }
3369
Darren Tuckerd1450db2006-03-13 19:06:51 +11003370 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003371 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003372 if (fprint_ll(f, llmax) < 0)
3373 exit(4);
3374 if (fclose(f) < 0)
3375 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003376 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003377 ]])],
3378 [
3379 llong_min=`$AWK '{print $1}' conftest.llminmax`
3380 llong_max=`$AWK '{print $2}' conftest.llminmax`
3381
Tim Rice648f8762011-01-26 12:38:57 -08003382 AC_MSG_RESULT([$llong_max])
3383 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003384 [max value of long long calculated by configure])
3385 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003386 AC_MSG_RESULT([$llong_min])
3387 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003388 [min value of long long calculated by configure])
3389 ],
3390 [
Tim Rice648f8762011-01-26 12:38:57 -08003391 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003392 ],
3393 [
3394 AC_MSG_WARN([cross compiling: not checking])
3395 ]
3396 )
3397fi
3398
3399
Damien Millera22ba012000-03-02 23:09:20 +11003400# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003401AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003402 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3403 [[ u_int a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003404 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
Tim Rice648f8762011-01-26 12:38:57 -08003405 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003406])
3407if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003408 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003409 have_u_int=1
3410fi
3411
Damien Miller61e50f12000-05-08 20:49:37 +10003412AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003413 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3414 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003415 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003416 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003417])
3418if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003419 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003420 have_intxx_t=1
3421fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003422
3423if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003424 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003425then
3426 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003427 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3428 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003429 [
Tim Rice648f8762011-01-26 12:38:57 -08003430 AC_DEFINE([HAVE_INTXX_T])
3431 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003432 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003433 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003434fi
3435
Damien Miller578783e2000-09-23 14:12:24 +11003436AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003438#include <sys/types.h>
3439#ifdef HAVE_STDINT_H
3440# include <stdint.h>
3441#endif
3442#include <sys/socket.h>
3443#ifdef HAVE_SYS_BITYPES_H
3444# include <sys/bitypes.h>
3445#endif
Tim Rice648f8762011-01-26 12:38:57 -08003446 ]], [[
3447int64_t a; a = 1;
3448 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003449 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003450 ])
Damien Miller578783e2000-09-23 14:12:24 +11003451])
3452if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003453 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003454fi
3455
Damien Miller61e50f12000-05-08 20:49:37 +10003456AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003457 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3458 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003459 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003460 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003461])
3462if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003463 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003464 have_u_intxx_t=1
3465fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003466
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003467if test -z "$have_u_intxx_t" ; then
3468 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003469 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3470 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003471 [
Tim Rice648f8762011-01-26 12:38:57 -08003472 AC_DEFINE([HAVE_U_INTXX_T])
3473 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003474 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003475 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003476fi
3477
Damien Miller578783e2000-09-23 14:12:24 +11003478AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3480 [[ u_int64_t a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003481 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003482 ])
Damien Miller578783e2000-09-23 14:12:24 +11003483])
3484if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003485 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003486 have_u_int64_t=1
3487fi
3488
Damien Millerc2868192014-01-30 10:21:19 +11003489if (test -z "$have_u_int64_t" && \
3490 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3491then
Tim Rice4cec93f2002-02-26 08:40:48 -08003492 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3494 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003495 [
Tim Rice648f8762011-01-26 12:38:57 -08003496 AC_DEFINE([HAVE_U_INT64_T])
3497 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003498 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003499 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003500fi
3501
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003502if test -z "$have_u_intxx_t" ; then
3503 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003504 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003505#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003506 ]], [[
3507 uint8_t a;
3508 uint16_t b;
3509 uint32_t c;
3510 a = b = c = 1;
3511 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003512 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003513 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003514 ])
3515 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003516 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003517 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003518 fi
3519fi
3520
Damien Millerc2868192014-01-30 10:21:19 +11003521if (test -z "$have_uintxx_t" && \
3522 test "x$ac_cv_header_stdint_h" = "xyes")
3523then
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003524 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003525 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3526 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003527 [
Tim Rice648f8762011-01-26 12:38:57 -08003528 AC_DEFINE([HAVE_UINTXX_T])
3529 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003530 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003531 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003532fi
3533
Damien Millerc2868192014-01-30 10:21:19 +11003534if (test -z "$have_uintxx_t" && \
3535 test "x$ac_cv_header_inttypes_h" = "xyes")
3536then
Darren Tucker6d725682014-01-17 19:17:34 +11003537 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3538 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3539 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3540 [
3541 AC_DEFINE([HAVE_UINTXX_T])
3542 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003543 ], [ AC_MSG_RESULT([no])
Darren Tucker6d725682014-01-17 19:17:34 +11003544 ])
3545fi
3546
Damien Milleredb82922000-06-20 13:25:52 +10003547if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003548 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003549then
3550 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003551 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003552#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003553 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003554 int8_t a; int16_t b; int32_t c;
3555 u_int8_t e; u_int16_t f; u_int32_t g;
3556 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003557 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003558 [
Tim Rice648f8762011-01-26 12:38:57 -08003559 AC_DEFINE([HAVE_U_INTXX_T])
3560 AC_DEFINE([HAVE_INTXX_T])
3561 AC_MSG_RESULT([yes])
3562 ], [AC_MSG_RESULT([no])
3563 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003564fi
3565
Damien Miller58be7382001-09-15 21:31:54 +10003566
3567AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003568 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3569 [[ u_char foo; foo = 125; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003570 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
Tim Rice648f8762011-01-26 12:38:57 -08003571 ])
Damien Miller58be7382001-09-15 21:31:54 +10003572])
3573if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003574 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003575fi
3576
Darren Tucker007e3b32013-11-03 18:43:55 +11003577AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3578#include <sys/types.h>
3579#include <stdint.h>
3580])
3581
Tim Rice13aae5e2001-10-21 17:53:58 -07003582TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003583
Tim Rice648f8762011-01-26 12:38:57 -08003584AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3585AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003586#include <sys/types.h>
3587#ifdef HAVE_SYS_BITYPES_H
3588#include <sys/bitypes.h>
3589#endif
3590#ifdef HAVE_SYS_STATFS_H
3591#include <sys/statfs.h>
3592#endif
3593#ifdef HAVE_SYS_STATVFS_H
3594#include <sys/statvfs.h>
3595#endif
3596])
Tim Rice4cec93f2002-02-26 08:40:48 -08003597
Tim Rice648f8762011-01-26 12:38:57 -08003598AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003599[#include <sys/types.h>
3600#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003601
Damien Miller61e50f12000-05-08 20:49:37 +10003602AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3604 [[ size_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003605 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003606 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003607])
3608if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003609 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003610fi
Damien Miller95058511999-12-29 10:36:45 +11003611
Damien Miller615f9392000-05-17 22:53:33 +10003612AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003613 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3614 [[ ssize_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003615 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003616 ])
Damien Miller615f9392000-05-17 22:53:33 +10003617])
3618if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003619 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003620fi
3621
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003622AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003623 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3624 [[ clock_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003625 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003626 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003627])
3628if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003629 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003630fi
3631
Damien Millerb54b40e2000-06-23 08:23:34 +10003632AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003633 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003634#include <sys/types.h>
3635#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003636 ]], [[ sa_family_t foo; foo = 1235; ]])],
3637 [ ac_cv_have_sa_family_t="yes" ],
3638 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003639#include <sys/types.h>
3640#include <sys/socket.h>
3641#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003642 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003643 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003644 [ ac_cv_have_sa_family_t="no" ]
3645 )
Tim Rice648f8762011-01-26 12:38:57 -08003646 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003647])
3648if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003649 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003650 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003651fi
3652
Damien Miller0f91b4e2000-06-18 15:43:25 +10003653AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003654 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3655 [[ pid_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003656 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003657 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003658])
3659if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003660 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003661fi
3662
3663AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003664 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3665 [[ mode_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003666 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003667 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003668])
3669if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003670 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003671fi
3672
Damien Miller61e50f12000-05-08 20:49:37 +10003673
3674AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003675 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003676#include <sys/types.h>
3677#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003678 ]], [[ struct sockaddr_storage s; ]])],
3679 [ ac_cv_have_struct_sockaddr_storage="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003680 [ ac_cv_have_struct_sockaddr_storage="no"
Tim Rice648f8762011-01-26 12:38:57 -08003681 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003682])
3683if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003684 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003685 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003686fi
Damien Miller34132e52000-01-14 15:45:46 +11003687
Damien Miller61e50f12000-05-08 20:49:37 +10003688AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003689 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003690#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003691#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003692 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3693 [ ac_cv_have_struct_sockaddr_in6="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003694 [ ac_cv_have_struct_sockaddr_in6="no"
Tim Rice648f8762011-01-26 12:38:57 -08003695 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003696])
3697if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003698 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003699 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003700fi
Damien Miller34132e52000-01-14 15:45:46 +11003701
Damien Miller61e50f12000-05-08 20:49:37 +10003702AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003703 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003704#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003705#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003706 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3707 [ ac_cv_have_struct_in6_addr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003708 [ ac_cv_have_struct_in6_addr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003709 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003710])
3711if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003712 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003713 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003714
3715dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003716 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003717 [
3718#ifdef HAVE_SYS_TYPES_H
3719#include <sys/types.h>
3720#endif
3721#include <netinet/in.h>
3722 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003723fi
Damien Miller34132e52000-01-14 15:45:46 +11003724
Damien Miller61e50f12000-05-08 20:49:37 +10003725AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003726 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003727#include <sys/types.h>
3728#include <sys/socket.h>
3729#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003730 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3731 [ ac_cv_have_struct_addrinfo="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003732 [ ac_cv_have_struct_addrinfo="no"
Tim Rice648f8762011-01-26 12:38:57 -08003733 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003734])
3735if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003736 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003737 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003738fi
3739
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003740AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003741 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3742 [[ struct timeval tv; tv.tv_sec = 1;]])],
3743 [ ac_cv_have_struct_timeval="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003744 [ ac_cv_have_struct_timeval="no"
Tim Rice648f8762011-01-26 12:38:57 -08003745 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003746])
3747if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003748 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003749 have_struct_timeval=1
3750fi
3751
Tim Rice648f8762011-01-26 12:38:57 -08003752AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003753
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003754# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003755if test "x$ac_cv_have_int64_t" = "xno" && \
3756 test "x$ac_cv_sizeof_long_int" != "x8" && \
3757 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003758 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3759 echo "an alternative compiler (I.E., GCC) before continuing."
3760 echo ""
3761 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003762else
3763dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003764 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003765 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003766#include <stdio.h>
3767#include <string.h>
3768#ifdef HAVE_SNPRINTF
3769main()
3770{
3771 char buf[50];
3772 char expected_out[50];
3773 int mazsize = 50 ;
3774#if (SIZEOF_LONG_INT == 8)
3775 long int num = 0x7fffffffffffffff;
3776#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003777 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003778#endif
3779 strcpy(expected_out, "9223372036854775807");
3780 snprintf(buf, mazsize, "%lld", num);
3781 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003782 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003783 exit(0);
3784}
3785#else
3786main() { exit(0); }
3787#endif
Tim Rice648f8762011-01-26 12:38:57 -08003788 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003789 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003790 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003791fi
3792
Damien Miller78315eb2000-09-29 23:01:36 +11003793dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003794OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3795OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3796OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3797OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3798OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3799OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3800OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3801OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3802OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3803OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3804OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3805OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3806OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3807OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3808OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3809OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3810OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003811
3812AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003813AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3814struct passwd.pw_change, struct passwd.pw_expire],
3815[], [], [[
3816#include <sys/types.h>
3817#include <pwd.h>
3818]])
3819
Tim Rice648f8762011-01-26 12:38:57 -08003820AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003821 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003822[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003823#include <stdio.h>
3824#if HAVE_SYS_TYPES_H
3825# include <sys/types.h>
3826#endif
3827#include <netinet/in.h>
3828#include <arpa/nameser.h>
3829#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003830]])
andre2ff7b5d2000-06-03 14:57:40 +00003831
Damien Miller61e50f12000-05-08 20:49:37 +10003832AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3833 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003834 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003835#include <sys/types.h>
3836#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003837 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3838 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3839 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003840])
3841if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003842 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003843fi
3844
Damien Miller61e50f12000-05-08 20:49:37 +10003845AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3846 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003847 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003848#include <sys/types.h>
3849#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003850 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3851 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003852 [ ac_cv_have___ss_family_in_struct_ss="no"
Tim Rice648f8762011-01-26 12:38:57 -08003853 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003854])
3855if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003856 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003857 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003858fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003859
Tim Rice28bbb0c2002-05-27 17:37:32 -07003860dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003861AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3862 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003863 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003864#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003865#include <sys/socket.h>
3866#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003867 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003868#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003869#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003870exit(1);
3871#endif
3872struct msghdr m;
3873m.msg_accrights = 0;
3874exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003875 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003876 [ ac_cv_have_accrights_in_msghdr="yes" ],
3877 [ ac_cv_have_accrights_in_msghdr="no" ]
3878 )
3879])
3880if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003881 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003882 [Define if your system uses access rights style
3883 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003884fi
3885
Tim Rice648f8762011-01-26 12:38:57 -08003886AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3887AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003888#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003889#include <sys/stat.h>
3890#ifdef HAVE_SYS_TIME_H
3891# include <sys/time.h>
3892#endif
3893#ifdef HAVE_SYS_MOUNT_H
3894#include <sys/mount.h>
3895#endif
3896#ifdef HAVE_SYS_STATVFS_H
3897#include <sys/statvfs.h>
3898#endif
Tim Rice648f8762011-01-26 12:38:57 -08003899 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3900 [ AC_MSG_RESULT([yes]) ],
3901 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003902
Tim Rice648f8762011-01-26 12:38:57 -08003903 AC_MSG_CHECKING([if fsid_t has member val])
3904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003905#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003906#include <sys/statvfs.h>
3907 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3908 [ AC_MSG_RESULT([yes])
3909 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3910 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003911
Tim Rice648f8762011-01-26 12:38:57 -08003912 AC_MSG_CHECKING([if f_fsid has member __val])
3913 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003914#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003915#include <sys/statvfs.h>
3916 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3917 [ AC_MSG_RESULT([yes])
3918 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3919 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003920])
Darren Tucker77001382008-06-09 06:17:53 +10003921
Kevin Stevesa44e0352002-04-07 16:18:03 +00003922AC_CACHE_CHECK([for msg_control field in struct msghdr],
3923 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003924 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003925#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003926#include <sys/socket.h>
3927#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003928 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003929#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003930#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003931exit(1);
3932#endif
3933struct msghdr m;
3934m.msg_control = 0;
3935exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003936 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003937 [ ac_cv_have_control_in_msghdr="yes" ],
3938 [ ac_cv_have_control_in_msghdr="no" ]
3939 )
3940])
3941if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003942 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003943 [Define if your system uses ancillary data style
3944 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003945fi
3946
Damien Miller61e50f12000-05-08 20:49:37 +10003947AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003948 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3949 [[ extern char *__progname; printf("%s", __progname); ]])],
3950 [ ac_cv_libc_defines___progname="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003951 [ ac_cv_libc_defines___progname="no"
Tim Rice648f8762011-01-26 12:38:57 -08003952 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003953])
3954if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003955 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003956fi
3957
Kevin Steves4846f4a2002-03-22 18:19:53 +00003958AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003959 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3960 [[ printf("%s", __FUNCTION__); ]])],
3961 [ ac_cv_cc_implements___FUNCTION__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003962 [ ac_cv_cc_implements___FUNCTION__="no"
Tim Rice648f8762011-01-26 12:38:57 -08003963 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003964])
3965if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003966 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003967 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003968fi
3969
3970AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003971 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3972 [[ printf("%s", __func__); ]])],
3973 [ ac_cv_cc_implements___func__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003974 [ ac_cv_cc_implements___func__="no"
Tim Rice648f8762011-01-26 12:38:57 -08003975 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003976])
3977if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003978 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003979fi
3980
Damien Miller57f39152005-11-24 19:58:19 +11003981AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003982 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3983#include <stdarg.h>
3984va_list x,y;
3985 ]], [[ va_copy(x,y); ]])],
3986 [ ac_cv_have_va_copy="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003987 [ ac_cv_have_va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08003988 ])
Damien Miller57f39152005-11-24 19:58:19 +11003989])
3990if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003991 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003992fi
3993
3994AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003995 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3996#include <stdarg.h>
3997va_list x,y;
3998 ]], [[ __va_copy(x,y); ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003999 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08004000 ])
Damien Miller57f39152005-11-24 19:58:19 +11004001])
4002if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004003 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11004004fi
4005
Damien Miller4f8e6692001-07-14 13:22:53 +10004006AC_CACHE_CHECK([whether getopt has optreset support],
4007 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08004008 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
4009 [[ extern int optreset; optreset = 0; ]])],
4010 [ ac_cv_have_getopt_optreset="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004011 [ ac_cv_have_getopt_optreset="no"
Tim Rice648f8762011-01-26 12:38:57 -08004012 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10004013])
4014if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004015 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004016 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10004017fi
Damien Millera22ba012000-03-02 23:09:20 +11004018
Damien Millerecbb26d2000-07-15 14:59:14 +10004019AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08004020 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4021[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
4022 [ ac_cv_libc_defines_sys_errlist="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004023 [ ac_cv_libc_defines_sys_errlist="no"
Tim Rice648f8762011-01-26 12:38:57 -08004024 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10004025])
4026if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004027 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004028 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10004029fi
4030
4031
Damien Miller11fa2cc2000-08-16 10:35:58 +10004032AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08004033 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
4034[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
4035 [ ac_cv_libc_defines_sys_nerr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07004036 [ ac_cv_libc_defines_sys_nerr="no"
Tim Rice648f8762011-01-26 12:38:57 -08004037 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004038])
4039if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004040 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004041fi
4042
Darren Tucker5f88d342003-10-15 16:57:57 +10004043# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08004044AC_SEARCH_LIBS([getrrsetbyname], [resolv],
4045 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004046 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10004047 [
Darren Tucker5f88d342003-10-15 16:57:57 +10004048 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08004049 AC_SEARCH_LIBS([res_query], [resolv])
4050 AC_SEARCH_LIBS([dn_expand], [resolv])
4051 AC_MSG_CHECKING([if res_query will link])
4052 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004053#include <sys/types.h>
4054#include <netinet/in.h>
4055#include <arpa/nameser.h>
4056#include <netdb.h>
4057#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004058 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004059 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004060 ]])],
4061 AC_MSG_RESULT([yes]),
4062 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10004063 saved_LIBS="$LIBS"
4064 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08004065 AC_MSG_CHECKING([for res_query in -lresolv])
4066 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004067#include <sys/types.h>
4068#include <netinet/in.h>
4069#include <arpa/nameser.h>
4070#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10004071#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004072 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10004073 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004074 ]])],
4075 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10004076 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004077 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10004078 ])
Tim Rice648f8762011-01-26 12:38:57 -08004079 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10004080 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07004081 [#include <sys/types.h>
4082 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08004083 AC_CHECK_MEMBER([HEADER.ad],
4084 [AC_DEFINE([HAVE_HEADER_AD], [1],
4085 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10004086 [#include <arpa/nameser.h>])
4087 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10004088
Tim Rice648f8762011-01-26 12:38:57 -08004089AC_MSG_CHECKING([if struct __res_state _res is an extern])
4090AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004091#include <stdio.h>
4092#if HAVE_SYS_TYPES_H
4093# include <sys/types.h>
4094#endif
4095#include <netinet/in.h>
4096#include <arpa/nameser.h>
4097#include <resolv.h>
4098extern struct __res_state _res;
Darren Tucker7ad8b282015-09-11 13:11:02 +10004099 ]], [[
4100struct __res_state *volatile p = &_res; /* force resolution of _res */
4101return 0;
4102 ]],)],
Tim Rice648f8762011-01-26 12:38:57 -08004103 [AC_MSG_RESULT([yes])
4104 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004105 [Define if you have struct __res_state _res as an extern])
4106 ],
Tim Rice648f8762011-01-26 12:38:57 -08004107 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004108)
4109
Damien Miller73b42d22006-04-22 21:26:08 +10004110# Check whether user wants SELinux support
4111SELINUX_MSG="no"
4112LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08004113AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11004114 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10004115 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10004116 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004117 AC_DEFINE([WITH_SELINUX], [1],
4118 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10004119 SELINUX_MSG="yes"
4120 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08004121 AC_MSG_ERROR([SELinux support requires selinux.h header]))
4122 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11004123 [ LIBSELINUX="-lselinux"
4124 LIBS="$LIBS -lselinux"
4125 ],
Tim Rice648f8762011-01-26 12:38:57 -08004126 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11004127 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10004128 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08004129 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10004130 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10004131 fi ]
4132)
Tim Rice648f8762011-01-26 12:38:57 -08004133AC_SUBST([SSHLIBS])
4134AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10004135
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004136# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11004137KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004138AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11004139 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11004140 [ if test "x$withval" != "xno" ; then
4141 if test "x$withval" = "xyes" ; then
4142 KRB5ROOT="/usr/local"
4143 else
4144 KRB5ROOT=${withval}
4145 fi
4146
Tim Rice648f8762011-01-26 12:38:57 -08004147 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004148 KRB5_MSG="yes"
4149
Darren Tucker4089fc12016-12-08 12:57:24 +11004150 AC_PATH_TOOL([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10004151 [$KRB5ROOT/bin/krb5-config],
4152 [$KRB5ROOT/bin:$PATH])
4153 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11004154 K5CFLAGS="`$KRB5CONF --cflags`"
4155 K5LIBS="`$KRB5CONF --libs`"
4156 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004157
Tim Rice648f8762011-01-26 12:38:57 -08004158 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004159 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08004160 AC_MSG_RESULT([yes])
4161 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004162 [Define this if you want GSSAPI
4163 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11004164 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
4165 GSSLIBS="`$KRB5CONF --libs gssapi`"
4166 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11004167 else
Tim Rice648f8762011-01-26 12:38:57 -08004168 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004169 fi
Tim Rice648f8762011-01-26 12:38:57 -08004170 AC_MSG_CHECKING([whether we are using Heimdal])
4171 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4172 ]], [[ char *tmp = heimdal_version; ]])],
4173 [ AC_MSG_RESULT([yes])
4174 AC_DEFINE([HEIMDAL], [1],
4175 [Define this if you are using the Heimdal
4176 version of Kerberos V5]) ],
4177 [AC_MSG_RESULT([no])
4178 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004179 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004180 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11004181 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08004182 AC_MSG_CHECKING([whether we are using Heimdal])
4183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4184 ]], [[ char *tmp = heimdal_version; ]])],
4185 [ AC_MSG_RESULT([yes])
4186 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11004187 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10004188 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08004189 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10004190 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08004191 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11004192 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08004193 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004194 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08004195 ])
4196 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004197
Tim Rice648f8762011-01-26 12:38:57 -08004198 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
4199 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004200 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08004201 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
4202 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004203 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11004204 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
4205 [ AC_DEFINE([GSSAPI])
4206 GSSLIBS="-lgss" ],
4207 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
4208 ])
Darren Tucker964de182013-02-22 10:39:59 +11004209 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08004210
Tim Rice648f8762011-01-26 12:38:57 -08004211 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004212 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11004213 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004214 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004215 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11004216 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004217 ]
4218 )
4219
4220 oldCPP="$CPPFLAGS"
4221 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004222 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004223 [ CPPFLAGS="$oldCPP" ])
4224
Damien Millera8e06ce2003-11-21 23:48:55 +11004225 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11004226 if test ! -z "$need_dash_r" ; then
4227 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
4228 fi
4229 if test ! -z "$blibpath" ; then
4230 blibpath="$blibpath:${KRB5ROOT}/lib"
4231 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004232
Tim Rice648f8762011-01-26 12:38:57 -08004233 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4234 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4235 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004236
Tim Rice648f8762011-01-26 12:38:57 -08004237 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4238 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004239
4240 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4241#ifdef HAVE_GSSAPI_H
4242# include <gssapi.h>
4243#elif defined(HAVE_GSSAPI_GSSAPI_H)
4244# include <gssapi/gssapi.h>
4245#endif
4246
4247#ifdef HAVE_GSSAPI_GENERIC_H
4248# include <gssapi_generic.h>
4249#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4250# include <gssapi/gssapi_generic.h>
4251#endif
4252 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004253 saved_LIBS="$LIBS"
4254 LIBS="$LIBS $K5LIBS"
4255 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4256 LIBS="$saved_LIBS"
4257
Darren Tucker0d27ed12004-02-24 10:37:33 +11004258 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004259 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004260)
Darren Tucker964de182013-02-22 10:39:59 +11004261AC_SUBST([GSSLIBS])
4262AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004263
Damien Millera22ba012000-03-02 23:09:20 +11004264# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004265
Damien Millerf58c6722002-05-13 13:15:42 +10004266PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004267AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004268 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004269 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004270 if test -n "$withval" && test "x$withval" != "xno" && \
4271 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004272 PRIVSEP_PATH=$withval
4273 fi
4274 ]
4275)
Tim Rice648f8762011-01-26 12:38:57 -08004276AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004277
Tim Rice648f8762011-01-26 12:38:57 -08004278AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004279 [ --with-xauth=PATH Specify path to xauth program ],
4280 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004281 if test -n "$withval" && test "x$withval" != "xno" && \
4282 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004283 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004284 fi
4285 ],
4286 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004287 TestPath="$PATH"
4288 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4289 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4290 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4291 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004292 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004293 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004294 xauth_path="/usr/openwin/bin/xauth"
4295 fi
4296 ]
4297)
4298
Damien Miller7d901272003-01-13 16:55:22 +11004299STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004300AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004301 [ --disable-strip Disable calling strip(1) on install],
4302 [
4303 if test "x$enableval" = "xno" ; then
4304 STRIP_OPT=
4305 fi
4306 ]
4307)
Tim Rice648f8762011-01-26 12:38:57 -08004308AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004309
Damien Millera19cf472000-11-29 13:28:50 +11004310if test -z "$xauth_path" ; then
4311 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004312 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004313else
Tim Rice648f8762011-01-26 12:38:57 -08004314 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004315 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004316 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004317 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004318fi
Damien Millera22ba012000-03-02 23:09:20 +11004319
Tim Rice90f42b02011-06-02 18:17:49 -07004320dnl # --with-maildir=/path/to/mail gets top priority.
4321dnl # if maildir is set in the platform case statement above we use that.
4322dnl # Otherwise we run a program to get the dir from system headers.
4323dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4324dnl # If we find _PATH_MAILDIR we do nothing because that is what
4325dnl # session.c expects anyway. Otherwise we set to the value found
4326dnl # stripping any trailing slash. If for some strage reason our program
4327dnl # does not find what it needs, we default to /var/spool/mail.
4328# Check for mail directory
4329AC_ARG_WITH([maildir],
4330 [ --with-maildir=/path/to/mail Specify your system mail directory],
4331 [
4332 if test "X$withval" != X && test "x$withval" != xno && \
4333 test "x${withval}" != xyes; then
4334 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4335 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4336 fi
4337 ],[
4338 if test "X$maildir" != "X"; then
4339 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4340 else
4341 AC_MSG_CHECKING([Discovering system mail directory])
4342 AC_RUN_IFELSE(
4343 [AC_LANG_PROGRAM([[
4344#include <stdio.h>
4345#include <string.h>
4346#ifdef HAVE_PATHS_H
4347#include <paths.h>
4348#endif
4349#ifdef HAVE_MAILLOCK_H
4350#include <maillock.h>
4351#endif
4352#define DATA "conftest.maildir"
4353 ]], [[
4354 FILE *fd;
4355 int rc;
4356
4357 fd = fopen(DATA,"w");
4358 if(fd == NULL)
4359 exit(1);
4360
4361#if defined (_PATH_MAILDIR)
4362 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4363 exit(1);
4364#elif defined (MAILDIR)
4365 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4366 exit(1);
4367#elif defined (_PATH_MAIL)
4368 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4369 exit(1);
4370#else
4371 exit (2);
4372#endif
4373
4374 exit(0);
4375 ]])],
4376 [
Tim Ricee1d93702016-05-31 11:13:22 -07004377 maildir_what=`awk -F: '{print $1}' conftest.maildir`
Tim Rice90f42b02011-06-02 18:17:49 -07004378 maildir=`awk -F: '{print $2}' conftest.maildir \
4379 | sed 's|/$||'`
4380 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4381 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4382 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4383 fi
4384 ],
4385 [
4386 if test "X$ac_status" = "X2";then
4387# our test program didn't find it. Default to /var/spool/mail
4388 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4389 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4390 else
4391 AC_MSG_RESULT([*** not found ***])
4392 fi
4393 ],
4394 [
4395 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4396 ]
4397 )
4398 fi
4399 ]
4400) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004401
Darren Tucker623d92f2004-09-12 22:36:15 +10004402if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004403 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4404 disable_ptmx_check=yes
4405fi
Damien Millera22ba012000-03-02 23:09:20 +11004406if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004407 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004408 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004409 [
Tim Rice648f8762011-01-26 12:38:57 -08004410 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004411 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004412 have_dev_ptmx=1
4413 ]
4414 )
4415 fi
Damien Millera22ba012000-03-02 23:09:20 +11004416fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004417
Darren Tucker623d92f2004-09-12 22:36:15 +10004418if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004419 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004420 [
Tim Rice648f8762011-01-26 12:38:57 -08004421 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004422 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004423 have_dev_ptc=1
4424 ]
4425 )
4426else
4427 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4428fi
Damien Miller204ad072000-03-02 23:56:12 +11004429
Damien Millera22ba012000-03-02 23:09:20 +11004430# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004431AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004432 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004433 [
Damien Miller897741e2001-04-16 10:41:46 +10004434 case "$withval" in
4435 man|cat|doc)
4436 MANTYPE=$withval
4437 ;;
4438 *)
Tim Rice648f8762011-01-26 12:38:57 -08004439 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004440 ;;
4441 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004442 ]
4443)
Ben Lindstrombc709922001-04-18 18:04:21 +00004444if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004445 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004446 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004447 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4448 MANTYPE=doc
4449 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4450 MANTYPE=man
4451 else
4452 MANTYPE=cat
4453 fi
4454fi
Tim Rice648f8762011-01-26 12:38:57 -08004455AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004456if test "$MANTYPE" = "doc"; then
4457 mansubdir=man;
4458else
4459 mansubdir=$MANTYPE;
4460fi
Tim Rice648f8762011-01-26 12:38:57 -08004461AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004462
Damien Millera22ba012000-03-02 23:09:20 +11004463# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004464MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004465AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004466 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004467 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004468 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004469 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004470 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004471 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004472 fi
4473 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004474)
4475
Damien Millera22ba012000-03-02 23:09:20 +11004476# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004477AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004478 [ --without-shadow Disable shadow password support],
4479 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004480 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004481 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004482 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004483 fi
4484 ]
4485)
4486
Damien Miller1f335fb2000-06-26 11:31:33 +10004487if test -z "$disable_shadow" ; then
4488 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004489 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004490#include <sys/types.h>
4491#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004492struct spwd sp;
4493 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4494 [ sp_expire_available=yes ], [
4495 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004496
4497 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004498 AC_MSG_RESULT([yes])
4499 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004500 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004501 else
Tim Rice648f8762011-01-26 12:38:57 -08004502 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004503 fi
4504fi
4505
Damien Millera22ba012000-03-02 23:09:20 +11004506# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004507if test ! -z "$IPADDR_IN_DISPLAY" ; then
4508 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004509 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004510 [Define if you need to use IP address
4511 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004512else
Damien Millera8e06ce2003-11-21 23:48:55 +11004513 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004514 AC_ARG_WITH([ipaddr-display],
Tim Rice6397eed2015-06-03 21:41:11 -07004515 [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY],
Damien Miller9a947342000-08-30 10:03:33 +11004516 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004517 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004518 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004519 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004520 fi
4521 ]
4522 )
4523fi
Damien Miller76112de1999-12-21 11:18:08 +11004524
Darren Tuckere1a790d2003-09-16 11:52:19 +10004525# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004526AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004527 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004528 [ if test "x$enableval" = "xno"; then
4529 AC_MSG_NOTICE([/etc/default/login handling disabled])
4530 etc_default_login=no
4531 else
4532 etc_default_login=yes
4533 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004534 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4535 then
4536 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4537 etc_default_login=no
4538 else
4539 etc_default_login=yes
4540 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004541)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004542
Darren Tucker2f9573d2005-02-10 22:28:54 +11004543if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004544 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004545 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004546 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004547 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004548 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004549 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004550fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004551
Tim Rice43a1c132002-04-17 21:19:14 -07004552dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004553if test $ac_cv_func_login_getcapbool = "yes" && \
4554 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004555 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004556fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004557
Damien Millera22ba012000-03-02 23:09:20 +11004558# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004559SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004560AC_ARG_WITH([default-path],
Tim Rice6397eed2015-06-03 21:41:11 -07004561 [ --with-default-path= Specify default $PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004562 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004563 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004564 AC_MSG_WARN([
4565--with-default-path=PATH has no effect on this system.
4566Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004567 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004568 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004569 AC_MSG_WARN([
4570--with-default-path=PATH will only be used if PATH is not defined in
4571$external_path_file .])
4572 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004573 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004574 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004575 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004576 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004577 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4578 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004579 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004580 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004581 AC_MSG_WARN([
4582If PATH is defined in $external_path_file, ensure the path to scp is included,
4583otherwise scp will not work.])
4584 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004585 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004586 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004587/* find out what STDPATH is */
4588#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004589#ifdef HAVE_PATHS_H
4590# include <paths.h>
4591#endif
4592#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004593# ifdef _PATH_USERPATH /* Irix */
4594# define _PATH_STDPATH _PATH_USERPATH
4595# else
4596# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4597# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004598#endif
4599#include <sys/types.h>
4600#include <sys/stat.h>
4601#include <fcntl.h>
4602#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004603 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004604 FILE *fd;
4605 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004606
Tim Rice59ea0a02001-03-10 13:50:45 -08004607 fd = fopen(DATA,"w");
4608 if(fd == NULL)
4609 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004610
Tim Rice59ea0a02001-03-10 13:50:45 -08004611 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4612 exit(1);
4613
4614 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004615 ]])],
4616 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004617 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4618 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4619 )
4620# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004621 t_bindir="${bindir}"
4622 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4623 t_bindir=`eval echo ${t_bindir}`
4624 case $t_bindir in
4625 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4626 esac
4627 case $t_bindir in
4628 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4629 esac
4630 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004631 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4632 if test $? -ne 0 ; then
4633 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4634 if test $? -ne 0 ; then
4635 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004636 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004637 fi
4638 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004639 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004640)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004641if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004642 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4643 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004644fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004645
Damien Millera18bbd32002-05-13 10:48:57 +10004646# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004647AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004648 [ --with-superuser-path= Specify different path for super-user],
4649 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004650 if test -n "$withval" && test "x$withval" != "xno" && \
4651 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004652 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004653 [Define if you want a different $PATH
4654 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004655 superuser_path=$withval
4656 fi
4657 ]
4658)
4659
4660
Damien Miller61e50f12000-05-08 20:49:37 +10004661AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004662IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004663AC_ARG_WITH(4in6,
4664 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4665 [
4666 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004667 AC_MSG_RESULT([yes])
4668 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004669 [Detect IPv4 in IPv6 mapped addresses
4670 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004671 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004672 else
Tim Rice648f8762011-01-26 12:38:57 -08004673 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004674 fi
Tim Rice648f8762011-01-26 12:38:57 -08004675 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004676 if test "x$inet6_default_4in6" = "xyes"; then
4677 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004678 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004679 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004680 else
4681 AC_MSG_RESULT([no (default)])
4682 fi
4683 ]
4684)
4685
Damien Miller60396b02001-02-18 17:01:00 +11004686# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004687BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004688AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004689 [ --with-bsd-auth Enable BSD auth support],
4690 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004691 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004692 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004693 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004694 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004695 fi
4696 ]
4697)
4698
Damien Millera22ba012000-03-02 23:09:20 +11004699# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004700piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004701# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004702if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004703 piddir=`eval echo ${sysconfdir}`
4704 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004705 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004706 esac
4707fi
4708
Tim Rice648f8762011-01-26 12:38:57 -08004709AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004710 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4711 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004712 if test -n "$withval" && test "x$withval" != "xno" && \
4713 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004714 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004715 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004716 AC_MSG_WARN([** no $piddir directory on this system **])
4717 fi
4718 fi
4719 ]
4720)
4721
Tim Ricee1d93702016-05-31 11:13:22 -07004722AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
Tim Rice648f8762011-01-26 12:38:57 -08004723 [Specify location of ssh.pid])
4724AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004725
andre2ff7b5d2000-06-03 14:57:40 +00004726dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004727AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004728 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004729 [
4730 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004731 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004732 fi
4733 ]
andre2ff7b5d2000-06-03 14:57:40 +00004734)
Tim Rice648f8762011-01-26 12:38:57 -08004735AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004736 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004737 [
4738 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004739 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004740 fi
4741 ]
andre2ff7b5d2000-06-03 14:57:40 +00004742)
Tim Rice648f8762011-01-26 12:38:57 -08004743AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004744 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004745 [
4746 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004747 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004748 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004749 fi
4750 ]
andre2ff7b5d2000-06-03 14:57:40 +00004751)
Tim Rice648f8762011-01-26 12:38:57 -08004752AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004753 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004754 [
4755 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004756 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004757 fi
4758 ]
andre2ff7b5d2000-06-03 14:57:40 +00004759)
Tim Rice648f8762011-01-26 12:38:57 -08004760AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004761 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004762 [
4763 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004764 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004765 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004766 fi
4767 ]
andre2ff7b5d2000-06-03 14:57:40 +00004768)
Tim Rice648f8762011-01-26 12:38:57 -08004769AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004770 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004771 [
4772 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004773 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004774 fi
4775 ]
andre2ff7b5d2000-06-03 14:57:40 +00004776)
Tim Rice648f8762011-01-26 12:38:57 -08004777AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004778 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004779 [
4780 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004781 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004782 [Define if you don't want to use pututline()
4783 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004784 fi
4785 ]
andre2ff7b5d2000-06-03 14:57:40 +00004786)
Tim Rice648f8762011-01-26 12:38:57 -08004787AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004788 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004789 [
4790 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004791 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004792 [Define if you don't want to use pututxline()
4793 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004794 fi
4795 ]
andre2ff7b5d2000-06-03 14:57:40 +00004796)
Tim Rice648f8762011-01-26 12:38:57 -08004797AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004798 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004799 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004800 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004801 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004802 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004803 conf_lastlog_location=$withval
4804 fi
4805 ]
4806)
andre2ff7b5d2000-06-03 14:57:40 +00004807
4808dnl lastlog, [uw]tmpx? detection
4809dnl NOTE: set the paths in the platform section to avoid the
4810dnl need for command-line parameters
4811dnl lastlog and [uw]tmp are subject to a file search if all else fails
4812
4813dnl lastlog detection
4814dnl NOTE: the code itself will detect if lastlog is a directory
4815AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004816AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004817#include <sys/types.h>
4818#include <utmp.h>
4819#ifdef HAVE_LASTLOG_H
4820# include <lastlog.h>
4821#endif
Damien Miller2994e082000-06-04 15:51:47 +10004822#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004823# include <paths.h>
4824#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004825#ifdef HAVE_LOGIN_H
4826# include <login.h>
4827#endif
Tim Rice648f8762011-01-26 12:38:57 -08004828 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4829 [ AC_MSG_RESULT([yes]) ],
4830 [
4831 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004832 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004833 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004834#include <sys/types.h>
4835#include <utmp.h>
4836#ifdef HAVE_LASTLOG_H
4837# include <lastlog.h>
4838#endif
4839#ifdef HAVE_PATHS_H
4840# include <paths.h>
4841#endif
Tim Rice648f8762011-01-26 12:38:57 -08004842 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4843 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004844 [
Tim Rice648f8762011-01-26 12:38:57 -08004845 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004846 system_lastlog_path=no
4847 ])
Tim Rice648f8762011-01-26 12:38:57 -08004848])
Damien Miller2994e082000-06-04 15:51:47 +10004849
andre2ff7b5d2000-06-03 14:57:40 +00004850if test -z "$conf_lastlog_location"; then
4851 if test x"$system_lastlog_path" = x"no" ; then
4852 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004853 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004854 conf_lastlog_location=$f
4855 fi
4856 done
4857 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004858 AC_MSG_WARN([** Cannot find lastlog **])
4859 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004860 fi
4861 fi
4862fi
4863
4864if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004865 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004866 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004867fi
andre2ff7b5d2000-06-03 14:57:40 +00004868
4869dnl utmp detection
4870AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004871AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004872#include <sys/types.h>
4873#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004874#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004875# include <paths.h>
4876#endif
Tim Rice648f8762011-01-26 12:38:57 -08004877 ]], [[ char *utmp = UTMP_FILE; ]])],
4878 [ AC_MSG_RESULT([yes]) ],
4879 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07004880 system_utmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08004881])
andre2ff7b5d2000-06-03 14:57:40 +00004882if test -z "$conf_utmp_location"; then
4883 if test x"$system_utmp_path" = x"no" ; then
4884 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4885 if test -f $f ; then
4886 conf_utmp_location=$f
4887 fi
4888 done
4889 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004890 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004891 fi
4892 fi
4893fi
4894if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004895 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004896 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004897fi
andre2ff7b5d2000-06-03 14:57:40 +00004898
4899dnl wtmp detection
4900AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004901AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004902#include <sys/types.h>
4903#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004904#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004905# include <paths.h>
4906#endif
Tim Rice648f8762011-01-26 12:38:57 -08004907 ]], [[ char *wtmp = WTMP_FILE; ]])],
4908 [ AC_MSG_RESULT([yes]) ],
4909 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07004910 system_wtmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08004911])
andre2ff7b5d2000-06-03 14:57:40 +00004912if test -z "$conf_wtmp_location"; then
4913 if test x"$system_wtmp_path" = x"no" ; then
4914 for f in /usr/adm/wtmp /var/log/wtmp; do
4915 if test -f $f ; then
4916 conf_wtmp_location=$f
4917 fi
4918 done
4919 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004920 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004921 fi
4922 fi
4923fi
4924if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004925 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004926 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004927fi
andre2ff7b5d2000-06-03 14:57:40 +00004928
andre2ff7b5d2000-06-03 14:57:40 +00004929dnl wtmpx detection
4930AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004931AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004932#include <sys/types.h>
4933#include <utmp.h>
4934#ifdef HAVE_UTMPX_H
4935#include <utmpx.h>
4936#endif
Damien Miller2994e082000-06-04 15:51:47 +10004937#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004938# include <paths.h>
4939#endif
Tim Rice648f8762011-01-26 12:38:57 -08004940 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4941 [ AC_MSG_RESULT([yes]) ],
4942 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07004943 system_wtmpx_path=no
Tim Rice648f8762011-01-26 12:38:57 -08004944])
andre2ff7b5d2000-06-03 14:57:40 +00004945if test -z "$conf_wtmpx_location"; then
4946 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004947 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004948 fi
4949else
Tim Rice648f8762011-01-26 12:38:57 -08004950 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004951 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004952fi
andre2ff7b5d2000-06-03 14:57:40 +00004953
Damien Miller4018c192000-04-30 09:30:44 +10004954
Damien Miller29ea30d2000-03-17 10:54:15 +11004955if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004956 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4957 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004958fi
4959
Damien Millera2438bb2013-03-15 10:23:07 +11004960AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004961 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004962 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004963 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004964 ], [
4965#ifdef HAVE_SYS_TYPES_H
4966#include <sys/types.h>
4967#endif
4968#ifdef HAVE_UTMP_H
4969#include <utmp.h>
4970#endif
4971#ifdef HAVE_UTMPX_H
4972#include <utmpx.h>
4973#endif
4974#ifdef HAVE_LASTLOG_H
4975#include <lastlog.h>
4976#endif
4977 ])
4978
4979AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4980 AC_DEFINE([DISABLE_UTMP])
4981 AC_DEFINE([DISABLE_WTMP])
4982 ], [
4983#ifdef HAVE_SYS_TYPES_H
4984#include <sys/types.h>
4985#endif
4986#ifdef HAVE_UTMP_H
4987#include <utmp.h>
4988#endif
4989#ifdef HAVE_UTMPX_H
4990#include <utmpx.h>
4991#endif
4992#ifdef HAVE_LASTLOG_H
4993#include <lastlog.h>
4994#endif
4995 ])
4996
Darren Tucker7da23cb2005-08-03 00:20:15 +10004997dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4998dnl Add now.
4999CFLAGS="$CFLAGS $werror_flags"
5000
Darren Tucker627337d2010-04-10 22:58:01 +10005001if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
5002 TEST_SSH_IPV6=no
5003else
5004 TEST_SSH_IPV6=yes
5005fi
Tim Rice648f8762011-01-26 12:38:57 -08005006AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
5007AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker47b8c992016-12-08 15:48:34 +11005008AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8])
Darren Tucker882abfd2013-11-09 00:17:41 +11005009AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10005010AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker5d376902008-06-11 04:15:05 +10005011
Damien Millerbac2d8a2000-09-05 16:13:06 +11005012AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10005013AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
5014 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10005015 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07005016AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10005017
Damien Miller7b22d652000-06-18 14:07:04 +10005018# Print summary of options
5019
Damien Miller7b22d652000-06-18 14:07:04 +10005020# Someone please show me a better way :)
5021A=`eval echo ${prefix}` ; A=`eval echo ${A}`
5022B=`eval echo ${bindir}` ; B=`eval echo ${B}`
5023C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
5024D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00005025E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00005026F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10005027G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10005028H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
5029I=`eval echo ${user_path}` ; I=`eval echo ${I}`
5030J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10005031
5032echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00005033echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10005034echo " User binaries: $B"
5035echo " System binaries: $C"
5036echo " Configuration files: $D"
5037echo " Askpass program: $E"
5038echo " Manual pages: $F"
5039echo " PID file: $G"
5040echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10005041if test "x$external_path_file" = "x/etc/login.conf" ; then
5042echo " At runtime, sshd will use the path defined in $external_path_file"
5043echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07005044else
Damien Millerf58c6722002-05-13 13:15:42 +10005045echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07005046 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10005047echo " (If PATH is set in $external_path_file it will be used instead. If"
5048echo " used, ensure the path to scp is present, otherwise scp will not work.)"
5049 fi
Tim Rice43a1c132002-04-17 21:19:14 -07005050fi
Damien Millera18bbd32002-05-13 10:48:57 +10005051if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10005052echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10005053fi
Damien Millerf58c6722002-05-13 13:15:42 +10005054echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10005055echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005056echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005057echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10005058echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005059echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005060echo " S/KEY support: $SKEY_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005061echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11005062echo " libedit support: $LIBEDIT_MSG"
Damien Miller523db852017-02-03 16:01:22 +11005063echo " libldns support: $LDNS_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005064echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11005065echo " Solaris project support: $SP_MSG"
Damien Miller4626cba2016-01-08 14:24:56 +11005066echo " Solaris privilege support: $SPP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10005067echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005068echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5069echo " BSD Auth support: $BSD_AUTH_MSG"
5070echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10005071echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11005072
Damien Miller7b22d652000-06-18 14:07:04 +10005073echo ""
5074
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00005075echo " Host: ${host}"
5076echo " Compiler: ${CC}"
5077echo " Compiler flags: ${CFLAGS}"
5078echo "Preprocessor flags: ${CPPFLAGS}"
5079echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10005080echo " Libraries: ${LIBS}"
5081if test ! -z "${SSHDLIBS}"; then
5082echo " +for sshd: ${SSHDLIBS}"
5083fi
Damien Miller71adf122011-01-25 12:16:15 +11005084if test ! -z "${SSHLIBS}"; then
5085echo " +for ssh: ${SSHLIBS}"
5086fi
Damien Miller7b22d652000-06-18 14:07:04 +10005087
5088echo ""
5089
Tim Rice6f1f7582004-05-30 21:38:51 -07005090if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10005091 echo "SVR4 style packages are supported with \"make package\""
5092 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07005093fi
5094
Damien Miller82cf0ce2000-12-20 13:34:48 +11005095if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11005096 echo "PAM is enabled. You may need to install a PAM control file "
5097 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11005098 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11005099 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11005100 echo ""
5101fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00005102
Damien Millerb4097182004-05-23 14:09:40 +10005103if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11005104 echo "WARNING: the operating system that you are using does not"
5105 echo "appear to support getpeereid(), getpeerucred() or the"
5106 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
5107 echo "enforce security checks to prevent unauthorised connections to"
5108 echo "ssh-agent. Their absence increases the risk that a malicious"
5109 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10005110 echo ""
5111fi
5112
Darren Tuckerd9f88912005-02-20 21:01:48 +11005113if test "$AUDIT_MODULE" = "bsm" ; then
5114 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
5115 echo "See the Solaris section in README.platform for details."
5116fi