blob: e31147c2477005df7862207e3b06fac9fb30a349 [file] [log] [blame]
Darren Tucker882abfd2013-11-09 00:17:41 +11001# $Id: configure.ac,v 1.540 2013/11/08 13:17:41 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 Tucker882abfd2013-11-09 00:17:41 +110018AC_REVISION($Revision: 1.540 $)
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
2453AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2454AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002455 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002456#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002457#include <openssl/ecdh.h>
2458#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002459#include <openssl/evp.h>
2460#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002461#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
Tim Rice648f8762011-01-26 12:38:57 -08002465 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002466 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2467 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002468 ]])],
2469 [
Tim Rice648f8762011-01-26 12:38:57 -08002470 AC_MSG_RESULT([yes])
2471 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002472 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002473 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002474 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002475 ],
2476 [
Tim Rice648f8762011-01-26 12:38:57 -08002477 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002478 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002479 COMMENT_OUT_ECC="#no ecc#"
Darren Tucker6d8bd572013-06-11 11:26:10 +10002480 unsupported_algorithms="$unsupported_algorithms \
2481 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 \
2482 ecdsa-sha2-nistp256-cert-v01@openssh.com \
2483 ecdsa-sha2-nistp384-cert-v01@openssh.com \
2484 ecdsa-sha2-nistp521-cert-v01@openssh.com \
2485 ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521"
Damien Miller6af914a2010-09-10 11:39:26 +10002486 ]
2487)
Tim Rice648f8762011-01-26 12:38:57 -08002488AC_SUBST([TEST_SSH_ECC])
2489AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002490
Tim Rice99203ec2007-03-26 09:35:28 -07002491saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002492AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002493 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002494 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2495 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002496 [Define if system has libiaf that supports set_id])
2497 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002498])
2499LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002500
2501### Configure cryptographic random number support
2502
2503# Check wheter OpenSSL seeds itself
2504AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002505AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002506 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002507#include <string.h>
2508#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002509 ]], [[
2510 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002511 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002512 [
2513 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002514 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002515 ],
2516 [
Tim Rice648f8762011-01-26 12:38:57 -08002517 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002518 ],
2519 [
2520 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002521 # This is safe, since we will fatal() at runtime if
2522 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002523 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002524 ]
2525)
2526
Damien Millerf22019b2011-05-05 13:48:37 +10002527# PRNGD TCP socket
2528AC_ARG_WITH([prngd-port],
2529 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2530 [
2531 case "$withval" in
2532 no)
2533 withval=""
2534 ;;
2535 [[0-9]]*)
2536 ;;
2537 *)
2538 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2539 ;;
2540 esac
2541 if test ! -z "$withval" ; then
2542 PRNGD_PORT="$withval"
2543 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2544 [Port number of PRNGD/EGD random number socket])
2545 fi
2546 ]
2547)
2548
2549# PRNGD Unix domain socket
2550AC_ARG_WITH([prngd-socket],
2551 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2552 [
2553 case "$withval" in
2554 yes)
2555 withval="/var/run/egd-pool"
2556 ;;
2557 no)
2558 withval=""
2559 ;;
2560 /*)
2561 ;;
2562 *)
2563 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2564 ;;
2565 esac
2566
2567 if test ! -z "$withval" ; then
2568 if test ! -z "$PRNGD_PORT" ; then
2569 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2570 fi
2571 if test ! -r "$withval" ; then
2572 AC_MSG_WARN([Entropy socket is not readable])
2573 fi
2574 PRNGD_SOCKET="$withval"
2575 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2576 [Location of PRNGD/EGD random number socket])
2577 fi
2578 ],
2579 [
2580 # Check for existing socket only if we don't have a random device already
2581 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2582 AC_MSG_CHECKING([for PRNGD/EGD socket])
2583 # Insert other locations here
2584 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2585 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2586 PRNGD_SOCKET="$sock"
2587 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2588 break;
2589 fi
2590 done
2591 if test ! -z "$PRNGD_SOCKET" ; then
2592 AC_MSG_RESULT([$PRNGD_SOCKET])
2593 else
2594 AC_MSG_RESULT([not found])
2595 fi
2596 fi
2597 ]
2598)
2599
2600# Which randomness source do we use?
2601if test ! -z "$PRNGD_PORT" ; then
2602 RAND_MSG="PRNGd port $PRNGD_PORT"
2603elif test ! -z "$PRNGD_SOCKET" ; then
2604 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2605elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2606 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2607 [Define if you want OpenSSL's internally seeded PRNG only])
2608 RAND_MSG="OpenSSL internal ONLY"
2609else
2610 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])
2611fi
2612
Darren Tucker3e6bde42006-08-20 20:03:50 +10002613# Check for PAM libs
2614PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002615AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002616 [ --with-pam Enable PAM support ],
2617 [
2618 if test "x$withval" != "xno" ; then
2619 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2620 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2621 AC_MSG_ERROR([PAM headers not found])
2622 fi
2623
2624 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002625 AC_CHECK_LIB([dl], [dlopen], , )
2626 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2627 AC_CHECK_FUNCS([pam_getenvlist])
2628 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002629 LIBS="$saved_LIBS"
2630
2631 PAM_MSG="yes"
2632
Darren Tucker20e9f972007-03-25 18:26:01 +10002633 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002634 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002635 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002636
Darren Tucker3e6bde42006-08-20 20:03:50 +10002637 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002638 case "$LIBS" in
2639 *-ldl*)
2640 # libdl already in LIBS
2641 ;;
2642 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002643 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002644 ;;
2645 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002646 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002647 fi
2648 ]
2649)
2650
2651# Check for older PAM
2652if test "x$PAM_MSG" = "xyes" ; then
2653 # Check PAM strerror arguments (old PAM)
2654 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002655 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002656#include <stdlib.h>
2657#if defined(HAVE_SECURITY_PAM_APPL_H)
2658#include <security/pam_appl.h>
2659#elif defined (HAVE_PAM_PAM_APPL_H)
2660#include <pam/pam_appl.h>
2661#endif
Tim Rice648f8762011-01-26 12:38:57 -08002662 ]], [[
2663(void)pam_strerror((pam_handle_t *)NULL, -1);
2664 ]])], [AC_MSG_RESULT([no])], [
2665 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002666 [Define if you have an old version of PAM
2667 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002668 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002669 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002670
2671 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002672fi
Damien Miller6c21c512002-01-22 21:57:53 +11002673
Damien Millerd3f6ad22002-06-25 10:24:47 +10002674SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002675AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002676 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002677 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002678 if test -n "$withval" && test "x$withval" != "xno" && \
2679 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002680 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002681 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002682 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002683)
Tim Rice648f8762011-01-26 12:38:57 -08002684AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002685 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002686AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002687
Damien Miller91f40d82013-02-22 11:37:00 +11002688if test "x$have_linux_no_new_privs" = "x1" ; then
2689AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2690 #include <sys/types.h>
2691 #include <linux/seccomp.h>
2692])
2693fi
2694if test "x$have_seccomp_filter" = "x1" ; then
2695AC_MSG_CHECKING([kernel for seccomp_filter support])
2696AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2697 #include <errno.h>
2698 #include <elf.h>
2699 #include <linux/audit.h>
2700 #include <linux/seccomp.h>
2701 #include <stdlib.h>
2702 #include <sys/prctl.h>
2703 ]],
2704 [[ int i = $seccomp_audit_arch;
2705 errno = 0;
2706 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2707 exit(errno == EFAULT ? 0 : 1); ]])],
2708 [ AC_MSG_RESULT([yes]) ], [
2709 AC_MSG_RESULT([no])
2710 # Disable seccomp filter as a target
2711 have_seccomp_filter=0
2712 ]
2713)
2714fi
2715
Damien Miller69ff1df2011-06-23 08:30:03 +10002716# Decide which sandbox style to use
2717sandbox_arg=""
2718AC_ARG_WITH([sandbox],
Damien Millere0956e32012-04-04 11:27:54 +10002719 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002720 [
2721 if test "x$withval" = "xyes" ; then
2722 sandbox_arg=""
2723 else
2724 sandbox_arg="$withval"
2725 fi
2726 ]
2727)
Darren Tucker60395f92012-07-03 14:31:18 +10002728
2729# Some platforms (seems to be the ones that have a kernel poll(2)-type
2730# function with which they implement select(2)) use an extra file descriptor
2731# when calling select(2), which means we can't use the rlimit sandbox.
2732AC_MSG_CHECKING([if select works with descriptor rlimit])
2733AC_RUN_IFELSE(
2734 [AC_LANG_PROGRAM([[
2735#include <sys/types.h>
2736#ifdef HAVE_SYS_TIME_H
2737# include <sys/time.h>
2738#endif
2739#include <sys/resource.h>
2740#ifdef HAVE_SYS_SELECT_H
2741# include <sys/select.h>
2742#endif
2743#include <errno.h>
2744#include <fcntl.h>
2745#include <stdlib.h>
2746 ]],[[
2747 struct rlimit rl_zero;
2748 int fd, r;
2749 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002750 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002751
2752 fd = open("/dev/null", O_RDONLY);
2753 FD_ZERO(&fds);
2754 FD_SET(fd, &fds);
2755 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2756 setrlimit(RLIMIT_FSIZE, &rl_zero);
2757 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002758 tv.tv_sec = 1;
2759 tv.tv_usec = 0;
2760 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002761 exit (r == -1 ? 1 : 0);
2762 ]])],
2763 [AC_MSG_RESULT([yes])
2764 select_works_with_rlimit=yes],
2765 [AC_MSG_RESULT([no])
2766 select_works_with_rlimit=no],
2767 [AC_MSG_WARN([cross compiling: assuming yes])]
2768)
2769
Darren Tuckerff008de2013-03-06 17:48:48 +11002770AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2771AC_RUN_IFELSE(
2772 [AC_LANG_PROGRAM([[
2773#include <sys/types.h>
2774#ifdef HAVE_SYS_TIME_H
2775# include <sys/time.h>
2776#endif
2777#include <sys/resource.h>
2778#include <errno.h>
2779#include <stdlib.h>
2780 ]],[[
2781 struct rlimit rl_zero;
2782 int fd, r;
2783 fd_set fds;
2784
2785 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2786 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2787 exit (r == -1 ? 1 : 0);
2788 ]])],
2789 [AC_MSG_RESULT([yes])
2790 rlimit_nofile_zero_works=yes],
2791 [AC_MSG_RESULT([no])
2792 rlimit_nofile_zero_works=no],
2793 [AC_MSG_WARN([cross compiling: assuming yes])]
2794)
2795
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002796AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2797AC_RUN_IFELSE(
2798 [AC_LANG_PROGRAM([[
2799#include <sys/types.h>
2800#include <sys/resource.h>
2801#include <stdlib.h>
2802 ]],[[
2803 struct rlimit rl_zero;
2804
2805 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2806 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2807 ]])],
2808 [AC_MSG_RESULT([yes])],
2809 [AC_MSG_RESULT([no])
2810 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
2811 [setrlimit RLIMIT_FSIZE works])],
2812 [AC_MSG_WARN([cross compiling: assuming yes])]
2813)
2814
Damien Miller69ff1df2011-06-23 08:30:03 +10002815if test "x$sandbox_arg" = "xsystrace" || \
2816 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002817 test "x$have_systr_policy_kill" != "x1" && \
2818 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002819 SANDBOX_STYLE="systrace"
2820 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002821elif test "x$sandbox_arg" = "xdarwin" || \
2822 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2823 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002824 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2825 "x$ac_cv_header_sandbox_h" != "xyes" && \
2826 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002827 SANDBOX_STYLE="darwin"
2828 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10002829elif test "x$sandbox_arg" = "xseccomp_filter" || \
2830 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10002831 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002832 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10002833 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002834 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
2835 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002836 test "x$have_linux_no_new_privs" = "x1" && \
2837 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11002838 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002839 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
2840 test "x$have_linux_no_new_privs" != "x1" && \
2841 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
2842 test "x$have_seccomp_filter" != "x1" && \
2843 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
2844 test "x$ac_cv_func_prctl" != "xyes" && \
2845 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
2846 SANDBOX_STYLE="seccomp_filter"
2847 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Miller69ff1df2011-06-23 08:30:03 +10002848elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10002849 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11002850 test "x$select_works_with_rlimit" = "xyes" && \
2851 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002852 test "x$ac_cv_func_setrlimit" != "xyes" && \
2853 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10002854 test "x$select_works_with_rlimit" != "xyes" && \
2855 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10002856 SANDBOX_STYLE="rlimit"
2857 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
2858elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2859 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2860 SANDBOX_STYLE="none"
2861 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2862else
Tim Ricea6e60612011-08-17 21:48:22 -07002863 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10002864fi
2865
Ben Lindstromb5628642000-10-18 00:02:25 +00002866# Cheap hack to ensure NEWS-OS libraries are arranged right.
2867if test ! -z "$SONY" ; then
2868 LIBS="$LIBS -liberty";
2869fi
2870
Damien Miller57f39152005-11-24 19:58:19 +11002871# Check for long long datatypes
2872AC_CHECK_TYPES([long long, unsigned long long, long double])
2873
2874# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002875AC_CHECK_SIZEOF([short int], [2])
2876AC_CHECK_SIZEOF([int], [4])
2877AC_CHECK_SIZEOF([long int], [4])
2878AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002879
Damien Millerfa2bb692002-04-23 23:22:25 +10002880# Sanity check long long for some platforms (AIX)
2881if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2882 ac_cv_sizeof_long_long_int=0
2883fi
2884
Darren Tucker537f1ed2005-10-25 18:38:33 +10002885# compute LLONG_MIN and LLONG_MAX if we don't know them.
2886if test -z "$have_llong_max"; then
2887 AC_MSG_CHECKING([for max value of long long])
2888 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002889 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002890#include <stdio.h>
2891/* Why is this so damn hard? */
2892#ifdef __GNUC__
2893# undef __GNUC__
2894#endif
2895#define __USE_ISOC99
2896#include <limits.h>
2897#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002898#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2899
2900/*
2901 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2902 * we do this the hard way.
2903 */
2904static int
2905fprint_ll(FILE *f, long long n)
2906{
2907 unsigned int i;
2908 int l[sizeof(long long) * 8];
2909
2910 if (n < 0)
2911 if (fprintf(f, "-") < 0)
2912 return -1;
2913 for (i = 0; n != 0; i++) {
2914 l[i] = my_abs(n % 10);
2915 n /= 10;
2916 }
2917 do {
2918 if (fprintf(f, "%d", l[--i]) < 0)
2919 return -1;
2920 } while (i != 0);
2921 if (fprintf(f, " ") < 0)
2922 return -1;
2923 return 0;
2924}
Tim Rice648f8762011-01-26 12:38:57 -08002925 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002926 FILE *f;
2927 long long i, llmin, llmax = 0;
2928
2929 if((f = fopen(DATA,"w")) == NULL)
2930 exit(1);
2931
2932#if defined(LLONG_MIN) && defined(LLONG_MAX)
2933 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2934 llmin = LLONG_MIN;
2935 llmax = LLONG_MAX;
2936#else
2937 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2938 /* This will work on one's complement and two's complement */
2939 for (i = 1; i > llmax; i <<= 1, i++)
2940 llmax = i;
2941 llmin = llmax + 1LL; /* wrap */
2942#endif
2943
2944 /* Sanity check */
2945 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002946 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2947 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002948 fprintf(f, "unknown unknown\n");
2949 exit(2);
2950 }
2951
Darren Tuckerd1450db2006-03-13 19:06:51 +11002952 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002953 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002954 if (fprint_ll(f, llmax) < 0)
2955 exit(4);
2956 if (fclose(f) < 0)
2957 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002958 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002959 ]])],
2960 [
2961 llong_min=`$AWK '{print $1}' conftest.llminmax`
2962 llong_max=`$AWK '{print $2}' conftest.llminmax`
2963
Tim Rice648f8762011-01-26 12:38:57 -08002964 AC_MSG_RESULT([$llong_max])
2965 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002966 [max value of long long calculated by configure])
2967 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002968 AC_MSG_RESULT([$llong_min])
2969 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002970 [min value of long long calculated by configure])
2971 ],
2972 [
Tim Rice648f8762011-01-26 12:38:57 -08002973 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002974 ],
2975 [
2976 AC_MSG_WARN([cross compiling: not checking])
2977 ]
2978 )
2979fi
2980
2981
Damien Millera22ba012000-03-02 23:09:20 +11002982# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002983AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2985 [[ u_int a; a = 1;]])],
2986 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2987 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002988])
2989if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002990 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002991 have_u_int=1
2992fi
2993
Damien Miller61e50f12000-05-08 20:49:37 +10002994AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2996 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2997 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2998 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002999])
3000if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003001 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003002 have_intxx_t=1
3003fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003004
3005if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003006 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003007then
3008 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003009 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3010 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003011 [
Tim Rice648f8762011-01-26 12:38:57 -08003012 AC_DEFINE([HAVE_INTXX_T])
3013 AC_MSG_RESULT([yes])
3014 ], [ AC_MSG_RESULT([no])
3015 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003016fi
3017
Damien Miller578783e2000-09-23 14:12:24 +11003018AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003019 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07003020#include <sys/types.h>
3021#ifdef HAVE_STDINT_H
3022# include <stdint.h>
3023#endif
3024#include <sys/socket.h>
3025#ifdef HAVE_SYS_BITYPES_H
3026# include <sys/bitypes.h>
3027#endif
Tim Rice648f8762011-01-26 12:38:57 -08003028 ]], [[
3029int64_t a; a = 1;
3030 ]])],
3031 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
3032 ])
Damien Miller578783e2000-09-23 14:12:24 +11003033])
3034if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003035 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08003036fi
3037
Damien Miller61e50f12000-05-08 20:49:37 +10003038AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003039 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3040 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
3041 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
3042 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003043])
3044if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003045 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003046 have_u_intxx_t=1
3047fi
Damien Millerc6398ef1999-11-20 12:18:40 +11003048
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003049if test -z "$have_u_intxx_t" ; then
3050 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08003051 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
3052 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003053 [
Tim Rice648f8762011-01-26 12:38:57 -08003054 AC_DEFINE([HAVE_U_INTXX_T])
3055 AC_MSG_RESULT([yes])
3056 ], [ AC_MSG_RESULT([no])
3057 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003058fi
3059
Damien Miller578783e2000-09-23 14:12:24 +11003060AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003061 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3062 [[ u_int64_t a; a = 1;]])],
3063 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
3064 ])
Damien Miller578783e2000-09-23 14:12:24 +11003065])
3066if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003067 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003068 have_u_int64_t=1
3069fi
3070
Tim Rice4cec93f2002-02-26 08:40:48 -08003071if test -z "$have_u_int64_t" ; then
3072 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003073 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3074 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003075 [
Tim Rice648f8762011-01-26 12:38:57 -08003076 AC_DEFINE([HAVE_U_INT64_T])
3077 AC_MSG_RESULT([yes])
3078 ], [ AC_MSG_RESULT([no])
3079 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003080fi
3081
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003082if test -z "$have_u_intxx_t" ; then
3083 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003084 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003085#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003086 ]], [[
3087 uint8_t a;
3088 uint16_t b;
3089 uint32_t c;
3090 a = b = c = 1;
3091 ]])],
3092 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3093 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003094 ])
3095 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003096 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003097 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003098 fi
3099fi
3100
3101if test -z "$have_uintxx_t" ; then
3102 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003103 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3104 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003105 [
Tim Rice648f8762011-01-26 12:38:57 -08003106 AC_DEFINE([HAVE_UINTXX_T])
3107 AC_MSG_RESULT([yes])
3108 ], [ AC_MSG_RESULT([no])
3109 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003110fi
3111
Damien Milleredb82922000-06-20 13:25:52 +10003112if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003113 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003114then
3115 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003117#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003118 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003119 int8_t a; int16_t b; int32_t c;
3120 u_int8_t e; u_int16_t f; u_int32_t g;
3121 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003122 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003123 [
Tim Rice648f8762011-01-26 12:38:57 -08003124 AC_DEFINE([HAVE_U_INTXX_T])
3125 AC_DEFINE([HAVE_INTXX_T])
3126 AC_MSG_RESULT([yes])
3127 ], [AC_MSG_RESULT([no])
3128 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003129fi
3130
Damien Miller58be7382001-09-15 21:31:54 +10003131
3132AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003133 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3134 [[ u_char foo; foo = 125; ]])],
3135 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3136 ])
Damien Miller58be7382001-09-15 21:31:54 +10003137])
3138if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003139 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003140fi
3141
Darren Tucker007e3b32013-11-03 18:43:55 +11003142AC_CHECK_TYPES([intmax_t, uintmax_t], , , [
3143#include <sys/types.h>
3144#include <stdint.h>
3145])
3146
Tim Rice13aae5e2001-10-21 17:53:58 -07003147TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003148
Tim Rice648f8762011-01-26 12:38:57 -08003149AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3150AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003151#include <sys/types.h>
3152#ifdef HAVE_SYS_BITYPES_H
3153#include <sys/bitypes.h>
3154#endif
3155#ifdef HAVE_SYS_STATFS_H
3156#include <sys/statfs.h>
3157#endif
3158#ifdef HAVE_SYS_STATVFS_H
3159#include <sys/statvfs.h>
3160#endif
3161])
Tim Rice4cec93f2002-02-26 08:40:48 -08003162
Tim Rice648f8762011-01-26 12:38:57 -08003163AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003164[#include <sys/types.h>
3165#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003166
Damien Miller61e50f12000-05-08 20:49:37 +10003167AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003168 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3169 [[ size_t foo; foo = 1235; ]])],
3170 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3171 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003172])
3173if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003174 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003175fi
Damien Miller95058511999-12-29 10:36:45 +11003176
Damien Miller615f9392000-05-17 22:53:33 +10003177AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003178 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3179 [[ ssize_t foo; foo = 1235; ]])],
3180 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3181 ])
Damien Miller615f9392000-05-17 22:53:33 +10003182])
3183if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003184 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003185fi
3186
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003187AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3189 [[ clock_t foo; foo = 1235; ]])],
3190 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3191 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003192])
3193if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003194 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003195fi
3196
Damien Millerb54b40e2000-06-23 08:23:34 +10003197AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003198 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003199#include <sys/types.h>
3200#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003201 ]], [[ sa_family_t foo; foo = 1235; ]])],
3202 [ ac_cv_have_sa_family_t="yes" ],
3203 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003204#include <sys/types.h>
3205#include <sys/socket.h>
3206#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003207 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003208 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003209 [ ac_cv_have_sa_family_t="no" ]
3210 )
Tim Rice648f8762011-01-26 12:38:57 -08003211 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003212])
3213if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003214 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003215 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003216fi
3217
Damien Miller0f91b4e2000-06-18 15:43:25 +10003218AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3220 [[ pid_t foo; foo = 1235; ]])],
3221 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3222 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003223])
3224if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003225 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003226fi
3227
3228AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3230 [[ mode_t foo; foo = 1235; ]])],
3231 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3232 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003233])
3234if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003235 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003236fi
3237
Damien Miller61e50f12000-05-08 20:49:37 +10003238
3239AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003240 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003241#include <sys/types.h>
3242#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003243 ]], [[ struct sockaddr_storage s; ]])],
3244 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3245 [ ac_cv_have_struct_sockaddr_storage="no"
3246 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003247])
3248if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003249 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003250 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003251fi
Damien Miller34132e52000-01-14 15:45:46 +11003252
Damien Miller61e50f12000-05-08 20:49:37 +10003253AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003254 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003255#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003256#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003257 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3258 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3259 [ ac_cv_have_struct_sockaddr_in6="no"
3260 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003261])
3262if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003263 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003264 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003265fi
Damien Miller34132e52000-01-14 15:45:46 +11003266
Damien Miller61e50f12000-05-08 20:49:37 +10003267AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003268 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003269#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003270#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003271 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3272 [ ac_cv_have_struct_in6_addr="yes" ],
3273 [ ac_cv_have_struct_in6_addr="no"
3274 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003275])
3276if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003277 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003278 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003279
3280dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003281 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003282 [
3283#ifdef HAVE_SYS_TYPES_H
3284#include <sys/types.h>
3285#endif
3286#include <netinet/in.h>
3287 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003288fi
Damien Miller34132e52000-01-14 15:45:46 +11003289
Damien Miller61e50f12000-05-08 20:49:37 +10003290AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003291 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003292#include <sys/types.h>
3293#include <sys/socket.h>
3294#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003295 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3296 [ ac_cv_have_struct_addrinfo="yes" ],
3297 [ ac_cv_have_struct_addrinfo="no"
3298 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003299])
3300if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003301 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003302 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003303fi
3304
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003305AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003306 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3307 [[ struct timeval tv; tv.tv_sec = 1;]])],
3308 [ ac_cv_have_struct_timeval="yes" ],
3309 [ ac_cv_have_struct_timeval="no"
3310 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003311])
3312if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003313 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003314 have_struct_timeval=1
3315fi
3316
Tim Rice648f8762011-01-26 12:38:57 -08003317AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003318
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003319# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003320if test "x$ac_cv_have_int64_t" = "xno" && \
3321 test "x$ac_cv_sizeof_long_int" != "x8" && \
3322 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003323 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3324 echo "an alternative compiler (I.E., GCC) before continuing."
3325 echo ""
3326 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003327else
3328dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003329 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003330 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003331#include <stdio.h>
3332#include <string.h>
3333#ifdef HAVE_SNPRINTF
3334main()
3335{
3336 char buf[50];
3337 char expected_out[50];
3338 int mazsize = 50 ;
3339#if (SIZEOF_LONG_INT == 8)
3340 long int num = 0x7fffffffffffffff;
3341#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003342 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003343#endif
3344 strcpy(expected_out, "9223372036854775807");
3345 snprintf(buf, mazsize, "%lld", num);
3346 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003347 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003348 exit(0);
3349}
3350#else
3351main() { exit(0); }
3352#endif
Tim Rice648f8762011-01-26 12:38:57 -08003353 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003354 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003355 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003356fi
3357
Damien Miller78315eb2000-09-29 23:01:36 +11003358dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003359OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3360OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3361OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3362OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3363OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3364OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3365OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3366OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3367OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3368OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3369OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3370OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3371OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3372OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3373OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3374OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3375OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003376
3377AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003378AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3379struct passwd.pw_change, struct passwd.pw_expire],
3380[], [], [[
3381#include <sys/types.h>
3382#include <pwd.h>
3383]])
3384
Tim Rice648f8762011-01-26 12:38:57 -08003385AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003386 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003387[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003388#include <stdio.h>
3389#if HAVE_SYS_TYPES_H
3390# include <sys/types.h>
3391#endif
3392#include <netinet/in.h>
3393#include <arpa/nameser.h>
3394#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003395]])
andre2ff7b5d2000-06-03 14:57:40 +00003396
Damien Miller61e50f12000-05-08 20:49:37 +10003397AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3398 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003400#include <sys/types.h>
3401#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003402 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3403 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3404 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003405])
3406if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003407 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003408fi
3409
Damien Miller61e50f12000-05-08 20:49:37 +10003410AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3411 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003412 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003413#include <sys/types.h>
3414#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003415 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3416 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3417 [ ac_cv_have___ss_family_in_struct_ss="no"
3418 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003419])
3420if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003421 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003422 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003423fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003424
Tim Rice28bbb0c2002-05-27 17:37:32 -07003425dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003426AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3427 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003428 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003429#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003430#include <sys/socket.h>
3431#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003432 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003433#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003434#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003435exit(1);
3436#endif
3437struct msghdr m;
3438m.msg_accrights = 0;
3439exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003440 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003441 [ ac_cv_have_accrights_in_msghdr="yes" ],
3442 [ ac_cv_have_accrights_in_msghdr="no" ]
3443 )
3444])
3445if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003446 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003447 [Define if your system uses access rights style
3448 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003449fi
3450
Tim Rice648f8762011-01-26 12:38:57 -08003451AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3452AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003453#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003454#include <sys/stat.h>
3455#ifdef HAVE_SYS_TIME_H
3456# include <sys/time.h>
3457#endif
3458#ifdef HAVE_SYS_MOUNT_H
3459#include <sys/mount.h>
3460#endif
3461#ifdef HAVE_SYS_STATVFS_H
3462#include <sys/statvfs.h>
3463#endif
Tim Rice648f8762011-01-26 12:38:57 -08003464 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3465 [ AC_MSG_RESULT([yes]) ],
3466 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003467
Tim Rice648f8762011-01-26 12:38:57 -08003468 AC_MSG_CHECKING([if fsid_t has member val])
3469 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003470#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003471#include <sys/statvfs.h>
3472 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3473 [ AC_MSG_RESULT([yes])
3474 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3475 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003476
Tim Rice648f8762011-01-26 12:38:57 -08003477 AC_MSG_CHECKING([if f_fsid has member __val])
3478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003479#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003480#include <sys/statvfs.h>
3481 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3482 [ AC_MSG_RESULT([yes])
3483 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3484 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003485])
Darren Tucker77001382008-06-09 06:17:53 +10003486
Kevin Stevesa44e0352002-04-07 16:18:03 +00003487AC_CACHE_CHECK([for msg_control field in struct msghdr],
3488 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003489 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003490#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003491#include <sys/socket.h>
3492#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003493 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003494#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003495#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003496exit(1);
3497#endif
3498struct msghdr m;
3499m.msg_control = 0;
3500exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003501 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003502 [ ac_cv_have_control_in_msghdr="yes" ],
3503 [ ac_cv_have_control_in_msghdr="no" ]
3504 )
3505])
3506if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003507 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003508 [Define if your system uses ancillary data style
3509 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003510fi
3511
Damien Miller61e50f12000-05-08 20:49:37 +10003512AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003513 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3514 [[ extern char *__progname; printf("%s", __progname); ]])],
3515 [ ac_cv_libc_defines___progname="yes" ],
3516 [ ac_cv_libc_defines___progname="no"
3517 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003518])
3519if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003520 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003521fi
3522
Kevin Steves4846f4a2002-03-22 18:19:53 +00003523AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003524 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3525 [[ printf("%s", __FUNCTION__); ]])],
3526 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3527 [ ac_cv_cc_implements___FUNCTION__="no"
3528 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003529])
3530if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003531 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003532 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003533fi
3534
3535AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003536 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3537 [[ printf("%s", __func__); ]])],
3538 [ ac_cv_cc_implements___func__="yes" ],
3539 [ ac_cv_cc_implements___func__="no"
3540 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003541])
3542if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003543 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003544fi
3545
Damien Miller57f39152005-11-24 19:58:19 +11003546AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003547 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3548#include <stdarg.h>
3549va_list x,y;
3550 ]], [[ va_copy(x,y); ]])],
3551 [ ac_cv_have_va_copy="yes" ],
3552 [ ac_cv_have_va_copy="no"
3553 ])
Damien Miller57f39152005-11-24 19:58:19 +11003554])
3555if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003556 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003557fi
3558
3559AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003560 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3561#include <stdarg.h>
3562va_list x,y;
3563 ]], [[ __va_copy(x,y); ]])],
3564 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3565 ])
Damien Miller57f39152005-11-24 19:58:19 +11003566])
3567if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003568 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003569fi
3570
Damien Miller4f8e6692001-07-14 13:22:53 +10003571AC_CACHE_CHECK([whether getopt has optreset support],
3572 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003573 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3574 [[ extern int optreset; optreset = 0; ]])],
3575 [ ac_cv_have_getopt_optreset="yes" ],
3576 [ ac_cv_have_getopt_optreset="no"
3577 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003578])
3579if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003580 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003581 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003582fi
Damien Millera22ba012000-03-02 23:09:20 +11003583
Damien Millerecbb26d2000-07-15 14:59:14 +10003584AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003585 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3586[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3587 [ ac_cv_libc_defines_sys_errlist="yes" ],
3588 [ ac_cv_libc_defines_sys_errlist="no"
3589 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003590])
3591if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003592 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003593 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003594fi
3595
3596
Damien Miller11fa2cc2000-08-16 10:35:58 +10003597AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003598 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3599[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3600 [ ac_cv_libc_defines_sys_nerr="yes" ],
3601 [ ac_cv_libc_defines_sys_nerr="no"
3602 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003603])
3604if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003605 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003606fi
3607
Darren Tucker5f88d342003-10-15 16:57:57 +10003608# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003609AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3610 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003611 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003612 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003613 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003614 AC_SEARCH_LIBS([res_query], [resolv])
3615 AC_SEARCH_LIBS([dn_expand], [resolv])
3616 AC_MSG_CHECKING([if res_query will link])
3617 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003618#include <sys/types.h>
3619#include <netinet/in.h>
3620#include <arpa/nameser.h>
3621#include <netdb.h>
3622#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003623 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003624 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003625 ]])],
3626 AC_MSG_RESULT([yes]),
3627 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003628 saved_LIBS="$LIBS"
3629 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003630 AC_MSG_CHECKING([for res_query in -lresolv])
3631 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003632#include <sys/types.h>
3633#include <netinet/in.h>
3634#include <arpa/nameser.h>
3635#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003636#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003637 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003638 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003639 ]])],
3640 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003641 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003642 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003643 ])
Tim Rice648f8762011-01-26 12:38:57 -08003644 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003645 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003646 [#include <sys/types.h>
3647 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003648 AC_CHECK_MEMBER([HEADER.ad],
3649 [AC_DEFINE([HAVE_HEADER_AD], [1],
3650 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003651 [#include <arpa/nameser.h>])
3652 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003653
Tim Rice648f8762011-01-26 12:38:57 -08003654AC_MSG_CHECKING([if struct __res_state _res is an extern])
3655AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003656#include <stdio.h>
3657#if HAVE_SYS_TYPES_H
3658# include <sys/types.h>
3659#endif
3660#include <netinet/in.h>
3661#include <arpa/nameser.h>
3662#include <resolv.h>
3663extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003664 ]], [[ ]])],
3665 [AC_MSG_RESULT([yes])
3666 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003667 [Define if you have struct __res_state _res as an extern])
3668 ],
Tim Rice648f8762011-01-26 12:38:57 -08003669 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003670)
3671
Damien Miller73b42d22006-04-22 21:26:08 +10003672# Check whether user wants SELinux support
3673SELINUX_MSG="no"
3674LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003675AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003676 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003677 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003678 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003679 AC_DEFINE([WITH_SELINUX], [1],
3680 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003681 SELINUX_MSG="yes"
3682 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003683 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3684 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003685 [ LIBSELINUX="-lselinux"
3686 LIBS="$LIBS -lselinux"
3687 ],
Tim Rice648f8762011-01-26 12:38:57 -08003688 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003689 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003690 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003691 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003692 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003693 fi ]
3694)
Tim Rice648f8762011-01-26 12:38:57 -08003695AC_SUBST([SSHLIBS])
3696AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003697
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003698# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003699KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003700AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003701 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003702 [ if test "x$withval" != "xno" ; then
3703 if test "x$withval" = "xyes" ; then
3704 KRB5ROOT="/usr/local"
3705 else
3706 KRB5ROOT=${withval}
3707 fi
3708
Tim Rice648f8762011-01-26 12:38:57 -08003709 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003710 KRB5_MSG="yes"
3711
Tim Rice648f8762011-01-26 12:38:57 -08003712 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003713 [$KRB5ROOT/bin/krb5-config],
3714 [$KRB5ROOT/bin:$PATH])
3715 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003716 K5CFLAGS="`$KRB5CONF --cflags`"
3717 K5LIBS="`$KRB5CONF --libs`"
3718 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003719
Tim Rice648f8762011-01-26 12:38:57 -08003720 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003721 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003722 AC_MSG_RESULT([yes])
3723 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003724 [Define this if you want GSSAPI
3725 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003726 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3727 GSSLIBS="`$KRB5CONF --libs gssapi`"
3728 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003729 else
Tim Rice648f8762011-01-26 12:38:57 -08003730 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003731 fi
Tim Rice648f8762011-01-26 12:38:57 -08003732 AC_MSG_CHECKING([whether we are using Heimdal])
3733 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3734 ]], [[ char *tmp = heimdal_version; ]])],
3735 [ AC_MSG_RESULT([yes])
3736 AC_DEFINE([HEIMDAL], [1],
3737 [Define this if you are using the Heimdal
3738 version of Kerberos V5]) ],
3739 [AC_MSG_RESULT([no])
3740 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003741 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003742 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003743 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003744 AC_MSG_CHECKING([whether we are using Heimdal])
3745 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3746 ]], [[ char *tmp = heimdal_version; ]])],
3747 [ AC_MSG_RESULT([yes])
3748 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003749 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003750 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003751 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003752 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003753 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003754 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003755 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003756 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003757
3758 ])
3759 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003760
Tim Rice648f8762011-01-26 12:38:57 -08003761 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3762 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003763 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003764 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3765 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003766 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003767 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3768 [ AC_DEFINE([GSSAPI])
3769 GSSLIBS="-lgss" ],
3770 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3771 ])
Darren Tucker964de182013-02-22 10:39:59 +11003772 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003773
Tim Rice648f8762011-01-26 12:38:57 -08003774 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003775 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003776 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003777 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003778 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003779 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003780 ]
3781 )
3782
3783 oldCPP="$CPPFLAGS"
3784 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003785 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003786 [ CPPFLAGS="$oldCPP" ])
3787
Damien Millera8e06ce2003-11-21 23:48:55 +11003788 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003789 if test ! -z "$need_dash_r" ; then
3790 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3791 fi
3792 if test ! -z "$blibpath" ; then
3793 blibpath="$blibpath:${KRB5ROOT}/lib"
3794 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003795
Tim Rice648f8762011-01-26 12:38:57 -08003796 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3797 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3798 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003799
Tim Rice648f8762011-01-26 12:38:57 -08003800 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3801 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11003802
3803 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
3804#ifdef HAVE_GSSAPI_H
3805# include <gssapi.h>
3806#elif defined(HAVE_GSSAPI_GSSAPI_H)
3807# include <gssapi/gssapi.h>
3808#endif
3809
3810#ifdef HAVE_GSSAPI_GENERIC_H
3811# include <gssapi_generic.h>
3812#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
3813# include <gssapi/gssapi_generic.h>
3814#endif
3815 ]])
Darren Tuckerf3ab2c52013-08-04 21:48:41 +10003816 saved_LIBS="$LIBS"
3817 LIBS="$LIBS $K5LIBS"
3818 AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message])
3819 LIBS="$saved_LIBS"
3820
Darren Tucker0d27ed12004-02-24 10:37:33 +11003821 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003822 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003823)
Darren Tucker964de182013-02-22 10:39:59 +11003824AC_SUBST([GSSLIBS])
3825AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10003826
Damien Millera22ba012000-03-02 23:09:20 +11003827# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003828
Damien Millerf58c6722002-05-13 13:15:42 +10003829PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003830AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003831 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003832 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003833 if test -n "$withval" && test "x$withval" != "xno" && \
3834 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003835 PRIVSEP_PATH=$withval
3836 fi
3837 ]
3838)
Tim Rice648f8762011-01-26 12:38:57 -08003839AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003840
Tim Rice648f8762011-01-26 12:38:57 -08003841AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003842 [ --with-xauth=PATH Specify path to xauth program ],
3843 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003844 if test -n "$withval" && test "x$withval" != "xno" && \
3845 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003846 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003847 fi
3848 ],
3849 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003850 TestPath="$PATH"
3851 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3852 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3853 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3854 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003855 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003856 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003857 xauth_path="/usr/openwin/bin/xauth"
3858 fi
3859 ]
3860)
3861
Damien Miller7d901272003-01-13 16:55:22 +11003862STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003863AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003864 [ --disable-strip Disable calling strip(1) on install],
3865 [
3866 if test "x$enableval" = "xno" ; then
3867 STRIP_OPT=
3868 fi
3869 ]
3870)
Tim Rice648f8762011-01-26 12:38:57 -08003871AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003872
Damien Millera19cf472000-11-29 13:28:50 +11003873if test -z "$xauth_path" ; then
3874 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003875 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003876else
Tim Rice648f8762011-01-26 12:38:57 -08003877 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003878 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003879 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003880 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003881fi
Damien Millera22ba012000-03-02 23:09:20 +11003882
Tim Rice90f42b02011-06-02 18:17:49 -07003883dnl # --with-maildir=/path/to/mail gets top priority.
3884dnl # if maildir is set in the platform case statement above we use that.
3885dnl # Otherwise we run a program to get the dir from system headers.
3886dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3887dnl # If we find _PATH_MAILDIR we do nothing because that is what
3888dnl # session.c expects anyway. Otherwise we set to the value found
3889dnl # stripping any trailing slash. If for some strage reason our program
3890dnl # does not find what it needs, we default to /var/spool/mail.
3891# Check for mail directory
3892AC_ARG_WITH([maildir],
3893 [ --with-maildir=/path/to/mail Specify your system mail directory],
3894 [
3895 if test "X$withval" != X && test "x$withval" != xno && \
3896 test "x${withval}" != xyes; then
3897 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3898 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3899 fi
3900 ],[
3901 if test "X$maildir" != "X"; then
3902 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3903 else
3904 AC_MSG_CHECKING([Discovering system mail directory])
3905 AC_RUN_IFELSE(
3906 [AC_LANG_PROGRAM([[
3907#include <stdio.h>
3908#include <string.h>
3909#ifdef HAVE_PATHS_H
3910#include <paths.h>
3911#endif
3912#ifdef HAVE_MAILLOCK_H
3913#include <maillock.h>
3914#endif
3915#define DATA "conftest.maildir"
3916 ]], [[
3917 FILE *fd;
3918 int rc;
3919
3920 fd = fopen(DATA,"w");
3921 if(fd == NULL)
3922 exit(1);
3923
3924#if defined (_PATH_MAILDIR)
3925 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3926 exit(1);
3927#elif defined (MAILDIR)
3928 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3929 exit(1);
3930#elif defined (_PATH_MAIL)
3931 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3932 exit(1);
3933#else
3934 exit (2);
3935#endif
3936
3937 exit(0);
3938 ]])],
3939 [
3940 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3941 maildir=`awk -F: '{print $2}' conftest.maildir \
3942 | sed 's|/$||'`
3943 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3944 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3945 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3946 fi
3947 ],
3948 [
3949 if test "X$ac_status" = "X2";then
3950# our test program didn't find it. Default to /var/spool/mail
3951 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3952 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3953 else
3954 AC_MSG_RESULT([*** not found ***])
3955 fi
3956 ],
3957 [
3958 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3959 ]
3960 )
3961 fi
3962 ]
3963) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003964
Darren Tucker623d92f2004-09-12 22:36:15 +10003965if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003966 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3967 disable_ptmx_check=yes
3968fi
Damien Millera22ba012000-03-02 23:09:20 +11003969if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003970 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003971 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003972 [
Tim Rice648f8762011-01-26 12:38:57 -08003973 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003974 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003975 have_dev_ptmx=1
3976 ]
3977 )
3978 fi
Damien Millera22ba012000-03-02 23:09:20 +11003979fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003980
Darren Tucker623d92f2004-09-12 22:36:15 +10003981if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003982 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003983 [
Tim Rice648f8762011-01-26 12:38:57 -08003984 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003985 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003986 have_dev_ptc=1
3987 ]
3988 )
3989else
3990 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3991fi
Damien Miller204ad072000-03-02 23:56:12 +11003992
Damien Millera22ba012000-03-02 23:09:20 +11003993# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003994AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003995 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003996 [
Damien Miller897741e2001-04-16 10:41:46 +10003997 case "$withval" in
3998 man|cat|doc)
3999 MANTYPE=$withval
4000 ;;
4001 *)
Tim Rice648f8762011-01-26 12:38:57 -08004002 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10004003 ;;
4004 esac
Damien Miller670a4b82000-01-22 13:53:11 +11004005 ]
4006)
Ben Lindstrombc709922001-04-18 18:04:21 +00004007if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07004008 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08004009 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00004010 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
4011 MANTYPE=doc
4012 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
4013 MANTYPE=man
4014 else
4015 MANTYPE=cat
4016 fi
4017fi
Tim Rice648f8762011-01-26 12:38:57 -08004018AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00004019if test "$MANTYPE" = "doc"; then
4020 mansubdir=man;
4021else
4022 mansubdir=$MANTYPE;
4023fi
Tim Rice648f8762011-01-26 12:38:57 -08004024AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11004025
Damien Millera22ba012000-03-02 23:09:20 +11004026# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11004027MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004028AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004029 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11004030 [
Damien Millerb85dcad2000-03-11 11:37:00 +11004031 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004032 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004033 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11004034 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11004035 fi
4036 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11004037)
4038
Damien Millera22ba012000-03-02 23:09:20 +11004039# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08004040AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11004041 [ --without-shadow Disable shadow password support],
4042 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004043 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004044 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10004045 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11004046 fi
4047 ]
4048)
4049
Damien Miller1f335fb2000-06-26 11:31:33 +10004050if test -z "$disable_shadow" ; then
4051 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08004052 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10004053#include <sys/types.h>
4054#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08004055struct spwd sp;
4056 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
4057 [ sp_expire_available=yes ], [
4058 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10004059
4060 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004061 AC_MSG_RESULT([yes])
4062 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004063 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10004064 else
Tim Rice648f8762011-01-26 12:38:57 -08004065 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10004066 fi
4067fi
4068
Damien Millera22ba012000-03-02 23:09:20 +11004069# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11004070if test ! -z "$IPADDR_IN_DISPLAY" ; then
4071 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08004072 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004073 [Define if you need to use IP address
4074 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11004075else
Damien Millera8e06ce2003-11-21 23:48:55 +11004076 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004077 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004078 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4079 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004080 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004081 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004082 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004083 fi
4084 ]
4085 )
4086fi
Damien Miller76112de1999-12-21 11:18:08 +11004087
Darren Tuckere1a790d2003-09-16 11:52:19 +10004088# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004089AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004090 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004091 [ if test "x$enableval" = "xno"; then
4092 AC_MSG_NOTICE([/etc/default/login handling disabled])
4093 etc_default_login=no
4094 else
4095 etc_default_login=yes
4096 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004097 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4098 then
4099 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4100 etc_default_login=no
4101 else
4102 etc_default_login=yes
4103 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004104)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004105
Darren Tucker2f9573d2005-02-10 22:28:54 +11004106if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004107 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004108 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004109 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004110 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004111 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004112 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004113fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004114
Tim Rice43a1c132002-04-17 21:19:14 -07004115dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004116if test $ac_cv_func_login_getcapbool = "yes" && \
4117 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004118 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004119fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004120
Damien Millera22ba012000-03-02 23:09:20 +11004121# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004122SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004123AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004124 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004125 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004126 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004127 AC_MSG_WARN([
4128--with-default-path=PATH has no effect on this system.
4129Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004130 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004131 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004132 AC_MSG_WARN([
4133--with-default-path=PATH will only be used if PATH is not defined in
4134$external_path_file .])
4135 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004136 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004137 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004138 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004139 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004140 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4141 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004142 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004143 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004144 AC_MSG_WARN([
4145If PATH is defined in $external_path_file, ensure the path to scp is included,
4146otherwise scp will not work.])
4147 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004148 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004149 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004150/* find out what STDPATH is */
4151#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004152#ifdef HAVE_PATHS_H
4153# include <paths.h>
4154#endif
4155#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004156# ifdef _PATH_USERPATH /* Irix */
4157# define _PATH_STDPATH _PATH_USERPATH
4158# else
4159# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4160# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004161#endif
4162#include <sys/types.h>
4163#include <sys/stat.h>
4164#include <fcntl.h>
4165#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004166 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004167 FILE *fd;
4168 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004169
Tim Rice59ea0a02001-03-10 13:50:45 -08004170 fd = fopen(DATA,"w");
4171 if(fd == NULL)
4172 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004173
Tim Rice59ea0a02001-03-10 13:50:45 -08004174 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4175 exit(1);
4176
4177 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004178 ]])],
4179 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004180 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4181 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4182 )
4183# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004184 t_bindir="${bindir}"
4185 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4186 t_bindir=`eval echo ${t_bindir}`
4187 case $t_bindir in
4188 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4189 esac
4190 case $t_bindir in
4191 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4192 esac
4193 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004194 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4195 if test $? -ne 0 ; then
4196 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4197 if test $? -ne 0 ; then
4198 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004199 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004200 fi
4201 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004202 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004203)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004204if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004205 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4206 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004207fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004208
Damien Millera18bbd32002-05-13 10:48:57 +10004209# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004210AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004211 [ --with-superuser-path= Specify different path for super-user],
4212 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004213 if test -n "$withval" && test "x$withval" != "xno" && \
4214 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004215 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004216 [Define if you want a different $PATH
4217 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004218 superuser_path=$withval
4219 fi
4220 ]
4221)
4222
4223
Damien Miller61e50f12000-05-08 20:49:37 +10004224AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004225IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004226AC_ARG_WITH(4in6,
4227 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4228 [
4229 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004230 AC_MSG_RESULT([yes])
4231 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004232 [Detect IPv4 in IPv6 mapped addresses
4233 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004234 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004235 else
Tim Rice648f8762011-01-26 12:38:57 -08004236 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004237 fi
Tim Rice648f8762011-01-26 12:38:57 -08004238 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004239 if test "x$inet6_default_4in6" = "xyes"; then
4240 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004241 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004242 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004243 else
4244 AC_MSG_RESULT([no (default)])
4245 fi
4246 ]
4247)
4248
Damien Miller60396b02001-02-18 17:01:00 +11004249# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004250BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004251AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004252 [ --with-bsd-auth Enable BSD auth support],
4253 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004254 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004255 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004256 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004257 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004258 fi
4259 ]
4260)
4261
Damien Millera22ba012000-03-02 23:09:20 +11004262# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004263piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004264# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004265if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004266 piddir=`eval echo ${sysconfdir}`
4267 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004268 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004269 esac
4270fi
4271
Tim Rice648f8762011-01-26 12:38:57 -08004272AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004273 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4274 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004275 if test -n "$withval" && test "x$withval" != "xno" && \
4276 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004277 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004278 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004279 AC_MSG_WARN([** no $piddir directory on this system **])
4280 fi
4281 fi
4282 ]
4283)
4284
Tim Rice648f8762011-01-26 12:38:57 -08004285AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4286 [Specify location of ssh.pid])
4287AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004288
andre2ff7b5d2000-06-03 14:57:40 +00004289dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004290AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004291 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004292 [
4293 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004294 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004295 fi
4296 ]
andre2ff7b5d2000-06-03 14:57:40 +00004297)
Tim Rice648f8762011-01-26 12:38:57 -08004298AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004299 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004300 [
4301 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004302 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004303 fi
4304 ]
andre2ff7b5d2000-06-03 14:57:40 +00004305)
Tim Rice648f8762011-01-26 12:38:57 -08004306AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004307 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004308 [
4309 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004310 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004311 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004312 fi
4313 ]
andre2ff7b5d2000-06-03 14:57:40 +00004314)
Tim Rice648f8762011-01-26 12:38:57 -08004315AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004316 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004317 [
4318 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004319 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004320 fi
4321 ]
andre2ff7b5d2000-06-03 14:57:40 +00004322)
Tim Rice648f8762011-01-26 12:38:57 -08004323AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004324 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004325 [
4326 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004327 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004328 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004329 fi
4330 ]
andre2ff7b5d2000-06-03 14:57:40 +00004331)
Tim Rice648f8762011-01-26 12:38:57 -08004332AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004333 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004334 [
4335 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004336 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004337 fi
4338 ]
andre2ff7b5d2000-06-03 14:57:40 +00004339)
Tim Rice648f8762011-01-26 12:38:57 -08004340AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004341 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004342 [
4343 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004344 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004345 [Define if you don't want to use pututline()
4346 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004347 fi
4348 ]
andre2ff7b5d2000-06-03 14:57:40 +00004349)
Tim Rice648f8762011-01-26 12:38:57 -08004350AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004351 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004352 [
4353 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004354 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004355 [Define if you don't want to use pututxline()
4356 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004357 fi
4358 ]
andre2ff7b5d2000-06-03 14:57:40 +00004359)
Tim Rice648f8762011-01-26 12:38:57 -08004360AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004361 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004362 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004363 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004364 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004365 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004366 conf_lastlog_location=$withval
4367 fi
4368 ]
4369)
andre2ff7b5d2000-06-03 14:57:40 +00004370
4371dnl lastlog, [uw]tmpx? detection
4372dnl NOTE: set the paths in the platform section to avoid the
4373dnl need for command-line parameters
4374dnl lastlog and [uw]tmp are subject to a file search if all else fails
4375
4376dnl lastlog detection
4377dnl NOTE: the code itself will detect if lastlog is a directory
4378AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004379AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004380#include <sys/types.h>
4381#include <utmp.h>
4382#ifdef HAVE_LASTLOG_H
4383# include <lastlog.h>
4384#endif
Damien Miller2994e082000-06-04 15:51:47 +10004385#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004386# include <paths.h>
4387#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004388#ifdef HAVE_LOGIN_H
4389# include <login.h>
4390#endif
Tim Rice648f8762011-01-26 12:38:57 -08004391 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4392 [ AC_MSG_RESULT([yes]) ],
4393 [
4394 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004395 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004396 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004397#include <sys/types.h>
4398#include <utmp.h>
4399#ifdef HAVE_LASTLOG_H
4400# include <lastlog.h>
4401#endif
4402#ifdef HAVE_PATHS_H
4403# include <paths.h>
4404#endif
Tim Rice648f8762011-01-26 12:38:57 -08004405 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4406 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004407 [
Tim Rice648f8762011-01-26 12:38:57 -08004408 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004409 system_lastlog_path=no
4410 ])
Tim Rice648f8762011-01-26 12:38:57 -08004411])
Damien Miller2994e082000-06-04 15:51:47 +10004412
andre2ff7b5d2000-06-03 14:57:40 +00004413if test -z "$conf_lastlog_location"; then
4414 if test x"$system_lastlog_path" = x"no" ; then
4415 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004416 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004417 conf_lastlog_location=$f
4418 fi
4419 done
4420 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004421 AC_MSG_WARN([** Cannot find lastlog **])
4422 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004423 fi
4424 fi
4425fi
4426
4427if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004428 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004429 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004430fi
andre2ff7b5d2000-06-03 14:57:40 +00004431
4432dnl utmp detection
4433AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004434AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004435#include <sys/types.h>
4436#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004437#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004438# include <paths.h>
4439#endif
Tim Rice648f8762011-01-26 12:38:57 -08004440 ]], [[ char *utmp = UTMP_FILE; ]])],
4441 [ AC_MSG_RESULT([yes]) ],
4442 [ AC_MSG_RESULT([no])
4443 system_utmp_path=no
4444])
andre2ff7b5d2000-06-03 14:57:40 +00004445if test -z "$conf_utmp_location"; then
4446 if test x"$system_utmp_path" = x"no" ; then
4447 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4448 if test -f $f ; then
4449 conf_utmp_location=$f
4450 fi
4451 done
4452 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004453 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004454 fi
4455 fi
4456fi
4457if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004458 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004459 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004460fi
andre2ff7b5d2000-06-03 14:57:40 +00004461
4462dnl wtmp detection
4463AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004464AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004465#include <sys/types.h>
4466#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004467#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004468# include <paths.h>
4469#endif
Tim Rice648f8762011-01-26 12:38:57 -08004470 ]], [[ char *wtmp = WTMP_FILE; ]])],
4471 [ AC_MSG_RESULT([yes]) ],
4472 [ AC_MSG_RESULT([no])
4473 system_wtmp_path=no
4474])
andre2ff7b5d2000-06-03 14:57:40 +00004475if test -z "$conf_wtmp_location"; then
4476 if test x"$system_wtmp_path" = x"no" ; then
4477 for f in /usr/adm/wtmp /var/log/wtmp; do
4478 if test -f $f ; then
4479 conf_wtmp_location=$f
4480 fi
4481 done
4482 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004483 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004484 fi
4485 fi
4486fi
4487if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004488 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004489 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004490fi
andre2ff7b5d2000-06-03 14:57:40 +00004491
andre2ff7b5d2000-06-03 14:57:40 +00004492dnl wtmpx detection
4493AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004494AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004495#include <sys/types.h>
4496#include <utmp.h>
4497#ifdef HAVE_UTMPX_H
4498#include <utmpx.h>
4499#endif
Damien Miller2994e082000-06-04 15:51:47 +10004500#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004501# include <paths.h>
4502#endif
Tim Rice648f8762011-01-26 12:38:57 -08004503 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4504 [ AC_MSG_RESULT([yes]) ],
4505 [ AC_MSG_RESULT([no])
4506 system_wtmpx_path=no
4507])
andre2ff7b5d2000-06-03 14:57:40 +00004508if test -z "$conf_wtmpx_location"; then
4509 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004510 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004511 fi
4512else
Tim Rice648f8762011-01-26 12:38:57 -08004513 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004514 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004515fi
andre2ff7b5d2000-06-03 14:57:40 +00004516
Damien Miller4018c192000-04-30 09:30:44 +10004517
Damien Miller29ea30d2000-03-17 10:54:15 +11004518if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004519 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4520 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004521fi
4522
Damien Millera2438bb2013-03-15 10:23:07 +11004523AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004524 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004525 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004526 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004527 ], [
4528#ifdef HAVE_SYS_TYPES_H
4529#include <sys/types.h>
4530#endif
4531#ifdef HAVE_UTMP_H
4532#include <utmp.h>
4533#endif
4534#ifdef HAVE_UTMPX_H
4535#include <utmpx.h>
4536#endif
4537#ifdef HAVE_LASTLOG_H
4538#include <lastlog.h>
4539#endif
4540 ])
4541
4542AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4543 AC_DEFINE([DISABLE_UTMP])
4544 AC_DEFINE([DISABLE_WTMP])
4545 ], [
4546#ifdef HAVE_SYS_TYPES_H
4547#include <sys/types.h>
4548#endif
4549#ifdef HAVE_UTMP_H
4550#include <utmp.h>
4551#endif
4552#ifdef HAVE_UTMPX_H
4553#include <utmpx.h>
4554#endif
4555#ifdef HAVE_LASTLOG_H
4556#include <lastlog.h>
4557#endif
4558 ])
4559
Darren Tucker7da23cb2005-08-03 00:20:15 +10004560dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4561dnl Add now.
4562CFLAGS="$CFLAGS $werror_flags"
4563
Darren Tucker627337d2010-04-10 22:58:01 +10004564if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4565 TEST_SSH_IPV6=no
4566else
4567 TEST_SSH_IPV6=yes
4568fi
Tim Rice648f8762011-01-26 12:38:57 -08004569AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4570AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker882abfd2013-11-09 00:17:41 +11004571AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
Darren Tucker6d8bd572013-06-11 11:26:10 +10004572AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms])
Darren Tucker5d376902008-06-11 04:15:05 +10004573
Damien Millerbac2d8a2000-09-05 16:13:06 +11004574AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004575AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4576 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004577 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004578AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004579
Damien Miller7b22d652000-06-18 14:07:04 +10004580# Print summary of options
4581
Damien Miller7b22d652000-06-18 14:07:04 +10004582# Someone please show me a better way :)
4583A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4584B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4585C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4586D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004587E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004588F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004589G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004590H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4591I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4592J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004593
4594echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004595echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004596echo " User binaries: $B"
4597echo " System binaries: $C"
4598echo " Configuration files: $D"
4599echo " Askpass program: $E"
4600echo " Manual pages: $F"
4601echo " PID file: $G"
4602echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004603if test "x$external_path_file" = "x/etc/login.conf" ; then
4604echo " At runtime, sshd will use the path defined in $external_path_file"
4605echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004606else
Damien Millerf58c6722002-05-13 13:15:42 +10004607echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004608 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004609echo " (If PATH is set in $external_path_file it will be used instead. If"
4610echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4611 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004612fi
Damien Millera18bbd32002-05-13 10:48:57 +10004613if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004614echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004615fi
Damien Millerf58c6722002-05-13 13:15:42 +10004616echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004617echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004618echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004619echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004620echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004621echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004622echo " S/KEY support: $SKEY_MSG"
4623echo " TCP Wrappers support: $TCPW_MSG"
4624echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004625echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004626echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004627echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004628echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004629echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4630echo " BSD Auth support: $BSD_AUTH_MSG"
4631echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004632echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004633
Damien Miller7b22d652000-06-18 14:07:04 +10004634echo ""
4635
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004636echo " Host: ${host}"
4637echo " Compiler: ${CC}"
4638echo " Compiler flags: ${CFLAGS}"
4639echo "Preprocessor flags: ${CPPFLAGS}"
4640echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004641echo " Libraries: ${LIBS}"
4642if test ! -z "${SSHDLIBS}"; then
4643echo " +for sshd: ${SSHDLIBS}"
4644fi
Damien Miller71adf122011-01-25 12:16:15 +11004645if test ! -z "${SSHLIBS}"; then
4646echo " +for ssh: ${SSHLIBS}"
4647fi
Damien Miller7b22d652000-06-18 14:07:04 +10004648
4649echo ""
4650
Tim Rice6f1f7582004-05-30 21:38:51 -07004651if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004652 echo "SVR4 style packages are supported with \"make package\""
4653 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004654fi
4655
Damien Miller82cf0ce2000-12-20 13:34:48 +11004656if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004657 echo "PAM is enabled. You may need to install a PAM control file "
4658 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004659 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004660 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004661 echo ""
4662fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004663
Damien Millerb4097182004-05-23 14:09:40 +10004664if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004665 echo "WARNING: the operating system that you are using does not"
4666 echo "appear to support getpeereid(), getpeerucred() or the"
4667 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4668 echo "enforce security checks to prevent unauthorised connections to"
4669 echo "ssh-agent. Their absence increases the risk that a malicious"
4670 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004671 echo ""
4672fi
4673
Darren Tuckerd9f88912005-02-20 21:01:48 +11004674if test "$AUDIT_MODULE" = "bsm" ; then
4675 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4676 echo "See the Solaris section in README.platform for details."
4677fi