blob: 4f40afce3d4981ac252c12a1d59ae3df09cf8109 [file] [log] [blame]
Darren Tucker6d725682014-01-17 19:17:34 +11001# $Id: configure.ac,v 1.553 2014/01/17 08:17:35 dtucker 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])
Darren Tucker6d725682014-01-17 19:17:34 +110018AC_REVISION($Revision: 1.553 $)
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
Tim Rice648f8762011-01-26 12:38:57 -080033AC_PATH_PROG([AR], [ar])
34AC_PATH_PROG([CAT], [cat])
35AC_PATH_PROG([KILL], [kill])
36AC_PATH_PROGS([PERL], [perl5 perl])
37AC_PATH_PROG([SED], [sed])
38AC_SUBST([PERL])
39AC_PATH_PROG([ENT], [ent])
40AC_SUBST([ENT])
41AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
42AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
43AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
44AC_PATH_PROG([SH], [sh])
45AC_PATH_PROG([GROFF], [groff])
46AC_PATH_PROG([NROFF], [nroff])
47AC_PATH_PROG([MANDOC], [mandoc])
48AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110049
Damien Miller30a69e72011-01-04 08:16:27 +110050dnl select manpage formatter
51if test "x$MANDOC" != "x" ; then
52 MANFMT="$MANDOC"
53elif test "x$NROFF" != "x" ; then
54 MANFMT="$NROFF -mandoc"
55elif test "x$GROFF" != "x" ; then
56 MANFMT="$GROFF -mandoc -Tascii"
57else
58 AC_MSG_WARN([no manpage formatted found])
59 MANFMT="false"
60fi
Tim Rice648f8762011-01-26 12:38:57 -080061AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110062
Tim Rice6f1f7582004-05-30 21:38:51 -070063dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080064AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070065 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080066AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070067 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080068AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110069if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080070 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110071else
Tim Rice648f8762011-01-26 12:38:57 -080072 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110073fi
Tim Rice6f1f7582004-05-30 21:38:51 -070074
Damien Millere8bb4502001-09-25 16:39:35 +100075# System features
76AC_SYS_LARGEFILE
77
Damien Miller3f62aba2000-11-29 11:56:35 +110078if test -z "$AR" ; then
79 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
80fi
81
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>
122])
Damien Miller868ea1e2014-01-17 16:47:04 +1100123AC_CHECK_DECL([cap_enter], [have_cap_enter=1], , [
124 #include <sys/capability.h>
125])
126
Darren Tuckerb7918af2008-03-09 11:34:23 +1100127use_stack_protector=1
Darren Tuckerfd994372014-01-17 09:53:24 +1100128use_toolchain_hardening=1
Tim Rice648f8762011-01-26 12:38:57 -0800129AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100130 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100131 if test "x$withval" = "xno"; then
132 use_stack_protector=0
133 fi ])
Darren Tuckerfd994372014-01-17 09:53:24 +1100134AC_ARG_WITH([hardening],
135 [ --without-hardening Don't use toolchain hardening flags], [
136 if test "x$withval" = "xno"; then
137 use_stack_protector=0
138 use_toolchain_hardening=0
139 fi ])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100140
Darren Tuckerfd994372014-01-17 09:53:24 +1100141# We use -Werror for the tests only so that we catch warnings like "this is
142# on by default" for things like -fPIE.
143AC_MSG_CHECKING([if $CC supports -Werror])
144saved_CFLAGS="$CFLAGS"
145CFLAGS="$CFLAGS -Werror"
146AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])],
147 [ AC_MSG_RESULT([yes])
148 WERROR="-Werror"],
149 [ AC_MSG_RESULT([no])
150 WERROR="" ]
151)
152CFLAGS="$saved_CFLAGS"
Damien Miller134d02a2011-01-12 16:00:37 +1100153
Damien Millera8e06ce2003-11-21 23:48:55 +1100154if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100155 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
156 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option])
Damien Millerb1763622011-05-20 11:45:25 +1000157 OSSH_CHECK_CFLAG_COMPILE([-Wall])
158 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
159 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
160 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
161 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000162 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000163 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
164 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
165 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100166 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Darren Tuckerfd994372014-01-17 09:53:24 +1100167 if test "x$use_toolchain_hardening" = "x1"; then
168 OSSH_CHECK_CFLAG_COMPILE([-ftrapv])
169 OSSH_CHECK_CFLAG_COMPILE([-fPIE])
170 OSSH_CHECK_LDFLAG_LINK([-pie])
171 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro])
172 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now])
173 OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack])
174 fi
Tim Rice648f8762011-01-26 12:38:57 -0800175 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100176 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700177 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000178 1.*) no_attrib_nonnull=1 ;;
179 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000180 no_attrib_nonnull=1
181 ;;
182 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100183 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700184 esac
Tim Rice648f8762011-01-26 12:38:57 -0800185 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000186
Tim Rice648f8762011-01-26 12:38:57 -0800187 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000188 saved_CFLAGS="$CFLAGS"
189 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800190 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
191 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
192 [ AC_MSG_RESULT([yes]) ],
193 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000194 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800195 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000196
Darren Tuckerb7918af2008-03-09 11:34:23 +1100197 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100198 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100199 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100200 if test "x$use_stack_protector" = "x1"; then
Darren Tuckerfd994372014-01-17 09:53:24 +1100201 for t in -fstack-protector-strong -fstack-protector-all \
202 -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800203 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100204 saved_CFLAGS="$CFLAGS"
205 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100206 CFLAGS="$CFLAGS $t -Werror"
207 LDFLAGS="$LDFLAGS $t -Werror"
208 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800209 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
210 [[
211 char x[256];
212 snprintf(x, sizeof(x), "XXX");
213 ]])],
214 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100215 CFLAGS="$saved_CFLAGS $t"
216 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800217 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100218 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800219 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
220 [[
221 char x[256];
222 snprintf(x, sizeof(x), "XXX");
223 ]])],
224 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100225 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800226 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100227 [ AC_MSG_WARN([cross compiling: cannot test])
228 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100229 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100230 ],
Tim Rice648f8762011-01-26 12:38:57 -0800231 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100232 )
233 CFLAGS="$saved_CFLAGS"
234 LDFLAGS="$saved_LDFLAGS"
235 done
236 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100237
Darren Tucker67b37032005-06-03 17:58:31 +1000238 if test -z "$have_llong_max"; then
239 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
240 unset ac_cv_have_decl_LLONG_MAX
241 saved_CFLAGS="$CFLAGS"
242 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800243 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000244 [have_llong_max=1],
245 [CFLAGS="$saved_CFLAGS"],
246 [#include <limits.h>]
247 )
248 fi
Damien Miller166bd442000-03-16 10:48:25 +1100249fi
250
Darren Tucker951b53b2013-02-08 11:50:09 +1100251AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
252AC_COMPILE_IFELSE(
253 [AC_LANG_PROGRAM([[
254#include <stdlib.h>
255__attribute__((__unused__)) static void foo(void){return;}]],
256 [[ exit(0); ]])],
257 [ AC_MSG_RESULT([yes]) ],
258 [ AC_MSG_RESULT([no])
259 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
260 [compiler does not accept __attribute__ on return types]) ]
261)
262
Darren Tucker391de5c2007-04-29 14:49:21 +1000263if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800264 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000265fi
266
Tim Rice648f8762011-01-26 12:38:57 -0800267AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800268 [ --without-rpath Disable auto-added -R linker paths],
269 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800270 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800271 need_dash_r=""
272 fi
273 if test "x$withval" = "xyes" ; then
274 need_dash_r=1
275 fi
276 ]
277)
278
Tim Rice1cfab232006-10-03 09:34:35 -0700279# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800280AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700281 [ --with-cflags Specify additional flags to pass to compiler],
282 [
283 if test -n "$withval" && test "x$withval" != "xno" && \
284 test "x${withval}" != "xyes"; then
285 CFLAGS="$CFLAGS $withval"
286 fi
287 ]
288)
Tim Rice648f8762011-01-26 12:38:57 -0800289AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700290 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
291 [
292 if test -n "$withval" && test "x$withval" != "xno" && \
293 test "x${withval}" != "xyes"; then
294 CPPFLAGS="$CPPFLAGS $withval"
295 fi
296 ]
297)
Tim Rice648f8762011-01-26 12:38:57 -0800298AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700299 [ --with-ldflags Specify additional flags to pass to linker],
300 [
301 if test -n "$withval" && test "x$withval" != "xno" && \
302 test "x${withval}" != "xyes"; then
303 LDFLAGS="$LDFLAGS $withval"
304 fi
305 ]
306)
Tim Rice648f8762011-01-26 12:38:57 -0800307AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700308 [ --with-libs Specify additional libraries to link with],
309 [
310 if test -n "$withval" && test "x$withval" != "xno" && \
311 test "x${withval}" != "xyes"; then
312 LIBS="$LIBS $withval"
313 fi
314 ]
315)
Tim Rice648f8762011-01-26 12:38:57 -0800316AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700317 [ --with-Werror Build main code with -Werror],
318 [
319 if test -n "$withval" && test "x$withval" != "xno"; then
320 werror_flags="-Werror"
321 if test "x${withval}" != "xyes"; then
322 werror_flags="$withval"
323 fi
324 fi
325 ]
326)
327
Tim Rice648f8762011-01-26 12:38:57 -0800328AC_CHECK_HEADERS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +1100329 blf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700330 bstring.h \
331 crypt.h \
332 crypto/sha2.h \
333 dirent.h \
334 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100335 elf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700336 features.h \
337 fcntl.h \
338 floatingpoint.h \
339 getopt.h \
340 glob.h \
341 ia.h \
342 iaf.h \
Darren Tucker6d725682014-01-17 19:17:34 +1100343 inttypes.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700344 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000345 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700346 login.h \
347 maillock.h \
348 ndir.h \
349 net/if_tun.h \
350 netdb.h \
351 netgroup.h \
352 pam/pam_appl.h \
353 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000354 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700355 pty.h \
356 readpassphrase.h \
357 rpc/types.h \
358 security/pam_appl.h \
359 sha2.h \
360 shadow.h \
361 stddef.h \
362 stdint.h \
363 string.h \
364 strings.h \
365 sys/audit.h \
366 sys/bitypes.h \
367 sys/bsdtty.h \
368 sys/cdefs.h \
369 sys/dir.h \
370 sys/mman.h \
371 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000372 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700373 sys/prctl.h \
374 sys/pstat.h \
375 sys/select.h \
376 sys/stat.h \
377 sys/stream.h \
378 sys/stropts.h \
379 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000380 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700381 sys/sysmacros.h \
382 sys/time.h \
383 sys/timers.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700384 time.h \
385 tmpdir.h \
386 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700387 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700388 unistd.h \
389 usersec.h \
390 util.h \
391 utime.h \
392 utmp.h \
393 utmpx.h \
394 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800395])
Tim Rice1cfab232006-10-03 09:34:35 -0700396
397# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800398AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700399#ifdef HAVE_SYS_TIME_H
400# include <sys/time.h>
401#endif
402])
403
404# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800405AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700406#ifdef HAVE_SYS_STREAM_H
407# include <sys/stream.h>
408#endif
409])
410
411# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800412AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700413#include <sys/types.h>
414])
415
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000416# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800417AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000418#include <sys/param.h>
419])
420
Darren Tuckeref4901c2013-06-03 01:59:13 +1000421# Android requires sys/socket.h to be included before sys/un.h
422AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000423#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000424#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000425])
426
Damien Miller1b06dc32006-08-31 03:24:41 +1000427# Messages for features tested for in target-specific section
428SIA_MSG="no"
429SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100430SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000431
Damien Millera22ba012000-03-02 23:09:20 +1100432# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100433case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100434*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000435 # Some versions of VAC won't allow macro redefinitions at
436 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
437 # particularly with older versions of vac or xlc.
438 # It also throws errors about null macro argments, but these are
439 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800440 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000441 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800442 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000443#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800444#define testmacro bar]],
445 [[ exit(0); ]])],
446 [ AC_MSG_RESULT([yes]) ],
447 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000448 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
449 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
450 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
451 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
452 ]
453 )
454
Damien Millera8e06ce2003-11-21 23:48:55 +1100455 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000456 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800457 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100458 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000459 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000460 if test "$GCC" = "yes"; then
461 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
462 else
463 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
464 fi
465 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000466 if (test -z "$blibflags"); then
467 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800468 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
469 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000470 fi
471 done
472 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800473 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000474 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
475 else
Tim Rice648f8762011-01-26 12:38:57 -0800476 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000477 fi
478 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000479 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800480 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700481 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800482 [AC_CHECK_LIB([s], [authenticate],
483 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700484 LIBS="$LIBS -ls"
485 ])
486 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100487 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100488 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100489 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000490 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800491 AC_CHECK_DECLS([loginfailed],
492 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
494 [[ (void)loginfailed("user","host","tty",0); ]])],
495 [AC_MSG_RESULT([yes])
496 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
497 [Define if your AIX loginfailed() function
498 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
499 ])],
500 [],
501 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000502 )
Tim Rice648f8762011-01-26 12:38:57 -0800503 AC_CHECK_FUNCS([getgrset setauthdb])
504 AC_CHECK_DECL([F_CLOSEM],
505 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000506 [],
507 [ #include <limits.h>
508 #include <fcntl.h> ]
509 )
Darren Tucker691d5232005-02-15 21:45:57 +1100510 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800511 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
512 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700513 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800514 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
515 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000516 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800517 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
518 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700519 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800520 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700521 [Define to a Set Process Title type if your system is
522 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800523 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100524 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800525 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100526 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100527 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000528*-*-android*)
529 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
530 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
531 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100532*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100533 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100534 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800535 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
536 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
537 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700538 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800539 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700540 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800541 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700542 [Define if the concept of ports only accessible to
543 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800544 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700545 [Define if your platform needs to skip post auth
546 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800547 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
548 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100549 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000550*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800551 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700552 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800553 AC_DEFINE([SETEUID_BREAKS_SETUID])
554 AC_DEFINE([BROKEN_SETREUID])
555 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000556 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000557*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800558 AC_MSG_CHECKING([if we have working getaddrinfo])
559 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000560main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
561 exit(0);
562 else
563 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800564}
565 ]])],
566 [AC_MSG_RESULT([working])],
567 [AC_MSG_RESULT([buggy])
568 AC_DEFINE([BROKEN_GETADDRINFO], [1],
569 [getaddrinfo is broken (if present)])
570 ],
571 [AC_MSG_RESULT([assume it is working])])
572 AC_DEFINE([SETEUID_BREAKS_SETUID])
573 AC_DEFINE([BROKEN_SETREUID])
574 AC_DEFINE([BROKEN_SETREGID])
575 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
576 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700577 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800578 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
579 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000580 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800581 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000582 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800583 m4_pattern_allow([AU_IPv])
584 AC_CHECK_DECL([AU_IPv4], [],
585 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100586 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800587 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100588 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100589 )
Damien Millerc09182f2011-06-03 12:11:38 +1000590 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
591 [Define to a Set Process Title type if your system is
592 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000593 AC_CHECK_FUNCS([sandbox_init])
594 AC_CHECK_HEADERS([sandbox.h])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000595 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000596*-*-dragonfly*)
597 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100598 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000599 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100600*-*-haiku*)
601 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800602 AC_CHECK_LIB([network], [socket])
603 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100604 MANTYPE=man
605 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000606*-*-hpux*)
607 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000608 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100609 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800610 AC_DEFINE([USE_PIPES])
611 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700612 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800613 AC_DEFINE([LOGIN_NEEDS_UTMPX])
614 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700615 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800616 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100617 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700618 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700619 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800620 AC_CHECK_LIB([xnet], [t_error], ,
621 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000622
623 # next, we define all of the options specific to major releases
624 case "$host" in
625 *-*-hpux10*)
626 if test -z "$GCC"; then
627 CFLAGS="$CFLAGS -Ae"
628 fi
629 ;;
630 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800631 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700632 [Define if you are using Solaris-derived PAM which
633 passes pam_messages to the conversation function
634 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800635 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700636 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800637 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000638 check_for_hpux_broken_getaddrinfo=1
639 check_for_conflicting_getspnam=1
640 ;;
641 esac
642
643 # lastly, we define options specific to minor releases
644 case "$host" in
645 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800646 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700647 [Define if you have SecureWare-based
648 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000649 disable_ptmx_check=yes
650 LIBS="$LIBS -lsecpw"
651 ;;
652 esac
Damien Miller1bead332000-04-30 00:47:29 +1000653 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100654*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100655 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800656 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700657 [Define if you system's inet_ntoa is busted
658 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800659 AC_DEFINE([SETEUID_BREAKS_SETUID])
660 AC_DEFINE([BROKEN_SETREUID])
661 AC_DEFINE([BROKEN_SETREGID])
662 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700663 [Define if you shouldn't strip 'tty' from your
664 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100666 ;;
667*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100668 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800669 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700670 [Define if you have/want arrays
671 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800672 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700673 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800674 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700675 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800676 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700677 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800678 AC_DEFINE([BROKEN_INET_NTOA])
679 AC_DEFINE([SETEUID_BREAKS_SETUID])
680 AC_DEFINE([BROKEN_SETREUID])
681 AC_DEFINE([BROKEN_SETREGID])
682 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
683 AC_DEFINE([WITH_ABBREV_NO_TTY])
684 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100685 ;;
Damien Miller90551722009-02-16 15:37:03 +1100686*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
687 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800688 AC_DEFINE([PAM_TTY_KLUDGE])
689 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
690 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
691 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
692 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100693 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100694*-*-linux*)
695 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100696 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000697 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800698 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700699 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800700 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700701 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800702 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
703 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700704 [Define to whatever link() returns for "not supported"
705 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800706 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
707 AC_DEFINE([USE_BTMP])
708 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100709 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000710 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000711 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800712 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700713 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000714 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000715 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100716 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100718 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800719 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100720 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800721 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100722 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800723 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100724 [Prepend the address family to IP tunnel traffic])
725 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000726 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
727 [], [#include <linux/types.h>])
Damien Millere0956e32012-04-04 11:27:54 +1000728 AC_CHECK_FUNCS([prctl])
Damien Miller91f40d82013-02-22 11:37:00 +1100729 AC_MSG_CHECKING([for seccomp architecture])
730 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000731 case "$host" in
732 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100733 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000734 ;;
735 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100736 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000737 ;;
Damien Miller91f40d82013-02-22 11:37:00 +1100738 arm*-*)
739 seccomp_audit_arch=AUDIT_ARCH_ARM
740 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000741 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100742 if test "x$seccomp_audit_arch" != "x" ; then
743 AC_MSG_RESULT(["$seccomp_audit_arch"])
744 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
745 [Specify the system call convention in use])
746 else
747 AC_MSG_RESULT([architecture not supported])
748 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100749 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000750mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800751 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000752 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000753 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100754*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000755 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800756 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800757 need_dash_r=1
758 fi
Tim Rice648f8762011-01-26 12:38:57 -0800759 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100760 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800761 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
762 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100763 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100764 TEST_MALLOC_OPTIONS="AJRX"
Damien Milleree1c0b32000-01-21 00:18:15 +1100765 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100766*-*-freebsd*)
767 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
769 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100770 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800771 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
772 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100773 AC_DEFINE([BROKEN_STRNVIS], [1], [FreeBSD strnvis does not do what we need])
774 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerfbd884a2001-02-27 08:39:07 +1100775 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000776*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800777 AC_DEFINE([SETEUID_BREAKS_SETUID])
778 AC_DEFINE([BROKEN_SETREUID])
779 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000780 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000781*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000782 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100783 conf_utmp_location=/etc/utmp
784 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700785 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800786 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
787 AC_DEFINE([BROKEN_REALPATH])
788 AC_DEFINE([USE_PIPES])
789 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000790 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000791*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800792 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
793 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
794 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
795 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000796 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100797 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000798 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100799*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800800 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800801 need_dash_r=1
802 fi
Tim Rice648f8762011-01-26 12:38:57 -0800803 AC_DEFINE([PAM_SUN_CODEBASE])
804 AC_DEFINE([LOGIN_NEEDS_UTMPX])
805 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700806 [Some versions of /bin/login need the TERM supplied
807 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800808 AC_DEFINE([PAM_TTY_KLUDGE])
809 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700810 [Define if pam_chauthtok wants real uid set
811 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800812 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000813 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800814 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700815 [Define if sshd somehow reacquires a controlling TTY
816 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800817 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000818 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800819 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000820 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000821 # hardwire lastlog location (can't detect it on some versions)
822 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800823 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000824 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
825 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800826 AC_MSG_RESULT([yes])
827 AC_DEFINE([DISABLE_UTMP])
828 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700829 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000830 else
Tim Rice648f8762011-01-26 12:38:57 -0800831 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000832 fi
Tim Rice648f8762011-01-26 12:38:57 -0800833 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000834 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
835 [
Tim Rice648f8762011-01-26 12:38:57 -0800836 AC_CHECK_LIB([contract], [ct_tmpl_activate],
837 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000838 [Define if you have Solaris process contracts])
839 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000840 SPC_MSG="yes" ], )
841 ],
842 )
Tim Rice648f8762011-01-26 12:38:57 -0800843 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100844 [ --with-solaris-projects Enable Solaris projects (experimental)],
845 [
Tim Rice648f8762011-01-26 12:38:57 -0800846 AC_CHECK_LIB([project], [setproject],
847 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100848 [Define if you have Solaris projects])
849 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100850 SP_MSG="yes" ], )
851 ],
852 )
Tim Rice5ab9b632013-06-02 14:05:48 -0700853 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +1100854 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000855*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000856 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800857 AC_CHECK_FUNCS([getpwanam])
858 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000859 conf_utmp_location=/etc/utmp
860 conf_wtmp_location=/var/adm/wtmp
861 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800862 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000863 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000864*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700865 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800866 AC_DEFINE([USE_PIPES])
867 AC_DEFINE([SSHD_ACQUIRES_CTTY])
868 AC_DEFINE([SETEUID_BREAKS_SETUID])
869 AC_DEFINE([BROKEN_SETREUID])
870 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000871 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000872*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700873 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800874 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100875 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800876 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100877 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800878 AC_DEFINE([USE_PIPES])
879 AC_DEFINE([IP_TOS_IS_BROKEN])
880 AC_DEFINE([SETEUID_BREAKS_SETUID])
881 AC_DEFINE([BROKEN_SETREUID])
882 AC_DEFINE([BROKEN_SETREGID])
883 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000884 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700885 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
886 # Attention: always take care to bind libsocket and libnsl before libc,
887 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000888 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800889# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100890*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800891 AC_DEFINE([USE_PIPES])
892 AC_DEFINE([SETEUID_BREAKS_SETUID])
893 AC_DEFINE([BROKEN_SETREUID])
894 AC_DEFINE([BROKEN_SETREGID])
895 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
896 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -0700897 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +1100898 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800899# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100900*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800901 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800902 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
903 AC_DEFINE([USE_PIPES])
904 AC_DEFINE([SETEUID_BREAKS_SETUID])
905 AC_DEFINE([BROKEN_GETADDRINFO])
906 AC_DEFINE([BROKEN_SETREUID])
907 AC_DEFINE([BROKEN_SETREGID])
908 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice5ab9b632013-06-02 14:05:48 -0700909 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4dbacff2005-06-01 20:09:28 -0700910 case "$host" in
911 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700912 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800913 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700914 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800915 AC_DEFINE([BROKEN_UPDWTMPX])
916 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
917 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
918 AC_DEFINE([HAVE_SECUREWARE])
919 AC_DEFINE([DISABLE_SHADOW])
920 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700921 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800922 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800923 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800924 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700925 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100926 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100927*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100928 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800929# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100930*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800931 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100932 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800933# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100934*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800935 if test -z "$GCC"; then
936 CFLAGS="$CFLAGS -belf"
937 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100938 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000939 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800940 AC_DEFINE([USE_PIPES])
941 AC_DEFINE([HAVE_SECUREWARE])
942 AC_DEFINE([DISABLE_SHADOW])
943 AC_DEFINE([DISABLE_FD_PASSING])
944 AC_DEFINE([SETEUID_BREAKS_SETUID])
945 AC_DEFINE([BROKEN_GETADDRINFO])
946 AC_DEFINE([BROKEN_SETREUID])
947 AC_DEFINE([BROKEN_SETREGID])
948 AC_DEFINE([WITH_ABBREV_NO_TTY])
949 AC_DEFINE([BROKEN_UPDWTMPX])
950 AC_DEFINE([PASSWD_NEEDS_USERNAME])
951 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700952 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -0700953 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -0700954 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +1000955 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000956*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800957 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700958 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800959 AC_DEFINE([SETEUID_BREAKS_SETUID])
960 AC_DEFINE([BROKEN_SETREUID])
961 AC_DEFINE([BROKEN_SETREGID])
962 AC_DEFINE([USE_PIPES])
963 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000964 LDFLAGS="$LDFLAGS"
965 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
966 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000967 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000968*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800969 AC_DEFINE([SETEUID_BREAKS_SETUID])
970 AC_DEFINE([BROKEN_SETREUID])
971 AC_DEFINE([BROKEN_SETREGID])
972 AC_DEFINE([WITH_ABBREV_NO_TTY])
973 AC_DEFINE([USE_PIPES])
974 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000975 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100976 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000977 MANTYPE=cat
978 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000979*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800980 AC_DEFINE([SETEUID_BREAKS_SETUID])
981 AC_DEFINE([BROKEN_SETREUID])
982 AC_DEFINE([BROKEN_SETREGID])
983 AC_DEFINE([USE_PIPES])
984 AC_DEFINE([DISABLE_FD_PASSING])
985 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000986 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
987 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
988 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700989 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000990*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800991 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000992 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800993 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000994 [ --with-osfsia Enable Digital Unix SIA],
995 [
996 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800997 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000998 no_osfsia=1
999 fi
1000 ],
1001 )
1002 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +10001003 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -08001004 AC_MSG_RESULT([yes])
1005 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001006 [Define if you have Digital Unix Security
1007 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -08001008 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001009 [Define if you don't want to use your
1010 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -08001011 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +10001012 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +10001013 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +10001014 else
Tim Rice648f8762011-01-26 12:38:57 -08001015 AC_MSG_RESULT([no])
1016 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -07001017 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +10001018 fi
1019 fi
Tim Rice648f8762011-01-26 12:38:57 -08001020 AC_DEFINE([BROKEN_GETADDRINFO])
1021 AC_DEFINE([SETEUID_BREAKS_SETUID])
1022 AC_DEFINE([BROKEN_SETREUID])
1023 AC_DEFINE([BROKEN_SETREGID])
1024 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +10001025 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001026
Tim Rice70335a62006-02-04 17:42:58 -08001027*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -08001028 AC_DEFINE([USE_PIPES])
1029 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -08001030 AC_DEFINE([DISABLE_LASTLOG])
1031 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1032 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001033 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001034 case "$host" in
1035 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001036 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001037 ;;
1038 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001039 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001040
1041*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001042 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
1043 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
1044 AC_DEFINE([NEED_SETPGRP])
1045 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001046 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001047
1048*-*-lynxos)
1049 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001050 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001051 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001052esac
1053
Tim Rice648f8762011-01-26 12:38:57 -08001054AC_MSG_CHECKING([compiler and flags for sanity])
1055AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1056 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001057 [
Tim Rice648f8762011-01-26 12:38:57 -08001058 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001059 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001060 ],
1061 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001062)
1063
Darren Tucker0c9653f2005-05-28 15:58:14 +10001064dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001065# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001066AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
1067AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001068
Tim Rice1e1ef642003-09-11 22:19:31 -07001069dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001070AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1071 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001072 AC_CACHE_CHECK([for broken dirname],
1073 ac_cv_have_broken_dirname, [
1074 save_LIBS="$LIBS"
1075 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001076 AC_RUN_IFELSE(
1077 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001078#include <libgen.h>
1079#include <string.h>
1080
1081int main(int argc, char **argv) {
1082 char *s, buf[32];
1083
1084 strncpy(buf,"/etc", 32);
1085 s = dirname(buf);
1086 if (!s || strncmp(s, "/", 32) != 0) {
1087 exit(1);
1088 } else {
1089 exit(0);
1090 }
1091}
Darren Tucker314d89e2005-10-17 23:29:23 +10001092 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001093 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001094 [ ac_cv_have_broken_dirname="yes" ],
1095 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001096 )
1097 LIBS="$save_LIBS"
1098 ])
1099 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1100 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001101 AC_DEFINE([HAVE_DIRNAME])
1102 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001103 fi
1104 ])
1105])
1106
Tim Rice648f8762011-01-26 12:38:57 -08001107AC_CHECK_FUNC([getspnam], ,
1108 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1109AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1110 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001111
Tim Rice13aae5e2001-10-21 17:53:58 -07001112dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001113AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001114 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001115 [ if test "x$withval" = "xno" ; then
1116 AC_MSG_ERROR([*** zlib is required ***])
1117 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001118 if test -d "$withval/lib"; then
1119 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001120 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001121 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001122 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001123 fi
1124 else
1125 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001126 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001127 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001128 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001129 fi
1130 fi
1131 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001132 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001133 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001134 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001135 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001136 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001137)
1138
Tim Rice648f8762011-01-26 12:38:57 -08001139AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1140AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001141 [
1142 saved_CPPFLAGS="$CPPFLAGS"
1143 saved_LDFLAGS="$LDFLAGS"
1144 save_LIBS="$LIBS"
1145 dnl Check default zlib install dir
1146 if test -n "${need_dash_r}"; then
1147 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1148 else
1149 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1150 fi
1151 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1152 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001153 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001154 [
1155 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1156 ]
1157 )
1158 ]
1159)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001160
Tim Rice648f8762011-01-26 12:38:57 -08001161AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001162 [ --without-zlib-version-check Disable zlib version check],
1163 [ if test "x$withval" = "xno" ; then
1164 zlib_check_nonfatal=1
1165 fi
1166 ]
1167)
1168
Tim Rice648f8762011-01-26 12:38:57 -08001169AC_MSG_CHECKING([for possibly buggy zlib])
1170AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001171#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001172#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001173#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001174 ]],
1175 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001176 int a=0, b=0, c=0, d=0, n, v;
1177 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1178 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001179 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001180 v = a*1000000 + b*10000 + c*100 + d;
1181 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1182
1183 /* 1.1.4 is OK */
1184 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001185 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001186
Darren Tucker41097ed2005-07-25 15:24:21 +10001187 /* 1.2.3 and up are OK */
1188 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001189 exit(0);
1190
Darren Tucker2dcd2392004-01-23 17:13:33 +11001191 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001192 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001193 AC_MSG_RESULT([no]),
1194 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001195 if test -z "$zlib_check_nonfatal" ; then
1196 AC_MSG_ERROR([*** zlib too old - check config.log ***
1197Your reported zlib version has known security problems. It's possible your
1198vendor has fixed these problems without changing the version number. If you
1199are sure this is the case, you can disable the check by running
1200"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001201If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001202See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001203 else
1204 AC_MSG_WARN([zlib version may have security problems])
1205 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001206 ],
1207 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001208)
Damien Miller6f9c3372000-10-25 10:06:04 +11001209
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001210dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001211AC_CHECK_FUNC([strcasecmp],
1212 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001213)
Tim Rice648f8762011-01-26 12:38:57 -08001214AC_CHECK_FUNCS([utimes],
1215 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001216 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001217)
Damien Millerab18c411999-11-11 10:40:23 +11001218
Tim Ricee589a292001-11-03 11:09:32 -08001219dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001220AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001221AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001222AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001223AC_SEARCH_LIBS([login], [util bsd])
1224AC_SEARCH_LIBS([logout], [util bsd])
1225AC_SEARCH_LIBS([logwtmp], [util bsd])
1226AC_SEARCH_LIBS([openpty], [util bsd])
1227AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001228AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001229
Ben Lindstrom8697e082001-02-24 21:41:10 +00001230AC_FUNC_STRFTIME
1231
Damien Miller3c027682001-03-14 11:39:45 +11001232# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001233AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1234AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001235 [
1236 #include <glob.h>
1237 #ifdef GLOB_ALTDIRFUNC
1238 FOUNDIT
1239 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001240 ],
Damien Miller3c027682001-03-14 11:39:45 +11001241 [
Tim Rice648f8762011-01-26 12:38:57 -08001242 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001243 [Define if your system glob() function has
1244 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001245 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001246 ],
1247 [
Tim Rice648f8762011-01-26 12:38:57 -08001248 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001249 ]
1250)
Damien Millerab18c411999-11-11 10:40:23 +11001251
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001252# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001253AC_MSG_CHECKING([for gl_matchc field in glob_t])
1254AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1255 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001256 [
Tim Rice648f8762011-01-26 12:38:57 -08001257 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001258 [Define if your system glob() function has
1259 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001260 AC_MSG_RESULT([yes])
1261 ], [
1262 AC_MSG_RESULT([no])
1263])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001264
Damien Millera6e121a2010-10-07 21:39:17 +11001265# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001266AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1267AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001268#ifndef GLOB_KEEPSTAT
1269#error "glob does not support GLOB_KEEPSTAT extension"
1270#endif
1271glob_t g;
1272g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001273]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001274 [
Tim Rice648f8762011-01-26 12:38:57 -08001275 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001276 [Define if your system glob() function has
1277 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001278 AC_MSG_RESULT([yes])
1279 ], [
1280 AC_MSG_RESULT([no])
1281
1282])
Damien Millera6e121a2010-10-07 21:39:17 +11001283
Tim Rice648f8762011-01-26 12:38:57 -08001284AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001285
Damien Miller18bb4732001-03-28 14:35:30 +10001286AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001287AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001288 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001289#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001290#include <dirent.h>]],
1291 [[
1292 struct dirent d;
1293 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001294 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001295 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001296 [
Tim Rice648f8762011-01-26 12:38:57 -08001297 AC_MSG_RESULT([no])
1298 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001299 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001300 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001301 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001302 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001303 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001304 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001305 ]
1306)
1307
Damien Miller36f49652004-08-15 18:40:59 +10001308AC_MSG_CHECKING([for /proc/pid/fd directory])
1309if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001310 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1311 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001312else
Tim Rice648f8762011-01-26 12:38:57 -08001313 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001314fi
1315
Damien Millerc547bf12001-02-16 10:18:12 +11001316# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001317SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001318AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001319 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001320 [
1321 if test "x$withval" != "xno" ; then
1322
1323 if test "x$withval" != "xyes" ; then
1324 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1325 LDFLAGS="$LDFLAGS -L${withval}/lib"
1326 fi
1327
Tim Rice648f8762011-01-26 12:38:57 -08001328 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001329 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001330 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001331
Tim Rice4cec93f2002-02-26 08:40:48 -08001332 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001333 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001334 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001335#include <stdio.h>
1336#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001337 ]], [[
1338 char *ff = skey_keyinfo(""); ff="";
1339 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001340 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001341 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001342 [
Tim Rice648f8762011-01-26 12:38:57 -08001343 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001344 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1345 ])
Tim Rice648f8762011-01-26 12:38:57 -08001346 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1347 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1348#include <stdio.h>
1349#include <skey.h>
1350 ]], [[
1351 (void)skeychallenge(NULL,"name","",0);
1352 ]])],
1353 [
1354 AC_MSG_RESULT([yes])
1355 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001356 [Define if your skeychallenge()
1357 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001358 [
1359 AC_MSG_RESULT([no])
1360 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001361 fi
1362 ]
1363)
1364
1365# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001366TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001367AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001368 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001369 [
1370 if test "x$withval" != "xno" ; then
1371 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001372 saved_LDFLAGS="$LDFLAGS"
1373 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001374 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001375 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001376 if test -d "${withval}/lib"; then
1377 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001378 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001379 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001380 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001381 fi
1382 else
1383 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001384 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001385 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001386 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001387 fi
1388 fi
1389 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001390 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001391 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001392 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001393 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001394 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001395 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001396 AC_MSG_CHECKING([for libwrap])
1397 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001398#include <sys/types.h>
1399#include <sys/socket.h>
1400#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001401#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001402int deny_severity = 0, allow_severity = 0;
1403 ]], [[
1404 hosts_access(0);
1405 ]])], [
1406 AC_MSG_RESULT([yes])
1407 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001408 [Define if you want
1409 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001410 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001411 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001412 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001413 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001414
1415 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001416 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001417 fi
1418 ]
1419)
1420
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001421# Check whether user wants to use ldns
1422LDNS_MSG="no"
1423AC_ARG_WITH(ldns,
1424 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1425 [
1426 if test "x$withval" != "xno" ; then
1427
1428 if test "x$withval" != "xyes" ; then
1429 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1430 LDFLAGS="$LDFLAGS -L${withval}/lib"
1431 fi
1432
1433 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1434 LIBS="-lldns $LIBS"
1435 LDNS_MSG="yes"
1436
1437 AC_MSG_CHECKING([for ldns support])
1438 AC_LINK_IFELSE(
1439 [AC_LANG_SOURCE([[
1440#include <stdio.h>
1441#include <stdlib.h>
1442#include <stdint.h>
1443#include <ldns/ldns.h>
1444int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1445 ]])
1446 ],
1447 [AC_MSG_RESULT(yes)],
1448 [
1449 AC_MSG_RESULT(no)
1450 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1451 ])
1452 fi
1453 ]
1454)
1455
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001456# Check whether user wants libedit support
1457LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001458AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001459 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001460 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001461 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001462 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001463 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001464 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001465 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001466 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001467 use_pkgconfig_for_libedit=yes
1468 else
Tim Rice648f8762011-01-26 12:38:57 -08001469 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001470 fi
1471 fi
1472 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001473 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1474 if test -n "${need_dash_r}"; then
1475 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1476 else
1477 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1478 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001479 fi
Damien Miller1f789802010-10-11 22:35:22 +11001480 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tucker8369c8e2013-12-05 11:00:16 +11001481 LIBEDIT=`$PKGCONFIG --libs libedit`
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001482 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1483 else
1484 LIBEDIT="-ledit -lcurses"
1485 fi
1486 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001487 AC_CHECK_LIB([edit], [el_init],
1488 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001489 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001490 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001491 ],
Tim Rice648f8762011-01-26 12:38:57 -08001492 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001493 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001494 )
Tim Rice648f8762011-01-26 12:38:57 -08001495 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001496 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001497 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1498 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001499 int i = H_SETSIZE;
1500 el_init("", NULL, NULL, NULL);
1501 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001502 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001503 [ AC_MSG_RESULT([yes]) ],
1504 [ AC_MSG_RESULT([no])
1505 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001506 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001507 fi ]
1508)
1509
Darren Tuckerd9f88912005-02-20 21:01:48 +11001510AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001511AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001512 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001513 [
Tim Rice648f8762011-01-26 12:38:57 -08001514 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001515 case "$withval" in
1516 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001517 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001518 AUDIT_MODULE=bsm
1519 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001520 AC_CHECK_HEADERS([bsm/audit.h], [],
1521 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001522 [
1523#ifdef HAVE_TIME_H
1524# include <time.h>
1525#endif
1526 ]
1527)
Tim Rice648f8762011-01-26 12:38:57 -08001528 AC_CHECK_LIB([bsm], [getaudit], [],
1529 [AC_MSG_ERROR([BSM enabled and required library not found])])
1530 AC_CHECK_FUNCS([getaudit], [],
1531 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001532 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001533 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1534 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker1fcec9d2013-12-19 11:00:12 +11001535 if test "$sol2ver" -ge 11; then
Darren Tucker93a2d412012-02-24 10:40:41 +11001536 SSHDLIBS="$SSHDLIBS -lscf"
1537 AC_DEFINE([BROKEN_BSM_API], [1],
1538 [The system has incomplete BSM API])
1539 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001540 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001541 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001542 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001543 AUDIT_MODULE=linux
1544 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001545 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001546 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001547 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001548 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001549 debug)
1550 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001551 AC_MSG_RESULT([debug])
1552 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001553 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001554 no)
Tim Rice648f8762011-01-26 12:38:57 -08001555 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001556 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001557 *)
1558 AC_MSG_ERROR([Unknown audit module $withval])
1559 ;;
1560 esac ]
1561)
1562
Damien Millerfe1f1432003-02-24 15:45:42 +11001563dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001564AC_CHECK_FUNCS([ \
Damien Miller1ff130d2013-12-07 11:51:51 +11001565 Blowfish_initstate \
1566 Blowfish_expandstate \
1567 Blowfish_expand0state \
1568 Blowfish_stream2word \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001569 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001570 arc4random_buf \
Damien Millerdf8b0302013-11-07 13:28:16 +11001571 arc4random_stir \
Damien Millera4be7c22008-05-19 14:47:37 +10001572 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001573 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001574 b64_ntop \
1575 __b64_ntop \
1576 b64_pton \
1577 __b64_pton \
1578 bcopy \
Damien Millera9134422013-12-07 11:35:36 +11001579 bcrypt_pbkdf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001580 bindresvport_sa \
Damien Miller1ff130d2013-12-07 11:51:51 +11001581 blf_enc \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001582 clock \
1583 closefrom \
1584 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001585 endgrent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001586 fchmod \
1587 fchown \
1588 freeaddrinfo \
Darren Tuckera5cf1e22014-01-17 18:10:58 +11001589 fstatfs \
Darren Tucker598eaa62008-06-09 03:32:29 +10001590 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001591 futimes \
1592 getaddrinfo \
1593 getcwd \
1594 getgrouplist \
1595 getnameinfo \
1596 getopt \
1597 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001598 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001599 getpgid \
1600 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001601 _getpty \
1602 getrlimit \
1603 getttyent \
1604 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001605 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001606 inet_aton \
1607 inet_ntoa \
1608 inet_ntop \
1609 innetgr \
1610 login_getcapbool \
Darren Tuckerae133d42013-06-06 08:30:20 +10001611 mblen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001612 md5_crypt \
1613 memmove \
1614 mkdtemp \
1615 mmap \
1616 ngetaddrinfo \
1617 nsleep \
1618 ogetaddrinfo \
1619 openlog_r \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001620 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001621 prctl \
1622 pstat \
1623 readpassphrase \
1624 realpath \
1625 recvmsg \
1626 rresvport_af \
1627 sendmsg \
1628 setdtablesize \
1629 setegid \
1630 setenv \
1631 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001632 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001633 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001634 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001635 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001636 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001637 setpcred \
1638 setproctitle \
1639 setregid \
1640 setreuid \
1641 setrlimit \
1642 setsid \
1643 setvbuf \
1644 sigaction \
1645 sigvec \
1646 snprintf \
1647 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001648 statfs \
1649 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001650 strdup \
1651 strerror \
1652 strlcat \
1653 strlcpy \
1654 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001655 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001656 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001657 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001658 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001659 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001660 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001661 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001662 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001663 sysconf \
1664 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001665 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001666 truncate \
1667 unsetenv \
1668 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001669 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001670 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001671 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001672 vhangup \
1673 vsnprintf \
1674 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001675])
Tim Rice13aae5e2001-10-21 17:53:58 -07001676
Tim Ricec7a8af02010-11-08 14:26:23 -08001677AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001678 [AC_LANG_PROGRAM(
1679 [[ #include <ctype.h> ]],
1680 [[ return (isblank('a')); ]])],
1681 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001682])
1683
Damien Millerb3c9f782010-02-12 10:11:34 +11001684# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001685AC_SEARCH_LIBS([dlopen], [dl],
1686 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001687)
1688
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001689# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001690AC_CHECK_FUNCS([gai_strerror], [
1691 AC_DEFINE([HAVE_GAI_STRERROR])
1692 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001693#include <sys/types.h>
1694#include <sys/socket.h>
1695#include <netdb.h>
1696
Tim Rice648f8762011-01-26 12:38:57 -08001697const char *gai_strerror(int);
1698 ]], [[
1699 char *str;
1700 str = gai_strerror(0);
1701 ]])], [
1702 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1703 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001704
Tim Rice648f8762011-01-26 12:38:57 -08001705AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1706 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001707
Darren Tuckera7108912013-06-02 08:18:31 +10001708AC_SEARCH_LIBS([clock_gettime], [rt],
1709 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1710
Darren Tuckerf1159b52003-07-07 19:44:01 +10001711dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001712AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1713AC_CHECK_DECL([strsep],
1714 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001715 [],
1716 [
1717#ifdef HAVE_STRING_H
1718# include <string.h>
1719#endif
1720 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001721
Darren Tuckerb2427c82003-09-10 15:22:44 +10001722dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001723AC_CHECK_DECL([tcsendbreak],
1724 [AC_DEFINE([HAVE_TCSENDBREAK])],
1725 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001726 [#include <termios.h>]
1727)
1728
Tim Rice648f8762011-01-26 12:38:57 -08001729AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001730
Tim Rice648f8762011-01-26 12:38:57 -08001731AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001732 [
1733#include <sys/types.h>
1734#include <sys/socket.h>
1735 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001736
Tim Rice648f8762011-01-26 12:38:57 -08001737AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001738 [
1739#include <sys/types.h>
1740#ifdef HAVE_SYS_STAT_H
1741# include <sys/stat.h>
1742#endif
1743#ifdef HAVE_FCNTL_H
1744# include <fcntl.h>
1745#endif
1746 ])
1747
Tim Rice648f8762011-01-26 12:38:57 -08001748AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001749#include <sys/types.h>
1750#include <sys/uio.h>
1751#include <unistd.h>
1752 ])
1753
Tim Rice648f8762011-01-26 12:38:57 -08001754AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001755#include <sys/param.h>
1756 ])
1757
Tim Rice648f8762011-01-26 12:38:57 -08001758AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001759#include <stddef.h>
1760 ])
1761
Darren Tuckerc7aad002013-06-02 07:18:47 +10001762# extra bits for select(2)
1763AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1764#include <sys/param.h>
1765#include <sys/types.h>
1766#ifdef HAVE_SYS_SYSMACROS_H
1767#include <sys/sysmacros.h>
1768#endif
1769#ifdef HAVE_SYS_SELECT_H
1770#include <sys/select.h>
1771#endif
1772#ifdef HAVE_SYS_TIME_H
1773#include <sys/time.h>
1774#endif
1775#ifdef HAVE_UNISTD_H
1776#include <unistd.h>
1777#endif
1778 ]])
1779AC_CHECK_TYPES([fd_mask], [], [], [[
1780#include <sys/param.h>
1781#include <sys/types.h>
1782#ifdef HAVE_SYS_SELECT_H
1783#include <sys/select.h>
1784#endif
1785#ifdef HAVE_SYS_TIME_H
1786#include <sys/time.h>
1787#endif
1788#ifdef HAVE_UNISTD_H
1789#include <unistd.h>
1790#endif
1791 ]])
1792
Tim Rice648f8762011-01-26 12:38:57 -08001793AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001794 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001795 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001796 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001797 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001798#include <stdlib.h>
1799#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001800 ]], [[
1801 errno=0;
1802 setresuid(0,0,0);
1803 if (errno==ENOSYS)
1804 exit(1);
1805 else
1806 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001807 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001808 [AC_MSG_RESULT([yes])],
1809 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001810 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001811 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001812 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001813 )
1814])
Darren Tuckere937be32003-12-17 18:53:26 +11001815
Tim Rice648f8762011-01-26 12:38:57 -08001816AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001817 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001818 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001819 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001820 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001821#include <stdlib.h>
1822#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001823 ]], [[
1824 errno=0;
1825 setresgid(0,0,0);
1826 if (errno==ENOSYS)
1827 exit(1);
1828 else
1829 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001830 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001831 [AC_MSG_RESULT([yes])],
1832 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001833 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001834 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001835 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001836 )
1837])
Darren Tuckere937be32003-12-17 18:53:26 +11001838
Damien Millerad833b32000-08-23 10:46:23 +10001839dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001840AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001841dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001842AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1843AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001844dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001845AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1846AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001847dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001848AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001849
Tim Rice648f8762011-01-26 12:38:57 -08001850AC_CHECK_FUNC([daemon],
1851 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1852 [AC_CHECK_LIB([bsd], [daemon],
1853 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001854)
1855
Tim Rice648f8762011-01-26 12:38:57 -08001856AC_CHECK_FUNC([getpagesize],
1857 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001858 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001859 [AC_CHECK_LIB([ucb], [getpagesize],
1860 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001861)
1862
Damien Millercb170cb2000-07-01 16:52:55 +10001863# Check for broken snprintf
1864if test "x$ac_cv_func_snprintf" = "xyes" ; then
1865 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001866 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001867 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1868 [[
1869 char b[5];
1870 snprintf(b,5,"123456789");
1871 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001872 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001873 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001874 [
Tim Rice648f8762011-01-26 12:38:57 -08001875 AC_MSG_RESULT([no])
1876 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001877 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001878 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001879 ],
1880 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001881 )
1882fi
1883
Damien Miller57f39152005-11-24 19:58:19 +11001884# If we don't have a working asprintf, then we strongly depend on vsnprintf
1885# returning the right thing on overflow: the number of characters it tried to
1886# create (as per SUSv3)
1887if test "x$ac_cv_func_asprintf" != "xyes" && \
1888 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1889 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1890 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001891 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001892#include <sys/types.h>
1893#include <stdio.h>
1894#include <stdarg.h>
1895
1896int x_snprintf(char *str,size_t count,const char *fmt,...)
1897{
1898 size_t ret; va_list ap;
1899 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1900 return ret;
1901}
Tim Rice648f8762011-01-26 12:38:57 -08001902 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001903 char x[1];
1904 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001905 ]])],
1906 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001907 [
Tim Rice648f8762011-01-26 12:38:57 -08001908 AC_MSG_RESULT([no])
1909 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001910 [Define if your snprintf is busted])
1911 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1912 ],
1913 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1914 )
1915fi
1916
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001917# On systems where [v]snprintf is broken, but is declared in stdio,
1918# check that the fmt argument is const char * or just char *.
1919# This is only useful for when BROKEN_SNPRINTF
1920AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001921AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1922#include <stdio.h>
1923int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1924 ]], [[
1925 snprintf(0, 0, 0);
1926 ]])],
1927 [AC_MSG_RESULT([yes])
1928 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001929 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001930 [AC_MSG_RESULT([no])
1931 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001932
Damien Millerb4097182004-05-23 14:09:40 +10001933# Check for missing getpeereid (or equiv) support
1934NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001935if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001936 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001937 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1938#include <sys/types.h>
1939#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1940 [ AC_MSG_RESULT([yes])
1941 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1942 ], [AC_MSG_RESULT([no])
1943 NO_PEERCHECK=1
1944 ])
Damien Millerb4097182004-05-23 14:09:40 +10001945fi
1946
Damien Millere8328192003-01-07 15:18:32 +11001947dnl see whether mkstemp() requires XXXXXX
1948if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1949AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001950AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001951 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001952#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001953 ]], [[
1954 char template[]="conftest.mkstemp-test";
1955 if (mkstemp(template) == -1)
1956 exit(1);
1957 unlink(template);
1958 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001959 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001960 [
Tim Rice648f8762011-01-26 12:38:57 -08001961 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001962 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001963 [
Tim Rice648f8762011-01-26 12:38:57 -08001964 AC_MSG_RESULT([yes])
1965 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001966 ],
1967 [
Tim Rice648f8762011-01-26 12:38:57 -08001968 AC_MSG_RESULT([yes])
1969 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001970 ]
Damien Millere8328192003-01-07 15:18:32 +11001971)
1972fi
1973
Darren Tucker70a3d552003-08-21 17:58:29 +10001974dnl make sure that openpty does not reacquire controlling terminal
1975if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001976 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001977 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001978 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001979#include <stdio.h>
1980#include <sys/fcntl.h>
1981#include <sys/types.h>
1982#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001983 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001984 pid_t pid;
1985 int fd, ptyfd, ttyfd, status;
1986
1987 pid = fork();
1988 if (pid < 0) { /* failed */
1989 exit(1);
1990 } else if (pid > 0) { /* parent */
1991 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001992 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001993 exit(WEXITSTATUS(status));
1994 else
1995 exit(2);
1996 } else { /* child */
1997 close(0); close(1); close(2);
1998 setsid();
1999 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
2000 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
2001 if (fd >= 0)
2002 exit(3); /* Acquired ctty: broken */
2003 else
2004 exit(0); /* Did not acquire ctty: OK */
2005 }
Darren Tucker314d89e2005-10-17 23:29:23 +10002006 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10002007 [
Tim Rice648f8762011-01-26 12:38:57 -08002008 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002009 ],
2010 [
Tim Rice648f8762011-01-26 12:38:57 -08002011 AC_MSG_RESULT([no])
2012 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10002013 ],
2014 [
Tim Rice648f8762011-01-26 12:38:57 -08002015 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10002016 ]
2017 )
2018fi
2019
Tim Rice8bb561b2005-03-17 16:23:19 -08002020if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2021 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002022 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002023 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002024 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10002025#include <stdio.h>
2026#include <sys/socket.h>
2027#include <netdb.h>
2028#include <errno.h>
2029#include <netinet/in.h>
2030
2031#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002032 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10002033 int err, sock;
2034 struct addrinfo *gai_ai, *ai, hints;
2035 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2036
2037 memset(&hints, 0, sizeof(hints));
2038 hints.ai_family = PF_UNSPEC;
2039 hints.ai_socktype = SOCK_STREAM;
2040 hints.ai_flags = AI_PASSIVE;
2041
2042 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2043 if (err != 0) {
2044 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2045 exit(1);
2046 }
2047
2048 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2049 if (ai->ai_family != AF_INET6)
2050 continue;
2051
2052 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2053 sizeof(ntop), strport, sizeof(strport),
2054 NI_NUMERICHOST|NI_NUMERICSERV);
2055
2056 if (err != 0) {
2057 if (err == EAI_SYSTEM)
2058 perror("getnameinfo EAI_SYSTEM");
2059 else
2060 fprintf(stderr, "getnameinfo failed: %s\n",
2061 gai_strerror(err));
2062 exit(2);
2063 }
2064
2065 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2066 if (sock < 0)
2067 perror("socket");
2068 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2069 if (errno == EBADF)
2070 exit(3);
2071 }
2072 }
2073 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002074 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002075 [
Tim Rice648f8762011-01-26 12:38:57 -08002076 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002077 ],
2078 [
Tim Rice648f8762011-01-26 12:38:57 -08002079 AC_MSG_RESULT([no])
2080 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002081 ],
2082 [
Tim Rice648f8762011-01-26 12:38:57 -08002083 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002084 ]
2085 )
2086fi
2087
Tim Rice8bb561b2005-03-17 16:23:19 -08002088if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2089 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002090 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002091 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002092 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002093#include <stdio.h>
2094#include <sys/socket.h>
2095#include <netdb.h>
2096#include <errno.h>
2097#include <netinet/in.h>
2098
2099#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002100 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002101 int err, sock;
2102 struct addrinfo *gai_ai, *ai, hints;
2103 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2104
2105 memset(&hints, 0, sizeof(hints));
2106 hints.ai_family = PF_UNSPEC;
2107 hints.ai_socktype = SOCK_STREAM;
2108 hints.ai_flags = AI_PASSIVE;
2109
2110 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2111 if (err != 0) {
2112 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2113 exit(1);
2114 }
2115
2116 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2117 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2118 continue;
2119
2120 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2121 sizeof(ntop), strport, sizeof(strport),
2122 NI_NUMERICHOST|NI_NUMERICSERV);
2123
2124 if (ai->ai_family == AF_INET && err != 0) {
2125 perror("getnameinfo");
2126 exit(2);
2127 }
2128 }
2129 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002130 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002131 [
Tim Rice648f8762011-01-26 12:38:57 -08002132 AC_MSG_RESULT([yes])
2133 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002134 [Define if you have a getaddrinfo that fails
2135 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002136 ],
2137 [
Tim Rice648f8762011-01-26 12:38:57 -08002138 AC_MSG_RESULT([no])
2139 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002140 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002141 [
Tim Rice648f8762011-01-26 12:38:57 -08002142 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002143 ]
2144 )
2145fi
2146
Darren Tuckera56f1912004-11-02 20:30:54 +11002147if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002148 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2149 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2150 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002151 [
Tim Rice648f8762011-01-26 12:38:57 -08002152 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002153 ],
2154 [
Tim Rice648f8762011-01-26 12:38:57 -08002155 AC_MSG_RESULT([yes])
2156 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002157 [Conflicting defs for getspnam])
2158 ]
2159 )
2160fi
2161
Damien Miller606f8802000-09-16 15:39:56 +11002162AC_FUNC_GETPGRP
2163
Tim Riceaef73712002-05-11 13:17:42 -07002164# Search for OpenSSL
2165saved_CPPFLAGS="$CPPFLAGS"
2166saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002167AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002168 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2169 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002170 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002171 case "$withval" in
2172 # Relative paths
2173 ./*|../*) withval="`pwd`/$withval"
2174 esac
Tim Riceaef73712002-05-11 13:17:42 -07002175 if test -d "$withval/lib"; then
2176 if test -n "${need_dash_r}"; then
2177 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2178 else
2179 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2180 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002181 elif test -d "$withval/lib64"; then
2182 if test -n "${need_dash_r}"; then
2183 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2184 else
2185 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2186 fi
Tim Riceaef73712002-05-11 13:17:42 -07002187 else
2188 if test -n "${need_dash_r}"; then
2189 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2190 else
2191 LDFLAGS="-L${withval} ${LDFLAGS}"
2192 fi
2193 fi
2194 if test -d "$withval/include"; then
2195 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2196 else
2197 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2198 fi
Damien Millera22ba012000-03-02 23:09:20 +11002199 fi
2200 ]
2201)
Tim Rice3d5352e2004-02-12 09:27:21 -08002202LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002203AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002204 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002205 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002206 [
Tim Riceaef73712002-05-11 13:17:42 -07002207 dnl Check default openssl install dir
2208 if test -n "${need_dash_r}"; then
2209 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002210 else
Tim Riceaef73712002-05-11 13:17:42 -07002211 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002212 fi
Tim Riceaef73712002-05-11 13:17:42 -07002213 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002214 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002215 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2216 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002217 [
2218 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2219 ]
2220 )
2221 ]
2222)
2223
Tim Riced730b782002-08-13 18:52:10 -07002224# Determine OpenSSL header version
2225AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002226AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002227 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002228#include <stdio.h>
2229#include <string.h>
2230#include <openssl/opensslv.h>
2231#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002232 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002233 FILE *fd;
2234 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002235
Damien Millera8e06ce2003-11-21 23:48:55 +11002236 fd = fopen(DATA,"w");
2237 if(fd == NULL)
2238 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002239
2240 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2241 exit(1);
2242
2243 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002244 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002245 [
2246 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002247 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002248 ],
2249 [
Tim Rice648f8762011-01-26 12:38:57 -08002250 AC_MSG_RESULT([not found])
2251 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002252 ],
2253 [
2254 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002255 ]
2256)
2257
2258# Determine OpenSSL library version
2259AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002260AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002261 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002262#include <stdio.h>
2263#include <string.h>
2264#include <openssl/opensslv.h>
2265#include <openssl/crypto.h>
2266#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002267 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002268 FILE *fd;
2269 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002270
Damien Millera8e06ce2003-11-21 23:48:55 +11002271 fd = fopen(DATA,"w");
2272 if(fd == NULL)
2273 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002274
2275 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2276 exit(1);
2277
2278 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002279 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002280 [
2281 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002282 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002283 ],
2284 [
Tim Rice648f8762011-01-26 12:38:57 -08002285 AC_MSG_RESULT([not found])
2286 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002287 ],
2288 [
2289 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002290 ]
2291)
Damien Millera22ba012000-03-02 23:09:20 +11002292
Tim Rice648f8762011-01-26 12:38:57 -08002293AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002294 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2295 [ if test "x$withval" = "xno" ; then
2296 openssl_check_nonfatal=1
2297 fi
2298 ]
2299)
2300
Damien Millerec932372002-01-22 22:16:03 +11002301# Sanity check OpenSSL headers
2302AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002303AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002304 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002305#include <string.h>
2306#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002307 ]], [[
2308 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002309 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002310 [
Tim Rice648f8762011-01-26 12:38:57 -08002311 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002312 ],
2313 [
Tim Rice648f8762011-01-26 12:38:57 -08002314 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002315 if test "x$openssl_check_nonfatal" = "x"; then
2316 AC_MSG_ERROR([Your OpenSSL headers do not match your
2317library. Check config.log for details.
2318If you are sure your installation is consistent, you can disable the check
2319by running "./configure --without-openssl-header-check".
2320Also see contrib/findssl.sh for help identifying header/library mismatches.
2321])
2322 else
2323 AC_MSG_WARN([Your OpenSSL headers do not match your
2324library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002325Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002326 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002327 ],
2328 [
2329 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002330 ]
2331)
2332
Darren Tucker639bbe82006-08-20 20:17:53 +10002333AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2334AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002335 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2336 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002337 [
Tim Rice648f8762011-01-26 12:38:57 -08002338 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002339 ],
2340 [
Tim Rice648f8762011-01-26 12:38:57 -08002341 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002342 saved_LIBS="$LIBS"
2343 LIBS="$LIBS -ldl"
2344 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2345 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002346 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2347 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002348 [
Tim Rice648f8762011-01-26 12:38:57 -08002349 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002350 ],
2351 [
Tim Rice648f8762011-01-26 12:38:57 -08002352 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002353 LIBS="$saved_LIBS"
2354 ]
2355 )
2356 ]
2357)
2358
Darren Tuckerc5487222014-01-17 15:12:16 +11002359AC_CHECK_FUNCS([ \
2360 BN_is_prime_ex \
2361 DSA_generate_parameters_ex \
Darren Tuckerd23a91f2014-01-17 17:32:30 +11002362 EVP_DigestInit_ex \
2363 EVP_DigestFinal_ex \
2364 EVP_MD_CTX_init \
2365 EVP_MD_CTX_cleanup \
Darren Tuckerc5487222014-01-17 15:12:16 +11002366 HMAC_CTX_init \
2367 RSA_generate_key_ex \
2368 RSA_get_default_method \
2369])
Darren Tuckerebdef762010-12-04 23:20:50 +11002370
Tim Rice648f8762011-01-26 12:38:57 -08002371AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002372 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2373 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002374 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2375 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2376#include <openssl/engine.h>
2377 ]], [[
2378 ENGINE_load_builtin_engines();
2379 ENGINE_register_all_complete();
2380 ]])],
2381 [ AC_MSG_RESULT([yes])
2382 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002383 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002384 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2385 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002386 fi ]
2387)
2388
Darren Tucker129d0bb2005-12-19 17:40:40 +11002389# Check for OpenSSL without EVP_aes_{192,256}_cbc
2390AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002391AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002392 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002393#include <string.h>
2394#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002395 ]], [[
2396 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002397 ]])],
2398 [
Tim Rice648f8762011-01-26 12:38:57 -08002399 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002400 ],
2401 [
Tim Rice648f8762011-01-26 12:38:57 -08002402 AC_MSG_RESULT([yes])
2403 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002404 [libcrypto is missing AES 192 and 256 bit functions])
2405 ]
2406)
2407
Damien Miller25a02b02012-12-13 08:18:56 +11002408# Check for OpenSSL with EVP_aes_*ctr
2409AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2410AC_LINK_IFELSE(
2411 [AC_LANG_PROGRAM([[
2412#include <string.h>
2413#include <openssl/evp.h>
2414 ]], [[
2415 exit(EVP_aes_128_ctr() == NULL ||
2416 EVP_aes_192_cbc() == NULL ||
2417 EVP_aes_256_cbc() == NULL);
2418 ]])],
2419 [
2420 AC_MSG_RESULT([yes])
2421 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2422 [libcrypto has EVP AES CTR])
2423 ],
2424 [
2425 AC_MSG_RESULT([no])
2426 ]
2427)
2428
Damien Millerd522c682013-01-09 16:42:47 +11002429# Check for OpenSSL with EVP_aes_*gcm
2430AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2431AC_LINK_IFELSE(
2432 [AC_LANG_PROGRAM([[
2433#include <string.h>
2434#include <openssl/evp.h>
2435 ]], [[
2436 exit(EVP_aes_128_gcm() == NULL ||
Damien Millerb6f73b32013-02-11 10:39:12 +11002437 EVP_aes_256_gcm() == NULL ||
2438 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2439 EVP_CTRL_GCM_IV_GEN == 0 ||
2440 EVP_CTRL_GCM_SET_TAG == 0 ||
2441 EVP_CTRL_GCM_GET_TAG == 0 ||
2442 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
Damien Millerd522c682013-01-09 16:42:47 +11002443 ]])],
2444 [
2445 AC_MSG_RESULT([yes])
2446 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2447 [libcrypto has EVP AES GCM])
2448 ],
2449 [
2450 AC_MSG_RESULT([no])
Darren Tucker6d8bd572013-06-11 11:26:10 +10002451 unsupported_algorithms="$unsupported_cipers \
2452 aes128-gcm@openssh.com aes256-gcm@openssh.com"
Damien Millerd522c682013-01-09 16:42:47 +11002453 ]
2454)
2455
Damien Millerb6f73b32013-02-11 10:39:12 +11002456AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2457 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2458 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2459
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002460AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2461AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002462 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002463#include <string.h>
2464#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002465 ]], [[
2466 if(EVP_DigestUpdate(NULL, NULL,0))
2467 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002468 ]])],
2469 [
Tim Rice648f8762011-01-26 12:38:57 -08002470 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002471 ],
2472 [
Tim Rice648f8762011-01-26 12:38:57 -08002473 AC_MSG_RESULT([no])
2474 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002475 [Define if EVP_DigestUpdate returns void])
2476 ]
2477)
2478
Tim Rice3d5352e2004-02-12 09:27:21 -08002479# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2480# because the system crypt() is more featureful.
2481if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002482 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002483fi
2484
Damien Millera8e06ce2003-11-21 23:48:55 +11002485# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002486# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002487if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002488 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002489fi
Darren Tuckerc0c33732013-06-02 06:28:03 +10002490AC_CHECK_FUNCS([crypt DES_crypt])
Damien Millera64b57a2001-01-17 10:44:13 +11002491
Damien Milleraf87af12006-03-15 13:02:28 +11002492# Search for SHA256 support in libc and/or OpenSSL
Darren Tucker4bf7e502013-11-07 22:33:48 +11002493AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2494 [unsupported_algorithms="$unsupported_algorithms \
Darren Tucker6d8bd572013-06-11 11:26:10 +10002495 hmac-sha2-256 hmac-sha2-512 \
2496 diffie-hellman-group-exchange-sha256 \
2497 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2498 ]
2499)
Damien Milleraf87af12006-03-15 13:02:28 +11002500
Damien Miller6af914a2010-09-10 11:39:26 +10002501# Check complete ECC support in OpenSSL
Darren Tucker37bcef52013-11-09 18:39:25 +11002502AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2503AC_LINK_IFELSE(
2504 [AC_LANG_PROGRAM([[
2505#include <openssl/ec.h>
2506#include <openssl/ecdh.h>
2507#include <openssl/ecdsa.h>
2508#include <openssl/evp.h>
2509#include <openssl/objects.h>
2510#include <openssl/opensslv.h>
2511#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2512# error "OpenSSL < 0.9.8g has unreliable ECC code"
2513#endif
2514 ]], [[
2515 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2516 const EVP_MD *m = EVP_sha256(); /* We need this too */
2517 ]])],
2518 [ AC_MSG_RESULT([yes])
2519 enable_nistp256=1 ],
2520 [ AC_MSG_RESULT([no]) ]
2521)
2522
2523AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2524AC_LINK_IFELSE(
2525 [AC_LANG_PROGRAM([[
2526#include <openssl/ec.h>
2527#include <openssl/ecdh.h>
2528#include <openssl/ecdsa.h>
2529#include <openssl/evp.h>
2530#include <openssl/objects.h>
2531#include <openssl/opensslv.h>
2532#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2533# error "OpenSSL < 0.9.8g has unreliable ECC code"
2534#endif
2535 ]], [[
2536 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2537 const EVP_MD *m = EVP_sha384(); /* We need this too */
2538 ]])],
2539 [ AC_MSG_RESULT([yes])
2540 enable_nistp384=1 ],
2541 [ AC_MSG_RESULT([no]) ]
2542)
2543
2544AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
Damien Miller6af914a2010-09-10 11:39:26 +10002545AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002546 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002547#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002548#include <openssl/ecdh.h>
2549#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002550#include <openssl/evp.h>
2551#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002552#include <openssl/opensslv.h>
2553#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2554# error "OpenSSL < 0.9.8g has unreliable ECC code"
2555#endif
Tim Rice648f8762011-01-26 12:38:57 -08002556 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002557 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2558 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002559 ]])],
Darren Tucker37bcef52013-11-09 18:39:25 +11002560 [ AC_MSG_RESULT([yes])
2561 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2562 AC_RUN_IFELSE(
2563 [AC_LANG_PROGRAM([[
2564#include <openssl/ec.h>
2565#include <openssl/ecdh.h>
2566#include <openssl/ecdsa.h>
2567#include <openssl/evp.h>
2568#include <openssl/objects.h>
2569#include <openssl/opensslv.h>
2570 ]],[[
2571 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2572 const EVP_MD *m = EVP_sha512(); /* We need this too */
2573 exit(e == NULL || m == NULL);
2574 ]])],
2575 [ AC_MSG_RESULT([yes])
2576 enable_nistp521=1 ],
2577 [ AC_MSG_RESULT([no]) ],
Darren Tucker95cb2d42013-11-09 22:02:31 +11002578 [ AC_MSG_WARN([cross-compiling: assuming yes])
Darren Tucker37bcef52013-11-09 18:39:25 +11002579 enable_nistp521=1 ]
Darren Tucker95cb2d42013-11-09 22:02:31 +11002580 )],
Darren Tucker37bcef52013-11-09 18:39:25 +11002581 AC_MSG_RESULT([no])
Damien Miller6af914a2010-09-10 11:39:26 +10002582)
Darren Tucker37bcef52013-11-09 18:39:25 +11002583
2584COMMENT_OUT_ECC="#no ecc#"
2585TEST_SSH_ECC=no
2586
2587if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
Darren Tuckerdd5264d2013-11-09 22:32:51 +11002588 test x$enable_nistp521 = x1; then
Darren Tucker37bcef52013-11-09 18:39:25 +11002589 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2590fi
2591if test x$enable_nistp256 = x1; then
2592 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2593 [libcrypto has NID_X9_62_prime256v1])
2594 TEST_SSH_ECC=yes
2595 COMMENT_OUT_ECC=""
2596else
2597 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2598 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2599fi
2600if test x$enable_nistp384 = x1; then
2601 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2602 TEST_SSH_ECC=yes
2603 COMMENT_OUT_ECC=""
2604else
2605 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2606 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2607fi
2608if test x$enable_nistp521 = x1; then
2609 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2610 TEST_SSH_ECC=yes
2611 COMMENT_OUT_ECC=""
2612else
2613 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2614 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2615fi
2616
Tim Rice648f8762011-01-26 12:38:57 -08002617AC_SUBST([TEST_SSH_ECC])
2618AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002619
Tim Rice99203ec2007-03-26 09:35:28 -07002620saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002621AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002622 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002623 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2624 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002625 [Define if system has libiaf that supports set_id])
2626 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002627])
2628LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002629
2630### Configure cryptographic random number support
2631
2632# Check wheter OpenSSL seeds itself
2633AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002634AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002635 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002636#include <string.h>
2637#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002638 ]], [[
2639 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002640 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002641 [
2642 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002643 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002644 ],
2645 [
Tim Rice648f8762011-01-26 12:38:57 -08002646 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002647 ],
2648 [
2649 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002650 # This is safe, since we will fatal() at runtime if
2651 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002652 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002653 ]
2654)
2655
Damien Millerf22019b2011-05-05 13:48:37 +10002656# PRNGD TCP socket
2657AC_ARG_WITH([prngd-port],
2658 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2659 [
2660 case "$withval" in
2661 no)
2662 withval=""
2663 ;;
2664 [[0-9]]*)
2665 ;;
2666 *)
2667 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2668 ;;
2669 esac
2670 if test ! -z "$withval" ; then
2671 PRNGD_PORT="$withval"
2672 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2673 [Port number of PRNGD/EGD random number socket])
2674 fi
2675 ]
2676)
2677
2678# PRNGD Unix domain socket
2679AC_ARG_WITH([prngd-socket],
2680 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2681 [
2682 case "$withval" in
2683 yes)
2684 withval="/var/run/egd-pool"
2685 ;;
2686 no)
2687 withval=""
2688 ;;
2689 /*)
2690 ;;
2691 *)
2692 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2693 ;;
2694 esac
2695
2696 if test ! -z "$withval" ; then
2697 if test ! -z "$PRNGD_PORT" ; then
2698 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2699 fi
2700 if test ! -r "$withval" ; then
2701 AC_MSG_WARN([Entropy socket is not readable])
2702 fi
2703 PRNGD_SOCKET="$withval"
2704 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2705 [Location of PRNGD/EGD random number socket])
2706 fi
2707 ],
2708 [
2709 # Check for existing socket only if we don't have a random device already
2710 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2711 AC_MSG_CHECKING([for PRNGD/EGD socket])
2712 # Insert other locations here
2713 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2714 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2715 PRNGD_SOCKET="$sock"
2716 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2717 break;
2718 fi
2719 done
2720 if test ! -z "$PRNGD_SOCKET" ; then
2721 AC_MSG_RESULT([$PRNGD_SOCKET])
2722 else
2723 AC_MSG_RESULT([not found])
2724 fi
2725 fi
2726 ]
2727)
2728
2729# Which randomness source do we use?
2730if test ! -z "$PRNGD_PORT" ; then
2731 RAND_MSG="PRNGd port $PRNGD_PORT"
2732elif test ! -z "$PRNGD_SOCKET" ; then
2733 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2734elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2735 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2736 [Define if you want OpenSSL's internally seeded PRNG only])
2737 RAND_MSG="OpenSSL internal ONLY"
2738else
2739 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])
2740fi
2741
Darren Tucker3e6bde42006-08-20 20:03:50 +10002742# Check for PAM libs
2743PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002744AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002745 [ --with-pam Enable PAM support ],
2746 [
2747 if test "x$withval" != "xno" ; then
2748 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2749 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2750 AC_MSG_ERROR([PAM headers not found])
2751 fi
2752
2753 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002754 AC_CHECK_LIB([dl], [dlopen], , )
2755 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2756 AC_CHECK_FUNCS([pam_getenvlist])
2757 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002758 LIBS="$saved_LIBS"
2759
2760 PAM_MSG="yes"
2761
Darren Tucker20e9f972007-03-25 18:26:01 +10002762 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002763 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002764 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002765
Darren Tucker3e6bde42006-08-20 20:03:50 +10002766 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002767 case "$LIBS" in
2768 *-ldl*)
2769 # libdl already in LIBS
2770 ;;
2771 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002772 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002773 ;;
2774 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002775 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002776 fi
2777 ]
2778)
2779
2780# Check for older PAM
2781if test "x$PAM_MSG" = "xyes" ; then
2782 # Check PAM strerror arguments (old PAM)
2783 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002784 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002785#include <stdlib.h>
2786#if defined(HAVE_SECURITY_PAM_APPL_H)
2787#include <security/pam_appl.h>
2788#elif defined (HAVE_PAM_PAM_APPL_H)
2789#include <pam/pam_appl.h>
2790#endif
Tim Rice648f8762011-01-26 12:38:57 -08002791 ]], [[
2792(void)pam_strerror((pam_handle_t *)NULL, -1);
2793 ]])], [AC_MSG_RESULT([no])], [
2794 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002795 [Define if you have an old version of PAM
2796 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002797 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002798 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002799
2800 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002801fi
Damien Miller6c21c512002-01-22 21:57:53 +11002802
Damien Millerd3f6ad22002-06-25 10:24:47 +10002803SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002804AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002805 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002806 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002807 if test -n "$withval" && test "x$withval" != "xno" && \
2808 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002809 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002810 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002811 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002812)
Tim Rice648f8762011-01-26 12:38:57 -08002813AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002814 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002815AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002816
Damien Miller91f40d82013-02-22 11:37:00 +11002817if test "x$have_linux_no_new_privs" = "x1" ; then
2818AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2819 #include <sys/types.h>
2820 #include <linux/seccomp.h>
2821])
2822fi
2823if test "x$have_seccomp_filter" = "x1" ; then
2824AC_MSG_CHECKING([kernel for seccomp_filter support])
2825AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2826 #include <errno.h>
2827 #include <elf.h>
2828 #include <linux/audit.h>
2829 #include <linux/seccomp.h>
2830 #include <stdlib.h>
2831 #include <sys/prctl.h>
2832 ]],
2833 [[ int i = $seccomp_audit_arch;
2834 errno = 0;
2835 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2836 exit(errno == EFAULT ? 0 : 1); ]])],
2837 [ AC_MSG_RESULT([yes]) ], [
2838 AC_MSG_RESULT([no])
2839 # Disable seccomp filter as a target
2840 have_seccomp_filter=0
2841 ]
2842)
2843fi
2844
Damien Miller69ff1df2011-06-23 08:30:03 +10002845# Decide which sandbox style to use
2846sandbox_arg=""
2847AC_ARG_WITH([sandbox],
Damien Miller868ea1e2014-01-17 16:47:04 +11002848 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter, capsicum)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002849 [
2850 if test "x$withval" = "xyes" ; then
2851 sandbox_arg=""
2852 else
2853 sandbox_arg="$withval"
2854 fi
2855 ]
2856)
Darren Tucker60395f92012-07-03 14:31:18 +10002857
2858# Some platforms (seems to be the ones that have a kernel poll(2)-type
2859# function with which they implement select(2)) use an extra file descriptor
2860# when calling select(2), which means we can't use the rlimit sandbox.
2861AC_MSG_CHECKING([if select works with descriptor rlimit])
2862AC_RUN_IFELSE(
2863 [AC_LANG_PROGRAM([[
2864#include <sys/types.h>
2865#ifdef HAVE_SYS_TIME_H
2866# include <sys/time.h>
2867#endif
2868#include <sys/resource.h>
2869#ifdef HAVE_SYS_SELECT_H
2870# include <sys/select.h>
2871#endif
2872#include <errno.h>
2873#include <fcntl.h>
2874#include <stdlib.h>
2875 ]],[[
2876 struct rlimit rl_zero;
2877 int fd, r;
2878 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002879 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002880
2881 fd = open("/dev/null", O_RDONLY);
2882 FD_ZERO(&fds);
2883 FD_SET(fd, &fds);
2884 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2885 setrlimit(RLIMIT_FSIZE, &rl_zero);
2886 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002887 tv.tv_sec = 1;
2888 tv.tv_usec = 0;
2889 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002890 exit (r == -1 ? 1 : 0);
2891 ]])],
2892 [AC_MSG_RESULT([yes])
2893 select_works_with_rlimit=yes],
2894 [AC_MSG_RESULT([no])
2895 select_works_with_rlimit=no],
2896 [AC_MSG_WARN([cross compiling: assuming yes])]
2897)
2898
Darren Tuckerff008de2013-03-06 17:48:48 +11002899AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2900AC_RUN_IFELSE(
2901 [AC_LANG_PROGRAM([[
2902#include <sys/types.h>
2903#ifdef HAVE_SYS_TIME_H
2904# include <sys/time.h>
2905#endif
2906#include <sys/resource.h>
2907#include <errno.h>
2908#include <stdlib.h>
2909 ]],[[
2910 struct rlimit rl_zero;
2911 int fd, r;
2912 fd_set fds;
2913
2914 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2915 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2916 exit (r == -1 ? 1 : 0);
2917 ]])],
2918 [AC_MSG_RESULT([yes])
2919 rlimit_nofile_zero_works=yes],
2920 [AC_MSG_RESULT([no])
2921 rlimit_nofile_zero_works=no],
2922 [AC_MSG_WARN([cross compiling: assuming yes])]
2923)
2924
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002925AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2926AC_RUN_IFELSE(
2927 [AC_LANG_PROGRAM([[
2928#include <sys/types.h>
2929#include <sys/resource.h>
2930#include <stdlib.h>
2931 ]],[[
2932 struct rlimit rl_zero;
2933
2934 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2935 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2936 ]])],
2937 [AC_MSG_RESULT([yes])],
2938 [AC_MSG_RESULT([no])
2939 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
2940 [setrlimit RLIMIT_FSIZE works])],
2941 [AC_MSG_WARN([cross compiling: assuming yes])]
2942)
2943
Damien Miller69ff1df2011-06-23 08:30:03 +10002944if test "x$sandbox_arg" = "xsystrace" || \
2945 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002946 test "x$have_systr_policy_kill" != "x1" && \
2947 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002948 SANDBOX_STYLE="systrace"
2949 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002950elif test "x$sandbox_arg" = "xdarwin" || \
2951 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2952 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002953 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2954 "x$ac_cv_header_sandbox_h" != "xyes" && \
2955 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002956 SANDBOX_STYLE="darwin"
2957 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10002958elif test "x$sandbox_arg" = "xseccomp_filter" || \
2959 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10002960 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002961 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10002962 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002963 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
2964 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002965 test "x$have_linux_no_new_privs" = "x1" && \
2966 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11002967 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002968 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
2969 test "x$have_linux_no_new_privs" != "x1" && \
2970 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
2971 test "x$have_seccomp_filter" != "x1" && \
2972 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
2973 test "x$ac_cv_func_prctl" != "xyes" && \
2974 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
2975 SANDBOX_STYLE="seccomp_filter"
2976 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Miller69ff1df2011-06-23 08:30:03 +10002977elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10002978 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11002979 test "x$select_works_with_rlimit" = "xyes" && \
2980 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002981 test "x$ac_cv_func_setrlimit" != "xyes" && \
2982 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10002983 test "x$select_works_with_rlimit" != "xyes" && \
2984 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10002985 SANDBOX_STYLE="rlimit"
2986 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
Damien Miller868ea1e2014-01-17 16:47:04 +11002987elif test "x$sandbox_arg" = "xcapsicum" || \
2988 ( test -z "$sandbox_arg" && \
2989 test "x$have_cap_enter" = "x1") ; then
2990 test "x$have_cap_enter" != "x1" && \
2991 AC_MSG_ERROR([capsicum sandbox requires cap_enter function])
2992 SANDBOX_STYLE="capsicum"
2993 AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum])
Damien Miller69ff1df2011-06-23 08:30:03 +10002994elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2995 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2996 SANDBOX_STYLE="none"
2997 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2998else
Tim Ricea6e60612011-08-17 21:48:22 -07002999 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10003000fi
3001
Ben Lindstromb5628642000-10-18 00:02:25 +00003002# Cheap hack to ensure NEWS-OS libraries are arranged right.
3003if test ! -z "$SONY" ; then
3004 LIBS="$LIBS -liberty";
3005fi
3006
Damien Miller57f39152005-11-24 19:58:19 +11003007# Check for long long datatypes
3008AC_CHECK_TYPES([long long, unsigned long long, long double])
3009
3010# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08003011AC_CHECK_SIZEOF([short int], [2])
3012AC_CHECK_SIZEOF([int], [4])
3013AC_CHECK_SIZEOF([long int], [4])
3014AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11003015
Damien Millerfa2bb692002-04-23 23:22:25 +10003016# Sanity check long long for some platforms (AIX)
3017if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
3018 ac_cv_sizeof_long_long_int=0
3019fi
3020
Darren Tucker537f1ed2005-10-25 18:38:33 +10003021# compute LLONG_MIN and LLONG_MAX if we don't know them.
3022if test -z "$have_llong_max"; then
3023 AC_MSG_CHECKING([for max value of long long])
3024 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003025 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003026#include <stdio.h>
3027/* Why is this so damn hard? */
3028#ifdef __GNUC__
3029# undef __GNUC__
3030#endif
3031#define __USE_ISOC99
3032#include <limits.h>
3033#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11003034#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
3035
3036/*
3037 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
3038 * we do this the hard way.
3039 */
3040static int
3041fprint_ll(FILE *f, long long n)
3042{
3043 unsigned int i;
3044 int l[sizeof(long long) * 8];
3045
3046 if (n < 0)
3047 if (fprintf(f, "-") < 0)
3048 return -1;
3049 for (i = 0; n != 0; i++) {
3050 l[i] = my_abs(n % 10);
3051 n /= 10;
3052 }
3053 do {
3054 if (fprintf(f, "%d", l[--i]) < 0)
3055 return -1;
3056 } while (i != 0);
3057 if (fprintf(f, " ") < 0)
3058 return -1;
3059 return 0;
3060}
Tim Rice648f8762011-01-26 12:38:57 -08003061 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003062 FILE *f;
3063 long long i, llmin, llmax = 0;
3064
3065 if((f = fopen(DATA,"w")) == NULL)
3066 exit(1);
3067
3068#if defined(LLONG_MIN) && defined(LLONG_MAX)
3069 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3070 llmin = LLONG_MIN;
3071 llmax = LLONG_MAX;
3072#else
3073 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3074 /* This will work on one's complement and two's complement */
3075 for (i = 1; i > llmax; i <<= 1, i++)
3076 llmax = i;
3077 llmin = llmax + 1LL; /* wrap */
3078#endif
3079
3080 /* Sanity check */
3081 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003082 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3083 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003084 fprintf(f, "unknown unknown\n");
3085 exit(2);
3086 }
3087
Darren Tuckerd1450db2006-03-13 19:06:51 +11003088 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003089 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003090 if (fprint_ll(f, llmax) < 0)
3091 exit(4);
3092 if (fclose(f) < 0)
3093 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003094 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003095 ]])],
3096 [
3097 llong_min=`$AWK '{print $1}' conftest.llminmax`
3098 llong_max=`$AWK '{print $2}' conftest.llminmax`
3099
Tim Rice648f8762011-01-26 12:38:57 -08003100 AC_MSG_RESULT([$llong_max])
3101 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003102 [max value of long long calculated by configure])
3103 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003104 AC_MSG_RESULT([$llong_min])
3105 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003106 [min value of long long calculated by configure])
3107 ],
3108 [
Tim Rice648f8762011-01-26 12:38:57 -08003109 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003110 ],
3111 [
3112 AC_MSG_WARN([cross compiling: not checking])
3113 ]
3114 )
3115fi
3116
3117
Damien Millera22ba012000-03-02 23:09:20 +11003118# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003119AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003120 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3121 [[ u_int a; a = 1;]])],
3122 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
3123 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003124])
3125if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003126 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003127 have_u_int=1
3128fi
3129
Damien Miller61e50f12000-05-08 20:49:37 +10003130AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003131 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3132 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
3133 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
3134 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003135])
3136if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003137 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003138 have_intxx_t=1
3139fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003140
3141if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003142 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003143then
3144 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003145 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3146 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003147 [
Tim Rice648f8762011-01-26 12:38:57 -08003148 AC_DEFINE([HAVE_INTXX_T])
3149 AC_MSG_RESULT([yes])
3150 ], [ AC_MSG_RESULT([no])
3151 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003152fi
3153
Damien Miller578783e2000-09-23 14:12:24 +11003154AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003155 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003156#include <sys/types.h>
3157#ifdef HAVE_STDINT_H
3158# include <stdint.h>
3159#endif
3160#include <sys/socket.h>
3161#ifdef HAVE_SYS_BITYPES_H
3162# include <sys/bitypes.h>
3163#endif
Tim Rice648f8762011-01-26 12:38:57 -08003164 ]], [[
3165int64_t a; a = 1;
3166 ]])],
3167 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
3168 ])
Damien Miller578783e2000-09-23 14:12:24 +11003169])
3170if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003171 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003172fi
3173
Damien Miller61e50f12000-05-08 20:49:37 +10003174AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003175 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3176 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
3177 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
3178 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003179])
3180if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003181 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003182 have_u_intxx_t=1
3183fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003184
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003185if test -z "$have_u_intxx_t" ; then
3186 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3188 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003189 [
Tim Rice648f8762011-01-26 12:38:57 -08003190 AC_DEFINE([HAVE_U_INTXX_T])
3191 AC_MSG_RESULT([yes])
3192 ], [ AC_MSG_RESULT([no])
3193 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003194fi
3195
Damien Miller578783e2000-09-23 14:12:24 +11003196AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3198 [[ u_int64_t a; a = 1;]])],
3199 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
3200 ])
Damien Miller578783e2000-09-23 14:12:24 +11003201])
3202if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003203 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003204 have_u_int64_t=1
3205fi
3206
Tim Rice4cec93f2002-02-26 08:40:48 -08003207if test -z "$have_u_int64_t" ; then
3208 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003209 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3210 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003211 [
Tim Rice648f8762011-01-26 12:38:57 -08003212 AC_DEFINE([HAVE_U_INT64_T])
3213 AC_MSG_RESULT([yes])
3214 ], [ AC_MSG_RESULT([no])
3215 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003216fi
3217
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003218if test -z "$have_u_intxx_t" ; then
3219 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003220 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003221#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003222 ]], [[
3223 uint8_t a;
3224 uint16_t b;
3225 uint32_t c;
3226 a = b = c = 1;
3227 ]])],
3228 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3229 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003230 ])
3231 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003232 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003233 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003234 fi
3235fi
3236
3237if test -z "$have_uintxx_t" ; then
3238 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003239 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3240 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003241 [
Tim Rice648f8762011-01-26 12:38:57 -08003242 AC_DEFINE([HAVE_UINTXX_T])
3243 AC_MSG_RESULT([yes])
3244 ], [ AC_MSG_RESULT([no])
3245 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003246fi
3247
Darren Tucker6d725682014-01-17 19:17:34 +11003248if test -z "$have_uintxx_t" ; then
3249 AC_MSG_CHECKING([for uintXX_t types in inttypes.h])
3250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]],
3251 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
3252 [
3253 AC_DEFINE([HAVE_UINTXX_T])
3254 AC_MSG_RESULT([yes])
3255 ], [ AC_MSG_RESULT([no])
3256 ])
3257fi
3258
Damien Milleredb82922000-06-20 13:25:52 +10003259if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003260 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003261then
3262 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003263 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003264#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003265 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003266 int8_t a; int16_t b; int32_t c;
3267 u_int8_t e; u_int16_t f; u_int32_t g;
3268 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003269 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003270 [
Tim Rice648f8762011-01-26 12:38:57 -08003271 AC_DEFINE([HAVE_U_INTXX_T])
3272 AC_DEFINE([HAVE_INTXX_T])
3273 AC_MSG_RESULT([yes])
3274 ], [AC_MSG_RESULT([no])
3275 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003276fi
3277
Damien Miller58be7382001-09-15 21:31:54 +10003278
3279AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003280 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3281 [[ u_char foo; foo = 125; ]])],
3282 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3283 ])
Damien Miller58be7382001-09-15 21:31:54 +10003284])
3285if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003286 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003287fi
3288
Darren Tucker007e3b32013-11-03 18:43:55 +11003289AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3290#include <sys/types.h>
3291#include <stdint.h>
3292])
3293
Tim Rice13aae5e2001-10-21 17:53:58 -07003294TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003295
Tim Rice648f8762011-01-26 12:38:57 -08003296AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3297AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003298#include <sys/types.h>
3299#ifdef HAVE_SYS_BITYPES_H
3300#include <sys/bitypes.h>
3301#endif
3302#ifdef HAVE_SYS_STATFS_H
3303#include <sys/statfs.h>
3304#endif
3305#ifdef HAVE_SYS_STATVFS_H
3306#include <sys/statvfs.h>
3307#endif
3308])
Tim Rice4cec93f2002-02-26 08:40:48 -08003309
Tim Rice648f8762011-01-26 12:38:57 -08003310AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003311[#include <sys/types.h>
3312#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003313
Damien Miller61e50f12000-05-08 20:49:37 +10003314AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3316 [[ size_t foo; foo = 1235; ]])],
3317 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3318 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003319])
3320if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003321 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003322fi
Damien Miller95058511999-12-29 10:36:45 +11003323
Damien Miller615f9392000-05-17 22:53:33 +10003324AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003325 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3326 [[ ssize_t foo; foo = 1235; ]])],
3327 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3328 ])
Damien Miller615f9392000-05-17 22:53:33 +10003329])
3330if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003331 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003332fi
3333
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003334AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003335 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3336 [[ clock_t foo; foo = 1235; ]])],
3337 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3338 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003339])
3340if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003341 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003342fi
3343
Damien Millerb54b40e2000-06-23 08:23:34 +10003344AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003345 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003346#include <sys/types.h>
3347#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003348 ]], [[ sa_family_t foo; foo = 1235; ]])],
3349 [ ac_cv_have_sa_family_t="yes" ],
3350 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003351#include <sys/types.h>
3352#include <sys/socket.h>
3353#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003354 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003355 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003356 [ ac_cv_have_sa_family_t="no" ]
3357 )
Tim Rice648f8762011-01-26 12:38:57 -08003358 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003359])
3360if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003361 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003362 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003363fi
3364
Damien Miller0f91b4e2000-06-18 15:43:25 +10003365AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3367 [[ pid_t foo; foo = 1235; ]])],
3368 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3369 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003370])
3371if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003372 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003373fi
3374
3375AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003376 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3377 [[ mode_t foo; foo = 1235; ]])],
3378 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3379 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003380])
3381if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003382 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003383fi
3384
Damien Miller61e50f12000-05-08 20:49:37 +10003385
3386AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003388#include <sys/types.h>
3389#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003390 ]], [[ struct sockaddr_storage s; ]])],
3391 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3392 [ ac_cv_have_struct_sockaddr_storage="no"
3393 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003394])
3395if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003396 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003397 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003398fi
Damien Miller34132e52000-01-14 15:45:46 +11003399
Damien Miller61e50f12000-05-08 20:49:37 +10003400AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003401 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003402#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003403#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003404 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3405 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3406 [ ac_cv_have_struct_sockaddr_in6="no"
3407 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003408])
3409if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003410 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003411 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003412fi
Damien Miller34132e52000-01-14 15:45:46 +11003413
Damien Miller61e50f12000-05-08 20:49:37 +10003414AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003415 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003416#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003417#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003418 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3419 [ ac_cv_have_struct_in6_addr="yes" ],
3420 [ ac_cv_have_struct_in6_addr="no"
3421 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003422])
3423if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003424 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003425 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003426
3427dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003428 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003429 [
3430#ifdef HAVE_SYS_TYPES_H
3431#include <sys/types.h>
3432#endif
3433#include <netinet/in.h>
3434 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003435fi
Damien Miller34132e52000-01-14 15:45:46 +11003436
Damien Miller61e50f12000-05-08 20:49:37 +10003437AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003438 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003439#include <sys/types.h>
3440#include <sys/socket.h>
3441#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003442 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3443 [ ac_cv_have_struct_addrinfo="yes" ],
3444 [ ac_cv_have_struct_addrinfo="no"
3445 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003446])
3447if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003448 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003449 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003450fi
3451
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003452AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003453 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3454 [[ struct timeval tv; tv.tv_sec = 1;]])],
3455 [ ac_cv_have_struct_timeval="yes" ],
3456 [ ac_cv_have_struct_timeval="no"
3457 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003458])
3459if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003460 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003461 have_struct_timeval=1
3462fi
3463
Tim Rice648f8762011-01-26 12:38:57 -08003464AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003465
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003466# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003467if test "x$ac_cv_have_int64_t" = "xno" && \
3468 test "x$ac_cv_sizeof_long_int" != "x8" && \
3469 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003470 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3471 echo "an alternative compiler (I.E., GCC) before continuing."
3472 echo ""
3473 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003474else
3475dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003476 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003477 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003478#include <stdio.h>
3479#include <string.h>
3480#ifdef HAVE_SNPRINTF
3481main()
3482{
3483 char buf[50];
3484 char expected_out[50];
3485 int mazsize = 50 ;
3486#if (SIZEOF_LONG_INT == 8)
3487 long int num = 0x7fffffffffffffff;
3488#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003489 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003490#endif
3491 strcpy(expected_out, "9223372036854775807");
3492 snprintf(buf, mazsize, "%lld", num);
3493 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003494 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003495 exit(0);
3496}
3497#else
3498main() { exit(0); }
3499#endif
Tim Rice648f8762011-01-26 12:38:57 -08003500 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003501 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003502 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003503fi
3504
Damien Miller78315eb2000-09-29 23:01:36 +11003505dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003506OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3507OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3508OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3509OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3510OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3511OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3512OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3513OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3514OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3515OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3516OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3517OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3518OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3519OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3520OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3521OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3522OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003523
3524AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003525AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3526struct passwd.pw_change, struct passwd.pw_expire],
3527[], [], [[
3528#include <sys/types.h>
3529#include <pwd.h>
3530]])
3531
Tim Rice648f8762011-01-26 12:38:57 -08003532AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003533 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003534[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003535#include <stdio.h>
3536#if HAVE_SYS_TYPES_H
3537# include <sys/types.h>
3538#endif
3539#include <netinet/in.h>
3540#include <arpa/nameser.h>
3541#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003542]])
andre2ff7b5d2000-06-03 14:57:40 +00003543
Damien Miller61e50f12000-05-08 20:49:37 +10003544AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3545 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003546 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003547#include <sys/types.h>
3548#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003549 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3550 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3551 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003552])
3553if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003554 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003555fi
3556
Damien Miller61e50f12000-05-08 20:49:37 +10003557AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3558 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003559 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003560#include <sys/types.h>
3561#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003562 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3563 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3564 [ ac_cv_have___ss_family_in_struct_ss="no"
3565 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003566])
3567if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003568 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003569 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003570fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003571
Tim Rice28bbb0c2002-05-27 17:37:32 -07003572dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003573AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3574 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003576#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003577#include <sys/socket.h>
3578#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003579 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003580#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003581#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003582exit(1);
3583#endif
3584struct msghdr m;
3585m.msg_accrights = 0;
3586exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003587 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003588 [ ac_cv_have_accrights_in_msghdr="yes" ],
3589 [ ac_cv_have_accrights_in_msghdr="no" ]
3590 )
3591])
3592if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003593 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003594 [Define if your system uses access rights style
3595 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003596fi
3597
Tim Rice648f8762011-01-26 12:38:57 -08003598AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3599AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003600#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003601#include <sys/stat.h>
3602#ifdef HAVE_SYS_TIME_H
3603# include <sys/time.h>
3604#endif
3605#ifdef HAVE_SYS_MOUNT_H
3606#include <sys/mount.h>
3607#endif
3608#ifdef HAVE_SYS_STATVFS_H
3609#include <sys/statvfs.h>
3610#endif
Tim Rice648f8762011-01-26 12:38:57 -08003611 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3612 [ AC_MSG_RESULT([yes]) ],
3613 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003614
Tim Rice648f8762011-01-26 12:38:57 -08003615 AC_MSG_CHECKING([if fsid_t has member val])
3616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003617#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003618#include <sys/statvfs.h>
3619 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3620 [ AC_MSG_RESULT([yes])
3621 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3622 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003623
Tim Rice648f8762011-01-26 12:38:57 -08003624 AC_MSG_CHECKING([if f_fsid has member __val])
3625 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003626#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003627#include <sys/statvfs.h>
3628 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3629 [ AC_MSG_RESULT([yes])
3630 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3631 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003632])
Darren Tucker77001382008-06-09 06:17:53 +10003633
Kevin Stevesa44e0352002-04-07 16:18:03 +00003634AC_CACHE_CHECK([for msg_control field in struct msghdr],
3635 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003636 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003637#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003638#include <sys/socket.h>
3639#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003640 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003641#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003642#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003643exit(1);
3644#endif
3645struct msghdr m;
3646m.msg_control = 0;
3647exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003648 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003649 [ ac_cv_have_control_in_msghdr="yes" ],
3650 [ ac_cv_have_control_in_msghdr="no" ]
3651 )
3652])
3653if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003654 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003655 [Define if your system uses ancillary data style
3656 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003657fi
3658
Damien Miller61e50f12000-05-08 20:49:37 +10003659AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003660 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3661 [[ extern char *__progname; printf("%s", __progname); ]])],
3662 [ ac_cv_libc_defines___progname="yes" ],
3663 [ ac_cv_libc_defines___progname="no"
3664 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003665])
3666if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003667 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003668fi
3669
Kevin Steves4846f4a2002-03-22 18:19:53 +00003670AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003671 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3672 [[ printf("%s", __FUNCTION__); ]])],
3673 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3674 [ ac_cv_cc_implements___FUNCTION__="no"
3675 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003676])
3677if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003678 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003679 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003680fi
3681
3682AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003683 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3684 [[ printf("%s", __func__); ]])],
3685 [ ac_cv_cc_implements___func__="yes" ],
3686 [ ac_cv_cc_implements___func__="no"
3687 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003688])
3689if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003690 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003691fi
3692
Damien Miller57f39152005-11-24 19:58:19 +11003693AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003694 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3695#include <stdarg.h>
3696va_list x,y;
3697 ]], [[ va_copy(x,y); ]])],
3698 [ ac_cv_have_va_copy="yes" ],
3699 [ ac_cv_have_va_copy="no"
3700 ])
Damien Miller57f39152005-11-24 19:58:19 +11003701])
3702if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003703 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003704fi
3705
3706AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003707 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3708#include <stdarg.h>
3709va_list x,y;
3710 ]], [[ __va_copy(x,y); ]])],
3711 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3712 ])
Damien Miller57f39152005-11-24 19:58:19 +11003713])
3714if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003715 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003716fi
3717
Damien Miller4f8e6692001-07-14 13:22:53 +10003718AC_CACHE_CHECK([whether getopt has optreset support],
3719 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003720 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3721 [[ extern int optreset; optreset = 0; ]])],
3722 [ ac_cv_have_getopt_optreset="yes" ],
3723 [ ac_cv_have_getopt_optreset="no"
3724 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003725])
3726if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003727 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003728 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003729fi
Damien Millera22ba012000-03-02 23:09:20 +11003730
Damien Millerecbb26d2000-07-15 14:59:14 +10003731AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003732 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3733[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3734 [ ac_cv_libc_defines_sys_errlist="yes" ],
3735 [ ac_cv_libc_defines_sys_errlist="no"
3736 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003737])
3738if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003739 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003740 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003741fi
3742
3743
Damien Miller11fa2cc2000-08-16 10:35:58 +10003744AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003745 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3746[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3747 [ ac_cv_libc_defines_sys_nerr="yes" ],
3748 [ ac_cv_libc_defines_sys_nerr="no"
3749 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003750])
3751if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003752 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003753fi
3754
Darren Tucker5f88d342003-10-15 16:57:57 +10003755# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003756AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3757 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003758 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003759 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003760 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003761 AC_SEARCH_LIBS([res_query], [resolv])
3762 AC_SEARCH_LIBS([dn_expand], [resolv])
3763 AC_MSG_CHECKING([if res_query will link])
3764 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003765#include <sys/types.h>
3766#include <netinet/in.h>
3767#include <arpa/nameser.h>
3768#include <netdb.h>
3769#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003770 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003771 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003772 ]])],
3773 AC_MSG_RESULT([yes]),
3774 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003775 saved_LIBS="$LIBS"
3776 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003777 AC_MSG_CHECKING([for res_query in -lresolv])
3778 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003779#include <sys/types.h>
3780#include <netinet/in.h>
3781#include <arpa/nameser.h>
3782#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003783#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003784 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003785 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003786 ]])],
3787 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003788 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003789 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003790 ])
Tim Rice648f8762011-01-26 12:38:57 -08003791 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003792 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003793 [#include <sys/types.h>
3794 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003795 AC_CHECK_MEMBER([HEADER.ad],
3796 [AC_DEFINE([HAVE_HEADER_AD], [1],
3797 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003798 [#include <arpa/nameser.h>])
3799 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003800
Tim Rice648f8762011-01-26 12:38:57 -08003801AC_MSG_CHECKING([if struct __res_state _res is an extern])
3802AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003803#include <stdio.h>
3804#if HAVE_SYS_TYPES_H
3805# include <sys/types.h>
3806#endif
3807#include <netinet/in.h>
3808#include <arpa/nameser.h>
3809#include <resolv.h>
3810extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003811 ]], [[ ]])],
3812 [AC_MSG_RESULT([yes])
3813 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003814 [Define if you have struct __res_state _res as an extern])
3815 ],
Tim Rice648f8762011-01-26 12:38:57 -08003816 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003817)
3818
Damien Miller73b42d22006-04-22 21:26:08 +10003819# Check whether user wants SELinux support
3820SELINUX_MSG="no"
3821LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003822AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003823 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003824 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003825 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003826 AC_DEFINE([WITH_SELINUX], [1],
3827 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003828 SELINUX_MSG="yes"
3829 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003830 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3831 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003832 [ LIBSELINUX="-lselinux"
3833 LIBS="$LIBS -lselinux"
3834 ],
Tim Rice648f8762011-01-26 12:38:57 -08003835 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003836 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003837 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003838 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003839 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003840 fi ]
3841)
Tim Rice648f8762011-01-26 12:38:57 -08003842AC_SUBST([SSHLIBS])
3843AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003844
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003845# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003846KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003847AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003848 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003849 [ if test "x$withval" != "xno" ; then
3850 if test "x$withval" = "xyes" ; then
3851 KRB5ROOT="/usr/local"
3852 else
3853 KRB5ROOT=${withval}
3854 fi
3855
Tim Rice648f8762011-01-26 12:38:57 -08003856 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003857 KRB5_MSG="yes"
3858
Tim Rice648f8762011-01-26 12:38:57 -08003859 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003860 [$KRB5ROOT/bin/krb5-config],
3861 [$KRB5ROOT/bin:$PATH])
3862 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003863 K5CFLAGS="`$KRB5CONF --cflags`"
3864 K5LIBS="`$KRB5CONF --libs`"
3865 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003866
Tim Rice648f8762011-01-26 12:38:57 -08003867 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003868 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003869 AC_MSG_RESULT([yes])
3870 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003871 [Define this if you want GSSAPI
3872 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003873 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3874 GSSLIBS="`$KRB5CONF --libs gssapi`"
3875 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003876 else
Tim Rice648f8762011-01-26 12:38:57 -08003877 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003878 fi
Tim Rice648f8762011-01-26 12:38:57 -08003879 AC_MSG_CHECKING([whether we are using Heimdal])
3880 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3881 ]], [[ char *tmp = heimdal_version; ]])],
3882 [ AC_MSG_RESULT([yes])
3883 AC_DEFINE([HEIMDAL], [1],
3884 [Define this if you are using the Heimdal
3885 version of Kerberos V5]) ],
3886 [AC_MSG_RESULT([no])
3887 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003888 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003889 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003890 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003891 AC_MSG_CHECKING([whether we are using Heimdal])
3892 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3893 ]], [[ char *tmp = heimdal_version; ]])],
3894 [ AC_MSG_RESULT([yes])
3895 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003896 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003897 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003898 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003899 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003900 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003901 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003902 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003903 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003904
3905 ])
3906 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003907
Tim Rice648f8762011-01-26 12:38:57 -08003908 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3909 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003910 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003911 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3912 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003913 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003914 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3915 [ AC_DEFINE([GSSAPI])
3916 GSSLIBS="-lgss" ],
3917 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3918 ])
Darren Tucker964de182013-02-22 10:39:59 +11003919 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003920
Tim Rice648f8762011-01-26 12:38:57 -08003921 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003922 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003923 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003924 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003925 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003926 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003927 ]
3928 )
3929
3930 oldCPP="$CPPFLAGS"
3931 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003932 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003933 [ CPPFLAGS="$oldCPP" ])
3934
Damien Millera8e06ce2003-11-21 23:48:55 +11003935 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003936 if test ! -z "$need_dash_r" ; then
3937 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3938 fi
3939 if test ! -z "$blibpath" ; then
3940 blibpath="$blibpath:${KRB5ROOT}/lib"
3941 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003942
Tim Rice648f8762011-01-26 12:38:57 -08003943 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3944 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3945 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003946
Tim Rice648f8762011-01-26 12:38:57 -08003947 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3948 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11003949
3950 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
3951#ifdef HAVE_GSSAPI_H
3952# include <gssapi.h>
3953#elif defined(HAVE_GSSAPI_GSSAPI_H)
3954# include <gssapi/gssapi.h>
3955#endif
3956
3957#ifdef HAVE_GSSAPI_GENERIC_H
3958# include <gssapi_generic.h>
3959#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
3960# include <gssapi/gssapi_generic.h>
3961#endif
3962 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10003963 saved_LIBS="$LIBS"
3964 LIBS="$LIBS $K5LIBS"
3965 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
3966 LIBS="$saved_LIBS"
3967
Darren Tucker0d27ed12004-02-24 10:37:33 +11003968 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003969 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003970)
Darren Tucker964de182013-02-22 10:39:59 +11003971AC_SUBST([GSSLIBS])
3972AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10003973
Damien Millera22ba012000-03-02 23:09:20 +11003974# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003975
Damien Millerf58c6722002-05-13 13:15:42 +10003976PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003977AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003978 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003979 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003980 if test -n "$withval" && test "x$withval" != "xno" && \
3981 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003982 PRIVSEP_PATH=$withval
3983 fi
3984 ]
3985)
Tim Rice648f8762011-01-26 12:38:57 -08003986AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003987
Tim Rice648f8762011-01-26 12:38:57 -08003988AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003989 [ --with-xauth=PATH Specify path to xauth program ],
3990 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003991 if test -n "$withval" && test "x$withval" != "xno" && \
3992 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003993 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003994 fi
3995 ],
3996 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003997 TestPath="$PATH"
3998 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3999 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
4000 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
4001 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08004002 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10004003 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11004004 xauth_path="/usr/openwin/bin/xauth"
4005 fi
4006 ]
4007)
4008
Damien Miller7d901272003-01-13 16:55:22 +11004009STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08004010AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11004011 [ --disable-strip Disable calling strip(1) on install],
4012 [
4013 if test "x$enableval" = "xno" ; then
4014 STRIP_OPT=
4015 fi
4016 ]
4017)
Tim Rice648f8762011-01-26 12:38:57 -08004018AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11004019
Damien Millera19cf472000-11-29 13:28:50 +11004020if test -z "$xauth_path" ; then
4021 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08004022 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11004023else
Tim Rice648f8762011-01-26 12:38:57 -08004024 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07004025 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11004026 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08004027 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11004028fi
Damien Millera22ba012000-03-02 23:09:20 +11004029
Tim Rice90f42b02011-06-02 18:17:49 -07004030dnl # --with-maildir=/path/to/mail gets top priority.
4031dnl # if maildir is set in the platform case statement above we use that.
4032dnl # Otherwise we run a program to get the dir from system headers.
4033dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
4034dnl # If we find _PATH_MAILDIR we do nothing because that is what
4035dnl # session.c expects anyway. Otherwise we set to the value found
4036dnl # stripping any trailing slash. If for some strage reason our program
4037dnl # does not find what it needs, we default to /var/spool/mail.
4038# Check for mail directory
4039AC_ARG_WITH([maildir],
4040 [ --with-maildir=/path/to/mail Specify your system mail directory],
4041 [
4042 if test "X$withval" != X && test "x$withval" != xno && \
4043 test "x${withval}" != xyes; then
4044 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
4045 [Set this to your mail directory if you do not have _PATH_MAILDIR])
4046 fi
4047 ],[
4048 if test "X$maildir" != "X"; then
4049 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4050 else
4051 AC_MSG_CHECKING([Discovering system mail directory])
4052 AC_RUN_IFELSE(
4053 [AC_LANG_PROGRAM([[
4054#include <stdio.h>
4055#include <string.h>
4056#ifdef HAVE_PATHS_H
4057#include <paths.h>
4058#endif
4059#ifdef HAVE_MAILLOCK_H
4060#include <maillock.h>
4061#endif
4062#define DATA "conftest.maildir"
4063 ]], [[
4064 FILE *fd;
4065 int rc;
4066
4067 fd = fopen(DATA,"w");
4068 if(fd == NULL)
4069 exit(1);
4070
4071#if defined (_PATH_MAILDIR)
4072 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4073 exit(1);
4074#elif defined (MAILDIR)
4075 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4076 exit(1);
4077#elif defined (_PATH_MAIL)
4078 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4079 exit(1);
4080#else
4081 exit (2);
4082#endif
4083
4084 exit(0);
4085 ]])],
4086 [
4087 maildir_what=`awk -F: '{print $1}' conftest.maildir`
4088 maildir=`awk -F: '{print $2}' conftest.maildir \
4089 | sed 's|/$||'`
4090 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4091 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4092 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4093 fi
4094 ],
4095 [
4096 if test "X$ac_status" = "X2";then
4097# our test program didn't find it. Default to /var/spool/mail
4098 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4099 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4100 else
4101 AC_MSG_RESULT([*** not found ***])
4102 fi
4103 ],
4104 [
4105 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4106 ]
4107 )
4108 fi
4109 ]
4110) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004111
Darren Tucker623d92f2004-09-12 22:36:15 +10004112if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004113 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4114 disable_ptmx_check=yes
4115fi
Damien Millera22ba012000-03-02 23:09:20 +11004116if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004117 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004118 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004119 [
Tim Rice648f8762011-01-26 12:38:57 -08004120 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004121 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004122 have_dev_ptmx=1
4123 ]
4124 )
4125 fi
Damien Millera22ba012000-03-02 23:09:20 +11004126fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004127
Darren Tucker623d92f2004-09-12 22:36:15 +10004128if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004129 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004130 [
Tim Rice648f8762011-01-26 12:38:57 -08004131 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004132 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004133 have_dev_ptc=1
4134 ]
4135 )
4136else
4137 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4138fi
Damien Miller204ad072000-03-02 23:56:12 +11004139
Damien Millera22ba012000-03-02 23:09:20 +11004140# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004141AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004142 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004143 [
Damien Miller897741e2001-04-16 10:41:46 +10004144 case "$withval" in
4145 man|cat|doc)
4146 MANTYPE=$withval
4147 ;;
4148 *)
Tim Rice648f8762011-01-26 12:38:57 -08004149 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004150 ;;
4151 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004152 ]
4153)
Ben Lindstrombc709922001-04-18 18:04:21 +00004154if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004155 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004156 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004157 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4158 MANTYPE=doc
4159 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4160 MANTYPE=man
4161 else
4162 MANTYPE=cat
4163 fi
4164fi
Tim Rice648f8762011-01-26 12:38:57 -08004165AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004166if test "$MANTYPE" = "doc"; then
4167 mansubdir=man;
4168else
4169 mansubdir=$MANTYPE;
4170fi
Tim Rice648f8762011-01-26 12:38:57 -08004171AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004172
Damien Millera22ba012000-03-02 23:09:20 +11004173# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004174MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004175AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004176 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004177 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004178 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004179 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004180 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004181 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004182 fi
4183 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004184)
4185
Damien Millera22ba012000-03-02 23:09:20 +11004186# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004187AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004188 [ --without-shadow Disable shadow password support],
4189 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004190 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004191 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004192 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004193 fi
4194 ]
4195)
4196
Damien Miller1f335fb2000-06-26 11:31:33 +10004197if test -z "$disable_shadow" ; then
4198 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004199 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004200#include <sys/types.h>
4201#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004202struct spwd sp;
4203 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4204 [ sp_expire_available=yes ], [
4205 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004206
4207 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004208 AC_MSG_RESULT([yes])
4209 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004210 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004211 else
Tim Rice648f8762011-01-26 12:38:57 -08004212 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004213 fi
4214fi
4215
Damien Millera22ba012000-03-02 23:09:20 +11004216# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004217if test ! -z "$IPADDR_IN_DISPLAY" ; then
4218 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004219 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004220 [Define if you need to use IP address
4221 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004222else
Damien Millera8e06ce2003-11-21 23:48:55 +11004223 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004224 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004225 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4226 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004227 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004228 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004229 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004230 fi
4231 ]
4232 )
4233fi
Damien Miller76112de1999-12-21 11:18:08 +11004234
Darren Tuckere1a790d2003-09-16 11:52:19 +10004235# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004236AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004237 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004238 [ if test "x$enableval" = "xno"; then
4239 AC_MSG_NOTICE([/etc/default/login handling disabled])
4240 etc_default_login=no
4241 else
4242 etc_default_login=yes
4243 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004244 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4245 then
4246 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4247 etc_default_login=no
4248 else
4249 etc_default_login=yes
4250 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004251)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004252
Darren Tucker2f9573d2005-02-10 22:28:54 +11004253if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004254 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004255 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004256 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004257 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004258 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004259 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004260fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004261
Tim Rice43a1c132002-04-17 21:19:14 -07004262dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004263if test $ac_cv_func_login_getcapbool = "yes" && \
4264 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004265 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004266fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004267
Damien Millera22ba012000-03-02 23:09:20 +11004268# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004269SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004270AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004271 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004272 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004273 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004274 AC_MSG_WARN([
4275--with-default-path=PATH has no effect on this system.
4276Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004277 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004278 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004279 AC_MSG_WARN([
4280--with-default-path=PATH will only be used if PATH is not defined in
4281$external_path_file .])
4282 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004283 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004284 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004285 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004286 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004287 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4288 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004289 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004290 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004291 AC_MSG_WARN([
4292If PATH is defined in $external_path_file, ensure the path to scp is included,
4293otherwise scp will not work.])
4294 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004295 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004296 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004297/* find out what STDPATH is */
4298#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004299#ifdef HAVE_PATHS_H
4300# include <paths.h>
4301#endif
4302#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004303# ifdef _PATH_USERPATH /* Irix */
4304# define _PATH_STDPATH _PATH_USERPATH
4305# else
4306# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4307# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004308#endif
4309#include <sys/types.h>
4310#include <sys/stat.h>
4311#include <fcntl.h>
4312#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004313 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004314 FILE *fd;
4315 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004316
Tim Rice59ea0a02001-03-10 13:50:45 -08004317 fd = fopen(DATA,"w");
4318 if(fd == NULL)
4319 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004320
Tim Rice59ea0a02001-03-10 13:50:45 -08004321 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4322 exit(1);
4323
4324 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004325 ]])],
4326 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004327 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4328 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4329 )
4330# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004331 t_bindir="${bindir}"
4332 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4333 t_bindir=`eval echo ${t_bindir}`
4334 case $t_bindir in
4335 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4336 esac
4337 case $t_bindir in
4338 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4339 esac
4340 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004341 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4342 if test $? -ne 0 ; then
4343 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4344 if test $? -ne 0 ; then
4345 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004346 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004347 fi
4348 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004349 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004350)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004351if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004352 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4353 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004354fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004355
Damien Millera18bbd32002-05-13 10:48:57 +10004356# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004357AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004358 [ --with-superuser-path= Specify different path for super-user],
4359 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004360 if test -n "$withval" && test "x$withval" != "xno" && \
4361 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004362 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004363 [Define if you want a different $PATH
4364 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004365 superuser_path=$withval
4366 fi
4367 ]
4368)
4369
4370
Damien Miller61e50f12000-05-08 20:49:37 +10004371AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004372IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004373AC_ARG_WITH(4in6,
4374 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4375 [
4376 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004377 AC_MSG_RESULT([yes])
4378 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004379 [Detect IPv4 in IPv6 mapped addresses
4380 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004381 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004382 else
Tim Rice648f8762011-01-26 12:38:57 -08004383 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004384 fi
Tim Rice648f8762011-01-26 12:38:57 -08004385 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004386 if test "x$inet6_default_4in6" = "xyes"; then
4387 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004388 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004389 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004390 else
4391 AC_MSG_RESULT([no (default)])
4392 fi
4393 ]
4394)
4395
Damien Miller60396b02001-02-18 17:01:00 +11004396# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004397BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004398AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004399 [ --with-bsd-auth Enable BSD auth support],
4400 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004401 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004402 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004403 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004404 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004405 fi
4406 ]
4407)
4408
Damien Millera22ba012000-03-02 23:09:20 +11004409# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004410piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004411# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004412if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004413 piddir=`eval echo ${sysconfdir}`
4414 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004415 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004416 esac
4417fi
4418
Tim Rice648f8762011-01-26 12:38:57 -08004419AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004420 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4421 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004422 if test -n "$withval" && test "x$withval" != "xno" && \
4423 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004424 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004425 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004426 AC_MSG_WARN([** no $piddir directory on this system **])
4427 fi
4428 fi
4429 ]
4430)
4431
Tim Rice648f8762011-01-26 12:38:57 -08004432AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4433 [Specify location of ssh.pid])
4434AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004435
andre2ff7b5d2000-06-03 14:57:40 +00004436dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004437AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004438 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004439 [
4440 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004441 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004442 fi
4443 ]
andre2ff7b5d2000-06-03 14:57:40 +00004444)
Tim Rice648f8762011-01-26 12:38:57 -08004445AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004446 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004447 [
4448 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004449 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004450 fi
4451 ]
andre2ff7b5d2000-06-03 14:57:40 +00004452)
Tim Rice648f8762011-01-26 12:38:57 -08004453AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004454 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004455 [
4456 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004457 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004458 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004459 fi
4460 ]
andre2ff7b5d2000-06-03 14:57:40 +00004461)
Tim Rice648f8762011-01-26 12:38:57 -08004462AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004463 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004464 [
4465 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004466 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004467 fi
4468 ]
andre2ff7b5d2000-06-03 14:57:40 +00004469)
Tim Rice648f8762011-01-26 12:38:57 -08004470AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004471 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004472 [
4473 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004474 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004475 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004476 fi
4477 ]
andre2ff7b5d2000-06-03 14:57:40 +00004478)
Tim Rice648f8762011-01-26 12:38:57 -08004479AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004480 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004481 [
4482 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004483 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004484 fi
4485 ]
andre2ff7b5d2000-06-03 14:57:40 +00004486)
Tim Rice648f8762011-01-26 12:38:57 -08004487AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004488 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004489 [
4490 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004491 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004492 [Define if you don't want to use pututline()
4493 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004494 fi
4495 ]
andre2ff7b5d2000-06-03 14:57:40 +00004496)
Tim Rice648f8762011-01-26 12:38:57 -08004497AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004498 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004499 [
4500 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004501 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004502 [Define if you don't want to use pututxline()
4503 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004504 fi
4505 ]
andre2ff7b5d2000-06-03 14:57:40 +00004506)
Tim Rice648f8762011-01-26 12:38:57 -08004507AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004508 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004509 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004510 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004511 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004512 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004513 conf_lastlog_location=$withval
4514 fi
4515 ]
4516)
andre2ff7b5d2000-06-03 14:57:40 +00004517
4518dnl lastlog, [uw]tmpx? detection
4519dnl NOTE: set the paths in the platform section to avoid the
4520dnl need for command-line parameters
4521dnl lastlog and [uw]tmp are subject to a file search if all else fails
4522
4523dnl lastlog detection
4524dnl NOTE: the code itself will detect if lastlog is a directory
4525AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004526AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004527#include <sys/types.h>
4528#include <utmp.h>
4529#ifdef HAVE_LASTLOG_H
4530# include <lastlog.h>
4531#endif
Damien Miller2994e082000-06-04 15:51:47 +10004532#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004533# include <paths.h>
4534#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004535#ifdef HAVE_LOGIN_H
4536# include <login.h>
4537#endif
Tim Rice648f8762011-01-26 12:38:57 -08004538 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4539 [ AC_MSG_RESULT([yes]) ],
4540 [
4541 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004542 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004544#include <sys/types.h>
4545#include <utmp.h>
4546#ifdef HAVE_LASTLOG_H
4547# include <lastlog.h>
4548#endif
4549#ifdef HAVE_PATHS_H
4550# include <paths.h>
4551#endif
Tim Rice648f8762011-01-26 12:38:57 -08004552 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4553 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004554 [
Tim Rice648f8762011-01-26 12:38:57 -08004555 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004556 system_lastlog_path=no
4557 ])
Tim Rice648f8762011-01-26 12:38:57 -08004558])
Damien Miller2994e082000-06-04 15:51:47 +10004559
andre2ff7b5d2000-06-03 14:57:40 +00004560if test -z "$conf_lastlog_location"; then
4561 if test x"$system_lastlog_path" = x"no" ; then
4562 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004563 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004564 conf_lastlog_location=$f
4565 fi
4566 done
4567 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004568 AC_MSG_WARN([** Cannot find lastlog **])
4569 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004570 fi
4571 fi
4572fi
4573
4574if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004575 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004576 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004577fi
andre2ff7b5d2000-06-03 14:57:40 +00004578
4579dnl utmp detection
4580AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004581AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004582#include <sys/types.h>
4583#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004584#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004585# include <paths.h>
4586#endif
Tim Rice648f8762011-01-26 12:38:57 -08004587 ]], [[ char *utmp = UTMP_FILE; ]])],
4588 [ AC_MSG_RESULT([yes]) ],
4589 [ AC_MSG_RESULT([no])
4590 system_utmp_path=no
4591])
andre2ff7b5d2000-06-03 14:57:40 +00004592if test -z "$conf_utmp_location"; then
4593 if test x"$system_utmp_path" = x"no" ; then
4594 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4595 if test -f $f ; then
4596 conf_utmp_location=$f
4597 fi
4598 done
4599 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004600 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004601 fi
4602 fi
4603fi
4604if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004605 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004606 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004607fi
andre2ff7b5d2000-06-03 14:57:40 +00004608
4609dnl wtmp detection
4610AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004611AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004612#include <sys/types.h>
4613#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004614#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004615# include <paths.h>
4616#endif
Tim Rice648f8762011-01-26 12:38:57 -08004617 ]], [[ char *wtmp = WTMP_FILE; ]])],
4618 [ AC_MSG_RESULT([yes]) ],
4619 [ AC_MSG_RESULT([no])
4620 system_wtmp_path=no
4621])
andre2ff7b5d2000-06-03 14:57:40 +00004622if test -z "$conf_wtmp_location"; then
4623 if test x"$system_wtmp_path" = x"no" ; then
4624 for f in /usr/adm/wtmp /var/log/wtmp; do
4625 if test -f $f ; then
4626 conf_wtmp_location=$f
4627 fi
4628 done
4629 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004630 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004631 fi
4632 fi
4633fi
4634if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004635 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004636 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004637fi
andre2ff7b5d2000-06-03 14:57:40 +00004638
andre2ff7b5d2000-06-03 14:57:40 +00004639dnl wtmpx detection
4640AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004641AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004642#include <sys/types.h>
4643#include <utmp.h>
4644#ifdef HAVE_UTMPX_H
4645#include <utmpx.h>
4646#endif
Damien Miller2994e082000-06-04 15:51:47 +10004647#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004648# include <paths.h>
4649#endif
Tim Rice648f8762011-01-26 12:38:57 -08004650 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4651 [ AC_MSG_RESULT([yes]) ],
4652 [ AC_MSG_RESULT([no])
4653 system_wtmpx_path=no
4654])
andre2ff7b5d2000-06-03 14:57:40 +00004655if test -z "$conf_wtmpx_location"; then
4656 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004657 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004658 fi
4659else
Tim Rice648f8762011-01-26 12:38:57 -08004660 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004661 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004662fi
andre2ff7b5d2000-06-03 14:57:40 +00004663
Damien Miller4018c192000-04-30 09:30:44 +10004664
Damien Miller29ea30d2000-03-17 10:54:15 +11004665if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004666 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4667 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004668fi
4669
Damien Millera2438bb2013-03-15 10:23:07 +11004670AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004671 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004672 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004673 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004674 ], [
4675#ifdef HAVE_SYS_TYPES_H
4676#include <sys/types.h>
4677#endif
4678#ifdef HAVE_UTMP_H
4679#include <utmp.h>
4680#endif
4681#ifdef HAVE_UTMPX_H
4682#include <utmpx.h>
4683#endif
4684#ifdef HAVE_LASTLOG_H
4685#include <lastlog.h>
4686#endif
4687 ])
4688
4689AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4690 AC_DEFINE([DISABLE_UTMP])
4691 AC_DEFINE([DISABLE_WTMP])
4692 ], [
4693#ifdef HAVE_SYS_TYPES_H
4694#include <sys/types.h>
4695#endif
4696#ifdef HAVE_UTMP_H
4697#include <utmp.h>
4698#endif
4699#ifdef HAVE_UTMPX_H
4700#include <utmpx.h>
4701#endif
4702#ifdef HAVE_LASTLOG_H
4703#include <lastlog.h>
4704#endif
4705 ])
4706
Darren Tucker7da23cb2005-08-03 00:20:15 +10004707dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4708dnl Add now.
4709CFLAGS="$CFLAGS $werror_flags"
4710
Darren Tucker627337d2010-04-10 22:58:01 +10004711if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4712 TEST_SSH_IPV6=no
4713else
4714 TEST_SSH_IPV6=yes
4715fi
Tim Rice648f8762011-01-26 12:38:57 -08004716AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4717AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker882abfd2013-11-09 00:17:41 +11004718AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10004719AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker5d376902008-06-11 04:15:05 +10004720
Damien Millerbac2d8a2000-09-05 16:13:06 +11004721AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004722AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4723 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004724 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004725AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004726
Damien Miller7b22d652000-06-18 14:07:04 +10004727# Print summary of options
4728
Damien Miller7b22d652000-06-18 14:07:04 +10004729# Someone please show me a better way :)
4730A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4731B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4732C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4733D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004734E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004735F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004736G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004737H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4738I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4739J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004740
4741echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004742echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004743echo " User binaries: $B"
4744echo " System binaries: $C"
4745echo " Configuration files: $D"
4746echo " Askpass program: $E"
4747echo " Manual pages: $F"
4748echo " PID file: $G"
4749echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004750if test "x$external_path_file" = "x/etc/login.conf" ; then
4751echo " At runtime, sshd will use the path defined in $external_path_file"
4752echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004753else
Damien Millerf58c6722002-05-13 13:15:42 +10004754echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004755 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004756echo " (If PATH is set in $external_path_file it will be used instead. If"
4757echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4758 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004759fi
Damien Millera18bbd32002-05-13 10:48:57 +10004760if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004761echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004762fi
Damien Millerf58c6722002-05-13 13:15:42 +10004763echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004764echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004765echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004766echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004767echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004768echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004769echo " S/KEY support: $SKEY_MSG"
4770echo " TCP Wrappers support: $TCPW_MSG"
4771echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004772echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004773echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004774echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004775echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004776echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4777echo " BSD Auth support: $BSD_AUTH_MSG"
4778echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004779echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004780
Damien Miller7b22d652000-06-18 14:07:04 +10004781echo ""
4782
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004783echo " Host: ${host}"
4784echo " Compiler: ${CC}"
4785echo " Compiler flags: ${CFLAGS}"
4786echo "Preprocessor flags: ${CPPFLAGS}"
4787echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004788echo " Libraries: ${LIBS}"
4789if test ! -z "${SSHDLIBS}"; then
4790echo " +for sshd: ${SSHDLIBS}"
4791fi
Damien Miller71adf122011-01-25 12:16:15 +11004792if test ! -z "${SSHLIBS}"; then
4793echo " +for ssh: ${SSHLIBS}"
4794fi
Damien Miller7b22d652000-06-18 14:07:04 +10004795
4796echo ""
4797
Tim Rice6f1f7582004-05-30 21:38:51 -07004798if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004799 echo "SVR4 style packages are supported with \"make package\""
4800 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004801fi
4802
Damien Miller82cf0ce2000-12-20 13:34:48 +11004803if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004804 echo "PAM is enabled. You may need to install a PAM control file "
4805 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004806 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004807 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004808 echo ""
4809fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004810
Damien Millerb4097182004-05-23 14:09:40 +10004811if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004812 echo "WARNING: the operating system that you are using does not"
4813 echo "appear to support getpeereid(), getpeerucred() or the"
4814 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4815 echo "enforce security checks to prevent unauthorised connections to"
4816 echo "ssh-agent. Their absence increases the risk that a malicious"
4817 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004818 echo ""
4819fi
4820
Darren Tuckerd9f88912005-02-20 21:01:48 +11004821if test "$AUDIT_MODULE" = "bsm" ; then
4822 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4823 echo "See the Solaris section in README.platform for details."
4824fi