blob: c30d547d9a2d6707caf69d4a4f977f89959a1b0e [file] [log] [blame]
Damien Miller6332da22013-04-23 14:25:52 +10001# $Id: configure.ac,v 1.521 2013/04/23 04:25:53 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Damien Miller6332da22013-04-23 14:25:52 +100018AC_REVISION($Revision: 1.521 $)
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
Damien Millerb1763622011-05-20 11:45:25 +1000132 OSSH_CHECK_CFLAG_COMPILE([-Wall])
133 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
134 OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
135 OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
136 OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
137 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
138 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
139 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tuckerce1c9572013-04-18 21:36:19 +1000140 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100141 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Tim Rice648f8762011-01-26 12:38:57 -0800142 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100143 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700144 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000145 1.*) no_attrib_nonnull=1 ;;
146 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000147 no_attrib_nonnull=1
148 ;;
149 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100150 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700151 esac
Tim Rice648f8762011-01-26 12:38:57 -0800152 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000153
Tim Rice648f8762011-01-26 12:38:57 -0800154 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000155 saved_CFLAGS="$CFLAGS"
156 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800157 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
158 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
159 [ AC_MSG_RESULT([yes]) ],
160 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000161 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800162 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000163
Darren Tuckerb7918af2008-03-09 11:34:23 +1100164 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100165 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100166 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100167 if test "x$use_stack_protector" = "x1"; then
168 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800169 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100170 saved_CFLAGS="$CFLAGS"
171 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100172 CFLAGS="$CFLAGS $t -Werror"
173 LDFLAGS="$LDFLAGS $t -Werror"
174 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800175 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
176 [[
177 char x[256];
178 snprintf(x, sizeof(x), "XXX");
179 ]])],
180 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100181 CFLAGS="$saved_CFLAGS $t"
182 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800183 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100184 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800185 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
186 [[
187 char x[256];
188 snprintf(x, sizeof(x), "XXX");
189 ]])],
190 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100191 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800192 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100193 [ AC_MSG_WARN([cross compiling: cannot test])
194 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100195 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100196 ],
Tim Rice648f8762011-01-26 12:38:57 -0800197 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100198 )
199 CFLAGS="$saved_CFLAGS"
200 LDFLAGS="$saved_LDFLAGS"
201 done
202 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100203
Darren Tucker67b37032005-06-03 17:58:31 +1000204 if test -z "$have_llong_max"; then
205 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
206 unset ac_cv_have_decl_LLONG_MAX
207 saved_CFLAGS="$CFLAGS"
208 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800209 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000210 [have_llong_max=1],
211 [CFLAGS="$saved_CFLAGS"],
212 [#include <limits.h>]
213 )
214 fi
Damien Miller166bd442000-03-16 10:48:25 +1100215fi
216
Darren Tucker951b53b2013-02-08 11:50:09 +1100217AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
218AC_COMPILE_IFELSE(
219 [AC_LANG_PROGRAM([[
220#include <stdlib.h>
221__attribute__((__unused__)) static void foo(void){return;}]],
222 [[ exit(0); ]])],
223 [ AC_MSG_RESULT([yes]) ],
224 [ AC_MSG_RESULT([no])
225 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
226 [compiler does not accept __attribute__ on return types]) ]
227)
228
Darren Tucker391de5c2007-04-29 14:49:21 +1000229if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800230 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000231fi
232
Tim Rice648f8762011-01-26 12:38:57 -0800233AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800234 [ --without-rpath Disable auto-added -R linker paths],
235 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800236 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800237 need_dash_r=""
238 fi
239 if test "x$withval" = "xyes" ; then
240 need_dash_r=1
241 fi
242 ]
243)
244
Tim Rice1cfab232006-10-03 09:34:35 -0700245# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800246AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700247 [ --with-cflags Specify additional flags to pass to compiler],
248 [
249 if test -n "$withval" && test "x$withval" != "xno" && \
250 test "x${withval}" != "xyes"; then
251 CFLAGS="$CFLAGS $withval"
252 fi
253 ]
254)
Tim Rice648f8762011-01-26 12:38:57 -0800255AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700256 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
257 [
258 if test -n "$withval" && test "x$withval" != "xno" && \
259 test "x${withval}" != "xyes"; then
260 CPPFLAGS="$CPPFLAGS $withval"
261 fi
262 ]
263)
Tim Rice648f8762011-01-26 12:38:57 -0800264AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700265 [ --with-ldflags Specify additional flags to pass to linker],
266 [
267 if test -n "$withval" && test "x$withval" != "xno" && \
268 test "x${withval}" != "xyes"; then
269 LDFLAGS="$LDFLAGS $withval"
270 fi
271 ]
272)
Tim Rice648f8762011-01-26 12:38:57 -0800273AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700274 [ --with-libs Specify additional libraries to link with],
275 [
276 if test -n "$withval" && test "x$withval" != "xno" && \
277 test "x${withval}" != "xyes"; then
278 LIBS="$LIBS $withval"
279 fi
280 ]
281)
Tim Rice648f8762011-01-26 12:38:57 -0800282AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700283 [ --with-Werror Build main code with -Werror],
284 [
285 if test -n "$withval" && test "x$withval" != "xno"; then
286 werror_flags="-Werror"
287 if test "x${withval}" != "xyes"; then
288 werror_flags="$withval"
289 fi
290 fi
291 ]
292)
293
Tim Rice648f8762011-01-26 12:38:57 -0800294AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700295 bstring.h \
296 crypt.h \
297 crypto/sha2.h \
298 dirent.h \
299 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100300 elf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700301 features.h \
302 fcntl.h \
303 floatingpoint.h \
304 getopt.h \
305 glob.h \
306 ia.h \
307 iaf.h \
308 limits.h \
309 login.h \
310 maillock.h \
311 ndir.h \
312 net/if_tun.h \
313 netdb.h \
314 netgroup.h \
315 pam/pam_appl.h \
316 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000317 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700318 pty.h \
319 readpassphrase.h \
320 rpc/types.h \
321 security/pam_appl.h \
322 sha2.h \
323 shadow.h \
324 stddef.h \
325 stdint.h \
326 string.h \
327 strings.h \
328 sys/audit.h \
329 sys/bitypes.h \
330 sys/bsdtty.h \
331 sys/cdefs.h \
332 sys/dir.h \
333 sys/mman.h \
334 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000335 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700336 sys/prctl.h \
337 sys/pstat.h \
338 sys/select.h \
339 sys/stat.h \
340 sys/stream.h \
341 sys/stropts.h \
342 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000343 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700344 sys/sysmacros.h \
345 sys/time.h \
346 sys/timers.h \
347 sys/un.h \
348 time.h \
349 tmpdir.h \
350 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700351 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700352 unistd.h \
353 usersec.h \
354 util.h \
355 utime.h \
356 utmp.h \
357 utmpx.h \
358 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800359])
Tim Rice1cfab232006-10-03 09:34:35 -0700360
361# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800362AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700363#ifdef HAVE_SYS_TIME_H
364# include <sys/time.h>
365#endif
366])
367
368# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800369AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700370#ifdef HAVE_SYS_STREAM_H
371# include <sys/stream.h>
372#endif
373])
374
375# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800376AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700377#include <sys/types.h>
378])
379
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000380# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800381AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000382#include <sys/param.h>
383])
384
Damien Miller1b06dc32006-08-31 03:24:41 +1000385# Messages for features tested for in target-specific section
386SIA_MSG="no"
387SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100388SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000389
Damien Millera22ba012000-03-02 23:09:20 +1100390# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100391case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100392*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000393 # Some versions of VAC won't allow macro redefinitions at
394 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
395 # particularly with older versions of vac or xlc.
396 # It also throws errors about null macro argments, but these are
397 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800398 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000399 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800400 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000401#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800402#define testmacro bar]],
403 [[ exit(0); ]])],
404 [ AC_MSG_RESULT([yes]) ],
405 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000406 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
407 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
408 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
409 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
410 ]
411 )
412
Damien Millera8e06ce2003-11-21 23:48:55 +1100413 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000414 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800415 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100416 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000417 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000418 if test "$GCC" = "yes"; then
419 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
420 else
421 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
422 fi
423 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000424 if (test -z "$blibflags"); then
425 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800426 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
427 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000428 fi
429 done
430 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800431 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000432 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
433 else
Tim Rice648f8762011-01-26 12:38:57 -0800434 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000435 fi
436 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000437 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800438 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700439 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800440 [AC_CHECK_LIB([s], [authenticate],
441 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700442 LIBS="$LIBS -ls"
443 ])
444 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100445 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100446 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100447 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000448 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800449 AC_CHECK_DECLS([loginfailed],
450 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
451 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
452 [[ (void)loginfailed("user","host","tty",0); ]])],
453 [AC_MSG_RESULT([yes])
454 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
455 [Define if your AIX loginfailed() function
456 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
457 ])],
458 [],
459 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000460 )
Tim Rice648f8762011-01-26 12:38:57 -0800461 AC_CHECK_FUNCS([getgrset setauthdb])
462 AC_CHECK_DECL([F_CLOSEM],
463 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000464 [],
465 [ #include <limits.h>
466 #include <fcntl.h> ]
467 )
Darren Tucker691d5232005-02-15 21:45:57 +1100468 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800469 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
470 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700471 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800472 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
473 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000474 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800475 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
476 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700477 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800478 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700479 [Define to a Set Process Title type if your system is
480 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800481 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100482 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800483 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100484 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100485 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100486*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100487 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100488 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800489 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
490 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
491 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700492 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800493 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700494 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800495 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700496 [Define if the concept of ports only accessible to
497 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800498 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700499 [Define if your platform needs to skip post auth
500 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800501 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
502 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100503 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000504*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800505 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700506 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800507 AC_DEFINE([SETEUID_BREAKS_SETUID])
508 AC_DEFINE([BROKEN_SETREUID])
509 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000510 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000511*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800512 AC_MSG_CHECKING([if we have working getaddrinfo])
513 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000514main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
515 exit(0);
516 else
517 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800518}
519 ]])],
520 [AC_MSG_RESULT([working])],
521 [AC_MSG_RESULT([buggy])
522 AC_DEFINE([BROKEN_GETADDRINFO], [1],
523 [getaddrinfo is broken (if present)])
524 ],
525 [AC_MSG_RESULT([assume it is working])])
526 AC_DEFINE([SETEUID_BREAKS_SETUID])
527 AC_DEFINE([BROKEN_SETREUID])
528 AC_DEFINE([BROKEN_SETREGID])
529 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
530 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700531 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800532 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
533 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000534 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800535 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000536 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800537 m4_pattern_allow([AU_IPv])
538 AC_CHECK_DECL([AU_IPv4], [],
539 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100540 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800541 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100542 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100543 )
Damien Millerc09182f2011-06-03 12:11:38 +1000544 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
545 [Define to a Set Process Title type if your system is
546 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000547 AC_CHECK_FUNCS([sandbox_init])
548 AC_CHECK_HEADERS([sandbox.h])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000549 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000550*-*-dragonfly*)
551 SSHDLIBS="$SSHDLIBS -lcrypt"
552 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100553*-*-haiku*)
554 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800555 AC_CHECK_LIB([network], [socket])
556 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100557 MANTYPE=man
558 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000559*-*-hpux*)
560 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000561 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100562 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800563 AC_DEFINE([USE_PIPES])
564 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700565 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800566 AC_DEFINE([LOGIN_NEEDS_UTMPX])
567 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700568 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800569 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100570 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700571 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700572 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800573 AC_CHECK_LIB([xnet], [t_error], ,
574 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000575
576 # next, we define all of the options specific to major releases
577 case "$host" in
578 *-*-hpux10*)
579 if test -z "$GCC"; then
580 CFLAGS="$CFLAGS -Ae"
581 fi
582 ;;
583 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800584 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700585 [Define if you are using Solaris-derived PAM which
586 passes pam_messages to the conversation function
587 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800588 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700589 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800590 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000591 check_for_hpux_broken_getaddrinfo=1
592 check_for_conflicting_getspnam=1
593 ;;
594 esac
595
596 # lastly, we define options specific to minor releases
597 case "$host" in
598 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700600 [Define if you have SecureWare-based
601 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000602 disable_ptmx_check=yes
603 LIBS="$LIBS -lsecpw"
604 ;;
605 esac
Damien Miller1bead332000-04-30 00:47:29 +1000606 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100607*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100608 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800609 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700610 [Define if you system's inet_ntoa is busted
611 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800612 AC_DEFINE([SETEUID_BREAKS_SETUID])
613 AC_DEFINE([BROKEN_SETREUID])
614 AC_DEFINE([BROKEN_SETREGID])
615 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700616 [Define if you shouldn't strip 'tty' from your
617 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800618 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100619 ;;
620*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100621 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800622 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700623 [Define if you have/want arrays
624 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800625 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700626 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800627 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700628 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800629 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700630 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800631 AC_DEFINE([BROKEN_INET_NTOA])
632 AC_DEFINE([SETEUID_BREAKS_SETUID])
633 AC_DEFINE([BROKEN_SETREUID])
634 AC_DEFINE([BROKEN_SETREGID])
635 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
636 AC_DEFINE([WITH_ABBREV_NO_TTY])
637 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100638 ;;
Damien Miller90551722009-02-16 15:37:03 +1100639*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
640 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800641 AC_DEFINE([PAM_TTY_KLUDGE])
642 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
643 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
644 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
645 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100646 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100647*-*-linux*)
648 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100649 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000650 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800651 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700652 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800653 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700654 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800655 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
656 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700657 [Define to whatever link() returns for "not supported"
658 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800659 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
660 AC_DEFINE([USE_BTMP])
661 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100662 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000663 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000664 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800665 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700666 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000667 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000668 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100669 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800670 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100671 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800672 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100673 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800674 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100675 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800676 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100677 [Prepend the address family to IP tunnel traffic])
678 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000679 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
680 [], [#include <linux/types.h>])
Damien Millere0956e32012-04-04 11:27:54 +1000681 AC_CHECK_FUNCS([prctl])
Damien Miller91f40d82013-02-22 11:37:00 +1100682 AC_MSG_CHECKING([for seccomp architecture])
683 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000684 case "$host" in
685 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100686 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000687 ;;
688 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100689 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000690 ;;
Damien Miller91f40d82013-02-22 11:37:00 +1100691 arm*-*)
692 seccomp_audit_arch=AUDIT_ARCH_ARM
693 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000694 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100695 if test "x$seccomp_audit_arch" != "x" ; then
696 AC_MSG_RESULT(["$seccomp_audit_arch"])
697 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
698 [Specify the system call convention in use])
699 else
700 AC_MSG_RESULT([architecture not supported])
701 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100702 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000703mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800704 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000705 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000706 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100707*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000708 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800709 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800710 need_dash_r=1
711 fi
Tim Rice648f8762011-01-26 12:38:57 -0800712 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100713 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800714 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
715 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100716 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100717 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100718*-*-freebsd*)
719 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800720 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
721 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100722 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800723 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
724 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Miller63b4bcd2013-03-20 12:55:14 +1100725 AC_DEFINE([BROKEN_STRNVIS], [1], [FreeBSD strnvis does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100726 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000727*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800728 AC_DEFINE([SETEUID_BREAKS_SETUID])
729 AC_DEFINE([BROKEN_SETREUID])
730 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000731 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000732*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000733 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100734 conf_utmp_location=/etc/utmp
735 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700736 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800737 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
738 AC_DEFINE([BROKEN_REALPATH])
739 AC_DEFINE([USE_PIPES])
740 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000741 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000742*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800743 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
744 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
745 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
746 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000747 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000748 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100749*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800750 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800751 need_dash_r=1
752 fi
Tim Rice648f8762011-01-26 12:38:57 -0800753 AC_DEFINE([PAM_SUN_CODEBASE])
754 AC_DEFINE([LOGIN_NEEDS_UTMPX])
755 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700756 [Some versions of /bin/login need the TERM supplied
757 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800758 AC_DEFINE([PAM_TTY_KLUDGE])
759 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700760 [Define if pam_chauthtok wants real uid set
761 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800762 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000763 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700765 [Define if sshd somehow reacquires a controlling TTY
766 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800767 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000768 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800769 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000770 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000771 # hardwire lastlog location (can't detect it on some versions)
772 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800773 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000774 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
775 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800776 AC_MSG_RESULT([yes])
777 AC_DEFINE([DISABLE_UTMP])
778 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700779 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000780 else
Tim Rice648f8762011-01-26 12:38:57 -0800781 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000782 fi
Tim Rice648f8762011-01-26 12:38:57 -0800783 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000784 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
785 [
Tim Rice648f8762011-01-26 12:38:57 -0800786 AC_CHECK_LIB([contract], [ct_tmpl_activate],
787 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000788 [Define if you have Solaris process contracts])
789 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000790 SPC_MSG="yes" ], )
791 ],
792 )
Tim Rice648f8762011-01-26 12:38:57 -0800793 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100794 [ --with-solaris-projects Enable Solaris projects (experimental)],
795 [
Tim Rice648f8762011-01-26 12:38:57 -0800796 AC_CHECK_LIB([project], [setproject],
797 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100798 [Define if you have Solaris projects])
799 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100800 SP_MSG="yes" ], )
801 ],
802 )
Damien Miller75b1d102000-01-07 14:01:41 +1100803 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000804*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000805 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800806 AC_CHECK_FUNCS([getpwanam])
807 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000808 conf_utmp_location=/etc/utmp
809 conf_wtmp_location=/var/adm/wtmp
810 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800811 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000812 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000813*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700814 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800815 AC_DEFINE([USE_PIPES])
816 AC_DEFINE([SSHD_ACQUIRES_CTTY])
817 AC_DEFINE([SETEUID_BREAKS_SETUID])
818 AC_DEFINE([BROKEN_SETREUID])
819 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000820 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000821*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700822 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800823 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100824 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800825 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100826 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800827 AC_DEFINE([USE_PIPES])
828 AC_DEFINE([IP_TOS_IS_BROKEN])
829 AC_DEFINE([SETEUID_BREAKS_SETUID])
830 AC_DEFINE([BROKEN_SETREUID])
831 AC_DEFINE([BROKEN_SETREGID])
832 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000833 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700834 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
835 # Attention: always take care to bind libsocket and libnsl before libc,
836 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000837 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800838# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100839*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800840 AC_DEFINE([USE_PIPES])
841 AC_DEFINE([SETEUID_BREAKS_SETUID])
842 AC_DEFINE([BROKEN_SETREUID])
843 AC_DEFINE([BROKEN_SETREGID])
844 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
845 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100846 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800847# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100848*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800849 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800850 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
851 AC_DEFINE([USE_PIPES])
852 AC_DEFINE([SETEUID_BREAKS_SETUID])
853 AC_DEFINE([BROKEN_GETADDRINFO])
854 AC_DEFINE([BROKEN_SETREUID])
855 AC_DEFINE([BROKEN_SETREGID])
856 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700857 case "$host" in
858 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700859 maildir=/var/spool/mail
Tim Rice4dbacff2005-06-01 20:09:28 -0700860 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800861 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700862 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800863 AC_DEFINE([BROKEN_UPDWTMPX])
864 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
865 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
866 AC_DEFINE([HAVE_SECUREWARE])
867 AC_DEFINE([DISABLE_SHADOW])
868 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700869 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800870 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800871 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800872 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700873 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100874 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100875*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100876 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800877# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100878*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800879 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100880 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800881# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100882*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800883 if test -z "$GCC"; then
884 CFLAGS="$CFLAGS -belf"
885 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100886 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000887 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800888 AC_DEFINE([USE_PIPES])
889 AC_DEFINE([HAVE_SECUREWARE])
890 AC_DEFINE([DISABLE_SHADOW])
891 AC_DEFINE([DISABLE_FD_PASSING])
892 AC_DEFINE([SETEUID_BREAKS_SETUID])
893 AC_DEFINE([BROKEN_GETADDRINFO])
894 AC_DEFINE([BROKEN_SETREUID])
895 AC_DEFINE([BROKEN_SETREGID])
896 AC_DEFINE([WITH_ABBREV_NO_TTY])
897 AC_DEFINE([BROKEN_UPDWTMPX])
898 AC_DEFINE([PASSWD_NEEDS_USERNAME])
899 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700900 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700901 TEST_SHELL=ksh
Tim Riceaa86c392013-03-16 20:55:46 -0700902 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +1000903 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000904*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800905 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700906 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800907 AC_DEFINE([SETEUID_BREAKS_SETUID])
908 AC_DEFINE([BROKEN_SETREUID])
909 AC_DEFINE([BROKEN_SETREGID])
910 AC_DEFINE([USE_PIPES])
911 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000912 LDFLAGS="$LDFLAGS"
913 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
914 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000915 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000916*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800917 AC_DEFINE([SETEUID_BREAKS_SETUID])
918 AC_DEFINE([BROKEN_SETREUID])
919 AC_DEFINE([BROKEN_SETREGID])
920 AC_DEFINE([WITH_ABBREV_NO_TTY])
921 AC_DEFINE([USE_PIPES])
922 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000923 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100924 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000925 MANTYPE=cat
926 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000927*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800928 AC_DEFINE([SETEUID_BREAKS_SETUID])
929 AC_DEFINE([BROKEN_SETREUID])
930 AC_DEFINE([BROKEN_SETREGID])
931 AC_DEFINE([USE_PIPES])
932 AC_DEFINE([DISABLE_FD_PASSING])
933 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000934 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
935 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
936 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700937 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000938*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800939 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000940 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800941 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000942 [ --with-osfsia Enable Digital Unix SIA],
943 [
944 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800945 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000946 no_osfsia=1
947 fi
948 ],
949 )
950 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000951 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800952 AC_MSG_RESULT([yes])
953 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700954 [Define if you have Digital Unix Security
955 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800956 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700957 [Define if you don't want to use your
958 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800959 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000960 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000961 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000962 else
Tim Rice648f8762011-01-26 12:38:57 -0800963 AC_MSG_RESULT([no])
964 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700965 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000966 fi
967 fi
Tim Rice648f8762011-01-26 12:38:57 -0800968 AC_DEFINE([BROKEN_GETADDRINFO])
969 AC_DEFINE([SETEUID_BREAKS_SETUID])
970 AC_DEFINE([BROKEN_SETREUID])
971 AC_DEFINE([BROKEN_SETREGID])
972 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000973 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000974
Tim Rice70335a62006-02-04 17:42:58 -0800975*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800976 AC_DEFINE([USE_PIPES])
977 AC_DEFINE([NO_X11_UNIX_SOCKETS])
978 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
979 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
980 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
981 AC_DEFINE([DISABLE_LASTLOG])
982 AC_DEFINE([SSHD_ACQUIRES_CTTY])
983 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800984 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000985 case "$host" in
986 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800987 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000988 ;;
989 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000990 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000991
992*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800993 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
994 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
995 AC_DEFINE([NEED_SETPGRP])
996 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700997 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000998
999*-*-lynxos)
1000 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001001 AC_DEFINE([MISSING_HOWMANY])
1002 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001003 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001004esac
1005
Tim Rice648f8762011-01-26 12:38:57 -08001006AC_MSG_CHECKING([compiler and flags for sanity])
1007AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1008 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001009 [
Tim Rice648f8762011-01-26 12:38:57 -08001010 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001011 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001012 ],
1013 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001014)
1015
Darren Tucker0c9653f2005-05-28 15:58:14 +10001016dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001017# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001018AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
1019AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001020
Tim Rice1e1ef642003-09-11 22:19:31 -07001021dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001022AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1023 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001024 AC_CACHE_CHECK([for broken dirname],
1025 ac_cv_have_broken_dirname, [
1026 save_LIBS="$LIBS"
1027 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001028 AC_RUN_IFELSE(
1029 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001030#include <libgen.h>
1031#include <string.h>
1032
1033int main(int argc, char **argv) {
1034 char *s, buf[32];
1035
1036 strncpy(buf,"/etc", 32);
1037 s = dirname(buf);
1038 if (!s || strncmp(s, "/", 32) != 0) {
1039 exit(1);
1040 } else {
1041 exit(0);
1042 }
1043}
Darren Tucker314d89e2005-10-17 23:29:23 +10001044 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001045 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001046 [ ac_cv_have_broken_dirname="yes" ],
1047 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001048 )
1049 LIBS="$save_LIBS"
1050 ])
1051 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1052 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001053 AC_DEFINE([HAVE_DIRNAME])
1054 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001055 fi
1056 ])
1057])
1058
Tim Rice648f8762011-01-26 12:38:57 -08001059AC_CHECK_FUNC([getspnam], ,
1060 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1061AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1062 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001063
Tim Rice13aae5e2001-10-21 17:53:58 -07001064dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001065AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001066 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001067 [ if test "x$withval" = "xno" ; then
1068 AC_MSG_ERROR([*** zlib is required ***])
1069 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001070 if test -d "$withval/lib"; then
1071 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001072 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001073 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001074 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001075 fi
1076 else
1077 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001078 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001079 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001080 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001081 fi
1082 fi
1083 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001084 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001085 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001086 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001087 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001088 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001089)
1090
Tim Rice648f8762011-01-26 12:38:57 -08001091AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1092AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001093 [
1094 saved_CPPFLAGS="$CPPFLAGS"
1095 saved_LDFLAGS="$LDFLAGS"
1096 save_LIBS="$LIBS"
1097 dnl Check default zlib install dir
1098 if test -n "${need_dash_r}"; then
1099 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1100 else
1101 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1102 fi
1103 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1104 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001105 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001106 [
1107 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1108 ]
1109 )
1110 ]
1111)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001112
Tim Rice648f8762011-01-26 12:38:57 -08001113AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001114 [ --without-zlib-version-check Disable zlib version check],
1115 [ if test "x$withval" = "xno" ; then
1116 zlib_check_nonfatal=1
1117 fi
1118 ]
1119)
1120
Tim Rice648f8762011-01-26 12:38:57 -08001121AC_MSG_CHECKING([for possibly buggy zlib])
1122AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001123#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001124#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001125#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001126 ]],
1127 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001128 int a=0, b=0, c=0, d=0, n, v;
1129 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1130 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001131 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001132 v = a*1000000 + b*10000 + c*100 + d;
1133 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1134
1135 /* 1.1.4 is OK */
1136 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001137 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001138
Darren Tucker41097ed2005-07-25 15:24:21 +10001139 /* 1.2.3 and up are OK */
1140 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001141 exit(0);
1142
Darren Tucker2dcd2392004-01-23 17:13:33 +11001143 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001144 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001145 AC_MSG_RESULT([no]),
1146 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001147 if test -z "$zlib_check_nonfatal" ; then
1148 AC_MSG_ERROR([*** zlib too old - check config.log ***
1149Your reported zlib version has known security problems. It's possible your
1150vendor has fixed these problems without changing the version number. If you
1151are sure this is the case, you can disable the check by running
1152"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001153If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001154See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001155 else
1156 AC_MSG_WARN([zlib version may have security problems])
1157 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001158 ],
1159 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001160)
Damien Miller6f9c3372000-10-25 10:06:04 +11001161
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001162dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001163AC_CHECK_FUNC([strcasecmp],
1164 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001165)
Tim Rice648f8762011-01-26 12:38:57 -08001166AC_CHECK_FUNCS([utimes],
1167 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001168 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001169)
Damien Millerab18c411999-11-11 10:40:23 +11001170
Tim Ricee589a292001-11-03 11:09:32 -08001171dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001172AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001173AC_SEARCH_LIBS([fmt_scaled], [util bsd])
1174AC_SEARCH_LIBS([login], [util bsd])
1175AC_SEARCH_LIBS([logout], [util bsd])
1176AC_SEARCH_LIBS([logwtmp], [util bsd])
1177AC_SEARCH_LIBS([openpty], [util bsd])
1178AC_SEARCH_LIBS([updwtmp], [util bsd])
1179AC_CHECK_FUNCS([fmt_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001180
Ben Lindstrom8697e082001-02-24 21:41:10 +00001181AC_FUNC_STRFTIME
1182
Damien Miller3c027682001-03-14 11:39:45 +11001183# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001184AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1185AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001186 [
1187 #include <glob.h>
1188 #ifdef GLOB_ALTDIRFUNC
1189 FOUNDIT
1190 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001191 ],
Damien Miller3c027682001-03-14 11:39:45 +11001192 [
Tim Rice648f8762011-01-26 12:38:57 -08001193 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001194 [Define if your system glob() function has
1195 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001196 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001197 ],
1198 [
Tim Rice648f8762011-01-26 12:38:57 -08001199 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001200 ]
1201)
Damien Millerab18c411999-11-11 10:40:23 +11001202
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001203# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001204AC_MSG_CHECKING([for gl_matchc field in glob_t])
1205AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1206 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001207 [
Tim Rice648f8762011-01-26 12:38:57 -08001208 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001209 [Define if your system glob() function has
1210 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001211 AC_MSG_RESULT([yes])
1212 ], [
1213 AC_MSG_RESULT([no])
1214])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001215
Damien Millera6e121a2010-10-07 21:39:17 +11001216# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001217AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1218AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001219#ifndef GLOB_KEEPSTAT
1220#error "glob does not support GLOB_KEEPSTAT extension"
1221#endif
1222glob_t g;
1223g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001224]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001225 [
Tim Rice648f8762011-01-26 12:38:57 -08001226 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001227 [Define if your system glob() function has
1228 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001229 AC_MSG_RESULT([yes])
1230 ], [
1231 AC_MSG_RESULT([no])
1232
1233])
Damien Millera6e121a2010-10-07 21:39:17 +11001234
Tim Rice648f8762011-01-26 12:38:57 -08001235AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001236
Damien Miller18bb4732001-03-28 14:35:30 +10001237AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001238AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001239 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001240#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001241#include <dirent.h>]],
1242 [[
1243 struct dirent d;
1244 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001245 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001246 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001247 [
Tim Rice648f8762011-01-26 12:38:57 -08001248 AC_MSG_RESULT([no])
1249 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001250 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001251 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001252 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001253 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001254 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001255 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001256 ]
1257)
1258
Damien Miller36f49652004-08-15 18:40:59 +10001259AC_MSG_CHECKING([for /proc/pid/fd directory])
1260if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001261 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1262 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001263else
Tim Rice648f8762011-01-26 12:38:57 -08001264 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001265fi
1266
Damien Millerc547bf12001-02-16 10:18:12 +11001267# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001268SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001269AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001270 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001271 [
1272 if test "x$withval" != "xno" ; then
1273
1274 if test "x$withval" != "xyes" ; then
1275 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1276 LDFLAGS="$LDFLAGS -L${withval}/lib"
1277 fi
1278
Tim Rice648f8762011-01-26 12:38:57 -08001279 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001280 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001281 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001282
Tim Rice4cec93f2002-02-26 08:40:48 -08001283 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001284 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001285 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001286#include <stdio.h>
1287#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001288 ]], [[
1289 char *ff = skey_keyinfo(""); ff="";
1290 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001291 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001292 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001293 [
Tim Rice648f8762011-01-26 12:38:57 -08001294 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001295 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1296 ])
Tim Rice648f8762011-01-26 12:38:57 -08001297 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1298 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1299#include <stdio.h>
1300#include <skey.h>
1301 ]], [[
1302 (void)skeychallenge(NULL,"name","",0);
1303 ]])],
1304 [
1305 AC_MSG_RESULT([yes])
1306 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001307 [Define if your skeychallenge()
1308 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001309 [
1310 AC_MSG_RESULT([no])
1311 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001312 fi
1313 ]
1314)
1315
1316# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001317TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001318AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001319 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001320 [
1321 if test "x$withval" != "xno" ; then
1322 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001323 saved_LDFLAGS="$LDFLAGS"
1324 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001325 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001326 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001327 if test -d "${withval}/lib"; then
1328 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001329 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001330 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001331 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001332 fi
1333 else
1334 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001335 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001336 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001337 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001338 fi
1339 fi
1340 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001341 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001342 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001343 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001344 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001345 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001346 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001347 AC_MSG_CHECKING([for libwrap])
1348 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001349#include <sys/types.h>
1350#include <sys/socket.h>
1351#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001352#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001353int deny_severity = 0, allow_severity = 0;
1354 ]], [[
1355 hosts_access(0);
1356 ]])], [
1357 AC_MSG_RESULT([yes])
1358 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001359 [Define if you want
1360 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001361 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001362 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001363 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001364 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001365
1366 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001367 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001368 fi
1369 ]
1370)
1371
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001372# Check whether user wants to use ldns
1373LDNS_MSG="no"
1374AC_ARG_WITH(ldns,
1375 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1376 [
1377 if test "x$withval" != "xno" ; then
1378
1379 if test "x$withval" != "xyes" ; then
1380 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1381 LDFLAGS="$LDFLAGS -L${withval}/lib"
1382 fi
1383
1384 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1385 LIBS="-lldns $LIBS"
1386 LDNS_MSG="yes"
1387
1388 AC_MSG_CHECKING([for ldns support])
1389 AC_LINK_IFELSE(
1390 [AC_LANG_SOURCE([[
1391#include <stdio.h>
1392#include <stdlib.h>
1393#include <stdint.h>
1394#include <ldns/ldns.h>
1395int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1396 ]])
1397 ],
1398 [AC_MSG_RESULT(yes)],
1399 [
1400 AC_MSG_RESULT(no)
1401 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1402 ])
1403 fi
1404 ]
1405)
1406
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001407# Check whether user wants libedit support
1408LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001409AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001410 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001411 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001412 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001413 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001414 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001415 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001416 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001417 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001418 use_pkgconfig_for_libedit=yes
1419 else
Tim Rice648f8762011-01-26 12:38:57 -08001420 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001421 fi
1422 fi
1423 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001424 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1425 if test -n "${need_dash_r}"; then
1426 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1427 else
1428 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1429 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001430 fi
Damien Miller1f789802010-10-11 22:35:22 +11001431 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001432 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1433 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1434 else
1435 LIBEDIT="-ledit -lcurses"
1436 fi
1437 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001438 AC_CHECK_LIB([edit], [el_init],
1439 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001440 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001441 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001442 ],
Tim Rice648f8762011-01-26 12:38:57 -08001443 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001444 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001445 )
Tim Rice648f8762011-01-26 12:38:57 -08001446 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001447 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001448 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1449 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001450 int i = H_SETSIZE;
1451 el_init("", NULL, NULL, NULL);
1452 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001453 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001454 [ AC_MSG_RESULT([yes]) ],
1455 [ AC_MSG_RESULT([no])
1456 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001457 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001458 fi ]
1459)
1460
Darren Tuckerd9f88912005-02-20 21:01:48 +11001461AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001462AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001463 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001464 [
Tim Rice648f8762011-01-26 12:38:57 -08001465 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001466 case "$withval" in
1467 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001468 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001469 AUDIT_MODULE=bsm
1470 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001471 AC_CHECK_HEADERS([bsm/audit.h], [],
1472 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001473 [
1474#ifdef HAVE_TIME_H
1475# include <time.h>
1476#endif
1477 ]
1478)
Tim Rice648f8762011-01-26 12:38:57 -08001479 AC_CHECK_LIB([bsm], [getaudit], [],
1480 [AC_MSG_ERROR([BSM enabled and required library not found])])
1481 AC_CHECK_FUNCS([getaudit], [],
1482 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001483 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001484 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1485 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker93a2d412012-02-24 10:40:41 +11001486 if test "$sol2ver" -eq 11; then
1487 SSHDLIBS="$SSHDLIBS -lscf"
1488 AC_DEFINE([BROKEN_BSM_API], [1],
1489 [The system has incomplete BSM API])
1490 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001491 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001492 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001493 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001494 AUDIT_MODULE=linux
1495 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001496 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001497 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001498 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001499 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001500 debug)
1501 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001502 AC_MSG_RESULT([debug])
1503 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001504 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001505 no)
Tim Rice648f8762011-01-26 12:38:57 -08001506 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001507 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001508 *)
1509 AC_MSG_ERROR([Unknown audit module $withval])
1510 ;;
1511 esac ]
1512)
1513
Damien Millerfe1f1432003-02-24 15:45:42 +11001514dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001515AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001516 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001517 arc4random_buf \
1518 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001519 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001520 b64_ntop \
1521 __b64_ntop \
1522 b64_pton \
1523 __b64_pton \
1524 bcopy \
1525 bindresvport_sa \
1526 clock \
1527 closefrom \
1528 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001529 fchmod \
1530 fchown \
1531 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001532 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001533 futimes \
1534 getaddrinfo \
1535 getcwd \
1536 getgrouplist \
1537 getnameinfo \
1538 getopt \
1539 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001540 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001541 getpgid \
1542 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001543 _getpty \
1544 getrlimit \
1545 getttyent \
1546 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001547 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001548 inet_aton \
1549 inet_ntoa \
1550 inet_ntop \
1551 innetgr \
1552 login_getcapbool \
1553 md5_crypt \
1554 memmove \
1555 mkdtemp \
1556 mmap \
1557 ngetaddrinfo \
1558 nsleep \
1559 ogetaddrinfo \
1560 openlog_r \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001561 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001562 prctl \
1563 pstat \
1564 readpassphrase \
1565 realpath \
1566 recvmsg \
1567 rresvport_af \
1568 sendmsg \
1569 setdtablesize \
1570 setegid \
1571 setenv \
1572 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001573 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001574 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001575 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001576 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001577 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001578 setpcred \
1579 setproctitle \
1580 setregid \
1581 setreuid \
1582 setrlimit \
1583 setsid \
1584 setvbuf \
1585 sigaction \
1586 sigvec \
1587 snprintf \
1588 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001589 statfs \
1590 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001591 strdup \
1592 strerror \
1593 strlcat \
1594 strlcpy \
1595 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001596 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001597 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001598 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001599 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001600 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001601 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001602 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001603 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001604 sysconf \
1605 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001606 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001607 truncate \
1608 unsetenv \
1609 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001610 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001611 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001612 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001613 vhangup \
1614 vsnprintf \
1615 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001616])
Tim Rice13aae5e2001-10-21 17:53:58 -07001617
Tim Ricec7a8af02010-11-08 14:26:23 -08001618AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001619 [AC_LANG_PROGRAM(
1620 [[ #include <ctype.h> ]],
1621 [[ return (isblank('a')); ]])],
1622 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001623])
1624
Damien Millerb3c9f782010-02-12 10:11:34 +11001625# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001626AC_SEARCH_LIBS([dlopen], [dl],
1627 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001628)
1629
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001630# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001631AC_CHECK_FUNCS([gai_strerror], [
1632 AC_DEFINE([HAVE_GAI_STRERROR])
1633 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001634#include <sys/types.h>
1635#include <sys/socket.h>
1636#include <netdb.h>
1637
Tim Rice648f8762011-01-26 12:38:57 -08001638const char *gai_strerror(int);
1639 ]], [[
1640 char *str;
1641 str = gai_strerror(0);
1642 ]])], [
1643 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1644 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001645
Tim Rice648f8762011-01-26 12:38:57 -08001646AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1647 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001648
Darren Tuckerf1159b52003-07-07 19:44:01 +10001649dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001650AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1651AC_CHECK_DECL([strsep],
1652 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001653 [],
1654 [
1655#ifdef HAVE_STRING_H
1656# include <string.h>
1657#endif
1658 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001659
Darren Tuckerb2427c82003-09-10 15:22:44 +10001660dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001661AC_CHECK_DECL([tcsendbreak],
1662 [AC_DEFINE([HAVE_TCSENDBREAK])],
1663 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001664 [#include <termios.h>]
1665)
1666
Tim Rice648f8762011-01-26 12:38:57 -08001667AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001668
Tim Rice648f8762011-01-26 12:38:57 -08001669AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001670 [
1671#include <sys/types.h>
1672#include <sys/socket.h>
1673 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001674
Tim Rice648f8762011-01-26 12:38:57 -08001675AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001676 [
1677#include <sys/types.h>
1678#ifdef HAVE_SYS_STAT_H
1679# include <sys/stat.h>
1680#endif
1681#ifdef HAVE_FCNTL_H
1682# include <fcntl.h>
1683#endif
1684 ])
1685
Tim Rice648f8762011-01-26 12:38:57 -08001686AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001687#include <sys/types.h>
1688#include <sys/uio.h>
1689#include <unistd.h>
1690 ])
1691
Tim Rice648f8762011-01-26 12:38:57 -08001692AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001693#include <sys/param.h>
1694 ])
1695
Tim Rice648f8762011-01-26 12:38:57 -08001696AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001697#include <stddef.h>
1698 ])
1699
Tim Rice648f8762011-01-26 12:38:57 -08001700AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001701 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001702 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001703 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001704 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001705#include <stdlib.h>
1706#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001707 ]], [[
1708 errno=0;
1709 setresuid(0,0,0);
1710 if (errno==ENOSYS)
1711 exit(1);
1712 else
1713 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001714 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001715 [AC_MSG_RESULT([yes])],
1716 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001717 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001718 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001719 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001720 )
1721])
Darren Tuckere937be32003-12-17 18:53:26 +11001722
Tim Rice648f8762011-01-26 12:38:57 -08001723AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001724 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001725 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001726 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001727 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001728#include <stdlib.h>
1729#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001730 ]], [[
1731 errno=0;
1732 setresgid(0,0,0);
1733 if (errno==ENOSYS)
1734 exit(1);
1735 else
1736 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001737 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001738 [AC_MSG_RESULT([yes])],
1739 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001740 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001741 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001742 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001743 )
1744])
Darren Tuckere937be32003-12-17 18:53:26 +11001745
Damien Millerad833b32000-08-23 10:46:23 +10001746dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001747AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001748dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001749AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1750AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001751dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001752AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1753AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001754dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001755AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001756
Tim Rice648f8762011-01-26 12:38:57 -08001757AC_CHECK_FUNC([daemon],
1758 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1759 [AC_CHECK_LIB([bsd], [daemon],
1760 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001761)
1762
Tim Rice648f8762011-01-26 12:38:57 -08001763AC_CHECK_FUNC([getpagesize],
1764 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001765 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001766 [AC_CHECK_LIB([ucb], [getpagesize],
1767 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001768)
1769
Damien Millercb170cb2000-07-01 16:52:55 +10001770# Check for broken snprintf
1771if test "x$ac_cv_func_snprintf" = "xyes" ; then
1772 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001773 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001774 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1775 [[
1776 char b[5];
1777 snprintf(b,5,"123456789");
1778 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001779 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001780 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001781 [
Tim Rice648f8762011-01-26 12:38:57 -08001782 AC_MSG_RESULT([no])
1783 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001784 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001785 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001786 ],
1787 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001788 )
1789fi
1790
Damien Miller57f39152005-11-24 19:58:19 +11001791# If we don't have a working asprintf, then we strongly depend on vsnprintf
1792# returning the right thing on overflow: the number of characters it tried to
1793# create (as per SUSv3)
1794if test "x$ac_cv_func_asprintf" != "xyes" && \
1795 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1796 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1797 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001798 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001799#include <sys/types.h>
1800#include <stdio.h>
1801#include <stdarg.h>
1802
1803int x_snprintf(char *str,size_t count,const char *fmt,...)
1804{
1805 size_t ret; va_list ap;
1806 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1807 return ret;
1808}
Tim Rice648f8762011-01-26 12:38:57 -08001809 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001810 char x[1];
1811 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001812 ]])],
1813 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001814 [
Tim Rice648f8762011-01-26 12:38:57 -08001815 AC_MSG_RESULT([no])
1816 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001817 [Define if your snprintf is busted])
1818 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1819 ],
1820 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1821 )
1822fi
1823
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001824# On systems where [v]snprintf is broken, but is declared in stdio,
1825# check that the fmt argument is const char * or just char *.
1826# This is only useful for when BROKEN_SNPRINTF
1827AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001828AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1829#include <stdio.h>
1830int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1831 ]], [[
1832 snprintf(0, 0, 0);
1833 ]])],
1834 [AC_MSG_RESULT([yes])
1835 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001836 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001837 [AC_MSG_RESULT([no])
1838 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001839
Damien Millerb4097182004-05-23 14:09:40 +10001840# Check for missing getpeereid (or equiv) support
1841NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001842if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001843 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001844 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1845#include <sys/types.h>
1846#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1847 [ AC_MSG_RESULT([yes])
1848 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1849 ], [AC_MSG_RESULT([no])
1850 NO_PEERCHECK=1
1851 ])
Damien Millerb4097182004-05-23 14:09:40 +10001852fi
1853
Damien Millere8328192003-01-07 15:18:32 +11001854dnl see whether mkstemp() requires XXXXXX
1855if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1856AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001857AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001858 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001859#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001860 ]], [[
1861 char template[]="conftest.mkstemp-test";
1862 if (mkstemp(template) == -1)
1863 exit(1);
1864 unlink(template);
1865 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001866 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001867 [
Tim Rice648f8762011-01-26 12:38:57 -08001868 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001869 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001870 [
Tim Rice648f8762011-01-26 12:38:57 -08001871 AC_MSG_RESULT([yes])
1872 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001873 ],
1874 [
Tim Rice648f8762011-01-26 12:38:57 -08001875 AC_MSG_RESULT([yes])
1876 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001877 ]
Damien Millere8328192003-01-07 15:18:32 +11001878)
1879fi
1880
Darren Tucker70a3d552003-08-21 17:58:29 +10001881dnl make sure that openpty does not reacquire controlling terminal
1882if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001883 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001884 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001885 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001886#include <stdio.h>
1887#include <sys/fcntl.h>
1888#include <sys/types.h>
1889#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001890 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001891 pid_t pid;
1892 int fd, ptyfd, ttyfd, status;
1893
1894 pid = fork();
1895 if (pid < 0) { /* failed */
1896 exit(1);
1897 } else if (pid > 0) { /* parent */
1898 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001899 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001900 exit(WEXITSTATUS(status));
1901 else
1902 exit(2);
1903 } else { /* child */
1904 close(0); close(1); close(2);
1905 setsid();
1906 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1907 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1908 if (fd >= 0)
1909 exit(3); /* Acquired ctty: broken */
1910 else
1911 exit(0); /* Did not acquire ctty: OK */
1912 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001913 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001914 [
Tim Rice648f8762011-01-26 12:38:57 -08001915 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001916 ],
1917 [
Tim Rice648f8762011-01-26 12:38:57 -08001918 AC_MSG_RESULT([no])
1919 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001920 ],
1921 [
Tim Rice648f8762011-01-26 12:38:57 -08001922 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001923 ]
1924 )
1925fi
1926
Tim Rice8bb561b2005-03-17 16:23:19 -08001927if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1928 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001929 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001930 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001931 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001932#include <stdio.h>
1933#include <sys/socket.h>
1934#include <netdb.h>
1935#include <errno.h>
1936#include <netinet/in.h>
1937
1938#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001939 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001940 int err, sock;
1941 struct addrinfo *gai_ai, *ai, hints;
1942 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1943
1944 memset(&hints, 0, sizeof(hints));
1945 hints.ai_family = PF_UNSPEC;
1946 hints.ai_socktype = SOCK_STREAM;
1947 hints.ai_flags = AI_PASSIVE;
1948
1949 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1950 if (err != 0) {
1951 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1952 exit(1);
1953 }
1954
1955 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1956 if (ai->ai_family != AF_INET6)
1957 continue;
1958
1959 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1960 sizeof(ntop), strport, sizeof(strport),
1961 NI_NUMERICHOST|NI_NUMERICSERV);
1962
1963 if (err != 0) {
1964 if (err == EAI_SYSTEM)
1965 perror("getnameinfo EAI_SYSTEM");
1966 else
1967 fprintf(stderr, "getnameinfo failed: %s\n",
1968 gai_strerror(err));
1969 exit(2);
1970 }
1971
1972 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1973 if (sock < 0)
1974 perror("socket");
1975 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1976 if (errno == EBADF)
1977 exit(3);
1978 }
1979 }
1980 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001981 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001982 [
Tim Rice648f8762011-01-26 12:38:57 -08001983 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001984 ],
1985 [
Tim Rice648f8762011-01-26 12:38:57 -08001986 AC_MSG_RESULT([no])
1987 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001988 ],
1989 [
Tim Rice648f8762011-01-26 12:38:57 -08001990 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001991 ]
1992 )
1993fi
1994
Tim Rice8bb561b2005-03-17 16:23:19 -08001995if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1996 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001997 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001998 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001999 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002000#include <stdio.h>
2001#include <sys/socket.h>
2002#include <netdb.h>
2003#include <errno.h>
2004#include <netinet/in.h>
2005
2006#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002007 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002008 int err, sock;
2009 struct addrinfo *gai_ai, *ai, hints;
2010 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2011
2012 memset(&hints, 0, sizeof(hints));
2013 hints.ai_family = PF_UNSPEC;
2014 hints.ai_socktype = SOCK_STREAM;
2015 hints.ai_flags = AI_PASSIVE;
2016
2017 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2018 if (err != 0) {
2019 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2020 exit(1);
2021 }
2022
2023 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2024 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2025 continue;
2026
2027 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2028 sizeof(ntop), strport, sizeof(strport),
2029 NI_NUMERICHOST|NI_NUMERICSERV);
2030
2031 if (ai->ai_family == AF_INET && err != 0) {
2032 perror("getnameinfo");
2033 exit(2);
2034 }
2035 }
2036 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002037 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002038 [
Tim Rice648f8762011-01-26 12:38:57 -08002039 AC_MSG_RESULT([yes])
2040 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002041 [Define if you have a getaddrinfo that fails
2042 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002043 ],
2044 [
Tim Rice648f8762011-01-26 12:38:57 -08002045 AC_MSG_RESULT([no])
2046 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002047 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002048 [
Tim Rice648f8762011-01-26 12:38:57 -08002049 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002050 ]
2051 )
2052fi
2053
Darren Tuckera56f1912004-11-02 20:30:54 +11002054if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002055 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2056 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2057 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002058 [
Tim Rice648f8762011-01-26 12:38:57 -08002059 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002060 ],
2061 [
Tim Rice648f8762011-01-26 12:38:57 -08002062 AC_MSG_RESULT([yes])
2063 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002064 [Conflicting defs for getspnam])
2065 ]
2066 )
2067fi
2068
Damien Miller606f8802000-09-16 15:39:56 +11002069AC_FUNC_GETPGRP
2070
Tim Riceaef73712002-05-11 13:17:42 -07002071# Search for OpenSSL
2072saved_CPPFLAGS="$CPPFLAGS"
2073saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002074AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002075 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2076 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002077 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002078 case "$withval" in
2079 # Relative paths
2080 ./*|../*) withval="`pwd`/$withval"
2081 esac
Tim Riceaef73712002-05-11 13:17:42 -07002082 if test -d "$withval/lib"; then
2083 if test -n "${need_dash_r}"; then
2084 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2085 else
2086 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2087 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002088 elif test -d "$withval/lib64"; then
2089 if test -n "${need_dash_r}"; then
2090 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2091 else
2092 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2093 fi
Tim Riceaef73712002-05-11 13:17:42 -07002094 else
2095 if test -n "${need_dash_r}"; then
2096 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2097 else
2098 LDFLAGS="-L${withval} ${LDFLAGS}"
2099 fi
2100 fi
2101 if test -d "$withval/include"; then
2102 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2103 else
2104 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2105 fi
Damien Millera22ba012000-03-02 23:09:20 +11002106 fi
2107 ]
2108)
Tim Rice3d5352e2004-02-12 09:27:21 -08002109LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002110AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002111 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002112 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002113 [
Tim Riceaef73712002-05-11 13:17:42 -07002114 dnl Check default openssl install dir
2115 if test -n "${need_dash_r}"; then
2116 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002117 else
Tim Riceaef73712002-05-11 13:17:42 -07002118 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002119 fi
Tim Riceaef73712002-05-11 13:17:42 -07002120 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002121 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002122 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2123 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002124 [
2125 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2126 ]
2127 )
2128 ]
2129)
2130
Tim Riced730b782002-08-13 18:52:10 -07002131# Determine OpenSSL header version
2132AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002133AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002134 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002135#include <stdio.h>
2136#include <string.h>
2137#include <openssl/opensslv.h>
2138#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002139 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002140 FILE *fd;
2141 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002142
Damien Millera8e06ce2003-11-21 23:48:55 +11002143 fd = fopen(DATA,"w");
2144 if(fd == NULL)
2145 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002146
2147 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2148 exit(1);
2149
2150 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002151 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002152 [
2153 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002154 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002155 ],
2156 [
Tim Rice648f8762011-01-26 12:38:57 -08002157 AC_MSG_RESULT([not found])
2158 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002159 ],
2160 [
2161 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002162 ]
2163)
2164
2165# Determine OpenSSL library version
2166AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002167AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002168 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002169#include <stdio.h>
2170#include <string.h>
2171#include <openssl/opensslv.h>
2172#include <openssl/crypto.h>
2173#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002174 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002175 FILE *fd;
2176 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002177
Damien Millera8e06ce2003-11-21 23:48:55 +11002178 fd = fopen(DATA,"w");
2179 if(fd == NULL)
2180 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002181
2182 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2183 exit(1);
2184
2185 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002186 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002187 [
2188 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002189 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002190 ],
2191 [
Tim Rice648f8762011-01-26 12:38:57 -08002192 AC_MSG_RESULT([not found])
2193 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002194 ],
2195 [
2196 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002197 ]
2198)
Damien Millera22ba012000-03-02 23:09:20 +11002199
Tim Rice648f8762011-01-26 12:38:57 -08002200AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002201 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2202 [ if test "x$withval" = "xno" ; then
2203 openssl_check_nonfatal=1
2204 fi
2205 ]
2206)
2207
Damien Millerec932372002-01-22 22:16:03 +11002208# Sanity check OpenSSL headers
2209AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002210AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002211 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002212#include <string.h>
2213#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002214 ]], [[
2215 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002216 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002217 [
Tim Rice648f8762011-01-26 12:38:57 -08002218 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002219 ],
2220 [
Tim Rice648f8762011-01-26 12:38:57 -08002221 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002222 if test "x$openssl_check_nonfatal" = "x"; then
2223 AC_MSG_ERROR([Your OpenSSL headers do not match your
2224library. Check config.log for details.
2225If you are sure your installation is consistent, you can disable the check
2226by running "./configure --without-openssl-header-check".
2227Also see contrib/findssl.sh for help identifying header/library mismatches.
2228])
2229 else
2230 AC_MSG_WARN([Your OpenSSL headers do not match your
2231library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002232Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002233 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002234 ],
2235 [
2236 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002237 ]
2238)
2239
Darren Tucker639bbe82006-08-20 20:17:53 +10002240AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2241AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002242 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2243 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002244 [
Tim Rice648f8762011-01-26 12:38:57 -08002245 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002246 ],
2247 [
Tim Rice648f8762011-01-26 12:38:57 -08002248 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002249 saved_LIBS="$LIBS"
2250 LIBS="$LIBS -ldl"
2251 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2252 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002253 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2254 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002255 [
Tim Rice648f8762011-01-26 12:38:57 -08002256 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002257 ],
2258 [
Tim Rice648f8762011-01-26 12:38:57 -08002259 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002260 LIBS="$saved_LIBS"
2261 ]
2262 )
2263 ]
2264)
2265
Darren Tuckere9b3ad72012-01-17 14:03:34 +11002266AC_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 +11002267
Tim Rice648f8762011-01-26 12:38:57 -08002268AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002269 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2270 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002271 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2272 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2273#include <openssl/engine.h>
2274 ]], [[
2275 ENGINE_load_builtin_engines();
2276 ENGINE_register_all_complete();
2277 ]])],
2278 [ AC_MSG_RESULT([yes])
2279 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002280 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002281 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2282 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002283 fi ]
2284)
2285
Darren Tucker129d0bb2005-12-19 17:40:40 +11002286# Check for OpenSSL without EVP_aes_{192,256}_cbc
2287AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002288AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002289 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002290#include <string.h>
2291#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002292 ]], [[
2293 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002294 ]])],
2295 [
Tim Rice648f8762011-01-26 12:38:57 -08002296 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002297 ],
2298 [
Tim Rice648f8762011-01-26 12:38:57 -08002299 AC_MSG_RESULT([yes])
2300 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002301 [libcrypto is missing AES 192 and 256 bit functions])
2302 ]
2303)
2304
Damien Miller25a02b02012-12-13 08:18:56 +11002305# Check for OpenSSL with EVP_aes_*ctr
2306AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2307AC_LINK_IFELSE(
2308 [AC_LANG_PROGRAM([[
2309#include <string.h>
2310#include <openssl/evp.h>
2311 ]], [[
2312 exit(EVP_aes_128_ctr() == NULL ||
2313 EVP_aes_192_cbc() == NULL ||
2314 EVP_aes_256_cbc() == NULL);
2315 ]])],
2316 [
2317 AC_MSG_RESULT([yes])
2318 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2319 [libcrypto has EVP AES CTR])
2320 ],
2321 [
2322 AC_MSG_RESULT([no])
2323 ]
2324)
2325
Damien Millerd522c682013-01-09 16:42:47 +11002326# Check for OpenSSL with EVP_aes_*gcm
2327AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2328AC_LINK_IFELSE(
2329 [AC_LANG_PROGRAM([[
2330#include <string.h>
2331#include <openssl/evp.h>
2332 ]], [[
2333 exit(EVP_aes_128_gcm() == NULL ||
Damien Millerb6f73b32013-02-11 10:39:12 +11002334 EVP_aes_256_gcm() == NULL ||
2335 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2336 EVP_CTRL_GCM_IV_GEN == 0 ||
2337 EVP_CTRL_GCM_SET_TAG == 0 ||
2338 EVP_CTRL_GCM_GET_TAG == 0 ||
2339 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
Damien Millerd522c682013-01-09 16:42:47 +11002340 ]])],
2341 [
2342 AC_MSG_RESULT([yes])
2343 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2344 [libcrypto has EVP AES GCM])
2345 ],
2346 [
2347 AC_MSG_RESULT([no])
2348 ]
2349)
2350
Damien Millerb6f73b32013-02-11 10:39:12 +11002351AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2352 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2353 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2354
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002355AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2356AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002357 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002358#include <string.h>
2359#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002360 ]], [[
2361 if(EVP_DigestUpdate(NULL, NULL,0))
2362 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002363 ]])],
2364 [
Tim Rice648f8762011-01-26 12:38:57 -08002365 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002366 ],
2367 [
Tim Rice648f8762011-01-26 12:38:57 -08002368 AC_MSG_RESULT([no])
2369 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002370 [Define if EVP_DigestUpdate returns void])
2371 ]
2372)
2373
Tim Rice3d5352e2004-02-12 09:27:21 -08002374# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2375# because the system crypt() is more featureful.
2376if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002377 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002378fi
2379
Damien Millera8e06ce2003-11-21 23:48:55 +11002380# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002381# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002382if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002383 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002384fi
2385
Damien Milleraf87af12006-03-15 13:02:28 +11002386# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002387AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002388 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002389AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002390
Damien Miller6af914a2010-09-10 11:39:26 +10002391# Check complete ECC support in OpenSSL
2392AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2393AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002394 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002395#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002396#include <openssl/ecdh.h>
2397#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002398#include <openssl/evp.h>
2399#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002400#include <openssl/opensslv.h>
2401#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2402# error "OpenSSL < 0.9.8g has unreliable ECC code"
2403#endif
Tim Rice648f8762011-01-26 12:38:57 -08002404 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002405 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2406 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002407 ]])],
2408 [
Tim Rice648f8762011-01-26 12:38:57 -08002409 AC_MSG_RESULT([yes])
2410 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002411 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002412 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002413 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002414 ],
2415 [
Tim Rice648f8762011-01-26 12:38:57 -08002416 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002417 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002418 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002419 ]
2420)
Tim Rice648f8762011-01-26 12:38:57 -08002421AC_SUBST([TEST_SSH_ECC])
2422AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002423
Tim Rice99203ec2007-03-26 09:35:28 -07002424saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002425AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002426 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002427 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2428 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002429 [Define if system has libiaf that supports set_id])
2430 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002431])
2432LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002433
2434### Configure cryptographic random number support
2435
2436# Check wheter OpenSSL seeds itself
2437AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002438AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002439 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002440#include <string.h>
2441#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002442 ]], [[
2443 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002444 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002445 [
2446 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002447 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002448 ],
2449 [
Tim Rice648f8762011-01-26 12:38:57 -08002450 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002451 ],
2452 [
2453 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002454 # This is safe, since we will fatal() at runtime if
2455 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002456 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002457 ]
2458)
2459
Damien Millerf22019b2011-05-05 13:48:37 +10002460# PRNGD TCP socket
2461AC_ARG_WITH([prngd-port],
2462 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2463 [
2464 case "$withval" in
2465 no)
2466 withval=""
2467 ;;
2468 [[0-9]]*)
2469 ;;
2470 *)
2471 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2472 ;;
2473 esac
2474 if test ! -z "$withval" ; then
2475 PRNGD_PORT="$withval"
2476 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2477 [Port number of PRNGD/EGD random number socket])
2478 fi
2479 ]
2480)
2481
2482# PRNGD Unix domain socket
2483AC_ARG_WITH([prngd-socket],
2484 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2485 [
2486 case "$withval" in
2487 yes)
2488 withval="/var/run/egd-pool"
2489 ;;
2490 no)
2491 withval=""
2492 ;;
2493 /*)
2494 ;;
2495 *)
2496 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2497 ;;
2498 esac
2499
2500 if test ! -z "$withval" ; then
2501 if test ! -z "$PRNGD_PORT" ; then
2502 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2503 fi
2504 if test ! -r "$withval" ; then
2505 AC_MSG_WARN([Entropy socket is not readable])
2506 fi
2507 PRNGD_SOCKET="$withval"
2508 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2509 [Location of PRNGD/EGD random number socket])
2510 fi
2511 ],
2512 [
2513 # Check for existing socket only if we don't have a random device already
2514 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2515 AC_MSG_CHECKING([for PRNGD/EGD socket])
2516 # Insert other locations here
2517 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2518 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2519 PRNGD_SOCKET="$sock"
2520 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2521 break;
2522 fi
2523 done
2524 if test ! -z "$PRNGD_SOCKET" ; then
2525 AC_MSG_RESULT([$PRNGD_SOCKET])
2526 else
2527 AC_MSG_RESULT([not found])
2528 fi
2529 fi
2530 ]
2531)
2532
2533# Which randomness source do we use?
2534if test ! -z "$PRNGD_PORT" ; then
2535 RAND_MSG="PRNGd port $PRNGD_PORT"
2536elif test ! -z "$PRNGD_SOCKET" ; then
2537 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2538elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2539 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2540 [Define if you want OpenSSL's internally seeded PRNG only])
2541 RAND_MSG="OpenSSL internal ONLY"
2542else
2543 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])
2544fi
2545
Darren Tucker3e6bde42006-08-20 20:03:50 +10002546# Check for PAM libs
2547PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002548AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002549 [ --with-pam Enable PAM support ],
2550 [
2551 if test "x$withval" != "xno" ; then
2552 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2553 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2554 AC_MSG_ERROR([PAM headers not found])
2555 fi
2556
2557 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002558 AC_CHECK_LIB([dl], [dlopen], , )
2559 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2560 AC_CHECK_FUNCS([pam_getenvlist])
2561 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002562 LIBS="$saved_LIBS"
2563
2564 PAM_MSG="yes"
2565
Darren Tucker20e9f972007-03-25 18:26:01 +10002566 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002567 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002568 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002569
Darren Tucker3e6bde42006-08-20 20:03:50 +10002570 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002571 case "$LIBS" in
2572 *-ldl*)
2573 # libdl already in LIBS
2574 ;;
2575 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002576 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002577 ;;
2578 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002579 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002580 fi
2581 ]
2582)
2583
2584# Check for older PAM
2585if test "x$PAM_MSG" = "xyes" ; then
2586 # Check PAM strerror arguments (old PAM)
2587 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002589#include <stdlib.h>
2590#if defined(HAVE_SECURITY_PAM_APPL_H)
2591#include <security/pam_appl.h>
2592#elif defined (HAVE_PAM_PAM_APPL_H)
2593#include <pam/pam_appl.h>
2594#endif
Tim Rice648f8762011-01-26 12:38:57 -08002595 ]], [[
2596(void)pam_strerror((pam_handle_t *)NULL, -1);
2597 ]])], [AC_MSG_RESULT([no])], [
2598 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002599 [Define if you have an old version of PAM
2600 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002601 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002602 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002603
2604 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002605fi
Damien Miller6c21c512002-01-22 21:57:53 +11002606
Damien Millerd3f6ad22002-06-25 10:24:47 +10002607SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002608AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002609 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002610 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002611 if test -n "$withval" && test "x$withval" != "xno" && \
2612 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002613 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002614 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002615 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002616)
Tim Rice648f8762011-01-26 12:38:57 -08002617AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002618 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002619AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002620
Damien Miller91f40d82013-02-22 11:37:00 +11002621if test "x$have_linux_no_new_privs" = "x1" ; then
2622AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2623 #include <sys/types.h>
2624 #include <linux/seccomp.h>
2625])
2626fi
2627if test "x$have_seccomp_filter" = "x1" ; then
2628AC_MSG_CHECKING([kernel for seccomp_filter support])
2629AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2630 #include <errno.h>
2631 #include <elf.h>
2632 #include <linux/audit.h>
2633 #include <linux/seccomp.h>
2634 #include <stdlib.h>
2635 #include <sys/prctl.h>
2636 ]],
2637 [[ int i = $seccomp_audit_arch;
2638 errno = 0;
2639 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2640 exit(errno == EFAULT ? 0 : 1); ]])],
2641 [ AC_MSG_RESULT([yes]) ], [
2642 AC_MSG_RESULT([no])
2643 # Disable seccomp filter as a target
2644 have_seccomp_filter=0
2645 ]
2646)
2647fi
2648
Damien Miller69ff1df2011-06-23 08:30:03 +10002649# Decide which sandbox style to use
2650sandbox_arg=""
2651AC_ARG_WITH([sandbox],
Damien Millere0956e32012-04-04 11:27:54 +10002652 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002653 [
2654 if test "x$withval" = "xyes" ; then
2655 sandbox_arg=""
2656 else
2657 sandbox_arg="$withval"
2658 fi
2659 ]
2660)
Darren Tucker60395f92012-07-03 14:31:18 +10002661
2662# Some platforms (seems to be the ones that have a kernel poll(2)-type
2663# function with which they implement select(2)) use an extra file descriptor
2664# when calling select(2), which means we can't use the rlimit sandbox.
2665AC_MSG_CHECKING([if select works with descriptor rlimit])
2666AC_RUN_IFELSE(
2667 [AC_LANG_PROGRAM([[
2668#include <sys/types.h>
2669#ifdef HAVE_SYS_TIME_H
2670# include <sys/time.h>
2671#endif
2672#include <sys/resource.h>
2673#ifdef HAVE_SYS_SELECT_H
2674# include <sys/select.h>
2675#endif
2676#include <errno.h>
2677#include <fcntl.h>
2678#include <stdlib.h>
2679 ]],[[
2680 struct rlimit rl_zero;
2681 int fd, r;
2682 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002683 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002684
2685 fd = open("/dev/null", O_RDONLY);
2686 FD_ZERO(&fds);
2687 FD_SET(fd, &fds);
2688 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2689 setrlimit(RLIMIT_FSIZE, &rl_zero);
2690 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002691 tv.tv_sec = 1;
2692 tv.tv_usec = 0;
2693 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002694 exit (r == -1 ? 1 : 0);
2695 ]])],
2696 [AC_MSG_RESULT([yes])
2697 select_works_with_rlimit=yes],
2698 [AC_MSG_RESULT([no])
2699 select_works_with_rlimit=no],
2700 [AC_MSG_WARN([cross compiling: assuming yes])]
2701)
2702
Darren Tuckerff008de2013-03-06 17:48:48 +11002703AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2704AC_RUN_IFELSE(
2705 [AC_LANG_PROGRAM([[
2706#include <sys/types.h>
2707#ifdef HAVE_SYS_TIME_H
2708# include <sys/time.h>
2709#endif
2710#include <sys/resource.h>
2711#include <errno.h>
2712#include <stdlib.h>
2713 ]],[[
2714 struct rlimit rl_zero;
2715 int fd, r;
2716 fd_set fds;
2717
2718 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2719 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2720 exit (r == -1 ? 1 : 0);
2721 ]])],
2722 [AC_MSG_RESULT([yes])
2723 rlimit_nofile_zero_works=yes],
2724 [AC_MSG_RESULT([no])
2725 rlimit_nofile_zero_works=no],
2726 [AC_MSG_WARN([cross compiling: assuming yes])]
2727)
2728
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002729AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2730AC_RUN_IFELSE(
2731 [AC_LANG_PROGRAM([[
2732#include <sys/types.h>
2733#include <sys/resource.h>
2734#include <stdlib.h>
2735 ]],[[
2736 struct rlimit rl_zero;
2737
2738 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2739 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2740 ]])],
2741 [AC_MSG_RESULT([yes])],
2742 [AC_MSG_RESULT([no])
2743 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
2744 [setrlimit RLIMIT_FSIZE works])],
2745 [AC_MSG_WARN([cross compiling: assuming yes])]
2746)
2747
Damien Miller69ff1df2011-06-23 08:30:03 +10002748if test "x$sandbox_arg" = "xsystrace" || \
2749 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002750 test "x$have_systr_policy_kill" != "x1" && \
2751 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002752 SANDBOX_STYLE="systrace"
2753 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002754elif test "x$sandbox_arg" = "xdarwin" || \
2755 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2756 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002757 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2758 "x$ac_cv_header_sandbox_h" != "xyes" && \
2759 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002760 SANDBOX_STYLE="darwin"
2761 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10002762elif test "x$sandbox_arg" = "xseccomp_filter" || \
2763 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10002764 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002765 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10002766 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002767 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
2768 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002769 test "x$have_linux_no_new_privs" = "x1" && \
2770 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11002771 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002772 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
2773 test "x$have_linux_no_new_privs" != "x1" && \
2774 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
2775 test "x$have_seccomp_filter" != "x1" && \
2776 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
2777 test "x$ac_cv_func_prctl" != "xyes" && \
2778 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
2779 SANDBOX_STYLE="seccomp_filter"
2780 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Miller69ff1df2011-06-23 08:30:03 +10002781elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10002782 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11002783 test "x$select_works_with_rlimit" = "xyes" && \
2784 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002785 test "x$ac_cv_func_setrlimit" != "xyes" && \
2786 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10002787 test "x$select_works_with_rlimit" != "xyes" && \
2788 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10002789 SANDBOX_STYLE="rlimit"
2790 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
2791elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2792 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2793 SANDBOX_STYLE="none"
2794 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2795else
Tim Ricea6e60612011-08-17 21:48:22 -07002796 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10002797fi
2798
Ben Lindstromb5628642000-10-18 00:02:25 +00002799# Cheap hack to ensure NEWS-OS libraries are arranged right.
2800if test ! -z "$SONY" ; then
2801 LIBS="$LIBS -liberty";
2802fi
2803
Damien Miller57f39152005-11-24 19:58:19 +11002804# Check for long long datatypes
2805AC_CHECK_TYPES([long long, unsigned long long, long double])
2806
2807# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002808AC_CHECK_SIZEOF([short int], [2])
2809AC_CHECK_SIZEOF([int], [4])
2810AC_CHECK_SIZEOF([long int], [4])
2811AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002812
Damien Millerfa2bb692002-04-23 23:22:25 +10002813# Sanity check long long for some platforms (AIX)
2814if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2815 ac_cv_sizeof_long_long_int=0
2816fi
2817
Darren Tucker537f1ed2005-10-25 18:38:33 +10002818# compute LLONG_MIN and LLONG_MAX if we don't know them.
2819if test -z "$have_llong_max"; then
2820 AC_MSG_CHECKING([for max value of long long])
2821 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002822 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002823#include <stdio.h>
2824/* Why is this so damn hard? */
2825#ifdef __GNUC__
2826# undef __GNUC__
2827#endif
2828#define __USE_ISOC99
2829#include <limits.h>
2830#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002831#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2832
2833/*
2834 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2835 * we do this the hard way.
2836 */
2837static int
2838fprint_ll(FILE *f, long long n)
2839{
2840 unsigned int i;
2841 int l[sizeof(long long) * 8];
2842
2843 if (n < 0)
2844 if (fprintf(f, "-") < 0)
2845 return -1;
2846 for (i = 0; n != 0; i++) {
2847 l[i] = my_abs(n % 10);
2848 n /= 10;
2849 }
2850 do {
2851 if (fprintf(f, "%d", l[--i]) < 0)
2852 return -1;
2853 } while (i != 0);
2854 if (fprintf(f, " ") < 0)
2855 return -1;
2856 return 0;
2857}
Tim Rice648f8762011-01-26 12:38:57 -08002858 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002859 FILE *f;
2860 long long i, llmin, llmax = 0;
2861
2862 if((f = fopen(DATA,"w")) == NULL)
2863 exit(1);
2864
2865#if defined(LLONG_MIN) && defined(LLONG_MAX)
2866 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2867 llmin = LLONG_MIN;
2868 llmax = LLONG_MAX;
2869#else
2870 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2871 /* This will work on one's complement and two's complement */
2872 for (i = 1; i > llmax; i <<= 1, i++)
2873 llmax = i;
2874 llmin = llmax + 1LL; /* wrap */
2875#endif
2876
2877 /* Sanity check */
2878 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002879 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2880 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002881 fprintf(f, "unknown unknown\n");
2882 exit(2);
2883 }
2884
Darren Tuckerd1450db2006-03-13 19:06:51 +11002885 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002886 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002887 if (fprint_ll(f, llmax) < 0)
2888 exit(4);
2889 if (fclose(f) < 0)
2890 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002891 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002892 ]])],
2893 [
2894 llong_min=`$AWK '{print $1}' conftest.llminmax`
2895 llong_max=`$AWK '{print $2}' conftest.llminmax`
2896
Tim Rice648f8762011-01-26 12:38:57 -08002897 AC_MSG_RESULT([$llong_max])
2898 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002899 [max value of long long calculated by configure])
2900 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002901 AC_MSG_RESULT([$llong_min])
2902 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002903 [min value of long long calculated by configure])
2904 ],
2905 [
Tim Rice648f8762011-01-26 12:38:57 -08002906 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002907 ],
2908 [
2909 AC_MSG_WARN([cross compiling: not checking])
2910 ]
2911 )
2912fi
2913
2914
Damien Millera22ba012000-03-02 23:09:20 +11002915# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002916AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002917 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2918 [[ u_int a; a = 1;]])],
2919 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2920 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002921])
2922if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002923 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002924 have_u_int=1
2925fi
2926
Damien Miller61e50f12000-05-08 20:49:37 +10002927AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002928 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2929 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2930 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2931 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002932])
2933if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002934 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002935 have_intxx_t=1
2936fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002937
2938if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002939 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002940then
2941 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002942 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2943 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002944 [
Tim Rice648f8762011-01-26 12:38:57 -08002945 AC_DEFINE([HAVE_INTXX_T])
2946 AC_MSG_RESULT([yes])
2947 ], [ AC_MSG_RESULT([no])
2948 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002949fi
2950
Damien Miller578783e2000-09-23 14:12:24 +11002951AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002952 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002953#include <sys/types.h>
2954#ifdef HAVE_STDINT_H
2955# include <stdint.h>
2956#endif
2957#include <sys/socket.h>
2958#ifdef HAVE_SYS_BITYPES_H
2959# include <sys/bitypes.h>
2960#endif
Tim Rice648f8762011-01-26 12:38:57 -08002961 ]], [[
2962int64_t a; a = 1;
2963 ]])],
2964 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2965 ])
Damien Miller578783e2000-09-23 14:12:24 +11002966])
2967if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002968 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002969fi
2970
Damien Miller61e50f12000-05-08 20:49:37 +10002971AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002972 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2973 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2974 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2975 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002976])
2977if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002978 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002979 have_u_intxx_t=1
2980fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002981
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002982if test -z "$have_u_intxx_t" ; then
2983 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2985 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002986 [
Tim Rice648f8762011-01-26 12:38:57 -08002987 AC_DEFINE([HAVE_U_INTXX_T])
2988 AC_MSG_RESULT([yes])
2989 ], [ AC_MSG_RESULT([no])
2990 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002991fi
2992
Damien Miller578783e2000-09-23 14:12:24 +11002993AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2995 [[ u_int64_t a; a = 1;]])],
2996 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2997 ])
Damien Miller578783e2000-09-23 14:12:24 +11002998])
2999if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003000 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003001 have_u_int64_t=1
3002fi
3003
Tim Rice4cec93f2002-02-26 08:40:48 -08003004if test -z "$have_u_int64_t" ; then
3005 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003006 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3007 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003008 [
Tim Rice648f8762011-01-26 12:38:57 -08003009 AC_DEFINE([HAVE_U_INT64_T])
3010 AC_MSG_RESULT([yes])
3011 ], [ AC_MSG_RESULT([no])
3012 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003013fi
3014
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003015if test -z "$have_u_intxx_t" ; then
3016 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003017 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003018#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003019 ]], [[
3020 uint8_t a;
3021 uint16_t b;
3022 uint32_t c;
3023 a = b = c = 1;
3024 ]])],
3025 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3026 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003027 ])
3028 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003029 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003030 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003031 fi
3032fi
3033
3034if test -z "$have_uintxx_t" ; then
3035 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003036 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3037 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003038 [
Tim Rice648f8762011-01-26 12:38:57 -08003039 AC_DEFINE([HAVE_UINTXX_T])
3040 AC_MSG_RESULT([yes])
3041 ], [ AC_MSG_RESULT([no])
3042 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003043fi
3044
Damien Milleredb82922000-06-20 13:25:52 +10003045if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003046 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003047then
3048 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003049 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003050#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003051 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003052 int8_t a; int16_t b; int32_t c;
3053 u_int8_t e; u_int16_t f; u_int32_t g;
3054 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003055 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003056 [
Tim Rice648f8762011-01-26 12:38:57 -08003057 AC_DEFINE([HAVE_U_INTXX_T])
3058 AC_DEFINE([HAVE_INTXX_T])
3059 AC_MSG_RESULT([yes])
3060 ], [AC_MSG_RESULT([no])
3061 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003062fi
3063
Damien Miller58be7382001-09-15 21:31:54 +10003064
3065AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003066 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3067 [[ u_char foo; foo = 125; ]])],
3068 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3069 ])
Damien Miller58be7382001-09-15 21:31:54 +10003070])
3071if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003072 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003073fi
3074
Tim Rice13aae5e2001-10-21 17:53:58 -07003075TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003076
Tim Rice648f8762011-01-26 12:38:57 -08003077AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3078AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003079#include <sys/types.h>
3080#ifdef HAVE_SYS_BITYPES_H
3081#include <sys/bitypes.h>
3082#endif
3083#ifdef HAVE_SYS_STATFS_H
3084#include <sys/statfs.h>
3085#endif
3086#ifdef HAVE_SYS_STATVFS_H
3087#include <sys/statvfs.h>
3088#endif
3089])
Tim Rice4cec93f2002-02-26 08:40:48 -08003090
Tim Rice648f8762011-01-26 12:38:57 -08003091AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003092[#include <sys/types.h>
3093#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003094
Damien Miller61e50f12000-05-08 20:49:37 +10003095AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003096 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3097 [[ size_t foo; foo = 1235; ]])],
3098 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3099 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003100])
3101if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003102 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003103fi
Damien Miller95058511999-12-29 10:36:45 +11003104
Damien Miller615f9392000-05-17 22:53:33 +10003105AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003106 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3107 [[ ssize_t foo; foo = 1235; ]])],
3108 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3109 ])
Damien Miller615f9392000-05-17 22:53:33 +10003110])
3111if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003112 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003113fi
3114
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003115AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003116 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3117 [[ clock_t foo; foo = 1235; ]])],
3118 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3119 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003120])
3121if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003122 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003123fi
3124
Damien Millerb54b40e2000-06-23 08:23:34 +10003125AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003126 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003127#include <sys/types.h>
3128#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003129 ]], [[ sa_family_t foo; foo = 1235; ]])],
3130 [ ac_cv_have_sa_family_t="yes" ],
3131 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003132#include <sys/types.h>
3133#include <sys/socket.h>
3134#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003135 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003136 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003137 [ ac_cv_have_sa_family_t="no" ]
3138 )
Tim Rice648f8762011-01-26 12:38:57 -08003139 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003140])
3141if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003142 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003143 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003144fi
3145
Damien Miller0f91b4e2000-06-18 15:43:25 +10003146AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003147 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3148 [[ pid_t foo; foo = 1235; ]])],
3149 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3150 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003151])
3152if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003153 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003154fi
3155
3156AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003157 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3158 [[ mode_t foo; foo = 1235; ]])],
3159 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3160 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003161])
3162if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003163 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003164fi
3165
Damien Miller61e50f12000-05-08 20:49:37 +10003166
3167AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003168 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003169#include <sys/types.h>
3170#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003171 ]], [[ struct sockaddr_storage s; ]])],
3172 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3173 [ ac_cv_have_struct_sockaddr_storage="no"
3174 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003175])
3176if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003177 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003178 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003179fi
Damien Miller34132e52000-01-14 15:45:46 +11003180
Damien Miller61e50f12000-05-08 20:49:37 +10003181AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003182 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003183#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003184#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003185 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3186 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3187 [ ac_cv_have_struct_sockaddr_in6="no"
3188 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003189])
3190if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003191 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003192 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003193fi
Damien Miller34132e52000-01-14 15:45:46 +11003194
Damien Miller61e50f12000-05-08 20:49:37 +10003195AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003196 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003197#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003198#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003199 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3200 [ ac_cv_have_struct_in6_addr="yes" ],
3201 [ ac_cv_have_struct_in6_addr="no"
3202 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003203])
3204if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003205 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003206 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003207
3208dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003209 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003210 [
3211#ifdef HAVE_SYS_TYPES_H
3212#include <sys/types.h>
3213#endif
3214#include <netinet/in.h>
3215 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003216fi
Damien Miller34132e52000-01-14 15:45:46 +11003217
Damien Miller61e50f12000-05-08 20:49:37 +10003218AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003220#include <sys/types.h>
3221#include <sys/socket.h>
3222#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003223 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3224 [ ac_cv_have_struct_addrinfo="yes" ],
3225 [ ac_cv_have_struct_addrinfo="no"
3226 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003227])
3228if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003229 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003230 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003231fi
3232
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003233AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003234 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3235 [[ struct timeval tv; tv.tv_sec = 1;]])],
3236 [ ac_cv_have_struct_timeval="yes" ],
3237 [ ac_cv_have_struct_timeval="no"
3238 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003239])
3240if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003241 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003242 have_struct_timeval=1
3243fi
3244
Tim Rice648f8762011-01-26 12:38:57 -08003245AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003246
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003247# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003248if test "x$ac_cv_have_int64_t" = "xno" && \
3249 test "x$ac_cv_sizeof_long_int" != "x8" && \
3250 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003251 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3252 echo "an alternative compiler (I.E., GCC) before continuing."
3253 echo ""
3254 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003255else
3256dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003257 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003258 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003259#include <stdio.h>
3260#include <string.h>
3261#ifdef HAVE_SNPRINTF
3262main()
3263{
3264 char buf[50];
3265 char expected_out[50];
3266 int mazsize = 50 ;
3267#if (SIZEOF_LONG_INT == 8)
3268 long int num = 0x7fffffffffffffff;
3269#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003270 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003271#endif
3272 strcpy(expected_out, "9223372036854775807");
3273 snprintf(buf, mazsize, "%lld", num);
3274 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003275 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003276 exit(0);
3277}
3278#else
3279main() { exit(0); }
3280#endif
Tim Rice648f8762011-01-26 12:38:57 -08003281 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003282 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003283 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003284fi
3285
Damien Miller78315eb2000-09-29 23:01:36 +11003286dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003287OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3288OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3289OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3290OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3291OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3292OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3293OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3294OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3295OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3296OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3297OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3298OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3299OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3300OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3301OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3302OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3303OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003304
3305AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003306AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3307struct passwd.pw_change, struct passwd.pw_expire],
3308[], [], [[
3309#include <sys/types.h>
3310#include <pwd.h>
3311]])
3312
Tim Rice648f8762011-01-26 12:38:57 -08003313AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003314 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003315[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003316#include <stdio.h>
3317#if HAVE_SYS_TYPES_H
3318# include <sys/types.h>
3319#endif
3320#include <netinet/in.h>
3321#include <arpa/nameser.h>
3322#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003323]])
andre2ff7b5d2000-06-03 14:57:40 +00003324
Damien Miller61e50f12000-05-08 20:49:37 +10003325AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3326 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003327 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003328#include <sys/types.h>
3329#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003330 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3331 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3332 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003333])
3334if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003335 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003336fi
3337
Damien Miller61e50f12000-05-08 20:49:37 +10003338AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3339 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003340 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003341#include <sys/types.h>
3342#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003343 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3344 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3345 [ ac_cv_have___ss_family_in_struct_ss="no"
3346 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003347])
3348if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003349 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003350 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003351fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003352
Tim Rice28bbb0c2002-05-27 17:37:32 -07003353dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003354AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3355 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003357#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003358#include <sys/socket.h>
3359#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003360 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003361#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003362#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003363exit(1);
3364#endif
3365struct msghdr m;
3366m.msg_accrights = 0;
3367exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003368 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003369 [ ac_cv_have_accrights_in_msghdr="yes" ],
3370 [ ac_cv_have_accrights_in_msghdr="no" ]
3371 )
3372])
3373if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003374 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003375 [Define if your system uses access rights style
3376 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003377fi
3378
Tim Rice648f8762011-01-26 12:38:57 -08003379AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3380AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003381#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003382#include <sys/stat.h>
3383#ifdef HAVE_SYS_TIME_H
3384# include <sys/time.h>
3385#endif
3386#ifdef HAVE_SYS_MOUNT_H
3387#include <sys/mount.h>
3388#endif
3389#ifdef HAVE_SYS_STATVFS_H
3390#include <sys/statvfs.h>
3391#endif
Tim Rice648f8762011-01-26 12:38:57 -08003392 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3393 [ AC_MSG_RESULT([yes]) ],
3394 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003395
Tim Rice648f8762011-01-26 12:38:57 -08003396 AC_MSG_CHECKING([if fsid_t has member val])
3397 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003398#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003399#include <sys/statvfs.h>
3400 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3401 [ AC_MSG_RESULT([yes])
3402 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3403 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003404
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_MSG_CHECKING([if f_fsid has member __val])
3406 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003407#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003408#include <sys/statvfs.h>
3409 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3410 [ AC_MSG_RESULT([yes])
3411 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3412 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003413])
Darren Tucker77001382008-06-09 06:17:53 +10003414
Kevin Stevesa44e0352002-04-07 16:18:03 +00003415AC_CACHE_CHECK([for msg_control field in struct msghdr],
3416 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003417 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003418#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003419#include <sys/socket.h>
3420#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003421 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003422#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003423#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003424exit(1);
3425#endif
3426struct msghdr m;
3427m.msg_control = 0;
3428exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003429 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003430 [ ac_cv_have_control_in_msghdr="yes" ],
3431 [ ac_cv_have_control_in_msghdr="no" ]
3432 )
3433])
3434if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003435 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003436 [Define if your system uses ancillary data style
3437 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003438fi
3439
Damien Miller61e50f12000-05-08 20:49:37 +10003440AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003441 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3442 [[ extern char *__progname; printf("%s", __progname); ]])],
3443 [ ac_cv_libc_defines___progname="yes" ],
3444 [ ac_cv_libc_defines___progname="no"
3445 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003446])
3447if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003448 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003449fi
3450
Kevin Steves4846f4a2002-03-22 18:19:53 +00003451AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003452 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3453 [[ printf("%s", __FUNCTION__); ]])],
3454 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3455 [ ac_cv_cc_implements___FUNCTION__="no"
3456 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003457])
3458if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003459 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003460 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003461fi
3462
3463AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003464 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3465 [[ printf("%s", __func__); ]])],
3466 [ ac_cv_cc_implements___func__="yes" ],
3467 [ ac_cv_cc_implements___func__="no"
3468 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003469])
3470if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003471 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003472fi
3473
Damien Miller57f39152005-11-24 19:58:19 +11003474AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003475 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3476#include <stdarg.h>
3477va_list x,y;
3478 ]], [[ va_copy(x,y); ]])],
3479 [ ac_cv_have_va_copy="yes" ],
3480 [ ac_cv_have_va_copy="no"
3481 ])
Damien Miller57f39152005-11-24 19:58:19 +11003482])
3483if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003484 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003485fi
3486
3487AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003488 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3489#include <stdarg.h>
3490va_list x,y;
3491 ]], [[ __va_copy(x,y); ]])],
3492 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3493 ])
Damien Miller57f39152005-11-24 19:58:19 +11003494])
3495if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003496 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003497fi
3498
Damien Miller4f8e6692001-07-14 13:22:53 +10003499AC_CACHE_CHECK([whether getopt has optreset support],
3500 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003501 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3502 [[ extern int optreset; optreset = 0; ]])],
3503 [ ac_cv_have_getopt_optreset="yes" ],
3504 [ ac_cv_have_getopt_optreset="no"
3505 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003506])
3507if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003508 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003509 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003510fi
Damien Millera22ba012000-03-02 23:09:20 +11003511
Damien Millerecbb26d2000-07-15 14:59:14 +10003512AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003513 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3514[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3515 [ ac_cv_libc_defines_sys_errlist="yes" ],
3516 [ ac_cv_libc_defines_sys_errlist="no"
3517 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003518])
3519if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003520 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003521 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003522fi
3523
3524
Damien Miller11fa2cc2000-08-16 10:35:58 +10003525AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003526 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3527[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3528 [ ac_cv_libc_defines_sys_nerr="yes" ],
3529 [ ac_cv_libc_defines_sys_nerr="no"
3530 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003531])
3532if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003533 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003534fi
3535
Darren Tucker5f88d342003-10-15 16:57:57 +10003536# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003537AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3538 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003539 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003540 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003541 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003542 AC_SEARCH_LIBS([res_query], [resolv])
3543 AC_SEARCH_LIBS([dn_expand], [resolv])
3544 AC_MSG_CHECKING([if res_query will link])
3545 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003546#include <sys/types.h>
3547#include <netinet/in.h>
3548#include <arpa/nameser.h>
3549#include <netdb.h>
3550#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003551 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003552 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003553 ]])],
3554 AC_MSG_RESULT([yes]),
3555 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003556 saved_LIBS="$LIBS"
3557 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003558 AC_MSG_CHECKING([for res_query in -lresolv])
3559 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003560#include <sys/types.h>
3561#include <netinet/in.h>
3562#include <arpa/nameser.h>
3563#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003564#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003565 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003566 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003567 ]])],
3568 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003569 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003570 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003571 ])
Tim Rice648f8762011-01-26 12:38:57 -08003572 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003573 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003574 [#include <sys/types.h>
3575 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003576 AC_CHECK_MEMBER([HEADER.ad],
3577 [AC_DEFINE([HAVE_HEADER_AD], [1],
3578 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003579 [#include <arpa/nameser.h>])
3580 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003581
Tim Rice648f8762011-01-26 12:38:57 -08003582AC_MSG_CHECKING([if struct __res_state _res is an extern])
3583AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003584#include <stdio.h>
3585#if HAVE_SYS_TYPES_H
3586# include <sys/types.h>
3587#endif
3588#include <netinet/in.h>
3589#include <arpa/nameser.h>
3590#include <resolv.h>
3591extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003592 ]], [[ ]])],
3593 [AC_MSG_RESULT([yes])
3594 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003595 [Define if you have struct __res_state _res as an extern])
3596 ],
Tim Rice648f8762011-01-26 12:38:57 -08003597 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003598)
3599
Damien Miller73b42d22006-04-22 21:26:08 +10003600# Check whether user wants SELinux support
3601SELINUX_MSG="no"
3602LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003603AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003604 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003605 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003606 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003607 AC_DEFINE([WITH_SELINUX], [1],
3608 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003609 SELINUX_MSG="yes"
3610 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003611 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3612 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003613 [ LIBSELINUX="-lselinux"
3614 LIBS="$LIBS -lselinux"
3615 ],
Tim Rice648f8762011-01-26 12:38:57 -08003616 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003617 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003618 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003619 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003620 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003621 fi ]
3622)
Tim Rice648f8762011-01-26 12:38:57 -08003623AC_SUBST([SSHLIBS])
3624AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003625
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003626# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003627KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003628AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003629 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003630 [ if test "x$withval" != "xno" ; then
3631 if test "x$withval" = "xyes" ; then
3632 KRB5ROOT="/usr/local"
3633 else
3634 KRB5ROOT=${withval}
3635 fi
3636
Tim Rice648f8762011-01-26 12:38:57 -08003637 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003638 KRB5_MSG="yes"
3639
Tim Rice648f8762011-01-26 12:38:57 -08003640 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003641 [$KRB5ROOT/bin/krb5-config],
3642 [$KRB5ROOT/bin:$PATH])
3643 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003644 K5CFLAGS="`$KRB5CONF --cflags`"
3645 K5LIBS="`$KRB5CONF --libs`"
3646 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003647
Tim Rice648f8762011-01-26 12:38:57 -08003648 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003649 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003650 AC_MSG_RESULT([yes])
3651 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003652 [Define this if you want GSSAPI
3653 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003654 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3655 GSSLIBS="`$KRB5CONF --libs gssapi`"
3656 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003657 else
Tim Rice648f8762011-01-26 12:38:57 -08003658 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003659 fi
Tim Rice648f8762011-01-26 12:38:57 -08003660 AC_MSG_CHECKING([whether we are using Heimdal])
3661 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3662 ]], [[ char *tmp = heimdal_version; ]])],
3663 [ AC_MSG_RESULT([yes])
3664 AC_DEFINE([HEIMDAL], [1],
3665 [Define this if you are using the Heimdal
3666 version of Kerberos V5]) ],
3667 [AC_MSG_RESULT([no])
3668 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003669 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003670 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003671 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003672 AC_MSG_CHECKING([whether we are using Heimdal])
3673 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3674 ]], [[ char *tmp = heimdal_version; ]])],
3675 [ AC_MSG_RESULT([yes])
3676 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003677 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003678 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003679 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003680 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003681 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003682 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003683 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003684 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003685
3686 ])
3687 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003688
Tim Rice648f8762011-01-26 12:38:57 -08003689 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3690 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003691 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003692 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3693 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003694 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003695 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3696 [ AC_DEFINE([GSSAPI])
3697 GSSLIBS="-lgss" ],
3698 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3699 ])
Darren Tucker964de182013-02-22 10:39:59 +11003700 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003701
Tim Rice648f8762011-01-26 12:38:57 -08003702 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003703 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003704 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003705 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003706 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003707 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003708 ]
3709 )
3710
3711 oldCPP="$CPPFLAGS"
3712 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003713 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003714 [ CPPFLAGS="$oldCPP" ])
3715
Damien Millera8e06ce2003-11-21 23:48:55 +11003716 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003717 if test ! -z "$need_dash_r" ; then
3718 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3719 fi
3720 if test ! -z "$blibpath" ; then
3721 blibpath="$blibpath:${KRB5ROOT}/lib"
3722 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003723
Tim Rice648f8762011-01-26 12:38:57 -08003724 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3725 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3726 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003727
Tim Rice648f8762011-01-26 12:38:57 -08003728 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3729 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11003730
3731 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
3732#ifdef HAVE_GSSAPI_H
3733# include <gssapi.h>
3734#elif defined(HAVE_GSSAPI_GSSAPI_H)
3735# include <gssapi/gssapi.h>
3736#endif
3737
3738#ifdef HAVE_GSSAPI_GENERIC_H
3739# include <gssapi_generic.h>
3740#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
3741# include <gssapi/gssapi_generic.h>
3742#endif
3743 ]])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003744 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003745 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003746)
Darren Tucker964de182013-02-22 10:39:59 +11003747AC_SUBST([GSSLIBS])
3748AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10003749
Damien Millera22ba012000-03-02 23:09:20 +11003750# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003751
Damien Millerf58c6722002-05-13 13:15:42 +10003752PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003753AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003754 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003755 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003756 if test -n "$withval" && test "x$withval" != "xno" && \
3757 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003758 PRIVSEP_PATH=$withval
3759 fi
3760 ]
3761)
Tim Rice648f8762011-01-26 12:38:57 -08003762AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003763
Tim Rice648f8762011-01-26 12:38:57 -08003764AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003765 [ --with-xauth=PATH Specify path to xauth program ],
3766 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003767 if test -n "$withval" && test "x$withval" != "xno" && \
3768 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003769 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003770 fi
3771 ],
3772 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003773 TestPath="$PATH"
3774 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3775 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3776 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3777 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003778 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003779 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003780 xauth_path="/usr/openwin/bin/xauth"
3781 fi
3782 ]
3783)
3784
Damien Miller7d901272003-01-13 16:55:22 +11003785STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003786AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003787 [ --disable-strip Disable calling strip(1) on install],
3788 [
3789 if test "x$enableval" = "xno" ; then
3790 STRIP_OPT=
3791 fi
3792 ]
3793)
Tim Rice648f8762011-01-26 12:38:57 -08003794AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003795
Damien Millera19cf472000-11-29 13:28:50 +11003796if test -z "$xauth_path" ; then
3797 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003798 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003799else
Tim Rice648f8762011-01-26 12:38:57 -08003800 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003801 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003802 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003803 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003804fi
Damien Millera22ba012000-03-02 23:09:20 +11003805
Tim Rice90f42b02011-06-02 18:17:49 -07003806dnl # --with-maildir=/path/to/mail gets top priority.
3807dnl # if maildir is set in the platform case statement above we use that.
3808dnl # Otherwise we run a program to get the dir from system headers.
3809dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3810dnl # If we find _PATH_MAILDIR we do nothing because that is what
3811dnl # session.c expects anyway. Otherwise we set to the value found
3812dnl # stripping any trailing slash. If for some strage reason our program
3813dnl # does not find what it needs, we default to /var/spool/mail.
3814# Check for mail directory
3815AC_ARG_WITH([maildir],
3816 [ --with-maildir=/path/to/mail Specify your system mail directory],
3817 [
3818 if test "X$withval" != X && test "x$withval" != xno && \
3819 test "x${withval}" != xyes; then
3820 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3821 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3822 fi
3823 ],[
3824 if test "X$maildir" != "X"; then
3825 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3826 else
3827 AC_MSG_CHECKING([Discovering system mail directory])
3828 AC_RUN_IFELSE(
3829 [AC_LANG_PROGRAM([[
3830#include <stdio.h>
3831#include <string.h>
3832#ifdef HAVE_PATHS_H
3833#include <paths.h>
3834#endif
3835#ifdef HAVE_MAILLOCK_H
3836#include <maillock.h>
3837#endif
3838#define DATA "conftest.maildir"
3839 ]], [[
3840 FILE *fd;
3841 int rc;
3842
3843 fd = fopen(DATA,"w");
3844 if(fd == NULL)
3845 exit(1);
3846
3847#if defined (_PATH_MAILDIR)
3848 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3849 exit(1);
3850#elif defined (MAILDIR)
3851 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3852 exit(1);
3853#elif defined (_PATH_MAIL)
3854 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3855 exit(1);
3856#else
3857 exit (2);
3858#endif
3859
3860 exit(0);
3861 ]])],
3862 [
3863 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3864 maildir=`awk -F: '{print $2}' conftest.maildir \
3865 | sed 's|/$||'`
3866 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3867 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3868 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3869 fi
3870 ],
3871 [
3872 if test "X$ac_status" = "X2";then
3873# our test program didn't find it. Default to /var/spool/mail
3874 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3875 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3876 else
3877 AC_MSG_RESULT([*** not found ***])
3878 fi
3879 ],
3880 [
3881 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3882 ]
3883 )
3884 fi
3885 ]
3886) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003887
Darren Tucker623d92f2004-09-12 22:36:15 +10003888if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003889 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3890 disable_ptmx_check=yes
3891fi
Damien Millera22ba012000-03-02 23:09:20 +11003892if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003893 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003894 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003895 [
Tim Rice648f8762011-01-26 12:38:57 -08003896 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003897 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003898 have_dev_ptmx=1
3899 ]
3900 )
3901 fi
Damien Millera22ba012000-03-02 23:09:20 +11003902fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003903
Darren Tucker623d92f2004-09-12 22:36:15 +10003904if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003905 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003906 [
Tim Rice648f8762011-01-26 12:38:57 -08003907 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003908 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003909 have_dev_ptc=1
3910 ]
3911 )
3912else
3913 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3914fi
Damien Miller204ad072000-03-02 23:56:12 +11003915
Damien Millera22ba012000-03-02 23:09:20 +11003916# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003917AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003918 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003919 [
Damien Miller897741e2001-04-16 10:41:46 +10003920 case "$withval" in
3921 man|cat|doc)
3922 MANTYPE=$withval
3923 ;;
3924 *)
Tim Rice648f8762011-01-26 12:38:57 -08003925 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003926 ;;
3927 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003928 ]
3929)
Ben Lindstrombc709922001-04-18 18:04:21 +00003930if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003931 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003932 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003933 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3934 MANTYPE=doc
3935 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3936 MANTYPE=man
3937 else
3938 MANTYPE=cat
3939 fi
3940fi
Tim Rice648f8762011-01-26 12:38:57 -08003941AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003942if test "$MANTYPE" = "doc"; then
3943 mansubdir=man;
3944else
3945 mansubdir=$MANTYPE;
3946fi
Tim Rice648f8762011-01-26 12:38:57 -08003947AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003948
Damien Millera22ba012000-03-02 23:09:20 +11003949# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003950MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003951AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003952 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003953 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003954 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003955 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003956 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003957 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003958 fi
3959 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003960)
3961
Damien Millera22ba012000-03-02 23:09:20 +11003962# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003963AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003964 [ --without-shadow Disable shadow password support],
3965 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003966 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003967 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003968 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003969 fi
3970 ]
3971)
3972
Damien Miller1f335fb2000-06-26 11:31:33 +10003973if test -z "$disable_shadow" ; then
3974 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003975 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003976#include <sys/types.h>
3977#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003978struct spwd sp;
3979 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3980 [ sp_expire_available=yes ], [
3981 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003982
3983 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003984 AC_MSG_RESULT([yes])
3985 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003986 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003987 else
Tim Rice648f8762011-01-26 12:38:57 -08003988 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003989 fi
3990fi
3991
Damien Millera22ba012000-03-02 23:09:20 +11003992# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003993if test ! -z "$IPADDR_IN_DISPLAY" ; then
3994 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003995 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003996 [Define if you need to use IP address
3997 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003998else
Damien Millera8e06ce2003-11-21 23:48:55 +11003999 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004000 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004001 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4002 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004003 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004004 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004005 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004006 fi
4007 ]
4008 )
4009fi
Damien Miller76112de1999-12-21 11:18:08 +11004010
Darren Tuckere1a790d2003-09-16 11:52:19 +10004011# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004012AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004013 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004014 [ if test "x$enableval" = "xno"; then
4015 AC_MSG_NOTICE([/etc/default/login handling disabled])
4016 etc_default_login=no
4017 else
4018 etc_default_login=yes
4019 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004020 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4021 then
4022 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4023 etc_default_login=no
4024 else
4025 etc_default_login=yes
4026 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004027)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004028
Darren Tucker2f9573d2005-02-10 22:28:54 +11004029if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004030 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004031 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004032 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004033 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004034 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004035 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004036fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004037
Tim Rice43a1c132002-04-17 21:19:14 -07004038dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004039if test $ac_cv_func_login_getcapbool = "yes" && \
4040 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004041 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004042fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004043
Damien Millera22ba012000-03-02 23:09:20 +11004044# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004045SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004046AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004047 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004048 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004049 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004050 AC_MSG_WARN([
4051--with-default-path=PATH has no effect on this system.
4052Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004053 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004054 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004055 AC_MSG_WARN([
4056--with-default-path=PATH will only be used if PATH is not defined in
4057$external_path_file .])
4058 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004059 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004060 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004061 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004062 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004063 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4064 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004065 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004066 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004067 AC_MSG_WARN([
4068If PATH is defined in $external_path_file, ensure the path to scp is included,
4069otherwise scp will not work.])
4070 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004071 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004072 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004073/* find out what STDPATH is */
4074#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004075#ifdef HAVE_PATHS_H
4076# include <paths.h>
4077#endif
4078#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004079# ifdef _PATH_USERPATH /* Irix */
4080# define _PATH_STDPATH _PATH_USERPATH
4081# else
4082# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4083# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004084#endif
4085#include <sys/types.h>
4086#include <sys/stat.h>
4087#include <fcntl.h>
4088#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004089 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004090 FILE *fd;
4091 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004092
Tim Rice59ea0a02001-03-10 13:50:45 -08004093 fd = fopen(DATA,"w");
4094 if(fd == NULL)
4095 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004096
Tim Rice59ea0a02001-03-10 13:50:45 -08004097 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4098 exit(1);
4099
4100 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004101 ]])],
4102 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004103 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4104 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4105 )
4106# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004107 t_bindir="${bindir}"
4108 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4109 t_bindir=`eval echo ${t_bindir}`
4110 case $t_bindir in
4111 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4112 esac
4113 case $t_bindir in
4114 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4115 esac
4116 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004117 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4118 if test $? -ne 0 ; then
4119 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4120 if test $? -ne 0 ; then
4121 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004122 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004123 fi
4124 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004125 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004126)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004127if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004128 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4129 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004130fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004131
Damien Millera18bbd32002-05-13 10:48:57 +10004132# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004133AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004134 [ --with-superuser-path= Specify different path for super-user],
4135 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004136 if test -n "$withval" && test "x$withval" != "xno" && \
4137 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004138 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004139 [Define if you want a different $PATH
4140 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004141 superuser_path=$withval
4142 fi
4143 ]
4144)
4145
4146
Damien Miller61e50f12000-05-08 20:49:37 +10004147AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004148IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004149AC_ARG_WITH(4in6,
4150 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4151 [
4152 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004153 AC_MSG_RESULT([yes])
4154 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004155 [Detect IPv4 in IPv6 mapped addresses
4156 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004157 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004158 else
Tim Rice648f8762011-01-26 12:38:57 -08004159 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004160 fi
Tim Rice648f8762011-01-26 12:38:57 -08004161 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004162 if test "x$inet6_default_4in6" = "xyes"; then
4163 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004164 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004165 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004166 else
4167 AC_MSG_RESULT([no (default)])
4168 fi
4169 ]
4170)
4171
Damien Miller60396b02001-02-18 17:01:00 +11004172# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004173BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004174AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004175 [ --with-bsd-auth Enable BSD auth support],
4176 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004177 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004178 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004179 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004180 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004181 fi
4182 ]
4183)
4184
Damien Millera22ba012000-03-02 23:09:20 +11004185# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004186piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004187# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004188if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004189 piddir=`eval echo ${sysconfdir}`
4190 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004191 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004192 esac
4193fi
4194
Tim Rice648f8762011-01-26 12:38:57 -08004195AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004196 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4197 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004198 if test -n "$withval" && test "x$withval" != "xno" && \
4199 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004200 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004201 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004202 AC_MSG_WARN([** no $piddir directory on this system **])
4203 fi
4204 fi
4205 ]
4206)
4207
Tim Rice648f8762011-01-26 12:38:57 -08004208AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4209 [Specify location of ssh.pid])
4210AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004211
andre2ff7b5d2000-06-03 14:57:40 +00004212dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004213AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004214 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004215 [
4216 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004217 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004218 fi
4219 ]
andre2ff7b5d2000-06-03 14:57:40 +00004220)
Tim Rice648f8762011-01-26 12:38:57 -08004221AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004222 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004223 [
4224 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004225 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004226 fi
4227 ]
andre2ff7b5d2000-06-03 14:57:40 +00004228)
Tim Rice648f8762011-01-26 12:38:57 -08004229AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004230 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004231 [
4232 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004233 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004234 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004235 fi
4236 ]
andre2ff7b5d2000-06-03 14:57:40 +00004237)
Tim Rice648f8762011-01-26 12:38:57 -08004238AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004239 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004240 [
4241 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004242 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004243 fi
4244 ]
andre2ff7b5d2000-06-03 14:57:40 +00004245)
Tim Rice648f8762011-01-26 12:38:57 -08004246AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004247 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004248 [
4249 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004250 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004251 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004252 fi
4253 ]
andre2ff7b5d2000-06-03 14:57:40 +00004254)
Tim Rice648f8762011-01-26 12:38:57 -08004255AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004256 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004257 [
4258 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004259 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004260 fi
4261 ]
andre2ff7b5d2000-06-03 14:57:40 +00004262)
Tim Rice648f8762011-01-26 12:38:57 -08004263AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004264 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004265 [
4266 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004267 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004268 [Define if you don't want to use pututline()
4269 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004270 fi
4271 ]
andre2ff7b5d2000-06-03 14:57:40 +00004272)
Tim Rice648f8762011-01-26 12:38:57 -08004273AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004274 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004275 [
4276 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004277 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004278 [Define if you don't want to use pututxline()
4279 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004280 fi
4281 ]
andre2ff7b5d2000-06-03 14:57:40 +00004282)
Tim Rice648f8762011-01-26 12:38:57 -08004283AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004284 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004285 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004286 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004287 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004288 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004289 conf_lastlog_location=$withval
4290 fi
4291 ]
4292)
andre2ff7b5d2000-06-03 14:57:40 +00004293
4294dnl lastlog, [uw]tmpx? detection
4295dnl NOTE: set the paths in the platform section to avoid the
4296dnl need for command-line parameters
4297dnl lastlog and [uw]tmp are subject to a file search if all else fails
4298
4299dnl lastlog detection
4300dnl NOTE: the code itself will detect if lastlog is a directory
4301AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004302AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004303#include <sys/types.h>
4304#include <utmp.h>
4305#ifdef HAVE_LASTLOG_H
4306# include <lastlog.h>
4307#endif
Damien Miller2994e082000-06-04 15:51:47 +10004308#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004309# include <paths.h>
4310#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004311#ifdef HAVE_LOGIN_H
4312# include <login.h>
4313#endif
Tim Rice648f8762011-01-26 12:38:57 -08004314 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4315 [ AC_MSG_RESULT([yes]) ],
4316 [
4317 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004318 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004319 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004320#include <sys/types.h>
4321#include <utmp.h>
4322#ifdef HAVE_LASTLOG_H
4323# include <lastlog.h>
4324#endif
4325#ifdef HAVE_PATHS_H
4326# include <paths.h>
4327#endif
Tim Rice648f8762011-01-26 12:38:57 -08004328 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4329 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004330 [
Tim Rice648f8762011-01-26 12:38:57 -08004331 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004332 system_lastlog_path=no
4333 ])
Tim Rice648f8762011-01-26 12:38:57 -08004334])
Damien Miller2994e082000-06-04 15:51:47 +10004335
andre2ff7b5d2000-06-03 14:57:40 +00004336if test -z "$conf_lastlog_location"; then
4337 if test x"$system_lastlog_path" = x"no" ; then
4338 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004339 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004340 conf_lastlog_location=$f
4341 fi
4342 done
4343 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004344 AC_MSG_WARN([** Cannot find lastlog **])
4345 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004346 fi
4347 fi
4348fi
4349
4350if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004351 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004352 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004353fi
andre2ff7b5d2000-06-03 14:57:40 +00004354
4355dnl utmp detection
4356AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004357AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004358#include <sys/types.h>
4359#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004360#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004361# include <paths.h>
4362#endif
Tim Rice648f8762011-01-26 12:38:57 -08004363 ]], [[ char *utmp = UTMP_FILE; ]])],
4364 [ AC_MSG_RESULT([yes]) ],
4365 [ AC_MSG_RESULT([no])
4366 system_utmp_path=no
4367])
andre2ff7b5d2000-06-03 14:57:40 +00004368if test -z "$conf_utmp_location"; then
4369 if test x"$system_utmp_path" = x"no" ; then
4370 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4371 if test -f $f ; then
4372 conf_utmp_location=$f
4373 fi
4374 done
4375 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004376 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004377 fi
4378 fi
4379fi
4380if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004381 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004382 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004383fi
andre2ff7b5d2000-06-03 14:57:40 +00004384
4385dnl wtmp detection
4386AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004387AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004388#include <sys/types.h>
4389#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004390#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004391# include <paths.h>
4392#endif
Tim Rice648f8762011-01-26 12:38:57 -08004393 ]], [[ char *wtmp = WTMP_FILE; ]])],
4394 [ AC_MSG_RESULT([yes]) ],
4395 [ AC_MSG_RESULT([no])
4396 system_wtmp_path=no
4397])
andre2ff7b5d2000-06-03 14:57:40 +00004398if test -z "$conf_wtmp_location"; then
4399 if test x"$system_wtmp_path" = x"no" ; then
4400 for f in /usr/adm/wtmp /var/log/wtmp; do
4401 if test -f $f ; then
4402 conf_wtmp_location=$f
4403 fi
4404 done
4405 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004406 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004407 fi
4408 fi
4409fi
4410if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004411 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004412 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004413fi
andre2ff7b5d2000-06-03 14:57:40 +00004414
andre2ff7b5d2000-06-03 14:57:40 +00004415dnl wtmpx detection
4416AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004417AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004418#include <sys/types.h>
4419#include <utmp.h>
4420#ifdef HAVE_UTMPX_H
4421#include <utmpx.h>
4422#endif
Damien Miller2994e082000-06-04 15:51:47 +10004423#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004424# include <paths.h>
4425#endif
Tim Rice648f8762011-01-26 12:38:57 -08004426 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4427 [ AC_MSG_RESULT([yes]) ],
4428 [ AC_MSG_RESULT([no])
4429 system_wtmpx_path=no
4430])
andre2ff7b5d2000-06-03 14:57:40 +00004431if test -z "$conf_wtmpx_location"; then
4432 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004433 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004434 fi
4435else
Tim Rice648f8762011-01-26 12:38:57 -08004436 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004437 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004438fi
andre2ff7b5d2000-06-03 14:57:40 +00004439
Damien Miller4018c192000-04-30 09:30:44 +10004440
Damien Miller29ea30d2000-03-17 10:54:15 +11004441if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004442 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4443 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004444fi
4445
Damien Millera2438bb2013-03-15 10:23:07 +11004446AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004447 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004448 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004449 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004450 ], [
4451#ifdef HAVE_SYS_TYPES_H
4452#include <sys/types.h>
4453#endif
4454#ifdef HAVE_UTMP_H
4455#include <utmp.h>
4456#endif
4457#ifdef HAVE_UTMPX_H
4458#include <utmpx.h>
4459#endif
4460#ifdef HAVE_LASTLOG_H
4461#include <lastlog.h>
4462#endif
4463 ])
4464
4465AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4466 AC_DEFINE([DISABLE_UTMP])
4467 AC_DEFINE([DISABLE_WTMP])
4468 ], [
4469#ifdef HAVE_SYS_TYPES_H
4470#include <sys/types.h>
4471#endif
4472#ifdef HAVE_UTMP_H
4473#include <utmp.h>
4474#endif
4475#ifdef HAVE_UTMPX_H
4476#include <utmpx.h>
4477#endif
4478#ifdef HAVE_LASTLOG_H
4479#include <lastlog.h>
4480#endif
4481 ])
4482
Darren Tucker7da23cb2005-08-03 00:20:15 +10004483dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4484dnl Add now.
4485CFLAGS="$CFLAGS $werror_flags"
4486
Darren Tucker627337d2010-04-10 22:58:01 +10004487if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4488 TEST_SSH_IPV6=no
4489else
4490 TEST_SSH_IPV6=yes
4491fi
Tim Rice648f8762011-01-26 12:38:57 -08004492AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4493AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004494
Damien Millerbac2d8a2000-09-05 16:13:06 +11004495AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004496AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4497 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004498 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004499AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004500
Damien Miller7b22d652000-06-18 14:07:04 +10004501# Print summary of options
4502
Damien Miller7b22d652000-06-18 14:07:04 +10004503# Someone please show me a better way :)
4504A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4505B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4506C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4507D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004508E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004509F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004510G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004511H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4512I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4513J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004514
4515echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004516echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004517echo " User binaries: $B"
4518echo " System binaries: $C"
4519echo " Configuration files: $D"
4520echo " Askpass program: $E"
4521echo " Manual pages: $F"
4522echo " PID file: $G"
4523echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004524if test "x$external_path_file" = "x/etc/login.conf" ; then
4525echo " At runtime, sshd will use the path defined in $external_path_file"
4526echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004527else
Damien Millerf58c6722002-05-13 13:15:42 +10004528echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004529 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004530echo " (If PATH is set in $external_path_file it will be used instead. If"
4531echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4532 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004533fi
Damien Millera18bbd32002-05-13 10:48:57 +10004534if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004535echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004536fi
Damien Millerf58c6722002-05-13 13:15:42 +10004537echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004538echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004539echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004540echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004541echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004542echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004543echo " S/KEY support: $SKEY_MSG"
4544echo " TCP Wrappers support: $TCPW_MSG"
4545echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004546echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004547echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004548echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004549echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004550echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4551echo " BSD Auth support: $BSD_AUTH_MSG"
4552echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004553echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004554
Damien Miller7b22d652000-06-18 14:07:04 +10004555echo ""
4556
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004557echo " Host: ${host}"
4558echo " Compiler: ${CC}"
4559echo " Compiler flags: ${CFLAGS}"
4560echo "Preprocessor flags: ${CPPFLAGS}"
4561echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004562echo " Libraries: ${LIBS}"
4563if test ! -z "${SSHDLIBS}"; then
4564echo " +for sshd: ${SSHDLIBS}"
4565fi
Damien Miller71adf122011-01-25 12:16:15 +11004566if test ! -z "${SSHLIBS}"; then
4567echo " +for ssh: ${SSHLIBS}"
4568fi
Damien Miller7b22d652000-06-18 14:07:04 +10004569
4570echo ""
4571
Tim Rice6f1f7582004-05-30 21:38:51 -07004572if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004573 echo "SVR4 style packages are supported with \"make package\""
4574 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004575fi
4576
Damien Miller82cf0ce2000-12-20 13:34:48 +11004577if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004578 echo "PAM is enabled. You may need to install a PAM control file "
4579 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004580 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004581 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004582 echo ""
4583fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004584
Damien Millerb4097182004-05-23 14:09:40 +10004585if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004586 echo "WARNING: the operating system that you are using does not"
4587 echo "appear to support getpeereid(), getpeerucred() or the"
4588 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4589 echo "enforce security checks to prevent unauthorised connections to"
4590 echo "ssh-agent. Their absence increases the risk that a malicious"
4591 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004592 echo ""
4593fi
4594
Darren Tuckerd9f88912005-02-20 21:01:48 +11004595if test "$AUDIT_MODULE" = "bsm" ; then
4596 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4597 echo "See the Solaris section in README.platform for details."
4598fi