blob: 5d4793cae26e9faefd4b5107e3c35eb7224e6070 [file] [log] [blame]
Darren Tucker37bcef52013-11-09 18:39:25 +11001# $Id: configure.ac,v 1.541 2013/11/09 07:39:25 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 Tucker37bcef52013-11-09 18:39:25 +110018AC_REVISION($Revision: 1.541 $)
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])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100123use_stack_protector=1
Tim Rice648f8762011-01-26 12:38:57 -0800124AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100125 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100126 if test "x$withval" = "xno"; then
127 use_stack_protector=0
128 fi ])
129
Damien Miller134d02a2011-01-12 16:00:37 +1100130
Damien Millera8e06ce2003-11-21 23:48:55 +1100131if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerc54e3e02013-05-10 18:53:14 +1000132 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments -Werror],
133 [-Qunused-arguments])
134 OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option -Werror],
135 [-Wno-unknown-warning-option])
Damien Millerb1763622011-05-20 11:45:25 +1000136 OSSH_CHECK_CFLAG_COMPILE([-Wall])
137 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
138 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
139 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
140 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000141 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000142 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
143 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
144 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100145 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Tim Rice648f8762011-01-26 12:38:57 -0800146 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100147 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700148 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000149 1.*) no_attrib_nonnull=1 ;;
150 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000151 no_attrib_nonnull=1
152 ;;
153 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100154 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700155 esac
Tim Rice648f8762011-01-26 12:38:57 -0800156 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000157
Tim Rice648f8762011-01-26 12:38:57 -0800158 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000159 saved_CFLAGS="$CFLAGS"
160 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800161 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
162 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
163 [ AC_MSG_RESULT([yes]) ],
164 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000165 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800166 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000167
Darren Tuckerb7918af2008-03-09 11:34:23 +1100168 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100169 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100170 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100171 if test "x$use_stack_protector" = "x1"; then
172 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800173 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100174 saved_CFLAGS="$CFLAGS"
175 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100176 CFLAGS="$CFLAGS $t -Werror"
177 LDFLAGS="$LDFLAGS $t -Werror"
178 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800179 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
180 [[
181 char x[256];
182 snprintf(x, sizeof(x), "XXX");
183 ]])],
184 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100185 CFLAGS="$saved_CFLAGS $t"
186 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800187 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100188 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800189 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
190 [[
191 char x[256];
192 snprintf(x, sizeof(x), "XXX");
193 ]])],
194 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100195 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800196 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100197 [ AC_MSG_WARN([cross compiling: cannot test])
198 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100199 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100200 ],
Tim Rice648f8762011-01-26 12:38:57 -0800201 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100202 )
203 CFLAGS="$saved_CFLAGS"
204 LDFLAGS="$saved_LDFLAGS"
205 done
206 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100207
Darren Tucker67b37032005-06-03 17:58:31 +1000208 if test -z "$have_llong_max"; then
209 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
210 unset ac_cv_have_decl_LLONG_MAX
211 saved_CFLAGS="$CFLAGS"
212 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800213 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000214 [have_llong_max=1],
215 [CFLAGS="$saved_CFLAGS"],
216 [#include <limits.h>]
217 )
218 fi
Damien Miller166bd442000-03-16 10:48:25 +1100219fi
220
Darren Tucker951b53b2013-02-08 11:50:09 +1100221AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
222AC_COMPILE_IFELSE(
223 [AC_LANG_PROGRAM([[
224#include <stdlib.h>
225__attribute__((__unused__)) static void foo(void){return;}]],
226 [[ exit(0); ]])],
227 [ AC_MSG_RESULT([yes]) ],
228 [ AC_MSG_RESULT([no])
229 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
230 [compiler does not accept __attribute__ on return types]) ]
231)
232
Darren Tucker391de5c2007-04-29 14:49:21 +1000233if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800234 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000235fi
236
Tim Rice648f8762011-01-26 12:38:57 -0800237AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800238 [ --without-rpath Disable auto-added -R linker paths],
239 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800240 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800241 need_dash_r=""
242 fi
243 if test "x$withval" = "xyes" ; then
244 need_dash_r=1
245 fi
246 ]
247)
248
Tim Rice1cfab232006-10-03 09:34:35 -0700249# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800250AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700251 [ --with-cflags Specify additional flags to pass to compiler],
252 [
253 if test -n "$withval" && test "x$withval" != "xno" && \
254 test "x${withval}" != "xyes"; then
255 CFLAGS="$CFLAGS $withval"
256 fi
257 ]
258)
Tim Rice648f8762011-01-26 12:38:57 -0800259AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700260 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
261 [
262 if test -n "$withval" && test "x$withval" != "xno" && \
263 test "x${withval}" != "xyes"; then
264 CPPFLAGS="$CPPFLAGS $withval"
265 fi
266 ]
267)
Tim Rice648f8762011-01-26 12:38:57 -0800268AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700269 [ --with-ldflags Specify additional flags to pass to linker],
270 [
271 if test -n "$withval" && test "x$withval" != "xno" && \
272 test "x${withval}" != "xyes"; then
273 LDFLAGS="$LDFLAGS $withval"
274 fi
275 ]
276)
Tim Rice648f8762011-01-26 12:38:57 -0800277AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700278 [ --with-libs Specify additional libraries to link with],
279 [
280 if test -n "$withval" && test "x$withval" != "xno" && \
281 test "x${withval}" != "xyes"; then
282 LIBS="$LIBS $withval"
283 fi
284 ]
285)
Tim Rice648f8762011-01-26 12:38:57 -0800286AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700287 [ --with-Werror Build main code with -Werror],
288 [
289 if test -n "$withval" && test "x$withval" != "xno"; then
290 werror_flags="-Werror"
291 if test "x${withval}" != "xyes"; then
292 werror_flags="$withval"
293 fi
294 fi
295 ]
296)
297
Tim Rice648f8762011-01-26 12:38:57 -0800298AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700299 bstring.h \
300 crypt.h \
301 crypto/sha2.h \
302 dirent.h \
303 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100304 elf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700305 features.h \
306 fcntl.h \
307 floatingpoint.h \
308 getopt.h \
309 glob.h \
310 ia.h \
311 iaf.h \
312 limits.h \
Darren Tuckerae133d42013-06-06 08:30:20 +1000313 locale.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700314 login.h \
315 maillock.h \
316 ndir.h \
317 net/if_tun.h \
318 netdb.h \
319 netgroup.h \
320 pam/pam_appl.h \
321 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000322 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700323 pty.h \
324 readpassphrase.h \
325 rpc/types.h \
326 security/pam_appl.h \
327 sha2.h \
328 shadow.h \
329 stddef.h \
330 stdint.h \
331 string.h \
332 strings.h \
333 sys/audit.h \
334 sys/bitypes.h \
335 sys/bsdtty.h \
336 sys/cdefs.h \
337 sys/dir.h \
338 sys/mman.h \
339 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000340 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700341 sys/prctl.h \
342 sys/pstat.h \
343 sys/select.h \
344 sys/stat.h \
345 sys/stream.h \
346 sys/stropts.h \
347 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000348 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700349 sys/sysmacros.h \
350 sys/time.h \
351 sys/timers.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700352 time.h \
353 tmpdir.h \
354 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700355 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700356 unistd.h \
357 usersec.h \
358 util.h \
359 utime.h \
360 utmp.h \
361 utmpx.h \
362 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800363])
Tim Rice1cfab232006-10-03 09:34:35 -0700364
365# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800366AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700367#ifdef HAVE_SYS_TIME_H
368# include <sys/time.h>
369#endif
370])
371
372# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800373AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700374#ifdef HAVE_SYS_STREAM_H
375# include <sys/stream.h>
376#endif
377])
378
379# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800380AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700381#include <sys/types.h>
382])
383
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000384# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800385AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000386#include <sys/param.h>
387])
388
Darren Tuckeref4901c2013-06-03 01:59:13 +1000389# Android requires sys/socket.h to be included before sys/un.h
390AC_CHECK_HEADERS([sys/un.h], [], [], [
Darren Tucker0b43ffe2013-06-03 09:30:44 +1000391#include <sys/types.h>
Darren Tucker16cac192013-06-04 12:55:24 +1000392#include <sys/socket.h>
Darren Tuckeref4901c2013-06-03 01:59:13 +1000393])
394
Damien Miller1b06dc32006-08-31 03:24:41 +1000395# Messages for features tested for in target-specific section
396SIA_MSG="no"
397SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100398SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000399
Damien Millera22ba012000-03-02 23:09:20 +1100400# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100401case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100402*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000403 # Some versions of VAC won't allow macro redefinitions at
404 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
405 # particularly with older versions of vac or xlc.
406 # It also throws errors about null macro argments, but these are
407 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800408 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000409 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800410 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000411#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800412#define testmacro bar]],
413 [[ exit(0); ]])],
414 [ AC_MSG_RESULT([yes]) ],
415 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000416 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
417 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
418 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
419 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
420 ]
421 )
422
Damien Millera8e06ce2003-11-21 23:48:55 +1100423 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000424 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800425 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100426 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000427 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000428 if test "$GCC" = "yes"; then
429 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
430 else
431 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
432 fi
433 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000434 if (test -z "$blibflags"); then
435 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800436 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
437 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000438 fi
439 done
440 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800441 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000442 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
443 else
Tim Rice648f8762011-01-26 12:38:57 -0800444 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000445 fi
446 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000447 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800448 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700449 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800450 [AC_CHECK_LIB([s], [authenticate],
451 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700452 LIBS="$LIBS -ls"
453 ])
454 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100455 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100456 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100457 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000458 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800459 AC_CHECK_DECLS([loginfailed],
460 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
462 [[ (void)loginfailed("user","host","tty",0); ]])],
463 [AC_MSG_RESULT([yes])
464 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
465 [Define if your AIX loginfailed() function
466 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
467 ])],
468 [],
469 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000470 )
Tim Rice648f8762011-01-26 12:38:57 -0800471 AC_CHECK_FUNCS([getgrset setauthdb])
472 AC_CHECK_DECL([F_CLOSEM],
473 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000474 [],
475 [ #include <limits.h>
476 #include <fcntl.h> ]
477 )
Darren Tucker691d5232005-02-15 21:45:57 +1100478 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800479 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
480 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700481 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800482 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
483 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000484 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800485 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
486 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700487 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800488 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700489 [Define to a Set Process Title type if your system is
490 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800491 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100492 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800493 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100494 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100495 ;;
Darren Tucker898ac932013-06-03 02:03:25 +1000496*-*-android*)
497 AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp])
498 AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp])
499 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100500*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100501 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100502 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800503 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
504 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
505 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700506 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800507 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700508 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800509 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700510 [Define if the concept of ports only accessible to
511 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800512 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700513 [Define if your platform needs to skip post auth
514 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800515 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
516 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100517 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000518*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800519 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700520 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800521 AC_DEFINE([SETEUID_BREAKS_SETUID])
522 AC_DEFINE([BROKEN_SETREUID])
523 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000524 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000525*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800526 AC_MSG_CHECKING([if we have working getaddrinfo])
527 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000528main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
529 exit(0);
530 else
531 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800532}
533 ]])],
534 [AC_MSG_RESULT([working])],
535 [AC_MSG_RESULT([buggy])
536 AC_DEFINE([BROKEN_GETADDRINFO], [1],
537 [getaddrinfo is broken (if present)])
538 ],
539 [AC_MSG_RESULT([assume it is working])])
540 AC_DEFINE([SETEUID_BREAKS_SETUID])
541 AC_DEFINE([BROKEN_SETREUID])
542 AC_DEFINE([BROKEN_SETREGID])
543 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
544 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700545 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800546 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
547 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000548 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800549 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000550 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800551 m4_pattern_allow([AU_IPv])
552 AC_CHECK_DECL([AU_IPv4], [],
553 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100554 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800555 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100556 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100557 )
Damien Millerc09182f2011-06-03 12:11:38 +1000558 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
559 [Define to a Set Process Title type if your system is
560 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000561 AC_CHECK_FUNCS([sandbox_init])
562 AC_CHECK_HEADERS([sandbox.h])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000563 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000564*-*-dragonfly*)
565 SSHDLIBS="$SSHDLIBS -lcrypt"
Darren Tucker882abfd2013-11-09 00:17:41 +1100566 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker57b29202006-09-10 20:25:51 +1000567 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100568*-*-haiku*)
569 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800570 AC_CHECK_LIB([network], [socket])
571 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100572 MANTYPE=man
573 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000574*-*-hpux*)
575 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000576 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100577 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800578 AC_DEFINE([USE_PIPES])
579 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700580 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800581 AC_DEFINE([LOGIN_NEEDS_UTMPX])
582 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700583 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800584 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100585 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700586 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700587 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800588 AC_CHECK_LIB([xnet], [t_error], ,
589 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000590
591 # next, we define all of the options specific to major releases
592 case "$host" in
593 *-*-hpux10*)
594 if test -z "$GCC"; then
595 CFLAGS="$CFLAGS -Ae"
596 fi
597 ;;
598 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700600 [Define if you are using Solaris-derived PAM which
601 passes pam_messages to the conversation function
602 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800603 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700604 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800605 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000606 check_for_hpux_broken_getaddrinfo=1
607 check_for_conflicting_getspnam=1
608 ;;
609 esac
610
611 # lastly, we define options specific to minor releases
612 case "$host" in
613 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800614 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700615 [Define if you have SecureWare-based
616 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000617 disable_ptmx_check=yes
618 LIBS="$LIBS -lsecpw"
619 ;;
620 esac
Damien Miller1bead332000-04-30 00:47:29 +1000621 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100622*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100623 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800624 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700625 [Define if you system's inet_ntoa is busted
626 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800627 AC_DEFINE([SETEUID_BREAKS_SETUID])
628 AC_DEFINE([BROKEN_SETREUID])
629 AC_DEFINE([BROKEN_SETREGID])
630 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700631 [Define if you shouldn't strip 'tty' from your
632 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800633 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100634 ;;
635*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100636 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800637 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700638 [Define if you have/want arrays
639 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800640 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700641 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800642 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700643 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800644 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700645 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800646 AC_DEFINE([BROKEN_INET_NTOA])
647 AC_DEFINE([SETEUID_BREAKS_SETUID])
648 AC_DEFINE([BROKEN_SETREUID])
649 AC_DEFINE([BROKEN_SETREGID])
650 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
651 AC_DEFINE([WITH_ABBREV_NO_TTY])
652 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100653 ;;
Damien Miller90551722009-02-16 15:37:03 +1100654*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
655 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800656 AC_DEFINE([PAM_TTY_KLUDGE])
657 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
658 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
659 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
660 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100661 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100662*-*-linux*)
663 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100664 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000665 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800666 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700667 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800668 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700669 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800670 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
671 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700672 [Define to whatever link() returns for "not supported"
673 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800674 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
675 AC_DEFINE([USE_BTMP])
676 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100677 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000678 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000679 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800680 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700681 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000682 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000683 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100684 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800685 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100686 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800687 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100688 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800689 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100690 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800691 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100692 [Prepend the address family to IP tunnel traffic])
693 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000694 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
695 [], [#include <linux/types.h>])
Damien Millere0956e32012-04-04 11:27:54 +1000696 AC_CHECK_FUNCS([prctl])
Damien Miller91f40d82013-02-22 11:37:00 +1100697 AC_MSG_CHECKING([for seccomp architecture])
698 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000699 case "$host" in
700 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100701 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000702 ;;
703 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100704 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000705 ;;
Damien Miller91f40d82013-02-22 11:37:00 +1100706 arm*-*)
707 seccomp_audit_arch=AUDIT_ARCH_ARM
708 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000709 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100710 if test "x$seccomp_audit_arch" != "x" ; then
711 AC_MSG_RESULT(["$seccomp_audit_arch"])
712 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
713 [Specify the system call convention in use])
714 else
715 AC_MSG_RESULT([architecture not supported])
716 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100717 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000718mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800719 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000720 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000721 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100722*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000723 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800724 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800725 need_dash_r=1
726 fi
Tim Rice648f8762011-01-26 12:38:57 -0800727 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100728 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800729 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
730 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100731 [Prepend the address family to IP tunnel traffic])
Darren Tucker882abfd2013-11-09 00:17:41 +1100732 TEST_MALLOC_OPTIONS="AJRX"
Damien Milleree1c0b32000-01-21 00:18:15 +1100733 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100734*-*-freebsd*)
735 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800736 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
737 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100738 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800739 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
740 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Darren Tucker882abfd2013-11-09 00:17:41 +1100741 AC_DEFINE([BROKEN_STRNVIS], [1], [FreeBSD strnvis does not do what we need])
742 TEST_MALLOC_OPTIONS="AJRX"
Damien Millerfbd884a2001-02-27 08:39:07 +1100743 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000744*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800745 AC_DEFINE([SETEUID_BREAKS_SETUID])
746 AC_DEFINE([BROKEN_SETREUID])
747 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000748 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000749*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000750 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100751 conf_utmp_location=/etc/utmp
752 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700753 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800754 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
755 AC_DEFINE([BROKEN_REALPATH])
756 AC_DEFINE([USE_PIPES])
757 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000758 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000759*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800760 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
761 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
762 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
763 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000764 [syslog_r function is safe to use in in a signal handler])
Darren Tucker882abfd2013-11-09 00:17:41 +1100765 TEST_MALLOC_OPTIONS="AFGJPRX"
Darren Tucker4a422572005-07-14 17:22:11 +1000766 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100767*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800768 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800769 need_dash_r=1
770 fi
Tim Rice648f8762011-01-26 12:38:57 -0800771 AC_DEFINE([PAM_SUN_CODEBASE])
772 AC_DEFINE([LOGIN_NEEDS_UTMPX])
773 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700774 [Some versions of /bin/login need the TERM supplied
775 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800776 AC_DEFINE([PAM_TTY_KLUDGE])
777 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700778 [Define if pam_chauthtok wants real uid set
779 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800780 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000781 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800782 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700783 [Define if sshd somehow reacquires a controlling TTY
784 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800785 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000786 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800787 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000788 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000789 # hardwire lastlog location (can't detect it on some versions)
790 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800791 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000792 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
793 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800794 AC_MSG_RESULT([yes])
795 AC_DEFINE([DISABLE_UTMP])
796 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700797 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000798 else
Tim Rice648f8762011-01-26 12:38:57 -0800799 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000800 fi
Tim Rice648f8762011-01-26 12:38:57 -0800801 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000802 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
803 [
Tim Rice648f8762011-01-26 12:38:57 -0800804 AC_CHECK_LIB([contract], [ct_tmpl_activate],
805 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000806 [Define if you have Solaris process contracts])
807 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000808 SPC_MSG="yes" ], )
809 ],
810 )
Tim Rice648f8762011-01-26 12:38:57 -0800811 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100812 [ --with-solaris-projects Enable Solaris projects (experimental)],
813 [
Tim Rice648f8762011-01-26 12:38:57 -0800814 AC_CHECK_LIB([project], [setproject],
815 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100816 [Define if you have Solaris projects])
817 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100818 SP_MSG="yes" ], )
819 ],
820 )
Tim Rice5ab9b632013-06-02 14:05:48 -0700821 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller75b1d102000-01-07 14:01:41 +1100822 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000823*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000824 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800825 AC_CHECK_FUNCS([getpwanam])
826 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000827 conf_utmp_location=/etc/utmp
828 conf_wtmp_location=/var/adm/wtmp
829 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800830 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000831 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000832*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700833 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800834 AC_DEFINE([USE_PIPES])
835 AC_DEFINE([SSHD_ACQUIRES_CTTY])
836 AC_DEFINE([SETEUID_BREAKS_SETUID])
837 AC_DEFINE([BROKEN_SETREUID])
838 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000839 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000840*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700841 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800842 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100843 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800844 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100845 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800846 AC_DEFINE([USE_PIPES])
847 AC_DEFINE([IP_TOS_IS_BROKEN])
848 AC_DEFINE([SETEUID_BREAKS_SETUID])
849 AC_DEFINE([BROKEN_SETREUID])
850 AC_DEFINE([BROKEN_SETREGID])
851 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000852 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700853 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
854 # Attention: always take care to bind libsocket and libnsl before libc,
855 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000856 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800857# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100858*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800859 AC_DEFINE([USE_PIPES])
860 AC_DEFINE([SETEUID_BREAKS_SETUID])
861 AC_DEFINE([BROKEN_SETREUID])
862 AC_DEFINE([BROKEN_SETREGID])
863 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
864 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice5ab9b632013-06-02 14:05:48 -0700865 TEST_SHELL=$SHELL # let configure find us a capable shell
Damien Miller78315eb2000-09-29 23:01:36 +1100866 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800867# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100868*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800869 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800870 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
871 AC_DEFINE([USE_PIPES])
872 AC_DEFINE([SETEUID_BREAKS_SETUID])
873 AC_DEFINE([BROKEN_GETADDRINFO])
874 AC_DEFINE([BROKEN_SETREUID])
875 AC_DEFINE([BROKEN_SETREGID])
876 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice5ab9b632013-06-02 14:05:48 -0700877 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Rice4dbacff2005-06-01 20:09:28 -0700878 case "$host" in
879 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700880 maildir=/var/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800881 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700882 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800883 AC_DEFINE([BROKEN_UPDWTMPX])
884 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
885 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
886 AC_DEFINE([HAVE_SECUREWARE])
887 AC_DEFINE([DISABLE_SHADOW])
888 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700889 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800890 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800891 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800892 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700893 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100894 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100895*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100896 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800897# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100898*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800899 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100900 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800901# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100902*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800903 if test -z "$GCC"; then
904 CFLAGS="$CFLAGS -belf"
905 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100906 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000907 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800908 AC_DEFINE([USE_PIPES])
909 AC_DEFINE([HAVE_SECUREWARE])
910 AC_DEFINE([DISABLE_SHADOW])
911 AC_DEFINE([DISABLE_FD_PASSING])
912 AC_DEFINE([SETEUID_BREAKS_SETUID])
913 AC_DEFINE([BROKEN_GETADDRINFO])
914 AC_DEFINE([BROKEN_SETREUID])
915 AC_DEFINE([BROKEN_SETREGID])
916 AC_DEFINE([WITH_ABBREV_NO_TTY])
917 AC_DEFINE([BROKEN_UPDWTMPX])
918 AC_DEFINE([PASSWD_NEEDS_USERNAME])
919 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700920 MANTYPE=man
Tim Rice5ab9b632013-06-02 14:05:48 -0700921 TEST_SHELL=$SHELL # let configure find us a capable shell
Tim Riceaa86c392013-03-16 20:55:46 -0700922 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +1000923 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000924*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800925 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700926 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800927 AC_DEFINE([SETEUID_BREAKS_SETUID])
928 AC_DEFINE([BROKEN_SETREUID])
929 AC_DEFINE([BROKEN_SETREGID])
930 AC_DEFINE([USE_PIPES])
931 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000932 LDFLAGS="$LDFLAGS"
933 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
934 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000935 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000936*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800937 AC_DEFINE([SETEUID_BREAKS_SETUID])
938 AC_DEFINE([BROKEN_SETREUID])
939 AC_DEFINE([BROKEN_SETREGID])
940 AC_DEFINE([WITH_ABBREV_NO_TTY])
941 AC_DEFINE([USE_PIPES])
942 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000943 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100944 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000945 MANTYPE=cat
946 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000947*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800948 AC_DEFINE([SETEUID_BREAKS_SETUID])
949 AC_DEFINE([BROKEN_SETREUID])
950 AC_DEFINE([BROKEN_SETREGID])
951 AC_DEFINE([USE_PIPES])
952 AC_DEFINE([DISABLE_FD_PASSING])
953 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000954 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
955 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
956 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700957 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000958*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800959 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000960 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800961 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000962 [ --with-osfsia Enable Digital Unix SIA],
963 [
964 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800965 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000966 no_osfsia=1
967 fi
968 ],
969 )
970 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000971 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800972 AC_MSG_RESULT([yes])
973 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700974 [Define if you have Digital Unix Security
975 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800976 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700977 [Define if you don't want to use your
978 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800979 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000980 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000981 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000982 else
Tim Rice648f8762011-01-26 12:38:57 -0800983 AC_MSG_RESULT([no])
984 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700985 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000986 fi
987 fi
Tim Rice648f8762011-01-26 12:38:57 -0800988 AC_DEFINE([BROKEN_GETADDRINFO])
989 AC_DEFINE([SETEUID_BREAKS_SETUID])
990 AC_DEFINE([BROKEN_SETREUID])
991 AC_DEFINE([BROKEN_SETREGID])
992 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000993 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000994
Tim Rice70335a62006-02-04 17:42:58 -0800995*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800996 AC_DEFINE([USE_PIPES])
997 AC_DEFINE([NO_X11_UNIX_SOCKETS])
Tim Rice648f8762011-01-26 12:38:57 -0800998 AC_DEFINE([DISABLE_LASTLOG])
999 AC_DEFINE([SSHD_ACQUIRES_CTTY])
1000 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -08001001 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +10001002 case "$host" in
1003 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -08001004 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +10001005 ;;
1006 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001007 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +10001008
1009*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -08001010 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
1011 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
1012 AC_DEFINE([NEED_SETPGRP])
1013 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -07001014 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001015
1016*-*-lynxos)
1017 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001018 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001019 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001020esac
1021
Tim Rice648f8762011-01-26 12:38:57 -08001022AC_MSG_CHECKING([compiler and flags for sanity])
1023AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1024 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001025 [
Tim Rice648f8762011-01-26 12:38:57 -08001026 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001027 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001028 ],
1029 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001030)
1031
Darren Tucker0c9653f2005-05-28 15:58:14 +10001032dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001033# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001034AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
1035AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001036
Tim Rice1e1ef642003-09-11 22:19:31 -07001037dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001038AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1039 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001040 AC_CACHE_CHECK([for broken dirname],
1041 ac_cv_have_broken_dirname, [
1042 save_LIBS="$LIBS"
1043 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001044 AC_RUN_IFELSE(
1045 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001046#include <libgen.h>
1047#include <string.h>
1048
1049int main(int argc, char **argv) {
1050 char *s, buf[32];
1051
1052 strncpy(buf,"/etc", 32);
1053 s = dirname(buf);
1054 if (!s || strncmp(s, "/", 32) != 0) {
1055 exit(1);
1056 } else {
1057 exit(0);
1058 }
1059}
Darren Tucker314d89e2005-10-17 23:29:23 +10001060 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001061 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001062 [ ac_cv_have_broken_dirname="yes" ],
1063 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001064 )
1065 LIBS="$save_LIBS"
1066 ])
1067 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1068 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001069 AC_DEFINE([HAVE_DIRNAME])
1070 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001071 fi
1072 ])
1073])
1074
Tim Rice648f8762011-01-26 12:38:57 -08001075AC_CHECK_FUNC([getspnam], ,
1076 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1077AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1078 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001079
Tim Rice13aae5e2001-10-21 17:53:58 -07001080dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001081AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001082 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001083 [ if test "x$withval" = "xno" ; then
1084 AC_MSG_ERROR([*** zlib is required ***])
1085 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001086 if test -d "$withval/lib"; then
1087 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001088 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001089 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001090 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001091 fi
1092 else
1093 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001094 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001095 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001096 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001097 fi
1098 fi
1099 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001100 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001101 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001102 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001103 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001104 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001105)
1106
Tim Rice648f8762011-01-26 12:38:57 -08001107AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1108AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001109 [
1110 saved_CPPFLAGS="$CPPFLAGS"
1111 saved_LDFLAGS="$LDFLAGS"
1112 save_LIBS="$LIBS"
1113 dnl Check default zlib install dir
1114 if test -n "${need_dash_r}"; then
1115 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1116 else
1117 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1118 fi
1119 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1120 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001121 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001122 [
1123 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1124 ]
1125 )
1126 ]
1127)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001128
Tim Rice648f8762011-01-26 12:38:57 -08001129AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001130 [ --without-zlib-version-check Disable zlib version check],
1131 [ if test "x$withval" = "xno" ; then
1132 zlib_check_nonfatal=1
1133 fi
1134 ]
1135)
1136
Tim Rice648f8762011-01-26 12:38:57 -08001137AC_MSG_CHECKING([for possibly buggy zlib])
1138AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001139#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001140#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001141#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001142 ]],
1143 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001144 int a=0, b=0, c=0, d=0, n, v;
1145 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1146 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001147 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001148 v = a*1000000 + b*10000 + c*100 + d;
1149 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1150
1151 /* 1.1.4 is OK */
1152 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001153 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001154
Darren Tucker41097ed2005-07-25 15:24:21 +10001155 /* 1.2.3 and up are OK */
1156 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001157 exit(0);
1158
Darren Tucker2dcd2392004-01-23 17:13:33 +11001159 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001160 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001161 AC_MSG_RESULT([no]),
1162 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001163 if test -z "$zlib_check_nonfatal" ; then
1164 AC_MSG_ERROR([*** zlib too old - check config.log ***
1165Your reported zlib version has known security problems. It's possible your
1166vendor has fixed these problems without changing the version number. If you
1167are sure this is the case, you can disable the check by running
1168"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001169If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001170See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001171 else
1172 AC_MSG_WARN([zlib version may have security problems])
1173 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001174 ],
1175 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001176)
Damien Miller6f9c3372000-10-25 10:06:04 +11001177
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001178dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001179AC_CHECK_FUNC([strcasecmp],
1180 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001181)
Tim Rice648f8762011-01-26 12:38:57 -08001182AC_CHECK_FUNCS([utimes],
1183 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001184 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001185)
Damien Millerab18c411999-11-11 10:40:23 +11001186
Tim Ricee589a292001-11-03 11:09:32 -08001187dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001188AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001189AC_SEARCH_LIBS([fmt_scaled], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001190AC_SEARCH_LIBS([scan_scaled], [util bsd])
Damien Miller398c0ff2012-04-19 21:46:35 +10001191AC_SEARCH_LIBS([login], [util bsd])
1192AC_SEARCH_LIBS([logout], [util bsd])
1193AC_SEARCH_LIBS([logwtmp], [util bsd])
1194AC_SEARCH_LIBS([openpty], [util bsd])
1195AC_SEARCH_LIBS([updwtmp], [util bsd])
Darren Tuckere194ba42013-05-16 20:47:31 +10001196AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001197
Ben Lindstrom8697e082001-02-24 21:41:10 +00001198AC_FUNC_STRFTIME
1199
Damien Miller3c027682001-03-14 11:39:45 +11001200# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001201AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1202AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001203 [
1204 #include <glob.h>
1205 #ifdef GLOB_ALTDIRFUNC
1206 FOUNDIT
1207 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001208 ],
Damien Miller3c027682001-03-14 11:39:45 +11001209 [
Tim Rice648f8762011-01-26 12:38:57 -08001210 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001211 [Define if your system glob() function has
1212 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001213 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001214 ],
1215 [
Tim Rice648f8762011-01-26 12:38:57 -08001216 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001217 ]
1218)
Damien Millerab18c411999-11-11 10:40:23 +11001219
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001220# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001221AC_MSG_CHECKING([for gl_matchc field in glob_t])
1222AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1223 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001224 [
Tim Rice648f8762011-01-26 12:38:57 -08001225 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001226 [Define if your system glob() function has
1227 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001228 AC_MSG_RESULT([yes])
1229 ], [
1230 AC_MSG_RESULT([no])
1231])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001232
Damien Millera6e121a2010-10-07 21:39:17 +11001233# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001234AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1235AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001236#ifndef GLOB_KEEPSTAT
1237#error "glob does not support GLOB_KEEPSTAT extension"
1238#endif
1239glob_t g;
1240g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001241]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001242 [
Tim Rice648f8762011-01-26 12:38:57 -08001243 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001244 [Define if your system glob() function has
1245 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001246 AC_MSG_RESULT([yes])
1247 ], [
1248 AC_MSG_RESULT([no])
1249
1250])
Damien Millera6e121a2010-10-07 21:39:17 +11001251
Tim Rice648f8762011-01-26 12:38:57 -08001252AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001253
Damien Miller18bb4732001-03-28 14:35:30 +10001254AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001255AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001256 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001257#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001258#include <dirent.h>]],
1259 [[
1260 struct dirent d;
1261 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001262 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001263 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001264 [
Tim Rice648f8762011-01-26 12:38:57 -08001265 AC_MSG_RESULT([no])
1266 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001267 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001268 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001269 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001270 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001271 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001272 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001273 ]
1274)
1275
Damien Miller36f49652004-08-15 18:40:59 +10001276AC_MSG_CHECKING([for /proc/pid/fd directory])
1277if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001278 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1279 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001280else
Tim Rice648f8762011-01-26 12:38:57 -08001281 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001282fi
1283
Damien Millerc547bf12001-02-16 10:18:12 +11001284# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001285SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001286AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001287 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001288 [
1289 if test "x$withval" != "xno" ; then
1290
1291 if test "x$withval" != "xyes" ; then
1292 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1293 LDFLAGS="$LDFLAGS -L${withval}/lib"
1294 fi
1295
Tim Rice648f8762011-01-26 12:38:57 -08001296 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001297 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001298 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001299
Tim Rice4cec93f2002-02-26 08:40:48 -08001300 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001301 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001302 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001303#include <stdio.h>
1304#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001305 ]], [[
1306 char *ff = skey_keyinfo(""); ff="";
1307 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001308 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001309 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001310 [
Tim Rice648f8762011-01-26 12:38:57 -08001311 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001312 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1313 ])
Tim Rice648f8762011-01-26 12:38:57 -08001314 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1316#include <stdio.h>
1317#include <skey.h>
1318 ]], [[
1319 (void)skeychallenge(NULL,"name","",0);
1320 ]])],
1321 [
1322 AC_MSG_RESULT([yes])
1323 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001324 [Define if your skeychallenge()
1325 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001326 [
1327 AC_MSG_RESULT([no])
1328 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001329 fi
1330 ]
1331)
1332
1333# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001334TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001335AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001336 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001337 [
1338 if test "x$withval" != "xno" ; then
1339 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001340 saved_LDFLAGS="$LDFLAGS"
1341 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001342 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001343 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001344 if test -d "${withval}/lib"; then
1345 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001346 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001347 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001348 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001349 fi
1350 else
1351 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001352 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001353 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001354 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001355 fi
1356 fi
1357 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001358 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001359 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001360 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001361 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001362 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001363 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001364 AC_MSG_CHECKING([for libwrap])
1365 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001366#include <sys/types.h>
1367#include <sys/socket.h>
1368#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001369#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001370int deny_severity = 0, allow_severity = 0;
1371 ]], [[
1372 hosts_access(0);
1373 ]])], [
1374 AC_MSG_RESULT([yes])
1375 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001376 [Define if you want
1377 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001378 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001379 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001380 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001381 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001382
1383 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001384 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001385 fi
1386 ]
1387)
1388
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001389# Check whether user wants to use ldns
1390LDNS_MSG="no"
1391AC_ARG_WITH(ldns,
1392 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1393 [
1394 if test "x$withval" != "xno" ; then
1395
1396 if test "x$withval" != "xyes" ; then
1397 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1398 LDFLAGS="$LDFLAGS -L${withval}/lib"
1399 fi
1400
1401 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1402 LIBS="-lldns $LIBS"
1403 LDNS_MSG="yes"
1404
1405 AC_MSG_CHECKING([for ldns support])
1406 AC_LINK_IFELSE(
1407 [AC_LANG_SOURCE([[
1408#include <stdio.h>
1409#include <stdlib.h>
1410#include <stdint.h>
1411#include <ldns/ldns.h>
1412int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1413 ]])
1414 ],
1415 [AC_MSG_RESULT(yes)],
1416 [
1417 AC_MSG_RESULT(no)
1418 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1419 ])
1420 fi
1421 ]
1422)
1423
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001424# Check whether user wants libedit support
1425LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001426AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001427 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001428 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001429 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001430 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001431 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001432 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001433 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001434 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001435 use_pkgconfig_for_libedit=yes
1436 else
Tim Rice648f8762011-01-26 12:38:57 -08001437 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001438 fi
1439 fi
1440 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001441 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1442 if test -n "${need_dash_r}"; then
1443 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1444 else
1445 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1446 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001447 fi
Damien Miller1f789802010-10-11 22:35:22 +11001448 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001449 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1450 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1451 else
1452 LIBEDIT="-ledit -lcurses"
1453 fi
1454 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001455 AC_CHECK_LIB([edit], [el_init],
1456 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001457 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001458 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001459 ],
Tim Rice648f8762011-01-26 12:38:57 -08001460 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001461 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001462 )
Tim Rice648f8762011-01-26 12:38:57 -08001463 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001464 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001465 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1466 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001467 int i = H_SETSIZE;
1468 el_init("", NULL, NULL, NULL);
1469 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001470 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001471 [ AC_MSG_RESULT([yes]) ],
1472 [ AC_MSG_RESULT([no])
1473 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001474 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001475 fi ]
1476)
1477
Darren Tuckerd9f88912005-02-20 21:01:48 +11001478AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001479AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001480 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001481 [
Tim Rice648f8762011-01-26 12:38:57 -08001482 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001483 case "$withval" in
1484 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001485 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001486 AUDIT_MODULE=bsm
1487 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001488 AC_CHECK_HEADERS([bsm/audit.h], [],
1489 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001490 [
1491#ifdef HAVE_TIME_H
1492# include <time.h>
1493#endif
1494 ]
1495)
Tim Rice648f8762011-01-26 12:38:57 -08001496 AC_CHECK_LIB([bsm], [getaudit], [],
1497 [AC_MSG_ERROR([BSM enabled and required library not found])])
1498 AC_CHECK_FUNCS([getaudit], [],
1499 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001500 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001501 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1502 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker93a2d412012-02-24 10:40:41 +11001503 if test "$sol2ver" -eq 11; then
1504 SSHDLIBS="$SSHDLIBS -lscf"
1505 AC_DEFINE([BROKEN_BSM_API], [1],
1506 [The system has incomplete BSM API])
1507 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001508 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001509 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001510 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001511 AUDIT_MODULE=linux
1512 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001513 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001514 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001515 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001516 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001517 debug)
1518 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001519 AC_MSG_RESULT([debug])
1520 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001521 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001522 no)
Tim Rice648f8762011-01-26 12:38:57 -08001523 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001524 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001525 *)
1526 AC_MSG_ERROR([Unknown audit module $withval])
1527 ;;
1528 esac ]
1529)
1530
Damien Millerfe1f1432003-02-24 15:45:42 +11001531dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001532AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001533 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001534 arc4random_buf \
Damien Millerdf8b0302013-11-07 13:28:16 +11001535 arc4random_stir \
Damien Millera4be7c22008-05-19 14:47:37 +10001536 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001537 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001538 b64_ntop \
1539 __b64_ntop \
1540 b64_pton \
1541 __b64_pton \
1542 bcopy \
1543 bindresvport_sa \
1544 clock \
1545 closefrom \
1546 dirfd \
Darren Tuckerefdf5342013-05-30 08:29:08 +10001547 endgrent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001548 fchmod \
1549 fchown \
1550 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001551 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001552 futimes \
1553 getaddrinfo \
1554 getcwd \
1555 getgrouplist \
1556 getnameinfo \
1557 getopt \
1558 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001559 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001560 getpgid \
1561 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001562 _getpty \
1563 getrlimit \
1564 getttyent \
1565 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001566 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001567 inet_aton \
1568 inet_ntoa \
1569 inet_ntop \
1570 innetgr \
1571 login_getcapbool \
Darren Tuckerae133d42013-06-06 08:30:20 +10001572 mblen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001573 md5_crypt \
1574 memmove \
1575 mkdtemp \
1576 mmap \
1577 ngetaddrinfo \
1578 nsleep \
1579 ogetaddrinfo \
1580 openlog_r \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001581 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001582 prctl \
1583 pstat \
1584 readpassphrase \
1585 realpath \
1586 recvmsg \
1587 rresvport_af \
1588 sendmsg \
1589 setdtablesize \
1590 setegid \
1591 setenv \
1592 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001593 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001594 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001595 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001596 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001597 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001598 setpcred \
1599 setproctitle \
1600 setregid \
1601 setreuid \
1602 setrlimit \
1603 setsid \
1604 setvbuf \
1605 sigaction \
1606 sigvec \
1607 snprintf \
1608 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001609 statfs \
1610 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001611 strdup \
1612 strerror \
1613 strlcat \
1614 strlcpy \
1615 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001616 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001617 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001618 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001619 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001620 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001621 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001622 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001623 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001624 sysconf \
1625 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001626 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001627 truncate \
1628 unsetenv \
1629 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001630 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001631 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001632 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001633 vhangup \
1634 vsnprintf \
1635 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001636])
Tim Rice13aae5e2001-10-21 17:53:58 -07001637
Tim Ricec7a8af02010-11-08 14:26:23 -08001638AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001639 [AC_LANG_PROGRAM(
1640 [[ #include <ctype.h> ]],
1641 [[ return (isblank('a')); ]])],
1642 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001643])
1644
Damien Millerb3c9f782010-02-12 10:11:34 +11001645# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001646AC_SEARCH_LIBS([dlopen], [dl],
1647 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001648)
1649
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001650# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001651AC_CHECK_FUNCS([gai_strerror], [
1652 AC_DEFINE([HAVE_GAI_STRERROR])
1653 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001654#include <sys/types.h>
1655#include <sys/socket.h>
1656#include <netdb.h>
1657
Tim Rice648f8762011-01-26 12:38:57 -08001658const char *gai_strerror(int);
1659 ]], [[
1660 char *str;
1661 str = gai_strerror(0);
1662 ]])], [
1663 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1664 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001665
Tim Rice648f8762011-01-26 12:38:57 -08001666AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1667 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001668
Darren Tuckera7108912013-06-02 08:18:31 +10001669AC_SEARCH_LIBS([clock_gettime], [rt],
1670 [AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])])
1671
Darren Tuckerf1159b52003-07-07 19:44:01 +10001672dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001673AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1674AC_CHECK_DECL([strsep],
1675 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001676 [],
1677 [
1678#ifdef HAVE_STRING_H
1679# include <string.h>
1680#endif
1681 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001682
Darren Tuckerb2427c82003-09-10 15:22:44 +10001683dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001684AC_CHECK_DECL([tcsendbreak],
1685 [AC_DEFINE([HAVE_TCSENDBREAK])],
1686 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001687 [#include <termios.h>]
1688)
1689
Tim Rice648f8762011-01-26 12:38:57 -08001690AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001691
Tim Rice648f8762011-01-26 12:38:57 -08001692AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001693 [
1694#include <sys/types.h>
1695#include <sys/socket.h>
1696 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001697
Tim Rice648f8762011-01-26 12:38:57 -08001698AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001699 [
1700#include <sys/types.h>
1701#ifdef HAVE_SYS_STAT_H
1702# include <sys/stat.h>
1703#endif
1704#ifdef HAVE_FCNTL_H
1705# include <fcntl.h>
1706#endif
1707 ])
1708
Tim Rice648f8762011-01-26 12:38:57 -08001709AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001710#include <sys/types.h>
1711#include <sys/uio.h>
1712#include <unistd.h>
1713 ])
1714
Tim Rice648f8762011-01-26 12:38:57 -08001715AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001716#include <sys/param.h>
1717 ])
1718
Tim Rice648f8762011-01-26 12:38:57 -08001719AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001720#include <stddef.h>
1721 ])
1722
Darren Tuckerc7aad002013-06-02 07:18:47 +10001723# extra bits for select(2)
1724AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[
1725#include <sys/param.h>
1726#include <sys/types.h>
1727#ifdef HAVE_SYS_SYSMACROS_H
1728#include <sys/sysmacros.h>
1729#endif
1730#ifdef HAVE_SYS_SELECT_H
1731#include <sys/select.h>
1732#endif
1733#ifdef HAVE_SYS_TIME_H
1734#include <sys/time.h>
1735#endif
1736#ifdef HAVE_UNISTD_H
1737#include <unistd.h>
1738#endif
1739 ]])
1740AC_CHECK_TYPES([fd_mask], [], [], [[
1741#include <sys/param.h>
1742#include <sys/types.h>
1743#ifdef HAVE_SYS_SELECT_H
1744#include <sys/select.h>
1745#endif
1746#ifdef HAVE_SYS_TIME_H
1747#include <sys/time.h>
1748#endif
1749#ifdef HAVE_UNISTD_H
1750#include <unistd.h>
1751#endif
1752 ]])
1753
Tim Rice648f8762011-01-26 12:38:57 -08001754AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001755 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001756 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001757 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001758 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001759#include <stdlib.h>
1760#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001761 ]], [[
1762 errno=0;
1763 setresuid(0,0,0);
1764 if (errno==ENOSYS)
1765 exit(1);
1766 else
1767 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001768 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001769 [AC_MSG_RESULT([yes])],
1770 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001771 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001772 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001773 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001774 )
1775])
Darren Tuckere937be32003-12-17 18:53:26 +11001776
Tim Rice648f8762011-01-26 12:38:57 -08001777AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001778 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001779 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001780 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001781 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001782#include <stdlib.h>
1783#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001784 ]], [[
1785 errno=0;
1786 setresgid(0,0,0);
1787 if (errno==ENOSYS)
1788 exit(1);
1789 else
1790 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001791 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001792 [AC_MSG_RESULT([yes])],
1793 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001794 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001795 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001796 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001797 )
1798])
Darren Tuckere937be32003-12-17 18:53:26 +11001799
Damien Millerad833b32000-08-23 10:46:23 +10001800dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001801AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001802dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001803AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1804AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001805dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001806AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1807AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001808dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001809AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001810
Tim Rice648f8762011-01-26 12:38:57 -08001811AC_CHECK_FUNC([daemon],
1812 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1813 [AC_CHECK_LIB([bsd], [daemon],
1814 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001815)
1816
Tim Rice648f8762011-01-26 12:38:57 -08001817AC_CHECK_FUNC([getpagesize],
1818 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001819 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001820 [AC_CHECK_LIB([ucb], [getpagesize],
1821 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001822)
1823
Damien Millercb170cb2000-07-01 16:52:55 +10001824# Check for broken snprintf
1825if test "x$ac_cv_func_snprintf" = "xyes" ; then
1826 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001827 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001828 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1829 [[
1830 char b[5];
1831 snprintf(b,5,"123456789");
1832 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001833 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001834 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001835 [
Tim Rice648f8762011-01-26 12:38:57 -08001836 AC_MSG_RESULT([no])
1837 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001838 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001839 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001840 ],
1841 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001842 )
1843fi
1844
Damien Miller57f39152005-11-24 19:58:19 +11001845# If we don't have a working asprintf, then we strongly depend on vsnprintf
1846# returning the right thing on overflow: the number of characters it tried to
1847# create (as per SUSv3)
1848if test "x$ac_cv_func_asprintf" != "xyes" && \
1849 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1850 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1851 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001852 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001853#include <sys/types.h>
1854#include <stdio.h>
1855#include <stdarg.h>
1856
1857int x_snprintf(char *str,size_t count,const char *fmt,...)
1858{
1859 size_t ret; va_list ap;
1860 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1861 return ret;
1862}
Tim Rice648f8762011-01-26 12:38:57 -08001863 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001864 char x[1];
1865 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001866 ]])],
1867 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001868 [
Tim Rice648f8762011-01-26 12:38:57 -08001869 AC_MSG_RESULT([no])
1870 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001871 [Define if your snprintf is busted])
1872 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1873 ],
1874 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1875 )
1876fi
1877
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001878# On systems where [v]snprintf is broken, but is declared in stdio,
1879# check that the fmt argument is const char * or just char *.
1880# This is only useful for when BROKEN_SNPRINTF
1881AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001882AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1883#include <stdio.h>
1884int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1885 ]], [[
1886 snprintf(0, 0, 0);
1887 ]])],
1888 [AC_MSG_RESULT([yes])
1889 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001890 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001891 [AC_MSG_RESULT([no])
1892 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001893
Damien Millerb4097182004-05-23 14:09:40 +10001894# Check for missing getpeereid (or equiv) support
1895NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001896if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001897 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001898 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1899#include <sys/types.h>
1900#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1901 [ AC_MSG_RESULT([yes])
1902 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1903 ], [AC_MSG_RESULT([no])
1904 NO_PEERCHECK=1
1905 ])
Damien Millerb4097182004-05-23 14:09:40 +10001906fi
1907
Damien Millere8328192003-01-07 15:18:32 +11001908dnl see whether mkstemp() requires XXXXXX
1909if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1910AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001911AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001912 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001913#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001914 ]], [[
1915 char template[]="conftest.mkstemp-test";
1916 if (mkstemp(template) == -1)
1917 exit(1);
1918 unlink(template);
1919 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001920 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001921 [
Tim Rice648f8762011-01-26 12:38:57 -08001922 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001923 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001924 [
Tim Rice648f8762011-01-26 12:38:57 -08001925 AC_MSG_RESULT([yes])
1926 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001927 ],
1928 [
Tim Rice648f8762011-01-26 12:38:57 -08001929 AC_MSG_RESULT([yes])
1930 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001931 ]
Damien Millere8328192003-01-07 15:18:32 +11001932)
1933fi
1934
Darren Tucker70a3d552003-08-21 17:58:29 +10001935dnl make sure that openpty does not reacquire controlling terminal
1936if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001937 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001938 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001939 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001940#include <stdio.h>
1941#include <sys/fcntl.h>
1942#include <sys/types.h>
1943#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001944 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001945 pid_t pid;
1946 int fd, ptyfd, ttyfd, status;
1947
1948 pid = fork();
1949 if (pid < 0) { /* failed */
1950 exit(1);
1951 } else if (pid > 0) { /* parent */
1952 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001953 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001954 exit(WEXITSTATUS(status));
1955 else
1956 exit(2);
1957 } else { /* child */
1958 close(0); close(1); close(2);
1959 setsid();
1960 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1961 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1962 if (fd >= 0)
1963 exit(3); /* Acquired ctty: broken */
1964 else
1965 exit(0); /* Did not acquire ctty: OK */
1966 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001967 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001968 [
Tim Rice648f8762011-01-26 12:38:57 -08001969 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001970 ],
1971 [
Tim Rice648f8762011-01-26 12:38:57 -08001972 AC_MSG_RESULT([no])
1973 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001974 ],
1975 [
Tim Rice648f8762011-01-26 12:38:57 -08001976 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001977 ]
1978 )
1979fi
1980
Tim Rice8bb561b2005-03-17 16:23:19 -08001981if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1982 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001983 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001984 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001985 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001986#include <stdio.h>
1987#include <sys/socket.h>
1988#include <netdb.h>
1989#include <errno.h>
1990#include <netinet/in.h>
1991
1992#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001993 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001994 int err, sock;
1995 struct addrinfo *gai_ai, *ai, hints;
1996 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1997
1998 memset(&hints, 0, sizeof(hints));
1999 hints.ai_family = PF_UNSPEC;
2000 hints.ai_socktype = SOCK_STREAM;
2001 hints.ai_flags = AI_PASSIVE;
2002
2003 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2004 if (err != 0) {
2005 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2006 exit(1);
2007 }
2008
2009 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2010 if (ai->ai_family != AF_INET6)
2011 continue;
2012
2013 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2014 sizeof(ntop), strport, sizeof(strport),
2015 NI_NUMERICHOST|NI_NUMERICSERV);
2016
2017 if (err != 0) {
2018 if (err == EAI_SYSTEM)
2019 perror("getnameinfo EAI_SYSTEM");
2020 else
2021 fprintf(stderr, "getnameinfo failed: %s\n",
2022 gai_strerror(err));
2023 exit(2);
2024 }
2025
2026 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2027 if (sock < 0)
2028 perror("socket");
2029 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2030 if (errno == EBADF)
2031 exit(3);
2032 }
2033 }
2034 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002035 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10002036 [
Tim Rice648f8762011-01-26 12:38:57 -08002037 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002038 ],
2039 [
Tim Rice648f8762011-01-26 12:38:57 -08002040 AC_MSG_RESULT([no])
2041 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002042 ],
2043 [
Tim Rice648f8762011-01-26 12:38:57 -08002044 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10002045 ]
2046 )
2047fi
2048
Tim Rice8bb561b2005-03-17 16:23:19 -08002049if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
2050 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002051 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10002052 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002053 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002054#include <stdio.h>
2055#include <sys/socket.h>
2056#include <netdb.h>
2057#include <errno.h>
2058#include <netinet/in.h>
2059
2060#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002061 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002062 int err, sock;
2063 struct addrinfo *gai_ai, *ai, hints;
2064 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2065
2066 memset(&hints, 0, sizeof(hints));
2067 hints.ai_family = PF_UNSPEC;
2068 hints.ai_socktype = SOCK_STREAM;
2069 hints.ai_flags = AI_PASSIVE;
2070
2071 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2072 if (err != 0) {
2073 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2074 exit(1);
2075 }
2076
2077 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2078 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2079 continue;
2080
2081 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2082 sizeof(ntop), strport, sizeof(strport),
2083 NI_NUMERICHOST|NI_NUMERICSERV);
2084
2085 if (ai->ai_family == AF_INET && err != 0) {
2086 perror("getnameinfo");
2087 exit(2);
2088 }
2089 }
2090 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002091 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002092 [
Tim Rice648f8762011-01-26 12:38:57 -08002093 AC_MSG_RESULT([yes])
2094 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002095 [Define if you have a getaddrinfo that fails
2096 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002097 ],
2098 [
Tim Rice648f8762011-01-26 12:38:57 -08002099 AC_MSG_RESULT([no])
2100 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002101 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002102 [
Tim Rice648f8762011-01-26 12:38:57 -08002103 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002104 ]
2105 )
2106fi
2107
Darren Tuckera56f1912004-11-02 20:30:54 +11002108if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002109 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2111 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002112 [
Tim Rice648f8762011-01-26 12:38:57 -08002113 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002114 ],
2115 [
Tim Rice648f8762011-01-26 12:38:57 -08002116 AC_MSG_RESULT([yes])
2117 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002118 [Conflicting defs for getspnam])
2119 ]
2120 )
2121fi
2122
Damien Miller606f8802000-09-16 15:39:56 +11002123AC_FUNC_GETPGRP
2124
Tim Riceaef73712002-05-11 13:17:42 -07002125# Search for OpenSSL
2126saved_CPPFLAGS="$CPPFLAGS"
2127saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002128AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002129 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2130 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002131 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002132 case "$withval" in
2133 # Relative paths
2134 ./*|../*) withval="`pwd`/$withval"
2135 esac
Tim Riceaef73712002-05-11 13:17:42 -07002136 if test -d "$withval/lib"; then
2137 if test -n "${need_dash_r}"; then
2138 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2139 else
2140 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2141 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002142 elif test -d "$withval/lib64"; then
2143 if test -n "${need_dash_r}"; then
2144 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2145 else
2146 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2147 fi
Tim Riceaef73712002-05-11 13:17:42 -07002148 else
2149 if test -n "${need_dash_r}"; then
2150 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2151 else
2152 LDFLAGS="-L${withval} ${LDFLAGS}"
2153 fi
2154 fi
2155 if test -d "$withval/include"; then
2156 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2157 else
2158 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2159 fi
Damien Millera22ba012000-03-02 23:09:20 +11002160 fi
2161 ]
2162)
Tim Rice3d5352e2004-02-12 09:27:21 -08002163LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002164AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002165 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002166 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002167 [
Tim Riceaef73712002-05-11 13:17:42 -07002168 dnl Check default openssl install dir
2169 if test -n "${need_dash_r}"; then
2170 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002171 else
Tim Riceaef73712002-05-11 13:17:42 -07002172 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002173 fi
Tim Riceaef73712002-05-11 13:17:42 -07002174 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002175 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002176 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2177 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002178 [
2179 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2180 ]
2181 )
2182 ]
2183)
2184
Tim Riced730b782002-08-13 18:52:10 -07002185# Determine OpenSSL header version
2186AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002187AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002188 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002189#include <stdio.h>
2190#include <string.h>
2191#include <openssl/opensslv.h>
2192#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002193 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002194 FILE *fd;
2195 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002196
Damien Millera8e06ce2003-11-21 23:48:55 +11002197 fd = fopen(DATA,"w");
2198 if(fd == NULL)
2199 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002200
2201 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2202 exit(1);
2203
2204 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002205 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002206 [
2207 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002208 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002209 ],
2210 [
Tim Rice648f8762011-01-26 12:38:57 -08002211 AC_MSG_RESULT([not found])
2212 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002213 ],
2214 [
2215 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002216 ]
2217)
2218
2219# Determine OpenSSL library version
2220AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002221AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002222 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002223#include <stdio.h>
2224#include <string.h>
2225#include <openssl/opensslv.h>
2226#include <openssl/crypto.h>
2227#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002228 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002229 FILE *fd;
2230 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002231
Damien Millera8e06ce2003-11-21 23:48:55 +11002232 fd = fopen(DATA,"w");
2233 if(fd == NULL)
2234 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002235
2236 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2237 exit(1);
2238
2239 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002240 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002241 [
2242 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002243 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002244 ],
2245 [
Tim Rice648f8762011-01-26 12:38:57 -08002246 AC_MSG_RESULT([not found])
2247 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002248 ],
2249 [
2250 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002251 ]
2252)
Damien Millera22ba012000-03-02 23:09:20 +11002253
Tim Rice648f8762011-01-26 12:38:57 -08002254AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002255 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2256 [ if test "x$withval" = "xno" ; then
2257 openssl_check_nonfatal=1
2258 fi
2259 ]
2260)
2261
Damien Millerec932372002-01-22 22:16:03 +11002262# Sanity check OpenSSL headers
2263AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002264AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002265 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002266#include <string.h>
2267#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002268 ]], [[
2269 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002270 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002271 [
Tim Rice648f8762011-01-26 12:38:57 -08002272 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002273 ],
2274 [
Tim Rice648f8762011-01-26 12:38:57 -08002275 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002276 if test "x$openssl_check_nonfatal" = "x"; then
2277 AC_MSG_ERROR([Your OpenSSL headers do not match your
2278library. Check config.log for details.
2279If you are sure your installation is consistent, you can disable the check
2280by running "./configure --without-openssl-header-check".
2281Also see contrib/findssl.sh for help identifying header/library mismatches.
2282])
2283 else
2284 AC_MSG_WARN([Your OpenSSL headers do not match your
2285library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002286Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002287 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002288 ],
2289 [
2290 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002291 ]
2292)
2293
Darren Tucker639bbe82006-08-20 20:17:53 +10002294AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2295AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002296 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2297 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002298 [
Tim Rice648f8762011-01-26 12:38:57 -08002299 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002300 ],
2301 [
Tim Rice648f8762011-01-26 12:38:57 -08002302 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002303 saved_LIBS="$LIBS"
2304 LIBS="$LIBS -ldl"
2305 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2306 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002307 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2308 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002309 [
Tim Rice648f8762011-01-26 12:38:57 -08002310 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002311 ],
2312 [
Tim Rice648f8762011-01-26 12:38:57 -08002313 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002314 LIBS="$saved_LIBS"
2315 ]
2316 )
2317 ]
2318)
2319
Darren Tuckere9b3ad72012-01-17 14:03:34 +11002320AC_CHECK_FUNCS([RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex RSA_get_default_method HMAC_CTX_init])
Darren Tuckerebdef762010-12-04 23:20:50 +11002321
Tim Rice648f8762011-01-26 12:38:57 -08002322AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002323 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2324 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002325 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2326 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2327#include <openssl/engine.h>
2328 ]], [[
2329 ENGINE_load_builtin_engines();
2330 ENGINE_register_all_complete();
2331 ]])],
2332 [ AC_MSG_RESULT([yes])
2333 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002334 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002335 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2336 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002337 fi ]
2338)
2339
Darren Tucker129d0bb2005-12-19 17:40:40 +11002340# Check for OpenSSL without EVP_aes_{192,256}_cbc
2341AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002342AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002343 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002344#include <string.h>
2345#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002346 ]], [[
2347 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002348 ]])],
2349 [
Tim Rice648f8762011-01-26 12:38:57 -08002350 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002351 ],
2352 [
Tim Rice648f8762011-01-26 12:38:57 -08002353 AC_MSG_RESULT([yes])
2354 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002355 [libcrypto is missing AES 192 and 256 bit functions])
2356 ]
2357)
2358
Damien Miller25a02b02012-12-13 08:18:56 +11002359# Check for OpenSSL with EVP_aes_*ctr
2360AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2361AC_LINK_IFELSE(
2362 [AC_LANG_PROGRAM([[
2363#include <string.h>
2364#include <openssl/evp.h>
2365 ]], [[
2366 exit(EVP_aes_128_ctr() == NULL ||
2367 EVP_aes_192_cbc() == NULL ||
2368 EVP_aes_256_cbc() == NULL);
2369 ]])],
2370 [
2371 AC_MSG_RESULT([yes])
2372 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2373 [libcrypto has EVP AES CTR])
2374 ],
2375 [
2376 AC_MSG_RESULT([no])
2377 ]
2378)
2379
Damien Millerd522c682013-01-09 16:42:47 +11002380# Check for OpenSSL with EVP_aes_*gcm
2381AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2382AC_LINK_IFELSE(
2383 [AC_LANG_PROGRAM([[
2384#include <string.h>
2385#include <openssl/evp.h>
2386 ]], [[
2387 exit(EVP_aes_128_gcm() == NULL ||
Damien Millerb6f73b32013-02-11 10:39:12 +11002388 EVP_aes_256_gcm() == NULL ||
2389 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2390 EVP_CTRL_GCM_IV_GEN == 0 ||
2391 EVP_CTRL_GCM_SET_TAG == 0 ||
2392 EVP_CTRL_GCM_GET_TAG == 0 ||
2393 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
Damien Millerd522c682013-01-09 16:42:47 +11002394 ]])],
2395 [
2396 AC_MSG_RESULT([yes])
2397 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2398 [libcrypto has EVP AES GCM])
2399 ],
2400 [
2401 AC_MSG_RESULT([no])
Darren Tucker6d8bd572013-06-11 11:26:10 +10002402 unsupported_algorithms="$unsupported_cipers \
2403 aes128-gcm@openssh.com aes256-gcm@openssh.com"
Damien Millerd522c682013-01-09 16:42:47 +11002404 ]
2405)
2406
Damien Millerb6f73b32013-02-11 10:39:12 +11002407AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2408 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2409 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2410
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002411AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2412AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002413 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002414#include <string.h>
2415#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002416 ]], [[
2417 if(EVP_DigestUpdate(NULL, NULL,0))
2418 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002419 ]])],
2420 [
Tim Rice648f8762011-01-26 12:38:57 -08002421 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002422 ],
2423 [
Tim Rice648f8762011-01-26 12:38:57 -08002424 AC_MSG_RESULT([no])
2425 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002426 [Define if EVP_DigestUpdate returns void])
2427 ]
2428)
2429
Tim Rice3d5352e2004-02-12 09:27:21 -08002430# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2431# because the system crypt() is more featureful.
2432if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002433 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002434fi
2435
Damien Millera8e06ce2003-11-21 23:48:55 +11002436# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002437# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002438if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002439 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002440fi
Darren Tuckerc0c33732013-06-02 06:28:03 +10002441AC_CHECK_FUNCS([crypt DES_crypt])
Damien Millera64b57a2001-01-17 10:44:13 +11002442
Damien Milleraf87af12006-03-15 13:02:28 +11002443# Search for SHA256 support in libc and/or OpenSSL
Darren Tucker4bf7e502013-11-07 22:33:48 +11002444AC_CHECK_FUNCS([SHA256_Update EVP_sha256], ,
2445 [unsupported_algorithms="$unsupported_algorithms \
Darren Tucker6d8bd572013-06-11 11:26:10 +10002446 hmac-sha2-256 hmac-sha2-512 \
2447 diffie-hellman-group-exchange-sha256 \
2448 hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com"
2449 ]
2450)
Damien Milleraf87af12006-03-15 13:02:28 +11002451
Damien Miller6af914a2010-09-10 11:39:26 +10002452# Check complete ECC support in OpenSSL
Darren Tucker37bcef52013-11-09 18:39:25 +11002453AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
2454AC_LINK_IFELSE(
2455 [AC_LANG_PROGRAM([[
2456#include <openssl/ec.h>
2457#include <openssl/ecdh.h>
2458#include <openssl/ecdsa.h>
2459#include <openssl/evp.h>
2460#include <openssl/objects.h>
2461#include <openssl/opensslv.h>
2462#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2463# error "OpenSSL < 0.9.8g has unreliable ECC code"
2464#endif
2465 ]], [[
2466 EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
2467 const EVP_MD *m = EVP_sha256(); /* We need this too */
2468 ]])],
2469 [ AC_MSG_RESULT([yes])
2470 enable_nistp256=1 ],
2471 [ AC_MSG_RESULT([no]) ]
2472)
2473
2474AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1])
2475AC_LINK_IFELSE(
2476 [AC_LANG_PROGRAM([[
2477#include <openssl/ec.h>
2478#include <openssl/ecdh.h>
2479#include <openssl/ecdsa.h>
2480#include <openssl/evp.h>
2481#include <openssl/objects.h>
2482#include <openssl/opensslv.h>
2483#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2484# error "OpenSSL < 0.9.8g has unreliable ECC code"
2485#endif
2486 ]], [[
2487 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1);
2488 const EVP_MD *m = EVP_sha384(); /* We need this too */
2489 ]])],
2490 [ AC_MSG_RESULT([yes])
2491 enable_nistp384=1 ],
2492 [ AC_MSG_RESULT([no]) ]
2493)
2494
2495AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1])
Damien Miller6af914a2010-09-10 11:39:26 +10002496AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002497 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002498#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002499#include <openssl/ecdh.h>
2500#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002501#include <openssl/evp.h>
2502#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002503#include <openssl/opensslv.h>
2504#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2505# error "OpenSSL < 0.9.8g has unreliable ECC code"
2506#endif
Tim Rice648f8762011-01-26 12:38:57 -08002507 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002508 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2509 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002510 ]])],
Darren Tucker37bcef52013-11-09 18:39:25 +11002511 [ AC_MSG_RESULT([yes])
2512 AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional])
2513 AC_RUN_IFELSE(
2514 [AC_LANG_PROGRAM([[
2515#include <openssl/ec.h>
2516#include <openssl/ecdh.h>
2517#include <openssl/ecdsa.h>
2518#include <openssl/evp.h>
2519#include <openssl/objects.h>
2520#include <openssl/opensslv.h>
2521 ]],[[
2522 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2523 const EVP_MD *m = EVP_sha512(); /* We need this too */
2524 exit(e == NULL || m == NULL);
2525 ]])],
2526 [ AC_MSG_RESULT([yes])
2527 enable_nistp521=1 ],
2528 [ AC_MSG_RESULT([no]) ],
2529 [ AC_MSG_WARN([cross-compiling, assuming yes])
2530 enable_nistp521=1 ]
2531 ])
2532 AC_MSG_RESULT([no])
Damien Miller6af914a2010-09-10 11:39:26 +10002533)
Darren Tucker37bcef52013-11-09 18:39:25 +11002534
2535COMMENT_OUT_ECC="#no ecc#"
2536TEST_SSH_ECC=no
2537
2538if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \
2539 x$enable_nistp521 = x1; then
2540 AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC])
2541fi
2542if test x$enable_nistp256 = x1; then
2543 AC_DEFINE([OPENSSL_HAS_NISTP256], [1],
2544 [libcrypto has NID_X9_62_prime256v1])
2545 TEST_SSH_ECC=yes
2546 COMMENT_OUT_ECC=""
2547else
2548 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp256 \
2549 ecdh-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com"
2550fi
2551if test x$enable_nistp384 = x1; then
2552 AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1])
2553 TEST_SSH_ECC=yes
2554 COMMENT_OUT_ECC=""
2555else
2556 unsupported_algorithms="$unsupported_algorithms ecdsa-sha2-nistp384 \
2557 ecdh-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com"
2558fi
2559if test x$enable_nistp521 = x1; then
2560 AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1])
2561 TEST_SSH_ECC=yes
2562 COMMENT_OUT_ECC=""
2563else
2564 unsupported_algorithms="$unsupported_algorithms ecdh-sha2-nistp521 \
2565 ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com"
2566fi
2567
Tim Rice648f8762011-01-26 12:38:57 -08002568AC_SUBST([TEST_SSH_ECC])
2569AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002570
Tim Rice99203ec2007-03-26 09:35:28 -07002571saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002572AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002573 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002574 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2575 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002576 [Define if system has libiaf that supports set_id])
2577 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002578])
2579LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002580
2581### Configure cryptographic random number support
2582
2583# Check wheter OpenSSL seeds itself
2584AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002585AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002586 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002587#include <string.h>
2588#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002589 ]], [[
2590 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002591 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002592 [
2593 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002594 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002595 ],
2596 [
Tim Rice648f8762011-01-26 12:38:57 -08002597 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002598 ],
2599 [
2600 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002601 # This is safe, since we will fatal() at runtime if
2602 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002603 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002604 ]
2605)
2606
Damien Millerf22019b2011-05-05 13:48:37 +10002607# PRNGD TCP socket
2608AC_ARG_WITH([prngd-port],
2609 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2610 [
2611 case "$withval" in
2612 no)
2613 withval=""
2614 ;;
2615 [[0-9]]*)
2616 ;;
2617 *)
2618 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2619 ;;
2620 esac
2621 if test ! -z "$withval" ; then
2622 PRNGD_PORT="$withval"
2623 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2624 [Port number of PRNGD/EGD random number socket])
2625 fi
2626 ]
2627)
2628
2629# PRNGD Unix domain socket
2630AC_ARG_WITH([prngd-socket],
2631 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2632 [
2633 case "$withval" in
2634 yes)
2635 withval="/var/run/egd-pool"
2636 ;;
2637 no)
2638 withval=""
2639 ;;
2640 /*)
2641 ;;
2642 *)
2643 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2644 ;;
2645 esac
2646
2647 if test ! -z "$withval" ; then
2648 if test ! -z "$PRNGD_PORT" ; then
2649 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2650 fi
2651 if test ! -r "$withval" ; then
2652 AC_MSG_WARN([Entropy socket is not readable])
2653 fi
2654 PRNGD_SOCKET="$withval"
2655 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2656 [Location of PRNGD/EGD random number socket])
2657 fi
2658 ],
2659 [
2660 # Check for existing socket only if we don't have a random device already
2661 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2662 AC_MSG_CHECKING([for PRNGD/EGD socket])
2663 # Insert other locations here
2664 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2665 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2666 PRNGD_SOCKET="$sock"
2667 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2668 break;
2669 fi
2670 done
2671 if test ! -z "$PRNGD_SOCKET" ; then
2672 AC_MSG_RESULT([$PRNGD_SOCKET])
2673 else
2674 AC_MSG_RESULT([not found])
2675 fi
2676 fi
2677 ]
2678)
2679
2680# Which randomness source do we use?
2681if test ! -z "$PRNGD_PORT" ; then
2682 RAND_MSG="PRNGd port $PRNGD_PORT"
2683elif test ! -z "$PRNGD_SOCKET" ; then
2684 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2685elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2686 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2687 [Define if you want OpenSSL's internally seeded PRNG only])
2688 RAND_MSG="OpenSSL internal ONLY"
2689else
2690 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])
2691fi
2692
Darren Tucker3e6bde42006-08-20 20:03:50 +10002693# Check for PAM libs
2694PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002695AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002696 [ --with-pam Enable PAM support ],
2697 [
2698 if test "x$withval" != "xno" ; then
2699 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2700 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2701 AC_MSG_ERROR([PAM headers not found])
2702 fi
2703
2704 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002705 AC_CHECK_LIB([dl], [dlopen], , )
2706 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2707 AC_CHECK_FUNCS([pam_getenvlist])
2708 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002709 LIBS="$saved_LIBS"
2710
2711 PAM_MSG="yes"
2712
Darren Tucker20e9f972007-03-25 18:26:01 +10002713 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002714 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002715 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002716
Darren Tucker3e6bde42006-08-20 20:03:50 +10002717 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002718 case "$LIBS" in
2719 *-ldl*)
2720 # libdl already in LIBS
2721 ;;
2722 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002723 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002724 ;;
2725 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002726 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002727 fi
2728 ]
2729)
2730
2731# Check for older PAM
2732if test "x$PAM_MSG" = "xyes" ; then
2733 # Check PAM strerror arguments (old PAM)
2734 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002735 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002736#include <stdlib.h>
2737#if defined(HAVE_SECURITY_PAM_APPL_H)
2738#include <security/pam_appl.h>
2739#elif defined (HAVE_PAM_PAM_APPL_H)
2740#include <pam/pam_appl.h>
2741#endif
Tim Rice648f8762011-01-26 12:38:57 -08002742 ]], [[
2743(void)pam_strerror((pam_handle_t *)NULL, -1);
2744 ]])], [AC_MSG_RESULT([no])], [
2745 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002746 [Define if you have an old version of PAM
2747 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002748 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002749 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002750
2751 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002752fi
Damien Miller6c21c512002-01-22 21:57:53 +11002753
Damien Millerd3f6ad22002-06-25 10:24:47 +10002754SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002755AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002756 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002757 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002758 if test -n "$withval" && test "x$withval" != "xno" && \
2759 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002760 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002761 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002762 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002763)
Tim Rice648f8762011-01-26 12:38:57 -08002764AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002765 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002766AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002767
Damien Miller91f40d82013-02-22 11:37:00 +11002768if test "x$have_linux_no_new_privs" = "x1" ; then
2769AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2770 #include <sys/types.h>
2771 #include <linux/seccomp.h>
2772])
2773fi
2774if test "x$have_seccomp_filter" = "x1" ; then
2775AC_MSG_CHECKING([kernel for seccomp_filter support])
2776AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2777 #include <errno.h>
2778 #include <elf.h>
2779 #include <linux/audit.h>
2780 #include <linux/seccomp.h>
2781 #include <stdlib.h>
2782 #include <sys/prctl.h>
2783 ]],
2784 [[ int i = $seccomp_audit_arch;
2785 errno = 0;
2786 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2787 exit(errno == EFAULT ? 0 : 1); ]])],
2788 [ AC_MSG_RESULT([yes]) ], [
2789 AC_MSG_RESULT([no])
2790 # Disable seccomp filter as a target
2791 have_seccomp_filter=0
2792 ]
2793)
2794fi
2795
Damien Miller69ff1df2011-06-23 08:30:03 +10002796# Decide which sandbox style to use
2797sandbox_arg=""
2798AC_ARG_WITH([sandbox],
Damien Millere0956e32012-04-04 11:27:54 +10002799 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002800 [
2801 if test "x$withval" = "xyes" ; then
2802 sandbox_arg=""
2803 else
2804 sandbox_arg="$withval"
2805 fi
2806 ]
2807)
Darren Tucker60395f92012-07-03 14:31:18 +10002808
2809# Some platforms (seems to be the ones that have a kernel poll(2)-type
2810# function with which they implement select(2)) use an extra file descriptor
2811# when calling select(2), which means we can't use the rlimit sandbox.
2812AC_MSG_CHECKING([if select works with descriptor rlimit])
2813AC_RUN_IFELSE(
2814 [AC_LANG_PROGRAM([[
2815#include <sys/types.h>
2816#ifdef HAVE_SYS_TIME_H
2817# include <sys/time.h>
2818#endif
2819#include <sys/resource.h>
2820#ifdef HAVE_SYS_SELECT_H
2821# include <sys/select.h>
2822#endif
2823#include <errno.h>
2824#include <fcntl.h>
2825#include <stdlib.h>
2826 ]],[[
2827 struct rlimit rl_zero;
2828 int fd, r;
2829 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002830 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002831
2832 fd = open("/dev/null", O_RDONLY);
2833 FD_ZERO(&fds);
2834 FD_SET(fd, &fds);
2835 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2836 setrlimit(RLIMIT_FSIZE, &rl_zero);
2837 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002838 tv.tv_sec = 1;
2839 tv.tv_usec = 0;
2840 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002841 exit (r == -1 ? 1 : 0);
2842 ]])],
2843 [AC_MSG_RESULT([yes])
2844 select_works_with_rlimit=yes],
2845 [AC_MSG_RESULT([no])
2846 select_works_with_rlimit=no],
2847 [AC_MSG_WARN([cross compiling: assuming yes])]
2848)
2849
Darren Tuckerff008de2013-03-06 17:48:48 +11002850AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2851AC_RUN_IFELSE(
2852 [AC_LANG_PROGRAM([[
2853#include <sys/types.h>
2854#ifdef HAVE_SYS_TIME_H
2855# include <sys/time.h>
2856#endif
2857#include <sys/resource.h>
2858#include <errno.h>
2859#include <stdlib.h>
2860 ]],[[
2861 struct rlimit rl_zero;
2862 int fd, r;
2863 fd_set fds;
2864
2865 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2866 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2867 exit (r == -1 ? 1 : 0);
2868 ]])],
2869 [AC_MSG_RESULT([yes])
2870 rlimit_nofile_zero_works=yes],
2871 [AC_MSG_RESULT([no])
2872 rlimit_nofile_zero_works=no],
2873 [AC_MSG_WARN([cross compiling: assuming yes])]
2874)
2875
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002876AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2877AC_RUN_IFELSE(
2878 [AC_LANG_PROGRAM([[
2879#include <sys/types.h>
2880#include <sys/resource.h>
2881#include <stdlib.h>
2882 ]],[[
2883 struct rlimit rl_zero;
2884
2885 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2886 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2887 ]])],
2888 [AC_MSG_RESULT([yes])],
2889 [AC_MSG_RESULT([no])
2890 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
2891 [setrlimit RLIMIT_FSIZE works])],
2892 [AC_MSG_WARN([cross compiling: assuming yes])]
2893)
2894
Damien Miller69ff1df2011-06-23 08:30:03 +10002895if test "x$sandbox_arg" = "xsystrace" || \
2896 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002897 test "x$have_systr_policy_kill" != "x1" && \
2898 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002899 SANDBOX_STYLE="systrace"
2900 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002901elif test "x$sandbox_arg" = "xdarwin" || \
2902 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2903 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002904 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2905 "x$ac_cv_header_sandbox_h" != "xyes" && \
2906 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002907 SANDBOX_STYLE="darwin"
2908 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10002909elif test "x$sandbox_arg" = "xseccomp_filter" || \
2910 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10002911 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002912 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10002913 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002914 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
2915 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002916 test "x$have_linux_no_new_privs" = "x1" && \
2917 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11002918 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002919 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
2920 test "x$have_linux_no_new_privs" != "x1" && \
2921 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
2922 test "x$have_seccomp_filter" != "x1" && \
2923 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
2924 test "x$ac_cv_func_prctl" != "xyes" && \
2925 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
2926 SANDBOX_STYLE="seccomp_filter"
2927 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Miller69ff1df2011-06-23 08:30:03 +10002928elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10002929 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11002930 test "x$select_works_with_rlimit" = "xyes" && \
2931 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002932 test "x$ac_cv_func_setrlimit" != "xyes" && \
2933 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10002934 test "x$select_works_with_rlimit" != "xyes" && \
2935 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10002936 SANDBOX_STYLE="rlimit"
2937 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
2938elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2939 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2940 SANDBOX_STYLE="none"
2941 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2942else
Tim Ricea6e60612011-08-17 21:48:22 -07002943 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10002944fi
2945
Ben Lindstromb5628642000-10-18 00:02:25 +00002946# Cheap hack to ensure NEWS-OS libraries are arranged right.
2947if test ! -z "$SONY" ; then
2948 LIBS="$LIBS -liberty";
2949fi
2950
Damien Miller57f39152005-11-24 19:58:19 +11002951# Check for long long datatypes
2952AC_CHECK_TYPES([long long, unsigned long long, long double])
2953
2954# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002955AC_CHECK_SIZEOF([short int], [2])
2956AC_CHECK_SIZEOF([int], [4])
2957AC_CHECK_SIZEOF([long int], [4])
2958AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002959
Damien Millerfa2bb692002-04-23 23:22:25 +10002960# Sanity check long long for some platforms (AIX)
2961if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2962 ac_cv_sizeof_long_long_int=0
2963fi
2964
Darren Tucker537f1ed2005-10-25 18:38:33 +10002965# compute LLONG_MIN and LLONG_MAX if we don't know them.
2966if test -z "$have_llong_max"; then
2967 AC_MSG_CHECKING([for max value of long long])
2968 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002969 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002970#include <stdio.h>
2971/* Why is this so damn hard? */
2972#ifdef __GNUC__
2973# undef __GNUC__
2974#endif
2975#define __USE_ISOC99
2976#include <limits.h>
2977#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002978#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2979
2980/*
2981 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2982 * we do this the hard way.
2983 */
2984static int
2985fprint_ll(FILE *f, long long n)
2986{
2987 unsigned int i;
2988 int l[sizeof(long long) * 8];
2989
2990 if (n < 0)
2991 if (fprintf(f, "-") < 0)
2992 return -1;
2993 for (i = 0; n != 0; i++) {
2994 l[i] = my_abs(n % 10);
2995 n /= 10;
2996 }
2997 do {
2998 if (fprintf(f, "%d", l[--i]) < 0)
2999 return -1;
3000 } while (i != 0);
3001 if (fprintf(f, " ") < 0)
3002 return -1;
3003 return 0;
3004}
Tim Rice648f8762011-01-26 12:38:57 -08003005 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10003006 FILE *f;
3007 long long i, llmin, llmax = 0;
3008
3009 if((f = fopen(DATA,"w")) == NULL)
3010 exit(1);
3011
3012#if defined(LLONG_MIN) && defined(LLONG_MAX)
3013 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
3014 llmin = LLONG_MIN;
3015 llmax = LLONG_MAX;
3016#else
3017 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
3018 /* This will work on one's complement and two's complement */
3019 for (i = 1; i > llmax; i <<= 1, i++)
3020 llmax = i;
3021 llmin = llmax + 1LL; /* wrap */
3022#endif
3023
3024 /* Sanity check */
3025 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11003026 || llmax - 1 > llmax || llmin == llmax || llmin == 0
3027 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10003028 fprintf(f, "unknown unknown\n");
3029 exit(2);
3030 }
3031
Darren Tuckerd1450db2006-03-13 19:06:51 +11003032 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10003033 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11003034 if (fprint_ll(f, llmax) < 0)
3035 exit(4);
3036 if (fclose(f) < 0)
3037 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003038 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10003039 ]])],
3040 [
3041 llong_min=`$AWK '{print $1}' conftest.llminmax`
3042 llong_max=`$AWK '{print $2}' conftest.llminmax`
3043
Tim Rice648f8762011-01-26 12:38:57 -08003044 AC_MSG_RESULT([$llong_max])
3045 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003046 [max value of long long calculated by configure])
3047 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08003048 AC_MSG_RESULT([$llong_min])
3049 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10003050 [min value of long long calculated by configure])
3051 ],
3052 [
Tim Rice648f8762011-01-26 12:38:57 -08003053 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10003054 ],
3055 [
3056 AC_MSG_WARN([cross compiling: not checking])
3057 ]
3058 )
3059fi
3060
3061
Damien Millera22ba012000-03-02 23:09:20 +11003062# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11003063AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08003064 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3065 [[ u_int a; a = 1;]])],
3066 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
3067 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11003068])
3069if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003070 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11003071 have_u_int=1
3072fi
3073
Damien Miller61e50f12000-05-08 20:49:37 +10003074AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003075 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3076 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
3077 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
3078 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003079])
3080if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003081 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003082 have_intxx_t=1
3083fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003084
3085if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003086 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003087then
3088 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003089 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3090 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003091 [
Tim Rice648f8762011-01-26 12:38:57 -08003092 AC_DEFINE([HAVE_INTXX_T])
3093 AC_MSG_RESULT([yes])
3094 ], [ AC_MSG_RESULT([no])
3095 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003096fi
3097
Damien Miller578783e2000-09-23 14:12:24 +11003098AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003099 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003100#include <sys/types.h>
3101#ifdef HAVE_STDINT_H
3102# include <stdint.h>
3103#endif
3104#include <sys/socket.h>
3105#ifdef HAVE_SYS_BITYPES_H
3106# include <sys/bitypes.h>
3107#endif
Tim Rice648f8762011-01-26 12:38:57 -08003108 ]], [[
3109int64_t a; a = 1;
3110 ]])],
3111 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
3112 ])
Damien Miller578783e2000-09-23 14:12:24 +11003113])
3114if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003115 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003116fi
3117
Damien Miller61e50f12000-05-08 20:49:37 +10003118AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003119 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3120 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
3121 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
3122 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003123])
3124if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003125 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003126 have_u_intxx_t=1
3127fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003128
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003129if test -z "$have_u_intxx_t" ; then
3130 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003131 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3132 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003133 [
Tim Rice648f8762011-01-26 12:38:57 -08003134 AC_DEFINE([HAVE_U_INTXX_T])
3135 AC_MSG_RESULT([yes])
3136 ], [ AC_MSG_RESULT([no])
3137 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003138fi
3139
Damien Miller578783e2000-09-23 14:12:24 +11003140AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003141 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3142 [[ u_int64_t a; a = 1;]])],
3143 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
3144 ])
Damien Miller578783e2000-09-23 14:12:24 +11003145])
3146if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003147 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003148 have_u_int64_t=1
3149fi
3150
Tim Rice4cec93f2002-02-26 08:40:48 -08003151if test -z "$have_u_int64_t" ; then
3152 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003153 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3154 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003155 [
Tim Rice648f8762011-01-26 12:38:57 -08003156 AC_DEFINE([HAVE_U_INT64_T])
3157 AC_MSG_RESULT([yes])
3158 ], [ AC_MSG_RESULT([no])
3159 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003160fi
3161
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003162if test -z "$have_u_intxx_t" ; then
3163 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003164 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003165#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003166 ]], [[
3167 uint8_t a;
3168 uint16_t b;
3169 uint32_t c;
3170 a = b = c = 1;
3171 ]])],
3172 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3173 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003174 ])
3175 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003176 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003177 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003178 fi
3179fi
3180
3181if test -z "$have_uintxx_t" ; then
3182 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3184 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003185 [
Tim Rice648f8762011-01-26 12:38:57 -08003186 AC_DEFINE([HAVE_UINTXX_T])
3187 AC_MSG_RESULT([yes])
3188 ], [ AC_MSG_RESULT([no])
3189 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003190fi
3191
Damien Milleredb82922000-06-20 13:25:52 +10003192if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003193 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003194then
3195 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003196 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003197#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003198 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003199 int8_t a; int16_t b; int32_t c;
3200 u_int8_t e; u_int16_t f; u_int32_t g;
3201 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003202 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003203 [
Tim Rice648f8762011-01-26 12:38:57 -08003204 AC_DEFINE([HAVE_U_INTXX_T])
3205 AC_DEFINE([HAVE_INTXX_T])
3206 AC_MSG_RESULT([yes])
3207 ], [AC_MSG_RESULT([no])
3208 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003209fi
3210
Damien Miller58be7382001-09-15 21:31:54 +10003211
3212AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003213 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3214 [[ u_char foo; foo = 125; ]])],
3215 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3216 ])
Damien Miller58be7382001-09-15 21:31:54 +10003217])
3218if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003219 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003220fi
3221
Darren Tucker007e3b32013-11-03 18:43:55 +11003222AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3223#include <sys/types.h>
3224#include <stdint.h>
3225])
3226
Tim Rice13aae5e2001-10-21 17:53:58 -07003227TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003228
Tim Rice648f8762011-01-26 12:38:57 -08003229AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3230AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003231#include <sys/types.h>
3232#ifdef HAVE_SYS_BITYPES_H
3233#include <sys/bitypes.h>
3234#endif
3235#ifdef HAVE_SYS_STATFS_H
3236#include <sys/statfs.h>
3237#endif
3238#ifdef HAVE_SYS_STATVFS_H
3239#include <sys/statvfs.h>
3240#endif
3241])
Tim Rice4cec93f2002-02-26 08:40:48 -08003242
Tim Rice648f8762011-01-26 12:38:57 -08003243AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003244[#include <sys/types.h>
3245#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003246
Damien Miller61e50f12000-05-08 20:49:37 +10003247AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003248 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3249 [[ size_t foo; foo = 1235; ]])],
3250 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3251 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003252])
3253if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003254 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003255fi
Damien Miller95058511999-12-29 10:36:45 +11003256
Damien Miller615f9392000-05-17 22:53:33 +10003257AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003258 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3259 [[ ssize_t foo; foo = 1235; ]])],
3260 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3261 ])
Damien Miller615f9392000-05-17 22:53:33 +10003262])
3263if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003264 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003265fi
3266
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003267AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003268 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3269 [[ clock_t foo; foo = 1235; ]])],
3270 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3271 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003272])
3273if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003274 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003275fi
3276
Damien Millerb54b40e2000-06-23 08:23:34 +10003277AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003278 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003279#include <sys/types.h>
3280#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003281 ]], [[ sa_family_t foo; foo = 1235; ]])],
3282 [ ac_cv_have_sa_family_t="yes" ],
3283 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003284#include <sys/types.h>
3285#include <sys/socket.h>
3286#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003287 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003288 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003289 [ ac_cv_have_sa_family_t="no" ]
3290 )
Tim Rice648f8762011-01-26 12:38:57 -08003291 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003292])
3293if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003294 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003295 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003296fi
3297
Damien Miller0f91b4e2000-06-18 15:43:25 +10003298AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3300 [[ pid_t foo; foo = 1235; ]])],
3301 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3302 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003303])
3304if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003305 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003306fi
3307
3308AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003309 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3310 [[ mode_t foo; foo = 1235; ]])],
3311 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3312 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003313])
3314if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003315 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003316fi
3317
Damien Miller61e50f12000-05-08 20:49:37 +10003318
3319AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003320 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003321#include <sys/types.h>
3322#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003323 ]], [[ struct sockaddr_storage s; ]])],
3324 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3325 [ ac_cv_have_struct_sockaddr_storage="no"
3326 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003327])
3328if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003329 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003330 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003331fi
Damien Miller34132e52000-01-14 15:45:46 +11003332
Damien Miller61e50f12000-05-08 20:49:37 +10003333AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003334 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003335#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003336#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003337 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3338 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3339 [ ac_cv_have_struct_sockaddr_in6="no"
3340 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003341])
3342if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003343 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003344 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003345fi
Damien Miller34132e52000-01-14 15:45:46 +11003346
Damien Miller61e50f12000-05-08 20:49:37 +10003347AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003348 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003349#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003350#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003351 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3352 [ ac_cv_have_struct_in6_addr="yes" ],
3353 [ ac_cv_have_struct_in6_addr="no"
3354 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003355])
3356if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003357 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003358 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003359
3360dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003361 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003362 [
3363#ifdef HAVE_SYS_TYPES_H
3364#include <sys/types.h>
3365#endif
3366#include <netinet/in.h>
3367 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003368fi
Damien Miller34132e52000-01-14 15:45:46 +11003369
Damien Miller61e50f12000-05-08 20:49:37 +10003370AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003372#include <sys/types.h>
3373#include <sys/socket.h>
3374#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003375 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3376 [ ac_cv_have_struct_addrinfo="yes" ],
3377 [ ac_cv_have_struct_addrinfo="no"
3378 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003379])
3380if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003381 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003382 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003383fi
3384
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003385AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3387 [[ struct timeval tv; tv.tv_sec = 1;]])],
3388 [ ac_cv_have_struct_timeval="yes" ],
3389 [ ac_cv_have_struct_timeval="no"
3390 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003391])
3392if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003393 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003394 have_struct_timeval=1
3395fi
3396
Tim Rice648f8762011-01-26 12:38:57 -08003397AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003398
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003399# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003400if test "x$ac_cv_have_int64_t" = "xno" && \
3401 test "x$ac_cv_sizeof_long_int" != "x8" && \
3402 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003403 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3404 echo "an alternative compiler (I.E., GCC) before continuing."
3405 echo ""
3406 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003407else
3408dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003409 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003410 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003411#include <stdio.h>
3412#include <string.h>
3413#ifdef HAVE_SNPRINTF
3414main()
3415{
3416 char buf[50];
3417 char expected_out[50];
3418 int mazsize = 50 ;
3419#if (SIZEOF_LONG_INT == 8)
3420 long int num = 0x7fffffffffffffff;
3421#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003422 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003423#endif
3424 strcpy(expected_out, "9223372036854775807");
3425 snprintf(buf, mazsize, "%lld", num);
3426 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003427 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003428 exit(0);
3429}
3430#else
3431main() { exit(0); }
3432#endif
Tim Rice648f8762011-01-26 12:38:57 -08003433 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003434 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003435 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003436fi
3437
Damien Miller78315eb2000-09-29 23:01:36 +11003438dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003439OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3440OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3441OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3442OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3443OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3444OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3445OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3446OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3447OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3448OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3449OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3450OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3451OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3452OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3453OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3454OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3455OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003456
3457AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003458AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3459struct passwd.pw_change, struct passwd.pw_expire],
3460[], [], [[
3461#include <sys/types.h>
3462#include <pwd.h>
3463]])
3464
Tim Rice648f8762011-01-26 12:38:57 -08003465AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003466 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003467[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003468#include <stdio.h>
3469#if HAVE_SYS_TYPES_H
3470# include <sys/types.h>
3471#endif
3472#include <netinet/in.h>
3473#include <arpa/nameser.h>
3474#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003475]])
andre2ff7b5d2000-06-03 14:57:40 +00003476
Damien Miller61e50f12000-05-08 20:49:37 +10003477AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3478 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003480#include <sys/types.h>
3481#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003482 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3483 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3484 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003485])
3486if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003487 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003488fi
3489
Damien Miller61e50f12000-05-08 20:49:37 +10003490AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3491 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003492 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003493#include <sys/types.h>
3494#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003495 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3496 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3497 [ ac_cv_have___ss_family_in_struct_ss="no"
3498 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003499])
3500if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003501 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003502 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003503fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003504
Tim Rice28bbb0c2002-05-27 17:37:32 -07003505dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003506AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3507 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003508 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003509#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003510#include <sys/socket.h>
3511#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003512 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003513#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003514#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003515exit(1);
3516#endif
3517struct msghdr m;
3518m.msg_accrights = 0;
3519exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003520 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003521 [ ac_cv_have_accrights_in_msghdr="yes" ],
3522 [ ac_cv_have_accrights_in_msghdr="no" ]
3523 )
3524])
3525if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003526 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003527 [Define if your system uses access rights style
3528 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003529fi
3530
Tim Rice648f8762011-01-26 12:38:57 -08003531AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3532AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003533#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003534#include <sys/stat.h>
3535#ifdef HAVE_SYS_TIME_H
3536# include <sys/time.h>
3537#endif
3538#ifdef HAVE_SYS_MOUNT_H
3539#include <sys/mount.h>
3540#endif
3541#ifdef HAVE_SYS_STATVFS_H
3542#include <sys/statvfs.h>
3543#endif
Tim Rice648f8762011-01-26 12:38:57 -08003544 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3545 [ AC_MSG_RESULT([yes]) ],
3546 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003547
Tim Rice648f8762011-01-26 12:38:57 -08003548 AC_MSG_CHECKING([if fsid_t has member val])
3549 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003550#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003551#include <sys/statvfs.h>
3552 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3553 [ AC_MSG_RESULT([yes])
3554 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3555 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003556
Tim Rice648f8762011-01-26 12:38:57 -08003557 AC_MSG_CHECKING([if f_fsid has member __val])
3558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003559#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003560#include <sys/statvfs.h>
3561 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3562 [ AC_MSG_RESULT([yes])
3563 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3564 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003565])
Darren Tucker77001382008-06-09 06:17:53 +10003566
Kevin Stevesa44e0352002-04-07 16:18:03 +00003567AC_CACHE_CHECK([for msg_control field in struct msghdr],
3568 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003569 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003570#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003571#include <sys/socket.h>
3572#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003573 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003574#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003575#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003576exit(1);
3577#endif
3578struct msghdr m;
3579m.msg_control = 0;
3580exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003581 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003582 [ ac_cv_have_control_in_msghdr="yes" ],
3583 [ ac_cv_have_control_in_msghdr="no" ]
3584 )
3585])
3586if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003587 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003588 [Define if your system uses ancillary data style
3589 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003590fi
3591
Damien Miller61e50f12000-05-08 20:49:37 +10003592AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003593 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3594 [[ extern char *__progname; printf("%s", __progname); ]])],
3595 [ ac_cv_libc_defines___progname="yes" ],
3596 [ ac_cv_libc_defines___progname="no"
3597 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003598])
3599if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003600 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003601fi
3602
Kevin Steves4846f4a2002-03-22 18:19:53 +00003603AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003604 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3605 [[ printf("%s", __FUNCTION__); ]])],
3606 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3607 [ ac_cv_cc_implements___FUNCTION__="no"
3608 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003609])
3610if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003611 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003612 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003613fi
3614
3615AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003616 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3617 [[ printf("%s", __func__); ]])],
3618 [ ac_cv_cc_implements___func__="yes" ],
3619 [ ac_cv_cc_implements___func__="no"
3620 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003621])
3622if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003623 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003624fi
3625
Damien Miller57f39152005-11-24 19:58:19 +11003626AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003627 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3628#include <stdarg.h>
3629va_list x,y;
3630 ]], [[ va_copy(x,y); ]])],
3631 [ ac_cv_have_va_copy="yes" ],
3632 [ ac_cv_have_va_copy="no"
3633 ])
Damien Miller57f39152005-11-24 19:58:19 +11003634])
3635if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003636 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003637fi
3638
3639AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003640 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3641#include <stdarg.h>
3642va_list x,y;
3643 ]], [[ __va_copy(x,y); ]])],
3644 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3645 ])
Damien Miller57f39152005-11-24 19:58:19 +11003646])
3647if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003648 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003649fi
3650
Damien Miller4f8e6692001-07-14 13:22:53 +10003651AC_CACHE_CHECK([whether getopt has optreset support],
3652 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003653 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3654 [[ extern int optreset; optreset = 0; ]])],
3655 [ ac_cv_have_getopt_optreset="yes" ],
3656 [ ac_cv_have_getopt_optreset="no"
3657 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003658])
3659if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003660 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003661 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003662fi
Damien Millera22ba012000-03-02 23:09:20 +11003663
Damien Millerecbb26d2000-07-15 14:59:14 +10003664AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003665 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3666[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3667 [ ac_cv_libc_defines_sys_errlist="yes" ],
3668 [ ac_cv_libc_defines_sys_errlist="no"
3669 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003670])
3671if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003672 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003673 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003674fi
3675
3676
Damien Miller11fa2cc2000-08-16 10:35:58 +10003677AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003678 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3679[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3680 [ ac_cv_libc_defines_sys_nerr="yes" ],
3681 [ ac_cv_libc_defines_sys_nerr="no"
3682 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003683])
3684if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003685 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003686fi
3687
Darren Tucker5f88d342003-10-15 16:57:57 +10003688# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003689AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3690 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003691 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003692 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003693 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003694 AC_SEARCH_LIBS([res_query], [resolv])
3695 AC_SEARCH_LIBS([dn_expand], [resolv])
3696 AC_MSG_CHECKING([if res_query will link])
3697 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003698#include <sys/types.h>
3699#include <netinet/in.h>
3700#include <arpa/nameser.h>
3701#include <netdb.h>
3702#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003703 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003704 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003705 ]])],
3706 AC_MSG_RESULT([yes]),
3707 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003708 saved_LIBS="$LIBS"
3709 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003710 AC_MSG_CHECKING([for res_query in -lresolv])
3711 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003712#include <sys/types.h>
3713#include <netinet/in.h>
3714#include <arpa/nameser.h>
3715#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003716#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003717 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003718 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003719 ]])],
3720 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003721 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003722 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003723 ])
Tim Rice648f8762011-01-26 12:38:57 -08003724 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003725 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003726 [#include <sys/types.h>
3727 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003728 AC_CHECK_MEMBER([HEADER.ad],
3729 [AC_DEFINE([HAVE_HEADER_AD], [1],
3730 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003731 [#include <arpa/nameser.h>])
3732 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003733
Tim Rice648f8762011-01-26 12:38:57 -08003734AC_MSG_CHECKING([if struct __res_state _res is an extern])
3735AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003736#include <stdio.h>
3737#if HAVE_SYS_TYPES_H
3738# include <sys/types.h>
3739#endif
3740#include <netinet/in.h>
3741#include <arpa/nameser.h>
3742#include <resolv.h>
3743extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003744 ]], [[ ]])],
3745 [AC_MSG_RESULT([yes])
3746 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003747 [Define if you have struct __res_state _res as an extern])
3748 ],
Tim Rice648f8762011-01-26 12:38:57 -08003749 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003750)
3751
Damien Miller73b42d22006-04-22 21:26:08 +10003752# Check whether user wants SELinux support
3753SELINUX_MSG="no"
3754LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003755AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003756 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003757 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003758 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003759 AC_DEFINE([WITH_SELINUX], [1],
3760 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003761 SELINUX_MSG="yes"
3762 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003763 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3764 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003765 [ LIBSELINUX="-lselinux"
3766 LIBS="$LIBS -lselinux"
3767 ],
Tim Rice648f8762011-01-26 12:38:57 -08003768 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003769 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003770 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003771 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003772 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003773 fi ]
3774)
Tim Rice648f8762011-01-26 12:38:57 -08003775AC_SUBST([SSHLIBS])
3776AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003777
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003778# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003779KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003780AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003781 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003782 [ if test "x$withval" != "xno" ; then
3783 if test "x$withval" = "xyes" ; then
3784 KRB5ROOT="/usr/local"
3785 else
3786 KRB5ROOT=${withval}
3787 fi
3788
Tim Rice648f8762011-01-26 12:38:57 -08003789 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003790 KRB5_MSG="yes"
3791
Tim Rice648f8762011-01-26 12:38:57 -08003792 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003793 [$KRB5ROOT/bin/krb5-config],
3794 [$KRB5ROOT/bin:$PATH])
3795 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003796 K5CFLAGS="`$KRB5CONF --cflags`"
3797 K5LIBS="`$KRB5CONF --libs`"
3798 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003799
Tim Rice648f8762011-01-26 12:38:57 -08003800 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003801 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003802 AC_MSG_RESULT([yes])
3803 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003804 [Define this if you want GSSAPI
3805 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003806 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3807 GSSLIBS="`$KRB5CONF --libs gssapi`"
3808 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003809 else
Tim Rice648f8762011-01-26 12:38:57 -08003810 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003811 fi
Tim Rice648f8762011-01-26 12:38:57 -08003812 AC_MSG_CHECKING([whether we are using Heimdal])
3813 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3814 ]], [[ char *tmp = heimdal_version; ]])],
3815 [ AC_MSG_RESULT([yes])
3816 AC_DEFINE([HEIMDAL], [1],
3817 [Define this if you are using the Heimdal
3818 version of Kerberos V5]) ],
3819 [AC_MSG_RESULT([no])
3820 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003821 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003822 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003823 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003824 AC_MSG_CHECKING([whether we are using Heimdal])
3825 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3826 ]], [[ char *tmp = heimdal_version; ]])],
3827 [ AC_MSG_RESULT([yes])
3828 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003829 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003830 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003831 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003832 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003833 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003834 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003835 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003836 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003837
3838 ])
3839 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003840
Tim Rice648f8762011-01-26 12:38:57 -08003841 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3842 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003843 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003844 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3845 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003846 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003847 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3848 [ AC_DEFINE([GSSAPI])
3849 GSSLIBS="-lgss" ],
3850 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3851 ])
Darren Tucker964de182013-02-22 10:39:59 +11003852 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003853
Tim Rice648f8762011-01-26 12:38:57 -08003854 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003855 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003856 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003857 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003858 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003859 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003860 ]
3861 )
3862
3863 oldCPP="$CPPFLAGS"
3864 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003865 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003866 [ CPPFLAGS="$oldCPP" ])
3867
Damien Millera8e06ce2003-11-21 23:48:55 +11003868 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003869 if test ! -z "$need_dash_r" ; then
3870 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3871 fi
3872 if test ! -z "$blibpath" ; then
3873 blibpath="$blibpath:${KRB5ROOT}/lib"
3874 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003875
Tim Rice648f8762011-01-26 12:38:57 -08003876 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3877 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3878 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003879
Tim Rice648f8762011-01-26 12:38:57 -08003880 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3881 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11003882
3883 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
3884#ifdef HAVE_GSSAPI_H
3885# include <gssapi.h>
3886#elif defined(HAVE_GSSAPI_GSSAPI_H)
3887# include <gssapi/gssapi.h>
3888#endif
3889
3890#ifdef HAVE_GSSAPI_GENERIC_H
3891# include <gssapi_generic.h>
3892#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
3893# include <gssapi/gssapi_generic.h>
3894#endif
3895 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10003896 saved_LIBS="$LIBS"
3897 LIBS="$LIBS $K5LIBS"
3898 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
3899 LIBS="$saved_LIBS"
3900
Darren Tucker0d27ed12004-02-24 10:37:33 +11003901 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003902 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003903)
Darren Tucker964de182013-02-22 10:39:59 +11003904AC_SUBST([GSSLIBS])
3905AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10003906
Damien Millera22ba012000-03-02 23:09:20 +11003907# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003908
Damien Millerf58c6722002-05-13 13:15:42 +10003909PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003910AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003911 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003912 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003913 if test -n "$withval" && test "x$withval" != "xno" && \
3914 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003915 PRIVSEP_PATH=$withval
3916 fi
3917 ]
3918)
Tim Rice648f8762011-01-26 12:38:57 -08003919AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003920
Tim Rice648f8762011-01-26 12:38:57 -08003921AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003922 [ --with-xauth=PATH Specify path to xauth program ],
3923 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003924 if test -n "$withval" && test "x$withval" != "xno" && \
3925 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003926 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003927 fi
3928 ],
3929 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003930 TestPath="$PATH"
3931 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3932 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3933 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3934 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003935 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003936 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003937 xauth_path="/usr/openwin/bin/xauth"
3938 fi
3939 ]
3940)
3941
Damien Miller7d901272003-01-13 16:55:22 +11003942STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003943AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003944 [ --disable-strip Disable calling strip(1) on install],
3945 [
3946 if test "x$enableval" = "xno" ; then
3947 STRIP_OPT=
3948 fi
3949 ]
3950)
Tim Rice648f8762011-01-26 12:38:57 -08003951AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003952
Damien Millera19cf472000-11-29 13:28:50 +11003953if test -z "$xauth_path" ; then
3954 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003955 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003956else
Tim Rice648f8762011-01-26 12:38:57 -08003957 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003958 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003959 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003960 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003961fi
Damien Millera22ba012000-03-02 23:09:20 +11003962
Tim Rice90f42b02011-06-02 18:17:49 -07003963dnl # --with-maildir=/path/to/mail gets top priority.
3964dnl # if maildir is set in the platform case statement above we use that.
3965dnl # Otherwise we run a program to get the dir from system headers.
3966dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3967dnl # If we find _PATH_MAILDIR we do nothing because that is what
3968dnl # session.c expects anyway. Otherwise we set to the value found
3969dnl # stripping any trailing slash. If for some strage reason our program
3970dnl # does not find what it needs, we default to /var/spool/mail.
3971# Check for mail directory
3972AC_ARG_WITH([maildir],
3973 [ --with-maildir=/path/to/mail Specify your system mail directory],
3974 [
3975 if test "X$withval" != X && test "x$withval" != xno && \
3976 test "x${withval}" != xyes; then
3977 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3978 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3979 fi
3980 ],[
3981 if test "X$maildir" != "X"; then
3982 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3983 else
3984 AC_MSG_CHECKING([Discovering system mail directory])
3985 AC_RUN_IFELSE(
3986 [AC_LANG_PROGRAM([[
3987#include <stdio.h>
3988#include <string.h>
3989#ifdef HAVE_PATHS_H
3990#include <paths.h>
3991#endif
3992#ifdef HAVE_MAILLOCK_H
3993#include <maillock.h>
3994#endif
3995#define DATA "conftest.maildir"
3996 ]], [[
3997 FILE *fd;
3998 int rc;
3999
4000 fd = fopen(DATA,"w");
4001 if(fd == NULL)
4002 exit(1);
4003
4004#if defined (_PATH_MAILDIR)
4005 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
4006 exit(1);
4007#elif defined (MAILDIR)
4008 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
4009 exit(1);
4010#elif defined (_PATH_MAIL)
4011 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
4012 exit(1);
4013#else
4014 exit (2);
4015#endif
4016
4017 exit(0);
4018 ]])],
4019 [
4020 maildir_what=`awk -F: '{print $1}' conftest.maildir`
4021 maildir=`awk -F: '{print $2}' conftest.maildir \
4022 | sed 's|/$||'`
4023 AC_MSG_RESULT([Using: $maildir from $maildir_what])
4024 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
4025 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
4026 fi
4027 ],
4028 [
4029 if test "X$ac_status" = "X2";then
4030# our test program didn't find it. Default to /var/spool/mail
4031 AC_MSG_RESULT([Using: default value of /var/spool/mail])
4032 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
4033 else
4034 AC_MSG_RESULT([*** not found ***])
4035 fi
4036 ],
4037 [
4038 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
4039 ]
4040 )
4041 fi
4042 ]
4043) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11004044
Darren Tucker623d92f2004-09-12 22:36:15 +10004045if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10004046 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
4047 disable_ptmx_check=yes
4048fi
Damien Millera22ba012000-03-02 23:09:20 +11004049if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004050 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004051 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004052 [
Tim Rice648f8762011-01-26 12:38:57 -08004053 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004054 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00004055 have_dev_ptmx=1
4056 ]
4057 )
4058 fi
Damien Millera22ba012000-03-02 23:09:20 +11004059fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10004060
Darren Tucker623d92f2004-09-12 22:36:15 +10004061if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004062 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10004063 [
Tim Rice648f8762011-01-26 12:38:57 -08004064 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004065 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004066 have_dev_ptc=1
4067 ]
4068 )
4069else
4070 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
4071fi
Damien Miller204ad072000-03-02 23:56:12 +11004072
Damien Millera22ba012000-03-02 23:09:20 +11004073# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08004074AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10004075 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11004076 [
Damien Miller897741e2001-04-16 10:41:46 +10004077 case "$withval" in
4078 man|cat|doc)
4079 MANTYPE=$withval
4080 ;;
4081 *)
Tim Rice648f8762011-01-26 12:38:57 -08004082 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004083 ;;
4084 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004085 ]
4086)
Ben Lindstrombc709922001-04-18 18:04:21 +00004087if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004088 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004089 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004090 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4091 MANTYPE=doc
4092 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4093 MANTYPE=man
4094 else
4095 MANTYPE=cat
4096 fi
4097fi
Tim Rice648f8762011-01-26 12:38:57 -08004098AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004099if test "$MANTYPE" = "doc"; then
4100 mansubdir=man;
4101else
4102 mansubdir=$MANTYPE;
4103fi
Tim Rice648f8762011-01-26 12:38:57 -08004104AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004105
Damien Millera22ba012000-03-02 23:09:20 +11004106# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004107MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004108AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004109 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004110 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004111 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004112 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004113 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004114 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004115 fi
4116 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004117)
4118
Damien Millera22ba012000-03-02 23:09:20 +11004119# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004120AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004121 [ --without-shadow Disable shadow password support],
4122 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004123 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004124 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004125 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004126 fi
4127 ]
4128)
4129
Damien Miller1f335fb2000-06-26 11:31:33 +10004130if test -z "$disable_shadow" ; then
4131 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004132 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004133#include <sys/types.h>
4134#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004135struct spwd sp;
4136 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4137 [ sp_expire_available=yes ], [
4138 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004139
4140 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004141 AC_MSG_RESULT([yes])
4142 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004143 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004144 else
Tim Rice648f8762011-01-26 12:38:57 -08004145 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004146 fi
4147fi
4148
Damien Millera22ba012000-03-02 23:09:20 +11004149# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004150if test ! -z "$IPADDR_IN_DISPLAY" ; then
4151 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004152 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004153 [Define if you need to use IP address
4154 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004155else
Damien Millera8e06ce2003-11-21 23:48:55 +11004156 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004157 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004158 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4159 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004160 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004161 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004162 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004163 fi
4164 ]
4165 )
4166fi
Damien Miller76112de1999-12-21 11:18:08 +11004167
Darren Tuckere1a790d2003-09-16 11:52:19 +10004168# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004169AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004170 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004171 [ if test "x$enableval" = "xno"; then
4172 AC_MSG_NOTICE([/etc/default/login handling disabled])
4173 etc_default_login=no
4174 else
4175 etc_default_login=yes
4176 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004177 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4178 then
4179 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4180 etc_default_login=no
4181 else
4182 etc_default_login=yes
4183 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004184)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004185
Darren Tucker2f9573d2005-02-10 22:28:54 +11004186if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004187 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004188 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004189 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004190 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004191 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004192 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004193fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004194
Tim Rice43a1c132002-04-17 21:19:14 -07004195dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004196if test $ac_cv_func_login_getcapbool = "yes" && \
4197 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004198 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004199fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004200
Damien Millera22ba012000-03-02 23:09:20 +11004201# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004202SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004203AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004204 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004205 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004206 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004207 AC_MSG_WARN([
4208--with-default-path=PATH has no effect on this system.
4209Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004210 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004211 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004212 AC_MSG_WARN([
4213--with-default-path=PATH will only be used if PATH is not defined in
4214$external_path_file .])
4215 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004216 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004217 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004218 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004219 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004220 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4221 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004222 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004223 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004224 AC_MSG_WARN([
4225If PATH is defined in $external_path_file, ensure the path to scp is included,
4226otherwise scp will not work.])
4227 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004228 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004229 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004230/* find out what STDPATH is */
4231#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004232#ifdef HAVE_PATHS_H
4233# include <paths.h>
4234#endif
4235#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004236# ifdef _PATH_USERPATH /* Irix */
4237# define _PATH_STDPATH _PATH_USERPATH
4238# else
4239# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4240# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004241#endif
4242#include <sys/types.h>
4243#include <sys/stat.h>
4244#include <fcntl.h>
4245#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004246 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004247 FILE *fd;
4248 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004249
Tim Rice59ea0a02001-03-10 13:50:45 -08004250 fd = fopen(DATA,"w");
4251 if(fd == NULL)
4252 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004253
Tim Rice59ea0a02001-03-10 13:50:45 -08004254 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4255 exit(1);
4256
4257 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004258 ]])],
4259 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004260 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4261 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4262 )
4263# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004264 t_bindir="${bindir}"
4265 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4266 t_bindir=`eval echo ${t_bindir}`
4267 case $t_bindir in
4268 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4269 esac
4270 case $t_bindir in
4271 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4272 esac
4273 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004274 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4275 if test $? -ne 0 ; then
4276 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4277 if test $? -ne 0 ; then
4278 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004279 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004280 fi
4281 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004282 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004283)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004284if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004285 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4286 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004287fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004288
Damien Millera18bbd32002-05-13 10:48:57 +10004289# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004290AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004291 [ --with-superuser-path= Specify different path for super-user],
4292 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004293 if test -n "$withval" && test "x$withval" != "xno" && \
4294 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004295 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004296 [Define if you want a different $PATH
4297 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004298 superuser_path=$withval
4299 fi
4300 ]
4301)
4302
4303
Damien Miller61e50f12000-05-08 20:49:37 +10004304AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004305IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004306AC_ARG_WITH(4in6,
4307 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4308 [
4309 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004310 AC_MSG_RESULT([yes])
4311 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004312 [Detect IPv4 in IPv6 mapped addresses
4313 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004314 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004315 else
Tim Rice648f8762011-01-26 12:38:57 -08004316 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004317 fi
Tim Rice648f8762011-01-26 12:38:57 -08004318 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004319 if test "x$inet6_default_4in6" = "xyes"; then
4320 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004321 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004322 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004323 else
4324 AC_MSG_RESULT([no (default)])
4325 fi
4326 ]
4327)
4328
Damien Miller60396b02001-02-18 17:01:00 +11004329# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004330BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004331AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004332 [ --with-bsd-auth Enable BSD auth support],
4333 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004334 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004335 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004336 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004337 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004338 fi
4339 ]
4340)
4341
Damien Millera22ba012000-03-02 23:09:20 +11004342# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004343piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004344# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004345if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004346 piddir=`eval echo ${sysconfdir}`
4347 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004348 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004349 esac
4350fi
4351
Tim Rice648f8762011-01-26 12:38:57 -08004352AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004353 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4354 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004355 if test -n "$withval" && test "x$withval" != "xno" && \
4356 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004357 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004358 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004359 AC_MSG_WARN([** no $piddir directory on this system **])
4360 fi
4361 fi
4362 ]
4363)
4364
Tim Rice648f8762011-01-26 12:38:57 -08004365AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4366 [Specify location of ssh.pid])
4367AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004368
andre2ff7b5d2000-06-03 14:57:40 +00004369dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004370AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004371 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004372 [
4373 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004374 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004375 fi
4376 ]
andre2ff7b5d2000-06-03 14:57:40 +00004377)
Tim Rice648f8762011-01-26 12:38:57 -08004378AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004379 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004380 [
4381 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004382 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004383 fi
4384 ]
andre2ff7b5d2000-06-03 14:57:40 +00004385)
Tim Rice648f8762011-01-26 12:38:57 -08004386AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004387 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004388 [
4389 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004390 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004391 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004392 fi
4393 ]
andre2ff7b5d2000-06-03 14:57:40 +00004394)
Tim Rice648f8762011-01-26 12:38:57 -08004395AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004396 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004397 [
4398 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004399 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004400 fi
4401 ]
andre2ff7b5d2000-06-03 14:57:40 +00004402)
Tim Rice648f8762011-01-26 12:38:57 -08004403AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004404 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004405 [
4406 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004407 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004408 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004409 fi
4410 ]
andre2ff7b5d2000-06-03 14:57:40 +00004411)
Tim Rice648f8762011-01-26 12:38:57 -08004412AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004413 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004414 [
4415 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004416 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004417 fi
4418 ]
andre2ff7b5d2000-06-03 14:57:40 +00004419)
Tim Rice648f8762011-01-26 12:38:57 -08004420AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004421 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004422 [
4423 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004424 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004425 [Define if you don't want to use pututline()
4426 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004427 fi
4428 ]
andre2ff7b5d2000-06-03 14:57:40 +00004429)
Tim Rice648f8762011-01-26 12:38:57 -08004430AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004431 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004432 [
4433 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004434 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004435 [Define if you don't want to use pututxline()
4436 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004437 fi
4438 ]
andre2ff7b5d2000-06-03 14:57:40 +00004439)
Tim Rice648f8762011-01-26 12:38:57 -08004440AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004441 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004442 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004443 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004444 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004445 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004446 conf_lastlog_location=$withval
4447 fi
4448 ]
4449)
andre2ff7b5d2000-06-03 14:57:40 +00004450
4451dnl lastlog, [uw]tmpx? detection
4452dnl NOTE: set the paths in the platform section to avoid the
4453dnl need for command-line parameters
4454dnl lastlog and [uw]tmp are subject to a file search if all else fails
4455
4456dnl lastlog detection
4457dnl NOTE: the code itself will detect if lastlog is a directory
4458AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004459AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004460#include <sys/types.h>
4461#include <utmp.h>
4462#ifdef HAVE_LASTLOG_H
4463# include <lastlog.h>
4464#endif
Damien Miller2994e082000-06-04 15:51:47 +10004465#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004466# include <paths.h>
4467#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004468#ifdef HAVE_LOGIN_H
4469# include <login.h>
4470#endif
Tim Rice648f8762011-01-26 12:38:57 -08004471 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4472 [ AC_MSG_RESULT([yes]) ],
4473 [
4474 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004475 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004476 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004477#include <sys/types.h>
4478#include <utmp.h>
4479#ifdef HAVE_LASTLOG_H
4480# include <lastlog.h>
4481#endif
4482#ifdef HAVE_PATHS_H
4483# include <paths.h>
4484#endif
Tim Rice648f8762011-01-26 12:38:57 -08004485 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4486 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004487 [
Tim Rice648f8762011-01-26 12:38:57 -08004488 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004489 system_lastlog_path=no
4490 ])
Tim Rice648f8762011-01-26 12:38:57 -08004491])
Damien Miller2994e082000-06-04 15:51:47 +10004492
andre2ff7b5d2000-06-03 14:57:40 +00004493if test -z "$conf_lastlog_location"; then
4494 if test x"$system_lastlog_path" = x"no" ; then
4495 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004496 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004497 conf_lastlog_location=$f
4498 fi
4499 done
4500 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004501 AC_MSG_WARN([** Cannot find lastlog **])
4502 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004503 fi
4504 fi
4505fi
4506
4507if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004508 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004509 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004510fi
andre2ff7b5d2000-06-03 14:57:40 +00004511
4512dnl utmp detection
4513AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004514AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004515#include <sys/types.h>
4516#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004517#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004518# include <paths.h>
4519#endif
Tim Rice648f8762011-01-26 12:38:57 -08004520 ]], [[ char *utmp = UTMP_FILE; ]])],
4521 [ AC_MSG_RESULT([yes]) ],
4522 [ AC_MSG_RESULT([no])
4523 system_utmp_path=no
4524])
andre2ff7b5d2000-06-03 14:57:40 +00004525if test -z "$conf_utmp_location"; then
4526 if test x"$system_utmp_path" = x"no" ; then
4527 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4528 if test -f $f ; then
4529 conf_utmp_location=$f
4530 fi
4531 done
4532 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004533 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004534 fi
4535 fi
4536fi
4537if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004538 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004539 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004540fi
andre2ff7b5d2000-06-03 14:57:40 +00004541
4542dnl wtmp detection
4543AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004544AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004545#include <sys/types.h>
4546#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004547#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004548# include <paths.h>
4549#endif
Tim Rice648f8762011-01-26 12:38:57 -08004550 ]], [[ char *wtmp = WTMP_FILE; ]])],
4551 [ AC_MSG_RESULT([yes]) ],
4552 [ AC_MSG_RESULT([no])
4553 system_wtmp_path=no
4554])
andre2ff7b5d2000-06-03 14:57:40 +00004555if test -z "$conf_wtmp_location"; then
4556 if test x"$system_wtmp_path" = x"no" ; then
4557 for f in /usr/adm/wtmp /var/log/wtmp; do
4558 if test -f $f ; then
4559 conf_wtmp_location=$f
4560 fi
4561 done
4562 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004563 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004564 fi
4565 fi
4566fi
4567if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004568 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004569 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004570fi
andre2ff7b5d2000-06-03 14:57:40 +00004571
andre2ff7b5d2000-06-03 14:57:40 +00004572dnl wtmpx detection
4573AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004574AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004575#include <sys/types.h>
4576#include <utmp.h>
4577#ifdef HAVE_UTMPX_H
4578#include <utmpx.h>
4579#endif
Damien Miller2994e082000-06-04 15:51:47 +10004580#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004581# include <paths.h>
4582#endif
Tim Rice648f8762011-01-26 12:38:57 -08004583 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4584 [ AC_MSG_RESULT([yes]) ],
4585 [ AC_MSG_RESULT([no])
4586 system_wtmpx_path=no
4587])
andre2ff7b5d2000-06-03 14:57:40 +00004588if test -z "$conf_wtmpx_location"; then
4589 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004590 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004591 fi
4592else
Tim Rice648f8762011-01-26 12:38:57 -08004593 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004594 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004595fi
andre2ff7b5d2000-06-03 14:57:40 +00004596
Damien Miller4018c192000-04-30 09:30:44 +10004597
Damien Miller29ea30d2000-03-17 10:54:15 +11004598if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004599 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4600 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004601fi
4602
Damien Millera2438bb2013-03-15 10:23:07 +11004603AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004604 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004605 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004606 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004607 ], [
4608#ifdef HAVE_SYS_TYPES_H
4609#include <sys/types.h>
4610#endif
4611#ifdef HAVE_UTMP_H
4612#include <utmp.h>
4613#endif
4614#ifdef HAVE_UTMPX_H
4615#include <utmpx.h>
4616#endif
4617#ifdef HAVE_LASTLOG_H
4618#include <lastlog.h>
4619#endif
4620 ])
4621
4622AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4623 AC_DEFINE([DISABLE_UTMP])
4624 AC_DEFINE([DISABLE_WTMP])
4625 ], [
4626#ifdef HAVE_SYS_TYPES_H
4627#include <sys/types.h>
4628#endif
4629#ifdef HAVE_UTMP_H
4630#include <utmp.h>
4631#endif
4632#ifdef HAVE_UTMPX_H
4633#include <utmpx.h>
4634#endif
4635#ifdef HAVE_LASTLOG_H
4636#include <lastlog.h>
4637#endif
4638 ])
4639
Darren Tucker7da23cb2005-08-03 00:20:15 +10004640dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4641dnl Add now.
4642CFLAGS="$CFLAGS $werror_flags"
4643
Darren Tucker627337d2010-04-10 22:58:01 +10004644if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4645 TEST_SSH_IPV6=no
4646else
4647 TEST_SSH_IPV6=yes
4648fi
Tim Rice648f8762011-01-26 12:38:57 -08004649AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4650AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker882abfd2013-11-09 00:17:41 +11004651AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10004652AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker5d376902008-06-11 04:15:05 +10004653
Damien Millerbac2d8a2000-09-05 16:13:06 +11004654AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004655AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4656 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004657 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004658AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004659
Damien Miller7b22d652000-06-18 14:07:04 +10004660# Print summary of options
4661
Damien Miller7b22d652000-06-18 14:07:04 +10004662# Someone please show me a better way :)
4663A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4664B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4665C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4666D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004667E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004668F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004669G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004670H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4671I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4672J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004673
4674echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004675echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004676echo " User binaries: $B"
4677echo " System binaries: $C"
4678echo " Configuration files: $D"
4679echo " Askpass program: $E"
4680echo " Manual pages: $F"
4681echo " PID file: $G"
4682echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004683if test "x$external_path_file" = "x/etc/login.conf" ; then
4684echo " At runtime, sshd will use the path defined in $external_path_file"
4685echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004686else
Damien Millerf58c6722002-05-13 13:15:42 +10004687echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004688 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004689echo " (If PATH is set in $external_path_file it will be used instead. If"
4690echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4691 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004692fi
Damien Millera18bbd32002-05-13 10:48:57 +10004693if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004694echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004695fi
Damien Millerf58c6722002-05-13 13:15:42 +10004696echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004697echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004698echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004699echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004700echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004701echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004702echo " S/KEY support: $SKEY_MSG"
4703echo " TCP Wrappers support: $TCPW_MSG"
4704echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004705echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004706echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004707echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004708echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004709echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4710echo " BSD Auth support: $BSD_AUTH_MSG"
4711echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004712echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004713
Damien Miller7b22d652000-06-18 14:07:04 +10004714echo ""
4715
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004716echo " Host: ${host}"
4717echo " Compiler: ${CC}"
4718echo " Compiler flags: ${CFLAGS}"
4719echo "Preprocessor flags: ${CPPFLAGS}"
4720echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004721echo " Libraries: ${LIBS}"
4722if test ! -z "${SSHDLIBS}"; then
4723echo " +for sshd: ${SSHDLIBS}"
4724fi
Damien Miller71adf122011-01-25 12:16:15 +11004725if test ! -z "${SSHLIBS}"; then
4726echo " +for ssh: ${SSHLIBS}"
4727fi
Damien Miller7b22d652000-06-18 14:07:04 +10004728
4729echo ""
4730
Tim Rice6f1f7582004-05-30 21:38:51 -07004731if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004732 echo "SVR4 style packages are supported with \"make package\""
4733 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004734fi
4735
Damien Miller82cf0ce2000-12-20 13:34:48 +11004736if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004737 echo "PAM is enabled. You may need to install a PAM control file "
4738 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004739 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004740 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004741 echo ""
4742fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004743
Damien Millerb4097182004-05-23 14:09:40 +10004744if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004745 echo "WARNING: the operating system that you are using does not"
4746 echo "appear to support getpeereid(), getpeerucred() or the"
4747 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4748 echo "enforce security checks to prevent unauthorised connections to"
4749 echo "ssh-agent. Their absence increases the risk that a malicious"
4750 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004751 echo ""
4752fi
4753
Darren Tuckerd9f88912005-02-20 21:01:48 +11004754if test "$AUDIT_MODULE" = "bsm" ; then
4755 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4756 echo "See the Solaris section in README.platform for details."
4757fi