blob: 93c50e085de5d84a627d4d276d74bbf86a66b9d6 [file] [log] [blame]
Darren Tuckerabbc7a72013-05-10 13:54:23 +10001# $Id: configure.ac,v 1.522 2013/05/10 03:54:23 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Darren Tuckerabbc7a72013-05-10 13:54:23 +100018AC_REVISION($Revision: 1.522 $)
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])
Darren Tuckerabbc7a72013-05-10 13:54:23 +1000137 OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess])
Damien Millerb1763622011-05-20 11:45:25 +1000138 OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
139 OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
140 OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Darren Tuckerce1c9572013-04-18 21:36:19 +1000141 OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments])
Darren Tucker4a725ef2011-11-21 16:38:48 +1100142 OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2])
Tim Rice648f8762011-01-26 12:38:57 -0800143 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100144 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700145 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000146 1.*) no_attrib_nonnull=1 ;;
147 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000148 no_attrib_nonnull=1
149 ;;
150 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100151 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700152 esac
Tim Rice648f8762011-01-26 12:38:57 -0800153 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000154
Tim Rice648f8762011-01-26 12:38:57 -0800155 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000156 saved_CFLAGS="$CFLAGS"
157 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800158 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
159 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
160 [ AC_MSG_RESULT([yes]) ],
161 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000162 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800163 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000164
Darren Tuckerb7918af2008-03-09 11:34:23 +1100165 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100166 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100167 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100168 if test "x$use_stack_protector" = "x1"; then
169 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800170 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100171 saved_CFLAGS="$CFLAGS"
172 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100173 CFLAGS="$CFLAGS $t -Werror"
174 LDFLAGS="$LDFLAGS $t -Werror"
175 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800176 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
177 [[
178 char x[256];
179 snprintf(x, sizeof(x), "XXX");
180 ]])],
181 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100182 CFLAGS="$saved_CFLAGS $t"
183 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800184 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100185 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800186 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
187 [[
188 char x[256];
189 snprintf(x, sizeof(x), "XXX");
190 ]])],
191 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100192 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800193 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100194 [ AC_MSG_WARN([cross compiling: cannot test])
195 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100196 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100197 ],
Tim Rice648f8762011-01-26 12:38:57 -0800198 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100199 )
200 CFLAGS="$saved_CFLAGS"
201 LDFLAGS="$saved_LDFLAGS"
202 done
203 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100204
Darren Tucker67b37032005-06-03 17:58:31 +1000205 if test -z "$have_llong_max"; then
206 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
207 unset ac_cv_have_decl_LLONG_MAX
208 saved_CFLAGS="$CFLAGS"
209 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800210 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000211 [have_llong_max=1],
212 [CFLAGS="$saved_CFLAGS"],
213 [#include <limits.h>]
214 )
215 fi
Damien Miller166bd442000-03-16 10:48:25 +1100216fi
217
Darren Tucker951b53b2013-02-08 11:50:09 +1100218AC_MSG_CHECKING([if compiler allows __attribute__ on return types])
219AC_COMPILE_IFELSE(
220 [AC_LANG_PROGRAM([[
221#include <stdlib.h>
222__attribute__((__unused__)) static void foo(void){return;}]],
223 [[ exit(0); ]])],
224 [ AC_MSG_RESULT([yes]) ],
225 [ AC_MSG_RESULT([no])
226 AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1,
227 [compiler does not accept __attribute__ on return types]) ]
228)
229
Darren Tucker391de5c2007-04-29 14:49:21 +1000230if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800231 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000232fi
233
Tim Rice648f8762011-01-26 12:38:57 -0800234AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800235 [ --without-rpath Disable auto-added -R linker paths],
236 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800237 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800238 need_dash_r=""
239 fi
240 if test "x$withval" = "xyes" ; then
241 need_dash_r=1
242 fi
243 ]
244)
245
Tim Rice1cfab232006-10-03 09:34:35 -0700246# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800247AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700248 [ --with-cflags Specify additional flags to pass to compiler],
249 [
250 if test -n "$withval" && test "x$withval" != "xno" && \
251 test "x${withval}" != "xyes"; then
252 CFLAGS="$CFLAGS $withval"
253 fi
254 ]
255)
Tim Rice648f8762011-01-26 12:38:57 -0800256AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700257 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
258 [
259 if test -n "$withval" && test "x$withval" != "xno" && \
260 test "x${withval}" != "xyes"; then
261 CPPFLAGS="$CPPFLAGS $withval"
262 fi
263 ]
264)
Tim Rice648f8762011-01-26 12:38:57 -0800265AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700266 [ --with-ldflags Specify additional flags to pass to linker],
267 [
268 if test -n "$withval" && test "x$withval" != "xno" && \
269 test "x${withval}" != "xyes"; then
270 LDFLAGS="$LDFLAGS $withval"
271 fi
272 ]
273)
Tim Rice648f8762011-01-26 12:38:57 -0800274AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700275 [ --with-libs Specify additional libraries to link with],
276 [
277 if test -n "$withval" && test "x$withval" != "xno" && \
278 test "x${withval}" != "xyes"; then
279 LIBS="$LIBS $withval"
280 fi
281 ]
282)
Tim Rice648f8762011-01-26 12:38:57 -0800283AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700284 [ --with-Werror Build main code with -Werror],
285 [
286 if test -n "$withval" && test "x$withval" != "xno"; then
287 werror_flags="-Werror"
288 if test "x${withval}" != "xyes"; then
289 werror_flags="$withval"
290 fi
291 fi
292 ]
293)
294
Tim Rice648f8762011-01-26 12:38:57 -0800295AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700296 bstring.h \
297 crypt.h \
298 crypto/sha2.h \
299 dirent.h \
300 endian.h \
Damien Miller91f40d82013-02-22 11:37:00 +1100301 elf.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700302 features.h \
303 fcntl.h \
304 floatingpoint.h \
305 getopt.h \
306 glob.h \
307 ia.h \
308 iaf.h \
309 limits.h \
310 login.h \
311 maillock.h \
312 ndir.h \
313 net/if_tun.h \
314 netdb.h \
315 netgroup.h \
316 pam/pam_appl.h \
317 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000318 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700319 pty.h \
320 readpassphrase.h \
321 rpc/types.h \
322 security/pam_appl.h \
323 sha2.h \
324 shadow.h \
325 stddef.h \
326 stdint.h \
327 string.h \
328 strings.h \
329 sys/audit.h \
330 sys/bitypes.h \
331 sys/bsdtty.h \
332 sys/cdefs.h \
333 sys/dir.h \
334 sys/mman.h \
335 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000336 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700337 sys/prctl.h \
338 sys/pstat.h \
339 sys/select.h \
340 sys/stat.h \
341 sys/stream.h \
342 sys/stropts.h \
343 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000344 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700345 sys/sysmacros.h \
346 sys/time.h \
347 sys/timers.h \
348 sys/un.h \
349 time.h \
350 tmpdir.h \
351 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700352 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700353 unistd.h \
354 usersec.h \
355 util.h \
356 utime.h \
357 utmp.h \
358 utmpx.h \
359 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800360])
Tim Rice1cfab232006-10-03 09:34:35 -0700361
362# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800363AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700364#ifdef HAVE_SYS_TIME_H
365# include <sys/time.h>
366#endif
367])
368
369# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800370AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700371#ifdef HAVE_SYS_STREAM_H
372# include <sys/stream.h>
373#endif
374])
375
376# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800377AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700378#include <sys/types.h>
379])
380
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000381# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800382AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000383#include <sys/param.h>
384])
385
Damien Miller1b06dc32006-08-31 03:24:41 +1000386# Messages for features tested for in target-specific section
387SIA_MSG="no"
388SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100389SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000390
Damien Millera22ba012000-03-02 23:09:20 +1100391# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100392case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100393*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000394 # Some versions of VAC won't allow macro redefinitions at
395 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
396 # particularly with older versions of vac or xlc.
397 # It also throws errors about null macro argments, but these are
398 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800399 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000400 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800401 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000402#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800403#define testmacro bar]],
404 [[ exit(0); ]])],
405 [ AC_MSG_RESULT([yes]) ],
406 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000407 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
408 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
409 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
410 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
411 ]
412 )
413
Damien Millera8e06ce2003-11-21 23:48:55 +1100414 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000415 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800416 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100417 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000418 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000419 if test "$GCC" = "yes"; then
420 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
421 else
422 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
423 fi
424 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000425 if (test -z "$blibflags"); then
426 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800427 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
428 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000429 fi
430 done
431 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800432 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000433 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
434 else
Tim Rice648f8762011-01-26 12:38:57 -0800435 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000436 fi
437 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000438 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800439 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700440 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800441 [AC_CHECK_LIB([s], [authenticate],
442 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700443 LIBS="$LIBS -ls"
444 ])
445 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100446 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100447 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100448 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000449 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800450 AC_CHECK_DECLS([loginfailed],
451 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
452 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
453 [[ (void)loginfailed("user","host","tty",0); ]])],
454 [AC_MSG_RESULT([yes])
455 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
456 [Define if your AIX loginfailed() function
457 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
458 ])],
459 [],
460 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000461 )
Tim Rice648f8762011-01-26 12:38:57 -0800462 AC_CHECK_FUNCS([getgrset setauthdb])
463 AC_CHECK_DECL([F_CLOSEM],
464 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000465 [],
466 [ #include <limits.h>
467 #include <fcntl.h> ]
468 )
Darren Tucker691d5232005-02-15 21:45:57 +1100469 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800470 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
471 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700472 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800473 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
474 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000475 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800476 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
477 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700478 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800479 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700480 [Define to a Set Process Title type if your system is
481 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800482 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100483 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800484 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100485 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Damien Miller75b1d102000-01-07 14:01:41 +1100486 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100487*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100488 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100489 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800490 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
491 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
492 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700493 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800494 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700495 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800496 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700497 [Define if the concept of ports only accessible to
498 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800499 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700500 [Define if your platform needs to skip post auth
501 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800502 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
503 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100504 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000505*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800506 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700507 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800508 AC_DEFINE([SETEUID_BREAKS_SETUID])
509 AC_DEFINE([BROKEN_SETREUID])
510 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000511 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000512*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800513 AC_MSG_CHECKING([if we have working getaddrinfo])
514 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000515main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
516 exit(0);
517 else
518 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800519}
520 ]])],
521 [AC_MSG_RESULT([working])],
522 [AC_MSG_RESULT([buggy])
523 AC_DEFINE([BROKEN_GETADDRINFO], [1],
524 [getaddrinfo is broken (if present)])
525 ],
526 [AC_MSG_RESULT([assume it is working])])
527 AC_DEFINE([SETEUID_BREAKS_SETUID])
528 AC_DEFINE([BROKEN_SETREUID])
529 AC_DEFINE([BROKEN_SETREGID])
530 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
531 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700532 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800533 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
534 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000535 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800536 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000537 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800538 m4_pattern_allow([AU_IPv])
539 AC_CHECK_DECL([AU_IPv4], [],
540 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100541 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800542 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100543 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100544 )
Damien Millerc09182f2011-06-03 12:11:38 +1000545 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
546 [Define to a Set Process Title type if your system is
547 supported by bsd-setproctitle.c])
Damien Millercd5e52e2011-06-27 07:18:18 +1000548 AC_CHECK_FUNCS([sandbox_init])
549 AC_CHECK_HEADERS([sandbox.h])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000550 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000551*-*-dragonfly*)
552 SSHDLIBS="$SSHDLIBS -lcrypt"
553 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100554*-*-haiku*)
555 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800556 AC_CHECK_LIB([network], [socket])
557 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100558 MANTYPE=man
559 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000560*-*-hpux*)
561 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000562 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100563 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800564 AC_DEFINE([USE_PIPES])
565 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700566 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800567 AC_DEFINE([LOGIN_NEEDS_UTMPX])
568 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700569 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800570 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tuckeraa97d132013-03-12 11:31:05 +1100571 AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)])
Tim Rice90f42b02011-06-02 18:17:49 -0700572 maildir="/var/mail"
Tim Ricef028f1e2002-07-19 12:41:10 -0700573 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800574 AC_CHECK_LIB([xnet], [t_error], ,
575 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000576
577 # next, we define all of the options specific to major releases
578 case "$host" in
579 *-*-hpux10*)
580 if test -z "$GCC"; then
581 CFLAGS="$CFLAGS -Ae"
582 fi
583 ;;
584 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800585 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700586 [Define if you are using Solaris-derived PAM which
587 passes pam_messages to the conversation function
588 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800589 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700590 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800591 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000592 check_for_hpux_broken_getaddrinfo=1
593 check_for_conflicting_getspnam=1
594 ;;
595 esac
596
597 # lastly, we define options specific to minor releases
598 case "$host" in
599 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800600 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700601 [Define if you have SecureWare-based
602 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000603 disable_ptmx_check=yes
604 LIBS="$LIBS -lsecpw"
605 ;;
606 esac
Damien Miller1bead332000-04-30 00:47:29 +1000607 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100608*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100609 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800610 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700611 [Define if you system's inet_ntoa is busted
612 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800613 AC_DEFINE([SETEUID_BREAKS_SETUID])
614 AC_DEFINE([BROKEN_SETREUID])
615 AC_DEFINE([BROKEN_SETREGID])
616 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700617 [Define if you shouldn't strip 'tty' from your
618 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800619 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100620 ;;
621*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100622 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800623 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700624 [Define if you have/want arrays
625 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800626 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700627 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800628 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700629 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800630 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700631 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800632 AC_DEFINE([BROKEN_INET_NTOA])
633 AC_DEFINE([SETEUID_BREAKS_SETUID])
634 AC_DEFINE([BROKEN_SETREUID])
635 AC_DEFINE([BROKEN_SETREGID])
636 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
637 AC_DEFINE([WITH_ABBREV_NO_TTY])
638 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100639 ;;
Damien Miller90551722009-02-16 15:37:03 +1100640*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
641 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800642 AC_DEFINE([PAM_TTY_KLUDGE])
643 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
644 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
645 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
646 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100647 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100648*-*-linux*)
649 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100650 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000651 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800652 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700653 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800654 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700655 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800656 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
657 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700658 [Define to whatever link() returns for "not supported"
659 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800660 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
661 AC_DEFINE([USE_BTMP])
662 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100663 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000664 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000665 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800666 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700667 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000668 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000669 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100670 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800671 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100672 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800673 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100674 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800675 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100676 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800677 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100678 [Prepend the address family to IP tunnel traffic])
679 fi
Darren Tucker60395f92012-07-03 14:31:18 +1000680 AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [],
681 [], [#include <linux/types.h>])
Damien Millere0956e32012-04-04 11:27:54 +1000682 AC_CHECK_FUNCS([prctl])
Damien Miller91f40d82013-02-22 11:37:00 +1100683 AC_MSG_CHECKING([for seccomp architecture])
684 seccomp_audit_arch=
Damien Millere0956e32012-04-04 11:27:54 +1000685 case "$host" in
686 x86_64-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100687 seccomp_audit_arch=AUDIT_ARCH_X86_64
Damien Millere0956e32012-04-04 11:27:54 +1000688 ;;
689 i*86-*)
Damien Miller91f40d82013-02-22 11:37:00 +1100690 seccomp_audit_arch=AUDIT_ARCH_I386
Damien Millere0956e32012-04-04 11:27:54 +1000691 ;;
Damien Miller91f40d82013-02-22 11:37:00 +1100692 arm*-*)
693 seccomp_audit_arch=AUDIT_ARCH_ARM
694 ;;
Damien Millere0956e32012-04-04 11:27:54 +1000695 esac
Damien Miller91f40d82013-02-22 11:37:00 +1100696 if test "x$seccomp_audit_arch" != "x" ; then
697 AC_MSG_RESULT(["$seccomp_audit_arch"])
698 AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch],
699 [Specify the system call convention in use])
700 else
701 AC_MSG_RESULT([architecture not supported])
702 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100703 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000704mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800705 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000706 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000707 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100708*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000709 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800710 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800711 need_dash_r=1
712 fi
Tim Rice648f8762011-01-26 12:38:57 -0800713 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100714 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800715 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
716 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100717 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100718 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100719*-*-freebsd*)
720 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800721 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
722 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100723 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800724 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
725 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Miller63b4bcd2013-03-20 12:55:14 +1100726 AC_DEFINE([BROKEN_STRNVIS], [1], [FreeBSD strnvis does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100727 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000728*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800729 AC_DEFINE([SETEUID_BREAKS_SETUID])
730 AC_DEFINE([BROKEN_SETREUID])
731 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000732 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000733*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000734 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100735 conf_utmp_location=/etc/utmp
736 conf_wtmp_location=/usr/adm/wtmp
Tim Rice90f42b02011-06-02 18:17:49 -0700737 maildir=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800738 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
739 AC_DEFINE([BROKEN_REALPATH])
740 AC_DEFINE([USE_PIPES])
741 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000742 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000743*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800744 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
745 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
746 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
747 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000748 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000749 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100750*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800751 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800752 need_dash_r=1
753 fi
Tim Rice648f8762011-01-26 12:38:57 -0800754 AC_DEFINE([PAM_SUN_CODEBASE])
755 AC_DEFINE([LOGIN_NEEDS_UTMPX])
756 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700757 [Some versions of /bin/login need the TERM supplied
758 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800759 AC_DEFINE([PAM_TTY_KLUDGE])
760 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700761 [Define if pam_chauthtok wants real uid set
762 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800763 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000764 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800765 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700766 [Define if sshd somehow reacquires a controlling TTY
767 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000769 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800770 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000771 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000772 # hardwire lastlog location (can't detect it on some versions)
773 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800774 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000775 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
776 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800777 AC_MSG_RESULT([yes])
778 AC_DEFINE([DISABLE_UTMP])
779 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700780 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000781 else
Tim Rice648f8762011-01-26 12:38:57 -0800782 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000783 fi
Tim Rice648f8762011-01-26 12:38:57 -0800784 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000785 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
786 [
Tim Rice648f8762011-01-26 12:38:57 -0800787 AC_CHECK_LIB([contract], [ct_tmpl_activate],
788 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000789 [Define if you have Solaris process contracts])
790 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000791 SPC_MSG="yes" ], )
792 ],
793 )
Tim Rice648f8762011-01-26 12:38:57 -0800794 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100795 [ --with-solaris-projects Enable Solaris projects (experimental)],
796 [
Tim Rice648f8762011-01-26 12:38:57 -0800797 AC_CHECK_LIB([project], [setproject],
798 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100799 [Define if you have Solaris projects])
800 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100801 SP_MSG="yes" ], )
802 ],
803 )
Damien Miller75b1d102000-01-07 14:01:41 +1100804 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000805*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000806 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800807 AC_CHECK_FUNCS([getpwanam])
808 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000809 conf_utmp_location=/etc/utmp
810 conf_wtmp_location=/var/adm/wtmp
811 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800812 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000813 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000814*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700815 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800816 AC_DEFINE([USE_PIPES])
817 AC_DEFINE([SSHD_ACQUIRES_CTTY])
818 AC_DEFINE([SETEUID_BREAKS_SETUID])
819 AC_DEFINE([BROKEN_SETREUID])
820 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000821 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000822*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700823 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800824 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100825 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800826 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100827 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800828 AC_DEFINE([USE_PIPES])
829 AC_DEFINE([IP_TOS_IS_BROKEN])
830 AC_DEFINE([SETEUID_BREAKS_SETUID])
831 AC_DEFINE([BROKEN_SETREUID])
832 AC_DEFINE([BROKEN_SETREGID])
833 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000834 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700835 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
836 # Attention: always take care to bind libsocket and libnsl before libc,
837 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000838 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800839# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100840*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800841 AC_DEFINE([USE_PIPES])
842 AC_DEFINE([SETEUID_BREAKS_SETUID])
843 AC_DEFINE([BROKEN_SETREUID])
844 AC_DEFINE([BROKEN_SETREGID])
845 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
846 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100847 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800848# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100849*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800850 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800851 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
852 AC_DEFINE([USE_PIPES])
853 AC_DEFINE([SETEUID_BREAKS_SETUID])
854 AC_DEFINE([BROKEN_GETADDRINFO])
855 AC_DEFINE([BROKEN_SETREUID])
856 AC_DEFINE([BROKEN_SETREGID])
857 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700858 case "$host" in
859 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
Tim Rice90f42b02011-06-02 18:17:49 -0700860 maildir=/var/spool/mail
Tim Rice4dbacff2005-06-01 20:09:28 -0700861 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800862 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700863 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800864 AC_DEFINE([BROKEN_UPDWTMPX])
865 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
866 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
867 AC_DEFINE([HAVE_SECUREWARE])
868 AC_DEFINE([DISABLE_SHADOW])
869 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700870 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800871 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800872 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800873 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700874 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100875 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100876*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100877 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800878# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100879*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800880 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100881 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800882# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100883*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800884 if test -z "$GCC"; then
885 CFLAGS="$CFLAGS -belf"
886 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100887 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000888 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800889 AC_DEFINE([USE_PIPES])
890 AC_DEFINE([HAVE_SECUREWARE])
891 AC_DEFINE([DISABLE_SHADOW])
892 AC_DEFINE([DISABLE_FD_PASSING])
893 AC_DEFINE([SETEUID_BREAKS_SETUID])
894 AC_DEFINE([BROKEN_GETADDRINFO])
895 AC_DEFINE([BROKEN_SETREUID])
896 AC_DEFINE([BROKEN_SETREGID])
897 AC_DEFINE([WITH_ABBREV_NO_TTY])
898 AC_DEFINE([BROKEN_UPDWTMPX])
899 AC_DEFINE([PASSWD_NEEDS_USERNAME])
900 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700901 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700902 TEST_SHELL=ksh
Tim Riceaa86c392013-03-16 20:55:46 -0700903 SKIP_DISABLE_LASTLOG_DEFINE=yes
Damien Millera66626b2000-06-13 18:57:53 +1000904 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000905*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800906 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700907 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800908 AC_DEFINE([SETEUID_BREAKS_SETUID])
909 AC_DEFINE([BROKEN_SETREUID])
910 AC_DEFINE([BROKEN_SETREGID])
911 AC_DEFINE([USE_PIPES])
912 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000913 LDFLAGS="$LDFLAGS"
914 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
915 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000916 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000917*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800918 AC_DEFINE([SETEUID_BREAKS_SETUID])
919 AC_DEFINE([BROKEN_SETREUID])
920 AC_DEFINE([BROKEN_SETREGID])
921 AC_DEFINE([WITH_ABBREV_NO_TTY])
922 AC_DEFINE([USE_PIPES])
923 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000924 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100925 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000926 MANTYPE=cat
927 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000928*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800929 AC_DEFINE([SETEUID_BREAKS_SETUID])
930 AC_DEFINE([BROKEN_SETREUID])
931 AC_DEFINE([BROKEN_SETREGID])
932 AC_DEFINE([USE_PIPES])
933 AC_DEFINE([DISABLE_FD_PASSING])
934 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000935 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
936 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
937 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700938 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000939*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800940 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000941 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800942 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000943 [ --with-osfsia Enable Digital Unix SIA],
944 [
945 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800946 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000947 no_osfsia=1
948 fi
949 ],
950 )
951 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000952 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800953 AC_MSG_RESULT([yes])
954 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700955 [Define if you have Digital Unix Security
956 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800957 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700958 [Define if you don't want to use your
959 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800960 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000961 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000962 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000963 else
Tim Rice648f8762011-01-26 12:38:57 -0800964 AC_MSG_RESULT([no])
965 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700966 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000967 fi
968 fi
Tim Rice648f8762011-01-26 12:38:57 -0800969 AC_DEFINE([BROKEN_GETADDRINFO])
970 AC_DEFINE([SETEUID_BREAKS_SETUID])
971 AC_DEFINE([BROKEN_SETREUID])
972 AC_DEFINE([BROKEN_SETREGID])
973 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000974 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000975
Tim Rice70335a62006-02-04 17:42:58 -0800976*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800977 AC_DEFINE([USE_PIPES])
978 AC_DEFINE([NO_X11_UNIX_SOCKETS])
979 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
980 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
981 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
982 AC_DEFINE([DISABLE_LASTLOG])
983 AC_DEFINE([SSHD_ACQUIRES_CTTY])
984 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800985 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000986 case "$host" in
987 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800988 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000989 ;;
990 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000991 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000992
993*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800994 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
995 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
996 AC_DEFINE([NEED_SETPGRP])
997 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700998 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000999
1000*-*-lynxos)
1001 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -08001002 AC_DEFINE([MISSING_HOWMANY])
1003 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +10001004 ;;
Damien Miller76112de1999-12-21 11:18:08 +11001005esac
1006
Tim Rice648f8762011-01-26 12:38:57 -08001007AC_MSG_CHECKING([compiler and flags for sanity])
1008AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
1009 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +10001010 [
Tim Rice648f8762011-01-26 12:38:57 -08001011 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +10001012 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001013 ],
1014 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +10001015)
1016
Darren Tucker0c9653f2005-05-28 15:58:14 +10001017dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +11001018# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -08001019AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
1020AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001021
Tim Rice1e1ef642003-09-11 22:19:31 -07001022dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -08001023AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
1024 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -07001025 AC_CACHE_CHECK([for broken dirname],
1026 ac_cv_have_broken_dirname, [
1027 save_LIBS="$LIBS"
1028 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +10001029 AC_RUN_IFELSE(
1030 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -07001031#include <libgen.h>
1032#include <string.h>
1033
1034int main(int argc, char **argv) {
1035 char *s, buf[32];
1036
1037 strncpy(buf,"/etc", 32);
1038 s = dirname(buf);
1039 if (!s || strncmp(s, "/", 32) != 0) {
1040 exit(1);
1041 } else {
1042 exit(0);
1043 }
1044}
Darren Tucker314d89e2005-10-17 23:29:23 +10001045 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -07001046 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +10001047 [ ac_cv_have_broken_dirname="yes" ],
1048 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -07001049 )
1050 LIBS="$save_LIBS"
1051 ])
1052 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1053 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001054 AC_DEFINE([HAVE_DIRNAME])
1055 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001056 fi
1057 ])
1058])
1059
Tim Rice648f8762011-01-26 12:38:57 -08001060AC_CHECK_FUNC([getspnam], ,
1061 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1062AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1063 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001064
Tim Rice13aae5e2001-10-21 17:53:58 -07001065dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001066AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001067 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001068 [ if test "x$withval" = "xno" ; then
1069 AC_MSG_ERROR([*** zlib is required ***])
1070 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001071 if test -d "$withval/lib"; then
1072 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001073 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001074 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001075 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001076 fi
1077 else
1078 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001079 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001080 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001081 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001082 fi
1083 fi
1084 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001085 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001086 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001087 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001088 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001089 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001090)
1091
Tim Rice648f8762011-01-26 12:38:57 -08001092AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1093AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001094 [
1095 saved_CPPFLAGS="$CPPFLAGS"
1096 saved_LDFLAGS="$LDFLAGS"
1097 save_LIBS="$LIBS"
1098 dnl Check default zlib install dir
1099 if test -n "${need_dash_r}"; then
1100 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1101 else
1102 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1103 fi
1104 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1105 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001106 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001107 [
1108 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1109 ]
1110 )
1111 ]
1112)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001113
Tim Rice648f8762011-01-26 12:38:57 -08001114AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001115 [ --without-zlib-version-check Disable zlib version check],
1116 [ if test "x$withval" = "xno" ; then
1117 zlib_check_nonfatal=1
1118 fi
1119 ]
1120)
1121
Tim Rice648f8762011-01-26 12:38:57 -08001122AC_MSG_CHECKING([for possibly buggy zlib])
1123AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001124#include <stdio.h>
Darren Tuckerc8a0f272013-03-22 12:49:14 +11001125#include <stdlib.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001126#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001127 ]],
1128 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001129 int a=0, b=0, c=0, d=0, n, v;
1130 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1131 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001132 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001133 v = a*1000000 + b*10000 + c*100 + d;
1134 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1135
1136 /* 1.1.4 is OK */
1137 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001138 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001139
Darren Tucker41097ed2005-07-25 15:24:21 +10001140 /* 1.2.3 and up are OK */
1141 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001142 exit(0);
1143
Darren Tucker2dcd2392004-01-23 17:13:33 +11001144 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001145 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001146 AC_MSG_RESULT([no]),
1147 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001148 if test -z "$zlib_check_nonfatal" ; then
1149 AC_MSG_ERROR([*** zlib too old - check config.log ***
1150Your reported zlib version has known security problems. It's possible your
1151vendor has fixed these problems without changing the version number. If you
1152are sure this is the case, you can disable the check by running
1153"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001154If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001155See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001156 else
1157 AC_MSG_WARN([zlib version may have security problems])
1158 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001159 ],
1160 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001161)
Damien Miller6f9c3372000-10-25 10:06:04 +11001162
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001163dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001164AC_CHECK_FUNC([strcasecmp],
1165 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001166)
Tim Rice648f8762011-01-26 12:38:57 -08001167AC_CHECK_FUNCS([utimes],
1168 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001169 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001170)
Damien Millerab18c411999-11-11 10:40:23 +11001171
Tim Ricee589a292001-11-03 11:09:32 -08001172dnl Checks for libutil functions
Damien Millerb87f6b72013-02-23 09:12:23 +11001173AC_CHECK_HEADERS([bsd/libutil.h libutil.h])
Damien Miller398c0ff2012-04-19 21:46:35 +10001174AC_SEARCH_LIBS([fmt_scaled], [util bsd])
1175AC_SEARCH_LIBS([login], [util bsd])
1176AC_SEARCH_LIBS([logout], [util bsd])
1177AC_SEARCH_LIBS([logwtmp], [util bsd])
1178AC_SEARCH_LIBS([openpty], [util bsd])
1179AC_SEARCH_LIBS([updwtmp], [util bsd])
1180AC_CHECK_FUNCS([fmt_scaled login logout openpty updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001181
Ben Lindstrom8697e082001-02-24 21:41:10 +00001182AC_FUNC_STRFTIME
1183
Damien Miller3c027682001-03-14 11:39:45 +11001184# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001185AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1186AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001187 [
1188 #include <glob.h>
1189 #ifdef GLOB_ALTDIRFUNC
1190 FOUNDIT
1191 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001192 ],
Damien Miller3c027682001-03-14 11:39:45 +11001193 [
Tim Rice648f8762011-01-26 12:38:57 -08001194 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001195 [Define if your system glob() function has
1196 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001197 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001198 ],
1199 [
Tim Rice648f8762011-01-26 12:38:57 -08001200 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001201 ]
1202)
Damien Millerab18c411999-11-11 10:40:23 +11001203
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001204# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001205AC_MSG_CHECKING([for gl_matchc field in glob_t])
1206AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1207 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001208 [
Tim Rice648f8762011-01-26 12:38:57 -08001209 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001210 [Define if your system glob() function has
1211 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001212 AC_MSG_RESULT([yes])
1213 ], [
1214 AC_MSG_RESULT([no])
1215])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001216
Damien Millera6e121a2010-10-07 21:39:17 +11001217# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001218AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1219AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001220#ifndef GLOB_KEEPSTAT
1221#error "glob does not support GLOB_KEEPSTAT extension"
1222#endif
1223glob_t g;
1224g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001225]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001226 [
Tim Rice648f8762011-01-26 12:38:57 -08001227 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001228 [Define if your system glob() function has
1229 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001230 AC_MSG_RESULT([yes])
1231 ], [
1232 AC_MSG_RESULT([no])
1233
1234])
Damien Millera6e121a2010-10-07 21:39:17 +11001235
Tim Rice648f8762011-01-26 12:38:57 -08001236AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001237
Damien Miller18bb4732001-03-28 14:35:30 +10001238AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001239AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001240 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001241#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001242#include <dirent.h>]],
1243 [[
1244 struct dirent d;
1245 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001246 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001247 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001248 [
Tim Rice648f8762011-01-26 12:38:57 -08001249 AC_MSG_RESULT([no])
1250 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001251 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001252 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001253 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001254 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001255 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001256 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001257 ]
1258)
1259
Damien Miller36f49652004-08-15 18:40:59 +10001260AC_MSG_CHECKING([for /proc/pid/fd directory])
1261if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001262 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1263 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001264else
Tim Rice648f8762011-01-26 12:38:57 -08001265 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001266fi
1267
Damien Millerc547bf12001-02-16 10:18:12 +11001268# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001269SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001270AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001271 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001272 [
1273 if test "x$withval" != "xno" ; then
1274
1275 if test "x$withval" != "xyes" ; then
1276 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1277 LDFLAGS="$LDFLAGS -L${withval}/lib"
1278 fi
1279
Tim Rice648f8762011-01-26 12:38:57 -08001280 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001281 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001282 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001283
Tim Rice4cec93f2002-02-26 08:40:48 -08001284 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001285 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001286 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001287#include <stdio.h>
1288#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001289 ]], [[
1290 char *ff = skey_keyinfo(""); ff="";
1291 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001292 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001293 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001294 [
Tim Rice648f8762011-01-26 12:38:57 -08001295 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001296 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1297 ])
Tim Rice648f8762011-01-26 12:38:57 -08001298 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1299 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1300#include <stdio.h>
1301#include <skey.h>
1302 ]], [[
1303 (void)skeychallenge(NULL,"name","",0);
1304 ]])],
1305 [
1306 AC_MSG_RESULT([yes])
1307 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001308 [Define if your skeychallenge()
1309 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001310 [
1311 AC_MSG_RESULT([no])
1312 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001313 fi
1314 ]
1315)
1316
1317# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001318TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001319AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001320 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001321 [
1322 if test "x$withval" != "xno" ; then
1323 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001324 saved_LDFLAGS="$LDFLAGS"
1325 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001326 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001327 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001328 if test -d "${withval}/lib"; then
1329 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001330 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001331 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001332 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001333 fi
1334 else
1335 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001336 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001337 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001338 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001339 fi
1340 fi
1341 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001342 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001343 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001344 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001345 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001346 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001347 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001348 AC_MSG_CHECKING([for libwrap])
1349 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001350#include <sys/types.h>
1351#include <sys/socket.h>
1352#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001353#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001354int deny_severity = 0, allow_severity = 0;
1355 ]], [[
1356 hosts_access(0);
1357 ]])], [
1358 AC_MSG_RESULT([yes])
1359 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001360 [Define if you want
1361 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001362 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001363 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001364 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001365 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001366
1367 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001368 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001369 fi
1370 ]
1371)
1372
Darren Tuckeraa3cbd12011-11-04 11:25:24 +11001373# Check whether user wants to use ldns
1374LDNS_MSG="no"
1375AC_ARG_WITH(ldns,
1376 [ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)],
1377 [
1378 if test "x$withval" != "xno" ; then
1379
1380 if test "x$withval" != "xyes" ; then
1381 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1382 LDFLAGS="$LDFLAGS -L${withval}/lib"
1383 fi
1384
1385 AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support])
1386 LIBS="-lldns $LIBS"
1387 LDNS_MSG="yes"
1388
1389 AC_MSG_CHECKING([for ldns support])
1390 AC_LINK_IFELSE(
1391 [AC_LANG_SOURCE([[
1392#include <stdio.h>
1393#include <stdlib.h>
1394#include <stdint.h>
1395#include <ldns/ldns.h>
1396int main() { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); }
1397 ]])
1398 ],
1399 [AC_MSG_RESULT(yes)],
1400 [
1401 AC_MSG_RESULT(no)
1402 AC_MSG_ERROR([** Incomplete or missing ldns libraries.])
1403 ])
1404 fi
1405 ]
1406)
1407
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001408# Check whether user wants libedit support
1409LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001410AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001411 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001412 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001413 if test "x$withval" = "xyes" ; then
Darren Tucker59353892012-05-19 15:24:37 +10001414 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001415 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001416 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001417 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001418 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001419 use_pkgconfig_for_libedit=yes
1420 else
Tim Rice648f8762011-01-26 12:38:57 -08001421 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001422 fi
1423 fi
1424 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001425 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1426 if test -n "${need_dash_r}"; then
1427 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1428 else
1429 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1430 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001431 fi
Damien Miller1f789802010-10-11 22:35:22 +11001432 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001433 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1434 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1435 else
1436 LIBEDIT="-ledit -lcurses"
1437 fi
1438 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001439 AC_CHECK_LIB([edit], [el_init],
1440 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001441 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001442 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001443 ],
Tim Rice648f8762011-01-26 12:38:57 -08001444 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001445 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001446 )
Tim Rice648f8762011-01-26 12:38:57 -08001447 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001448 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001449 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1450 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001451 int i = H_SETSIZE;
1452 el_init("", NULL, NULL, NULL);
1453 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001454 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001455 [ AC_MSG_RESULT([yes]) ],
1456 [ AC_MSG_RESULT([no])
1457 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001458 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001459 fi ]
1460)
1461
Darren Tuckerd9f88912005-02-20 21:01:48 +11001462AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001463AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001464 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001465 [
Tim Rice648f8762011-01-26 12:38:57 -08001466 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001467 case "$withval" in
1468 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001469 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001470 AUDIT_MODULE=bsm
1471 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001472 AC_CHECK_HEADERS([bsm/audit.h], [],
1473 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001474 [
1475#ifdef HAVE_TIME_H
1476# include <time.h>
1477#endif
1478 ]
1479)
Tim Rice648f8762011-01-26 12:38:57 -08001480 AC_CHECK_LIB([bsm], [getaudit], [],
1481 [AC_MSG_ERROR([BSM enabled and required library not found])])
1482 AC_CHECK_FUNCS([getaudit], [],
1483 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001484 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001485 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1486 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tucker93a2d412012-02-24 10:40:41 +11001487 if test "$sol2ver" -eq 11; then
1488 SSHDLIBS="$SSHDLIBS -lscf"
1489 AC_DEFINE([BROKEN_BSM_API], [1],
1490 [The system has incomplete BSM API])
1491 fi
Darren Tuckerd9f88912005-02-20 21:01:48 +11001492 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001493 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001494 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001495 AUDIT_MODULE=linux
1496 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001497 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001498 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001499 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001500 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001501 debug)
1502 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001503 AC_MSG_RESULT([debug])
1504 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001505 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001506 no)
Tim Rice648f8762011-01-26 12:38:57 -08001507 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001508 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001509 *)
1510 AC_MSG_ERROR([Unknown audit module $withval])
1511 ;;
1512 esac ]
1513)
1514
Damien Millerfe1f1432003-02-24 15:45:42 +11001515dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001516AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001517 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001518 arc4random_buf \
1519 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001520 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001521 b64_ntop \
1522 __b64_ntop \
1523 b64_pton \
1524 __b64_pton \
1525 bcopy \
1526 bindresvport_sa \
1527 clock \
1528 closefrom \
1529 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001530 fchmod \
1531 fchown \
1532 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001533 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001534 futimes \
1535 getaddrinfo \
1536 getcwd \
1537 getgrouplist \
1538 getnameinfo \
1539 getopt \
1540 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001541 getpeerucred \
Darren Tucker3c4a24c2013-02-15 11:41:35 +11001542 getpgid \
1543 getpgrp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001544 _getpty \
1545 getrlimit \
1546 getttyent \
1547 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001548 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001549 inet_aton \
1550 inet_ntoa \
1551 inet_ntop \
1552 innetgr \
1553 login_getcapbool \
1554 md5_crypt \
1555 memmove \
1556 mkdtemp \
1557 mmap \
1558 ngetaddrinfo \
1559 nsleep \
1560 ogetaddrinfo \
1561 openlog_r \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001562 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001563 prctl \
1564 pstat \
1565 readpassphrase \
1566 realpath \
1567 recvmsg \
1568 rresvport_af \
1569 sendmsg \
1570 setdtablesize \
1571 setegid \
1572 setenv \
1573 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001574 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001575 setgroups \
Darren Tucker34f702a2012-07-04 08:50:09 +10001576 setlinebuf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001577 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001578 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001579 setpcred \
1580 setproctitle \
1581 setregid \
1582 setreuid \
1583 setrlimit \
1584 setsid \
1585 setvbuf \
1586 sigaction \
1587 sigvec \
1588 snprintf \
1589 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001590 statfs \
1591 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001592 strdup \
1593 strerror \
1594 strlcat \
1595 strlcpy \
1596 strmode \
Darren Tuckerb54f50e2011-09-29 23:17:18 +10001597 strnlen \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001598 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001599 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001600 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001601 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001602 strtoul \
Darren Tucker8e6fb782013-02-15 12:13:01 +11001603 strtoull \
Damien Miller34a17692007-06-11 14:15:42 +10001604 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001605 sysconf \
1606 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001607 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001608 truncate \
1609 unsetenv \
1610 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001611 user_from_uid \
Damien Millerf4db77d2013-03-15 10:34:25 +11001612 usleep \
Damien Miller57f39152005-11-24 19:58:19 +11001613 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001614 vhangup \
1615 vsnprintf \
1616 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001617])
Tim Rice13aae5e2001-10-21 17:53:58 -07001618
Tim Ricec7a8af02010-11-08 14:26:23 -08001619AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001620 [AC_LANG_PROGRAM(
1621 [[ #include <ctype.h> ]],
1622 [[ return (isblank('a')); ]])],
1623 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001624])
1625
Damien Millerb3c9f782010-02-12 10:11:34 +11001626# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001627AC_SEARCH_LIBS([dlopen], [dl],
1628 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001629)
1630
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001631# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001632AC_CHECK_FUNCS([gai_strerror], [
1633 AC_DEFINE([HAVE_GAI_STRERROR])
1634 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001635#include <sys/types.h>
1636#include <sys/socket.h>
1637#include <netdb.h>
1638
Tim Rice648f8762011-01-26 12:38:57 -08001639const char *gai_strerror(int);
1640 ]], [[
1641 char *str;
1642 str = gai_strerror(0);
1643 ]])], [
1644 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1645 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001646
Tim Rice648f8762011-01-26 12:38:57 -08001647AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1648 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001649
Darren Tuckerf1159b52003-07-07 19:44:01 +10001650dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001651AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1652AC_CHECK_DECL([strsep],
1653 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001654 [],
1655 [
1656#ifdef HAVE_STRING_H
1657# include <string.h>
1658#endif
1659 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001660
Darren Tuckerb2427c82003-09-10 15:22:44 +10001661dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001662AC_CHECK_DECL([tcsendbreak],
1663 [AC_DEFINE([HAVE_TCSENDBREAK])],
1664 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001665 [#include <termios.h>]
1666)
1667
Tim Rice648f8762011-01-26 12:38:57 -08001668AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001669
Tim Rice648f8762011-01-26 12:38:57 -08001670AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001671 [
1672#include <sys/types.h>
1673#include <sys/socket.h>
1674 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001675
Tim Rice648f8762011-01-26 12:38:57 -08001676AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001677 [
1678#include <sys/types.h>
1679#ifdef HAVE_SYS_STAT_H
1680# include <sys/stat.h>
1681#endif
1682#ifdef HAVE_FCNTL_H
1683# include <fcntl.h>
1684#endif
1685 ])
1686
Tim Rice648f8762011-01-26 12:38:57 -08001687AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001688#include <sys/types.h>
1689#include <sys/uio.h>
1690#include <unistd.h>
1691 ])
1692
Tim Rice648f8762011-01-26 12:38:57 -08001693AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001694#include <sys/param.h>
1695 ])
1696
Tim Rice648f8762011-01-26 12:38:57 -08001697AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001698#include <stddef.h>
1699 ])
1700
Tim Rice648f8762011-01-26 12:38:57 -08001701AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001702 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001703 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001704 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001705 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001706#include <stdlib.h>
1707#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001708 ]], [[
1709 errno=0;
1710 setresuid(0,0,0);
1711 if (errno==ENOSYS)
1712 exit(1);
1713 else
1714 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001715 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001716 [AC_MSG_RESULT([yes])],
1717 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001718 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001719 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001720 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001721 )
1722])
Darren Tuckere937be32003-12-17 18:53:26 +11001723
Tim Rice648f8762011-01-26 12:38:57 -08001724AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001725 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001726 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001727 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001728 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001729#include <stdlib.h>
1730#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001731 ]], [[
1732 errno=0;
1733 setresgid(0,0,0);
1734 if (errno==ENOSYS)
1735 exit(1);
1736 else
1737 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001738 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001739 [AC_MSG_RESULT([yes])],
1740 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001741 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001742 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001743 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001744 )
1745])
Darren Tuckere937be32003-12-17 18:53:26 +11001746
Damien Millerad833b32000-08-23 10:46:23 +10001747dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001748AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001749dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001750AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1751AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001752dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001753AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1754AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001755dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001756AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001757
Tim Rice648f8762011-01-26 12:38:57 -08001758AC_CHECK_FUNC([daemon],
1759 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1760 [AC_CHECK_LIB([bsd], [daemon],
1761 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001762)
1763
Tim Rice648f8762011-01-26 12:38:57 -08001764AC_CHECK_FUNC([getpagesize],
1765 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001766 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001767 [AC_CHECK_LIB([ucb], [getpagesize],
1768 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001769)
1770
Damien Millercb170cb2000-07-01 16:52:55 +10001771# Check for broken snprintf
1772if test "x$ac_cv_func_snprintf" = "xyes" ; then
1773 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001774 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001775 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1776 [[
1777 char b[5];
1778 snprintf(b,5,"123456789");
1779 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001780 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001781 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001782 [
Tim Rice648f8762011-01-26 12:38:57 -08001783 AC_MSG_RESULT([no])
1784 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001785 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001786 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001787 ],
1788 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001789 )
1790fi
1791
Damien Miller57f39152005-11-24 19:58:19 +11001792# If we don't have a working asprintf, then we strongly depend on vsnprintf
1793# returning the right thing on overflow: the number of characters it tried to
1794# create (as per SUSv3)
1795if test "x$ac_cv_func_asprintf" != "xyes" && \
1796 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1797 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1798 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001799 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001800#include <sys/types.h>
1801#include <stdio.h>
1802#include <stdarg.h>
1803
1804int x_snprintf(char *str,size_t count,const char *fmt,...)
1805{
1806 size_t ret; va_list ap;
1807 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1808 return ret;
1809}
Tim Rice648f8762011-01-26 12:38:57 -08001810 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001811 char x[1];
1812 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001813 ]])],
1814 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001815 [
Tim Rice648f8762011-01-26 12:38:57 -08001816 AC_MSG_RESULT([no])
1817 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001818 [Define if your snprintf is busted])
1819 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1820 ],
1821 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1822 )
1823fi
1824
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001825# On systems where [v]snprintf is broken, but is declared in stdio,
1826# check that the fmt argument is const char * or just char *.
1827# This is only useful for when BROKEN_SNPRINTF
1828AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001829AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1830#include <stdio.h>
1831int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1832 ]], [[
1833 snprintf(0, 0, 0);
1834 ]])],
1835 [AC_MSG_RESULT([yes])
1836 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001837 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001838 [AC_MSG_RESULT([no])
1839 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001840
Damien Millerb4097182004-05-23 14:09:40 +10001841# Check for missing getpeereid (or equiv) support
1842NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001843if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001844 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001845 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1846#include <sys/types.h>
1847#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1848 [ AC_MSG_RESULT([yes])
1849 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1850 ], [AC_MSG_RESULT([no])
1851 NO_PEERCHECK=1
1852 ])
Damien Millerb4097182004-05-23 14:09:40 +10001853fi
1854
Damien Millere8328192003-01-07 15:18:32 +11001855dnl see whether mkstemp() requires XXXXXX
1856if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1857AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001858AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001859 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001860#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001861 ]], [[
1862 char template[]="conftest.mkstemp-test";
1863 if (mkstemp(template) == -1)
1864 exit(1);
1865 unlink(template);
1866 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001867 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001868 [
Tim Rice648f8762011-01-26 12:38:57 -08001869 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001870 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001871 [
Tim Rice648f8762011-01-26 12:38:57 -08001872 AC_MSG_RESULT([yes])
1873 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001874 ],
1875 [
Tim Rice648f8762011-01-26 12:38:57 -08001876 AC_MSG_RESULT([yes])
1877 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001878 ]
Damien Millere8328192003-01-07 15:18:32 +11001879)
1880fi
1881
Darren Tucker70a3d552003-08-21 17:58:29 +10001882dnl make sure that openpty does not reacquire controlling terminal
1883if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001884 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001885 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001886 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001887#include <stdio.h>
1888#include <sys/fcntl.h>
1889#include <sys/types.h>
1890#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001891 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001892 pid_t pid;
1893 int fd, ptyfd, ttyfd, status;
1894
1895 pid = fork();
1896 if (pid < 0) { /* failed */
1897 exit(1);
1898 } else if (pid > 0) { /* parent */
1899 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001900 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001901 exit(WEXITSTATUS(status));
1902 else
1903 exit(2);
1904 } else { /* child */
1905 close(0); close(1); close(2);
1906 setsid();
1907 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1908 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1909 if (fd >= 0)
1910 exit(3); /* Acquired ctty: broken */
1911 else
1912 exit(0); /* Did not acquire ctty: OK */
1913 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001914 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001915 [
Tim Rice648f8762011-01-26 12:38:57 -08001916 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001917 ],
1918 [
Tim Rice648f8762011-01-26 12:38:57 -08001919 AC_MSG_RESULT([no])
1920 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001921 ],
1922 [
Tim Rice648f8762011-01-26 12:38:57 -08001923 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001924 ]
1925 )
1926fi
1927
Tim Rice8bb561b2005-03-17 16:23:19 -08001928if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1929 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001930 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001931 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001932 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001933#include <stdio.h>
1934#include <sys/socket.h>
1935#include <netdb.h>
1936#include <errno.h>
1937#include <netinet/in.h>
1938
1939#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001940 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001941 int err, sock;
1942 struct addrinfo *gai_ai, *ai, hints;
1943 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1944
1945 memset(&hints, 0, sizeof(hints));
1946 hints.ai_family = PF_UNSPEC;
1947 hints.ai_socktype = SOCK_STREAM;
1948 hints.ai_flags = AI_PASSIVE;
1949
1950 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1951 if (err != 0) {
1952 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1953 exit(1);
1954 }
1955
1956 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1957 if (ai->ai_family != AF_INET6)
1958 continue;
1959
1960 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1961 sizeof(ntop), strport, sizeof(strport),
1962 NI_NUMERICHOST|NI_NUMERICSERV);
1963
1964 if (err != 0) {
1965 if (err == EAI_SYSTEM)
1966 perror("getnameinfo EAI_SYSTEM");
1967 else
1968 fprintf(stderr, "getnameinfo failed: %s\n",
1969 gai_strerror(err));
1970 exit(2);
1971 }
1972
1973 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1974 if (sock < 0)
1975 perror("socket");
1976 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1977 if (errno == EBADF)
1978 exit(3);
1979 }
1980 }
1981 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001982 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001983 [
Tim Rice648f8762011-01-26 12:38:57 -08001984 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001985 ],
1986 [
Tim Rice648f8762011-01-26 12:38:57 -08001987 AC_MSG_RESULT([no])
1988 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001989 ],
1990 [
Tim Rice648f8762011-01-26 12:38:57 -08001991 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001992 ]
1993 )
1994fi
1995
Tim Rice8bb561b2005-03-17 16:23:19 -08001996if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1997 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001998 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001999 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002000 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11002001#include <stdio.h>
2002#include <sys/socket.h>
2003#include <netdb.h>
2004#include <errno.h>
2005#include <netinet/in.h>
2006
2007#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08002008 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11002009 int err, sock;
2010 struct addrinfo *gai_ai, *ai, hints;
2011 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
2012
2013 memset(&hints, 0, sizeof(hints));
2014 hints.ai_family = PF_UNSPEC;
2015 hints.ai_socktype = SOCK_STREAM;
2016 hints.ai_flags = AI_PASSIVE;
2017
2018 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
2019 if (err != 0) {
2020 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
2021 exit(1);
2022 }
2023
2024 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
2025 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2026 continue;
2027
2028 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
2029 sizeof(ntop), strport, sizeof(strport),
2030 NI_NUMERICHOST|NI_NUMERICSERV);
2031
2032 if (ai->ai_family == AF_INET && err != 0) {
2033 perror("getnameinfo");
2034 exit(2);
2035 }
2036 }
2037 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10002038 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11002039 [
Tim Rice648f8762011-01-26 12:38:57 -08002040 AC_MSG_RESULT([yes])
2041 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002042 [Define if you have a getaddrinfo that fails
2043 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11002044 ],
2045 [
Tim Rice648f8762011-01-26 12:38:57 -08002046 AC_MSG_RESULT([no])
2047 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10002048 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10002049 [
Tim Rice648f8762011-01-26 12:38:57 -08002050 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11002051 ]
2052 )
2053fi
2054
Darren Tuckera56f1912004-11-02 20:30:54 +11002055if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002056 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
2057 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
2058 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11002059 [
Tim Rice648f8762011-01-26 12:38:57 -08002060 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11002061 ],
2062 [
Tim Rice648f8762011-01-26 12:38:57 -08002063 AC_MSG_RESULT([yes])
2064 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11002065 [Conflicting defs for getspnam])
2066 ]
2067 )
2068fi
2069
Damien Miller606f8802000-09-16 15:39:56 +11002070AC_FUNC_GETPGRP
2071
Tim Riceaef73712002-05-11 13:17:42 -07002072# Search for OpenSSL
2073saved_CPPFLAGS="$CPPFLAGS"
2074saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08002075AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11002076 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2077 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00002078 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11002079 case "$withval" in
2080 # Relative paths
2081 ./*|../*) withval="`pwd`/$withval"
2082 esac
Tim Riceaef73712002-05-11 13:17:42 -07002083 if test -d "$withval/lib"; then
2084 if test -n "${need_dash_r}"; then
2085 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2086 else
2087 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2088 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10002089 elif test -d "$withval/lib64"; then
2090 if test -n "${need_dash_r}"; then
2091 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
2092 else
2093 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
2094 fi
Tim Riceaef73712002-05-11 13:17:42 -07002095 else
2096 if test -n "${need_dash_r}"; then
2097 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2098 else
2099 LDFLAGS="-L${withval} ${LDFLAGS}"
2100 fi
2101 fi
2102 if test -d "$withval/include"; then
2103 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2104 else
2105 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2106 fi
Damien Millera22ba012000-03-02 23:09:20 +11002107 fi
2108 ]
2109)
Tim Rice3d5352e2004-02-12 09:27:21 -08002110LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002111AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002112 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002113 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002114 [
Tim Riceaef73712002-05-11 13:17:42 -07002115 dnl Check default openssl install dir
2116 if test -n "${need_dash_r}"; then
2117 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002118 else
Tim Riceaef73712002-05-11 13:17:42 -07002119 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002120 fi
Tim Riceaef73712002-05-11 13:17:42 -07002121 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002122 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002123 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2124 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002125 [
2126 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2127 ]
2128 )
2129 ]
2130)
2131
Tim Riced730b782002-08-13 18:52:10 -07002132# Determine OpenSSL header version
2133AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002134AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002135 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002136#include <stdio.h>
2137#include <string.h>
2138#include <openssl/opensslv.h>
2139#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002140 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002141 FILE *fd;
2142 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002143
Damien Millera8e06ce2003-11-21 23:48:55 +11002144 fd = fopen(DATA,"w");
2145 if(fd == NULL)
2146 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002147
2148 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2149 exit(1);
2150
2151 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002152 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002153 [
2154 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002155 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002156 ],
2157 [
Tim Rice648f8762011-01-26 12:38:57 -08002158 AC_MSG_RESULT([not found])
2159 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002160 ],
2161 [
2162 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002163 ]
2164)
2165
2166# Determine OpenSSL library version
2167AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002168AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002169 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002170#include <stdio.h>
2171#include <string.h>
2172#include <openssl/opensslv.h>
2173#include <openssl/crypto.h>
2174#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002175 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 FILE *fd;
2177 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002178
Damien Millera8e06ce2003-11-21 23:48:55 +11002179 fd = fopen(DATA,"w");
2180 if(fd == NULL)
2181 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002182
2183 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2184 exit(1);
2185
2186 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002187 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002188 [
2189 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002190 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002191 ],
2192 [
Tim Rice648f8762011-01-26 12:38:57 -08002193 AC_MSG_RESULT([not found])
2194 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002195 ],
2196 [
2197 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002198 ]
2199)
Damien Millera22ba012000-03-02 23:09:20 +11002200
Tim Rice648f8762011-01-26 12:38:57 -08002201AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002202 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2203 [ if test "x$withval" = "xno" ; then
2204 openssl_check_nonfatal=1
2205 fi
2206 ]
2207)
2208
Damien Millerec932372002-01-22 22:16:03 +11002209# Sanity check OpenSSL headers
2210AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002211AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002212 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002213#include <string.h>
2214#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002215 ]], [[
2216 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002217 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002218 [
Tim Rice648f8762011-01-26 12:38:57 -08002219 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002220 ],
2221 [
Tim Rice648f8762011-01-26 12:38:57 -08002222 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002223 if test "x$openssl_check_nonfatal" = "x"; then
2224 AC_MSG_ERROR([Your OpenSSL headers do not match your
2225library. Check config.log for details.
2226If you are sure your installation is consistent, you can disable the check
2227by running "./configure --without-openssl-header-check".
2228Also see contrib/findssl.sh for help identifying header/library mismatches.
2229])
2230 else
2231 AC_MSG_WARN([Your OpenSSL headers do not match your
2232library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002233Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002234 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002235 ],
2236 [
2237 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002238 ]
2239)
2240
Darren Tucker639bbe82006-08-20 20:17:53 +10002241AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2242AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002243 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2244 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002245 [
Tim Rice648f8762011-01-26 12:38:57 -08002246 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002247 ],
2248 [
Tim Rice648f8762011-01-26 12:38:57 -08002249 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002250 saved_LIBS="$LIBS"
2251 LIBS="$LIBS -ldl"
2252 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2253 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002254 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2255 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002256 [
Tim Rice648f8762011-01-26 12:38:57 -08002257 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002258 ],
2259 [
Tim Rice648f8762011-01-26 12:38:57 -08002260 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002261 LIBS="$saved_LIBS"
2262 ]
2263 )
2264 ]
2265)
2266
Darren Tuckere9b3ad72012-01-17 14:03:34 +11002267AC_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 +11002268
Tim Rice648f8762011-01-26 12:38:57 -08002269AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002270 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2271 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002272 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2273 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2274#include <openssl/engine.h>
2275 ]], [[
2276 ENGINE_load_builtin_engines();
2277 ENGINE_register_all_complete();
2278 ]])],
2279 [ AC_MSG_RESULT([yes])
2280 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002281 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002282 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2283 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002284 fi ]
2285)
2286
Darren Tucker129d0bb2005-12-19 17:40:40 +11002287# Check for OpenSSL without EVP_aes_{192,256}_cbc
2288AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002289AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002290 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002291#include <string.h>
2292#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002293 ]], [[
2294 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002295 ]])],
2296 [
Tim Rice648f8762011-01-26 12:38:57 -08002297 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002298 ],
2299 [
Tim Rice648f8762011-01-26 12:38:57 -08002300 AC_MSG_RESULT([yes])
2301 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002302 [libcrypto is missing AES 192 and 256 bit functions])
2303 ]
2304)
2305
Damien Miller25a02b02012-12-13 08:18:56 +11002306# Check for OpenSSL with EVP_aes_*ctr
2307AC_MSG_CHECKING([whether OpenSSL has AES CTR via EVP])
2308AC_LINK_IFELSE(
2309 [AC_LANG_PROGRAM([[
2310#include <string.h>
2311#include <openssl/evp.h>
2312 ]], [[
2313 exit(EVP_aes_128_ctr() == NULL ||
2314 EVP_aes_192_cbc() == NULL ||
2315 EVP_aes_256_cbc() == NULL);
2316 ]])],
2317 [
2318 AC_MSG_RESULT([yes])
2319 AC_DEFINE([OPENSSL_HAVE_EVPCTR], [1],
2320 [libcrypto has EVP AES CTR])
2321 ],
2322 [
2323 AC_MSG_RESULT([no])
2324 ]
2325)
2326
Damien Millerd522c682013-01-09 16:42:47 +11002327# Check for OpenSSL with EVP_aes_*gcm
2328AC_MSG_CHECKING([whether OpenSSL has AES GCM via EVP])
2329AC_LINK_IFELSE(
2330 [AC_LANG_PROGRAM([[
2331#include <string.h>
2332#include <openssl/evp.h>
2333 ]], [[
2334 exit(EVP_aes_128_gcm() == NULL ||
Damien Millerb6f73b32013-02-11 10:39:12 +11002335 EVP_aes_256_gcm() == NULL ||
2336 EVP_CTRL_GCM_SET_IV_FIXED == 0 ||
2337 EVP_CTRL_GCM_IV_GEN == 0 ||
2338 EVP_CTRL_GCM_SET_TAG == 0 ||
2339 EVP_CTRL_GCM_GET_TAG == 0 ||
2340 EVP_CIPHER_CTX_ctrl(NULL, 0, 0, NULL) == 0);
Damien Millerd522c682013-01-09 16:42:47 +11002341 ]])],
2342 [
2343 AC_MSG_RESULT([yes])
2344 AC_DEFINE([OPENSSL_HAVE_EVPGCM], [1],
2345 [libcrypto has EVP AES GCM])
2346 ],
2347 [
2348 AC_MSG_RESULT([no])
2349 ]
2350)
2351
Damien Millerb6f73b32013-02-11 10:39:12 +11002352AC_SEARCH_LIBS([EVP_CIPHER_CTX_ctrl], [crypto],
2353 [AC_DEFINE([HAVE_EVP_CIPHER_CTX_CTRL], [1],
2354 [Define if libcrypto has EVP_CIPHER_CTX_ctrl])])
2355
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002356AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2357AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002358 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002359#include <string.h>
2360#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002361 ]], [[
2362 if(EVP_DigestUpdate(NULL, NULL,0))
2363 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002364 ]])],
2365 [
Tim Rice648f8762011-01-26 12:38:57 -08002366 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002367 ],
2368 [
Tim Rice648f8762011-01-26 12:38:57 -08002369 AC_MSG_RESULT([no])
2370 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002371 [Define if EVP_DigestUpdate returns void])
2372 ]
2373)
2374
Tim Rice3d5352e2004-02-12 09:27:21 -08002375# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2376# because the system crypt() is more featureful.
2377if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002378 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002379fi
2380
Damien Millera8e06ce2003-11-21 23:48:55 +11002381# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002382# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002383if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002384 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002385fi
2386
Damien Milleraf87af12006-03-15 13:02:28 +11002387# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002388AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002389 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002390AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002391
Damien Miller6af914a2010-09-10 11:39:26 +10002392# Check complete ECC support in OpenSSL
2393AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2394AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002395 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002396#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002397#include <openssl/ecdh.h>
2398#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002399#include <openssl/evp.h>
2400#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002401#include <openssl/opensslv.h>
2402#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2403# error "OpenSSL < 0.9.8g has unreliable ECC code"
2404#endif
Tim Rice648f8762011-01-26 12:38:57 -08002405 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002406 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2407 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002408 ]])],
2409 [
Tim Rice648f8762011-01-26 12:38:57 -08002410 AC_MSG_RESULT([yes])
2411 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002412 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002413 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002414 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002415 ],
2416 [
Tim Rice648f8762011-01-26 12:38:57 -08002417 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002418 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002419 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002420 ]
2421)
Tim Rice648f8762011-01-26 12:38:57 -08002422AC_SUBST([TEST_SSH_ECC])
2423AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002424
Tim Rice99203ec2007-03-26 09:35:28 -07002425saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002426AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002427 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002428 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2429 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002430 [Define if system has libiaf that supports set_id])
2431 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002432])
2433LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002434
2435### Configure cryptographic random number support
2436
2437# Check wheter OpenSSL seeds itself
2438AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002439AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002440 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002441#include <string.h>
2442#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002443 ]], [[
2444 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002445 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002446 [
2447 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002448 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002449 ],
2450 [
Tim Rice648f8762011-01-26 12:38:57 -08002451 AC_MSG_RESULT([no])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002452 ],
2453 [
2454 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002455 # This is safe, since we will fatal() at runtime if
2456 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002457 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002458 ]
2459)
2460
Damien Millerf22019b2011-05-05 13:48:37 +10002461# PRNGD TCP socket
2462AC_ARG_WITH([prngd-port],
2463 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2464 [
2465 case "$withval" in
2466 no)
2467 withval=""
2468 ;;
2469 [[0-9]]*)
2470 ;;
2471 *)
2472 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2473 ;;
2474 esac
2475 if test ! -z "$withval" ; then
2476 PRNGD_PORT="$withval"
2477 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2478 [Port number of PRNGD/EGD random number socket])
2479 fi
2480 ]
2481)
2482
2483# PRNGD Unix domain socket
2484AC_ARG_WITH([prngd-socket],
2485 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2486 [
2487 case "$withval" in
2488 yes)
2489 withval="/var/run/egd-pool"
2490 ;;
2491 no)
2492 withval=""
2493 ;;
2494 /*)
2495 ;;
2496 *)
2497 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2498 ;;
2499 esac
2500
2501 if test ! -z "$withval" ; then
2502 if test ! -z "$PRNGD_PORT" ; then
2503 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2504 fi
2505 if test ! -r "$withval" ; then
2506 AC_MSG_WARN([Entropy socket is not readable])
2507 fi
2508 PRNGD_SOCKET="$withval"
2509 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2510 [Location of PRNGD/EGD random number socket])
2511 fi
2512 ],
2513 [
2514 # Check for existing socket only if we don't have a random device already
2515 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2516 AC_MSG_CHECKING([for PRNGD/EGD socket])
2517 # Insert other locations here
2518 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2519 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2520 PRNGD_SOCKET="$sock"
2521 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2522 break;
2523 fi
2524 done
2525 if test ! -z "$PRNGD_SOCKET" ; then
2526 AC_MSG_RESULT([$PRNGD_SOCKET])
2527 else
2528 AC_MSG_RESULT([not found])
2529 fi
2530 fi
2531 ]
2532)
2533
2534# Which randomness source do we use?
2535if test ! -z "$PRNGD_PORT" ; then
2536 RAND_MSG="PRNGd port $PRNGD_PORT"
2537elif test ! -z "$PRNGD_SOCKET" ; then
2538 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2539elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2540 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2541 [Define if you want OpenSSL's internally seeded PRNG only])
2542 RAND_MSG="OpenSSL internal ONLY"
2543else
2544 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])
2545fi
2546
Darren Tucker3e6bde42006-08-20 20:03:50 +10002547# Check for PAM libs
2548PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002549AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002550 [ --with-pam Enable PAM support ],
2551 [
2552 if test "x$withval" != "xno" ; then
2553 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2554 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2555 AC_MSG_ERROR([PAM headers not found])
2556 fi
2557
2558 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002559 AC_CHECK_LIB([dl], [dlopen], , )
2560 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2561 AC_CHECK_FUNCS([pam_getenvlist])
2562 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002563 LIBS="$saved_LIBS"
2564
2565 PAM_MSG="yes"
2566
Darren Tucker20e9f972007-03-25 18:26:01 +10002567 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002568 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002569 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002570
Darren Tucker3e6bde42006-08-20 20:03:50 +10002571 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002572 case "$LIBS" in
2573 *-ldl*)
2574 # libdl already in LIBS
2575 ;;
2576 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002577 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002578 ;;
2579 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002580 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002581 fi
2582 ]
2583)
2584
2585# Check for older PAM
2586if test "x$PAM_MSG" = "xyes" ; then
2587 # Check PAM strerror arguments (old PAM)
2588 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002589 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002590#include <stdlib.h>
2591#if defined(HAVE_SECURITY_PAM_APPL_H)
2592#include <security/pam_appl.h>
2593#elif defined (HAVE_PAM_PAM_APPL_H)
2594#include <pam/pam_appl.h>
2595#endif
Tim Rice648f8762011-01-26 12:38:57 -08002596 ]], [[
2597(void)pam_strerror((pam_handle_t *)NULL, -1);
2598 ]])], [AC_MSG_RESULT([no])], [
2599 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002600 [Define if you have an old version of PAM
2601 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002602 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002603 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002604
2605 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002606fi
Damien Miller6c21c512002-01-22 21:57:53 +11002607
Damien Millerd3f6ad22002-06-25 10:24:47 +10002608SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002609AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002610 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002611 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002612 if test -n "$withval" && test "x$withval" != "xno" && \
2613 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002614 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002615 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002616 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002617)
Tim Rice648f8762011-01-26 12:38:57 -08002618AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002619 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002620AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002621
Damien Miller91f40d82013-02-22 11:37:00 +11002622if test "x$have_linux_no_new_privs" = "x1" ; then
2623AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [
2624 #include <sys/types.h>
2625 #include <linux/seccomp.h>
2626])
2627fi
2628if test "x$have_seccomp_filter" = "x1" ; then
2629AC_MSG_CHECKING([kernel for seccomp_filter support])
2630AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2631 #include <errno.h>
2632 #include <elf.h>
2633 #include <linux/audit.h>
2634 #include <linux/seccomp.h>
2635 #include <stdlib.h>
2636 #include <sys/prctl.h>
2637 ]],
2638 [[ int i = $seccomp_audit_arch;
2639 errno = 0;
2640 prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0);
2641 exit(errno == EFAULT ? 0 : 1); ]])],
2642 [ AC_MSG_RESULT([yes]) ], [
2643 AC_MSG_RESULT([no])
2644 # Disable seccomp filter as a target
2645 have_seccomp_filter=0
2646 ]
2647)
2648fi
2649
Damien Miller69ff1df2011-06-23 08:30:03 +10002650# Decide which sandbox style to use
2651sandbox_arg=""
2652AC_ARG_WITH([sandbox],
Damien Millere0956e32012-04-04 11:27:54 +10002653 [ --with-sandbox=style Specify privilege separation sandbox (no, darwin, rlimit, systrace, seccomp_filter)],
Damien Miller69ff1df2011-06-23 08:30:03 +10002654 [
2655 if test "x$withval" = "xyes" ; then
2656 sandbox_arg=""
2657 else
2658 sandbox_arg="$withval"
2659 fi
2660 ]
2661)
Darren Tucker60395f92012-07-03 14:31:18 +10002662
2663# Some platforms (seems to be the ones that have a kernel poll(2)-type
2664# function with which they implement select(2)) use an extra file descriptor
2665# when calling select(2), which means we can't use the rlimit sandbox.
2666AC_MSG_CHECKING([if select works with descriptor rlimit])
2667AC_RUN_IFELSE(
2668 [AC_LANG_PROGRAM([[
2669#include <sys/types.h>
2670#ifdef HAVE_SYS_TIME_H
2671# include <sys/time.h>
2672#endif
2673#include <sys/resource.h>
2674#ifdef HAVE_SYS_SELECT_H
2675# include <sys/select.h>
2676#endif
2677#include <errno.h>
2678#include <fcntl.h>
2679#include <stdlib.h>
2680 ]],[[
2681 struct rlimit rl_zero;
2682 int fd, r;
2683 fd_set fds;
Damien Millere4f43472013-03-08 12:14:22 +11002684 struct timeval tv;
Darren Tucker60395f92012-07-03 14:31:18 +10002685
2686 fd = open("/dev/null", O_RDONLY);
2687 FD_ZERO(&fds);
2688 FD_SET(fd, &fds);
2689 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2690 setrlimit(RLIMIT_FSIZE, &rl_zero);
2691 setrlimit(RLIMIT_NOFILE, &rl_zero);
Damien Millere4f43472013-03-08 12:14:22 +11002692 tv.tv_sec = 1;
2693 tv.tv_usec = 0;
2694 r = select(fd+1, &fds, NULL, NULL, &tv);
Darren Tucker60395f92012-07-03 14:31:18 +10002695 exit (r == -1 ? 1 : 0);
2696 ]])],
2697 [AC_MSG_RESULT([yes])
2698 select_works_with_rlimit=yes],
2699 [AC_MSG_RESULT([no])
2700 select_works_with_rlimit=no],
2701 [AC_MSG_WARN([cross compiling: assuming yes])]
2702)
2703
Darren Tuckerff008de2013-03-06 17:48:48 +11002704AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works])
2705AC_RUN_IFELSE(
2706 [AC_LANG_PROGRAM([[
2707#include <sys/types.h>
2708#ifdef HAVE_SYS_TIME_H
2709# include <sys/time.h>
2710#endif
2711#include <sys/resource.h>
2712#include <errno.h>
2713#include <stdlib.h>
2714 ]],[[
2715 struct rlimit rl_zero;
2716 int fd, r;
2717 fd_set fds;
2718
2719 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2720 r = setrlimit(RLIMIT_NOFILE, &rl_zero);
2721 exit (r == -1 ? 1 : 0);
2722 ]])],
2723 [AC_MSG_RESULT([yes])
2724 rlimit_nofile_zero_works=yes],
2725 [AC_MSG_RESULT([no])
2726 rlimit_nofile_zero_works=no],
2727 [AC_MSG_WARN([cross compiling: assuming yes])]
2728)
2729
Darren Tuckerd545a4b2012-07-03 22:48:31 +10002730AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works])
2731AC_RUN_IFELSE(
2732 [AC_LANG_PROGRAM([[
2733#include <sys/types.h>
2734#include <sys/resource.h>
2735#include <stdlib.h>
2736 ]],[[
2737 struct rlimit rl_zero;
2738
2739 rl_zero.rlim_cur = rl_zero.rlim_max = 0;
2740 exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0);
2741 ]])],
2742 [AC_MSG_RESULT([yes])],
2743 [AC_MSG_RESULT([no])
2744 AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1,
2745 [setrlimit RLIMIT_FSIZE works])],
2746 [AC_MSG_WARN([cross compiling: assuming yes])]
2747)
2748
Damien Miller69ff1df2011-06-23 08:30:03 +10002749if test "x$sandbox_arg" = "xsystrace" || \
2750 ( test -z "$sandbox_arg" && test "x$have_systr_policy_kill" = "x1" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002751 test "x$have_systr_policy_kill" != "x1" && \
2752 AC_MSG_ERROR([systrace sandbox requires systrace headers and SYSTR_POLICY_KILL support])
Damien Miller69ff1df2011-06-23 08:30:03 +10002753 SANDBOX_STYLE="systrace"
2754 AC_DEFINE([SANDBOX_SYSTRACE], [1], [Sandbox using systrace(4)])
Damien Millercd5e52e2011-06-27 07:18:18 +10002755elif test "x$sandbox_arg" = "xdarwin" || \
2756 ( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \
2757 test "x$ac_cv_header_sandbox_h" = "xyes") ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002758 test "x$ac_cv_func_sandbox_init" != "xyes" -o \
2759 "x$ac_cv_header_sandbox_h" != "xyes" && \
2760 AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function])
Damien Millercd5e52e2011-06-27 07:18:18 +10002761 SANDBOX_STYLE="darwin"
2762 AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)])
Damien Millere0956e32012-04-04 11:27:54 +10002763elif test "x$sandbox_arg" = "xseccomp_filter" || \
2764 ( test -z "$sandbox_arg" && \
Darren Tuckerd0494fd2012-05-19 14:25:39 +10002765 test "x$have_seccomp_filter" = "x1" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002766 test "x$ac_cv_header_elf_h" = "xyes" && \
Damien Millere0956e32012-04-04 11:27:54 +10002767 test "x$ac_cv_header_linux_audit_h" = "xyes" && \
Damien Miller91f40d82013-02-22 11:37:00 +11002768 test "x$ac_cv_header_linux_filter_h" = "xyes" && \
2769 test "x$seccomp_audit_arch" != "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002770 test "x$have_linux_no_new_privs" = "x1" && \
2771 test "x$ac_cv_func_prctl" = "xyes" ) ; then
Damien Miller91f40d82013-02-22 11:37:00 +11002772 test "x$seccomp_audit_arch" = "x" && \
Damien Millere0956e32012-04-04 11:27:54 +10002773 AC_MSG_ERROR([seccomp_filter sandbox not supported on $host])
2774 test "x$have_linux_no_new_privs" != "x1" && \
2775 AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS])
2776 test "x$have_seccomp_filter" != "x1" && \
2777 AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers])
2778 test "x$ac_cv_func_prctl" != "xyes" && \
2779 AC_MSG_ERROR([seccomp_filter sandbox requires prctl function])
2780 SANDBOX_STYLE="seccomp_filter"
2781 AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter])
Damien Miller69ff1df2011-06-23 08:30:03 +10002782elif test "x$sandbox_arg" = "xrlimit" || \
Darren Tucker60395f92012-07-03 14:31:18 +10002783 ( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \
Darren Tuckerff008de2013-03-06 17:48:48 +11002784 test "x$select_works_with_rlimit" = "xyes" && \
2785 test "x$rlimit_nofile_zero_works" = "xyes" ) ; then
Damien Miller1a91c0f2011-08-17 11:59:25 +10002786 test "x$ac_cv_func_setrlimit" != "xyes" && \
2787 AC_MSG_ERROR([rlimit sandbox requires setrlimit function])
Darren Tucker60395f92012-07-03 14:31:18 +10002788 test "x$select_works_with_rlimit" != "xyes" && \
2789 AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit])
Damien Miller69ff1df2011-06-23 08:30:03 +10002790 SANDBOX_STYLE="rlimit"
2791 AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)])
2792elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \
2793 test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then
2794 SANDBOX_STYLE="none"
2795 AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing])
2796else
Tim Ricea6e60612011-08-17 21:48:22 -07002797 AC_MSG_ERROR([unsupported --with-sandbox])
Damien Miller69ff1df2011-06-23 08:30:03 +10002798fi
2799
Ben Lindstromb5628642000-10-18 00:02:25 +00002800# Cheap hack to ensure NEWS-OS libraries are arranged right.
2801if test ! -z "$SONY" ; then
2802 LIBS="$LIBS -liberty";
2803fi
2804
Damien Miller57f39152005-11-24 19:58:19 +11002805# Check for long long datatypes
2806AC_CHECK_TYPES([long long, unsigned long long, long double])
2807
2808# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002809AC_CHECK_SIZEOF([short int], [2])
2810AC_CHECK_SIZEOF([int], [4])
2811AC_CHECK_SIZEOF([long int], [4])
2812AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002813
Damien Millerfa2bb692002-04-23 23:22:25 +10002814# Sanity check long long for some platforms (AIX)
2815if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2816 ac_cv_sizeof_long_long_int=0
2817fi
2818
Darren Tucker537f1ed2005-10-25 18:38:33 +10002819# compute LLONG_MIN and LLONG_MAX if we don't know them.
2820if test -z "$have_llong_max"; then
2821 AC_MSG_CHECKING([for max value of long long])
2822 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002823 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002824#include <stdio.h>
2825/* Why is this so damn hard? */
2826#ifdef __GNUC__
2827# undef __GNUC__
2828#endif
2829#define __USE_ISOC99
2830#include <limits.h>
2831#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002832#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2833
2834/*
2835 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2836 * we do this the hard way.
2837 */
2838static int
2839fprint_ll(FILE *f, long long n)
2840{
2841 unsigned int i;
2842 int l[sizeof(long long) * 8];
2843
2844 if (n < 0)
2845 if (fprintf(f, "-") < 0)
2846 return -1;
2847 for (i = 0; n != 0; i++) {
2848 l[i] = my_abs(n % 10);
2849 n /= 10;
2850 }
2851 do {
2852 if (fprintf(f, "%d", l[--i]) < 0)
2853 return -1;
2854 } while (i != 0);
2855 if (fprintf(f, " ") < 0)
2856 return -1;
2857 return 0;
2858}
Tim Rice648f8762011-01-26 12:38:57 -08002859 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002860 FILE *f;
2861 long long i, llmin, llmax = 0;
2862
2863 if((f = fopen(DATA,"w")) == NULL)
2864 exit(1);
2865
2866#if defined(LLONG_MIN) && defined(LLONG_MAX)
2867 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2868 llmin = LLONG_MIN;
2869 llmax = LLONG_MAX;
2870#else
2871 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2872 /* This will work on one's complement and two's complement */
2873 for (i = 1; i > llmax; i <<= 1, i++)
2874 llmax = i;
2875 llmin = llmax + 1LL; /* wrap */
2876#endif
2877
2878 /* Sanity check */
2879 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002880 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2881 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002882 fprintf(f, "unknown unknown\n");
2883 exit(2);
2884 }
2885
Darren Tuckerd1450db2006-03-13 19:06:51 +11002886 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002887 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002888 if (fprint_ll(f, llmax) < 0)
2889 exit(4);
2890 if (fclose(f) < 0)
2891 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002892 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002893 ]])],
2894 [
2895 llong_min=`$AWK '{print $1}' conftest.llminmax`
2896 llong_max=`$AWK '{print $2}' conftest.llminmax`
2897
Tim Rice648f8762011-01-26 12:38:57 -08002898 AC_MSG_RESULT([$llong_max])
2899 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002900 [max value of long long calculated by configure])
2901 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002902 AC_MSG_RESULT([$llong_min])
2903 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002904 [min value of long long calculated by configure])
2905 ],
2906 [
Tim Rice648f8762011-01-26 12:38:57 -08002907 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002908 ],
2909 [
2910 AC_MSG_WARN([cross compiling: not checking])
2911 ]
2912 )
2913fi
2914
2915
Damien Millera22ba012000-03-02 23:09:20 +11002916# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002917AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002918 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2919 [[ u_int a; a = 1;]])],
2920 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2921 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002922])
2923if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002924 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002925 have_u_int=1
2926fi
2927
Damien Miller61e50f12000-05-08 20:49:37 +10002928AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002929 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2930 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2931 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2932 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002933])
2934if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002935 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002936 have_intxx_t=1
2937fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002938
2939if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002940 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002941then
2942 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002943 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2944 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002945 [
Tim Rice648f8762011-01-26 12:38:57 -08002946 AC_DEFINE([HAVE_INTXX_T])
2947 AC_MSG_RESULT([yes])
2948 ], [ AC_MSG_RESULT([no])
2949 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002950fi
2951
Damien Miller578783e2000-09-23 14:12:24 +11002952AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002953 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002954#include <sys/types.h>
2955#ifdef HAVE_STDINT_H
2956# include <stdint.h>
2957#endif
2958#include <sys/socket.h>
2959#ifdef HAVE_SYS_BITYPES_H
2960# include <sys/bitypes.h>
2961#endif
Tim Rice648f8762011-01-26 12:38:57 -08002962 ]], [[
2963int64_t a; a = 1;
2964 ]])],
2965 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2966 ])
Damien Miller578783e2000-09-23 14:12:24 +11002967])
2968if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002969 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002970fi
2971
Damien Miller61e50f12000-05-08 20:49:37 +10002972AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002973 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2974 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2975 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2976 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002977])
2978if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002979 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002980 have_u_intxx_t=1
2981fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002982
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002983if test -z "$have_u_intxx_t" ; then
2984 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002985 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2986 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002987 [
Tim Rice648f8762011-01-26 12:38:57 -08002988 AC_DEFINE([HAVE_U_INTXX_T])
2989 AC_MSG_RESULT([yes])
2990 ], [ AC_MSG_RESULT([no])
2991 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002992fi
2993
Damien Miller578783e2000-09-23 14:12:24 +11002994AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2996 [[ u_int64_t a; a = 1;]])],
2997 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2998 ])
Damien Miller578783e2000-09-23 14:12:24 +11002999])
3000if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003001 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11003002 have_u_int64_t=1
3003fi
3004
Tim Rice4cec93f2002-02-26 08:40:48 -08003005if test -z "$have_u_int64_t" ; then
3006 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003007 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
3008 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08003009 [
Tim Rice648f8762011-01-26 12:38:57 -08003010 AC_DEFINE([HAVE_U_INT64_T])
3011 AC_MSG_RESULT([yes])
3012 ], [ AC_MSG_RESULT([no])
3013 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08003014fi
3015
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003016if test -z "$have_u_intxx_t" ; then
3017 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003018 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003019#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003020 ]], [[
3021 uint8_t a;
3022 uint16_t b;
3023 uint32_t c;
3024 a = b = c = 1;
3025 ]])],
3026 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
3027 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003028 ])
3029 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003030 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003031 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003032 fi
3033fi
3034
3035if test -z "$have_uintxx_t" ; then
3036 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08003037 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
3038 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003039 [
Tim Rice648f8762011-01-26 12:38:57 -08003040 AC_DEFINE([HAVE_UINTXX_T])
3041 AC_MSG_RESULT([yes])
3042 ], [ AC_MSG_RESULT([no])
3043 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003044fi
3045
Damien Milleredb82922000-06-20 13:25:52 +10003046if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11003047 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11003048then
3049 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08003050 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10003051#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08003052 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10003053 int8_t a; int16_t b; int32_t c;
3054 u_int8_t e; u_int16_t f; u_int32_t g;
3055 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08003056 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11003057 [
Tim Rice648f8762011-01-26 12:38:57 -08003058 AC_DEFINE([HAVE_U_INTXX_T])
3059 AC_DEFINE([HAVE_INTXX_T])
3060 AC_MSG_RESULT([yes])
3061 ], [AC_MSG_RESULT([no])
3062 ])
Damien Millerb29ea912000-01-15 14:12:03 +11003063fi
3064
Damien Miller58be7382001-09-15 21:31:54 +10003065
3066AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08003067 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3068 [[ u_char foo; foo = 125; ]])],
3069 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
3070 ])
Damien Miller58be7382001-09-15 21:31:54 +10003071])
3072if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003073 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10003074fi
3075
Tim Rice13aae5e2001-10-21 17:53:58 -07003076TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11003077
Tim Rice648f8762011-01-26 12:38:57 -08003078AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
3079AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10003080#include <sys/types.h>
3081#ifdef HAVE_SYS_BITYPES_H
3082#include <sys/bitypes.h>
3083#endif
3084#ifdef HAVE_SYS_STATFS_H
3085#include <sys/statfs.h>
3086#endif
3087#ifdef HAVE_SYS_STATVFS_H
3088#include <sys/statvfs.h>
3089#endif
3090])
Tim Rice4cec93f2002-02-26 08:40:48 -08003091
Tim Rice648f8762011-01-26 12:38:57 -08003092AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11003093[#include <sys/types.h>
3094#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11003095
Damien Miller61e50f12000-05-08 20:49:37 +10003096AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003097 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3098 [[ size_t foo; foo = 1235; ]])],
3099 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
3100 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003101])
3102if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003103 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003104fi
Damien Miller95058511999-12-29 10:36:45 +11003105
Damien Miller615f9392000-05-17 22:53:33 +10003106AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003107 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3108 [[ ssize_t foo; foo = 1235; ]])],
3109 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
3110 ])
Damien Miller615f9392000-05-17 22:53:33 +10003111])
3112if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003113 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10003114fi
3115
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003116AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003117 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
3118 [[ clock_t foo; foo = 1235; ]])],
3119 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
3120 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003121])
3122if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003123 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00003124fi
3125
Damien Millerb54b40e2000-06-23 08:23:34 +10003126AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003127 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10003128#include <sys/types.h>
3129#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003130 ]], [[ sa_family_t foo; foo = 1235; ]])],
3131 [ ac_cv_have_sa_family_t="yes" ],
3132 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11003133#include <sys/types.h>
3134#include <sys/socket.h>
3135#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003136 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11003137 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10003138 [ ac_cv_have_sa_family_t="no" ]
3139 )
Tim Rice648f8762011-01-26 12:38:57 -08003140 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10003141])
3142if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003143 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003144 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10003145fi
3146
Damien Miller0f91b4e2000-06-18 15:43:25 +10003147AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3149 [[ pid_t foo; foo = 1235; ]])],
3150 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
3151 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003152])
3153if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003154 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003155fi
3156
3157AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08003158 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
3159 [[ mode_t foo; foo = 1235; ]])],
3160 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
3161 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003162])
3163if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003164 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10003165fi
3166
Damien Miller61e50f12000-05-08 20:49:37 +10003167
3168AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08003169 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003170#include <sys/types.h>
3171#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003172 ]], [[ struct sockaddr_storage s; ]])],
3173 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3174 [ ac_cv_have_struct_sockaddr_storage="no"
3175 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003176])
3177if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003178 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003179 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003180fi
Damien Miller34132e52000-01-14 15:45:46 +11003181
Damien Miller61e50f12000-05-08 20:49:37 +10003182AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08003183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003184#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003185#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003186 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
3187 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3188 [ ac_cv_have_struct_sockaddr_in6="no"
3189 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003190])
3191if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003192 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003193 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003194fi
Damien Miller34132e52000-01-14 15:45:46 +11003195
Damien Miller61e50f12000-05-08 20:49:37 +10003196AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08003197 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10003198#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003199#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08003200 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
3201 [ ac_cv_have_struct_in6_addr="yes" ],
3202 [ ac_cv_have_struct_in6_addr="no"
3203 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003204])
3205if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003206 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003207 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003208
3209dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08003210 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08003211 [
3212#ifdef HAVE_SYS_TYPES_H
3213#include <sys/types.h>
3214#endif
3215#include <netinet/in.h>
3216 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003217fi
Damien Miller34132e52000-01-14 15:45:46 +11003218
Damien Miller61e50f12000-05-08 20:49:37 +10003219AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08003220 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003221#include <sys/types.h>
3222#include <sys/socket.h>
3223#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08003224 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
3225 [ ac_cv_have_struct_addrinfo="yes" ],
3226 [ ac_cv_have_struct_addrinfo="no"
3227 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003228])
3229if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003230 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003231 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003232fi
3233
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003234AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08003235 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
3236 [[ struct timeval tv; tv.tv_sec = 1;]])],
3237 [ ac_cv_have_struct_timeval="yes" ],
3238 [ ac_cv_have_struct_timeval="no"
3239 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003240])
3241if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003242 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003243 have_struct_timeval=1
3244fi
3245
Tim Rice648f8762011-01-26 12:38:57 -08003246AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003247
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003248# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003249if test "x$ac_cv_have_int64_t" = "xno" && \
3250 test "x$ac_cv_sizeof_long_int" != "x8" && \
3251 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003252 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3253 echo "an alternative compiler (I.E., GCC) before continuing."
3254 echo ""
3255 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003256else
3257dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003258 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003259 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003260#include <stdio.h>
3261#include <string.h>
3262#ifdef HAVE_SNPRINTF
3263main()
3264{
3265 char buf[50];
3266 char expected_out[50];
3267 int mazsize = 50 ;
3268#if (SIZEOF_LONG_INT == 8)
3269 long int num = 0x7fffffffffffffff;
3270#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003271 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003272#endif
3273 strcpy(expected_out, "9223372036854775807");
3274 snprintf(buf, mazsize, "%lld", num);
3275 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003276 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003277 exit(0);
3278}
3279#else
3280main() { exit(0); }
3281#endif
Tim Rice648f8762011-01-26 12:38:57 -08003282 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003283 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003284 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003285fi
3286
Damien Miller78315eb2000-09-29 23:01:36 +11003287dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003288OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3289OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3290OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3291OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3292OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3293OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3294OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3295OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3296OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3297OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3298OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3299OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3300OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3301OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3302OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3303OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3304OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003305
3306AC_CHECK_MEMBERS([struct stat.st_blksize])
Damien Miller6332da22013-04-23 14:25:52 +10003307AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class,
3308struct passwd.pw_change, struct passwd.pw_expire],
3309[], [], [[
3310#include <sys/types.h>
3311#include <pwd.h>
3312]])
3313
Tim Rice648f8762011-01-26 12:38:57 -08003314AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003315 [Define if we don't have struct __res_state in resolv.h])],
Damien Miller6332da22013-04-23 14:25:52 +10003316[[
Darren Tucker58e298d2005-11-25 13:14:58 +11003317#include <stdio.h>
3318#if HAVE_SYS_TYPES_H
3319# include <sys/types.h>
3320#endif
3321#include <netinet/in.h>
3322#include <arpa/nameser.h>
3323#include <resolv.h>
Damien Miller6332da22013-04-23 14:25:52 +10003324]])
andre2ff7b5d2000-06-03 14:57:40 +00003325
Damien Miller61e50f12000-05-08 20:49:37 +10003326AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3327 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003328 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003329#include <sys/types.h>
3330#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003331 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3332 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3333 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003334])
3335if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003336 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003337fi
3338
Damien Miller61e50f12000-05-08 20:49:37 +10003339AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3340 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003341 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003342#include <sys/types.h>
3343#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003344 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3345 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3346 [ ac_cv_have___ss_family_in_struct_ss="no"
3347 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003348])
3349if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003350 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003351 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003352fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003353
Tim Rice28bbb0c2002-05-27 17:37:32 -07003354dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003355AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3356 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003357 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003358#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003359#include <sys/socket.h>
3360#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003361 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003362#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003363#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003364exit(1);
3365#endif
3366struct msghdr m;
3367m.msg_accrights = 0;
3368exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003369 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003370 [ ac_cv_have_accrights_in_msghdr="yes" ],
3371 [ ac_cv_have_accrights_in_msghdr="no" ]
3372 )
3373])
3374if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003375 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003376 [Define if your system uses access rights style
3377 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003378fi
3379
Tim Rice648f8762011-01-26 12:38:57 -08003380AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3381AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere1a3ddf2012-05-04 11:05:45 +10003382#include <sys/param.h>
Darren Tucker32780622009-06-16 16:11:02 +10003383#include <sys/stat.h>
3384#ifdef HAVE_SYS_TIME_H
3385# include <sys/time.h>
3386#endif
3387#ifdef HAVE_SYS_MOUNT_H
3388#include <sys/mount.h>
3389#endif
3390#ifdef HAVE_SYS_STATVFS_H
3391#include <sys/statvfs.h>
3392#endif
Tim Rice648f8762011-01-26 12:38:57 -08003393 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3394 [ AC_MSG_RESULT([yes]) ],
3395 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003396
Tim Rice648f8762011-01-26 12:38:57 -08003397 AC_MSG_CHECKING([if fsid_t has member val])
3398 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003399#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003400#include <sys/statvfs.h>
3401 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3402 [ AC_MSG_RESULT([yes])
3403 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3404 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003405
Tim Rice648f8762011-01-26 12:38:57 -08003406 AC_MSG_CHECKING([if f_fsid has member __val])
3407 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003408#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003409#include <sys/statvfs.h>
3410 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3411 [ AC_MSG_RESULT([yes])
3412 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3413 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003414])
Darren Tucker77001382008-06-09 06:17:53 +10003415
Kevin Stevesa44e0352002-04-07 16:18:03 +00003416AC_CACHE_CHECK([for msg_control field in struct msghdr],
3417 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003418 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003419#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003420#include <sys/socket.h>
3421#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003422 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003423#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003424#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003425exit(1);
3426#endif
3427struct msghdr m;
3428m.msg_control = 0;
3429exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003430 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003431 [ ac_cv_have_control_in_msghdr="yes" ],
3432 [ ac_cv_have_control_in_msghdr="no" ]
3433 )
3434])
3435if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003436 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003437 [Define if your system uses ancillary data style
3438 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003439fi
3440
Damien Miller61e50f12000-05-08 20:49:37 +10003441AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003442 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3443 [[ extern char *__progname; printf("%s", __progname); ]])],
3444 [ ac_cv_libc_defines___progname="yes" ],
3445 [ ac_cv_libc_defines___progname="no"
3446 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003447])
3448if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003449 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003450fi
3451
Kevin Steves4846f4a2002-03-22 18:19:53 +00003452AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003453 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3454 [[ printf("%s", __FUNCTION__); ]])],
3455 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3456 [ ac_cv_cc_implements___FUNCTION__="no"
3457 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003458])
3459if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003460 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003461 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003462fi
3463
3464AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003465 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3466 [[ printf("%s", __func__); ]])],
3467 [ ac_cv_cc_implements___func__="yes" ],
3468 [ ac_cv_cc_implements___func__="no"
3469 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003470])
3471if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003472 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003473fi
3474
Damien Miller57f39152005-11-24 19:58:19 +11003475AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003476 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3477#include <stdarg.h>
3478va_list x,y;
3479 ]], [[ va_copy(x,y); ]])],
3480 [ ac_cv_have_va_copy="yes" ],
3481 [ ac_cv_have_va_copy="no"
3482 ])
Damien Miller57f39152005-11-24 19:58:19 +11003483])
3484if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003485 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003486fi
3487
3488AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003489 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3490#include <stdarg.h>
3491va_list x,y;
3492 ]], [[ __va_copy(x,y); ]])],
3493 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3494 ])
Damien Miller57f39152005-11-24 19:58:19 +11003495])
3496if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003497 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003498fi
3499
Damien Miller4f8e6692001-07-14 13:22:53 +10003500AC_CACHE_CHECK([whether getopt has optreset support],
3501 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003502 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3503 [[ extern int optreset; optreset = 0; ]])],
3504 [ ac_cv_have_getopt_optreset="yes" ],
3505 [ ac_cv_have_getopt_optreset="no"
3506 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003507])
3508if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003509 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003510 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003511fi
Damien Millera22ba012000-03-02 23:09:20 +11003512
Damien Millerecbb26d2000-07-15 14:59:14 +10003513AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003514 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3515[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3516 [ ac_cv_libc_defines_sys_errlist="yes" ],
3517 [ ac_cv_libc_defines_sys_errlist="no"
3518 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003519])
3520if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003521 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003522 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003523fi
3524
3525
Damien Miller11fa2cc2000-08-16 10:35:58 +10003526AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003527 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3528[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3529 [ ac_cv_libc_defines_sys_nerr="yes" ],
3530 [ ac_cv_libc_defines_sys_nerr="no"
3531 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003532])
3533if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003534 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003535fi
3536
Darren Tucker5f88d342003-10-15 16:57:57 +10003537# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003538AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3539 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003540 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003541 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003542 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003543 AC_SEARCH_LIBS([res_query], [resolv])
3544 AC_SEARCH_LIBS([dn_expand], [resolv])
3545 AC_MSG_CHECKING([if res_query will link])
3546 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003547#include <sys/types.h>
3548#include <netinet/in.h>
3549#include <arpa/nameser.h>
3550#include <netdb.h>
3551#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003552 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003553 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003554 ]])],
3555 AC_MSG_RESULT([yes]),
3556 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003557 saved_LIBS="$LIBS"
3558 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003559 AC_MSG_CHECKING([for res_query in -lresolv])
3560 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003561#include <sys/types.h>
3562#include <netinet/in.h>
3563#include <arpa/nameser.h>
3564#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003565#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003566 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003567 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003568 ]])],
3569 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003570 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003571 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003572 ])
Tim Rice648f8762011-01-26 12:38:57 -08003573 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003574 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003575 [#include <sys/types.h>
3576 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003577 AC_CHECK_MEMBER([HEADER.ad],
3578 [AC_DEFINE([HAVE_HEADER_AD], [1],
3579 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003580 [#include <arpa/nameser.h>])
3581 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003582
Tim Rice648f8762011-01-26 12:38:57 -08003583AC_MSG_CHECKING([if struct __res_state _res is an extern])
3584AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003585#include <stdio.h>
3586#if HAVE_SYS_TYPES_H
3587# include <sys/types.h>
3588#endif
3589#include <netinet/in.h>
3590#include <arpa/nameser.h>
3591#include <resolv.h>
3592extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003593 ]], [[ ]])],
3594 [AC_MSG_RESULT([yes])
3595 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003596 [Define if you have struct __res_state _res as an extern])
3597 ],
Tim Rice648f8762011-01-26 12:38:57 -08003598 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003599)
3600
Damien Miller73b42d22006-04-22 21:26:08 +10003601# Check whether user wants SELinux support
3602SELINUX_MSG="no"
3603LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003604AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003605 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003606 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003607 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003608 AC_DEFINE([WITH_SELINUX], [1],
3609 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003610 SELINUX_MSG="yes"
3611 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003612 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3613 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003614 [ LIBSELINUX="-lselinux"
3615 LIBS="$LIBS -lselinux"
3616 ],
Tim Rice648f8762011-01-26 12:38:57 -08003617 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003618 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003619 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003620 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003621 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003622 fi ]
3623)
Tim Rice648f8762011-01-26 12:38:57 -08003624AC_SUBST([SSHLIBS])
3625AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003626
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003627# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003628KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003629AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003630 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003631 [ if test "x$withval" != "xno" ; then
3632 if test "x$withval" = "xyes" ; then
3633 KRB5ROOT="/usr/local"
3634 else
3635 KRB5ROOT=${withval}
3636 fi
3637
Tim Rice648f8762011-01-26 12:38:57 -08003638 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003639 KRB5_MSG="yes"
3640
Tim Rice648f8762011-01-26 12:38:57 -08003641 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003642 [$KRB5ROOT/bin/krb5-config],
3643 [$KRB5ROOT/bin:$PATH])
3644 if test -x $KRB5CONF ; then
Darren Tucker964de182013-02-22 10:39:59 +11003645 K5CFLAGS="`$KRB5CONF --cflags`"
3646 K5LIBS="`$KRB5CONF --libs`"
3647 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003648
Tim Rice648f8762011-01-26 12:38:57 -08003649 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003650 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003651 AC_MSG_RESULT([yes])
3652 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003653 [Define this if you want GSSAPI
3654 support in the version 2 protocol])
Darren Tucker964de182013-02-22 10:39:59 +11003655 GSSCFLAGS="`$KRB5CONF --cflags gssapi`"
3656 GSSLIBS="`$KRB5CONF --libs gssapi`"
3657 CPPFLAGS="$CPPFLAGS $GSSCFLAGS"
Damien Millera8e06ce2003-11-21 23:48:55 +11003658 else
Tim Rice648f8762011-01-26 12:38:57 -08003659 AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003660 fi
Tim Rice648f8762011-01-26 12:38:57 -08003661 AC_MSG_CHECKING([whether we are using Heimdal])
3662 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3663 ]], [[ char *tmp = heimdal_version; ]])],
3664 [ AC_MSG_RESULT([yes])
3665 AC_DEFINE([HEIMDAL], [1],
3666 [Define this if you are using the Heimdal
3667 version of Kerberos V5]) ],
3668 [AC_MSG_RESULT([no])
3669 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003670 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003671 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003672 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003673 AC_MSG_CHECKING([whether we are using Heimdal])
3674 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3675 ]], [[ char *tmp = heimdal_version; ]])],
3676 [ AC_MSG_RESULT([yes])
3677 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003678 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003679 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003680 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003681 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003682 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003683 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003684 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003685 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003686
3687 ])
3688 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003689
Tim Rice648f8762011-01-26 12:38:57 -08003690 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3691 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003692 GSSLIBS="-lgssapi_krb5" ],
Tim Rice648f8762011-01-26 12:38:57 -08003693 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3694 [ AC_DEFINE([GSSAPI])
Darren Tucker964de182013-02-22 10:39:59 +11003695 GSSLIBS="-lgssapi" ],
Darren Tuckera2b5a4c2013-02-22 10:43:15 +11003696 [ AC_CHECK_LIB([gss], [gss_init_sec_context],
3697 [ AC_DEFINE([GSSAPI])
3698 GSSLIBS="-lgss" ],
3699 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]))
3700 ])
Darren Tucker964de182013-02-22 10:39:59 +11003701 ])
Tim Riceeae17cc2005-03-17 16:52:20 -08003702
Tim Rice648f8762011-01-26 12:38:57 -08003703 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003704 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003705 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003706 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003707 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003708 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003709 ]
3710 )
3711
3712 oldCPP="$CPPFLAGS"
3713 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003714 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003715 [ CPPFLAGS="$oldCPP" ])
3716
Damien Millera8e06ce2003-11-21 23:48:55 +11003717 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003718 if test ! -z "$need_dash_r" ; then
3719 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3720 fi
3721 if test ! -z "$blibpath" ; then
3722 blibpath="$blibpath:${KRB5ROOT}/lib"
3723 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003724
Tim Rice648f8762011-01-26 12:38:57 -08003725 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3726 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3727 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003728
Tim Rice648f8762011-01-26 12:38:57 -08003729 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3730 [Define this if you want to use libkafs' AFS support])])
Darren Tucker03978c62013-02-25 11:24:44 +11003731
3732 AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[
3733#ifdef HAVE_GSSAPI_H
3734# include <gssapi.h>
3735#elif defined(HAVE_GSSAPI_GSSAPI_H)
3736# include <gssapi/gssapi.h>
3737#endif
3738
3739#ifdef HAVE_GSSAPI_GENERIC_H
3740# include <gssapi_generic.h>
3741#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
3742# include <gssapi/gssapi_generic.h>
3743#endif
3744 ]])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003745 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003746 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003747)
Darren Tucker964de182013-02-22 10:39:59 +11003748AC_SUBST([GSSLIBS])
3749AC_SUBST([K5LIBS])
Damien Millerc79bc0d2001-03-28 13:03:42 +10003750
Damien Millera22ba012000-03-02 23:09:20 +11003751# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003752
Damien Millerf58c6722002-05-13 13:15:42 +10003753PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003754AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003755 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003756 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003757 if test -n "$withval" && test "x$withval" != "xno" && \
3758 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003759 PRIVSEP_PATH=$withval
3760 fi
3761 ]
3762)
Tim Rice648f8762011-01-26 12:38:57 -08003763AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003764
Tim Rice648f8762011-01-26 12:38:57 -08003765AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003766 [ --with-xauth=PATH Specify path to xauth program ],
3767 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003768 if test -n "$withval" && test "x$withval" != "xno" && \
3769 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003770 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003771 fi
3772 ],
3773 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003774 TestPath="$PATH"
3775 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3776 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3777 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3778 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003779 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003780 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003781 xauth_path="/usr/openwin/bin/xauth"
3782 fi
3783 ]
3784)
3785
Damien Miller7d901272003-01-13 16:55:22 +11003786STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003787AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003788 [ --disable-strip Disable calling strip(1) on install],
3789 [
3790 if test "x$enableval" = "xno" ; then
3791 STRIP_OPT=
3792 fi
3793 ]
3794)
Tim Rice648f8762011-01-26 12:38:57 -08003795AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003796
Damien Millera19cf472000-11-29 13:28:50 +11003797if test -z "$xauth_path" ; then
3798 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003799 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003800else
Tim Rice648f8762011-01-26 12:38:57 -08003801 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003802 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003803 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003804 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003805fi
Damien Millera22ba012000-03-02 23:09:20 +11003806
Tim Rice90f42b02011-06-02 18:17:49 -07003807dnl # --with-maildir=/path/to/mail gets top priority.
3808dnl # if maildir is set in the platform case statement above we use that.
3809dnl # Otherwise we run a program to get the dir from system headers.
3810dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL
3811dnl # If we find _PATH_MAILDIR we do nothing because that is what
3812dnl # session.c expects anyway. Otherwise we set to the value found
3813dnl # stripping any trailing slash. If for some strage reason our program
3814dnl # does not find what it needs, we default to /var/spool/mail.
3815# Check for mail directory
3816AC_ARG_WITH([maildir],
3817 [ --with-maildir=/path/to/mail Specify your system mail directory],
3818 [
3819 if test "X$withval" != X && test "x$withval" != xno && \
3820 test "x${withval}" != xyes; then
3821 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"],
3822 [Set this to your mail directory if you do not have _PATH_MAILDIR])
3823 fi
3824 ],[
3825 if test "X$maildir" != "X"; then
3826 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3827 else
3828 AC_MSG_CHECKING([Discovering system mail directory])
3829 AC_RUN_IFELSE(
3830 [AC_LANG_PROGRAM([[
3831#include <stdio.h>
3832#include <string.h>
3833#ifdef HAVE_PATHS_H
3834#include <paths.h>
3835#endif
3836#ifdef HAVE_MAILLOCK_H
3837#include <maillock.h>
3838#endif
3839#define DATA "conftest.maildir"
3840 ]], [[
3841 FILE *fd;
3842 int rc;
3843
3844 fd = fopen(DATA,"w");
3845 if(fd == NULL)
3846 exit(1);
3847
3848#if defined (_PATH_MAILDIR)
3849 if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0)
3850 exit(1);
3851#elif defined (MAILDIR)
3852 if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0)
3853 exit(1);
3854#elif defined (_PATH_MAIL)
3855 if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0)
3856 exit(1);
3857#else
3858 exit (2);
3859#endif
3860
3861 exit(0);
3862 ]])],
3863 [
3864 maildir_what=`awk -F: '{print $1}' conftest.maildir`
3865 maildir=`awk -F: '{print $2}' conftest.maildir \
3866 | sed 's|/$||'`
3867 AC_MSG_RESULT([Using: $maildir from $maildir_what])
3868 if test "x$maildir_what" != "x_PATH_MAILDIR"; then
3869 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"])
3870 fi
3871 ],
3872 [
3873 if test "X$ac_status" = "X2";then
3874# our test program didn't find it. Default to /var/spool/mail
3875 AC_MSG_RESULT([Using: default value of /var/spool/mail])
3876 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"])
3877 else
3878 AC_MSG_RESULT([*** not found ***])
3879 fi
3880 ],
3881 [
3882 AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail])
3883 ]
3884 )
3885 fi
3886 ]
3887) # maildir
Damien Millera22ba012000-03-02 23:09:20 +11003888
Darren Tucker623d92f2004-09-12 22:36:15 +10003889if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003890 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3891 disable_ptmx_check=yes
3892fi
Damien Millera22ba012000-03-02 23:09:20 +11003893if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003894 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003895 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003896 [
Tim Rice648f8762011-01-26 12:38:57 -08003897 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003898 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003899 have_dev_ptmx=1
3900 ]
3901 )
3902 fi
Damien Millera22ba012000-03-02 23:09:20 +11003903fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003904
Darren Tucker623d92f2004-09-12 22:36:15 +10003905if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003906 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003907 [
Tim Rice648f8762011-01-26 12:38:57 -08003908 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003909 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003910 have_dev_ptc=1
3911 ]
3912 )
3913else
3914 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3915fi
Damien Miller204ad072000-03-02 23:56:12 +11003916
Damien Millera22ba012000-03-02 23:09:20 +11003917# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003918AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003919 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003920 [
Damien Miller897741e2001-04-16 10:41:46 +10003921 case "$withval" in
3922 man|cat|doc)
3923 MANTYPE=$withval
3924 ;;
3925 *)
Tim Rice648f8762011-01-26 12:38:57 -08003926 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003927 ;;
3928 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003929 ]
3930)
Ben Lindstrombc709922001-04-18 18:04:21 +00003931if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003932 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003933 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003934 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3935 MANTYPE=doc
3936 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3937 MANTYPE=man
3938 else
3939 MANTYPE=cat
3940 fi
3941fi
Tim Rice648f8762011-01-26 12:38:57 -08003942AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003943if test "$MANTYPE" = "doc"; then
3944 mansubdir=man;
3945else
3946 mansubdir=$MANTYPE;
3947fi
Tim Rice648f8762011-01-26 12:38:57 -08003948AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003949
Damien Millera22ba012000-03-02 23:09:20 +11003950# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003951MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003952AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003953 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003954 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003955 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003956 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003957 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003958 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003959 fi
3960 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003961)
3962
Damien Millera22ba012000-03-02 23:09:20 +11003963# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003964AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003965 [ --without-shadow Disable shadow password support],
3966 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003967 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003968 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003969 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003970 fi
3971 ]
3972)
3973
Damien Miller1f335fb2000-06-26 11:31:33 +10003974if test -z "$disable_shadow" ; then
3975 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003976 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003977#include <sys/types.h>
3978#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003979struct spwd sp;
3980 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3981 [ sp_expire_available=yes ], [
3982 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003983
3984 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003985 AC_MSG_RESULT([yes])
3986 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003987 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003988 else
Tim Rice648f8762011-01-26 12:38:57 -08003989 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003990 fi
3991fi
3992
Damien Millera22ba012000-03-02 23:09:20 +11003993# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003994if test ! -z "$IPADDR_IN_DISPLAY" ; then
3995 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003996 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003997 [Define if you need to use IP address
3998 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003999else
Damien Millera8e06ce2003-11-21 23:48:55 +11004000 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08004001 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11004002 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
4003 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004004 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004005 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11004006 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11004007 fi
4008 ]
4009 )
4010fi
Damien Miller76112de1999-12-21 11:18:08 +11004011
Darren Tuckere1a790d2003-09-16 11:52:19 +10004012# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08004013AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11004014 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004015 [ if test "x$enableval" = "xno"; then
4016 AC_MSG_NOTICE([/etc/default/login handling disabled])
4017 etc_default_login=no
4018 else
4019 etc_default_login=yes
4020 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10004021 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
4022 then
4023 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
4024 etc_default_login=no
4025 else
4026 etc_default_login=yes
4027 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11004028)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004029
Darren Tucker2f9573d2005-02-10 22:28:54 +11004030if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08004031 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11004032 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10004033 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08004034 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004035 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10004036 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11004037fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004038
Tim Rice43a1c132002-04-17 21:19:14 -07004039dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08004040if test $ac_cv_func_login_getcapbool = "yes" && \
4041 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004042 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07004043fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10004044
Damien Millera22ba012000-03-02 23:09:20 +11004045# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11004046SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08004047AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10004048 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11004049 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10004050 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07004051 AC_MSG_WARN([
4052--with-default-path=PATH has no effect on this system.
4053Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08004054 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07004055 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004056 AC_MSG_WARN([
4057--with-default-path=PATH will only be used if PATH is not defined in
4058$external_path_file .])
4059 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004060 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11004061 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11004062 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08004063 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10004064 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
4065 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07004066 else
Tim Riceb925b4b2003-09-15 22:40:49 -07004067 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004068 AC_MSG_WARN([
4069If PATH is defined in $external_path_file, ensure the path to scp is included,
4070otherwise scp will not work.])
4071 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10004072 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08004073 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08004074/* find out what STDPATH is */
4075#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08004076#ifdef HAVE_PATHS_H
4077# include <paths.h>
4078#endif
4079#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08004080# ifdef _PATH_USERPATH /* Irix */
4081# define _PATH_STDPATH _PATH_USERPATH
4082# else
4083# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4084# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08004085#endif
4086#include <sys/types.h>
4087#include <sys/stat.h>
4088#include <fcntl.h>
4089#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08004090 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08004091 FILE *fd;
4092 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08004093
Tim Rice59ea0a02001-03-10 13:50:45 -08004094 fd = fopen(DATA,"w");
4095 if(fd == NULL)
4096 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08004097
Tim Rice59ea0a02001-03-10 13:50:45 -08004098 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4099 exit(1);
4100
4101 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10004102 ]])],
4103 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08004104 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4105 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4106 )
4107# make sure $bindir is in USER_PATH so scp will work
Damien Miller77eab7b2012-07-06 11:49:28 +10004108 t_bindir="${bindir}"
4109 while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do
4110 t_bindir=`eval echo ${t_bindir}`
4111 case $t_bindir in
4112 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4113 esac
4114 case $t_bindir in
4115 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4116 esac
4117 done
Tim Rice59ea0a02001-03-10 13:50:45 -08004118 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4119 if test $? -ne 0 ; then
4120 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4121 if test $? -ne 0 ; then
4122 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08004123 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08004124 fi
4125 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004126 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11004127)
Darren Tuckere1a790d2003-09-16 11:52:19 +10004128if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004129 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
4130 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07004131fi
Damien Miller5a3e6831999-12-27 09:48:56 +11004132
Damien Millera18bbd32002-05-13 10:48:57 +10004133# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08004134AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10004135 [ --with-superuser-path= Specify different path for super-user],
4136 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004137 if test -n "$withval" && test "x$withval" != "xno" && \
4138 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08004139 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07004140 [Define if you want a different $PATH
4141 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10004142 superuser_path=$withval
4143 fi
4144 ]
4145)
4146
4147
Damien Miller61e50f12000-05-08 20:49:37 +10004148AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11004149IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11004150AC_ARG_WITH(4in6,
4151 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4152 [
4153 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004154 AC_MSG_RESULT([yes])
4155 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004156 [Detect IPv4 in IPv6 mapped addresses
4157 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11004158 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004159 else
Tim Rice648f8762011-01-26 12:38:57 -08004160 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11004161 fi
Tim Rice648f8762011-01-26 12:38:57 -08004162 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11004163 if test "x$inet6_default_4in6" = "xyes"; then
4164 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08004165 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11004166 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11004167 else
4168 AC_MSG_RESULT([no (default)])
4169 fi
4170 ]
4171)
4172
Damien Miller60396b02001-02-18 17:01:00 +11004173# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11004174BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08004175AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11004176 [ --with-bsd-auth Enable BSD auth support],
4177 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004178 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004179 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004180 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11004181 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11004182 fi
4183 ]
4184)
4185
Damien Millera22ba012000-03-02 23:09:20 +11004186# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11004187piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11004188# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08004189if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11004190 piddir=`eval echo ${sysconfdir}`
4191 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11004192 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11004193 esac
4194fi
4195
Tim Rice648f8762011-01-26 12:38:57 -08004196AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08004197 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4198 [
Tim Rice35cc69d2005-03-17 16:44:25 -08004199 if test -n "$withval" && test "x$withval" != "xno" && \
4200 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004201 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08004202 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08004203 AC_MSG_WARN([** no $piddir directory on this system **])
4204 fi
4205 fi
4206 ]
4207)
4208
Tim Rice648f8762011-01-26 12:38:57 -08004209AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
4210 [Specify location of ssh.pid])
4211AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11004212
andre2ff7b5d2000-06-03 14:57:40 +00004213dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08004214AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004215 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004216 [
4217 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004218 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10004219 fi
4220 ]
andre2ff7b5d2000-06-03 14:57:40 +00004221)
Tim Rice648f8762011-01-26 12:38:57 -08004222AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00004223 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004224 [
4225 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004226 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004227 fi
4228 ]
andre2ff7b5d2000-06-03 14:57:40 +00004229)
Tim Rice648f8762011-01-26 12:38:57 -08004230AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00004231 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004232 [
4233 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004234 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004235 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004236 fi
4237 ]
andre2ff7b5d2000-06-03 14:57:40 +00004238)
Tim Rice648f8762011-01-26 12:38:57 -08004239AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00004240 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004241 [
4242 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004243 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10004244 fi
4245 ]
andre2ff7b5d2000-06-03 14:57:40 +00004246)
Tim Rice648f8762011-01-26 12:38:57 -08004247AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00004248 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004249 [
4250 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004251 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004252 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004253 fi
4254 ]
andre2ff7b5d2000-06-03 14:57:40 +00004255)
Tim Rice648f8762011-01-26 12:38:57 -08004256AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00004257 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004258 [
4259 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004260 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10004261 fi
4262 ]
andre2ff7b5d2000-06-03 14:57:40 +00004263)
Tim Rice648f8762011-01-26 12:38:57 -08004264AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00004265 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004266 [
4267 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004268 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004269 [Define if you don't want to use pututline()
4270 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004271 fi
4272 ]
andre2ff7b5d2000-06-03 14:57:40 +00004273)
Tim Rice648f8762011-01-26 12:38:57 -08004274AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00004275 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004276 [
4277 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004278 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07004279 [Define if you don't want to use pututxline()
4280 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004281 fi
4282 ]
andre2ff7b5d2000-06-03 14:57:40 +00004283)
Tim Rice648f8762011-01-26 12:38:57 -08004284AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00004285 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004286 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004287 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004288 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08004289 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004290 conf_lastlog_location=$withval
4291 fi
4292 ]
4293)
andre2ff7b5d2000-06-03 14:57:40 +00004294
4295dnl lastlog, [uw]tmpx? detection
4296dnl NOTE: set the paths in the platform section to avoid the
4297dnl need for command-line parameters
4298dnl lastlog and [uw]tmp are subject to a file search if all else fails
4299
4300dnl lastlog detection
4301dnl NOTE: the code itself will detect if lastlog is a directory
4302AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004303AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004304#include <sys/types.h>
4305#include <utmp.h>
4306#ifdef HAVE_LASTLOG_H
4307# include <lastlog.h>
4308#endif
Damien Miller2994e082000-06-04 15:51:47 +10004309#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004310# include <paths.h>
4311#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004312#ifdef HAVE_LOGIN_H
4313# include <login.h>
4314#endif
Tim Rice648f8762011-01-26 12:38:57 -08004315 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4316 [ AC_MSG_RESULT([yes]) ],
4317 [
4318 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004319 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004320 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004321#include <sys/types.h>
4322#include <utmp.h>
4323#ifdef HAVE_LASTLOG_H
4324# include <lastlog.h>
4325#endif
4326#ifdef HAVE_PATHS_H
4327# include <paths.h>
4328#endif
Tim Rice648f8762011-01-26 12:38:57 -08004329 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4330 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004331 [
Tim Rice648f8762011-01-26 12:38:57 -08004332 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004333 system_lastlog_path=no
4334 ])
Tim Rice648f8762011-01-26 12:38:57 -08004335])
Damien Miller2994e082000-06-04 15:51:47 +10004336
andre2ff7b5d2000-06-03 14:57:40 +00004337if test -z "$conf_lastlog_location"; then
4338 if test x"$system_lastlog_path" = x"no" ; then
4339 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004340 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004341 conf_lastlog_location=$f
4342 fi
4343 done
4344 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004345 AC_MSG_WARN([** Cannot find lastlog **])
4346 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004347 fi
4348 fi
4349fi
4350
4351if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004352 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004353 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004354fi
andre2ff7b5d2000-06-03 14:57:40 +00004355
4356dnl utmp detection
4357AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004358AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004359#include <sys/types.h>
4360#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004361#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004362# include <paths.h>
4363#endif
Tim Rice648f8762011-01-26 12:38:57 -08004364 ]], [[ char *utmp = UTMP_FILE; ]])],
4365 [ AC_MSG_RESULT([yes]) ],
4366 [ AC_MSG_RESULT([no])
4367 system_utmp_path=no
4368])
andre2ff7b5d2000-06-03 14:57:40 +00004369if test -z "$conf_utmp_location"; then
4370 if test x"$system_utmp_path" = x"no" ; then
4371 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4372 if test -f $f ; then
4373 conf_utmp_location=$f
4374 fi
4375 done
4376 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004377 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004378 fi
4379 fi
4380fi
4381if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004382 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004383 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004384fi
andre2ff7b5d2000-06-03 14:57:40 +00004385
4386dnl wtmp detection
4387AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004388AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004389#include <sys/types.h>
4390#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004391#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004392# include <paths.h>
4393#endif
Tim Rice648f8762011-01-26 12:38:57 -08004394 ]], [[ char *wtmp = WTMP_FILE; ]])],
4395 [ AC_MSG_RESULT([yes]) ],
4396 [ AC_MSG_RESULT([no])
4397 system_wtmp_path=no
4398])
andre2ff7b5d2000-06-03 14:57:40 +00004399if test -z "$conf_wtmp_location"; then
4400 if test x"$system_wtmp_path" = x"no" ; then
4401 for f in /usr/adm/wtmp /var/log/wtmp; do
4402 if test -f $f ; then
4403 conf_wtmp_location=$f
4404 fi
4405 done
4406 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004407 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004408 fi
4409 fi
4410fi
4411if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004412 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004413 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004414fi
andre2ff7b5d2000-06-03 14:57:40 +00004415
andre2ff7b5d2000-06-03 14:57:40 +00004416dnl wtmpx detection
4417AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004418AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004419#include <sys/types.h>
4420#include <utmp.h>
4421#ifdef HAVE_UTMPX_H
4422#include <utmpx.h>
4423#endif
Damien Miller2994e082000-06-04 15:51:47 +10004424#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004425# include <paths.h>
4426#endif
Tim Rice648f8762011-01-26 12:38:57 -08004427 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4428 [ AC_MSG_RESULT([yes]) ],
4429 [ AC_MSG_RESULT([no])
4430 system_wtmpx_path=no
4431])
andre2ff7b5d2000-06-03 14:57:40 +00004432if test -z "$conf_wtmpx_location"; then
4433 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004434 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004435 fi
4436else
Tim Rice648f8762011-01-26 12:38:57 -08004437 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004438 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004439fi
andre2ff7b5d2000-06-03 14:57:40 +00004440
Damien Miller4018c192000-04-30 09:30:44 +10004441
Damien Miller29ea30d2000-03-17 10:54:15 +11004442if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004443 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4444 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004445fi
4446
Damien Millera2438bb2013-03-15 10:23:07 +11004447AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
Tim Riceaa86c392013-03-16 20:55:46 -07004448 if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
Damien Millera2438bb2013-03-15 10:23:07 +11004449 AC_DEFINE([DISABLE_LASTLOG])
Tim Riceaa86c392013-03-16 20:55:46 -07004450 fi
Damien Millera2438bb2013-03-15 10:23:07 +11004451 ], [
4452#ifdef HAVE_SYS_TYPES_H
4453#include <sys/types.h>
4454#endif
4455#ifdef HAVE_UTMP_H
4456#include <utmp.h>
4457#endif
4458#ifdef HAVE_UTMPX_H
4459#include <utmpx.h>
4460#endif
4461#ifdef HAVE_LASTLOG_H
4462#include <lastlog.h>
4463#endif
4464 ])
4465
4466AC_CHECK_MEMBER([struct utmp.ut_line], [], [
4467 AC_DEFINE([DISABLE_UTMP])
4468 AC_DEFINE([DISABLE_WTMP])
4469 ], [
4470#ifdef HAVE_SYS_TYPES_H
4471#include <sys/types.h>
4472#endif
4473#ifdef HAVE_UTMP_H
4474#include <utmp.h>
4475#endif
4476#ifdef HAVE_UTMPX_H
4477#include <utmpx.h>
4478#endif
4479#ifdef HAVE_LASTLOG_H
4480#include <lastlog.h>
4481#endif
4482 ])
4483
Darren Tucker7da23cb2005-08-03 00:20:15 +10004484dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4485dnl Add now.
4486CFLAGS="$CFLAGS $werror_flags"
4487
Darren Tucker627337d2010-04-10 22:58:01 +10004488if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4489 TEST_SSH_IPV6=no
4490else
4491 TEST_SSH_IPV6=yes
4492fi
Tim Rice648f8762011-01-26 12:38:57 -08004493AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4494AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004495
Damien Millerbac2d8a2000-09-05 16:13:06 +11004496AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004497AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4498 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004499 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004500AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004501
Damien Miller7b22d652000-06-18 14:07:04 +10004502# Print summary of options
4503
Damien Miller7b22d652000-06-18 14:07:04 +10004504# Someone please show me a better way :)
4505A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4506B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4507C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4508D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004509E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004510F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004511G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004512H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4513I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4514J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004515
4516echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004517echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004518echo " User binaries: $B"
4519echo " System binaries: $C"
4520echo " Configuration files: $D"
4521echo " Askpass program: $E"
4522echo " Manual pages: $F"
4523echo " PID file: $G"
4524echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004525if test "x$external_path_file" = "x/etc/login.conf" ; then
4526echo " At runtime, sshd will use the path defined in $external_path_file"
4527echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004528else
Damien Millerf58c6722002-05-13 13:15:42 +10004529echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004530 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004531echo " (If PATH is set in $external_path_file it will be used instead. If"
4532echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4533 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004534fi
Damien Millera18bbd32002-05-13 10:48:57 +10004535if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004536echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004537fi
Damien Millerf58c6722002-05-13 13:15:42 +10004538echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004539echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004540echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004541echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004542echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004543echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004544echo " S/KEY support: $SKEY_MSG"
4545echo " TCP Wrappers support: $TCPW_MSG"
4546echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004547echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004548echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004549echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004550echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004551echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4552echo " BSD Auth support: $BSD_AUTH_MSG"
4553echo " Random number source: $RAND_MSG"
Damien Miller69ff1df2011-06-23 08:30:03 +10004554echo " Privsep sandbox style: $SANDBOX_STYLE"
Damien Miller60396b02001-02-18 17:01:00 +11004555
Damien Miller7b22d652000-06-18 14:07:04 +10004556echo ""
4557
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004558echo " Host: ${host}"
4559echo " Compiler: ${CC}"
4560echo " Compiler flags: ${CFLAGS}"
4561echo "Preprocessor flags: ${CPPFLAGS}"
4562echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004563echo " Libraries: ${LIBS}"
4564if test ! -z "${SSHDLIBS}"; then
4565echo " +for sshd: ${SSHDLIBS}"
4566fi
Damien Miller71adf122011-01-25 12:16:15 +11004567if test ! -z "${SSHLIBS}"; then
4568echo " +for ssh: ${SSHLIBS}"
4569fi
Damien Miller7b22d652000-06-18 14:07:04 +10004570
4571echo ""
4572
Tim Rice6f1f7582004-05-30 21:38:51 -07004573if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004574 echo "SVR4 style packages are supported with \"make package\""
4575 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004576fi
4577
Damien Miller82cf0ce2000-12-20 13:34:48 +11004578if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004579 echo "PAM is enabled. You may need to install a PAM control file "
4580 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004581 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004582 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004583 echo ""
4584fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004585
Damien Millerb4097182004-05-23 14:09:40 +10004586if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004587 echo "WARNING: the operating system that you are using does not"
4588 echo "appear to support getpeereid(), getpeerucred() or the"
4589 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4590 echo "enforce security checks to prevent unauthorised connections to"
4591 echo "ssh-agent. Their absence increases the risk that a malicious"
4592 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004593 echo ""
4594fi
4595
Darren Tuckerd9f88912005-02-20 21:01:48 +11004596if test "$AUDIT_MODULE" = "bsm" ; then
4597 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4598 echo "See the Solaris section in README.platform for details."
4599fi