blob: 2439e3948837f91a9aafeb8c111ec08c764ae874 [file] [log] [blame] [raw]
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])
Tim Rice6f1f7582004-05-30 21:38:51 -070049
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
Damien Miller2e1b0821999-12-25 10:11:29 +110074
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
Damien Millerad833b32000-08-23 10:46:23 +100082# Use LOGIN_PROGRAM from environment if possible
83if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice648f8762011-01-26 12:38:57 -080084 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM"],
Tim Rice7df8d392005-09-19 09:33:39 -070085 [If your header files don't define LOGIN_PROGRAM,
86 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100087else
88 # Search for login
Tim Rice648f8762011-01-26 12:38:57 -080089 AC_PATH_PROG([LOGIN_PROGRAM_FALLBACK], [login])
Damien Millerad833b32000-08-23 10:46:23 +100090 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
Tim Rice648f8762011-01-26 12:38:57 -080091 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM_FALLBACK"])
Damien Millerad833b32000-08-23 10:46:23 +100092 fi
93fi
94
Tim Rice648f8762011-01-26 12:38:57 -080095AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +110096if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -080097 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -070098 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110099fi
100
Damien Miller166bd442000-03-16 10:48:25 +1100101if test -z "$LD" ; then
102 LD=$CC
103fi
Tim Rice648f8762011-01-26 12:38:57 -0800104AC_SUBST([LD])
Tim Riceeae17cc2005-03-17 16:52:20 -0800105
Damien Miller166bd442000-03-16 10:48:25 +1100106AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +1000107
Tim Rice648f8762011-01-26 12:38:57 -0800108AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
Damien Miller69ff1df2011-06-23 08:30:03 +1000109AC_CHECK_DECL([SYSTR_POLICY_KILL], [have_systr_policy_kill=1], , [
110 #include <sys/types.h>
111 #include <sys/param.h>
112 #include <dev/systrace.h>
113])
114AC_CHECK_DECL([RLIMIT_NPROC],
115 [AC_DEFINE([HAVE_RLIMIT_NPROC], [], [sys/resource.h has RLIMIT_NPROC])], , [
116 #include <sys/types.h>
117 #include <sys/resource.h>
118])
Damien Millere0956e32012-04-04 11:27:54 +1000119AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [
120 #include <sys/types.h>
121 #include <linux/prctl.h>
Damien Miller868ea1e2014-01-17 16:47:04 +1100122])
123
Damien Miller72ef7c12015-01-15 02:21:31 +1100124openssl=yes
djm@openbsd.org564d63e2015-07-01 23:10:47 +0000125ssh1=no
Damien Miller72ef7c12015-01-15 02:21:31 +1100126AC_ARG_WITH([openssl],
127 [ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ],
Damien Miller76c04802015-01-13 19:38:18 +1100128 [ if test "x$withval" = "xno" ; then
Damien Miller72ef7c12015-01-15 02:21:31 +1100129 openssl=no
Damien Miller76c04802015-01-13 19:38:18 +1100130 ssh1=no
131 fi
Damien Miller72ef7c12015-01-15 02:21:31 +1100132 ]
133)
134AC_MSG_CHECKING([whether OpenSSL will be used for cryptography])
135if test "x$openssl" = "xyes" ; then
136 AC_MSG_RESULT([yes])
137 AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography])
138else
139 AC_MSG_RESULT([no])
140fi
141
142AC_ARG_WITH([ssh1],
Darren Tucker366bada2015-09-11 13:29:22 +1000143 [ --with-ssh1 Enable support for SSH protocol 1],
Damien Miller72ef7c12015-01-15 02:21:31 +1100144 [
djm@openbsd.org2aa9da12015-03-24 01:29:19 +0000145 if test "x$withval" = "xyes" ; then
146 if test "x$openssl" = "xno" ; then
147 AC_MSG_ERROR([Cannot enable SSH protocol 1 with OpenSSL disabled])
148 fi
149 ssh1=yes
Damien Miller0c2a81d2015-05-29 17:08:28 +1000150 elif test "x$withval" = "xno" ; then
151 ssh1=no
152 else
153 AC_MSG_ERROR([unknown --with-ssh1 argument])
Damien Miller72ef7c12015-01-15 02:21:31 +1100154 fi
Damien Miller76c04802015-01-13 19:38:18 +1100155 ]
156)
157AC_MSG_CHECKING([whether SSH protocol 1 support is enabled])
158if test "x$ssh1" = "xyes" ; then
159 AC_MSG_RESULT([yes])
160 AC_DEFINE_UNQUOTED([WITH_SSH1], [1], [include SSH protocol version 1 support])
161else
162 AC_MSG_RESULT([no])
163fi
164
Darren Tuckerb7918af2008-03-09 11:34:23 +1100165use_stack_protector=1
Darren Tuckerfd994372014-01-17 09:53:24 +1100166use_toolchain_hardening=1
Tim Rice648f8762011-01-26 12:38:57 -0800167AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100168 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100169 if test "x$withval" = "xno"; then
170 use_stack_protector=0
171 fi ])
Darren Tuckerfd994372014-01-17 09:53:24 +1100172AC_ARG_WITH([hardening],
173 [ --without-hardening Don't use toolchain hardening flags], [
174 if test "x$withval" = "xno"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100175 use_toolchain_hardening=0
176 fi ])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100177
Darren Tuckerfd994372014-01-17 09:53:24 +1100178# We use -Werror for the tests only so that we catch warnings like "this is
179# on by default" for things like -fPIE.
180AC_MSG_CHECKING([if $CC supports -Werror])
181saved_CFLAGS="$CFLAGS"
182CFLAGS="$CFLAGS -Werror"
183AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
184 [ AC_MSG_RESULT([yes])
185 WERROR="-Werror"],
186 [ AC_MSG_RESULT([no])
187 WERROR="" ]
188)
189CFLAGS="$saved_CFLAGS"
Damien Miller134d02a2011-01-12 16:00:37 +1100190
Damien Millera8e06ce2003-11-21 23:48:55 +1100191if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100192 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
193 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option])
Damien Millerb1763622011-05-20 11:45:25 +1000194 OSSH_CHECK_CFLAG_COMPILE([-Wall])
195 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
196 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
197 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
198 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000199 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000200 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
201 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
202 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100203 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100204 if test "x$use_toolchain_hardening" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100205 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
206 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
207 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
Damien Miller5c2ff5e2014-01-22 21:30:12 +1100208 # NB. -ftrapv expects certain support functions to be present in
209 # the compiler library (libgcc or similar) to detect integer operations
210 # that can overflow. We must check that the result of enabling it
211 # actually links. The test program compiled/linked includes a number
212 # of integer operations that should exercise this.
213 OSSH_CHECK_CFLAG_LINK([-ftrapv])
Darren Tuckerfd994372014-01-17 09:53:24 +1100214 fi
Tim Rice648f8762011-01-26 12:38:57 -0800215 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100216 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700217 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000218 1.*) no_attrib_nonnull=1 ;;
219 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000220 no_attrib_nonnull=1
221 ;;
222 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100223 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700224 esac
Tim Rice648f8762011-01-26 12:38:57 -0800225 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000226
Tim Rice648f8762011-01-26 12:38:57 -0800227 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000228 saved_CFLAGS="$CFLAGS"
229 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800230 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
231 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
232 [ AC_MSG_RESULT([yes]) ],
233 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000234 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800235 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000236
Darren Tuckerb7918af2008-03-09 11:34:23 +1100237 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100238 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100239 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100240 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100241 for t in -fstack-protector-strong -fstack-protector-all \
242 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800243 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100244 saved_CFLAGS="$CFLAGS"
245 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100246 CFLAGS="$CFLAGS $t -Werror"
247 LDFLAGS="$LDFLAGS $t -Werror"
248 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800249 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
250 [[
251 char x[256];
252 snprintf(x, sizeof(x), "XXX");
253 ]])],
254 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100255 CFLAGS="$saved_CFLAGS $t"
256 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800257 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100258 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800259 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
260 [[
261 char x[256];
262 snprintf(x, sizeof(x), "XXX");
263 ]])],
264 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100265 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800266 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100267 [ AC_MSG_WARN([cross compiling: cannot test])
268 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100269 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100270 ],
Tim Rice648f8762011-01-26 12:38:57 -0800271 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100272 )
273 CFLAGS="$saved_CFLAGS"
274 LDFLAGS="$saved_LDFLAGS"
275 done
276 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100277
Darren Tucker67b37032005-06-03 17:58:31 +1000278 if test -z "$have_llong_max"; then
279 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
280 unset ac_cv_have_decl_LLONG_MAX
281 saved_CFLAGS="$CFLAGS"
282 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800283 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000284 [have_llong_max=1],
285 [CFLAGS="$saved_CFLAGS"],
286 [#include <limits.h>]
287 )
288 fi
Darren Tucker431f0222005-06-07 17:53:40 +1000289fi
290
Darren Tucker951b53b2013-02-08 11:50:09 +1100291AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
292AC_COMPILE_IFELSE(
293 [AC_LANG_PROGRAM([[
294#include <stdlib.h>
295__attribute__((__unused__)) static void foo(void){return;}]],
296 [[ exit(0); ]])],
297 [ AC_MSG_RESULT([yes]) ],
298 [ AC_MSG_RESULT([no])
299 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
300 [compiler does not accept __attribute__ on return types]) ]
301)
302
Darren Tucker391de5c2007-04-29 14:49:21 +1000303if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800304 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000305fi
306
Tim Rice648f8762011-01-26 12:38:57 -0800307AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800308 [ --without-rpath Disable auto-added -R linker paths],
309 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800310 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800311 need_dash_r=""
312 fi
313 if test "x$withval" = "xyes" ; then
314 need_dash_r=1
315 fi
316 ]
317)
Tim Rice1cfab232006-10-03 09:34:35 -0700318
319# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800320AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700321 [ --with-cflags Specify additional flags to pass to compiler],
322 [
323 if test -n "$withval" && test "x$withval" != "xno" && \
324 test "x${withval}" != "xyes"; then
325 CFLAGS="$CFLAGS $withval"
326 fi
327 ]
328)
Tim Rice648f8762011-01-26 12:38:57 -0800329AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700330 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
331 [
332 if test -n "$withval" && test "x$withval" != "xno" && \
333 test "x${withval}" != "xyes"; then
334 CPPFLAGS="$CPPFLAGS $withval"
335 fi
336 ]
337)
Tim Rice648f8762011-01-26 12:38:57 -0800338AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700339 [ --with-ldflags Specify additional flags to pass to linker],
340 [
341 if test -n "$withval" && test "x$withval" != "xno" && \
342 test "x${withval}" != "xyes"; then
343 LDFLAGS="$LDFLAGS $withval"
344 fi
345 ]
346)
Tim Rice648f8762011-01-26 12:38:57 -0800347AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700348 [ --with-libs Specify additional libraries to link with],
349 [
350 if test -n "$withval" && test "x$withval" != "xno" && \
351 test "x${withval}" != "xyes"; then
352 LIBS="$LIBS $withval"
353 fi
354 ]
355)
Tim Rice648f8762011-01-26 12:38:57 -0800356AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700357 [ --with-Werror Build main code with -Werror],
358 [
359 if test -n "$withval" && test "x$withval" != "xno"; then
360 werror_flags="-Werror"
361 if test "x${withval}" != "xyes"; then
362 werror_flags="$withval"
363 fi
364 fi
365 ]
366)
367
Tim Rice648f8762011-01-26 12:38:57 -0800368AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100369 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700370 bstring.h \
371 crypt.h \
372 crypto/sha2.h \
373 dirent.h \
374 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100375 elf.h \
Darren Tucker6310ef22016-07-13 14:42:35 +1000376 err.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700377 features.h \
378 fcntl.h \
379 floatingpoint.h \
380 getopt.h \
381 glob.h \
382 ia.h \
383 iaf.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100384 inttypes.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000385 langinfo.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700386 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000387 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700388 login.h \
389 maillock.h \
390 ndir.h \
391 net/if_tun.h \
392 netdb.h \
393 netgroup.h \
394 pam/pam_appl.h \
395 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000396 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700397 pty.h \
398 readpassphrase.h \
399 rpc/types.h \
400 security/pam_appl.h \
401 sha2.h \
402 shadow.h \
403 stddef.h \
404 stdint.h \
405 string.h \
406 strings.h \
407 sys/audit.h \
408 sys/bitypes.h \
409 sys/bsdtty.h \
Damien Millerc96d8532014-01-25 13:12:28 +1100410 sys/capability.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700411 sys/cdefs.h \
412 sys/dir.h \
413 sys/mman.h \
414 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000415 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700416 sys/prctl.h \
417 sys/pstat.h \
418 sys/select.h \
419 sys/stat.h \
420 sys/stream.h \
421 sys/stropts.h \
422 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000423 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700424 sys/sysmacros.h \
425 sys/time.h \
426 sys/timers.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700427 time.h \
428 tmpdir.h \
429 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700430 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700431 unistd.h \
432 usersec.h \
433 util.h \
434 utime.h \
435 utmp.h \
436 utmpx.h \
437 vis.h \
Darren Tuckerf3f2cc82016-07-11 17:23:38 +1000438 wchar.h \
Tim Rice648f8762011-01-26 12:38:57 -0800439])
Tim Rice1cfab232006-10-03 09:34:35 -0700440
441# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800442AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700443#ifdef HAVE_SYS_TIME_H
444# include <sys/time.h>
445#endif
446])
447
448# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800449AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700450#ifdef HAVE_SYS_STREAM_H
451# include <sys/stream.h>
452#endif
453])
454
455# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800456AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700457#include <sys/types.h>
458])
Damien Miller1b06dc32006-08-31 03:24:41 +1000459
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000460# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800461AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000462#include <sys/param.h>
463])
464
Darren Tuckeref4901c2013-06-03 01:59:13 +1000465# Android requires sys/socket.h to be included before sys/un.h
466AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000467#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000468#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000469])
470
Damien Miller1b06dc32006-08-31 03:24:41 +1000471# Messages for features tested for in target-specific section
472SIA_MSG="no"
473SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100474SP_MSG="no"
Damien Miller4626cba2016-01-08 14:24:56 +1100475SPP_MSG="no"
476
477# Support for Solaris/Illumos privileges (this test is used by both
478# the --with-solaris-privs option and --with-sandbox=solaris).
479SOLARIS_PRIVS="no"
Damien Miller78315eb2000-09-29 23:01:36 +1100480
Damien Millera22ba012000-03-02 23:09:20 +1100481# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100482case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100483*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000484 # Some versions of VAC won't allow macro redefinitions at
485 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
486 # particularly with older versions of vac or xlc.
487 # It also throws errors about null macro argments, but these are
488 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800489 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000490 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800491 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000492#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800493#define testmacro bar]],
494 [[ exit(0); ]])],
495 [ AC_MSG_RESULT([yes]) ],
496 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000497 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
498 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
499 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
500 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
501 ]
502 )
503
Damien Millera8e06ce2003-11-21 23:48:55 +1100504 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000505 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800506 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100507 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000508 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000509 if test "$GCC" = "yes"; then
510 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
511 else
512 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
513 fi
514 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000515 if (test -z "$blibflags"); then
516 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800517 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
518 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000519 fi
520 done
521 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800522 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000523 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
524 else
Tim Rice648f8762011-01-26 12:38:57 -0800525 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000526 fi
527 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000528 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800529 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700530 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800531 [AC_CHECK_LIB([s], [authenticate],
532 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700533 LIBS="$LIBS -ls"
534 ])
535 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100536 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100537 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100538 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000539 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800540 AC_CHECK_DECLS([loginfailed],
541 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
543 [[ (void)loginfailed("user","host","tty",0); ]])],
544 [AC_MSG_RESULT([yes])
545 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
546 [Define if your AIX loginfailed() function
547 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
548 ])],
549 [],
550 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000551 )
Tim Rice648f8762011-01-26 12:38:57 -0800552 AC_CHECK_FUNCS([getgrset setauthdb])
553 AC_CHECK_DECL([F_CLOSEM],
554 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000555 [],
556 [ #include <limits.h>
557 #include <fcntl.h> ]
558 )
Darren Tucker691d5232005-02-15 21:45:57 +1100559 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800560 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
561 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700562 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800563 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
564 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000565 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800566 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
567 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700568 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800569 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700570 [Define to a Set Process Title type if your system is
571 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800572 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100573 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800574 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100575 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100576 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000577*-*-android*)
578 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
579 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
580 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100581*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100582 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100583 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800584 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
585 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
Damien Miller4626cba2016-01-08 14:24:56 +1100586 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
587 [Define to disable UID restoration test])
Tim Rice648f8762011-01-26 12:38:57 -0800588 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700589 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700591 [Define if X11 doesn't support AF_UNIX sockets on that system])
Darren Tucker5f41f032016-04-08 21:14:13 +1000592 AC_DEFINE([IPPORT_RESERVED], [0],
593 [Cygwin has no notion of ports only accessible to superusers])
Tim Rice648f8762011-01-26 12:38:57 -0800594 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700595 [Define if your platform needs to skip post auth
596 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800597 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
Darren Tuckerfdce3732014-01-18 21:12:42 +1100598 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
599 # Cygwin defines optargs, optargs as declspec(dllimport) for historical
600 # reasons which cause compile warnings, so we disable those warnings.
601 OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100602 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000603*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800604 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700605 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800606 AC_DEFINE([SETEUID_BREAKS_SETUID])
607 AC_DEFINE([BROKEN_SETREUID])
608 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000609 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000610*-*-darwin*)
Damien Miller852472a2014-01-22 16:31:18 +1100611 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800612 AC_MSG_CHECKING([if we have working getaddrinfo])
613 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000614main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
615 exit(0);
616 else
617 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800618}
619 ]])],
620 [AC_MSG_RESULT([working])],
621 [AC_MSG_RESULT([buggy])
622 AC_DEFINE([BROKEN_GETADDRINFO], [1],
623 [getaddrinfo is broken (if present)])
624 ],
625 [AC_MSG_RESULT([assume it is working])])
626 AC_DEFINE([SETEUID_BREAKS_SETUID])
627 AC_DEFINE([BROKEN_SETREUID])
628 AC_DEFINE([BROKEN_SETREGID])
629 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
630 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700631 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800632 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
633 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000634 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800635 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000636 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800637 m4_pattern_allow([AU_IPv])
Tim Ricee1d93702016-05-31 11:13:22 -0700638 AC_CHECK_DECL([AU_IPv4], [],
Tim Rice648f8762011-01-26 12:38:57 -0800639 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100640 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800641 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100642 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100643 )
Damien Millerc09182f2011-06-03 12:11:38 +1000644 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
645 [Define to a Set Process Title type if your system is
646 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000647 AC_CHECK_FUNCS([sandbox_init])
648 AC_CHECK_HEADERS([sandbox.h])
Damien Miller39f303b2016-02-23 12:56:59 +1100649 AC_CHECK_LIB([sandbox], [sandbox_apply], [
650 SSHDLIBS="$SSHDLIBS -lsandbox"
651 ])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000652 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000653*-*-dragonfly*)
654 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100655 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000656 ;;
Tim Ricee1d93702016-05-31 11:13:22 -0700657*-*-haiku*)
Darren Tuckera83d90f2010-03-26 10:27:33 +1100658 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800659 AC_CHECK_LIB([network], [socket])
660 AC_DEFINE([HAVE_U_INT64_T])
Tim Ricee1d93702016-05-31 11:13:22 -0700661 MANTYPE=man
662 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000663*-*-hpux*)
664 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000665 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100666 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800667 AC_DEFINE([USE_PIPES])
668 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700669 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800670 AC_DEFINE([LOGIN_NEEDS_UTMPX])
671 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700672 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800673 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100674 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700675 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700676 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800677 AC_CHECK_LIB([xnet], [t_error], ,
678 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000679
680 # next, we define all of the options specific to major releases
681 case "$host" in
682 *-*-hpux10*)
683 if test -z "$GCC"; then
684 CFLAGS="$CFLAGS -Ae"
685 fi
686 ;;
687 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800688 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700689 [Define if you are using Solaris-derived PAM which
690 passes pam_messages to the conversation function
691 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800692 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700693 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800694 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000695 check_for_hpux_broken_getaddrinfo=1
696 check_for_conflicting_getspnam=1
697 ;;
698 esac
699
700 # lastly, we define options specific to minor releases
701 case "$host" in
702 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800703 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700704 [Define if you have SecureWare-based
705 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000706 disable_ptmx_check=yes
707 LIBS="$LIBS -lsecpw"
708 ;;
709 esac
Damien Miller1bead332000-04-30 00:47:29 +1000710 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100711*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100712 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800713 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700714 [Define if you system's inet_ntoa is busted
715 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800716 AC_DEFINE([SETEUID_BREAKS_SETUID])
717 AC_DEFINE([BROKEN_SETREUID])
718 AC_DEFINE([BROKEN_SETREGID])
719 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700720 [Define if you shouldn't strip 'tty' from your
721 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800722 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100723 ;;
724*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100725 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800726 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700727 [Define if you have/want arrays
728 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800729 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700730 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800731 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700732 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800733 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700734 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800735 AC_DEFINE([BROKEN_INET_NTOA])
736 AC_DEFINE([SETEUID_BREAKS_SETUID])
737 AC_DEFINE([BROKEN_SETREUID])
738 AC_DEFINE([BROKEN_SETREGID])
739 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
740 AC_DEFINE([WITH_ABBREV_NO_TTY])
741 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerb29ea912000-01-15 14:12:03 +1100742 ;;
Damien Miller90551722009-02-16 15:37:03 +1100743*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
744 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800745 AC_DEFINE([PAM_TTY_KLUDGE])
746 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
747 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
748 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
749 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100750 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100751*-*-linux*)
752 no_dev_ptmx=1
Damien Miller852472a2014-01-22 16:31:18 +1100753 use_pie=auto
Damien Millera64b57a2001-01-17 10:44:13 +1100754 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000755 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800756 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700757 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800758 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700759 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800760 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
761 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700762 [Define to whatever link() returns for "not supported"
763 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
765 AC_DEFINE([USE_BTMP])
766 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100767 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000768 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000769 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800770 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700771 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000772 ;;
773 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100774 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800775 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100776 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800777 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100778 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800779 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100780 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800781 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100782 [Prepend the address family to IP tunnel traffic])
783 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000784 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
785 [], [#include <linux/types.h>])
Damien Millere0956e32012-04-04 11:27:54 +1000786 AC_CHECK_FUNCS([prctl])
Damien Miller91f40d82013-02-22 11:37:00 +1100787 AC_MSG_CHECKING([for seccomp architecture])
788 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000789 case "$host" in
790 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100791 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000792 ;;
793 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100794 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000795 ;;
Damien Miller99f33d72015-06-17 10:50:51 +1000796 arm*-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100797 seccomp_audit_arch=AUDIT_ARCH_ARM
Damien Miller99f33d72015-06-17 10:50:51 +1000798 ;;
799 aarch64*-*)
800 seccomp_audit_arch=AUDIT_ARCH_AARCH64
Damien Miller5c15e222015-06-18 15:07:56 +1000801 ;;
Damien Millerb9c50612016-07-08 13:59:13 +1000802 s390x-*)
803 seccomp_audit_arch=AUDIT_ARCH_S390X
804 ;;
805 s390-*)
806 seccomp_audit_arch=AUDIT_ARCH_S390
807 ;;
808 powerpc64-*)
809 seccomp_audit_arch=AUDIT_ARCH_PPC64
810 ;;
811 powerpc64le-*)
812 seccomp_audit_arch=AUDIT_ARCH_PPC64LE
813 ;;
814 mips-*)
815 seccomp_audit_arch=AUDIT_ARCH_MIPS
816 ;;
817 mipsel-*)
818 seccomp_audit_arch=AUDIT_ARCH_MIPSEL
819 ;;
820 mips64-*)
821 seccomp_audit_arch=AUDIT_ARCH_MIPS64
822 ;;
823 mips64el-*)
824 seccomp_audit_arch=AUDIT_ARCH_MIPSEL64
825 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000826 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100827 if test "x$seccomp_audit_arch" != "x" ; then
828 AC_MSG_RESULT(["$seccomp_audit_arch"])
Damien Miller99f33d72015-06-17 10:50:51 +1000829 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
830 [Specify the system call convention in use])
Damien Miller91f40d82013-02-22 11:37:00 +1100831 else
832 AC_MSG_RESULT([architecture not supported])
833 fi
Damien Millerbeb4ba51999-12-28 15:09:35 +1100834 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000835mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800836 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000837 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000838 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100839*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000840 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800841 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800842 need_dash_r=1
843 fi
Tim Rice648f8762011-01-26 12:38:57 -0800844 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100845 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800846 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
847 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100848 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100849 TEST_MALLOC_OPTIONS="AJRX"
Darren Tucker42a09252014-01-23 23:14:39 +1100850 AC_DEFINE([BROKEN_STRNVIS], [1],
851 [NetBSD strnvis argument order is swapped compared to OpenBSD])
Damien Millerf5bbd3b2014-01-30 11:26:46 +1100852 AC_DEFINE([BROKEN_READ_COMPARISON], [1],
853 [NetBSD read function is sometimes redirected, breaking atomicio comparisons against it])
Damien Milleree1c0b32000-01-21 00:18:15 +1100854 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100855*-*-freebsd*)
856 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800857 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
858 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100859 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800860 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
861 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker42a09252014-01-23 23:14:39 +1100862 AC_DEFINE([BROKEN_STRNVIS], [1],
863 [FreeBSD strnvis argument order is swapped compared to OpenBSD])
Darren Tucker882abfd2013-11-09 00:17:41 +1100864 TEST_MALLOC_OPTIONS="AJRX"
Damien Miller2035b222014-01-26 09:39:53 +1100865 # Preauth crypto occasionally uses file descriptors for crypto offload
866 # and will crash if they cannot be opened.
Damien Miller5b447c02014-01-26 09:46:53 +1100867 AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1],
Tim Rice03ae0812014-02-21 09:09:34 -0800868 [define if setrlimit RLIMIT_NOFILE breaks things])
Damien Millerfbd884a2001-02-27 08:39:07 +1100869 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000870*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800871 AC_DEFINE([SETEUID_BREAKS_SETUID])
872 AC_DEFINE([BROKEN_SETREUID])
873 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000874 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000875*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000876 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100877 conf_utmp_location=/etc/utmp
878 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700879 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800880 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
881 AC_DEFINE([BROKEN_REALPATH])
882 AC_DEFINE([USE_PIPES])
883 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000884 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000885*-*-openbsd*)
Damien Miller852472a2014-01-22 16:31:18 +1100886 use_pie=auto
Tim Rice648f8762011-01-26 12:38:57 -0800887 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
888 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
889 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
890 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000891 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100892 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000893 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100894*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800895 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800896 need_dash_r=1
897 fi
Tim Rice648f8762011-01-26 12:38:57 -0800898 AC_DEFINE([PAM_SUN_CODEBASE])
899 AC_DEFINE([LOGIN_NEEDS_UTMPX])
900 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700901 [Some versions of /bin/login need the TERM supplied
902 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800903 AC_DEFINE([PAM_TTY_KLUDGE])
904 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700905 [Define if pam_chauthtok wants real uid set
906 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800907 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000908 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800909 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700910 [Define if sshd somehow reacquires a controlling TTY
911 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800912 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000913 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800914 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000915 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000916 # hardwire lastlog location (can't detect it on some versions)
917 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800918 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000919 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
920 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800921 AC_MSG_RESULT([yes])
922 AC_DEFINE([DISABLE_UTMP])
923 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700924 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000925 else
Tim Rice648f8762011-01-26 12:38:57 -0800926 AC_MSG_RESULT([no])
Darren Tucker394b8c82003-07-19 19:49:45 +1000927 fi
Darren Tuckera86ec4d2016-06-14 10:48:27 +1000928 AC_CHECK_FUNCS([setpflags])
Darren Tucker907091a2016-02-19 09:05:39 +1100929 AC_CHECK_FUNCS([setppriv])
930 AC_CHECK_FUNCS([priv_basicset])
931 AC_CHECK_HEADERS([priv.h])
Tim Rice648f8762011-01-26 12:38:57 -0800932 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000933 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
934 [
Tim Rice648f8762011-01-26 12:38:57 -0800935 AC_CHECK_LIB([contract], [ct_tmpl_activate],
936 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000937 [Define if you have Solaris process contracts])
Damien Miller4626cba2016-01-08 14:24:56 +1100938 LIBS="$LIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000939 SPC_MSG="yes" ], )
Darren Tucker97528352010-11-05 12:03:05 +1100940 ],
941 )
Tim Rice648f8762011-01-26 12:38:57 -0800942 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100943 [ --with-solaris-projects Enable Solaris projects (experimental)],
944 [
Tim Rice648f8762011-01-26 12:38:57 -0800945 AC_CHECK_LIB([project], [setproject],
946 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100947 [Define if you have Solaris projects])
Damien Miller4626cba2016-01-08 14:24:56 +1100948 LIBS="$LIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100949 SP_MSG="yes" ], )
Damien Miller4626cba2016-01-08 14:24:56 +1100950 ],
951 )
952 AC_ARG_WITH([solaris-privs],
953 [ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)],
954 [
955 AC_MSG_CHECKING([for Solaris/Illumos privilege support])
Darren Tucker907091a2016-02-19 09:05:39 +1100956 if test "x$ac_cv_func_setppriv" = "xyes" -a \
957 "x$ac_cv_header_priv_h" = "xyes" ; then
958 SOLARIS_PRIVS=yes
Damien Miller4626cba2016-01-08 14:24:56 +1100959 AC_MSG_RESULT([found])
960 AC_DEFINE([NO_UID_RESTORATION_TEST], [1],
961 [Define to disable UID restoration test])
962 AC_DEFINE([USE_SOLARIS_PRIVS], [1],
963 [Define if you have Solaris privileges])
964 SPP_MSG="yes"
965 else
966 AC_MSG_RESULT([not found])
967 AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs])
968 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000969 ],
970 )
Tim Rice5ab9b632013-06-02 14:05:48 -0700971 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +1100972 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000973*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000974 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800975 AC_CHECK_FUNCS([getpwanam])
976 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000977 conf_utmp_location=/etc/utmp
978 conf_wtmp_location=/var/adm/wtmp
979 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800980 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000981 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000982*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700983 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800984 AC_DEFINE([USE_PIPES])
985 AC_DEFINE([SSHD_ACQUIRES_CTTY])
986 AC_DEFINE([SETEUID_BREAKS_SETUID])
987 AC_DEFINE([BROKEN_SETREUID])
988 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000989 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000990*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700991 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800992 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100993 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800994 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100995 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800996 AC_DEFINE([USE_PIPES])
997 AC_DEFINE([IP_TOS_IS_BROKEN])
998 AC_DEFINE([SETEUID_BREAKS_SETUID])
999 AC_DEFINE([BROKEN_SETREUID])
1000 AC_DEFINE([BROKEN_SETREGID])
1001 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +10001002 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -07001003 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
1004 # Attention: always take care to bind libsocket and libnsl before libc,
1005 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +10001006 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001007# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +11001008*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -08001009 AC_DEFINE([USE_PIPES])
1010 AC_DEFINE([SETEUID_BREAKS_SETUID])
1011 AC_DEFINE([BROKEN_SETREUID])
1012 AC_DEFINE([BROKEN_SETREGID])
1013 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
1014 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -07001015 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +11001016 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001017# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +11001018*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -08001019 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -08001020 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
1021 AC_DEFINE([USE_PIPES])
1022 AC_DEFINE([SETEUID_BREAKS_SETUID])
1023 AC_DEFINE([BROKEN_GETADDRINFO])
1024 AC_DEFINE([BROKEN_SETREUID])
1025 AC_DEFINE([BROKEN_SETREGID])
1026 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice5ab9b632013-06-02 14:05:48 -07001027 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4dbacff2005-06-01 20:09:28 -07001028 case "$host" in
1029 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -07001030 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -08001031 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001032 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -08001033 AC_DEFINE([BROKEN_UPDWTMPX])
1034 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
1035 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
1036 AC_DEFINE([HAVE_SECUREWARE])
1037 AC_DEFINE([DISABLE_SHADOW])
1038 ], , )
Tim Rice20168652005-08-29 17:17:37 -07001039 ;;
Tim Rice648f8762011-01-26 12:38:57 -08001040 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -08001041 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -08001042 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -07001043 esac
Damien Miller78315eb2000-09-29 23:01:36 +11001044 ;;
Damien Miller75b1d102000-01-07 14:01:41 +11001045*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +11001046 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001047# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +11001048*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -08001049 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +11001050 ;;
Tim Rice0f83d292004-12-08 18:29:58 -08001051# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +11001052*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -08001053 if test -z "$GCC"; then
1054 CFLAGS="$CFLAGS -belf"
1055 fi
Damien Miller5dfe9762001-02-16 12:05:39 +11001056 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +10001057 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -08001058 AC_DEFINE([USE_PIPES])
1059 AC_DEFINE([HAVE_SECUREWARE])
1060 AC_DEFINE([DISABLE_SHADOW])
1061 AC_DEFINE([DISABLE_FD_PASSING])
1062 AC_DEFINE([SETEUID_BREAKS_SETUID])
1063 AC_DEFINE([BROKEN_GETADDRINFO])
1064 AC_DEFINE([BROKEN_SETREUID])
1065 AC_DEFINE([BROKEN_SETREGID])
1066 AC_DEFINE([WITH_ABBREV_NO_TTY])
1067 AC_DEFINE([BROKEN_UPDWTMPX])
1068 AC_DEFINE([PASSWD_NEEDS_USERNAME])
1069 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -07001070 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -07001071 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -07001072 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +10001073 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001074*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -08001075 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001076 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -08001077 AC_DEFINE([SETEUID_BREAKS_SETUID])
1078 AC_DEFINE([BROKEN_SETREUID])
1079 AC_DEFINE([BROKEN_SETREGID])
1080 AC_DEFINE([USE_PIPES])
1081 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001082 LDFLAGS="$LDFLAGS"
1083 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
1084 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +00001085 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001086*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -08001087 AC_DEFINE([SETEUID_BREAKS_SETUID])
1088 AC_DEFINE([BROKEN_SETREUID])
1089 AC_DEFINE([BROKEN_SETREGID])
1090 AC_DEFINE([WITH_ABBREV_NO_TTY])
1091 AC_DEFINE([USE_PIPES])
1092 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001093 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +11001094 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +10001095 MANTYPE=cat
1096 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +00001097*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -08001098 AC_DEFINE([SETEUID_BREAKS_SETUID])
1099 AC_DEFINE([BROKEN_SETREUID])
1100 AC_DEFINE([BROKEN_SETREGID])
1101 AC_DEFINE([USE_PIPES])
1102 AC_DEFINE([DISABLE_FD_PASSING])
1103 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +00001104 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
1105 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
1106 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -07001107 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +10001108*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -08001109 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001110 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -08001111 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001112 [ --with-osfsia Enable Digital Unix SIA],
1113 [
1114 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001115 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +00001116 no_osfsia=1
1117 fi
1118 ],
1119 )
1120 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001121 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001122 AC_MSG_RESULT([yes])
1123 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001124 [Define if you have Digital Unix Security
1125 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001126 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001127 [Define if you don't want to use your
1128 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001129 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001130 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001131 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001132 else
Tim Rice648f8762011-01-26 12:38:57 -08001133 AC_MSG_RESULT([no])
1134 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001135 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001136 fi
1137 fi
Tim Rice648f8762011-01-26 12:38:57 -08001138 AC_DEFINE([BROKEN_GETADDRINFO])
1139 AC_DEFINE([SETEUID_BREAKS_SETUID])
1140 AC_DEFINE([BROKEN_SETREUID])
1141 AC_DEFINE([BROKEN_SETREGID])
1142 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001143 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001144
Tim Rice70335a62006-02-04 17:42:58 -08001145*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001146 AC_DEFINE([USE_PIPES])
1147 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001148 AC_DEFINE([DISABLE_LASTLOG])
1149 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1150 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001151 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001152 case "$host" in
1153 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001154 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001155 ;;
1156 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001157 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001158
1159*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001160 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
1161 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
1162 AC_DEFINE([NEED_SETPGRP])
1163 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001164 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001165
1166*-*-lynxos)
1167 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001168 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001169 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001170esac
Damien Miller7f6ea021999-10-28 13:25:17 +10001171
Tim Rice648f8762011-01-26 12:38:57 -08001172AC_MSG_CHECKING([compiler and flags for sanity])
1173AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1174 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001175 [
Tim Rice648f8762011-01-26 12:38:57 -08001176 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001177 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001178 ],
1179 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001180)
1181
Darren Tucker0c9653f2005-05-28 15:58:14 +10001182dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001183# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001184AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Tim Rice13aae5e2001-10-21 17:53:58 -07001185
Tim Rice1e1ef642003-09-11 22:19:31 -07001186dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001187AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1188 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001189 AC_CACHE_CHECK([for broken dirname],
1190 ac_cv_have_broken_dirname, [
1191 save_LIBS="$LIBS"
1192 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001193 AC_RUN_IFELSE(
1194 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001195#include <libgen.h>
1196#include <string.h>
1197
1198int main(int argc, char **argv) {
1199 char *s, buf[32];
1200
1201 strncpy(buf,"/etc", 32);
1202 s = dirname(buf);
1203 if (!s || strncmp(s, "/", 32) != 0) {
1204 exit(1);
1205 } else {
1206 exit(0);
1207 }
1208}
Darren Tucker314d89e2005-10-17 23:29:23 +10001209 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001210 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001211 [ ac_cv_have_broken_dirname="yes" ],
1212 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001213 )
1214 LIBS="$save_LIBS"
1215 ])
1216 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1217 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001218 AC_DEFINE([HAVE_DIRNAME])
1219 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001220 fi
1221 ])
1222])
1223
Tim Rice648f8762011-01-26 12:38:57 -08001224AC_CHECK_FUNC([getspnam], ,
1225 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1226AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1227 [Define if you have the basename function.])])
Damien Miller150c8b52002-02-13 23:06:56 +11001228
Tim Rice13aae5e2001-10-21 17:53:58 -07001229dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001230AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001231 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001232 [ if test "x$withval" = "xno" ; then
1233 AC_MSG_ERROR([*** zlib is required ***])
1234 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001235 if test -d "$withval/lib"; then
1236 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001237 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001238 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001239 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001240 fi
1241 else
1242 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001243 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001244 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001245 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001246 fi
1247 fi
1248 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001249 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001250 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001251 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001252 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001253 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001254)
1255
Tim Rice648f8762011-01-26 12:38:57 -08001256AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1257AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001258 [
1259 saved_CPPFLAGS="$CPPFLAGS"
1260 saved_LDFLAGS="$LDFLAGS"
1261 save_LIBS="$LIBS"
1262 dnl Check default zlib install dir
1263 if test -n "${need_dash_r}"; then
1264 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1265 else
1266 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1267 fi
1268 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1269 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001270 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001271 [
1272 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1273 ]
1274 )
1275 ]
1276)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001277
Tim Rice648f8762011-01-26 12:38:57 -08001278AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001279 [ --without-zlib-version-check Disable zlib version check],
1280 [ if test "x$withval" = "xno" ; then
1281 zlib_check_nonfatal=1
1282 fi
1283 ]
1284)
1285
Tim Rice648f8762011-01-26 12:38:57 -08001286AC_MSG_CHECKING([for possibly buggy zlib])
1287AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001288#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001289#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001290#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001291 ]],
1292 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001293 int a=0, b=0, c=0, d=0, n, v;
1294 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1295 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001296 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001297 v = a*1000000 + b*10000 + c*100 + d;
1298 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1299
1300 /* 1.1.4 is OK */
1301 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001302 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001303
Darren Tucker41097ed2005-07-25 15:24:21 +10001304 /* 1.2.3 and up are OK */
1305 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001306 exit(0);
1307
Darren Tucker2dcd2392004-01-23 17:13:33 +11001308 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001309 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001310 AC_MSG_RESULT([no]),
1311 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001312 if test -z "$zlib_check_nonfatal" ; then
1313 AC_MSG_ERROR([*** zlib too old - check config.log ***
1314Your reported zlib version has known security problems. It's possible your
1315vendor has fixed these problems without changing the version number. If you
1316are sure this is the case, you can disable the check by running
1317"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001318If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001319See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001320 else
1321 AC_MSG_WARN([zlib version may have security problems])
1322 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001323 ],
1324 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001325)
Damien Miller6f9c3372000-10-25 10:06:04 +11001326
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001327dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001328AC_CHECK_FUNC([strcasecmp],
1329 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001330)
Tim Rice648f8762011-01-26 12:38:57 -08001331AC_CHECK_FUNCS([utimes],
1332 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001333 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001334)
Tim Ricee589a292001-11-03 11:09:32 -08001335
1336dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001337AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001338AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001339AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001340AC_SEARCH_LIBS([login], [util bsd])
1341AC_SEARCH_LIBS([logout], [util bsd])
1342AC_SEARCH_LIBS([logwtmp], [util bsd])
1343AC_SEARCH_LIBS([openpty], [util bsd])
1344AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001345AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Damien Millerab18c411999-11-11 10:40:23 +11001346
Darren Tucker2fee9092016-02-17 09:48:15 +11001347# On some platforms, inet_ntop and gethostbyname may be found in libresolv
1348# or libnsl.
Damien Millerab039492014-01-28 15:07:10 +11001349AC_SEARCH_LIBS([inet_ntop], [resolv nsl])
Darren Tucker2fee9092016-02-17 09:48:15 +11001350AC_SEARCH_LIBS([gethostbyname], [resolv nsl])
Damien Millerab039492014-01-28 15:07:10 +11001351
Ben Lindstrom8697e082001-02-24 21:41:10 +00001352AC_FUNC_STRFTIME
1353
Damien Miller3c027682001-03-14 11:39:45 +11001354# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001355AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1356AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001357 [
1358 #include <glob.h>
1359 #ifdef GLOB_ALTDIRFUNC
1360 FOUNDIT
1361 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001362 ],
Damien Miller3c027682001-03-14 11:39:45 +11001363 [
Tim Rice648f8762011-01-26 12:38:57 -08001364 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001365 [Define if your system glob() function has
1366 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001367 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001368 ],
1369 [
Tim Rice648f8762011-01-26 12:38:57 -08001370 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001371 ]
1372)
Damien Millerc547bf12001-02-16 10:18:12 +11001373
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001374# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001375AC_MSG_CHECKING([for gl_matchc field in glob_t])
1376AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1377 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001378 [
Tim Rice648f8762011-01-26 12:38:57 -08001379 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001380 [Define if your system glob() function has
1381 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001382 AC_MSG_RESULT([yes])
1383 ], [
1384 AC_MSG_RESULT([no])
1385])
Damien Millerc547bf12001-02-16 10:18:12 +11001386
Damien Millera6e121a2010-10-07 21:39:17 +11001387# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001388AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1389AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001390#ifndef GLOB_KEEPSTAT
1391#error "glob does not support GLOB_KEEPSTAT extension"
1392#endif
1393glob_t g;
1394g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001395]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001396 [
Tim Rice648f8762011-01-26 12:38:57 -08001397 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001398 [Define if your system glob() function has
1399 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001400 AC_MSG_RESULT([yes])
1401 ], [
1402 AC_MSG_RESULT([no])
Damien Miller72ef7c12015-01-15 02:21:31 +11001403
Tim Rice648f8762011-01-26 12:38:57 -08001404])
Damien Millera6e121a2010-10-07 21:39:17 +11001405
Tim Rice648f8762011-01-26 12:38:57 -08001406AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001407
Darren Tucker7df91b02016-07-14 12:25:24 +10001408AC_CHECK_DECL([VIS_ALL], ,
1409 AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>])
1410
Damien Miller18bb4732001-03-28 14:35:30 +10001411AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001412AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001413 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001414#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001415#include <dirent.h>]],
1416 [[
1417 struct dirent d;
1418 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001419 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001420 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001421 [
Tim Rice648f8762011-01-26 12:38:57 -08001422 AC_MSG_RESULT([no])
1423 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001424 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001425 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001426 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001427 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001428 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001429 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001430 ]
1431)
Darren Tucker538738d2009-10-07 18:56:10 +11001432
Damien Miller36f49652004-08-15 18:40:59 +10001433AC_MSG_CHECKING([for /proc/pid/fd directory])
1434if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001435 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1436 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001437else
Tim Rice648f8762011-01-26 12:38:57 -08001438 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001439fi
1440
Damien Millerc547bf12001-02-16 10:18:12 +11001441# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001442SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001443AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001444 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001445 [
1446 if test "x$withval" != "xno" ; then
1447
1448 if test "x$withval" != "xyes" ; then
1449 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1450 LDFLAGS="$LDFLAGS -L${withval}/lib"
1451 fi
1452
Tim Rice648f8762011-01-26 12:38:57 -08001453 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001454 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001455 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001456
Tim Rice4cec93f2002-02-26 08:40:48 -08001457 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001458 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001459 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001460#include <stdio.h>
1461#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001462 ]], [[
1463 char *ff = skey_keyinfo(""); ff="";
1464 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001465 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001466 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001467 [
Tim Rice648f8762011-01-26 12:38:57 -08001468 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001469 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1470 ])
Tim Ricee1d93702016-05-31 11:13:22 -07001471 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
Tim Rice648f8762011-01-26 12:38:57 -08001472 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1473#include <stdio.h>
1474#include <skey.h>
1475 ]], [[
1476 (void)skeychallenge(NULL,"name","",0);
1477 ]])],
1478 [
1479 AC_MSG_RESULT([yes])
1480 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001481 [Define if your skeychallenge()
1482 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001483 [
1484 AC_MSG_RESULT([no])
1485 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001486 fi
1487 ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001488)
1489
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001490# Check whether user wants to use ldns
1491LDNS_MSG="no"
1492AC_ARG_WITH(ldns,
1493 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1494 [
1495 if test "x$withval" != "xno" ; then
1496
1497 if test "x$withval" != "xyes" ; then
1498 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1499 LDFLAGS="$LDFLAGS -L${withval}/lib"
1500 fi
1501
1502 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1503 LIBS="-lldns $LIBS"
1504 LDNS_MSG="yes"
1505
1506 AC_MSG_CHECKING([for ldns support])
1507 AC_LINK_IFELSE(
1508 [AC_LANG_SOURCE([[
1509#include <stdio.h>
1510#include <stdlib.h>
1511#include <stdint.h>
1512#include <ldns/ldns.h>
1513int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1514 ]])
1515 ],
1516 [AC_MSG_RESULT(yes)],
1517 [
1518 AC_MSG_RESULT(no)
1519 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1520 ])
1521 fi
1522 ]
1523)
1524
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001525# Check whether user wants libedit support
1526LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001527AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001528 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001529 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001530 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001531 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001532 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001533 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Tim Ricee1d93702016-05-31 11:13:22 -07001534 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001535 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001536 use_pkgconfig_for_libedit=yes
1537 else
Tim Rice648f8762011-01-26 12:38:57 -08001538 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001539 fi
1540 fi
1541 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001542 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1543 if test -n "${need_dash_r}"; then
1544 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1545 else
1546 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1547 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001548 fi
Damien Miller1f789802010-10-11 22:35:22 +11001549 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001550 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001551 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1552 else
1553 LIBEDIT="-ledit -lcurses"
1554 fi
1555 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001556 AC_CHECK_LIB([edit], [el_init],
1557 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001558 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001559 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001560 ],
Tim Rice648f8762011-01-26 12:38:57 -08001561 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001562 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001563 )
Tim Rice648f8762011-01-26 12:38:57 -08001564 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001565 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001566 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1567 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001568 int i = H_SETSIZE;
1569 el_init("", NULL, NULL, NULL);
1570 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001571 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001572 [ AC_MSG_RESULT([yes]) ],
1573 [ AC_MSG_RESULT([no])
1574 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001575 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001576 fi ]
Darren Tuckerd9f88912005-02-20 21:01:48 +11001577)
1578
1579AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001580AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001581 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001582 [
Tim Rice648f8762011-01-26 12:38:57 -08001583 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001584 case "$withval" in
1585 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001586 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001587 AUDIT_MODULE=bsm
1588 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001589 AC_CHECK_HEADERS([bsm/audit.h], [],
1590 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001591 [
1592#ifdef HAVE_TIME_H
1593# include <time.h>
1594#endif
1595 ]
1596)
Tim Rice648f8762011-01-26 12:38:57 -08001597 AC_CHECK_LIB([bsm], [getaudit], [],
1598 [AC_MSG_ERROR([BSM enabled and required library not found])])
1599 AC_CHECK_FUNCS([getaudit], [],
1600 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001601 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001602 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1603 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001604 if test "$sol2ver" -ge 11; then
Tim Ricee1d93702016-05-31 11:13:22 -07001605 SSHDLIBS="$SSHDLIBS -lscf"
1606 AC_DEFINE([BROKEN_BSM_API], [1],
1607 [The system has incomplete BSM API])
Darren Tucker93a2d412012-02-24 10:40:41 +11001608 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001609 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001610 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001611 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001612 AUDIT_MODULE=linux
1613 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001614 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001615 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001616 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001617 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001618 debug)
1619 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001620 AC_MSG_RESULT([debug])
1621 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001622 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001623 no)
Tim Rice648f8762011-01-26 12:38:57 -08001624 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001625 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001626 *)
1627 AC_MSG_ERROR([Unknown audit module $withval])
1628 ;;
1629 esac ]
Damien Millerc547bf12001-02-16 10:18:12 +11001630)
Damien Miller7f6ea021999-10-28 13:25:17 +10001631
Darren Tucker096118d2014-01-21 12:48:51 +11001632AC_ARG_WITH([pie],
Damien Miller76c04802015-01-13 19:38:18 +11001633 [ --with-pie Build Position Independent Executables if possible], [
Darren Tucker096118d2014-01-21 12:48:51 +11001634 if test "x$withval" = "xno"; then
Damien Miller852472a2014-01-22 16:31:18 +11001635 use_pie=no
Darren Tucker096118d2014-01-21 12:48:51 +11001636 fi
1637 if test "x$withval" = "xyes"; then
Damien Miller852472a2014-01-22 16:31:18 +11001638 use_pie=yes
Darren Tucker096118d2014-01-21 12:48:51 +11001639 fi
1640 ]
1641)
Damien Miller852472a2014-01-22 16:31:18 +11001642if test "x$use_pie" = "x"; then
1643 use_pie=no
1644fi
1645if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then
1646 # Turn off automatic PIE when toolchain hardening is off.
1647 use_pie=no
1648fi
Damien Millerc161fc92014-01-29 21:01:33 +11001649if test "x$use_pie" = "xauto"; then
Damien Miller852472a2014-01-22 16:31:18 +11001650 # Automatic PIE requires gcc >= 4.x
1651 AC_MSG_CHECKING([for gcc >= 4.x])
1652 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
1653#if !defined(__GNUC__) || __GNUC__ < 4
1654#error gcc is too old
1655#endif
1656]])],
1657 [ AC_MSG_RESULT([yes]) ],
1658 [ AC_MSG_RESULT([no])
1659 use_pie=no ]
1660)
1661fi
1662if test "x$use_pie" != "xno"; then
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001663 SAVED_CFLAGS="$CFLAGS"
1664 SAVED_LDFLAGS="$LDFLAGS"
Darren Tucker096118d2014-01-21 12:48:51 +11001665 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
1666 OSSH_CHECK_LDFLAG_LINK([-pie])
Damien Miller5c2ff5e2014-01-22 21:30:12 +11001667 # We use both -fPIE and -pie or neither.
1668 AC_MSG_CHECKING([whether both -fPIE and -pie are supported])
1669 if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \
1670 echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then
1671 AC_MSG_RESULT([yes])
1672 else
1673 AC_MSG_RESULT([no])
1674 CFLAGS="$SAVED_CFLAGS"
1675 LDFLAGS="$SAVED_LDFLAGS"
1676 fi
Darren Tucker096118d2014-01-21 12:48:51 +11001677fi
1678
Damien Millerfe1f1432003-02-24 15:45:42 +11001679dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001680AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001681 Blowfish_initstate \
1682 Blowfish_expandstate \
1683 Blowfish_expand0state \
1684 Blowfish_stream2word \
Damien Miller57f39152005-11-24 19:58:19 +11001685 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001686 b64_ntop \
1687 __b64_ntop \
1688 b64_pton \
1689 __b64_pton \
1690 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001691 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001692 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001693 blf_enc \
Damien Millerc96d8532014-01-25 13:12:28 +11001694 cap_rights_limit \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001695 clock \
1696 closefrom \
1697 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001698 endgrent \
Darren Tucker6310ef22016-07-13 14:42:35 +10001699 err \
1700 errx \
Damien Miller1d2c4562014-02-04 11:18:20 +11001701 explicit_bzero \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001702 fchmod \
1703 fchown \
1704 freeaddrinfo \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001705 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001706 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001707 futimes \
1708 getaddrinfo \
1709 getcwd \
1710 getgrouplist \
1711 getnameinfo \
1712 getopt \
1713 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001714 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001715 getpgid \
1716 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001717 _getpty \
1718 getrlimit \
1719 getttyent \
1720 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001721 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001722 inet_aton \
1723 inet_ntoa \
1724 inet_ntop \
1725 innetgr \
1726 login_getcapbool \
1727 md5_crypt \
1728 memmove \
Damien Miller3d673d12014-08-27 06:32:01 +10001729 memset_s \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001730 mkdtemp \
1731 mmap \
1732 ngetaddrinfo \
1733 nsleep \
1734 ogetaddrinfo \
1735 openlog_r \
Darren Tucker3ddd15e2015-11-30 07:23:53 +11001736 pledge \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001737 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001738 prctl \
1739 pstat \
1740 readpassphrase \
Darren Tucker642652d2014-12-10 01:32:23 +11001741 reallocarray \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001742 recvmsg \
1743 rresvport_af \
1744 sendmsg \
1745 setdtablesize \
1746 setegid \
1747 setenv \
1748 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001749 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001750 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001751 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001752 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001753 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001754 setpcred \
1755 setproctitle \
1756 setregid \
1757 setreuid \
1758 setrlimit \
1759 setsid \
1760 setvbuf \
1761 sigaction \
1762 sigvec \
1763 snprintf \
1764 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001765 statfs \
1766 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001767 strdup \
1768 strerror \
1769 strlcat \
1770 strlcpy \
1771 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001772 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001773 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001774 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001775 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001776 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001777 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001778 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001779 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001780 sysconf \
1781 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001782 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001783 truncate \
1784 unsetenv \
1785 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001786 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001787 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001788 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001789 vsnprintf \
1790 waitpid \
Darren Tucker6310ef22016-07-13 14:42:35 +10001791 warn \
Tim Rice648f8762011-01-26 12:38:57 -08001792])
Damien Millerb3c9f782010-02-12 10:11:34 +11001793
Darren Tuckera2333582016-07-14 10:59:09 +10001794dnl Wide character support. Linux man page says it needs _XOPEN_SOURCE.
1795saved_CFLAGS="$CFLAGS"
1796CFLAGS="$CFLAGS -D_XOPEN_SOURCE"
1797AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth])
1798CFLAGS="$saved_CFLAGS"
1799
Tim Ricec7a8af02010-11-08 14:26:23 -08001800AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001801 [AC_LANG_PROGRAM(
1802 [[ #include <ctype.h> ]],
1803 [[ return (isblank('a')); ]])],
1804 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001805])
1806
Damien Miller72ef7c12015-01-15 02:21:31 +11001807# PKCS11 depends on OpenSSL.
1808if test "x$openssl" = "xyes" ; then
1809 # PKCS#11 support requires dlopen() and co
1810 AC_SEARCH_LIBS([dlopen], [dl],
1811 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
1812 )
1813fi
Ben Lindstrom6b0c96a2002-06-25 03:22:03 +00001814
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001815# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001816AC_CHECK_FUNCS([gai_strerror], [
1817 AC_DEFINE([HAVE_GAI_STRERROR])
1818 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001819#include <sys/types.h>
1820#include <sys/socket.h>
1821#include <netdb.h>
1822
Tim Rice648f8762011-01-26 12:38:57 -08001823const char *gai_strerror(int);
1824 ]], [[
1825 char *str;
1826 str = gai_strerror(0);
1827 ]])], [
1828 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1829 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001830
Tim Rice648f8762011-01-26 12:38:57 -08001831AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1832 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001833
Darren Tuckera7108912013-06-02 08:18:31 +10001834AC_SEARCH_LIBS([clock_gettime], [rt],
1835 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1836
Darren Tuckerf1159b52003-07-07 19:44:01 +10001837dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001838AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1839AC_CHECK_DECL([strsep],
1840 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001841 [],
1842 [
1843#ifdef HAVE_STRING_H
1844# include <string.h>
1845#endif
1846 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001847
Darren Tuckerb2427c82003-09-10 15:22:44 +10001848dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001849AC_CHECK_DECL([tcsendbreak],
1850 [AC_DEFINE([HAVE_TCSENDBREAK])],
1851 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001852 [#include <termios.h>]
1853)
Darren Tuckerc82afd52003-09-11 14:42:55 +10001854
Tim Rice648f8762011-01-26 12:38:57 -08001855AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001856
Tim Rice648f8762011-01-26 12:38:57 -08001857AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001858 [
1859#include <sys/types.h>
1860#include <sys/socket.h>
1861 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001862
Tim Rice648f8762011-01-26 12:38:57 -08001863AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001864 [
1865#include <sys/types.h>
1866#ifdef HAVE_SYS_STAT_H
1867# include <sys/stat.h>
1868#endif
1869#ifdef HAVE_FCNTL_H
1870# include <fcntl.h>
1871#endif
1872 ])
1873
Tim Rice648f8762011-01-26 12:38:57 -08001874AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001875#include <sys/types.h>
1876#include <sys/uio.h>
1877#include <unistd.h>
1878 ])
1879
Tim Rice648f8762011-01-26 12:38:57 -08001880AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001881#include <sys/param.h>
1882 ])
1883
Tim Rice648f8762011-01-26 12:38:57 -08001884AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001885#include <stddef.h>
1886 ])
1887
Darren Tuckerc7aad002013-06-02 07:18:47 +10001888# extra bits for select(2)
1889AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1890#include <sys/param.h>
1891#include <sys/types.h>
1892#ifdef HAVE_SYS_SYSMACROS_H
1893#include <sys/sysmacros.h>
1894#endif
1895#ifdef HAVE_SYS_SELECT_H
1896#include <sys/select.h>
1897#endif
1898#ifdef HAVE_SYS_TIME_H
1899#include <sys/time.h>
1900#endif
1901#ifdef HAVE_UNISTD_H
1902#include <unistd.h>
1903#endif
1904 ]])
1905AC_CHECK_TYPES([fd_mask], [], [], [[
1906#include <sys/param.h>
1907#include <sys/types.h>
1908#ifdef HAVE_SYS_SELECT_H
1909#include <sys/select.h>
1910#endif
1911#ifdef HAVE_SYS_TIME_H
1912#include <sys/time.h>
1913#endif
1914#ifdef HAVE_UNISTD_H
1915#include <unistd.h>
1916#endif
1917 ]])
1918
Tim Rice648f8762011-01-26 12:38:57 -08001919AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001920 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001921 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001922 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001923 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001924#include <stdlib.h>
1925#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001926 ]], [[
1927 errno=0;
1928 setresuid(0,0,0);
1929 if (errno==ENOSYS)
1930 exit(1);
1931 else
1932 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001933 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001934 [AC_MSG_RESULT([yes])],
1935 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001936 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001937 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001938 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001939 )
1940])
Darren Tuckere937be32003-12-17 18:53:26 +11001941
Tim Rice648f8762011-01-26 12:38:57 -08001942AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001943 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001944 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001945 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001946 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001947#include <stdlib.h>
1948#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001949 ]], [[
1950 errno=0;
1951 setresgid(0,0,0);
1952 if (errno==ENOSYS)
1953 exit(1);
1954 else
1955 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001956 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001957 [AC_MSG_RESULT([yes])],
1958 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001959 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001960 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001961 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001962 )
1963])
Darren Tuckere937be32003-12-17 18:53:26 +11001964
Darren Tuckerd3e2aee2015-07-17 12:52:34 +10001965AC_CHECK_FUNCS([realpath], [
1966 dnl the sftp v3 spec says SSH_FXP_REALPATH will "canonicalize any given
1967 dnl path name", however some implementations of realpath (and some
1968 dnl versions of the POSIX spec) do not work on non-existent files,
1969 dnl so we use the OpenBSD implementation on those platforms.
1970 AC_MSG_CHECKING([if realpath works with non-existent files])
1971 AC_RUN_IFELSE(
1972 [AC_LANG_PROGRAM([[
1973#include <limits.h>
1974#include <stdlib.h>
1975#include <errno.h>
1976 ]], [[
1977 char buf[PATH_MAX];
1978 if (realpath("/opensshnonexistentfilename1234", buf) == NULL)
1979 if (errno == ENOENT)
1980 exit(1);
1981 exit(0);
1982 ]])],
1983 [AC_MSG_RESULT([yes])],
1984 [AC_DEFINE([BROKEN_REALPATH], [1],
1985 [realpath does not work with nonexistent files])
1986 AC_MSG_RESULT([no])],
1987 [AC_MSG_WARN([cross compiling: assuming working])]
1988 )
1989])
1990
Damien Millerad833b32000-08-23 10:46:23 +10001991dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001992AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001993dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001994AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1995AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001996dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001997AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1998AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001999dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08002000AC_CHECK_FUNCS([getlastlogxbyname])
Damien Miller04f80141999-11-19 15:32:34 +11002001
Tim Rice648f8762011-01-26 12:38:57 -08002002AC_CHECK_FUNC([daemon],
2003 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
2004 [AC_CHECK_LIB([bsd], [daemon],
2005 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11002006)
2007
Tim Rice648f8762011-01-26 12:38:57 -08002008AC_CHECK_FUNC([getpagesize],
2009 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002010 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08002011 [AC_CHECK_LIB([ucb], [getpagesize],
2012 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11002013)
2014
Damien Millercb170cb2000-07-01 16:52:55 +10002015# Check for broken snprintf
2016if test "x$ac_cv_func_snprintf" = "xyes" ; then
2017 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002018 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002019 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
2020 [[
2021 char b[5];
2022 snprintf(b,5,"123456789");
Tim Ricee1d93702016-05-31 11:13:22 -07002023 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10002024 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08002025 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10002026 [
Tim Rice648f8762011-01-26 12:38:57 -08002027 AC_MSG_RESULT([no])
2028 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002029 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10002030 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002031 ],
2032 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Miller57f39152005-11-24 19:58:19 +11002033 )
2034fi
2035
Damien Millerd244a582014-08-23 17:06:49 +10002036# We depend on vsnprintf returning the right thing on overflow: the
2037# number of characters it tried to create (as per SUSv3)
2038if test "x$ac_cv_func_vsnprintf" = "xyes" ; then
Damien Miller57f39152005-11-24 19:58:19 +11002039 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
2040 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002041 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11002042#include <sys/types.h>
2043#include <stdio.h>
2044#include <stdarg.h>
2045
Damien Millerd244a582014-08-23 17:06:49 +10002046int x_snprintf(char *str, size_t count, const char *fmt, ...)
Damien Miller57f39152005-11-24 19:58:19 +11002047{
Damien Millerd244a582014-08-23 17:06:49 +10002048 size_t ret;
2049 va_list ap;
2050
2051 va_start(ap, fmt);
2052 ret = vsnprintf(str, count, fmt, ap);
2053 va_end(ap);
Damien Miller57f39152005-11-24 19:58:19 +11002054 return ret;
2055}
Tim Rice648f8762011-01-26 12:38:57 -08002056 ]], [[
Damien Millerd244a582014-08-23 17:06:49 +10002057char x[1];
2058if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11)
2059 return 1;
2060if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11)
2061 return 1;
2062return 0;
Tim Rice648f8762011-01-26 12:38:57 -08002063 ]])],
2064 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11002065 [
Tim Rice648f8762011-01-26 12:38:57 -08002066 AC_MSG_RESULT([no])
2067 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11002068 [Define if your snprintf is busted])
2069 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
2070 ],
2071 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10002072 )
Damien Millerb4097182004-05-23 14:09:40 +10002073fi
2074
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002075# On systems where [v]snprintf is broken, but is declared in stdio,
2076# check that the fmt argument is const char * or just char *.
2077# This is only useful for when BROKEN_SNPRINTF
2078AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08002079AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2080#include <stdio.h>
2081int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
2082 ]], [[
2083 snprintf(0, 0, 0);
2084 ]])],
2085 [AC_MSG_RESULT([yes])
2086 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002087 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08002088 [AC_MSG_RESULT([no])
2089 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11002090
Damien Millerb4097182004-05-23 14:09:40 +10002091# Check for missing getpeereid (or equiv) support
2092NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11002093if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10002094 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08002095 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2096#include <sys/types.h>
2097#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
2098 [ AC_MSG_RESULT([yes])
2099 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
2100 ], [AC_MSG_RESULT([no])
2101 NO_PEERCHECK=1
2102 ])
Damien Millercb170cb2000-07-01 16:52:55 +10002103fi
Darren Tucker1f5e3dc2010-01-08 19:53:52 +11002104
Damien Millere8328192003-01-07 15:18:32 +11002105dnl see whether mkstemp() requires XXXXXX
2106if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
2107AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10002108AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002109 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11002110#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08002111 ]], [[
2112 char template[]="conftest.mkstemp-test";
2113 if (mkstemp(template) == -1)
2114 exit(1);
2115 unlink(template);
2116 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002117 ]])],
Damien Millere8328192003-01-07 15:18:32 +11002118 [
Tim Rice648f8762011-01-26 12:38:57 -08002119 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11002120 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11002121 [
Tim Rice648f8762011-01-26 12:38:57 -08002122 AC_MSG_RESULT([yes])
2123 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11002124 ],
2125 [
Tim Rice648f8762011-01-26 12:38:57 -08002126 AC_MSG_RESULT([yes])
2127 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11002128 ]
Damien Millere8328192003-01-07 15:18:32 +11002129)
2130fi
2131
Darren Tucker70a3d552003-08-21 17:58:29 +10002132dnl make sure that openpty does not reacquire controlling terminal
2133if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08002134 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10002135 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002136 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10002137#include <stdio.h>
2138#include <sys/fcntl.h>
2139#include <sys/types.h>
2140#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08002141 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10002142 pid_t pid;
2143 int fd, ptyfd, ttyfd, status;
2144
2145 pid = fork();
2146 if (pid < 0) { /* failed */
2147 exit(1);
2148 } else if (pid > 0) { /* parent */
2149 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11002150 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10002151 exit(WEXITSTATUS(status));
2152 else
2153 exit(2);
2154 } else { /* child */
2155 close(0); close(1); close(2);
2156 setsid();
2157 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2158 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2159 if (fd >= 0)
2160 exit(3); /* Acquired ctty: broken */
2161 else
2162 exit(0); /* Did not acquire ctty: OK */
2163 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002164 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002165 [
Tim Rice648f8762011-01-26 12:38:57 -08002166 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002167 ],
2168 [
Tim Rice648f8762011-01-26 12:38:57 -08002169 AC_MSG_RESULT([no])
2170 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002171 ],
2172 [
Tim Rice648f8762011-01-26 12:38:57 -08002173 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002174 ]
2175 )
2176fi
Darren Tucker4398cf52004-04-06 21:39:02 +10002177
Tim Rice8bb561b2005-03-17 16:23:19 -08002178if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2179 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002180 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002181 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002182 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002183#include <stdio.h>
2184#include <sys/socket.h>
2185#include <netdb.h>
2186#include <errno.h>
2187#include <netinet/in.h>
2188
2189#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002190 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002191 int err, sock;
2192 struct addrinfo *gai_ai, *ai, hints;
2193 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2194
2195 memset(&hints, 0, sizeof(hints));
2196 hints.ai_family = PF_UNSPEC;
2197 hints.ai_socktype = SOCK_STREAM;
2198 hints.ai_flags = AI_PASSIVE;
2199
2200 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2201 if (err != 0) {
2202 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2203 exit(1);
2204 }
2205
2206 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2207 if (ai->ai_family != AF_INET6)
2208 continue;
2209
2210 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2211 sizeof(ntop), strport, sizeof(strport),
2212 NI_NUMERICHOST|NI_NUMERICSERV);
2213
2214 if (err != 0) {
2215 if (err == EAI_SYSTEM)
2216 perror("getnameinfo EAI_SYSTEM");
2217 else
2218 fprintf(stderr, "getnameinfo failed: %s\n",
2219 gai_strerror(err));
2220 exit(2);
2221 }
2222
2223 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2224 if (sock < 0)
2225 perror("socket");
2226 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2227 if (errno == EBADF)
2228 exit(3);
2229 }
2230 }
2231 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002232 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002233 [
Tim Rice648f8762011-01-26 12:38:57 -08002234 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002235 ],
2236 [
Tim Rice648f8762011-01-26 12:38:57 -08002237 AC_MSG_RESULT([no])
2238 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002239 ],
2240 [
Tim Rice648f8762011-01-26 12:38:57 -08002241 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002242 ]
2243 )
2244fi
2245
Tim Rice8bb561b2005-03-17 16:23:19 -08002246if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2247 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002248 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002249 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002250 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002251#include <stdio.h>
2252#include <sys/socket.h>
2253#include <netdb.h>
2254#include <errno.h>
2255#include <netinet/in.h>
2256
2257#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002258 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002259 int err, sock;
2260 struct addrinfo *gai_ai, *ai, hints;
2261 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2262
2263 memset(&hints, 0, sizeof(hints));
2264 hints.ai_family = PF_UNSPEC;
2265 hints.ai_socktype = SOCK_STREAM;
2266 hints.ai_flags = AI_PASSIVE;
2267
2268 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2269 if (err != 0) {
2270 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2271 exit(1);
2272 }
2273
2274 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2275 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2276 continue;
2277
2278 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2279 sizeof(ntop), strport, sizeof(strport),
2280 NI_NUMERICHOST|NI_NUMERICSERV);
2281
2282 if (ai->ai_family == AF_INET && err != 0) {
2283 perror("getnameinfo");
2284 exit(2);
2285 }
2286 }
2287 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002288 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002289 [
Tim Rice648f8762011-01-26 12:38:57 -08002290 AC_MSG_RESULT([yes])
2291 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002292 [Define if you have a getaddrinfo that fails
2293 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002294 ],
2295 [
Tim Rice648f8762011-01-26 12:38:57 -08002296 AC_MSG_RESULT([no])
2297 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002298 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002299 [
Tim Rice648f8762011-01-26 12:38:57 -08002300 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002301 ]
2302 )
2303fi
2304
Darren Tuckere50e8c92015-02-21 15:10:33 +11002305if test "x$ac_cv_func_getaddrinfo" = "xyes"; then
2306 AC_CHECK_DECLS(AI_NUMERICSERV, , ,
2307 [#include <sys/types.h>
2308 #include <sys/socket.h>
2309 #include <netdb.h>])
2310fi
2311
Darren Tuckera56f1912004-11-02 20:30:54 +11002312if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002313 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2314 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2315 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002316 [
Tim Rice648f8762011-01-26 12:38:57 -08002317 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002318 ],
2319 [
Tim Rice648f8762011-01-26 12:38:57 -08002320 AC_MSG_RESULT([yes])
2321 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002322 [Conflicting defs for getspnam])
2323 ]
2324 )
2325fi
2326
Damien Miller606f8802000-09-16 15:39:56 +11002327AC_FUNC_GETPGRP
Ben Lindstromec3830a2001-01-25 00:07:33 +00002328
Tim Riceaef73712002-05-11 13:17:42 -07002329# Search for OpenSSL
2330saved_CPPFLAGS="$CPPFLAGS"
2331saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002332AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002333 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2334 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002335 if test "x$openssl" = "xno" ; then
2336 AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled])
2337 fi
Ben Lindstrom23e13712000-10-29 22:49:19 +00002338 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002339 case "$withval" in
2340 # Relative paths
2341 ./*|../*) withval="`pwd`/$withval"
2342 esac
Tim Riceaef73712002-05-11 13:17:42 -07002343 if test -d "$withval/lib"; then
2344 if test -n "${need_dash_r}"; then
2345 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2346 else
2347 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2348 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002349 elif test -d "$withval/lib64"; then
2350 if test -n "${need_dash_r}"; then
2351 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2352 else
2353 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2354 fi
Tim Riceaef73712002-05-11 13:17:42 -07002355 else
2356 if test -n "${need_dash_r}"; then
2357 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2358 else
2359 LDFLAGS="-L${withval} ${LDFLAGS}"
2360 fi
2361 fi
2362 if test -d "$withval/include"; then
2363 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2364 else
2365 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2366 fi
Damien Millera22ba012000-03-02 23:09:20 +11002367 fi
2368 ]
2369)
Damien Millerb9c56672014-05-15 14:43:37 +10002370
Tim Rice648f8762011-01-26 12:38:57 -08002371AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002372 [ --without-openssl-header-check Disable OpenSSL version consistency check],
Damien Millerec932372002-01-22 22:16:03 +11002373 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002374 if test "x$withval" = "xno" ; then
2375 openssl_check_nonfatal=1
Damien Miller9975e482007-03-05 11:51:27 +11002376 fi
Damien Millerec932372002-01-22 22:16:03 +11002377 ]
2378)
2379
Damien Miller72ef7c12015-01-15 02:21:31 +11002380openssl_engine=no
Tim Rice648f8762011-01-26 12:38:57 -08002381AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002382 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
Damien Miller72ef7c12015-01-15 02:21:31 +11002383 [
Damien Miller72ef7c12015-01-15 02:21:31 +11002384 if test "x$withval" != "xno" ; then
Darren Tuckerb5fa0cd2015-12-15 15:10:32 +11002385 if test "x$openssl" = "xno" ; then
2386 AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled])
2387 fi
Damien Miller72ef7c12015-01-15 02:21:31 +11002388 openssl_engine=yes
2389 fi
2390 ]
2391)
2392
2393if test "x$openssl" = "xyes" ; then
2394 LIBS="-lcrypto $LIBS"
2395 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
2396 [Define if your ssl headers are included
2397 with #include <openssl/header.h>])],
2398 [
2399 dnl Check default openssl install dir
2400 if test -n "${need_dash_r}"; then
2401 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2402 else
2403 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2404 fi
2405 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2406 AC_CHECK_HEADER([openssl/opensslv.h], ,
2407 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2408 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
2409 [
2410 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2411 ]
2412 )
2413 ]
2414 )
2415
2416 # Determine OpenSSL header version
2417 AC_MSG_CHECKING([OpenSSL header version])
2418 AC_RUN_IFELSE(
2419 [AC_LANG_PROGRAM([[
Darren Tucker15605962015-11-10 11:14:47 +11002420 #include <stdlib.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002421 #include <stdio.h>
2422 #include <string.h>
2423 #include <openssl/opensslv.h>
2424 #define DATA "conftest.sslincver"
2425 ]], [[
2426 FILE *fd;
2427 int rc;
2428
2429 fd = fopen(DATA,"w");
2430 if(fd == NULL)
2431 exit(1);
2432
Darren Tuckerb3413532016-04-04 11:09:21 +10002433 if ((rc = fprintf(fd, "%08lx (%s)\n",
2434 (unsigned long)OPENSSL_VERSION_NUMBER,
2435 OPENSSL_VERSION_TEXT)) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002436 exit(1);
2437
2438 exit(0);
2439 ]])],
2440 [
2441 ssl_header_ver=`cat conftest.sslincver`
2442 AC_MSG_RESULT([$ssl_header_ver])
2443 ],
2444 [
2445 AC_MSG_RESULT([not found])
2446 AC_MSG_ERROR([OpenSSL version header not found.])
2447 ],
2448 [
2449 AC_MSG_WARN([cross compiling: not checking])
2450 ]
2451 )
2452
2453 # Determine OpenSSL library version
2454 AC_MSG_CHECKING([OpenSSL library version])
2455 AC_RUN_IFELSE(
2456 [AC_LANG_PROGRAM([[
2457 #include <stdio.h>
2458 #include <string.h>
2459 #include <openssl/opensslv.h>
2460 #include <openssl/crypto.h>
2461 #define DATA "conftest.ssllibver"
2462 ]], [[
2463 FILE *fd;
2464 int rc;
2465
2466 fd = fopen(DATA,"w");
2467 if(fd == NULL)
2468 exit(1);
2469
Darren Tucker815bcac2016-04-04 11:07:59 +10002470 if ((rc = fprintf(fd, "%08lx (%s)\n", (unsigned long)SSLeay(),
2471 SSLeay_version(SSLEAY_VERSION))) < 0)
Damien Miller72ef7c12015-01-15 02:21:31 +11002472 exit(1);
2473
2474 exit(0);
2475 ]])],
2476 [
2477 ssl_library_ver=`cat conftest.ssllibver`
2478 # Check version is supported.
2479 case "$ssl_library_ver" in
2480 0090[[0-7]]*|009080[[0-5]]*)
2481 AC_MSG_ERROR([OpenSSL >= 0.9.8f required (have "$ssl_library_ver")])
2482 ;;
2483 *) ;;
2484 esac
2485 AC_MSG_RESULT([$ssl_library_ver])
2486 ],
2487 [
2488 AC_MSG_RESULT([not found])
2489 AC_MSG_ERROR([OpenSSL library not found.])
2490 ],
2491 [
2492 AC_MSG_WARN([cross compiling: not checking])
2493 ]
2494 )
2495
2496 # Sanity check OpenSSL headers
2497 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2498 AC_RUN_IFELSE(
2499 [AC_LANG_PROGRAM([[
2500 #include <string.h>
2501 #include <openssl/opensslv.h>
Darren Tuckerc1d7e542015-12-15 14:27:09 +11002502 #include <openssl/crypto.h>
Damien Miller72ef7c12015-01-15 02:21:31 +11002503 ]], [[
2504 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
2505 ]])],
2506 [
2507 AC_MSG_RESULT([yes])
2508 ],
2509 [
2510 AC_MSG_RESULT([no])
2511 if test "x$openssl_check_nonfatal" = "x"; then
2512 AC_MSG_ERROR([Your OpenSSL headers do not match your
2513 library. Check config.log for details.
2514 If you are sure your installation is consistent, you can disable the check
2515 by running "./configure --without-openssl-header-check".
2516 Also see contrib/findssl.sh for help identifying header/library mismatches.
2517 ])
2518 else
2519 AC_MSG_WARN([Your OpenSSL headers do not match your
2520 library. Check config.log for details.
2521 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2522 fi
2523 ],
2524 [
2525 AC_MSG_WARN([cross compiling: not checking])
2526 ]
2527 )
2528
2529 AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2530 AC_LINK_IFELSE(
2531 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2532 [[ SSLeay_add_all_algorithms(); ]])],
2533 [
2534 AC_MSG_RESULT([yes])
2535 ],
2536 [
2537 AC_MSG_RESULT([no])
2538 saved_LIBS="$LIBS"
2539 LIBS="$LIBS -ldl"
2540 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2541 AC_LINK_IFELSE(
2542 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2543 [[ SSLeay_add_all_algorithms(); ]])],
2544 [
2545 AC_MSG_RESULT([yes])
2546 ],
2547 [
2548 AC_MSG_RESULT([no])
2549 LIBS="$saved_LIBS"
2550 ]
2551 )
2552 ]
2553 )
2554
2555 AC_CHECK_FUNCS([ \
2556 BN_is_prime_ex \
2557 DSA_generate_parameters_ex \
2558 EVP_DigestInit_ex \
2559 EVP_DigestFinal_ex \
2560 EVP_MD_CTX_init \
2561 EVP_MD_CTX_cleanup \
2562 EVP_MD_CTX_copy_ex \
2563 HMAC_CTX_init \
2564 RSA_generate_key_ex \
2565 RSA_get_default_method \
2566 ])
2567
2568 if test "x$openssl_engine" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002569 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2570 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002571 #include <openssl/engine.h>
Tim Rice648f8762011-01-26 12:38:57 -08002572 ]], [[
Damien Miller72ef7c12015-01-15 02:21:31 +11002573 ENGINE_load_builtin_engines();
2574 ENGINE_register_all_complete();
Tim Rice648f8762011-01-26 12:38:57 -08002575 ]])],
2576 [ AC_MSG_RESULT([yes])
2577 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002578 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002579 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2580 ])
Damien Miller72ef7c12015-01-15 02:21:31 +11002581 fi
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002582
Damien Miller72ef7c12015-01-15 02:21:31 +11002583 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2584 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2585 AC_LINK_IFELSE(
Darren Tucker37bcef52013-11-09 18:39:25 +11002586 [AC_LANG_PROGRAM([[
Damien Miller72ef7c12015-01-15 02:21:31 +11002587 #include <string.h>
2588 #include <openssl/evp.h>
2589 ]], [[
2590 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
2591 ]])],
2592 [
2593 AC_MSG_RESULT([no])
2594 ],
2595 [
2596 AC_MSG_RESULT([yes])
2597 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
2598 [libcrypto is missing AES 192 and 256 bit functions])
2599 ]
2600 )
2601
2602 # Check for OpenSSL with EVP_aes_*ctr
2603 AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2604 AC_LINK_IFELSE(
2605 [AC_LANG_PROGRAM([[
2606 #include <string.h>
2607 #include <openssl/evp.h>
2608 ]], [[
2609 exit(EVP_aes_128_ctr() == NULL ||
2610 EVP_aes_192_cbc() == NULL ||
2611 EVP_aes_256_cbc() == NULL);
2612 ]])],
2613 [
2614 AC_MSG_RESULT([yes])
2615 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2616 [libcrypto has EVP AES CTR])
2617 ],
2618 [
2619 AC_MSG_RESULT([no])
2620 ]
2621 )
2622
2623 # Check for OpenSSL with EVP_aes_*gcm
2624 AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2625 AC_LINK_IFELSE(
2626 [AC_LANG_PROGRAM([[
2627 #include <string.h>
2628 #include <openssl/evp.h>
2629 ]], [[
2630 exit(EVP_aes_128_gcm() == NULL ||
2631 EVP_aes_256_gcm() == NULL ||
2632 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2633 EVP_CTRL_GCM_IV_GEN == 0 ||
2634 EVP_CTRL_GCM_SET_TAG == 0 ||
2635 EVP_CTRL_GCM_GET_TAG == 0 ||
2636 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
2637 ]])],
2638 [
2639 AC_MSG_RESULT([yes])
2640 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2641 [libcrypto has EVP AES GCM])
2642 ],
2643 [
2644 AC_MSG_RESULT([no])
2645 unsupported_algorithms="$unsupported_cipers \
2646 aes128-gcm@openssh.com aes256-gcm@openssh.com"
2647 ]
2648 )
2649
2650 AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2651 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2652 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2653
2654 AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2655 AC_LINK_IFELSE(
2656 [AC_LANG_PROGRAM([[
2657 #include <string.h>
2658 #include <openssl/evp.h>
2659 ]], [[
2660 if(EVP_DigestUpdate(NULL, NULL,0))
2661 exit(0);
2662 ]])],
2663 [
2664 AC_MSG_RESULT([yes])
2665 ],
2666 [
2667 AC_MSG_RESULT([no])
2668 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
2669 [Define if EVP_DigestUpdate returns void])
2670 ]
2671 )
2672
2673 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2674 # because the system crypt() is more featureful.
2675 if test "x$check_for_libcrypt_before" = "x1"; then
2676 AC_CHECK_LIB([crypt], [crypt])
2677 fi
2678
2679 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2680 # version in OpenSSL.
2681 if test "x$check_for_libcrypt_later" = "x1"; then
2682 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
2683 fi
Damien Miller00797e82015-03-04 05:02:45 +11002684 AC_CHECK_FUNCS([crypt DES_crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002685
2686 # Search for SHA256 support in libc and/or OpenSSL
2687 AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2688 [unsupported_algorithms="$unsupported_algorithms \
2689 hmac-sha2-256 hmac-sha2-512 \
2690 diffie-hellman-group-exchange-sha256 \
2691 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2692 ]
2693 )
2694 # Search for RIPE-MD support in OpenSSL
2695 AC_CHECK_FUNCS([EVP_ripemd160], ,
2696 [unsupported_algorithms="$unsupported_algorithms \
2697 hmac-ripemd160
2698 hmac-ripemd160@openssh.com
2699 hmac-ripemd160-etm@openssh.com"
2700 ]
2701 )
2702
2703 # Check complete ECC support in OpenSSL
2704 AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2705 AC_LINK_IFELSE(
2706 [AC_LANG_PROGRAM([[
2707 #include <openssl/ec.h>
2708 #include <openssl/ecdh.h>
2709 #include <openssl/ecdsa.h>
2710 #include <openssl/evp.h>
2711 #include <openssl/objects.h>
2712 #include <openssl/opensslv.h>
2713 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2714 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2715 #endif
2716 ]], [[
2717 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2718 const EVP_MD *m = EVP_sha256(); /* We need this too */
Darren Tucker37bcef52013-11-09 18:39:25 +11002719 ]])],
2720 [ AC_MSG_RESULT([yes])
Damien Miller72ef7c12015-01-15 02:21:31 +11002721 enable_nistp256=1 ],
2722 [ AC_MSG_RESULT([no]) ]
2723 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002724
Damien Miller72ef7c12015-01-15 02:21:31 +11002725 AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2726 AC_LINK_IFELSE(
2727 [AC_LANG_PROGRAM([[
2728 #include <openssl/ec.h>
2729 #include <openssl/ecdh.h>
2730 #include <openssl/ecdsa.h>
2731 #include <openssl/evp.h>
2732 #include <openssl/objects.h>
2733 #include <openssl/opensslv.h>
2734 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2735 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2736 #endif
2737 ]], [[
2738 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2739 const EVP_MD *m = EVP_sha384(); /* We need this too */
2740 ]])],
2741 [ AC_MSG_RESULT([yes])
2742 enable_nistp384=1 ],
2743 [ AC_MSG_RESULT([no]) ]
2744 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002745
Damien Miller72ef7c12015-01-15 02:21:31 +11002746 AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
2747 AC_LINK_IFELSE(
2748 [AC_LANG_PROGRAM([[
2749 #include <openssl/ec.h>
2750 #include <openssl/ecdh.h>
2751 #include <openssl/ecdsa.h>
2752 #include <openssl/evp.h>
2753 #include <openssl/objects.h>
2754 #include <openssl/opensslv.h>
2755 #if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2756 # error "OpenSSL < 0.9.8g has unreliable ECC code"
2757 #endif
2758 ]], [[
2759 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2760 const EVP_MD *m = EVP_sha512(); /* We need this too */
2761 ]])],
2762 [ AC_MSG_RESULT([yes])
2763 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2764 AC_RUN_IFELSE(
2765 [AC_LANG_PROGRAM([[
2766 #include <openssl/ec.h>
2767 #include <openssl/ecdh.h>
2768 #include <openssl/ecdsa.h>
2769 #include <openssl/evp.h>
2770 #include <openssl/objects.h>
2771 #include <openssl/opensslv.h>
2772 ]],[[
2773 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2774 const EVP_MD *m = EVP_sha512(); /* We need this too */
2775 exit(e == NULL || m == NULL);
2776 ]])],
2777 [ AC_MSG_RESULT([yes])
2778 enable_nistp521=1 ],
2779 [ AC_MSG_RESULT([no]) ],
2780 [ AC_MSG_WARN([cross-compiling: assuming yes])
2781 enable_nistp521=1 ]
2782 )],
2783 AC_MSG_RESULT([no])
2784 )
Darren Tucker37bcef52013-11-09 18:39:25 +11002785
Damien Miller72ef7c12015-01-15 02:21:31 +11002786 COMMENT_OUT_ECC="#no ecc#"
2787 TEST_SSH_ECC=no
2788
2789 if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2790 test x$enable_nistp521 = x1; then
2791 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2792 fi
2793 if test x$enable_nistp256 = x1; then
2794 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2795 [libcrypto has NID_X9_62_prime256v1])
2796 TEST_SSH_ECC=yes
2797 COMMENT_OUT_ECC=""
2798 else
2799 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2800 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2801 fi
2802 if test x$enable_nistp384 = x1; then
2803 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2804 TEST_SSH_ECC=yes
2805 COMMENT_OUT_ECC=""
2806 else
2807 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2808 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2809 fi
2810 if test x$enable_nistp521 = x1; then
2811 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2812 TEST_SSH_ECC=yes
2813 COMMENT_OUT_ECC=""
2814 else
2815 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2816 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2817 fi
2818
2819 AC_SUBST([TEST_SSH_ECC])
2820 AC_SUBST([COMMENT_OUT_ECC])
2821else
2822 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Miller00797e82015-03-04 05:02:45 +11002823 AC_CHECK_FUNCS([crypt])
Damien Miller72ef7c12015-01-15 02:21:31 +11002824fi
Damien Miller6af914a2010-09-10 11:39:26 +10002825
Damien Miller00f9cd22014-07-15 10:41:38 +10002826AC_CHECK_FUNCS([ \
2827 arc4random \
2828 arc4random_buf \
2829 arc4random_stir \
2830 arc4random_uniform \
2831])
2832
Tim Rice99203ec2007-03-26 09:35:28 -07002833saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002834AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002835 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002836 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2837 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Ricee1d93702016-05-31 11:13:22 -07002838 [Define if system has libiaf that supports set_id])
Tim Rice0eeaf122007-09-10 16:24:17 -07002839 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002840])
2841LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002842
2843### Configure cryptographic random number support
2844
2845# Check wheter OpenSSL seeds itself
Damien Miller72ef7c12015-01-15 02:21:31 +11002846if test "x$openssl" = "xyes" ; then
2847 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2848 AC_RUN_IFELSE(
2849 [AC_LANG_PROGRAM([[
2850 #include <string.h>
2851 #include <openssl/rand.h>
2852 ]], [[
2853 exit(RAND_status() == 1 ? 0 : 1);
2854 ]])],
2855 [
2856 OPENSSL_SEEDS_ITSELF=yes
2857 AC_MSG_RESULT([yes])
2858 ],
2859 [
2860 AC_MSG_RESULT([no])
2861 ],
2862 [
2863 AC_MSG_WARN([cross compiling: assuming yes])
2864 # This is safe, since we will fatal() at runtime if
2865 # OpenSSL is not seeded correctly.
2866 OPENSSL_SEEDS_ITSELF=yes
2867 ]
2868 )
2869fi
Damien Millerf22019b2011-05-05 13:48:37 +10002870
2871# PRNGD TCP socket
2872AC_ARG_WITH([prngd-port],
2873 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2874 [
2875 case "$withval" in
2876 no)
2877 withval=""
2878 ;;
2879 [[0-9]]*)
2880 ;;
2881 *)
2882 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2883 ;;
2884 esac
2885 if test ! -z "$withval" ; then
2886 PRNGD_PORT="$withval"
2887 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2888 [Port number of PRNGD/EGD random number socket])
2889 fi
2890 ]
2891)
2892
2893# PRNGD Unix domain socket
2894AC_ARG_WITH([prngd-socket],
2895 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2896 [
2897 case "$withval" in
2898 yes)
2899 withval="/var/run/egd-pool"
2900 ;;
2901 no)
2902 withval=""
2903 ;;
2904 /*)
2905 ;;
2906 *)
2907 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2908 ;;
2909 esac
2910
2911 if test ! -z "$withval" ; then
2912 if test ! -z "$PRNGD_PORT" ; then
2913 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2914 fi
2915 if test ! -r "$withval" ; then
2916 AC_MSG_WARN([Entropy socket is not readable])
2917 fi
2918 PRNGD_SOCKET="$withval"
2919 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2920 [Location of PRNGD/EGD random number socket])
2921 fi
2922 ],
2923 [
2924 # Check for existing socket only if we don't have a random device already
2925 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2926 AC_MSG_CHECKING([for PRNGD/EGD socket])
2927 # Insert other locations here
2928 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2929 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2930 PRNGD_SOCKET="$sock"
2931 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2932 break;
2933 fi
2934 done
2935 if test ! -z "$PRNGD_SOCKET" ; then
2936 AC_MSG_RESULT([$PRNGD_SOCKET])
2937 else
2938 AC_MSG_RESULT([not found])
2939 fi
2940 fi
2941 ]
2942)
2943
2944# Which randomness source do we use?
2945if test ! -z "$PRNGD_PORT" ; then
2946 RAND_MSG="PRNGd port $PRNGD_PORT"
2947elif test ! -z "$PRNGD_SOCKET" ; then
2948 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2949elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2950 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Damien Miller72ef7c12015-01-15 02:21:31 +11002951 [Define if you want the OpenSSL internally seeded PRNG only])
Damien Millerf22019b2011-05-05 13:48:37 +10002952 RAND_MSG="OpenSSL internal ONLY"
Damien Miller72ef7c12015-01-15 02:21:31 +11002953elif test "x$openssl" = "xno" ; then
2954 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 +10002955else
2956 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])
2957fi
Damien Miller6c21c512002-01-22 21:57:53 +11002958
Darren Tucker3e6bde42006-08-20 20:03:50 +10002959# Check for PAM libs
2960PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002961AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002962 [ --with-pam Enable PAM support ],
2963 [
2964 if test "x$withval" != "xno" ; then
2965 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2966 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2967 AC_MSG_ERROR([PAM headers not found])
2968 fi
2969
2970 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002971 AC_CHECK_LIB([dl], [dlopen], , )
2972 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2973 AC_CHECK_FUNCS([pam_getenvlist])
2974 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002975 LIBS="$saved_LIBS"
2976
2977 PAM_MSG="yes"
2978
Darren Tucker20e9f972007-03-25 18:26:01 +10002979 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002980 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002981 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002982
Darren Tucker3e6bde42006-08-20 20:03:50 +10002983 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002984 case "$LIBS" in
2985 *-ldl*)
2986 # libdl already in LIBS
2987 ;;
2988 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002989 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002990 ;;
2991 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002992 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002993 fi
2994 ]
2995)
2996
2997# Check for older PAM
2998if test "x$PAM_MSG" = "xyes" ; then
2999 # Check PAM strerror arguments (old PAM)
3000 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08003001 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10003002#include <stdlib.h>
3003#if defined(HAVE_SECURITY_PAM_APPL_H)
3004#include <security/pam_appl.h>
3005#elif defined (HAVE_PAM_PAM_APPL_H)
3006#include <pam/pam_appl.h>
3007#endif
Tim Rice648f8762011-01-26 12:38:57 -08003008 ]], [[
3009(void)pam_strerror((pam_handle_t *)NULL, -1);
3010 ]])], [AC_MSG_RESULT([no])], [
3011 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10003012 [Define if you have an old version of PAM
3013 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08003014 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003015 PAM_MSG="yes (old library)"
Damien Miller72ef7c12015-01-15 02:21:31 +11003016
Tim Rice648f8762011-01-26 12:38:57 -08003017 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10003018fi
Damien Miller6c21c512002-01-22 21:57:53 +11003019
Damien Miller6482d902014-05-27 14:34:42 +10003020case "$host" in
3021*-*-cygwin*)
3022 SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER
3023 ;;
3024*)
3025 SSH_PRIVSEP_USER=sshd
3026 ;;
3027esac
Tim Rice648f8762011-01-26 12:38:57 -08003028AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00003029 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00003030 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003031 if test -n "$withval" && test "x$withval" != "xno" && \
3032 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10003033 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00003034 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08003035 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00003036)
Damien Miller6482d902014-05-27 14:34:42 +10003037if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then
3038 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER],
3039 [Cygwin function to fetch non-privileged user for privilege separation])
3040else
3041 AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
3042 [non-privileged user for privilege separation])
3043fi
Tim Rice648f8762011-01-26 12:38:57 -08003044AC_SUBST([SSH_PRIVSEP_USER])
Damien Millera64b57a2001-01-17 10:44:13 +11003045
Damien Miller91f40d82013-02-22 11:37:00 +11003046if test "x$have_linux_no_new_privs" = "x1" ; then
3047AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
3048 #include <sys/types.h>
3049 #include <linux/seccomp.h>
3050])
3051fi
3052if test "x$have_seccomp_filter" = "x1" ; then
3053AC_MSG_CHECKING([kernel for seccomp_filter support])
3054AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3055 #include <errno.h>
3056 #include <elf.h>
3057 #include <linux/audit.h>
3058 #include <linux/seccomp.h>
3059 #include <stdlib.h>
3060 #include <sys/prctl.h>
3061 ]],
3062 [[ int i = $seccomp_audit_arch;
3063 errno = 0;
3064 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
3065 exit(errno == EFAULT ? 0 : 1); ]])],
3066 [ AC_MSG_RESULT([yes]) ], [
3067 AC_MSG_RESULT([no])
3068 # Disable seccomp filter as a target
3069 have_seccomp_filter=0
3070 ]
3071)
3072fi
3073
Damien Miller69ff1df2011-06-23 08:30:03 +10003074# Decide which sandbox style to use
3075sandbox_arg=""
3076AC_ARG_WITH([sandbox],
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003077 [ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter, systrace, pledge)],
Damien Miller69ff1df2011-06-23 08:30:03 +10003078 [
3079 if test "x$withval" = "xyes" ; then
3080 sandbox_arg=""
3081 else
3082 sandbox_arg="$withval"
3083 fi
3084 ]
3085)
Darren Tucker60395f92012-07-03 14:31:18 +10003086
3087# Some platforms (seems to be the ones that have a kernel poll(2)-type
3088# function with which they implement select(2)) use an extra file descriptor
3089# when calling select(2), which means we can't use the rlimit sandbox.
3090AC_MSG_CHECKING([if select works with descriptor rlimit])
3091AC_RUN_IFELSE(
3092 [AC_LANG_PROGRAM([[
3093#include <sys/types.h>
3094#ifdef HAVE_SYS_TIME_H
3095# include <sys/time.h>
3096#endif
3097#include <sys/resource.h>
3098#ifdef HAVE_SYS_SELECT_H
3099# include <sys/select.h>
3100#endif
3101#include <errno.h>
3102#include <fcntl.h>
3103#include <stdlib.h>
3104 ]],[[
3105 struct rlimit rl_zero;
3106 int fd, r;
3107 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11003108 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10003109
3110 fd = open("/dev/null", O_RDONLY);
3111 FD_ZERO(&fds);
3112 FD_SET(fd, &fds);
3113 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3114 setrlimit(RLIMIT_FSIZE, &rl_zero);
3115 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11003116 tv.tv_sec = 1;
3117 tv.tv_usec = 0;
3118 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10003119 exit (r == -1 ? 1 : 0);
3120 ]])],
3121 [AC_MSG_RESULT([yes])
3122 select_works_with_rlimit=yes],
3123 [AC_MSG_RESULT([no])
3124 select_works_with_rlimit=no],
3125 [AC_MSG_WARN([cross compiling: assuming yes])]
3126)
3127
Darren Tuckerff008de2013-03-06 17:48:48 +11003128AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
3129AC_RUN_IFELSE(
3130 [AC_LANG_PROGRAM([[
3131#include <sys/types.h>
3132#ifdef HAVE_SYS_TIME_H
3133# include <sys/time.h>
3134#endif
3135#include <sys/resource.h>
3136#include <errno.h>
3137#include <stdlib.h>
3138 ]],[[
3139 struct rlimit rl_zero;
3140 int fd, r;
3141 fd_set fds;
3142
3143 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3144 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
3145 exit (r == -1 ? 1 : 0);
3146 ]])],
3147 [AC_MSG_RESULT([yes])
3148 rlimit_nofile_zero_works=yes],
3149 [AC_MSG_RESULT([no])
3150 rlimit_nofile_zero_works=no],
3151 [AC_MSG_WARN([cross compiling: assuming yes])]
3152)
3153
Darren Tuckerd545a4b2012-07-03 22:48:31 +10003154AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
3155AC_RUN_IFELSE(
3156 [AC_LANG_PROGRAM([[
3157#include <sys/types.h>
3158#include <sys/resource.h>
3159#include <stdlib.h>
3160 ]],[[
3161 struct rlimit rl_zero;
3162
3163 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
3164 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
3165 ]])],
3166 [AC_MSG_RESULT([yes])],
3167 [AC_MSG_RESULT([no])
3168 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
3169 [setrlimit RLIMIT_FSIZE works])],
3170 [AC_MSG_WARN([cross compiling: assuming yes])]
3171)
3172
deraadt@openbsd.org2539dce2015-10-09 01:37:08 +00003173if test "x$sandbox_arg" = "xpledge" || \
3174 ( test -z "$sandbox_arg" && test "x$ac_cv_func_pledge" = "xyes" ) ; then
3175 test "x$ac_cv_func_pledge" != "xyes" && \
3176 AC_MSG_ERROR([pledge sandbox requires pledge(2) support])
3177 SANDBOX_STYLE="pledge"
Damien Millerfafe1d82015-10-14 09:22:15 -07003178 AC_DEFINE([SANDBOX_PLEDGE], [1], [Sandbox using pledge(2)])
Damien Miller9846a2f2015-10-08 04:30:48 +11003179elif test "x$sandbox_arg" = "xsystrace" || \
Damien Miller69ff1df2011-06-23 08:30:03 +10003180 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003181 test "x$have_systr_policy_kill" != "x1" && \
3182 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10003183 SANDBOX_STYLE="systrace"
3184 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10003185elif test "x$sandbox_arg" = "xdarwin" || \
3186 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
3187 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003188 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
3189 "x$ac_cv_header_sandbox_h" != "xyes" && \
3190 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10003191 SANDBOX_STYLE="darwin"
3192 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10003193elif test "x$sandbox_arg" = "xseccomp_filter" || \
3194 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10003195 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003196 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10003197 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11003198 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
3199 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003200 test "x$have_linux_no_new_privs" = "x1" && \
3201 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11003202 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10003203 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
3204 test "x$have_linux_no_new_privs" != "x1" && \
3205 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
3206 test "x$have_seccomp_filter" != "x1" && \
3207 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
3208 test "x$ac_cv_func_prctl" != "xyes" && \
3209 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
3210 SANDBOX_STYLE="seccomp_filter"
3211 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Millerf62ecef2014-01-25 12:34:38 +11003212elif test "x$sandbox_arg" = "xcapsicum" || \
3213 ( test -z "$sandbox_arg" && \
Damien Miller603b8f42014-01-25 13:16:59 +11003214 test "x$ac_cv_header_sys_capability_h" = "xyes" && \
3215 test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then
3216 test "x$ac_cv_header_sys_capability_h" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003217 AC_MSG_ERROR([capsicum sandbox requires sys/capability.h header])
Damien Miller603b8f42014-01-25 13:16:59 +11003218 test "x$ac_cv_func_cap_rights_limit" != "xyes" && \
Damien Millerc96d8532014-01-25 13:12:28 +11003219 AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function])
Damien Millerf62ecef2014-01-25 12:34:38 +11003220 SANDBOX_STYLE="capsicum"
3221 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10003222elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10003223 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11003224 test "x$select_works_with_rlimit" = "xyes" && \
3225 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10003226 test "x$ac_cv_func_setrlimit" != "xyes" && \
3227 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10003228 test "x$select_works_with_rlimit" != "xyes" && \
3229 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10003230 SANDBOX_STYLE="rlimit"
3231 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller4626cba2016-01-08 14:24:56 +11003232elif test "x$sandbox_arg" = "xsolaris" || \
3233 ( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then
3234 SANDBOX_STYLE="solaris"
3235 AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges])
Damien Miller69ff1df2011-06-23 08:30:03 +10003236elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
3237 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
3238 SANDBOX_STYLE="none"
3239 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
3240else
Tim Ricea6e60612011-08-17 21:48:22 -07003241 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003242fi
3243
Ben Lindstromb5628642000-10-18 00:02:25 +00003244# Cheap hack to ensure NEWS-OS libraries are arranged right.
3245if test ! -z "$SONY" ; then
3246 LIBS="$LIBS -liberty";
3247fi
3248
Damien Miller57f39152005-11-24 19:58:19 +11003249# Check for long long datatypes
3250AC_CHECK_TYPES([long long, unsigned long long, long double])
3251
3252# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003253AC_CHECK_SIZEOF([short int], [2])
3254AC_CHECK_SIZEOF([int], [4])
3255AC_CHECK_SIZEOF([long int], [4])
3256AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003257
Damien Millerfa2bb692002-04-23 23:22:25 +10003258# Sanity check long long for some platforms (AIX)
3259if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3260 ac_cv_sizeof_long_long_int=0
3261fi
3262
Darren Tucker537f1ed2005-10-25 18:38:33 +10003263# compute LLONG_MIN and LLONG_MAX if we don't know them.
3264if test -z "$have_llong_max"; then
3265 AC_MSG_CHECKING([for max value of long long])
3266 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003267 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003268#include <stdio.h>
3269/* Why is this so damn hard? */
3270#ifdef __GNUC__
3271# undef __GNUC__
3272#endif
3273#define __USE_ISOC99
3274#include <limits.h>
3275#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003276#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3277
3278/*
3279 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3280 * we do this the hard way.
3281 */
3282static int
3283fprint_ll(FILE *f, long long n)
3284{
3285 unsigned int i;
3286 int l[sizeof(long long) * 8];
3287
3288 if (n < 0)
3289 if (fprintf(f, "-") < 0)
3290 return -1;
3291 for (i = 0; n != 0; i++) {
3292 l[i] = my_abs(n % 10);
3293 n /= 10;
3294 }
3295 do {
3296 if (fprintf(f, "%d", l[--i]) < 0)
3297 return -1;
3298 } while (i != 0);
3299 if (fprintf(f, " ") < 0)
3300 return -1;
3301 return 0;
3302}
Tim Rice648f8762011-01-26 12:38:57 -08003303 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003304 FILE *f;
3305 long long i, llmin, llmax = 0;
3306
3307 if((f = fopen(DATA,"w")) == NULL)
3308 exit(1);
3309
3310#if defined(LLONG_MIN) && defined(LLONG_MAX)
3311 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3312 llmin = LLONG_MIN;
3313 llmax = LLONG_MAX;
3314#else
3315 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3316 /* This will work on one's complement and two's complement */
3317 for (i = 1; i > llmax; i <<= 1, i++)
3318 llmax = i;
3319 llmin = llmax + 1LL; /* wrap */
3320#endif
3321
3322 /* Sanity check */
3323 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003324 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3325 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003326 fprintf(f, "unknown unknown\n");
3327 exit(2);
3328 }
3329
Darren Tuckerd1450db2006-03-13 19:06:51 +11003330 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003331 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003332 if (fprint_ll(f, llmax) < 0)
3333 exit(4);
3334 if (fclose(f) < 0)
3335 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003336 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003337 ]])],
3338 [
3339 llong_min=`$AWK '{print $1}' conftest.llminmax`
3340 llong_max=`$AWK '{print $2}' conftest.llminmax`
Darren Tucker537f1ed2005-10-25 18:38:33 +10003341
Tim Rice648f8762011-01-26 12:38:57 -08003342 AC_MSG_RESULT([$llong_max])
3343 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003344 [max value of long long calculated by configure])
3345 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003346 AC_MSG_RESULT([$llong_min])
3347 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003348 [min value of long long calculated by configure])
3349 ],
3350 [
Tim Rice648f8762011-01-26 12:38:57 -08003351 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003352 ],
3353 [
3354 AC_MSG_WARN([cross compiling: not checking])
3355 ]
3356 )
3357fi
3358
3359
Damien Millera22ba012000-03-02 23:09:20 +11003360# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003361AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003362 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3363 [[ u_int a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003364 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
Tim Rice648f8762011-01-26 12:38:57 -08003365 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003366])
3367if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003368 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003369 have_u_int=1
3370fi
3371
Damien Miller61e50f12000-05-08 20:49:37 +10003372AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003373 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3374 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003375 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003376 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003377])
3378if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003379 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003380 have_intxx_t=1
3381fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003382
3383if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003384 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003385then
3386 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3388 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003389 [
Tim Rice648f8762011-01-26 12:38:57 -08003390 AC_DEFINE([HAVE_INTXX_T])
3391 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003392 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003393 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003394fi
3395
Damien Miller578783e2000-09-23 14:12:24 +11003396AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003398#include <sys/types.h>
3399#ifdef HAVE_STDINT_H
3400# include <stdint.h>
3401#endif
3402#include <sys/socket.h>
3403#ifdef HAVE_SYS_BITYPES_H
3404# include <sys/bitypes.h>
3405#endif
Tim Rice648f8762011-01-26 12:38:57 -08003406 ]], [[
3407int64_t a; a = 1;
3408 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003409 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003410 ])
Damien Miller578783e2000-09-23 14:12:24 +11003411])
3412if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003413 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003414fi
3415
Damien Miller61e50f12000-05-08 20:49:37 +10003416AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003417 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3418 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003419 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003420 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003421])
3422if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003423 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003424 have_u_intxx_t=1
3425fi
Damien Millerb29ea912000-01-15 14:12:03 +11003426
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003427if test -z "$have_u_intxx_t" ; then
3428 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003429 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3430 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003431 [
Tim Rice648f8762011-01-26 12:38:57 -08003432 AC_DEFINE([HAVE_U_INTXX_T])
3433 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003434 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003435 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003436fi
3437
Damien Miller578783e2000-09-23 14:12:24 +11003438AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003439 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3440 [[ u_int64_t a; a = 1;]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003441 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003442 ])
Damien Miller578783e2000-09-23 14:12:24 +11003443])
3444if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003445 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003446 have_u_int64_t=1
Tim Rice4cec93f2002-02-26 08:40:48 -08003447fi
3448
Damien Millerc2868192014-01-30 10:21:19 +11003449if (test -z "$have_u_int64_t" && \
3450 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3451then
Tim Rice4cec93f2002-02-26 08:40:48 -08003452 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003453 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3454 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003455 [
Tim Rice648f8762011-01-26 12:38:57 -08003456 AC_DEFINE([HAVE_U_INT64_T])
3457 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003458 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003459 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003460fi
3461
3462if test -z "$have_u_intxx_t" ; then
3463 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003464 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003465#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003466 ]], [[
3467 uint8_t a;
3468 uint16_t b;
3469 uint32_t c;
3470 a = b = c = 1;
3471 ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003472 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003473 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003474 ])
3475 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003476 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003477 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003478 fi
3479fi
3480
Damien Millerc2868192014-01-30 10:21:19 +11003481if (test -z "$have_uintxx_t" && \
3482 test "x$ac_cv_header_stdint_h" = "xyes")
3483then
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003484 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003485 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3486 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003487 [
Tim Rice648f8762011-01-26 12:38:57 -08003488 AC_DEFINE([HAVE_UINTXX_T])
3489 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003490 ], [ AC_MSG_RESULT([no])
Tim Rice648f8762011-01-26 12:38:57 -08003491 ])
Damien Miller578783e2000-09-23 14:12:24 +11003492fi
3493
Damien Millerc2868192014-01-30 10:21:19 +11003494if (test -z "$have_uintxx_t" && \
3495 test "x$ac_cv_header_inttypes_h" = "xyes")
3496then
Darren Tucker6d725682014-01-17 19:17:34 +11003497 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3498 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3499 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3500 [
3501 AC_DEFINE([HAVE_UINTXX_T])
3502 AC_MSG_RESULT([yes])
Tim Ricee1d93702016-05-31 11:13:22 -07003503 ], [ AC_MSG_RESULT([no])
Darren Tucker6d725682014-01-17 19:17:34 +11003504 ])
3505fi
3506
Damien Milleredb82922000-06-20 13:25:52 +10003507if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003508 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003509then
3510 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003511 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003512#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003513 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003514 int8_t a; int16_t b; int32_t c;
3515 u_int8_t e; u_int16_t f; u_int32_t g;
3516 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003517 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003518 [
Tim Rice648f8762011-01-26 12:38:57 -08003519 AC_DEFINE([HAVE_U_INTXX_T])
3520 AC_DEFINE([HAVE_INTXX_T])
3521 AC_MSG_RESULT([yes])
3522 ], [AC_MSG_RESULT([no])
3523 ])
Damien Millerd6121d22000-03-17 23:26:46 +11003524fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003525
Damien Miller58be7382001-09-15 21:31:54 +10003526
3527AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003528 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3529 [[ u_char foo; foo = 125; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003530 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
Tim Rice648f8762011-01-26 12:38:57 -08003531 ])
Damien Miller58be7382001-09-15 21:31:54 +10003532])
3533if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003534 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003535fi
3536
Darren Tucker007e3b32013-11-03 18:43:55 +11003537AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3538#include <sys/types.h>
3539#include <stdint.h>
3540])
3541
Tim Rice13aae5e2001-10-21 17:53:58 -07003542TYPE_SOCKLEN_T
Tim Rice4cec93f2002-02-26 08:40:48 -08003543
Tim Rice648f8762011-01-26 12:38:57 -08003544AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3545AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003546#include <sys/types.h>
3547#ifdef HAVE_SYS_BITYPES_H
3548#include <sys/bitypes.h>
3549#endif
3550#ifdef HAVE_SYS_STATFS_H
3551#include <sys/statfs.h>
3552#endif
3553#ifdef HAVE_SYS_STATVFS_H
3554#include <sys/statvfs.h>
3555#endif
3556])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003557
Tim Rice648f8762011-01-26 12:38:57 -08003558AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003559[#include <sys/types.h>
3560#include <netinet/in.h>])
Damien Miller74d0d4a1999-12-29 02:24:35 +11003561
Damien Miller61e50f12000-05-08 20:49:37 +10003562AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003563 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3564 [[ size_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003565 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003566 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003567])
3568if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003569 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003570fi
Damien Miller34132e52000-01-14 15:45:46 +11003571
Damien Miller615f9392000-05-17 22:53:33 +10003572AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003573 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3574 [[ ssize_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003575 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003576 ])
Damien Miller615f9392000-05-17 22:53:33 +10003577])
3578if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003579 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003580fi
3581
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003582AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3584 [[ clock_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003585 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003586 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003587])
3588if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003589 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003590fi
3591
Damien Millerb54b40e2000-06-23 08:23:34 +10003592AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003593 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003594#include <sys/types.h>
3595#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003596 ]], [[ sa_family_t foo; foo = 1235; ]])],
3597 [ ac_cv_have_sa_family_t="yes" ],
3598 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003599#include <sys/types.h>
3600#include <sys/socket.h>
3601#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003602 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003603 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003604 [ ac_cv_have_sa_family_t="no" ]
3605 )
Tim Rice648f8762011-01-26 12:38:57 -08003606 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003607])
3608if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003609 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003610 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003611fi
3612
Damien Miller0f91b4e2000-06-18 15:43:25 +10003613AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3615 [[ pid_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003616 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003617 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003618])
3619if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003620 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003621fi
3622
3623AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003624 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3625 [[ mode_t foo; foo = 1235; ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003626 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
Tim Rice648f8762011-01-26 12:38:57 -08003627 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003628])
3629if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003630 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003631fi
3632
Damien Miller61e50f12000-05-08 20:49:37 +10003633
3634AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003636#include <sys/types.h>
3637#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003638 ]], [[ struct sockaddr_storage s; ]])],
3639 [ ac_cv_have_struct_sockaddr_storage="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003640 [ ac_cv_have_struct_sockaddr_storage="no"
Tim Rice648f8762011-01-26 12:38:57 -08003641 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003642])
3643if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003644 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003645 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003646fi
Damien Miller34132e52000-01-14 15:45:46 +11003647
Damien Miller61e50f12000-05-08 20:49:37 +10003648AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003649 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003650#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003651#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003652 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3653 [ ac_cv_have_struct_sockaddr_in6="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003654 [ ac_cv_have_struct_sockaddr_in6="no"
Tim Rice648f8762011-01-26 12:38:57 -08003655 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003656])
3657if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003658 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003659 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003660fi
Damien Miller34132e52000-01-14 15:45:46 +11003661
Damien Miller61e50f12000-05-08 20:49:37 +10003662AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003663 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003664#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003665#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003666 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3667 [ ac_cv_have_struct_in6_addr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003668 [ ac_cv_have_struct_in6_addr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003669 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003670])
3671if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003672 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003673 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003674
3675dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003676 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003677 [
3678#ifdef HAVE_SYS_TYPES_H
3679#include <sys/types.h>
3680#endif
3681#include <netinet/in.h>
3682 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003683fi
Damien Miller34132e52000-01-14 15:45:46 +11003684
Damien Miller61e50f12000-05-08 20:49:37 +10003685AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003686 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003687#include <sys/types.h>
3688#include <sys/socket.h>
3689#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003690 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3691 [ ac_cv_have_struct_addrinfo="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003692 [ ac_cv_have_struct_addrinfo="no"
Tim Rice648f8762011-01-26 12:38:57 -08003693 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003694])
3695if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003696 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003697 [define if you have struct addrinfo data type])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003698fi
3699
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003700AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003701 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3702 [[ struct timeval tv; tv.tv_sec = 1;]])],
3703 [ ac_cv_have_struct_timeval="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003704 [ ac_cv_have_struct_timeval="no"
Tim Rice648f8762011-01-26 12:38:57 -08003705 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003706])
3707if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003708 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003709 have_struct_timeval=1
3710fi
3711
Tim Rice648f8762011-01-26 12:38:57 -08003712AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003713
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003714# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003715if test "x$ac_cv_have_int64_t" = "xno" && \
3716 test "x$ac_cv_sizeof_long_int" != "x8" && \
3717 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003718 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3719 echo "an alternative compiler (I.E., GCC) before continuing."
3720 echo ""
3721 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003722else
3723dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003724 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003725 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003726#include <stdio.h>
3727#include <string.h>
3728#ifdef HAVE_SNPRINTF
3729main()
3730{
3731 char buf[50];
3732 char expected_out[50];
3733 int mazsize = 50 ;
3734#if (SIZEOF_LONG_INT == 8)
3735 long int num = 0x7fffffffffffffff;
3736#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003737 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003738#endif
3739 strcpy(expected_out, "9223372036854775807");
3740 snprintf(buf, mazsize, "%lld", num);
3741 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003742 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003743 exit(0);
3744}
3745#else
3746main() { exit(0); }
3747#endif
Tim Rice648f8762011-01-26 12:38:57 -08003748 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003749 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003750 )
Damien Miller61e50f12000-05-08 20:49:37 +10003751fi
3752
Damien Miller78315eb2000-09-29 23:01:36 +11003753dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003754OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3755OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3756OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3757OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3758OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3759OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3760OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3761OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3762OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3763OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3764OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3765OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3766OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3767OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3768OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3769OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3770OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003771
3772AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003773AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3774struct passwd.pw_change, struct passwd.pw_expire],
3775[], [], [[
3776#include <sys/types.h>
3777#include <pwd.h>
3778]])
3779
Tim Rice648f8762011-01-26 12:38:57 -08003780AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003781 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003782[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003783#include <stdio.h>
3784#if HAVE_SYS_TYPES_H
3785# include <sys/types.h>
3786#endif
3787#include <netinet/in.h>
3788#include <arpa/nameser.h>
3789#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003790]])
Damien Miller942da032000-08-18 13:59:06 +10003791
Damien Miller61e50f12000-05-08 20:49:37 +10003792AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3793 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003794 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003795#include <sys/types.h>
3796#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003797 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3798 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3799 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003800])
3801if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003802 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003803fi
Damien Miller61e50f12000-05-08 20:49:37 +10003804
3805AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3806 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003808#include <sys/types.h>
3809#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003810 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3811 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003812 [ ac_cv_have___ss_family_in_struct_ss="no"
Tim Rice648f8762011-01-26 12:38:57 -08003813 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003814])
3815if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003816 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003817 [Fields in struct sockaddr_storage])
Kevin Steves82456952001-06-22 21:14:18 +00003818fi
Damien Miller61e50f12000-05-08 20:49:37 +10003819
Tim Rice28bbb0c2002-05-27 17:37:32 -07003820dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003821AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3822 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003823 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003824#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003825#include <sys/socket.h>
3826#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003827 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003828#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003829#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003830exit(1);
3831#endif
3832struct msghdr m;
3833m.msg_accrights = 0;
3834exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003835 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003836 [ ac_cv_have_accrights_in_msghdr="yes" ],
3837 [ ac_cv_have_accrights_in_msghdr="no" ]
3838 )
3839])
3840if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003841 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003842 [Define if your system uses access rights style
3843 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003844fi
3845
Tim Rice648f8762011-01-26 12:38:57 -08003846AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3847AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003848#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003849#include <sys/stat.h>
3850#ifdef HAVE_SYS_TIME_H
3851# include <sys/time.h>
3852#endif
3853#ifdef HAVE_SYS_MOUNT_H
3854#include <sys/mount.h>
3855#endif
3856#ifdef HAVE_SYS_STATVFS_H
3857#include <sys/statvfs.h>
3858#endif
Tim Rice648f8762011-01-26 12:38:57 -08003859 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3860 [ AC_MSG_RESULT([yes]) ],
3861 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003862
Tim Rice648f8762011-01-26 12:38:57 -08003863 AC_MSG_CHECKING([if fsid_t has member val])
3864 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003865#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003866#include <sys/statvfs.h>
3867 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3868 [ AC_MSG_RESULT([yes])
3869 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3870 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003871
Tim Rice648f8762011-01-26 12:38:57 -08003872 AC_MSG_CHECKING([if f_fsid has member __val])
3873 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003874#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003875#include <sys/statvfs.h>
3876 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3877 [ AC_MSG_RESULT([yes])
3878 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3879 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003880])
Darren Tucker77001382008-06-09 06:17:53 +10003881
Kevin Stevesa44e0352002-04-07 16:18:03 +00003882AC_CACHE_CHECK([for msg_control field in struct msghdr],
3883 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003884 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003885#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003886#include <sys/socket.h>
3887#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003888 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003889#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003890#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003891exit(1);
3892#endif
3893struct msghdr m;
3894m.msg_control = 0;
3895exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003896 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003897 [ ac_cv_have_control_in_msghdr="yes" ],
3898 [ ac_cv_have_control_in_msghdr="no" ]
3899 )
3900])
3901if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003902 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003903 [Define if your system uses ancillary data style
3904 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003905fi
3906
Damien Miller61e50f12000-05-08 20:49:37 +10003907AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003908 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3909 [[ extern char *__progname; printf("%s", __progname); ]])],
3910 [ ac_cv_libc_defines___progname="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003911 [ ac_cv_libc_defines___progname="no"
Tim Rice648f8762011-01-26 12:38:57 -08003912 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003913])
3914if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003915 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003916fi
3917
Kevin Steves4846f4a2002-03-22 18:19:53 +00003918AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003919 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3920 [[ printf("%s", __FUNCTION__); ]])],
3921 [ ac_cv_cc_implements___FUNCTION__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003922 [ ac_cv_cc_implements___FUNCTION__="no"
Tim Rice648f8762011-01-26 12:38:57 -08003923 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003924])
3925if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003926 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003927 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003928fi
3929
3930AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003931 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3932 [[ printf("%s", __func__); ]])],
3933 [ ac_cv_cc_implements___func__="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003934 [ ac_cv_cc_implements___func__="no"
Tim Rice648f8762011-01-26 12:38:57 -08003935 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003936])
3937if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003938 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003939fi
3940
Damien Miller57f39152005-11-24 19:58:19 +11003941AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003942 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3943#include <stdarg.h>
3944va_list x,y;
3945 ]], [[ va_copy(x,y); ]])],
3946 [ ac_cv_have_va_copy="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003947 [ ac_cv_have_va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08003948 ])
Damien Miller57f39152005-11-24 19:58:19 +11003949])
3950if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003951 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003952fi
3953
3954AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003955 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3956#include <stdarg.h>
3957va_list x,y;
3958 ]], [[ __va_copy(x,y); ]])],
Tim Ricee1d93702016-05-31 11:13:22 -07003959 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
Tim Rice648f8762011-01-26 12:38:57 -08003960 ])
Damien Miller57f39152005-11-24 19:58:19 +11003961])
3962if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003963 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003964fi
3965
Damien Miller4f8e6692001-07-14 13:22:53 +10003966AC_CACHE_CHECK([whether getopt has optreset support],
3967 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003968 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3969 [[ extern int optreset; optreset = 0; ]])],
3970 [ ac_cv_have_getopt_optreset="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003971 [ ac_cv_have_getopt_optreset="no"
Tim Rice648f8762011-01-26 12:38:57 -08003972 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003973])
3974if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003975 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003976 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003977fi
Damien Millera22ba012000-03-02 23:09:20 +11003978
Damien Millerecbb26d2000-07-15 14:59:14 +10003979AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003980 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3981[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3982 [ ac_cv_libc_defines_sys_errlist="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003983 [ ac_cv_libc_defines_sys_errlist="no"
Tim Rice648f8762011-01-26 12:38:57 -08003984 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003985])
3986if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003987 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003988 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003989fi
3990
3991
Damien Miller11fa2cc2000-08-16 10:35:58 +10003992AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003993 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3994[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3995 [ ac_cv_libc_defines_sys_nerr="yes" ],
Tim Ricee1d93702016-05-31 11:13:22 -07003996 [ ac_cv_libc_defines_sys_nerr="no"
Tim Rice648f8762011-01-26 12:38:57 -08003997 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003998])
3999if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004000 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10004001fi
4002
Darren Tucker5f88d342003-10-15 16:57:57 +10004003# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08004004AC_SEARCH_LIBS([getrrsetbyname], [resolv],
4005 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004006 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10004007 [
Darren Tucker5f88d342003-10-15 16:57:57 +10004008 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08004009 AC_SEARCH_LIBS([res_query], [resolv])
4010 AC_SEARCH_LIBS([dn_expand], [resolv])
4011 AC_MSG_CHECKING([if res_query will link])
4012 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004013#include <sys/types.h>
4014#include <netinet/in.h>
4015#include <arpa/nameser.h>
4016#include <netdb.h>
4017#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004018 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004019 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004020 ]])],
4021 AC_MSG_RESULT([yes]),
4022 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10004023 saved_LIBS="$LIBS"
4024 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08004025 AC_MSG_CHECKING([for res_query in -lresolv])
4026 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10004027#include <sys/types.h>
4028#include <netinet/in.h>
4029#include <arpa/nameser.h>
4030#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10004031#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08004032 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10004033 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08004034 ]])],
4035 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10004036 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004037 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10004038 ])
Tim Rice648f8762011-01-26 12:38:57 -08004039 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10004040 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07004041 [#include <sys/types.h>
4042 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08004043 AC_CHECK_MEMBER([HEADER.ad],
4044 [AC_DEFINE([HAVE_HEADER_AD], [1],
4045 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10004046 [#include <arpa/nameser.h>])
4047 ])
Damien Miller85de5802001-09-18 14:01:11 +10004048
Tim Rice648f8762011-01-26 12:38:57 -08004049AC_MSG_CHECKING([if struct __res_state _res is an extern])
4050AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004051#include <stdio.h>
4052#if HAVE_SYS_TYPES_H
4053# include <sys/types.h>
4054#endif
4055#include <netinet/in.h>
4056#include <arpa/nameser.h>
4057#include <resolv.h>
4058extern struct __res_state _res;
Darren Tucker7ad8b282015-09-11 13:11:02 +10004059 ]], [[
4060struct __res_state *volatile p = &_res; /* force resolution of _res */
4061return 0;
4062 ]],)],
Tim Rice648f8762011-01-26 12:38:57 -08004063 [AC_MSG_RESULT([yes])
4064 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004065 [Define if you have struct __res_state _res as an extern])
4066 ],
Tim Rice648f8762011-01-26 12:38:57 -08004067 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10004068)
4069
Damien Miller73b42d22006-04-22 21:26:08 +10004070# Check whether user wants SELinux support
4071SELINUX_MSG="no"
4072LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08004073AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11004074 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10004075 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10004076 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08004077 AC_DEFINE([WITH_SELINUX], [1],
4078 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10004079 SELINUX_MSG="yes"
4080 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08004081 AC_MSG_ERROR([SELinux support requires selinux.h header]))
4082 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11004083 [ LIBSELINUX="-lselinux"
4084 LIBS="$LIBS -lselinux"
4085 ],
Tim Rice648f8762011-01-26 12:38:57 -08004086 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11004087 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10004088 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08004089 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10004090 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10004091 fi ]
4092)
Tim Rice648f8762011-01-26 12:38:57 -08004093AC_SUBST([SSHLIBS])
4094AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10004095
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004096# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11004097KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004098AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11004099 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11004100 [ if test "x$withval" != "xno" ; then
4101 if test "x$withval" = "xyes" ; then
4102 KRB5ROOT="/usr/local"
4103 else
4104 KRB5ROOT=${withval}
4105 fi
4106
Tim Rice648f8762011-01-26 12:38:57 -08004107 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004108 KRB5_MSG="yes"
4109
Tim Rice648f8762011-01-26 12:38:57 -08004110 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10004111 [$KRB5ROOT/bin/krb5-config],
4112 [$KRB5ROOT/bin:$PATH])
4113 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11004114 K5CFLAGS="`$KRB5CONF --cflags`"
4115 K5LIBS="`$KRB5CONF --libs`"
4116 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11004117
Tim Rice648f8762011-01-26 12:38:57 -08004118 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004119 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08004120 AC_MSG_RESULT([yes])
4121 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004122 [Define this if you want GSSAPI
4123 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11004124 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
4125 GSSLIBS="`$KRB5CONF --libs gssapi`"
4126 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11004127 else
Tim Rice648f8762011-01-26 12:38:57 -08004128 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004129 fi
Tim Rice648f8762011-01-26 12:38:57 -08004130 AC_MSG_CHECKING([whether we are using Heimdal])
4131 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4132 ]], [[ char *tmp = heimdal_version; ]])],
4133 [ AC_MSG_RESULT([yes])
4134 AC_DEFINE([HEIMDAL], [1],
4135 [Define this if you are using the Heimdal
4136 version of Kerberos V5]) ],
4137 [AC_MSG_RESULT([no])
4138 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11004139 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004140 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11004141 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08004142 AC_MSG_CHECKING([whether we are using Heimdal])
4143 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
4144 ]], [[ char *tmp = heimdal_version; ]])],
4145 [ AC_MSG_RESULT([yes])
4146 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11004147 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10004148 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08004149 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10004150 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08004151 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11004152 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08004153 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11004154 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08004155 ])
4156 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004157
Tim Rice648f8762011-01-26 12:38:57 -08004158 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
4159 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004160 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08004161 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
4162 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11004163 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11004164 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
4165 [ AC_DEFINE([GSSAPI])
4166 GSSLIBS="-lgss" ],
4167 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
4168 ])
Darren Tucker964de182013-02-22 10:39:59 +11004169 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08004170
Tim Rice648f8762011-01-26 12:38:57 -08004171 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004172 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11004173 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004174 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004175 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11004176 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004177 ]
4178 )
4179
4180 oldCPP="$CPPFLAGS"
4181 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08004182 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10004183 [ CPPFLAGS="$oldCPP" ])
4184
Damien Millera8e06ce2003-11-21 23:48:55 +11004185 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11004186 if test ! -z "$need_dash_r" ; then
4187 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
4188 fi
4189 if test ! -z "$blibpath" ; then
4190 blibpath="$blibpath:${KRB5ROOT}/lib"
4191 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07004192
Tim Rice648f8762011-01-26 12:38:57 -08004193 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
4194 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
4195 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07004196
Tim Rice648f8762011-01-26 12:38:57 -08004197 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
4198 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11004199
4200 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
4201#ifdef HAVE_GSSAPI_H
4202# include <gssapi.h>
4203#elif defined(HAVE_GSSAPI_GSSAPI_H)
4204# include <gssapi/gssapi.h>
4205#endif
4206
4207#ifdef HAVE_GSSAPI_GENERIC_H
4208# include <gssapi_generic.h>
4209#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
4210# include <gssapi/gssapi_generic.h>
4211#endif
4212 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10004213 saved_LIBS="$LIBS"
4214 LIBS="$LIBS $K5LIBS"
4215 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
4216 LIBS="$saved_LIBS"
4217
Darren Tucker0d27ed12004-02-24 10:37:33 +11004218 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11004219 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10004220)
Darren Tucker964de182013-02-22 10:39:59 +11004221AC_SUBST([GSSLIBS])
4222AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10004223
Damien Millera22ba012000-03-02 23:09:20 +11004224# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11004225
Damien Millerf58c6722002-05-13 13:15:42 +10004226PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08004227AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07004228 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10004229 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004230 if test -n "$withval" && test "x$withval" != "xno" && \
4231 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10004232 PRIVSEP_PATH=$withval
4233 fi
4234 ]
4235)
Tim Rice648f8762011-01-26 12:38:57 -08004236AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10004237
Tim Rice648f8762011-01-26 12:38:57 -08004238AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11004239 [ --with-xauth=PATH Specify path to xauth program ],
4240 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004241 if test -n "$withval" && test "x$withval" != "xno" && \
4242 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10004243 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11004244 fi
4245 ],
4246 [
Tim Ricee22be3b2002-07-17 19:20:07 -07004247 TestPath="$PATH"
4248 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
4249 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4250 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4251 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004252 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004253 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004254 xauth_path="/usr/openwin/bin/xauth"
4255 fi
4256 ]
4257)
4258
Damien Miller7d901272003-01-13 16:55:22 +11004259STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004260AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004261 [ --disable-strip Disable calling strip(1) on install],
4262 [
4263 if test "x$enableval" = "xno" ; then
4264 STRIP_OPT=
4265 fi
4266 ]
4267)
Tim Rice648f8762011-01-26 12:38:57 -08004268AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004269
Damien Millera19cf472000-11-29 13:28:50 +11004270if test -z "$xauth_path" ; then
4271 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004272 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004273else
Tim Rice648f8762011-01-26 12:38:57 -08004274 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004275 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004276 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004277 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004278fi
4279
Tim Rice90f42b02011-06-02 18:17:49 -07004280dnl # --with-maildir=/path/to/mail gets top priority.
4281dnl # if maildir is set in the platform case statement above we use that.
4282dnl # Otherwise we run a program to get the dir from system headers.
4283dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4284dnl # If we find _PATH_MAILDIR we do nothing because that is what
4285dnl # session.c expects anyway. Otherwise we set to the value found
4286dnl # stripping any trailing slash. If for some strage reason our program
4287dnl # does not find what it needs, we default to /var/spool/mail.
4288# Check for mail directory
4289AC_ARG_WITH([maildir],
4290 [ --with-maildir=/path/to/mail Specify your system mail directory],
4291 [
4292 if test "X$withval" != X && test "x$withval" != xno && \
4293 test "x${withval}" != xyes; then
4294 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4295 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4296 fi
4297 ],[
4298 if test "X$maildir" != "X"; then
4299 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4300 else
4301 AC_MSG_CHECKING([Discovering system mail directory])
4302 AC_RUN_IFELSE(
4303 [AC_LANG_PROGRAM([[
4304#include <stdio.h>
4305#include <string.h>
4306#ifdef HAVE_PATHS_H
4307#include <paths.h>
4308#endif
4309#ifdef HAVE_MAILLOCK_H
4310#include <maillock.h>
4311#endif
4312#define DATA "conftest.maildir"
4313 ]], [[
4314 FILE *fd;
4315 int rc;
4316
4317 fd = fopen(DATA,"w");
4318 if(fd == NULL)
4319 exit(1);
4320
4321#if defined (_PATH_MAILDIR)
4322 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4323 exit(1);
4324#elif defined (MAILDIR)
4325 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4326 exit(1);
4327#elif defined (_PATH_MAIL)
4328 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4329 exit(1);
4330#else
4331 exit (2);
4332#endif
4333
4334 exit(0);
4335 ]])],
4336 [
Tim Ricee1d93702016-05-31 11:13:22 -07004337 maildir_what=`awk -F: '{print $1}' conftest.maildir`
Tim Rice90f42b02011-06-02 18:17:49 -07004338 maildir=`awk -F: '{print $2}' conftest.maildir \
4339 | sed 's|/$||'`
4340 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4341 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4342 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4343 fi
4344 ],
4345 [
4346 if test "X$ac_status" = "X2";then
4347# our test program didn't find it. Default to /var/spool/mail
4348 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4349 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4350 else
4351 AC_MSG_RESULT([*** not found ***])
4352 fi
4353 ],
4354 [
4355 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4356 ]
4357 )
4358 fi
4359 ]
4360) # maildir
Damien Miller3f905871999-11-15 17:10:57 +11004361
Darren Tucker623d92f2004-09-12 22:36:15 +10004362if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004363 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4364 disable_ptmx_check=yes
4365fi
Damien Millera22ba012000-03-02 23:09:20 +11004366if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004367 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004368 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004369 [
Tim Rice648f8762011-01-26 12:38:57 -08004370 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004371 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004372 have_dev_ptmx=1
4373 ]
4374 )
4375 fi
Damien Millera22ba012000-03-02 23:09:20 +11004376fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004377
Darren Tucker623d92f2004-09-12 22:36:15 +10004378if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004379 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004380 [
Tim Rice648f8762011-01-26 12:38:57 -08004381 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004382 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004383 have_dev_ptc=1
4384 ]
4385 )
4386else
4387 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4388fi
Damien Millera22ba012000-03-02 23:09:20 +11004389
4390# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004391AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004392 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004393 [
Damien Miller897741e2001-04-16 10:41:46 +10004394 case "$withval" in
4395 man|cat|doc)
4396 MANTYPE=$withval
4397 ;;
4398 *)
Tim Rice648f8762011-01-26 12:38:57 -08004399 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004400 ;;
4401 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004402 ]
4403)
Ben Lindstrombc709922001-04-18 18:04:21 +00004404if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004405 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004406 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004407 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4408 MANTYPE=doc
4409 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4410 MANTYPE=man
4411 else
4412 MANTYPE=cat
4413 fi
4414fi
Tim Rice648f8762011-01-26 12:38:57 -08004415AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004416if test "$MANTYPE" = "doc"; then
4417 mansubdir=man;
4418else
4419 mansubdir=$MANTYPE;
4420fi
Tim Rice648f8762011-01-26 12:38:57 -08004421AC_SUBST([mansubdir])
Damien Miller80297751999-11-19 13:03:25 +11004422
Damien Millera22ba012000-03-02 23:09:20 +11004423# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004424MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004425AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004426 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004427 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004428 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004429 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004430 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004431 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004432 fi
4433 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004434)
4435
Damien Millera22ba012000-03-02 23:09:20 +11004436# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004437AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004438 [ --without-shadow Disable shadow password support],
4439 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004440 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004441 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004442 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004443 fi
4444 ]
4445)
4446
Damien Miller1f335fb2000-06-26 11:31:33 +10004447if test -z "$disable_shadow" ; then
4448 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004449 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004450#include <sys/types.h>
4451#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004452struct spwd sp;
4453 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4454 [ sp_expire_available=yes ], [
4455 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004456
4457 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004458 AC_MSG_RESULT([yes])
4459 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004460 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004461 else
Tim Rice648f8762011-01-26 12:38:57 -08004462 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004463 fi
4464fi
4465
Damien Millera22ba012000-03-02 23:09:20 +11004466# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004467if test ! -z "$IPADDR_IN_DISPLAY" ; then
4468 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004469 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004470 [Define if you need to use IP address
4471 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004472else
Damien Millera8e06ce2003-11-21 23:48:55 +11004473 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004474 AC_ARG_WITH([ipaddr-display],
Tim Rice6397eed2015-06-03 21:41:11 -07004475 [ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY],
Damien Miller9a947342000-08-30 10:03:33 +11004476 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004477 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004478 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004479 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004480 fi
4481 ]
4482 )
4483fi
Damien Miller76112de1999-12-21 11:18:08 +11004484
Darren Tuckere1a790d2003-09-16 11:52:19 +10004485# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004486AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004487 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004488 [ if test "x$enableval" = "xno"; then
4489 AC_MSG_NOTICE([/etc/default/login handling disabled])
4490 etc_default_login=no
4491 else
4492 etc_default_login=yes
4493 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004494 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4495 then
4496 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4497 etc_default_login=no
4498 else
4499 etc_default_login=yes
4500 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004501)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004502
Darren Tucker2f9573d2005-02-10 22:28:54 +11004503if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004504 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004505 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004506 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004507 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004508 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004509 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004510fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004511
Tim Rice43a1c132002-04-17 21:19:14 -07004512dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004513if test $ac_cv_func_login_getcapbool = "yes" && \
4514 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004515 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004516fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004517
Damien Millera22ba012000-03-02 23:09:20 +11004518# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004519SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004520AC_ARG_WITH([default-path],
Tim Rice6397eed2015-06-03 21:41:11 -07004521 [ --with-default-path= Specify default $PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004522 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004523 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004524 AC_MSG_WARN([
4525--with-default-path=PATH has no effect on this system.
4526Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004527 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004528 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004529 AC_MSG_WARN([
4530--with-default-path=PATH will only be used if PATH is not defined in
4531$external_path_file .])
4532 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004533 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004534 SERVER_PATH_MSG="$withval"
Tim Rice59ea0a02001-03-10 13:50:45 -08004535 fi
4536 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004537 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4538 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004539 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004540 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004541 AC_MSG_WARN([
4542If PATH is defined in $external_path_file, ensure the path to scp is included,
4543otherwise scp will not work.])
4544 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004545 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004546 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004547/* find out what STDPATH is */
4548#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004549#ifdef HAVE_PATHS_H
4550# include <paths.h>
4551#endif
4552#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004553# ifdef _PATH_USERPATH /* Irix */
4554# define _PATH_STDPATH _PATH_USERPATH
4555# else
4556# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4557# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004558#endif
4559#include <sys/types.h>
4560#include <sys/stat.h>
4561#include <fcntl.h>
4562#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004563 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004564 FILE *fd;
4565 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004566
Tim Rice59ea0a02001-03-10 13:50:45 -08004567 fd = fopen(DATA,"w");
4568 if(fd == NULL)
4569 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004570
Tim Rice59ea0a02001-03-10 13:50:45 -08004571 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4572 exit(1);
4573
4574 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004575 ]])],
4576 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004577 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4578 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4579 )
4580# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004581 t_bindir="${bindir}"
4582 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4583 t_bindir=`eval echo ${t_bindir}`
4584 case $t_bindir in
4585 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4586 esac
4587 case $t_bindir in
4588 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4589 esac
4590 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004591 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4592 if test $? -ne 0 ; then
4593 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4594 if test $? -ne 0 ; then
4595 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004596 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004597 fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004598 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004599 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004600)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004601if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004602 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4603 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004604fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004605
Damien Millera18bbd32002-05-13 10:48:57 +10004606# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004607AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004608 [ --with-superuser-path= Specify different path for super-user],
4609 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004610 if test -n "$withval" && test "x$withval" != "xno" && \
4611 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004612 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004613 [Define if you want a different $PATH
4614 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004615 superuser_path=$withval
4616 fi
4617 ]
4618)
4619
4620
Damien Miller61e50f12000-05-08 20:49:37 +10004621AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004622IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004623AC_ARG_WITH(4in6,
4624 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4625 [
4626 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004627 AC_MSG_RESULT([yes])
4628 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004629 [Detect IPv4 in IPv6 mapped addresses
4630 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004631 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004632 else
Tim Rice648f8762011-01-26 12:38:57 -08004633 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004634 fi
Tim Rice648f8762011-01-26 12:38:57 -08004635 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004636 if test "x$inet6_default_4in6" = "xyes"; then
4637 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004638 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004639 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004640 else
4641 AC_MSG_RESULT([no (default)])
4642 fi
4643 ]
4644)
4645
Damien Miller60396b02001-02-18 17:01:00 +11004646# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004647BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004648AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004649 [ --with-bsd-auth Enable BSD auth support],
4650 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004651 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004652 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004653 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004654 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004655 fi
4656 ]
4657)
Damien Miller78315eb2000-09-29 23:01:36 +11004658
Damien Millera22ba012000-03-02 23:09:20 +11004659# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004660piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004661# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004662if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004663 piddir=`eval echo ${sysconfdir}`
4664 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004665 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004666 esac
4667fi
4668
Tim Rice648f8762011-01-26 12:38:57 -08004669AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004670 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4671 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004672 if test -n "$withval" && test "x$withval" != "xno" && \
4673 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004674 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004675 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004676 AC_MSG_WARN([** no $piddir directory on this system **])
4677 fi
4678 fi
4679 ]
4680)
4681
Tim Ricee1d93702016-05-31 11:13:22 -07004682AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
Tim Rice648f8762011-01-26 12:38:57 -08004683 [Specify location of ssh.pid])
4684AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004685
andre2ff7b5d2000-06-03 14:57:40 +00004686dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004687AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004688 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004689 [
4690 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004691 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004692 fi
4693 ]
andre2ff7b5d2000-06-03 14:57:40 +00004694)
Tim Rice648f8762011-01-26 12:38:57 -08004695AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004696 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004697 [
4698 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004699 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004700 fi
4701 ]
andre2ff7b5d2000-06-03 14:57:40 +00004702)
Tim Rice648f8762011-01-26 12:38:57 -08004703AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004704 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004705 [
4706 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004707 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004708 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004709 fi
4710 ]
andre2ff7b5d2000-06-03 14:57:40 +00004711)
Tim Rice648f8762011-01-26 12:38:57 -08004712AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004713 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004714 [
4715 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004716 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004717 fi
4718 ]
andre2ff7b5d2000-06-03 14:57:40 +00004719)
Tim Rice648f8762011-01-26 12:38:57 -08004720AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004721 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004722 [
4723 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004724 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004725 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004726 fi
4727 ]
andre2ff7b5d2000-06-03 14:57:40 +00004728)
Tim Rice648f8762011-01-26 12:38:57 -08004729AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004730 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004731 [
4732 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004733 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004734 fi
4735 ]
andre2ff7b5d2000-06-03 14:57:40 +00004736)
Tim Rice648f8762011-01-26 12:38:57 -08004737AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004738 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004739 [
4740 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004741 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004742 [Define if you don't want to use pututline()
4743 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004744 fi
4745 ]
andre2ff7b5d2000-06-03 14:57:40 +00004746)
Tim Rice648f8762011-01-26 12:38:57 -08004747AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004748 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004749 [
4750 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004751 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004752 [Define if you don't want to use pututxline()
4753 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004754 fi
4755 ]
andre2ff7b5d2000-06-03 14:57:40 +00004756)
Tim Rice648f8762011-01-26 12:38:57 -08004757AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004758 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004759 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004760 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004761 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004762 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004763 conf_lastlog_location=$withval
4764 fi
4765 ]
4766)
andre2ff7b5d2000-06-03 14:57:40 +00004767
4768dnl lastlog, [uw]tmpx? detection
4769dnl NOTE: set the paths in the platform section to avoid the
4770dnl need for command-line parameters
4771dnl lastlog and [uw]tmp are subject to a file search if all else fails
4772
4773dnl lastlog detection
4774dnl NOTE: the code itself will detect if lastlog is a directory
4775AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004776AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004777#include <sys/types.h>
4778#include <utmp.h>
4779#ifdef HAVE_LASTLOG_H
4780# include <lastlog.h>
4781#endif
Damien Miller2994e082000-06-04 15:51:47 +10004782#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004783# include <paths.h>
4784#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004785#ifdef HAVE_LOGIN_H
4786# include <login.h>
4787#endif
Tim Rice648f8762011-01-26 12:38:57 -08004788 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4789 [ AC_MSG_RESULT([yes]) ],
4790 [
4791 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004792 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004793 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004794#include <sys/types.h>
4795#include <utmp.h>
4796#ifdef HAVE_LASTLOG_H
4797# include <lastlog.h>
4798#endif
4799#ifdef HAVE_PATHS_H
4800# include <paths.h>
4801#endif
Tim Rice648f8762011-01-26 12:38:57 -08004802 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4803 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004804 [
Tim Rice648f8762011-01-26 12:38:57 -08004805 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004806 system_lastlog_path=no
4807 ])
Tim Rice648f8762011-01-26 12:38:57 -08004808])
Damien Miller2994e082000-06-04 15:51:47 +10004809
andre2ff7b5d2000-06-03 14:57:40 +00004810if test -z "$conf_lastlog_location"; then
4811 if test x"$system_lastlog_path" = x"no" ; then
4812 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004813 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004814 conf_lastlog_location=$f
4815 fi
4816 done
4817 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004818 AC_MSG_WARN([** Cannot find lastlog **])
4819 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004820 fi
4821 fi
4822fi
4823
4824if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004825 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004826 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004827fi
andre2ff7b5d2000-06-03 14:57:40 +00004828
4829dnl utmp detection
4830AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004831AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004832#include <sys/types.h>
4833#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004834#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004835# include <paths.h>
4836#endif
Tim Rice648f8762011-01-26 12:38:57 -08004837 ]], [[ char *utmp = UTMP_FILE; ]])],
4838 [ AC_MSG_RESULT([yes]) ],
4839 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07004840 system_utmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08004841])
andre2ff7b5d2000-06-03 14:57:40 +00004842if test -z "$conf_utmp_location"; then
4843 if test x"$system_utmp_path" = x"no" ; then
4844 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4845 if test -f $f ; then
4846 conf_utmp_location=$f
4847 fi
4848 done
4849 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004850 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004851 fi
4852 fi
4853fi
4854if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004855 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004856 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004857fi
andre2ff7b5d2000-06-03 14:57:40 +00004858
4859dnl wtmp detection
4860AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004861AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004862#include <sys/types.h>
4863#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004864#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004865# include <paths.h>
4866#endif
Tim Rice648f8762011-01-26 12:38:57 -08004867 ]], [[ char *wtmp = WTMP_FILE; ]])],
4868 [ AC_MSG_RESULT([yes]) ],
4869 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07004870 system_wtmp_path=no
Tim Rice648f8762011-01-26 12:38:57 -08004871])
andre2ff7b5d2000-06-03 14:57:40 +00004872if test -z "$conf_wtmp_location"; then
4873 if test x"$system_wtmp_path" = x"no" ; then
4874 for f in /usr/adm/wtmp /var/log/wtmp; do
4875 if test -f $f ; then
4876 conf_wtmp_location=$f
4877 fi
4878 done
4879 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004880 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004881 fi
4882 fi
4883fi
4884if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004885 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004886 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004887fi
andre2ff7b5d2000-06-03 14:57:40 +00004888
andre2ff7b5d2000-06-03 14:57:40 +00004889dnl wtmpx detection
4890AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004891AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004892#include <sys/types.h>
4893#include <utmp.h>
4894#ifdef HAVE_UTMPX_H
4895#include <utmpx.h>
4896#endif
Damien Miller2994e082000-06-04 15:51:47 +10004897#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004898# include <paths.h>
4899#endif
Tim Rice648f8762011-01-26 12:38:57 -08004900 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4901 [ AC_MSG_RESULT([yes]) ],
4902 [ AC_MSG_RESULT([no])
Tim Ricee1d93702016-05-31 11:13:22 -07004903 system_wtmpx_path=no
Tim Rice648f8762011-01-26 12:38:57 -08004904])
andre2ff7b5d2000-06-03 14:57:40 +00004905if test -z "$conf_wtmpx_location"; then
4906 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004907 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004908 fi
4909else
Tim Rice648f8762011-01-26 12:38:57 -08004910 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004911 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004912fi
andre2ff7b5d2000-06-03 14:57:40 +00004913
Damien Miller4018c192000-04-30 09:30:44 +10004914
Damien Miller29ea30d2000-03-17 10:54:15 +11004915if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004916 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4917 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Tim Rice4cec93f2002-02-26 08:40:48 -08004918fi
4919
Damien Millera2438bb2013-03-15 10:23:07 +11004920AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004921 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004922 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004923 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004924 ], [
4925#ifdef HAVE_SYS_TYPES_H
4926#include <sys/types.h>
4927#endif
4928#ifdef HAVE_UTMP_H
4929#include <utmp.h>
4930#endif
4931#ifdef HAVE_UTMPX_H
4932#include <utmpx.h>
4933#endif
4934#ifdef HAVE_LASTLOG_H
4935#include <lastlog.h>
4936#endif
4937 ])
4938
4939AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4940 AC_DEFINE([DISABLE_UTMP])
4941 AC_DEFINE([DISABLE_WTMP])
4942 ], [
4943#ifdef HAVE_SYS_TYPES_H
4944#include <sys/types.h>
4945#endif
4946#ifdef HAVE_UTMP_H
4947#include <utmp.h>
4948#endif
4949#ifdef HAVE_UTMPX_H
4950#include <utmpx.h>
4951#endif
4952#ifdef HAVE_LASTLOG_H
4953#include <lastlog.h>
4954#endif
4955 ])
4956
Darren Tucker7da23cb2005-08-03 00:20:15 +10004957dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4958dnl Add now.
4959CFLAGS="$CFLAGS $werror_flags"
4960
Darren Tucker627337d2010-04-10 22:58:01 +10004961if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4962 TEST_SSH_IPV6=no
4963else
4964 TEST_SSH_IPV6=yes
4965fi
Tim Rice648f8762011-01-26 12:38:57 -08004966AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4967AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker882abfd2013-11-09 00:17:41 +11004968AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10004969AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Damien Miller7ea845e2010-02-12 09:21:02 +11004970
Damien Millerbac2d8a2000-09-05 16:13:06 +11004971AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004972AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4973 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004974 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004975AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004976
Damien Miller7b22d652000-06-18 14:07:04 +10004977# Print summary of options
Damien Miller7b22d652000-06-18 14:07:04 +10004978
4979# Someone please show me a better way :)
4980A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4981B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4982C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4983D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004984E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004985F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004986G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004987H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4988I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4989J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004990
4991echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004992echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004993echo " User binaries: $B"
4994echo " System binaries: $C"
4995echo " Configuration files: $D"
4996echo " Askpass program: $E"
4997echo " Manual pages: $F"
4998echo " PID file: $G"
4999echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10005000if test "x$external_path_file" = "x/etc/login.conf" ; then
5001echo " At runtime, sshd will use the path defined in $external_path_file"
5002echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07005003else
Damien Millerf58c6722002-05-13 13:15:42 +10005004echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07005005 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10005006echo " (If PATH is set in $external_path_file it will be used instead. If"
5007echo " used, ensure the path to scp is present, otherwise scp will not work.)"
5008 fi
Tim Rice43a1c132002-04-17 21:19:14 -07005009fi
Damien Millera18bbd32002-05-13 10:48:57 +10005010if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10005011echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10005012fi
Damien Millerf58c6722002-05-13 13:15:42 +10005013echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10005014echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005015echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005016echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10005017echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005018echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005019echo " S/KEY support: $SKEY_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005020echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11005021echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10005022echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11005023echo " Solaris project support: $SP_MSG"
Damien Miller4626cba2016-01-08 14:24:56 +11005024echo " Solaris privilege support: $SPP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10005025echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10005026echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
5027echo " BSD Auth support: $BSD_AUTH_MSG"
5028echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10005029echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11005030
Damien Miller7b22d652000-06-18 14:07:04 +10005031echo ""
5032
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00005033echo " Host: ${host}"
5034echo " Compiler: ${CC}"
5035echo " Compiler flags: ${CFLAGS}"
5036echo "Preprocessor flags: ${CPPFLAGS}"
5037echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10005038echo " Libraries: ${LIBS}"
5039if test ! -z "${SSHDLIBS}"; then
5040echo " +for sshd: ${SSHDLIBS}"
5041fi
Damien Miller71adf122011-01-25 12:16:15 +11005042if test ! -z "${SSHLIBS}"; then
5043echo " +for ssh: ${SSHLIBS}"
5044fi
Damien Miller7b22d652000-06-18 14:07:04 +10005045
5046echo ""
5047
Tim Rice6f1f7582004-05-30 21:38:51 -07005048if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10005049 echo "SVR4 style packages are supported with \"make package\""
5050 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07005051fi
5052
Damien Miller82cf0ce2000-12-20 13:34:48 +11005053if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11005054 echo "PAM is enabled. You may need to install a PAM control file "
5055 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11005056 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11005057 echo "subdirectory"
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00005058 echo ""
5059fi
Damien Miller60396b02001-02-18 17:01:00 +11005060
Damien Millerb4097182004-05-23 14:09:40 +10005061if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11005062 echo "WARNING: the operating system that you are using does not"
5063 echo "appear to support getpeereid(), getpeerucred() or the"
5064 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
5065 echo "enforce security checks to prevent unauthorised connections to"
5066 echo "ssh-agent. Their absence increases the risk that a malicious"
5067 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10005068 echo ""
5069fi
5070
Darren Tuckerd9f88912005-02-20 21:01:48 +11005071if test "$AUDIT_MODULE" = "bsm" ; then
5072 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
5073 echo "See the Solaris section in README.platform for details."
5074fi