blob: c8d90ea0dfe0850f2b0f4b063dd74e02fa53c564 [file] [log] [blame]
Tim Rice648f8762011-01-26 12:38:57 -08001# $Id: configure.ac,v 1.471 2011/01/26 20:38:58 tim 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])
18AC_REVISION($Revision: 1.471 $)
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
Damien Miller134d02a2011-01-12 16:00:37 +110022# local macros
23AC_DEFUN([OPENSSH_CHECK_CFLAG_COMPILE], [{
24 AC_MSG_CHECKING([if $CC supports $1])
25 saved_CFLAGS="$CFLAGS"
26 CFLAGS="$CFLAGS $1"
27 AC_COMPILE_IFELSE([void main(void) { return 0; }],
Tim Rice648f8762011-01-26 12:38:57 -080028 [ AC_MSG_RESULT([yes]) ],
29 [ AC_MSG_RESULT([no])
Damien Miller134d02a2011-01-12 16:00:37 +110030 CFLAGS="$saved_CFLAGS" ]
31 )
32}])
33
Tim Rice648f8762011-01-26 12:38:57 -080034AC_CONFIG_HEADER([config.h])
Damien Miller856799b2000-03-15 21:18:10 +110035AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110036AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110037AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100038
Damien Millera22ba012000-03-02 23:09:20 +110039# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100040AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110041AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100042AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110043AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080044AC_PROG_EGREP
Tim Rice648f8762011-01-26 12:38:57 -080045AC_PATH_PROG([AR], [ar])
46AC_PATH_PROG([CAT], [cat])
47AC_PATH_PROG([KILL], [kill])
48AC_PATH_PROGS([PERL], [perl5 perl])
49AC_PATH_PROG([SED], [sed])
50AC_SUBST([PERL])
51AC_PATH_PROG([ENT], [ent])
52AC_SUBST([ENT])
53AC_PATH_PROG([TEST_MINUS_S_SH], [bash])
54AC_PATH_PROG([TEST_MINUS_S_SH], [ksh])
55AC_PATH_PROG([TEST_MINUS_S_SH], [sh])
56AC_PATH_PROG([SH], [sh])
57AC_PATH_PROG([GROFF], [groff])
58AC_PATH_PROG([NROFF], [nroff])
59AC_PATH_PROG([MANDOC], [mandoc])
60AC_SUBST([TEST_SHELL], [sh])
Damien Miller2e1b0821999-12-25 10:11:29 +110061
Damien Miller30a69e72011-01-04 08:16:27 +110062dnl select manpage formatter
63if test "x$MANDOC" != "x" ; then
64 MANFMT="$MANDOC"
65elif test "x$NROFF" != "x" ; then
66 MANFMT="$NROFF -mandoc"
67elif test "x$GROFF" != "x" ; then
68 MANFMT="$GROFF -mandoc -Tascii"
69else
70 AC_MSG_WARN([no manpage formatted found])
71 MANFMT="false"
72fi
Tim Rice648f8762011-01-26 12:38:57 -080073AC_SUBST([MANFMT])
Damien Miller30a69e72011-01-04 08:16:27 +110074
Tim Rice6f1f7582004-05-30 21:38:51 -070075dnl for buildpkg.sh
Tim Rice648f8762011-01-26 12:38:57 -080076AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd],
Tim Rice6f1f7582004-05-30 21:38:51 -070077 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080078AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd],
Tim Rice6f1f7582004-05-30 21:38:51 -070079 [/usr/sbin${PATH_SEPARATOR}/etc])
Tim Rice648f8762011-01-26 12:38:57 -080080AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no])
Darren Tuckerfbea7642006-01-30 00:22:39 +110081if test -x /sbin/sh; then
Tim Rice648f8762011-01-26 12:38:57 -080082 AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110083else
Tim Rice648f8762011-01-26 12:38:57 -080084 AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh])
Darren Tuckerfbea7642006-01-30 00:22:39 +110085fi
Tim Rice6f1f7582004-05-30 21:38:51 -070086
Damien Millere8bb4502001-09-25 16:39:35 +100087# System features
88AC_SYS_LARGEFILE
89
Damien Miller3f62aba2000-11-29 11:56:35 +110090if test -z "$AR" ; then
91 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
92fi
93
Damien Millerad833b32000-08-23 10:46:23 +100094# Use LOGIN_PROGRAM from environment if possible
95if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice648f8762011-01-26 12:38:57 -080096 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM"],
Tim Rice7df8d392005-09-19 09:33:39 -070097 [If your header files don't define LOGIN_PROGRAM,
98 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100099else
100 # Search for login
Tim Rice648f8762011-01-26 12:38:57 -0800101 AC_PATH_PROG([LOGIN_PROGRAM_FALLBACK], [login])
Damien Millerad833b32000-08-23 10:46:23 +1000102 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800103 AC_DEFINE_UNQUOTED([LOGIN_PROGRAM_FALLBACK], ["$LOGIN_PROGRAM_FALLBACK"])
Damien Millerad833b32000-08-23 10:46:23 +1000104 fi
105fi
106
Tim Rice648f8762011-01-26 12:38:57 -0800107AC_PATH_PROG([PATH_PASSWD_PROG], [passwd])
Darren Tucker23bc8d02004-02-06 16:24:31 +1100108if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800109 AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"],
Tim Rice7df8d392005-09-19 09:33:39 -0700110 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +1100111fi
112
Damien Miller166bd442000-03-16 10:48:25 +1100113if test -z "$LD" ; then
114 LD=$CC
115fi
Tim Rice648f8762011-01-26 12:38:57 -0800116AC_SUBST([LD])
Tim Riceeae17cc2005-03-17 16:52:20 -0800117
Damien Miller166bd442000-03-16 10:48:25 +1100118AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +1000119
Tim Rice648f8762011-01-26 12:38:57 -0800120AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>])
Darren Tucker67b37032005-06-03 17:58:31 +1000121
Darren Tuckerb7918af2008-03-09 11:34:23 +1100122use_stack_protector=1
Tim Rice648f8762011-01-26 12:38:57 -0800123AC_ARG_WITH([stackprotect],
Damien Millerda3155e2008-03-27 12:30:18 +1100124 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100125 if test "x$withval" = "xno"; then
126 use_stack_protector=0
127 fi ])
128
Damien Miller134d02a2011-01-12 16:00:37 +1100129
Damien Millera8e06ce2003-11-21 23:48:55 +1100130if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller134d02a2011-01-12 16:00:37 +1100131 OPENSSH_CHECK_CFLAG_COMPILE([-Wall])
132 OPENSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
133 OPENSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
134 OPENSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
135 OPENSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
136 OPENSSH_CHECK_CFLAG_COMPILE([-Wno-pointer-sign])
137 OPENSSH_CHECK_CFLAG_COMPILE([-Wno-unused-result])
138 OPENSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
Tim Rice648f8762011-01-26 12:38:57 -0800139 AC_MSG_CHECKING([gcc version])
Darren Tucker3f9545e2005-11-12 15:20:52 +1100140 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700141 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000142 1.*) no_attrib_nonnull=1 ;;
143 2.8* | 2.9*)
Darren Tucker391de5c2007-04-29 14:49:21 +1000144 no_attrib_nonnull=1
145 ;;
146 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100147 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700148 esac
Tim Rice648f8762011-01-26 12:38:57 -0800149 AC_MSG_RESULT([$GCC_VER])
Damien Millerde3cb0a2005-05-26 20:48:25 +1000150
Tim Rice648f8762011-01-26 12:38:57 -0800151 AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset])
Darren Tucker330c93f2008-06-16 02:27:48 +1000152 saved_CFLAGS="$CFLAGS"
153 CFLAGS="$CFLAGS -fno-builtin-memset"
Tim Rice648f8762011-01-26 12:38:57 -0800154 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]],
155 [[ char b[10]; memset(b, 0, sizeof(b)); ]])],
156 [ AC_MSG_RESULT([yes]) ],
157 [ AC_MSG_RESULT([no])
Darren Tucker330c93f2008-06-16 02:27:48 +1000158 CFLAGS="$saved_CFLAGS" ]
Tim Rice648f8762011-01-26 12:38:57 -0800159 )
Darren Tucker330c93f2008-06-16 02:27:48 +1000160
Darren Tuckerb7918af2008-03-09 11:34:23 +1100161 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100162 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100163 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100164 if test "x$use_stack_protector" = "x1"; then
165 for t in -fstack-protector-all -fstack-protector; do
Tim Rice648f8762011-01-26 12:38:57 -0800166 AC_MSG_CHECKING([if $CC supports $t])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100167 saved_CFLAGS="$CFLAGS"
168 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100169 CFLAGS="$CFLAGS $t -Werror"
170 LDFLAGS="$LDFLAGS $t -Werror"
171 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800172 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
173 [[
174 char x[256];
175 snprintf(x, sizeof(x), "XXX");
176 ]])],
177 [ AC_MSG_RESULT([yes])
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100178 CFLAGS="$saved_CFLAGS $t"
179 LDFLAGS="$saved_LDFLAGS $t"
Tim Rice648f8762011-01-26 12:38:57 -0800180 AC_MSG_CHECKING([if $t works])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100181 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800182 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
183 [[
184 char x[256];
185 snprintf(x, sizeof(x), "XXX");
186 ]])],
187 [ AC_MSG_RESULT([yes])
Darren Tuckerb7918af2008-03-09 11:34:23 +1100188 break ],
Tim Rice648f8762011-01-26 12:38:57 -0800189 [ AC_MSG_RESULT([no]) ],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100190 [ AC_MSG_WARN([cross compiling: cannot test])
191 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100192 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100193 ],
Tim Rice648f8762011-01-26 12:38:57 -0800194 [ AC_MSG_RESULT([no]) ]
Darren Tuckerb7918af2008-03-09 11:34:23 +1100195 )
196 CFLAGS="$saved_CFLAGS"
197 LDFLAGS="$saved_LDFLAGS"
198 done
199 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100200
Darren Tucker67b37032005-06-03 17:58:31 +1000201 if test -z "$have_llong_max"; then
202 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
203 unset ac_cv_have_decl_LLONG_MAX
204 saved_CFLAGS="$CFLAGS"
205 CFLAGS="$CFLAGS -std=gnu99"
Tim Rice648f8762011-01-26 12:38:57 -0800206 AC_CHECK_DECL([LLONG_MAX],
Darren Tucker67b37032005-06-03 17:58:31 +1000207 [have_llong_max=1],
208 [CFLAGS="$saved_CFLAGS"],
209 [#include <limits.h>]
210 )
211 fi
Damien Miller166bd442000-03-16 10:48:25 +1100212fi
213
Darren Tucker391de5c2007-04-29 14:49:21 +1000214if test "x$no_attrib_nonnull" != "x1" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800215 AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull])
Darren Tucker391de5c2007-04-29 14:49:21 +1000216fi
217
Tim Rice648f8762011-01-26 12:38:57 -0800218AC_ARG_WITH([rpath],
Tim Rice88368a32003-12-08 12:35:59 -0800219 [ --without-rpath Disable auto-added -R linker paths],
220 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800221 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800222 need_dash_r=""
223 fi
224 if test "x$withval" = "xyes" ; then
225 need_dash_r=1
226 fi
227 ]
228)
229
Tim Rice1cfab232006-10-03 09:34:35 -0700230# Allow user to specify flags
Tim Rice648f8762011-01-26 12:38:57 -0800231AC_ARG_WITH([cflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700232 [ --with-cflags Specify additional flags to pass to compiler],
233 [
234 if test -n "$withval" && test "x$withval" != "xno" && \
235 test "x${withval}" != "xyes"; then
236 CFLAGS="$CFLAGS $withval"
237 fi
238 ]
239)
Tim Rice648f8762011-01-26 12:38:57 -0800240AC_ARG_WITH([cppflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700241 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
242 [
243 if test -n "$withval" && test "x$withval" != "xno" && \
244 test "x${withval}" != "xyes"; then
245 CPPFLAGS="$CPPFLAGS $withval"
246 fi
247 ]
248)
Tim Rice648f8762011-01-26 12:38:57 -0800249AC_ARG_WITH([ldflags],
Tim Rice1cfab232006-10-03 09:34:35 -0700250 [ --with-ldflags Specify additional flags to pass to linker],
251 [
252 if test -n "$withval" && test "x$withval" != "xno" && \
253 test "x${withval}" != "xyes"; then
254 LDFLAGS="$LDFLAGS $withval"
255 fi
256 ]
257)
Tim Rice648f8762011-01-26 12:38:57 -0800258AC_ARG_WITH([libs],
Tim Rice1cfab232006-10-03 09:34:35 -0700259 [ --with-libs Specify additional libraries to link with],
260 [
261 if test -n "$withval" && test "x$withval" != "xno" && \
262 test "x${withval}" != "xyes"; then
263 LIBS="$LIBS $withval"
264 fi
265 ]
266)
Tim Rice648f8762011-01-26 12:38:57 -0800267AC_ARG_WITH([Werror],
Tim Rice1cfab232006-10-03 09:34:35 -0700268 [ --with-Werror Build main code with -Werror],
269 [
270 if test -n "$withval" && test "x$withval" != "xno"; then
271 werror_flags="-Werror"
272 if test "x${withval}" != "xyes"; then
273 werror_flags="$withval"
274 fi
275 fi
276 ]
277)
278
Tim Rice648f8762011-01-26 12:38:57 -0800279AC_CHECK_HEADERS([ \
Tim Rice1cfab232006-10-03 09:34:35 -0700280 bstring.h \
281 crypt.h \
282 crypto/sha2.h \
283 dirent.h \
284 endian.h \
285 features.h \
286 fcntl.h \
287 floatingpoint.h \
288 getopt.h \
289 glob.h \
290 ia.h \
291 iaf.h \
292 limits.h \
293 login.h \
294 maillock.h \
295 ndir.h \
296 net/if_tun.h \
297 netdb.h \
298 netgroup.h \
299 pam/pam_appl.h \
300 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000301 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700302 pty.h \
303 readpassphrase.h \
304 rpc/types.h \
305 security/pam_appl.h \
306 sha2.h \
307 shadow.h \
308 stddef.h \
309 stdint.h \
310 string.h \
311 strings.h \
312 sys/audit.h \
313 sys/bitypes.h \
314 sys/bsdtty.h \
315 sys/cdefs.h \
316 sys/dir.h \
317 sys/mman.h \
318 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000319 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700320 sys/prctl.h \
321 sys/pstat.h \
322 sys/select.h \
323 sys/stat.h \
324 sys/stream.h \
325 sys/stropts.h \
326 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000327 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700328 sys/sysmacros.h \
329 sys/time.h \
330 sys/timers.h \
331 sys/un.h \
332 time.h \
333 tmpdir.h \
334 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700335 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700336 unistd.h \
337 usersec.h \
338 util.h \
339 utime.h \
340 utmp.h \
341 utmpx.h \
342 vis.h \
Tim Rice648f8762011-01-26 12:38:57 -0800343])
Tim Rice1cfab232006-10-03 09:34:35 -0700344
345# lastlog.h requires sys/time.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800346AC_CHECK_HEADERS([lastlog.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700347#ifdef HAVE_SYS_TIME_H
348# include <sys/time.h>
349#endif
350])
351
352# sys/ptms.h requires sys/stream.h to be included first on Solaris
Tim Rice648f8762011-01-26 12:38:57 -0800353AC_CHECK_HEADERS([sys/ptms.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700354#ifdef HAVE_SYS_STREAM_H
355# include <sys/stream.h>
356#endif
357])
358
359# login_cap.h requires sys/types.h on NetBSD
Tim Rice648f8762011-01-26 12:38:57 -0800360AC_CHECK_HEADERS([login_cap.h], [], [], [
Tim Rice1cfab232006-10-03 09:34:35 -0700361#include <sys/types.h>
362])
363
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000364# older BSDs need sys/param.h before sys/mount.h
Tim Rice648f8762011-01-26 12:38:57 -0800365AC_CHECK_HEADERS([sys/mount.h], [], [], [
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000366#include <sys/param.h>
367])
368
Damien Miller1b06dc32006-08-31 03:24:41 +1000369# Messages for features tested for in target-specific section
370SIA_MSG="no"
371SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100372SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000373
Damien Millera22ba012000-03-02 23:09:20 +1100374# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100375case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100376*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000377 # Some versions of VAC won't allow macro redefinitions at
378 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
379 # particularly with older versions of vac or xlc.
380 # It also throws errors about null macro argments, but these are
381 # not fatal.
Tim Rice648f8762011-01-26 12:38:57 -0800382 AC_MSG_CHECKING([if compiler allows macro redefinitions])
Darren Tucker9216c372006-09-18 23:17:40 +1000383 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -0800384 [AC_LANG_PROGRAM([[
Darren Tucker9216c372006-09-18 23:17:40 +1000385#define testmacro foo
Tim Rice648f8762011-01-26 12:38:57 -0800386#define testmacro bar]],
387 [[ exit(0); ]])],
388 [ AC_MSG_RESULT([yes]) ],
389 [ AC_MSG_RESULT([no])
Darren Tucker9216c372006-09-18 23:17:40 +1000390 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
391 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
392 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
393 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
394 ]
395 )
396
Damien Millera8e06ce2003-11-21 23:48:55 +1100397 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000398 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800399 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100400 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000401 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000402 if test "$GCC" = "yes"; then
403 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
404 else
405 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
406 fi
407 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000408 if (test -z "$blibflags"); then
409 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
Tim Rice648f8762011-01-26 12:38:57 -0800410 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
411 [blibflags=$tryflags], [])
Damien Millereab4bae2003-04-29 23:22:40 +1000412 fi
413 done
414 if (test -z "$blibflags"); then
Tim Rice648f8762011-01-26 12:38:57 -0800415 AC_MSG_RESULT([not found])
Damien Millereab4bae2003-04-29 23:22:40 +1000416 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
417 else
Tim Rice648f8762011-01-26 12:38:57 -0800418 AC_MSG_RESULT([$blibflags])
Damien Millereab4bae2003-04-29 23:22:40 +1000419 fi
420 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000421 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice648f8762011-01-26 12:38:57 -0800422 AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700423 [Define if you want to enable AIX4's authenticate function])],
Tim Rice648f8762011-01-26 12:38:57 -0800424 [AC_CHECK_LIB([s], [authenticate],
425 [ AC_DEFINE([WITH_AIXAUTHENTICATE])
Tim Ricee958ed32002-07-05 07:12:33 -0700426 LIBS="$LIBS -ls"
427 ])
428 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100429 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100430 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100431 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000432 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Tim Rice648f8762011-01-26 12:38:57 -0800433 AC_CHECK_DECLS([loginfailed],
434 [AC_MSG_CHECKING([if loginfailed takes 4 arguments])
435 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]],
436 [[ (void)loginfailed("user","host","tty",0); ]])],
437 [AC_MSG_RESULT([yes])
438 AC_DEFINE([AIX_LOGINFAILED_4ARG], [1],
439 [Define if your AIX loginfailed() function
440 takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no])
441 ])],
442 [],
443 [#include <usersec.h>]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000444 )
Tim Rice648f8762011-01-26 12:38:57 -0800445 AC_CHECK_FUNCS([getgrset setauthdb])
446 AC_CHECK_DECL([F_CLOSEM],
447 AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000448 [],
449 [ #include <limits.h>
450 #include <fcntl.h> ]
451 )
Darren Tucker691d5232005-02-15 21:45:57 +1100452 check_for_aix_broken_getaddrinfo=1
Tim Rice648f8762011-01-26 12:38:57 -0800453 AC_DEFINE([BROKEN_REALPATH], [1], [Define if you have a broken realpath.])
454 AC_DEFINE([SETEUID_BREAKS_SETUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700455 [Define if your platform breaks doing a seteuid before a setuid])
Tim Rice648f8762011-01-26 12:38:57 -0800456 AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken])
457 AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000458 dnl AIX handles lastlog as part of its login message
Tim Rice648f8762011-01-26 12:38:57 -0800459 AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog])
460 AC_DEFINE([LOGIN_NEEDS_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700461 [Some systems need a utmpx entry for /bin/login to work])
Tim Rice648f8762011-01-26 12:38:57 -0800462 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV],
Tim Rice7df8d392005-09-19 09:33:39 -0700463 [Define to a Set Process Title type if your system is
464 supported by bsd-setproctitle.c])
Tim Rice648f8762011-01-26 12:38:57 -0800465 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Darren Tucker91d25a02005-11-26 22:24:09 +1100466 [AIX 5.2 and 5.3 (and presumably newer) require this])
Tim Rice648f8762011-01-26 12:38:57 -0800467 AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100468 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100469*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100470 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100471 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice648f8762011-01-26 12:38:57 -0800472 AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin])
473 AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()])
474 AC_DEFINE([DISABLE_SHADOW], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700475 [Define if you want to disable shadow passwords])
Tim Rice648f8762011-01-26 12:38:57 -0800476 AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700477 [Define if X11 doesn't support AF_UNIX sockets on that system])
Tim Rice648f8762011-01-26 12:38:57 -0800478 AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700479 [Define if the concept of ports only accessible to
480 superusers isn't known])
Tim Rice648f8762011-01-26 12:38:57 -0800481 AC_DEFINE([DISABLE_FD_PASSING], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700482 [Define if your platform needs to skip post auth
483 file descriptor passing])
Tim Rice648f8762011-01-26 12:38:57 -0800484 AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size])
485 AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100486 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000487*-*-dgux*)
Tim Rice648f8762011-01-26 12:38:57 -0800488 AC_DEFINE([IP_TOS_IS_BROKEN], [1],
Tim Ricea74000e2009-03-18 11:25:02 -0700489 [Define if your system choked on IP TOS setting])
Tim Rice648f8762011-01-26 12:38:57 -0800490 AC_DEFINE([SETEUID_BREAKS_SETUID])
491 AC_DEFINE([BROKEN_SETREUID])
492 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom58055132001-02-15 18:34:29 +0000493 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000494*-*-darwin*)
Tim Rice648f8762011-01-26 12:38:57 -0800495 AC_MSG_CHECKING([if we have working getaddrinfo])
496 AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include <mach-o/dyld.h>
Damien Millerfc93d4b2002-09-04 23:26:29 +1000497main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
498 exit(0);
499 else
500 exit(1);
Tim Rice648f8762011-01-26 12:38:57 -0800501}
502 ]])],
503 [AC_MSG_RESULT([working])],
504 [AC_MSG_RESULT([buggy])
505 AC_DEFINE([BROKEN_GETADDRINFO], [1],
506 [getaddrinfo is broken (if present)])
507 ],
508 [AC_MSG_RESULT([assume it is working])])
509 AC_DEFINE([SETEUID_BREAKS_SETUID])
510 AC_DEFINE([BROKEN_SETREUID])
511 AC_DEFINE([BROKEN_SETREGID])
512 AC_DEFINE([BROKEN_GLOB], [1], [OS X glob does not do what we expect])
513 AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700514 [Define if your resolver libs need this for getrrsetbyname])
Tim Rice648f8762011-01-26 12:38:57 -0800515 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
516 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000517 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800518 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Darren Tucker3eb48342006-06-23 21:05:12 +1000519 [Prepend the address family to IP tunnel traffic])
Tim Rice648f8762011-01-26 12:38:57 -0800520 m4_pattern_allow([AU_IPv])
521 AC_CHECK_DECL([AU_IPv4], [],
522 AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records])
Darren Tuckeracada072008-02-25 21:05:04 +1100523 [#include <bsm/audit.h>]
Tim Rice648f8762011-01-26 12:38:57 -0800524 AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1],
Damien Miller20e231f2009-02-12 13:12:21 +1100525 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100526 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000527 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000528*-*-dragonfly*)
529 SSHDLIBS="$SSHDLIBS -lcrypt"
530 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100531*-*-haiku*)
532 LIBS="$LIBS -lbsd "
Tim Rice648f8762011-01-26 12:38:57 -0800533 AC_CHECK_LIB([network], [socket])
534 AC_DEFINE([HAVE_U_INT64_T])
Darren Tuckera83d90f2010-03-26 10:27:33 +1100535 MANTYPE=man
536 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000537*-*-hpux*)
538 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000539 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100540 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800541 AC_DEFINE([USE_PIPES])
542 AC_DEFINE([LOGIN_NO_ENDOPT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700543 [Define if your login program cannot handle end of options ("--")])
Tim Rice648f8762011-01-26 12:38:57 -0800544 AC_DEFINE([LOGIN_NEEDS_UTMPX])
545 AC_DEFINE([LOCKED_PASSWD_STRING], ["*"],
Tim Rice7df8d392005-09-19 09:33:39 -0700546 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800547 AC_DEFINE([SPT_TYPE], [SPT_PSTAT])
Darren Tucker1e6616b2005-10-08 12:07:01 +1000548 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700549 LIBS="$LIBS -lsec"
Tim Rice648f8762011-01-26 12:38:57 -0800550 AC_CHECK_LIB([xnet], [t_error], ,
551 [AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])])
Darren Tuckerfd333282005-05-28 18:31:42 +1000552
553 # next, we define all of the options specific to major releases
554 case "$host" in
555 *-*-hpux10*)
556 if test -z "$GCC"; then
557 CFLAGS="$CFLAGS -Ae"
558 fi
559 ;;
560 *-*-hpux11*)
Tim Rice648f8762011-01-26 12:38:57 -0800561 AC_DEFINE([PAM_SUN_CODEBASE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700562 [Define if you are using Solaris-derived PAM which
563 passes pam_messages to the conversation function
564 with an extra level of indirection])
Tim Rice648f8762011-01-26 12:38:57 -0800565 AC_DEFINE([DISABLE_UTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700566 [Define if you don't want to use utmp])
Tim Rice648f8762011-01-26 12:38:57 -0800567 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Darren Tuckerfd333282005-05-28 18:31:42 +1000568 check_for_hpux_broken_getaddrinfo=1
569 check_for_conflicting_getspnam=1
570 ;;
571 esac
572
573 # lastly, we define options specific to minor releases
574 case "$host" in
575 *-*-hpux10.26)
Tim Rice648f8762011-01-26 12:38:57 -0800576 AC_DEFINE([HAVE_SECUREWARE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700577 [Define if you have SecureWare-based
578 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000579 disable_ptmx_check=yes
580 LIBS="$LIBS -lsecpw"
581 ;;
582 esac
Damien Miller1bead332000-04-30 00:47:29 +1000583 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100584*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100585 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800586 AC_DEFINE([BROKEN_INET_NTOA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700587 [Define if you system's inet_ntoa is busted
588 (e.g. Irix gcc issue)])
Tim Rice648f8762011-01-26 12:38:57 -0800589 AC_DEFINE([SETEUID_BREAKS_SETUID])
590 AC_DEFINE([BROKEN_SETREUID])
591 AC_DEFINE([BROKEN_SETREGID])
592 AC_DEFINE([WITH_ABBREV_NO_TTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700593 [Define if you shouldn't strip 'tty' from your
594 ttyname in [uw]tmp])
Tim Rice648f8762011-01-26 12:38:57 -0800595 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller1808f382000-01-06 12:03:12 +1100596 ;;
597*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100598 PATH="$PATH:/usr/etc"
Tim Rice648f8762011-01-26 12:38:57 -0800599 AC_DEFINE([WITH_IRIX_ARRAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700600 [Define if you have/want arrays
601 (cluster-wide session managment, not C arrays)])
Tim Rice648f8762011-01-26 12:38:57 -0800602 AC_DEFINE([WITH_IRIX_PROJECT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700603 [Define if you want IRIX project management])
Tim Rice648f8762011-01-26 12:38:57 -0800604 AC_DEFINE([WITH_IRIX_AUDIT], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700605 [Define if you want IRIX audit trails])
Tim Rice648f8762011-01-26 12:38:57 -0800606 AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700607 [Define if you want IRIX kernel jobs])])
Tim Rice648f8762011-01-26 12:38:57 -0800608 AC_DEFINE([BROKEN_INET_NTOA])
609 AC_DEFINE([SETEUID_BREAKS_SETUID])
610 AC_DEFINE([BROKEN_SETREUID])
611 AC_DEFINE([BROKEN_SETREGID])
612 AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)])
613 AC_DEFINE([WITH_ABBREV_NO_TTY])
614 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Millerbeb4ba51999-12-28 15:09:35 +1100615 ;;
Damien Miller90551722009-02-16 15:37:03 +1100616*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
617 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800618 AC_DEFINE([PAM_TTY_KLUDGE])
619 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"])
620 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
621 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
622 AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins])
Damien Miller90551722009-02-16 15:37:03 +1100623 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100624*-*-linux*)
625 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100626 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000627 check_for_openpty_ctty_bug=1
Tim Rice648f8762011-01-26 12:38:57 -0800628 AC_DEFINE([PAM_TTY_KLUDGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700629 [Work around problematic Linux PAM modules handling of PAM_TTY])
Tim Rice648f8762011-01-26 12:38:57 -0800630 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"],
Tim Rice7df8d392005-09-19 09:33:39 -0700631 [String used in /etc/passwd to denote locked account])
Tim Rice648f8762011-01-26 12:38:57 -0800632 AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV])
633 AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM],
Tim Rice7df8d392005-09-19 09:33:39 -0700634 [Define to whatever link() returns for "not supported"
635 if it doesn't return EOPNOTSUPP.])
Tim Rice648f8762011-01-26 12:38:57 -0800636 AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts])
637 AC_DEFINE([USE_BTMP])
638 AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100639 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000640 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000641 1.*|2.0.*)
Tim Rice648f8762011-01-26 12:38:57 -0800642 AC_DEFINE([BROKEN_CMSG_TYPE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700643 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000644 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000645 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100646 # tun(4) forwarding compat code
Tim Rice648f8762011-01-26 12:38:57 -0800647 AC_CHECK_HEADERS([linux/if_tun.h])
Damien Millerbd4e4102006-01-01 21:03:30 +1100648 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800649 AC_DEFINE([SSH_TUN_LINUX], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100650 [Open tunnel devices the Linux tun/tap way])
Tim Rice648f8762011-01-26 12:38:57 -0800651 AC_DEFINE([SSH_TUN_COMPAT_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100652 [Use tunnel device compatibility to OpenBSD])
Tim Rice648f8762011-01-26 12:38:57 -0800653 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller89e03ba2005-12-31 16:42:03 +1100654 [Prepend the address family to IP tunnel traffic])
655 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100656 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000657mips-sony-bsd|mips-sony-newsos4)
Tim Rice648f8762011-01-26 12:38:57 -0800658 AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000659 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000660 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100661*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000662 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800663 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800664 need_dash_r=1
665 fi
Tim Rice648f8762011-01-26 12:38:57 -0800666 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100667 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800668 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
669 AC_DEFINE([SSH_TUN_PREPEND_AF], [1],
Damien Miller2dcddbf2006-01-01 19:47:05 +1100670 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100671 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100672*-*-freebsd*)
673 check_for_libcrypt_later=1
Tim Rice648f8762011-01-26 12:38:57 -0800674 AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)])
675 AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100676 AC_CHECK_HEADER([net/if_tap.h], ,
Tim Rice648f8762011-01-26 12:38:57 -0800677 AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support]))
678 AC_DEFINE([BROKEN_GLOB], [1], [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100679 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000680*-*-bsdi*)
Tim Rice648f8762011-01-26 12:38:57 -0800681 AC_DEFINE([SETEUID_BREAKS_SETUID])
682 AC_DEFINE([BROKEN_SETREUID])
683 AC_DEFINE([BROKEN_SETREGID])
Darren Tuckered9eb022003-09-22 11:18:47 +1000684 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000685*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000686 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100687 conf_utmp_location=/etc/utmp
688 conf_wtmp_location=/usr/adm/wtmp
689 MAIL=/usr/spool/mail
Tim Rice648f8762011-01-26 12:38:57 -0800690 AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT])
691 AC_DEFINE([BROKEN_REALPATH])
692 AC_DEFINE([USE_PIPES])
693 AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000694 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000695*-*-openbsd*)
Tim Rice648f8762011-01-26 12:38:57 -0800696 AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel])
697 AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded])
698 AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way])
699 AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1],
Damien Millerbb598142006-08-19 08:38:23 +1000700 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000701 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100702*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800703 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800704 need_dash_r=1
705 fi
Tim Rice648f8762011-01-26 12:38:57 -0800706 AC_DEFINE([PAM_SUN_CODEBASE])
707 AC_DEFINE([LOGIN_NEEDS_UTMPX])
708 AC_DEFINE([LOGIN_NEEDS_TERM], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700709 [Some versions of /bin/login need the TERM supplied
710 on the commandline])
Tim Rice648f8762011-01-26 12:38:57 -0800711 AC_DEFINE([PAM_TTY_KLUDGE])
712 AC_DEFINE([SSHPAM_CHAUTHTOK_NEEDS_RUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700713 [Define if pam_chauthtok wants real uid set
714 to the unpriv'ed user])
Tim Rice648f8762011-01-26 12:38:57 -0800715 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Darren Tuckerc437cda2003-05-10 17:05:46 +1000716 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice648f8762011-01-26 12:38:57 -0800717 AC_DEFINE([SSHD_ACQUIRES_CTTY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700718 [Define if sshd somehow reacquires a controlling TTY
719 after setsid()])
Tim Rice648f8762011-01-26 12:38:57 -0800720 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd
Darren Tucker0249f932006-06-24 12:10:07 +1000721 in case the name is longer than 8 chars])
Tim Rice648f8762011-01-26 12:38:57 -0800722 AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000723 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000724 # hardwire lastlog location (can't detect it on some versions)
725 conf_lastlog_location="/var/adm/lastlog"
Tim Rice648f8762011-01-26 12:38:57 -0800726 AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x])
Damien Millera1cb6442000-06-09 11:58:35 +1000727 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
728 if test "$sol2ver" -ge 8; then
Tim Rice648f8762011-01-26 12:38:57 -0800729 AC_MSG_RESULT([yes])
730 AC_DEFINE([DISABLE_UTMP])
731 AC_DEFINE([DISABLE_WTMP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700732 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000733 else
Tim Rice648f8762011-01-26 12:38:57 -0800734 AC_MSG_RESULT([no])
Damien Millera1cb6442000-06-09 11:58:35 +1000735 fi
Tim Rice648f8762011-01-26 12:38:57 -0800736 AC_ARG_WITH([solaris-contracts],
Damien Miller1b06dc32006-08-31 03:24:41 +1000737 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
738 [
Tim Rice648f8762011-01-26 12:38:57 -0800739 AC_CHECK_LIB([contract], [ct_tmpl_activate],
740 [ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1],
Damien Miller1b06dc32006-08-31 03:24:41 +1000741 [Define if you have Solaris process contracts])
742 SSHDLIBS="$SSHDLIBS -lcontract"
Damien Miller1b06dc32006-08-31 03:24:41 +1000743 SPC_MSG="yes" ], )
744 ],
745 )
Tim Rice648f8762011-01-26 12:38:57 -0800746 AC_ARG_WITH([solaris-projects],
Darren Tucker97528352010-11-05 12:03:05 +1100747 [ --with-solaris-projects Enable Solaris projects (experimental)],
748 [
Tim Rice648f8762011-01-26 12:38:57 -0800749 AC_CHECK_LIB([project], [setproject],
750 [ AC_DEFINE([USE_SOLARIS_PROJECTS], [1],
Darren Tucker97528352010-11-05 12:03:05 +1100751 [Define if you have Solaris projects])
752 SSHDLIBS="$SSHDLIBS -lproject"
Darren Tucker97528352010-11-05 12:03:05 +1100753 SP_MSG="yes" ], )
754 ],
755 )
Damien Miller75b1d102000-01-07 14:01:41 +1100756 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000757*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000758 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Tim Rice648f8762011-01-26 12:38:57 -0800759 AC_CHECK_FUNCS([getpwanam])
760 AC_DEFINE([PAM_SUN_CODEBASE])
Damien Miller36ccb5c2000-08-09 16:34:27 +1000761 conf_utmp_location=/etc/utmp
762 conf_wtmp_location=/var/adm/wtmp
763 conf_lastlog_location=/var/adm/lastlog
Tim Rice648f8762011-01-26 12:38:57 -0800764 AC_DEFINE([USE_PIPES])
Damien Millerdfc83f42000-05-20 15:02:59 +1000765 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000766*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700767 LIBS="$LIBS -lc89"
Tim Rice648f8762011-01-26 12:38:57 -0800768 AC_DEFINE([USE_PIPES])
769 AC_DEFINE([SSHD_ACQUIRES_CTTY])
770 AC_DEFINE([SETEUID_BREAKS_SETUID])
771 AC_DEFINE([BROKEN_SETREUID])
772 AC_DEFINE([BROKEN_SETREGID])
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000773 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000774*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700775 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Tim Rice648f8762011-01-26 12:38:57 -0800776 AC_CHECK_LIB([dl], [dlsym], ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100777 # -lresolv needs to be at the end of LIBS or DNS lookups break
Tim Rice648f8762011-01-26 12:38:57 -0800778 AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100779 IPADDR_IN_DISPLAY=yes
Tim Rice648f8762011-01-26 12:38:57 -0800780 AC_DEFINE([USE_PIPES])
781 AC_DEFINE([IP_TOS_IS_BROKEN])
782 AC_DEFINE([SETEUID_BREAKS_SETUID])
783 AC_DEFINE([BROKEN_SETREUID])
784 AC_DEFINE([BROKEN_SETREGID])
785 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000786 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700787 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
788 # Attention: always take care to bind libsocket and libnsl before libc,
789 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000790 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800791# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100792*-*-sysv4.2*)
Tim Rice648f8762011-01-26 12:38:57 -0800793 AC_DEFINE([USE_PIPES])
794 AC_DEFINE([SETEUID_BREAKS_SETUID])
795 AC_DEFINE([BROKEN_SETREUID])
796 AC_DEFINE([BROKEN_SETREGID])
797 AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd])
798 AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Damien Miller78315eb2000-09-29 23:01:36 +1100799 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800800# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100801*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800802 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Rice648f8762011-01-26 12:38:57 -0800803 AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars])
804 AC_DEFINE([USE_PIPES])
805 AC_DEFINE([SETEUID_BREAKS_SETUID])
806 AC_DEFINE([BROKEN_GETADDRINFO])
807 AC_DEFINE([BROKEN_SETREUID])
808 AC_DEFINE([BROKEN_SETREGID])
809 AC_DEFINE([PASSWD_NEEDS_USERNAME])
Tim Rice4dbacff2005-06-01 20:09:28 -0700810 case "$host" in
811 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
812 TEST_SHELL=/u95/bin/sh
Tim Rice648f8762011-01-26 12:38:57 -0800813 AC_DEFINE([BROKEN_LIBIAF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700814 [ia_uinfo routines not supported by OS yet])
Tim Rice648f8762011-01-26 12:38:57 -0800815 AC_DEFINE([BROKEN_UPDWTMPX])
816 AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot"
817 AC_CHECK_FUNCS([getluid setluid], , , [-lprot])
818 AC_DEFINE([HAVE_SECUREWARE])
819 AC_DEFINE([DISABLE_SHADOW])
820 ], , )
Tim Rice4dbacff2005-06-01 20:09:28 -0700821 ;;
Tim Rice648f8762011-01-26 12:38:57 -0800822 *) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"])
Tim Rice26767912009-01-07 20:50:08 -0800823 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800824 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700825 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100826 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100827*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100828 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800829# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100830*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800831 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100832 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800833# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100834*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800835 if test -z "$GCC"; then
836 CFLAGS="$CFLAGS -belf"
837 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100838 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000839 no_dev_ptmx=1
Tim Rice648f8762011-01-26 12:38:57 -0800840 AC_DEFINE([USE_PIPES])
841 AC_DEFINE([HAVE_SECUREWARE])
842 AC_DEFINE([DISABLE_SHADOW])
843 AC_DEFINE([DISABLE_FD_PASSING])
844 AC_DEFINE([SETEUID_BREAKS_SETUID])
845 AC_DEFINE([BROKEN_GETADDRINFO])
846 AC_DEFINE([BROKEN_SETREUID])
847 AC_DEFINE([BROKEN_SETREGID])
848 AC_DEFINE([WITH_ABBREV_NO_TTY])
849 AC_DEFINE([BROKEN_UPDWTMPX])
850 AC_DEFINE([PASSWD_NEEDS_USERNAME])
851 AC_CHECK_FUNCS([getluid setluid])
Tim Rice07183b82001-04-25 21:40:28 -0700852 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700853 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000854 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000855*-*-unicosmk*)
Tim Rice648f8762011-01-26 12:38:57 -0800856 AC_DEFINE([NO_SSH_LASTLOG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700857 [Define if you don't want to use lastlog in session.c])
Tim Rice648f8762011-01-26 12:38:57 -0800858 AC_DEFINE([SETEUID_BREAKS_SETUID])
859 AC_DEFINE([BROKEN_SETREUID])
860 AC_DEFINE([BROKEN_SETREGID])
861 AC_DEFINE([USE_PIPES])
862 AC_DEFINE([DISABLE_FD_PASSING])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000863 LDFLAGS="$LDFLAGS"
864 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
865 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000866 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000867*-*-unicosmp*)
Tim Rice648f8762011-01-26 12:38:57 -0800868 AC_DEFINE([SETEUID_BREAKS_SETUID])
869 AC_DEFINE([BROKEN_SETREUID])
870 AC_DEFINE([BROKEN_SETREGID])
871 AC_DEFINE([WITH_ABBREV_NO_TTY])
872 AC_DEFINE([USE_PIPES])
873 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000874 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100875 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000876 MANTYPE=cat
877 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000878*-*-unicos*)
Tim Rice648f8762011-01-26 12:38:57 -0800879 AC_DEFINE([SETEUID_BREAKS_SETUID])
880 AC_DEFINE([BROKEN_SETREUID])
881 AC_DEFINE([BROKEN_SETREGID])
882 AC_DEFINE([USE_PIPES])
883 AC_DEFINE([DISABLE_FD_PASSING])
884 AC_DEFINE([NO_SSH_LASTLOG])
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000885 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
886 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
887 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700888 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000889*-dec-osf*)
Tim Rice648f8762011-01-26 12:38:57 -0800890 AC_MSG_CHECKING([for Digital Unix SIA])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000891 no_osfsia=""
Tim Rice648f8762011-01-26 12:38:57 -0800892 AC_ARG_WITH([osfsia],
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000893 [ --with-osfsia Enable Digital Unix SIA],
894 [
895 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -0800896 AC_MSG_RESULT([disabled])
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000897 no_osfsia=1
898 fi
899 ],
900 )
901 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000902 if test -f /etc/sia/matrix.conf; then
Tim Rice648f8762011-01-26 12:38:57 -0800903 AC_MSG_RESULT([yes])
904 AC_DEFINE([HAVE_OSF_SIA], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700905 [Define if you have Digital Unix Security
906 Integration Architecture])
Tim Rice648f8762011-01-26 12:38:57 -0800907 AC_DEFINE([DISABLE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -0700908 [Define if you don't want to use your
909 system's login() call])
Tim Rice648f8762011-01-26 12:38:57 -0800910 AC_DEFINE([DISABLE_FD_PASSING])
Damien Millerb8c656e2000-06-28 15:22:41 +1000911 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000912 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000913 else
Tim Rice648f8762011-01-26 12:38:57 -0800914 AC_MSG_RESULT([no])
915 AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"],
Tim Rice7df8d392005-09-19 09:33:39 -0700916 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000917 fi
918 fi
Tim Rice648f8762011-01-26 12:38:57 -0800919 AC_DEFINE([BROKEN_GETADDRINFO])
920 AC_DEFINE([SETEUID_BREAKS_SETUID])
921 AC_DEFINE([BROKEN_SETREUID])
922 AC_DEFINE([BROKEN_SETREGID])
923 AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000924 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000925
Tim Rice70335a62006-02-04 17:42:58 -0800926*-*-nto-qnx*)
Tim Rice648f8762011-01-26 12:38:57 -0800927 AC_DEFINE([USE_PIPES])
928 AC_DEFINE([NO_X11_UNIX_SOCKETS])
929 AC_DEFINE([MISSING_NFDBITS], [1], [Define on *nto-qnx systems])
930 AC_DEFINE([MISSING_HOWMANY], [1], [Define on *nto-qnx systems])
931 AC_DEFINE([MISSING_FD_MASK], [1], [Define on *nto-qnx systems])
932 AC_DEFINE([DISABLE_LASTLOG])
933 AC_DEFINE([SSHD_ACQUIRES_CTTY])
934 AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800935 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000936 case "$host" in
937 *-*-nto-qnx6*)
Tim Rice648f8762011-01-26 12:38:57 -0800938 AC_DEFINE([DISABLE_FD_PASSING])
Darren Tucker8acb3b62007-08-10 14:36:12 +1000939 ;;
940 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000941 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000942
943*-*-ultrix*)
Tim Rice648f8762011-01-26 12:38:57 -0800944 AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1])
945 AC_DEFINE([BROKEN_MMAP], [1], [Ultrix mmap can't map files])
946 AC_DEFINE([NEED_SETPGRP])
947 AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix])
Tim Ricefcc7ff12005-06-02 20:28:29 -0700948 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000949
950*-*-lynxos)
951 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice648f8762011-01-26 12:38:57 -0800952 AC_DEFINE([MISSING_HOWMANY])
953 AC_DEFINE([BROKEN_SETVBUF], [1], [LynxOS has broken setvbuf() implementation])
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000954 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100955esac
956
Tim Rice648f8762011-01-26 12:38:57 -0800957AC_MSG_CHECKING([compiler and flags for sanity])
958AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], [[ exit(0); ]])],
959 [ AC_MSG_RESULT([yes]) ],
Darren Tucker6eb93042003-06-29 21:30:41 +1000960 [
Tim Rice648f8762011-01-26 12:38:57 -0800961 AC_MSG_RESULT([no])
Darren Tucker6eb93042003-06-29 21:30:41 +1000962 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000963 ],
964 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000965)
966
Darren Tucker0c9653f2005-05-28 15:58:14 +1000967dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100968# Checks for libraries.
Tim Rice648f8762011-01-26 12:38:57 -0800969AC_CHECK_FUNC([yp_match], , [AC_CHECK_LIB([nsl], [yp_match])])
970AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])])
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000971
Tim Rice1e1ef642003-09-11 22:19:31 -0700972dnl IRIX and Solaris 2.5.1 have dirname() in libgen
Tim Rice648f8762011-01-26 12:38:57 -0800973AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [
974 AC_CHECK_LIB([gen], [dirname], [
Tim Rice1e1ef642003-09-11 22:19:31 -0700975 AC_CACHE_CHECK([for broken dirname],
976 ac_cv_have_broken_dirname, [
977 save_LIBS="$LIBS"
978 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000979 AC_RUN_IFELSE(
980 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700981#include <libgen.h>
982#include <string.h>
983
984int main(int argc, char **argv) {
985 char *s, buf[32];
986
987 strncpy(buf,"/etc", 32);
988 s = dirname(buf);
989 if (!s || strncmp(s, "/", 32) != 0) {
990 exit(1);
991 } else {
992 exit(0);
993 }
994}
Darren Tucker314d89e2005-10-17 23:29:23 +1000995 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700996 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000997 [ ac_cv_have_broken_dirname="yes" ],
998 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700999 )
1000 LIBS="$save_LIBS"
1001 ])
1002 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1003 LIBS="$LIBS -lgen"
Tim Rice648f8762011-01-26 12:38:57 -08001004 AC_DEFINE([HAVE_DIRNAME])
1005 AC_CHECK_HEADERS([libgen.h])
Tim Rice1e1ef642003-09-11 22:19:31 -07001006 fi
1007 ])
1008])
1009
Tim Rice648f8762011-01-26 12:38:57 -08001010AC_CHECK_FUNC([getspnam], ,
1011 [AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])])
1012AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
1013 [Define if you have the basename function.])])
Tim Rice1e1ef642003-09-11 22:19:31 -07001014
Tim Rice13aae5e2001-10-21 17:53:58 -07001015dnl zlib is required
Tim Rice648f8762011-01-26 12:38:57 -08001016AC_ARG_WITH([zlib],
Tim Rice13aae5e2001-10-21 17:53:58 -07001017 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001018 [ if test "x$withval" = "xno" ; then
1019 AC_MSG_ERROR([*** zlib is required ***])
1020 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001021 if test -d "$withval/lib"; then
1022 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001023 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001024 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001025 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001026 fi
1027 else
1028 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001029 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001030 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001031 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001032 fi
1033 fi
1034 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001035 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001036 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001037 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001038 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001039 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001040)
1041
Tim Rice648f8762011-01-26 12:38:57 -08001042AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
1043AC_CHECK_LIB([z], [deflate], ,
Tim Ricefcb62202004-01-23 18:35:16 -08001044 [
1045 saved_CPPFLAGS="$CPPFLAGS"
1046 saved_LDFLAGS="$LDFLAGS"
1047 save_LIBS="$LIBS"
1048 dnl Check default zlib install dir
1049 if test -n "${need_dash_r}"; then
1050 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1051 else
1052 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1053 fi
1054 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1055 LIBS="$LIBS -lz"
Tim Rice648f8762011-01-26 12:38:57 -08001056 AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])],
Tim Ricefcb62202004-01-23 18:35:16 -08001057 [
1058 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1059 ]
1060 )
1061 ]
1062)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001063
Tim Rice648f8762011-01-26 12:38:57 -08001064AC_ARG_WITH([zlib-version-check],
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001065 [ --without-zlib-version-check Disable zlib version check],
1066 [ if test "x$withval" = "xno" ; then
1067 zlib_check_nonfatal=1
1068 fi
1069 ]
1070)
1071
Tim Rice648f8762011-01-26 12:38:57 -08001072AC_MSG_CHECKING([for possibly buggy zlib])
1073AC_RUN_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001074#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001075#include <zlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001076 ]],
1077 [[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001078 int a=0, b=0, c=0, d=0, n, v;
1079 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1080 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001081 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001082 v = a*1000000 + b*10000 + c*100 + d;
1083 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1084
1085 /* 1.1.4 is OK */
1086 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001087 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001088
Darren Tucker41097ed2005-07-25 15:24:21 +10001089 /* 1.2.3 and up are OK */
1090 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001091 exit(0);
1092
Darren Tucker2dcd2392004-01-23 17:13:33 +11001093 exit(2);
Darren Tucker623d92f2004-09-12 22:36:15 +10001094 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001095 AC_MSG_RESULT([no]),
1096 [ AC_MSG_RESULT([yes])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001097 if test -z "$zlib_check_nonfatal" ; then
1098 AC_MSG_ERROR([*** zlib too old - check config.log ***
1099Your reported zlib version has known security problems. It's possible your
1100vendor has fixed these problems without changing the version number. If you
1101are sure this is the case, you can disable the check by running
1102"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001103If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001104See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001105 else
1106 AC_MSG_WARN([zlib version may have security problems])
1107 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001108 ],
1109 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001110)
Damien Miller6f9c3372000-10-25 10:06:04 +11001111
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001112dnl UnixWare 2.x
Tim Rice648f8762011-01-26 12:38:57 -08001113AC_CHECK_FUNC([strcasecmp],
1114 [], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001115)
Tim Rice648f8762011-01-26 12:38:57 -08001116AC_CHECK_FUNCS([utimes],
1117 [], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES])
Tim Ricecbb90662002-07-08 19:17:10 -07001118 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001119)
Damien Millerab18c411999-11-11 10:40:23 +11001120
Tim Ricee589a292001-11-03 11:09:32 -08001121dnl Checks for libutil functions
Tim Rice648f8762011-01-26 12:38:57 -08001122AC_CHECK_HEADERS([libutil.h])
1123AC_SEARCH_LIBS([login], [util bsd], [AC_DEFINE([HAVE_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001124 [Define if your libraries define login()])])
Tim Rice648f8762011-01-26 12:38:57 -08001125AC_CHECK_FUNCS([fmt_scaled logout updwtmp logwtmp])
Tim Ricee589a292001-11-03 11:09:32 -08001126
Ben Lindstrom8697e082001-02-24 21:41:10 +00001127AC_FUNC_STRFTIME
1128
Damien Miller3c027682001-03-14 11:39:45 +11001129# Check for ALTDIRFUNC glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001130AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support])
1131AC_EGREP_CPP([FOUNDIT],
Damien Miller3c027682001-03-14 11:39:45 +11001132 [
1133 #include <glob.h>
1134 #ifdef GLOB_ALTDIRFUNC
1135 FOUNDIT
1136 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001137 ],
Damien Miller3c027682001-03-14 11:39:45 +11001138 [
Tim Rice648f8762011-01-26 12:38:57 -08001139 AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001140 [Define if your system glob() function has
1141 the GLOB_ALTDIRFUNC extension])
Tim Rice648f8762011-01-26 12:38:57 -08001142 AC_MSG_RESULT([yes])
Damien Miller3c027682001-03-14 11:39:45 +11001143 ],
1144 [
Tim Rice648f8762011-01-26 12:38:57 -08001145 AC_MSG_RESULT([no])
Damien Miller3c027682001-03-14 11:39:45 +11001146 ]
1147)
Damien Millerab18c411999-11-11 10:40:23 +11001148
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001149# Check for g.gl_matchc glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001150AC_MSG_CHECKING([for gl_matchc field in glob_t])
1151AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]],
1152 [[ glob_t g; g.gl_matchc = 1; ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001153 [
Tim Rice648f8762011-01-26 12:38:57 -08001154 AC_DEFINE([GLOB_HAS_GL_MATCHC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001155 [Define if your system glob() function has
1156 gl_matchc options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001157 AC_MSG_RESULT([yes])
1158 ], [
1159 AC_MSG_RESULT([no])
1160])
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001161
Damien Millera6e121a2010-10-07 21:39:17 +11001162# Check for g.gl_statv glob() extension
Tim Rice648f8762011-01-26 12:38:57 -08001163AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob])
1164AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[
Damien Millera6e121a2010-10-07 21:39:17 +11001165#ifndef GLOB_KEEPSTAT
1166#error "glob does not support GLOB_KEEPSTAT extension"
1167#endif
1168glob_t g;
1169g.gl_statv = NULL;
Tim Rice648f8762011-01-26 12:38:57 -08001170]])],
Damien Millera6e121a2010-10-07 21:39:17 +11001171 [
Tim Rice648f8762011-01-26 12:38:57 -08001172 AC_DEFINE([GLOB_HAS_GL_STATV], [1],
Damien Millera6e121a2010-10-07 21:39:17 +11001173 [Define if your system glob() function has
1174 gl_statv options in glob_t])
Tim Rice648f8762011-01-26 12:38:57 -08001175 AC_MSG_RESULT([yes])
1176 ], [
1177 AC_MSG_RESULT([no])
1178
1179])
Damien Millera6e121a2010-10-07 21:39:17 +11001180
Tim Rice648f8762011-01-26 12:38:57 -08001181AC_CHECK_DECLS([GLOB_NOMATCH], , , [#include <glob.h>])
Darren Tucker096faec2006-09-01 20:29:10 +10001182
Damien Miller18bb4732001-03-28 14:35:30 +10001183AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001184AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001185 [AC_LANG_PROGRAM([[
Damien Miller18bb4732001-03-28 14:35:30 +10001186#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08001187#include <dirent.h>]],
1188 [[
1189 struct dirent d;
1190 exit(sizeof(d.d_name)<=sizeof(char));
Darren Tucker623d92f2004-09-12 22:36:15 +10001191 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001192 [AC_MSG_RESULT([yes])],
Damien Miller18bb4732001-03-28 14:35:30 +10001193 [
Tim Rice648f8762011-01-26 12:38:57 -08001194 AC_MSG_RESULT([no])
1195 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1],
Darren Tucker79d09fa2005-11-24 22:34:54 +11001196 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001197 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001198 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001199 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001200 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
Tim Rice648f8762011-01-26 12:38:57 -08001201 AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME])
Damien Miller18bb4732001-03-28 14:35:30 +10001202 ]
1203)
1204
Damien Miller36f49652004-08-15 18:40:59 +10001205AC_MSG_CHECKING([for /proc/pid/fd directory])
1206if test -d "/proc/$$/fd" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001207 AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd])
1208 AC_MSG_RESULT([yes])
Damien Miller36f49652004-08-15 18:40:59 +10001209else
Tim Rice648f8762011-01-26 12:38:57 -08001210 AC_MSG_RESULT([no])
Damien Miller36f49652004-08-15 18:40:59 +10001211fi
1212
Damien Millerc547bf12001-02-16 10:18:12 +11001213# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001214SKEY_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001215AC_ARG_WITH([skey],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001216 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001217 [
1218 if test "x$withval" != "xno" ; then
1219
1220 if test "x$withval" != "xyes" ; then
1221 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1222 LDFLAGS="$LDFLAGS -L${withval}/lib"
1223 fi
1224
Tim Rice648f8762011-01-26 12:38:57 -08001225 AC_DEFINE([SKEY], [1], [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001226 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001227 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001228
Tim Rice4cec93f2002-02-26 08:40:48 -08001229 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001230 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001231 [AC_LANG_PROGRAM([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001232#include <stdio.h>
1233#include <skey.h>
Tim Rice648f8762011-01-26 12:38:57 -08001234 ]], [[
1235 char *ff = skey_keyinfo(""); ff="";
1236 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001237 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001238 [AC_MSG_RESULT([yes])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001239 [
Tim Rice648f8762011-01-26 12:38:57 -08001240 AC_MSG_RESULT([no])
Damien Millerc547bf12001-02-16 10:18:12 +11001241 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1242 ])
Tim Rice648f8762011-01-26 12:38:57 -08001243 AC_MSG_CHECKING([if skeychallenge takes 4 arguments])
1244 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1245#include <stdio.h>
1246#include <skey.h>
1247 ]], [[
1248 (void)skeychallenge(NULL,"name","",0);
1249 ]])],
1250 [
1251 AC_MSG_RESULT([yes])
1252 AC_DEFINE([SKEYCHALLENGE_4ARG], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001253 [Define if your skeychallenge()
1254 function takes 4 arguments (NetBSD)])],
Tim Rice648f8762011-01-26 12:38:57 -08001255 [
1256 AC_MSG_RESULT([no])
1257 ])
Damien Millerc547bf12001-02-16 10:18:12 +11001258 fi
1259 ]
1260)
1261
1262# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001263TCPW_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001264AC_ARG_WITH([tcp-wrappers],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001265 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001266 [
1267 if test "x$withval" != "xno" ; then
1268 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001269 saved_LDFLAGS="$LDFLAGS"
1270 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001271 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001272 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001273 if test -d "${withval}/lib"; then
1274 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001275 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001276 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001277 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001278 fi
1279 else
1280 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001281 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001282 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001283 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001284 fi
1285 fi
1286 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001287 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001288 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001289 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001290 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001291 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001292 LIBS="-lwrap $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08001293 AC_MSG_CHECKING([for libwrap])
1294 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Damien Miller0ac45002004-04-14 20:14:26 +10001295#include <sys/types.h>
1296#include <sys/socket.h>
1297#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001298#include <tcpd.h>
Tim Rice648f8762011-01-26 12:38:57 -08001299int deny_severity = 0, allow_severity = 0;
1300 ]], [[
1301 hosts_access(0);
1302 ]])], [
1303 AC_MSG_RESULT([yes])
1304 AC_DEFINE([LIBWRAP], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001305 [Define if you want
1306 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001307 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001308 TCPW_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001309 ], [
Damien Millerc547bf12001-02-16 10:18:12 +11001310 AC_MSG_ERROR([*** libwrap missing])
Tim Rice648f8762011-01-26 12:38:57 -08001311
1312 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08001313 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001314 fi
1315 ]
1316)
1317
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001318# Check whether user wants libedit support
1319LIBEDIT_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08001320AC_ARG_WITH([libedit],
Darren Tucker1b6f2292005-02-11 16:11:49 +11001321 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001322 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001323 if test "x$withval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08001324 AC_PATH_PROG([PKGCONFIG], [pkg-config], [no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001325 if test "x$PKGCONFIG" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08001326 AC_MSG_CHECKING([if $PKGCONFIG knows about libedit])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001327 if "$PKGCONFIG" libedit; then
Tim Rice648f8762011-01-26 12:38:57 -08001328 AC_MSG_RESULT([yes])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001329 use_pkgconfig_for_libedit=yes
1330 else
Tim Rice648f8762011-01-26 12:38:57 -08001331 AC_MSG_RESULT([no])
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001332 fi
1333 fi
1334 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001335 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1336 if test -n "${need_dash_r}"; then
1337 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1338 else
1339 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1340 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001341 fi
Damien Miller1f789802010-10-11 22:35:22 +11001342 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001343 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1344 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1345 else
1346 LIBEDIT="-ledit -lcurses"
1347 fi
1348 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Tim Rice648f8762011-01-26 12:38:57 -08001349 AC_CHECK_LIB([edit], [el_init],
1350 [ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001351 LIBEDIT_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08001352 AC_SUBST([LIBEDIT])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001353 ],
Tim Rice648f8762011-01-26 12:38:57 -08001354 [ AC_MSG_ERROR([libedit not found]) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001355 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001356 )
Tim Rice648f8762011-01-26 12:38:57 -08001357 AC_MSG_CHECKING([if libedit version is compatible])
Tim Ricec1819c82005-08-15 17:48:40 -07001358 AC_COMPILE_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001359 [AC_LANG_PROGRAM([[ #include <histedit.h> ]],
1360 [[
Darren Tuckerc7572b22005-08-10 20:34:15 +10001361 int i = H_SETSIZE;
1362 el_init("", NULL, NULL, NULL);
1363 exit(0);
Tim Ricec1819c82005-08-15 17:48:40 -07001364 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001365 [ AC_MSG_RESULT([yes]) ],
1366 [ AC_MSG_RESULT([no])
1367 AC_MSG_ERROR([libedit version is not compatible]) ]
Darren Tuckerc7572b22005-08-10 20:34:15 +10001368 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001369 fi ]
1370)
1371
Darren Tuckerd9f88912005-02-20 21:01:48 +11001372AUDIT_MODULE=none
Tim Rice648f8762011-01-26 12:38:57 -08001373AC_ARG_WITH([audit],
Darren Tuckerea52a822011-01-17 21:15:27 +11001374 [ --with-audit=module Enable audit support (modules=debug,bsm,linux)],
Darren Tuckerd9f88912005-02-20 21:01:48 +11001375 [
Tim Rice648f8762011-01-26 12:38:57 -08001376 AC_MSG_CHECKING([for supported audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001377 case "$withval" in
1378 bsm)
Tim Rice648f8762011-01-26 12:38:57 -08001379 AC_MSG_RESULT([bsm])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001380 AUDIT_MODULE=bsm
1381 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001382 AC_CHECK_HEADERS([bsm/audit.h], [],
1383 [AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001384 [
1385#ifdef HAVE_TIME_H
1386# include <time.h>
1387#endif
1388 ]
1389)
Tim Rice648f8762011-01-26 12:38:57 -08001390 AC_CHECK_LIB([bsm], [getaudit], [],
1391 [AC_MSG_ERROR([BSM enabled and required library not found])])
1392 AC_CHECK_FUNCS([getaudit], [],
1393 [AC_MSG_ERROR([BSM enabled and required function not found])])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001394 # These are optional
Tim Rice648f8762011-01-26 12:38:57 -08001395 AC_CHECK_FUNCS([getaudit_addr aug_get_machine])
1396 AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001397 ;;
Darren Tuckerea52a822011-01-17 21:15:27 +11001398 linux)
Tim Rice648f8762011-01-26 12:38:57 -08001399 AC_MSG_RESULT([linux])
Darren Tuckerea52a822011-01-17 21:15:27 +11001400 AUDIT_MODULE=linux
1401 dnl Checks for headers, libs and functions
Tim Rice648f8762011-01-26 12:38:57 -08001402 AC_CHECK_HEADERS([libaudit.h])
Darren Tuckerea52a822011-01-17 21:15:27 +11001403 SSHDLIBS="$SSHDLIBS -laudit"
Tim Rice648f8762011-01-26 12:38:57 -08001404 AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module])
Darren Tuckerea52a822011-01-17 21:15:27 +11001405 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001406 debug)
1407 AUDIT_MODULE=debug
Tim Rice648f8762011-01-26 12:38:57 -08001408 AC_MSG_RESULT([debug])
1409 AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001410 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001411 no)
Tim Rice648f8762011-01-26 12:38:57 -08001412 AC_MSG_RESULT([no])
Tim Rice8bc6b902005-08-09 10:09:53 -07001413 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001414 *)
1415 AC_MSG_ERROR([Unknown audit module $withval])
1416 ;;
1417 esac ]
1418)
1419
Damien Millerfe1f1432003-02-24 15:45:42 +11001420dnl Checks for library functions. Please keep in alphabetical order
Tim Rice648f8762011-01-26 12:38:57 -08001421AC_CHECK_FUNCS([ \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001422 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001423 arc4random_buf \
1424 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001425 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001426 b64_ntop \
1427 __b64_ntop \
1428 b64_pton \
1429 __b64_pton \
1430 bcopy \
1431 bindresvport_sa \
1432 clock \
1433 closefrom \
1434 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001435 fchmod \
1436 fchown \
1437 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001438 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001439 futimes \
1440 getaddrinfo \
1441 getcwd \
1442 getgrouplist \
1443 getnameinfo \
1444 getopt \
1445 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001446 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001447 _getpty \
1448 getrlimit \
1449 getttyent \
1450 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001451 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001452 inet_aton \
1453 inet_ntoa \
1454 inet_ntop \
1455 innetgr \
1456 login_getcapbool \
1457 md5_crypt \
1458 memmove \
1459 mkdtemp \
1460 mmap \
1461 ngetaddrinfo \
1462 nsleep \
1463 ogetaddrinfo \
1464 openlog_r \
1465 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001466 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001467 prctl \
1468 pstat \
1469 readpassphrase \
1470 realpath \
1471 recvmsg \
1472 rresvport_af \
1473 sendmsg \
1474 setdtablesize \
1475 setegid \
1476 setenv \
1477 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001478 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001479 setgroups \
1480 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001481 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001482 setpcred \
1483 setproctitle \
1484 setregid \
1485 setreuid \
1486 setrlimit \
1487 setsid \
1488 setvbuf \
1489 sigaction \
1490 sigvec \
1491 snprintf \
1492 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001493 statfs \
1494 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001495 strdup \
1496 strerror \
1497 strlcat \
1498 strlcpy \
1499 strmode \
1500 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001501 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001502 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001503 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001504 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001505 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001506 sysconf \
1507 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001508 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001509 truncate \
1510 unsetenv \
1511 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001512 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001513 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001514 vhangup \
1515 vsnprintf \
1516 waitpid \
Tim Rice648f8762011-01-26 12:38:57 -08001517])
Tim Rice13aae5e2001-10-21 17:53:58 -07001518
Tim Ricec7a8af02010-11-08 14:26:23 -08001519AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001520 [AC_LANG_PROGRAM(
1521 [[ #include <ctype.h> ]],
1522 [[ return (isblank('a')); ]])],
1523 [AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).])
Tim Ricec7a8af02010-11-08 14:26:23 -08001524])
1525
Damien Millerb3c9f782010-02-12 10:11:34 +11001526# PKCS#11 support requires dlopen() and co
Tim Rice648f8762011-01-26 12:38:57 -08001527AC_SEARCH_LIBS([dlopen], [dl],
1528 [AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])]
Damien Millerb3c9f782010-02-12 10:11:34 +11001529)
1530
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001531# IRIX has a const char return value for gai_strerror()
Tim Rice648f8762011-01-26 12:38:57 -08001532AC_CHECK_FUNCS([gai_strerror], [
1533 AC_DEFINE([HAVE_GAI_STRERROR])
1534 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001535#include <sys/types.h>
1536#include <sys/socket.h>
1537#include <netdb.h>
1538
Tim Rice648f8762011-01-26 12:38:57 -08001539const char *gai_strerror(int);
1540 ]], [[
1541 char *str;
1542 str = gai_strerror(0);
1543 ]])], [
1544 AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1],
1545 [Define if gai_strerror() returns const char *])], [])])
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001546
Tim Rice648f8762011-01-26 12:38:57 -08001547AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1],
1548 [Some systems put nanosleep outside of libc])])
Damien Millercd6853c2003-01-28 11:33:42 +11001549
Darren Tuckerf1159b52003-07-07 19:44:01 +10001550dnl Make sure prototypes are defined for these before using them.
Tim Rice648f8762011-01-26 12:38:57 -08001551AC_CHECK_DECL([getrusage], [AC_CHECK_FUNCS([getrusage])])
1552AC_CHECK_DECL([strsep],
1553 [AC_CHECK_FUNCS([strsep])],
Darren Tucker390b6d52005-05-28 16:54:36 +10001554 [],
1555 [
1556#ifdef HAVE_STRING_H
1557# include <string.h>
1558#endif
1559 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001560
Darren Tuckerb2427c82003-09-10 15:22:44 +10001561dnl tcsendbreak might be a macro
Tim Rice648f8762011-01-26 12:38:57 -08001562AC_CHECK_DECL([tcsendbreak],
1563 [AC_DEFINE([HAVE_TCSENDBREAK])],
1564 [AC_CHECK_FUNCS([tcsendbreak])],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001565 [#include <termios.h>]
1566)
1567
Tim Rice648f8762011-01-26 12:38:57 -08001568AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>])
Darren Tucker5bb14002004-04-23 18:53:10 +10001569
Tim Rice648f8762011-01-26 12:38:57 -08001570AC_CHECK_DECLS([SHUT_RD], , ,
Darren Tucker128a0892006-07-12 19:02:56 +10001571 [
1572#include <sys/types.h>
1573#include <sys/socket.h>
1574 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001575
Tim Rice648f8762011-01-26 12:38:57 -08001576AC_CHECK_DECLS([O_NONBLOCK], , ,
Darren Tucker248469b2006-07-12 14:14:31 +10001577 [
1578#include <sys/types.h>
1579#ifdef HAVE_SYS_STAT_H
1580# include <sys/stat.h>
1581#endif
1582#ifdef HAVE_FCNTL_H
1583# include <fcntl.h>
1584#endif
1585 ])
1586
Tim Rice648f8762011-01-26 12:38:57 -08001587AC_CHECK_DECLS([writev], , , [
Darren Tuckered0b5922006-09-03 22:44:49 +10001588#include <sys/types.h>
1589#include <sys/uio.h>
1590#include <unistd.h>
1591 ])
1592
Tim Rice648f8762011-01-26 12:38:57 -08001593AC_CHECK_DECLS([MAXSYMLINKS], , , [
Darren Tucker6d862a52007-04-29 14:39:02 +10001594#include <sys/param.h>
1595 ])
1596
Tim Rice648f8762011-01-26 12:38:57 -08001597AC_CHECK_DECLS([offsetof], , , [
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001598#include <stddef.h>
1599 ])
1600
Tim Rice648f8762011-01-26 12:38:57 -08001601AC_CHECK_FUNCS([setresuid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001602 dnl Some platorms have setresuid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001603 AC_MSG_CHECKING([if setresuid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001604 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001605 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001606#include <stdlib.h>
1607#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001608 ]], [[
1609 errno=0;
1610 setresuid(0,0,0);
1611 if (errno==ENOSYS)
1612 exit(1);
1613 else
1614 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001615 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001616 [AC_MSG_RESULT([yes])],
1617 [AC_DEFINE([BROKEN_SETRESUID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001618 [Define if your setresuid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001619 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001620 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001621 )
1622])
Darren Tuckere937be32003-12-17 18:53:26 +11001623
Tim Rice648f8762011-01-26 12:38:57 -08001624AC_CHECK_FUNCS([setresgid], [
Darren Tucker2a6b0292003-12-31 14:59:17 +11001625 dnl Some platorms have setresgid that isn't implemented, test for this
Tim Rice648f8762011-01-26 12:38:57 -08001626 AC_MSG_CHECKING([if setresgid seems to work])
Darren Tucker623d92f2004-09-12 22:36:15 +10001627 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001628 [AC_LANG_PROGRAM([[
Darren Tuckere937be32003-12-17 18:53:26 +11001629#include <stdlib.h>
1630#include <errno.h>
Tim Rice648f8762011-01-26 12:38:57 -08001631 ]], [[
1632 errno=0;
1633 setresgid(0,0,0);
1634 if (errno==ENOSYS)
1635 exit(1);
1636 else
1637 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10001638 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001639 [AC_MSG_RESULT([yes])],
1640 [AC_DEFINE([BROKEN_SETRESGID], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001641 [Define if your setresgid() is broken])
Tim Rice648f8762011-01-26 12:38:57 -08001642 AC_MSG_RESULT([not implemented])],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001643 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001644 )
1645])
Darren Tuckere937be32003-12-17 18:53:26 +11001646
Damien Millerad833b32000-08-23 10:46:23 +10001647dnl Checks for time functions
Tim Rice648f8762011-01-26 12:38:57 -08001648AC_CHECK_FUNCS([gettimeofday time])
Damien Millerad833b32000-08-23 10:46:23 +10001649dnl Checks for utmp functions
Tim Rice648f8762011-01-26 12:38:57 -08001650AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent])
1651AC_CHECK_FUNCS([utmpname])
Damien Millerad833b32000-08-23 10:46:23 +10001652dnl Checks for utmpx functions
Tim Rice648f8762011-01-26 12:38:57 -08001653AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline])
1654AC_CHECK_FUNCS([setutxdb setutxent utmpxname])
Damien Miller20e231f2009-02-12 13:12:21 +11001655dnl Checks for lastlog functions
Tim Rice648f8762011-01-26 12:38:57 -08001656AC_CHECK_FUNCS([getlastlogxbyname])
Damien Millercedfecc1999-11-15 14:36:53 +11001657
Tim Rice648f8762011-01-26 12:38:57 -08001658AC_CHECK_FUNC([daemon],
1659 [AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])],
1660 [AC_CHECK_LIB([bsd], [daemon],
1661 [LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])]
Damien Miller04f80141999-11-19 15:32:34 +11001662)
1663
Tim Rice648f8762011-01-26 12:38:57 -08001664AC_CHECK_FUNC([getpagesize],
1665 [AC_DEFINE([HAVE_GETPAGESIZE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001666 [Define if your libraries define getpagesize()])],
Tim Rice648f8762011-01-26 12:38:57 -08001667 [AC_CHECK_LIB([ucb], [getpagesize],
1668 [LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001669)
1670
Damien Millercb170cb2000-07-01 16:52:55 +10001671# Check for broken snprintf
1672if test "x$ac_cv_func_snprintf" = "xyes" ; then
1673 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001674 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001675 [AC_LANG_PROGRAM([[ #include <stdio.h> ]],
1676 [[
1677 char b[5];
1678 snprintf(b,5,"123456789");
1679 exit(b[4]!='\0');
Darren Tucker623d92f2004-09-12 22:36:15 +10001680 ]])],
Tim Rice648f8762011-01-26 12:38:57 -08001681 [AC_MSG_RESULT([yes])],
Damien Millercb170cb2000-07-01 16:52:55 +10001682 [
Tim Rice648f8762011-01-26 12:38:57 -08001683 AC_MSG_RESULT([no])
1684 AC_DEFINE([BROKEN_SNPRINTF], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001685 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001686 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001687 ],
1688 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001689 )
1690fi
1691
Damien Miller57f39152005-11-24 19:58:19 +11001692# If we don't have a working asprintf, then we strongly depend on vsnprintf
1693# returning the right thing on overflow: the number of characters it tried to
1694# create (as per SUSv3)
1695if test "x$ac_cv_func_asprintf" != "xyes" && \
1696 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1697 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1698 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001699 [AC_LANG_PROGRAM([[
Damien Miller57f39152005-11-24 19:58:19 +11001700#include <sys/types.h>
1701#include <stdio.h>
1702#include <stdarg.h>
1703
1704int x_snprintf(char *str,size_t count,const char *fmt,...)
1705{
1706 size_t ret; va_list ap;
1707 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1708 return ret;
1709}
Tim Rice648f8762011-01-26 12:38:57 -08001710 ]], [[
Damien Miller57f39152005-11-24 19:58:19 +11001711 char x[1];
1712 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
Tim Rice648f8762011-01-26 12:38:57 -08001713 ]])],
1714 [AC_MSG_RESULT([yes])],
Damien Miller57f39152005-11-24 19:58:19 +11001715 [
Tim Rice648f8762011-01-26 12:38:57 -08001716 AC_MSG_RESULT([no])
1717 AC_DEFINE([BROKEN_SNPRINTF], [1],
Damien Miller57f39152005-11-24 19:58:19 +11001718 [Define if your snprintf is busted])
1719 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1720 ],
1721 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1722 )
1723fi
1724
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001725# On systems where [v]snprintf is broken, but is declared in stdio,
1726# check that the fmt argument is const char * or just char *.
1727# This is only useful for when BROKEN_SNPRINTF
1728AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
Tim Rice648f8762011-01-26 12:38:57 -08001729AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1730#include <stdio.h>
1731int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1732 ]], [[
1733 snprintf(0, 0, 0);
1734 ]])],
1735 [AC_MSG_RESULT([yes])
1736 AC_DEFINE([SNPRINTF_CONST], [const],
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001737 [Define as const if snprintf() can declare const char *fmt])],
Tim Rice648f8762011-01-26 12:38:57 -08001738 [AC_MSG_RESULT([no])
1739 AC_DEFINE([SNPRINTF_CONST], [/* not const */])])
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001740
Damien Millerb4097182004-05-23 14:09:40 +10001741# Check for missing getpeereid (or equiv) support
1742NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001743if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001744 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
Tim Rice648f8762011-01-26 12:38:57 -08001745 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1746#include <sys/types.h>
1747#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])],
1748 [ AC_MSG_RESULT([yes])
1749 AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option])
1750 ], [AC_MSG_RESULT([no])
1751 NO_PEERCHECK=1
1752 ])
Damien Millerb4097182004-05-23 14:09:40 +10001753fi
1754
Damien Millere8328192003-01-07 15:18:32 +11001755dnl see whether mkstemp() requires XXXXXX
1756if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1757AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001758AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001759 [AC_LANG_PROGRAM([[
Damien Millere8328192003-01-07 15:18:32 +11001760#include <stdlib.h>
Tim Rice648f8762011-01-26 12:38:57 -08001761 ]], [[
1762 char template[]="conftest.mkstemp-test";
1763 if (mkstemp(template) == -1)
1764 exit(1);
1765 unlink(template);
1766 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001767 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001768 [
Tim Rice648f8762011-01-26 12:38:57 -08001769 AC_MSG_RESULT([no])
Damien Millere8328192003-01-07 15:18:32 +11001770 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001771 [
Tim Rice648f8762011-01-26 12:38:57 -08001772 AC_MSG_RESULT([yes])
1773 AC_DEFINE([HAVE_STRICT_MKSTEMP], [1], [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001774 ],
1775 [
Tim Rice648f8762011-01-26 12:38:57 -08001776 AC_MSG_RESULT([yes])
1777 AC_DEFINE([HAVE_STRICT_MKSTEMP])
Damien Millera8e06ce2003-11-21 23:48:55 +11001778 ]
Damien Millere8328192003-01-07 15:18:32 +11001779)
1780fi
1781
Darren Tucker70a3d552003-08-21 17:58:29 +10001782dnl make sure that openpty does not reacquire controlling terminal
1783if test ! -z "$check_for_openpty_ctty_bug"; then
Tim Rice648f8762011-01-26 12:38:57 -08001784 AC_MSG_CHECKING([if openpty correctly handles controlling tty])
Darren Tucker314d89e2005-10-17 23:29:23 +10001785 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001786 [AC_LANG_PROGRAM([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001787#include <stdio.h>
1788#include <sys/fcntl.h>
1789#include <sys/types.h>
1790#include <sys/wait.h>
Tim Rice648f8762011-01-26 12:38:57 -08001791 ]], [[
Darren Tucker70a3d552003-08-21 17:58:29 +10001792 pid_t pid;
1793 int fd, ptyfd, ttyfd, status;
1794
1795 pid = fork();
1796 if (pid < 0) { /* failed */
1797 exit(1);
1798 } else if (pid > 0) { /* parent */
1799 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001800 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001801 exit(WEXITSTATUS(status));
1802 else
1803 exit(2);
1804 } else { /* child */
1805 close(0); close(1); close(2);
1806 setsid();
1807 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1808 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1809 if (fd >= 0)
1810 exit(3); /* Acquired ctty: broken */
1811 else
1812 exit(0); /* Did not acquire ctty: OK */
1813 }
Darren Tucker314d89e2005-10-17 23:29:23 +10001814 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001815 [
Tim Rice648f8762011-01-26 12:38:57 -08001816 AC_MSG_RESULT([yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001817 ],
1818 [
Tim Rice648f8762011-01-26 12:38:57 -08001819 AC_MSG_RESULT([no])
1820 AC_DEFINE([SSHD_ACQUIRES_CTTY])
Darren Tucker314d89e2005-10-17 23:29:23 +10001821 ],
1822 [
Tim Rice648f8762011-01-26 12:38:57 -08001823 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker70a3d552003-08-21 17:58:29 +10001824 ]
1825 )
1826fi
1827
Tim Rice8bb561b2005-03-17 16:23:19 -08001828if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1829 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001830 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001831 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001832 [AC_LANG_PROGRAM([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001833#include <stdio.h>
1834#include <sys/socket.h>
1835#include <netdb.h>
1836#include <errno.h>
1837#include <netinet/in.h>
1838
1839#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001840 ]], [[
Darren Tucker4398cf52004-04-06 21:39:02 +10001841 int err, sock;
1842 struct addrinfo *gai_ai, *ai, hints;
1843 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1844
1845 memset(&hints, 0, sizeof(hints));
1846 hints.ai_family = PF_UNSPEC;
1847 hints.ai_socktype = SOCK_STREAM;
1848 hints.ai_flags = AI_PASSIVE;
1849
1850 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1851 if (err != 0) {
1852 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1853 exit(1);
1854 }
1855
1856 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1857 if (ai->ai_family != AF_INET6)
1858 continue;
1859
1860 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1861 sizeof(ntop), strport, sizeof(strport),
1862 NI_NUMERICHOST|NI_NUMERICSERV);
1863
1864 if (err != 0) {
1865 if (err == EAI_SYSTEM)
1866 perror("getnameinfo EAI_SYSTEM");
1867 else
1868 fprintf(stderr, "getnameinfo failed: %s\n",
1869 gai_strerror(err));
1870 exit(2);
1871 }
1872
1873 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1874 if (sock < 0)
1875 perror("socket");
1876 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1877 if (errno == EBADF)
1878 exit(3);
1879 }
1880 }
1881 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001882 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001883 [
Tim Rice648f8762011-01-26 12:38:57 -08001884 AC_MSG_RESULT([yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001885 ],
1886 [
Tim Rice648f8762011-01-26 12:38:57 -08001887 AC_MSG_RESULT([no])
1888 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001889 ],
1890 [
Tim Rice648f8762011-01-26 12:38:57 -08001891 AC_MSG_RESULT([cross-compiling, assuming yes])
Darren Tucker4398cf52004-04-06 21:39:02 +10001892 ]
1893 )
1894fi
1895
Tim Rice8bb561b2005-03-17 16:23:19 -08001896if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1897 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001898 AC_MSG_CHECKING([if getaddrinfo seems to work])
Darren Tucker314d89e2005-10-17 23:29:23 +10001899 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08001900 [AC_LANG_PROGRAM([[
Darren Tucker691d5232005-02-15 21:45:57 +11001901#include <stdio.h>
1902#include <sys/socket.h>
1903#include <netdb.h>
1904#include <errno.h>
1905#include <netinet/in.h>
1906
1907#define TEST_PORT "2222"
Tim Rice648f8762011-01-26 12:38:57 -08001908 ]], [[
Darren Tucker691d5232005-02-15 21:45:57 +11001909 int err, sock;
1910 struct addrinfo *gai_ai, *ai, hints;
1911 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1912
1913 memset(&hints, 0, sizeof(hints));
1914 hints.ai_family = PF_UNSPEC;
1915 hints.ai_socktype = SOCK_STREAM;
1916 hints.ai_flags = AI_PASSIVE;
1917
1918 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1919 if (err != 0) {
1920 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1921 exit(1);
1922 }
1923
1924 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1925 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1926 continue;
1927
1928 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1929 sizeof(ntop), strport, sizeof(strport),
1930 NI_NUMERICHOST|NI_NUMERICSERV);
1931
1932 if (ai->ai_family == AF_INET && err != 0) {
1933 perror("getnameinfo");
1934 exit(2);
1935 }
1936 }
1937 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10001938 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001939 [
Tim Rice648f8762011-01-26 12:38:57 -08001940 AC_MSG_RESULT([yes])
1941 AC_DEFINE([AIX_GETNAMEINFO_HACK], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07001942 [Define if you have a getaddrinfo that fails
1943 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001944 ],
1945 [
Tim Rice648f8762011-01-26 12:38:57 -08001946 AC_MSG_RESULT([no])
1947 AC_DEFINE([BROKEN_GETADDRINFO])
Darren Tucker314d89e2005-10-17 23:29:23 +10001948 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001949 [
Tim Rice648f8762011-01-26 12:38:57 -08001950 AC_MSG_RESULT([cross-compiling, assuming no])
Darren Tucker691d5232005-02-15 21:45:57 +11001951 ]
1952 )
1953fi
1954
Darren Tuckera56f1912004-11-02 20:30:54 +11001955if test "x$check_for_conflicting_getspnam" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08001956 AC_MSG_CHECKING([for conflicting getspnam in shadow.h])
1957 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <shadow.h> ]],
1958 [[ exit(0); ]])],
Darren Tuckera56f1912004-11-02 20:30:54 +11001959 [
Tim Rice648f8762011-01-26 12:38:57 -08001960 AC_MSG_RESULT([no])
Darren Tuckera56f1912004-11-02 20:30:54 +11001961 ],
1962 [
Tim Rice648f8762011-01-26 12:38:57 -08001963 AC_MSG_RESULT([yes])
1964 AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1],
Darren Tuckera56f1912004-11-02 20:30:54 +11001965 [Conflicting defs for getspnam])
1966 ]
1967 )
1968fi
1969
Damien Miller606f8802000-09-16 15:39:56 +11001970AC_FUNC_GETPGRP
1971
Tim Riceaef73712002-05-11 13:17:42 -07001972# Search for OpenSSL
1973saved_CPPFLAGS="$CPPFLAGS"
1974saved_LDFLAGS="$LDFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08001975AC_ARG_WITH([ssl-dir],
Damien Millera22ba012000-03-02 23:09:20 +11001976 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1977 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001978 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001979 case "$withval" in
1980 # Relative paths
1981 ./*|../*) withval="`pwd`/$withval"
1982 esac
Tim Riceaef73712002-05-11 13:17:42 -07001983 if test -d "$withval/lib"; then
1984 if test -n "${need_dash_r}"; then
1985 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1986 else
1987 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1988 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10001989 elif test -d "$withval/lib64"; then
1990 if test -n "${need_dash_r}"; then
1991 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
1992 else
1993 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
1994 fi
Tim Riceaef73712002-05-11 13:17:42 -07001995 else
1996 if test -n "${need_dash_r}"; then
1997 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1998 else
1999 LDFLAGS="-L${withval} ${LDFLAGS}"
2000 fi
2001 fi
2002 if test -d "$withval/include"; then
2003 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2004 else
2005 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2006 fi
Damien Millera22ba012000-03-02 23:09:20 +11002007 fi
2008 ]
2009)
Tim Rice3d5352e2004-02-12 09:27:21 -08002010LIBS="-lcrypto $LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002011AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002012 [Define if your ssl headers are included
Tim Rice648f8762011-01-26 12:38:57 -08002013 with #include <openssl/header.h>])],
Damien Miller3b512e12000-05-17 23:29:18 +10002014 [
Tim Riceaef73712002-05-11 13:17:42 -07002015 dnl Check default openssl install dir
2016 if test -n "${need_dash_r}"; then
2017 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002018 else
Tim Riceaef73712002-05-11 13:17:42 -07002019 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002020 fi
Tim Riceaef73712002-05-11 13:17:42 -07002021 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002022 AC_CHECK_HEADER([openssl/opensslv.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08002023 [AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])])
2024 AC_TRY_LINK_FUNC([RAND_add], [AC_DEFINE([HAVE_OPENSSL])],
Tim Riceaef73712002-05-11 13:17:42 -07002025 [
2026 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2027 ]
2028 )
2029 ]
2030)
2031
Tim Riced730b782002-08-13 18:52:10 -07002032# Determine OpenSSL header version
2033AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002034AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002035 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002036#include <stdio.h>
2037#include <string.h>
2038#include <openssl/opensslv.h>
2039#define DATA "conftest.sslincver"
Tim Rice648f8762011-01-26 12:38:57 -08002040 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002041 FILE *fd;
2042 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002043
Damien Millera8e06ce2003-11-21 23:48:55 +11002044 fd = fopen(DATA,"w");
2045 if(fd == NULL)
2046 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002047
2048 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2049 exit(1);
2050
2051 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002052 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002053 [
2054 ssl_header_ver=`cat conftest.sslincver`
Tim Rice648f8762011-01-26 12:38:57 -08002055 AC_MSG_RESULT([$ssl_header_ver])
Tim Riced730b782002-08-13 18:52:10 -07002056 ],
2057 [
Tim Rice648f8762011-01-26 12:38:57 -08002058 AC_MSG_RESULT([not found])
2059 AC_MSG_ERROR([OpenSSL version header not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002060 ],
2061 [
2062 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002063 ]
2064)
2065
2066# Determine OpenSSL library version
2067AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002068AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002069 [AC_LANG_PROGRAM([[
Tim Riced730b782002-08-13 18:52:10 -07002070#include <stdio.h>
2071#include <string.h>
2072#include <openssl/opensslv.h>
2073#include <openssl/crypto.h>
2074#define DATA "conftest.ssllibver"
Tim Rice648f8762011-01-26 12:38:57 -08002075 ]], [[
Damien Millera8e06ce2003-11-21 23:48:55 +11002076 FILE *fd;
2077 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002078
Damien Millera8e06ce2003-11-21 23:48:55 +11002079 fd = fopen(DATA,"w");
2080 if(fd == NULL)
2081 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002082
2083 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2084 exit(1);
2085
2086 exit(0);
Darren Tucker623d92f2004-09-12 22:36:15 +10002087 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002088 [
2089 ssl_library_ver=`cat conftest.ssllibver`
Tim Rice648f8762011-01-26 12:38:57 -08002090 AC_MSG_RESULT([$ssl_library_ver])
Tim Riced730b782002-08-13 18:52:10 -07002091 ],
2092 [
Tim Rice648f8762011-01-26 12:38:57 -08002093 AC_MSG_RESULT([not found])
2094 AC_MSG_ERROR([OpenSSL library not found.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002095 ],
2096 [
2097 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002098 ]
2099)
Damien Millera22ba012000-03-02 23:09:20 +11002100
Tim Rice648f8762011-01-26 12:38:57 -08002101AC_ARG_WITH([openssl-header-check],
Damien Miller9975e482007-03-05 11:51:27 +11002102 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2103 [ if test "x$withval" = "xno" ; then
2104 openssl_check_nonfatal=1
2105 fi
2106 ]
2107)
2108
Damien Millerec932372002-01-22 22:16:03 +11002109# Sanity check OpenSSL headers
2110AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002111AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002112 [AC_LANG_PROGRAM([[
Damien Millerec932372002-01-22 22:16:03 +11002113#include <string.h>
2114#include <openssl/opensslv.h>
Tim Rice648f8762011-01-26 12:38:57 -08002115 ]], [[
2116 exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002117 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002118 [
Tim Rice648f8762011-01-26 12:38:57 -08002119 AC_MSG_RESULT([yes])
Damien Millerec932372002-01-22 22:16:03 +11002120 ],
2121 [
Tim Rice648f8762011-01-26 12:38:57 -08002122 AC_MSG_RESULT([no])
Damien Miller9975e482007-03-05 11:51:27 +11002123 if test "x$openssl_check_nonfatal" = "x"; then
2124 AC_MSG_ERROR([Your OpenSSL headers do not match your
2125library. Check config.log for details.
2126If you are sure your installation is consistent, you can disable the check
2127by running "./configure --without-openssl-header-check".
2128Also see contrib/findssl.sh for help identifying header/library mismatches.
2129])
2130 else
2131 AC_MSG_WARN([Your OpenSSL headers do not match your
2132library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002133Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002134 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002135 ],
2136 [
2137 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002138 ]
2139)
2140
Darren Tucker639bbe82006-08-20 20:17:53 +10002141AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2142AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002143 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2144 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002145 [
Tim Rice648f8762011-01-26 12:38:57 -08002146 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002147 ],
2148 [
Tim Rice648f8762011-01-26 12:38:57 -08002149 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002150 saved_LIBS="$LIBS"
2151 LIBS="$LIBS -ldl"
2152 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2153 AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002154 [AC_LANG_PROGRAM([[ #include <openssl/evp.h> ]],
2155 [[ SSLeay_add_all_algorithms(); ]])],
Darren Tucker639bbe82006-08-20 20:17:53 +10002156 [
Tim Rice648f8762011-01-26 12:38:57 -08002157 AC_MSG_RESULT([yes])
Darren Tucker639bbe82006-08-20 20:17:53 +10002158 ],
2159 [
Tim Rice648f8762011-01-26 12:38:57 -08002160 AC_MSG_RESULT([no])
Darren Tucker639bbe82006-08-20 20:17:53 +10002161 LIBS="$saved_LIBS"
2162 ]
2163 )
2164 ]
2165)
2166
Tim Rice648f8762011-01-26 12:38:57 -08002167AC_CHECK_FUNCS([RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex RSA_get_default_method])
Darren Tuckerebdef762010-12-04 23:20:50 +11002168
Tim Rice648f8762011-01-26 12:38:57 -08002169AC_ARG_WITH([ssl-engine],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002170 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2171 [ if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002172 AC_MSG_CHECKING([for OpenSSL ENGINE support])
2173 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2174#include <openssl/engine.h>
2175 ]], [[
2176 ENGINE_load_builtin_engines();
2177 ENGINE_register_all_complete();
2178 ]])],
2179 [ AC_MSG_RESULT([yes])
2180 AC_DEFINE([USE_OPENSSL_ENGINE], [1],
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002181 [Enable OpenSSL engine support])
Tim Rice648f8762011-01-26 12:38:57 -08002182 ], [ AC_MSG_ERROR([OpenSSL ENGINE support not found])
2183 ])
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002184 fi ]
2185)
2186
Darren Tucker129d0bb2005-12-19 17:40:40 +11002187# Check for OpenSSL without EVP_aes_{192,256}_cbc
2188AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002189AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002190 [AC_LANG_PROGRAM([[
Darren Tucker129d0bb2005-12-19 17:40:40 +11002191#include <string.h>
2192#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002193 ]], [[
2194 exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);
Darren Tucker129d0bb2005-12-19 17:40:40 +11002195 ]])],
2196 [
Tim Rice648f8762011-01-26 12:38:57 -08002197 AC_MSG_RESULT([no])
Darren Tucker129d0bb2005-12-19 17:40:40 +11002198 ],
2199 [
Tim Rice648f8762011-01-26 12:38:57 -08002200 AC_MSG_RESULT([yes])
2201 AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1],
Darren Tucker129d0bb2005-12-19 17:40:40 +11002202 [libcrypto is missing AES 192 and 256 bit functions])
2203 ]
2204)
2205
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002206AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2207AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002208 [AC_LANG_PROGRAM([[
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002209#include <string.h>
2210#include <openssl/evp.h>
Tim Rice648f8762011-01-26 12:38:57 -08002211 ]], [[
2212 if(EVP_DigestUpdate(NULL, NULL,0))
2213 exit(0);
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002214 ]])],
2215 [
Tim Rice648f8762011-01-26 12:38:57 -08002216 AC_MSG_RESULT([yes])
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002217 ],
2218 [
Tim Rice648f8762011-01-26 12:38:57 -08002219 AC_MSG_RESULT([no])
2220 AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1],
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002221 [Define if EVP_DigestUpdate returns void])
2222 ]
2223)
2224
Tim Rice3d5352e2004-02-12 09:27:21 -08002225# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2226# because the system crypt() is more featureful.
2227if test "x$check_for_libcrypt_before" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002228 AC_CHECK_LIB([crypt], [crypt])
Tim Rice3d5352e2004-02-12 09:27:21 -08002229fi
2230
Damien Millera8e06ce2003-11-21 23:48:55 +11002231# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002232# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002233if test "x$check_for_libcrypt_later" = "x1"; then
Tim Rice648f8762011-01-26 12:38:57 -08002234 AC_CHECK_LIB([crypt], [crypt], [LIBS="$LIBS -lcrypt"])
Damien Millera64b57a2001-01-17 10:44:13 +11002235fi
2236
Damien Milleraf87af12006-03-15 13:02:28 +11002237# Search for SHA256 support in libc and/or OpenSSL
Tim Rice648f8762011-01-26 12:38:57 -08002238AC_CHECK_FUNCS([SHA256_Update EVP_sha256], [TEST_SSH_SHA256=yes],
Darren Tucker50c61f82011-01-16 18:28:09 +11002239 [TEST_SSH_SHA256=no])
Tim Rice648f8762011-01-26 12:38:57 -08002240AC_SUBST([TEST_SSH_SHA256])
Damien Milleraf87af12006-03-15 13:02:28 +11002241
Damien Miller6af914a2010-09-10 11:39:26 +10002242# Check complete ECC support in OpenSSL
2243AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2244AC_LINK_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002245 [AC_LANG_PROGRAM([[
Damien Miller6af914a2010-09-10 11:39:26 +10002246#include <openssl/ec.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002247#include <openssl/ecdh.h>
2248#include <openssl/ecdsa.h>
Damien Miller6af914a2010-09-10 11:39:26 +10002249#include <openssl/evp.h>
2250#include <openssl/objects.h>
Damien Millere323ebc2011-01-19 23:12:27 +11002251#include <openssl/opensslv.h>
2252#if OPENSSL_VERSION_NUMBER < 0x0090807f /* 0.9.8g */
2253# error "OpenSSL < 0.9.8g has unreliable ECC code"
2254#endif
Tim Rice648f8762011-01-26 12:38:57 -08002255 ]], [[
Damien Miller6af914a2010-09-10 11:39:26 +10002256 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2257 const EVP_MD *m = EVP_sha512(); /* We need this too */
Damien Miller6af914a2010-09-10 11:39:26 +10002258 ]])],
2259 [
Tim Rice648f8762011-01-26 12:38:57 -08002260 AC_MSG_RESULT([yes])
2261 AC_DEFINE([OPENSSL_HAS_ECC], [1],
Damien Miller6af914a2010-09-10 11:39:26 +10002262 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002263 TEST_SSH_ECC=yes
Tim Rice9b87a5c2011-01-12 22:35:43 -08002264 COMMENT_OUT_ECC=""
Damien Miller6af914a2010-09-10 11:39:26 +10002265 ],
2266 [
Tim Rice648f8762011-01-26 12:38:57 -08002267 AC_MSG_RESULT([no])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002268 TEST_SSH_ECC=no
Tim Rice9b87a5c2011-01-12 22:35:43 -08002269 COMMENT_OUT_ECC="#no ecc#"
Damien Miller6af914a2010-09-10 11:39:26 +10002270 ]
2271)
Tim Rice648f8762011-01-26 12:38:57 -08002272AC_SUBST([TEST_SSH_ECC])
2273AC_SUBST([COMMENT_OUT_ECC])
Damien Miller6af914a2010-09-10 11:39:26 +10002274
Tim Rice99203ec2007-03-26 09:35:28 -07002275saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002276AC_CHECK_LIB([iaf], [ia_openinfo], [
Tim Rice99203ec2007-03-26 09:35:28 -07002277 LIBS="$LIBS -liaf"
Tim Rice648f8762011-01-26 12:38:57 -08002278 AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf"
2279 AC_DEFINE([HAVE_LIBIAF], [1],
Tim Rice0eeaf122007-09-10 16:24:17 -07002280 [Define if system has libiaf that supports set_id])
2281 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002282])
2283LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002284
2285### Configure cryptographic random number support
2286
2287# Check wheter OpenSSL seeds itself
2288AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002289AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002290 [AC_LANG_PROGRAM([[
Damien Miller6c21c512002-01-22 21:57:53 +11002291#include <string.h>
2292#include <openssl/rand.h>
Tim Rice648f8762011-01-26 12:38:57 -08002293 ]], [[
2294 exit(RAND_status() == 1 ? 0 : 1);
Darren Tucker623d92f2004-09-12 22:36:15 +10002295 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002296 [
2297 OPENSSL_SEEDS_ITSELF=yes
Tim Rice648f8762011-01-26 12:38:57 -08002298 AC_MSG_RESULT([yes])
Damien Miller6c21c512002-01-22 21:57:53 +11002299 ],
2300 [
Tim Rice648f8762011-01-26 12:38:57 -08002301 AC_MSG_RESULT([no])
Damien Miller6c21c512002-01-22 21:57:53 +11002302 # Default to use of the rand helper if OpenSSL doesn't
2303 # seed itself
2304 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002305 ],
2306 [
2307 AC_MSG_WARN([cross compiling: assuming yes])
2308 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002309 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002310 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002311 ]
2312)
2313
Darren Tucker3e6bde42006-08-20 20:03:50 +10002314# Check for PAM libs
2315PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002316AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002317 [ --with-pam Enable PAM support ],
2318 [
2319 if test "x$withval" != "xno" ; then
2320 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2321 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2322 AC_MSG_ERROR([PAM headers not found])
2323 fi
2324
2325 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002326 AC_CHECK_LIB([dl], [dlopen], , )
2327 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2328 AC_CHECK_FUNCS([pam_getenvlist])
2329 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002330 LIBS="$saved_LIBS"
2331
2332 PAM_MSG="yes"
2333
Darren Tucker20e9f972007-03-25 18:26:01 +10002334 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002335 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002336 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002337
Darren Tucker3e6bde42006-08-20 20:03:50 +10002338 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002339 case "$LIBS" in
2340 *-ldl*)
2341 # libdl already in LIBS
2342 ;;
2343 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002344 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002345 ;;
2346 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002347 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002348 fi
2349 ]
2350)
2351
2352# Check for older PAM
2353if test "x$PAM_MSG" = "xyes" ; then
2354 # Check PAM strerror arguments (old PAM)
2355 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002356 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002357#include <stdlib.h>
2358#if defined(HAVE_SECURITY_PAM_APPL_H)
2359#include <security/pam_appl.h>
2360#elif defined (HAVE_PAM_PAM_APPL_H)
2361#include <pam/pam_appl.h>
2362#endif
Tim Rice648f8762011-01-26 12:38:57 -08002363 ]], [[
2364(void)pam_strerror((pam_handle_t *)NULL, -1);
2365 ]])], [AC_MSG_RESULT([no])], [
2366 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002367 [Define if you have an old version of PAM
2368 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002369 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002370 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002371
2372 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002373fi
Damien Miller6c21c512002-01-22 21:57:53 +11002374
2375# Do we want to force the use of the rand helper?
Tim Rice648f8762011-01-26 12:38:57 -08002376AC_ARG_WITH([rand-helper],
Damien Miller6c21c512002-01-22 21:57:53 +11002377 [ --with-rand-helper Use subprocess to gather strong randomness ],
2378 [
2379 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002380 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002381 # the previous test showed it to be unseeded.
2382 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2383 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2384 OPENSSL_SEEDS_ITSELF=yes
2385 USE_RAND_HELPER=""
2386 fi
2387 else
2388 USE_RAND_HELPER=yes
2389 fi
2390 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002391)
Damien Miller6c21c512002-01-22 21:57:53 +11002392
2393# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002394if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002395 # OpenSSL only
Tim Rice648f8762011-01-26 12:38:57 -08002396 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002397 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002398 RAND_MSG="OpenSSL internal ONLY"
2399 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002400elif test ! -z "$USE_RAND_HELPER" ; then
2401 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002402 RAND_MSG="ssh-rand-helper"
2403 INSTALL_SSH_RAND_HELPER="yes"
2404fi
Tim Rice648f8762011-01-26 12:38:57 -08002405AC_SUBST([INSTALL_SSH_RAND_HELPER])
Damien Miller6c21c512002-01-22 21:57:53 +11002406
2407### Configuration of ssh-rand-helper
2408
2409# PRNGD TCP socket
Tim Rice648f8762011-01-26 12:38:57 -08002410AC_ARG_WITH([prngd-port],
Damien Miller6c21c512002-01-22 21:57:53 +11002411 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2412 [
Damien Millere996d722002-01-23 11:20:59 +11002413 case "$withval" in
2414 no)
2415 withval=""
2416 ;;
2417 [[0-9]]*)
2418 ;;
2419 *)
Tim Rice648f8762011-01-26 12:38:57 -08002420 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
Damien Millere996d722002-01-23 11:20:59 +11002421 ;;
2422 esac
2423 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002424 PRNGD_PORT="$withval"
Tim Rice648f8762011-01-26 12:38:57 -08002425 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
Tim Rice7df8d392005-09-19 09:33:39 -07002426 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002427 fi
2428 ]
2429)
2430
2431# PRNGD Unix domain socket
Tim Rice648f8762011-01-26 12:38:57 -08002432AC_ARG_WITH([prngd-socket],
Damien Miller6c21c512002-01-22 21:57:53 +11002433 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2434 [
Damien Millere996d722002-01-23 11:20:59 +11002435 case "$withval" in
2436 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002437 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002438 ;;
2439 no)
2440 withval=""
2441 ;;
2442 /*)
2443 ;;
2444 *)
Tim Rice648f8762011-01-26 12:38:57 -08002445 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
Damien Millere996d722002-01-23 11:20:59 +11002446 ;;
2447 esac
2448
2449 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002450 if test ! -z "$PRNGD_PORT" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002451 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002452 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002453 if test ! -r "$withval" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002454 AC_MSG_WARN([Entropy socket is not readable])
Damien Miller6c21c512002-01-22 21:57:53 +11002455 fi
2456 PRNGD_SOCKET="$withval"
Tim Rice648f8762011-01-26 12:38:57 -08002457 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
Tim Rice7df8d392005-09-19 09:33:39 -07002458 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002459 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002460 ],
2461 [
2462 # Check for existing socket only if we don't have a random device already
2463 if test "$USE_RAND_HELPER" = yes ; then
Tim Rice648f8762011-01-26 12:38:57 -08002464 AC_MSG_CHECKING([for PRNGD/EGD socket])
Tim Rice4cec93f2002-02-26 08:40:48 -08002465 # Insert other locations here
2466 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2467 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2468 PRNGD_SOCKET="$sock"
Tim Rice648f8762011-01-26 12:38:57 -08002469 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
Tim Rice4cec93f2002-02-26 08:40:48 -08002470 break;
2471 fi
2472 done
2473 if test ! -z "$PRNGD_SOCKET" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002474 AC_MSG_RESULT([$PRNGD_SOCKET])
Tim Rice4cec93f2002-02-26 08:40:48 -08002475 else
Tim Rice648f8762011-01-26 12:38:57 -08002476 AC_MSG_RESULT([not found])
Tim Rice4cec93f2002-02-26 08:40:48 -08002477 fi
2478 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002479 ]
2480)
2481
2482# Change default command timeout for hashing entropy source
2483entropy_timeout=200
Tim Rice648f8762011-01-26 12:38:57 -08002484AC_ARG_WITH([entropy-timeout],
Damien Miller6c21c512002-01-22 21:57:53 +11002485 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2486 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002487 if test -n "$withval" && test "x$withval" != "xno" && \
2488 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002489 entropy_timeout=$withval
2490 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002491 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002492)
Tim Rice648f8762011-01-26 12:38:57 -08002493AC_DEFINE_UNQUOTED([ENTROPY_TIMEOUT_MSEC], [$entropy_timeout],
Tim Rice7df8d392005-09-19 09:33:39 -07002494 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002495
Damien Millerd3f6ad22002-06-25 10:24:47 +10002496SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002497AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002498 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002499 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002500 if test -n "$withval" && test "x$withval" != "xno" && \
2501 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002502 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002503 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002504 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002505)
Tim Rice648f8762011-01-26 12:38:57 -08002506AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002507 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002508AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002509
Tim Rice88f2ab52002-03-17 12:17:34 -08002510# We do this little dance with the search path to insure
2511# that programs that we select for use by installed programs
2512# (which may be run by the super-user) come from trusted
2513# locations before they come from the user's private area.
2514# This should help avoid accidentally configuring some
2515# random version of a program in someone's personal bin.
2516
2517OPATH=$PATH
2518PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002519test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002520test -d /sbin && PATH=$PATH:/sbin
2521test -d /usr/sbin && PATH=$PATH:/usr/sbin
2522PATH=$PATH:/etc:$OPATH
2523
Damien Millera8e06ce2003-11-21 23:48:55 +11002524# These programs are used by the command hashing source to gather entropy
Tim Rice648f8762011-01-26 12:38:57 -08002525OSSH_PATH_ENTROPY_PROG([PROG_LS], [ls])
2526OSSH_PATH_ENTROPY_PROG([PROG_NETSTAT], [netstat])
2527OSSH_PATH_ENTROPY_PROG([PROG_ARP], [arp])
2528OSSH_PATH_ENTROPY_PROG([PROG_IFCONFIG], [ifconfig])
2529OSSH_PATH_ENTROPY_PROG([PROG_JSTAT], [jstat])
2530OSSH_PATH_ENTROPY_PROG([PROG_PS], [ps])
2531OSSH_PATH_ENTROPY_PROG([PROG_SAR], [sar])
2532OSSH_PATH_ENTROPY_PROG([PROG_W], [w])
2533OSSH_PATH_ENTROPY_PROG([PROG_WHO], [who])
2534OSSH_PATH_ENTROPY_PROG([PROG_LAST], [last])
2535OSSH_PATH_ENTROPY_PROG([PROG_LASTLOG], [lastlog])
2536OSSH_PATH_ENTROPY_PROG([PROG_DF], [df])
2537OSSH_PATH_ENTROPY_PROG([PROG_VMSTAT], [vmstat])
2538OSSH_PATH_ENTROPY_PROG([PROG_UPTIME], [uptime])
2539OSSH_PATH_ENTROPY_PROG([PROG_IPCS], [ipcs])
2540OSSH_PATH_ENTROPY_PROG([PROG_TAIL], [tail])
Tim Rice88f2ab52002-03-17 12:17:34 -08002541# restore PATH
2542PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002543
2544# Where does ssh-rand-helper get its randomness from?
2545INSTALL_SSH_PRNG_CMDS=""
2546if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2547 if test ! -z "$PRNGD_PORT" ; then
2548 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2549 elif test ! -z "$PRNGD_SOCKET" ; then
2550 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2551 else
2552 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2553 RAND_HELPER_CMDHASH=yes
2554 INSTALL_SSH_PRNG_CMDS="yes"
2555 fi
2556fi
Tim Rice648f8762011-01-26 12:38:57 -08002557AC_SUBST([INSTALL_SSH_PRNG_CMDS])
Damien Miller6c21c512002-01-22 21:57:53 +11002558
2559
Ben Lindstromb5628642000-10-18 00:02:25 +00002560# Cheap hack to ensure NEWS-OS libraries are arranged right.
2561if test ! -z "$SONY" ; then
2562 LIBS="$LIBS -liberty";
2563fi
2564
Damien Miller57f39152005-11-24 19:58:19 +11002565# Check for long long datatypes
2566AC_CHECK_TYPES([long long, unsigned long long, long double])
2567
2568# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002569AC_CHECK_SIZEOF([char], [1])
2570AC_CHECK_SIZEOF([short int], [2])
2571AC_CHECK_SIZEOF([int], [4])
2572AC_CHECK_SIZEOF([long int], [4])
2573AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002574
Damien Millerfa2bb692002-04-23 23:22:25 +10002575# Sanity check long long for some platforms (AIX)
2576if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2577 ac_cv_sizeof_long_long_int=0
2578fi
2579
Darren Tucker537f1ed2005-10-25 18:38:33 +10002580# compute LLONG_MIN and LLONG_MAX if we don't know them.
2581if test -z "$have_llong_max"; then
2582 AC_MSG_CHECKING([for max value of long long])
2583 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002584 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002585#include <stdio.h>
2586/* Why is this so damn hard? */
2587#ifdef __GNUC__
2588# undef __GNUC__
2589#endif
2590#define __USE_ISOC99
2591#include <limits.h>
2592#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002593#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2594
2595/*
2596 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2597 * we do this the hard way.
2598 */
2599static int
2600fprint_ll(FILE *f, long long n)
2601{
2602 unsigned int i;
2603 int l[sizeof(long long) * 8];
2604
2605 if (n < 0)
2606 if (fprintf(f, "-") < 0)
2607 return -1;
2608 for (i = 0; n != 0; i++) {
2609 l[i] = my_abs(n % 10);
2610 n /= 10;
2611 }
2612 do {
2613 if (fprintf(f, "%d", l[--i]) < 0)
2614 return -1;
2615 } while (i != 0);
2616 if (fprintf(f, " ") < 0)
2617 return -1;
2618 return 0;
2619}
Tim Rice648f8762011-01-26 12:38:57 -08002620 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002621 FILE *f;
2622 long long i, llmin, llmax = 0;
2623
2624 if((f = fopen(DATA,"w")) == NULL)
2625 exit(1);
2626
2627#if defined(LLONG_MIN) && defined(LLONG_MAX)
2628 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2629 llmin = LLONG_MIN;
2630 llmax = LLONG_MAX;
2631#else
2632 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2633 /* This will work on one's complement and two's complement */
2634 for (i = 1; i > llmax; i <<= 1, i++)
2635 llmax = i;
2636 llmin = llmax + 1LL; /* wrap */
2637#endif
2638
2639 /* Sanity check */
2640 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002641 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2642 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002643 fprintf(f, "unknown unknown\n");
2644 exit(2);
2645 }
2646
Darren Tuckerd1450db2006-03-13 19:06:51 +11002647 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002648 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002649 if (fprint_ll(f, llmax) < 0)
2650 exit(4);
2651 if (fclose(f) < 0)
2652 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002653 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002654 ]])],
2655 [
2656 llong_min=`$AWK '{print $1}' conftest.llminmax`
2657 llong_max=`$AWK '{print $2}' conftest.llminmax`
2658
Tim Rice648f8762011-01-26 12:38:57 -08002659 AC_MSG_RESULT([$llong_max])
2660 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002661 [max value of long long calculated by configure])
2662 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002663 AC_MSG_RESULT([$llong_min])
2664 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002665 [min value of long long calculated by configure])
2666 ],
2667 [
Tim Rice648f8762011-01-26 12:38:57 -08002668 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002669 ],
2670 [
2671 AC_MSG_WARN([cross compiling: not checking])
2672 ]
2673 )
2674fi
2675
2676
Damien Millera22ba012000-03-02 23:09:20 +11002677# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002678AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2680 [[ u_int a; a = 1;]])],
2681 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2682 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002683])
2684if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002685 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002686 have_u_int=1
2687fi
2688
Damien Miller61e50f12000-05-08 20:49:37 +10002689AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002690 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2691 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2692 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2693 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002694])
2695if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002696 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002697 have_intxx_t=1
2698fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002699
2700if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002701 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002702then
2703 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002704 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2705 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002706 [
Tim Rice648f8762011-01-26 12:38:57 -08002707 AC_DEFINE([HAVE_INTXX_T])
2708 AC_MSG_RESULT([yes])
2709 ], [ AC_MSG_RESULT([no])
2710 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002711fi
2712
Damien Miller578783e2000-09-23 14:12:24 +11002713AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002714 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002715#include <sys/types.h>
2716#ifdef HAVE_STDINT_H
2717# include <stdint.h>
2718#endif
2719#include <sys/socket.h>
2720#ifdef HAVE_SYS_BITYPES_H
2721# include <sys/bitypes.h>
2722#endif
Tim Rice648f8762011-01-26 12:38:57 -08002723 ]], [[
2724int64_t a; a = 1;
2725 ]])],
2726 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2727 ])
Damien Miller578783e2000-09-23 14:12:24 +11002728])
2729if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002730 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002731fi
2732
Damien Miller61e50f12000-05-08 20:49:37 +10002733AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002734 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2735 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2736 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2737 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002738])
2739if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002740 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002741 have_u_intxx_t=1
2742fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002743
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002744if test -z "$have_u_intxx_t" ; then
2745 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2747 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002748 [
Tim Rice648f8762011-01-26 12:38:57 -08002749 AC_DEFINE([HAVE_U_INTXX_T])
2750 AC_MSG_RESULT([yes])
2751 ], [ AC_MSG_RESULT([no])
2752 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002753fi
2754
Damien Miller578783e2000-09-23 14:12:24 +11002755AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002756 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2757 [[ u_int64_t a; a = 1;]])],
2758 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2759 ])
Damien Miller578783e2000-09-23 14:12:24 +11002760])
2761if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002762 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002763 have_u_int64_t=1
2764fi
2765
Tim Rice4cec93f2002-02-26 08:40:48 -08002766if test -z "$have_u_int64_t" ; then
2767 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002768 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2769 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002770 [
Tim Rice648f8762011-01-26 12:38:57 -08002771 AC_DEFINE([HAVE_U_INT64_T])
2772 AC_MSG_RESULT([yes])
2773 ], [ AC_MSG_RESULT([no])
2774 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002775fi
2776
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002777if test -z "$have_u_intxx_t" ; then
2778 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002779 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002780#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002781 ]], [[
2782 uint8_t a;
2783 uint16_t b;
2784 uint32_t c;
2785 a = b = c = 1;
2786 ]])],
2787 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2788 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002789 ])
2790 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002791 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002792 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002793 fi
2794fi
2795
2796if test -z "$have_uintxx_t" ; then
2797 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002798 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2799 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002800 [
Tim Rice648f8762011-01-26 12:38:57 -08002801 AC_DEFINE([HAVE_UINTXX_T])
2802 AC_MSG_RESULT([yes])
2803 ], [ AC_MSG_RESULT([no])
2804 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002805fi
2806
Damien Milleredb82922000-06-20 13:25:52 +10002807if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002808 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002809then
2810 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002811 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002812#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002813 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002814 int8_t a; int16_t b; int32_t c;
2815 u_int8_t e; u_int16_t f; u_int32_t g;
2816 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002817 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002818 [
Tim Rice648f8762011-01-26 12:38:57 -08002819 AC_DEFINE([HAVE_U_INTXX_T])
2820 AC_DEFINE([HAVE_INTXX_T])
2821 AC_MSG_RESULT([yes])
2822 ], [AC_MSG_RESULT([no])
2823 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002824fi
2825
Damien Miller58be7382001-09-15 21:31:54 +10002826
2827AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002828 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2829 [[ u_char foo; foo = 125; ]])],
2830 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2831 ])
Damien Miller58be7382001-09-15 21:31:54 +10002832])
2833if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002834 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002835fi
2836
Tim Rice13aae5e2001-10-21 17:53:58 -07002837TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002838
Tim Rice648f8762011-01-26 12:38:57 -08002839AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2840AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002841#include <sys/types.h>
2842#ifdef HAVE_SYS_BITYPES_H
2843#include <sys/bitypes.h>
2844#endif
2845#ifdef HAVE_SYS_STATFS_H
2846#include <sys/statfs.h>
2847#endif
2848#ifdef HAVE_SYS_STATVFS_H
2849#include <sys/statvfs.h>
2850#endif
2851])
Tim Rice4cec93f2002-02-26 08:40:48 -08002852
Tim Rice648f8762011-01-26 12:38:57 -08002853AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002854[#include <sys/types.h>
2855#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002856
Damien Miller61e50f12000-05-08 20:49:37 +10002857AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002858 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2859 [[ size_t foo; foo = 1235; ]])],
2860 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2861 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002862])
2863if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002864 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002865fi
Damien Miller95058511999-12-29 10:36:45 +11002866
Damien Miller615f9392000-05-17 22:53:33 +10002867AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002868 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2869 [[ ssize_t foo; foo = 1235; ]])],
2870 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2871 ])
Damien Miller615f9392000-05-17 22:53:33 +10002872])
2873if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002874 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002875fi
2876
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002877AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002878 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2879 [[ clock_t foo; foo = 1235; ]])],
2880 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2881 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002882])
2883if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002884 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002885fi
2886
Damien Millerb54b40e2000-06-23 08:23:34 +10002887AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002888 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002889#include <sys/types.h>
2890#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002891 ]], [[ sa_family_t foo; foo = 1235; ]])],
2892 [ ac_cv_have_sa_family_t="yes" ],
2893 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002894#include <sys/types.h>
2895#include <sys/socket.h>
2896#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002897 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002898 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002899 [ ac_cv_have_sa_family_t="no" ]
2900 )
Tim Rice648f8762011-01-26 12:38:57 -08002901 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002902])
2903if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002904 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002905 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002906fi
2907
Damien Miller0f91b4e2000-06-18 15:43:25 +10002908AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002909 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2910 [[ pid_t foo; foo = 1235; ]])],
2911 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2912 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002913])
2914if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002915 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002916fi
2917
2918AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002919 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2920 [[ mode_t foo; foo = 1235; ]])],
2921 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2922 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002923])
2924if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002925 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002926fi
2927
Damien Miller61e50f12000-05-08 20:49:37 +10002928
2929AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002930 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002931#include <sys/types.h>
2932#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002933 ]], [[ struct sockaddr_storage s; ]])],
2934 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2935 [ ac_cv_have_struct_sockaddr_storage="no"
2936 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002937])
2938if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002939 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002940 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002941fi
Damien Miller34132e52000-01-14 15:45:46 +11002942
Damien Miller61e50f12000-05-08 20:49:37 +10002943AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002944 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002945#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002946#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002947 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2948 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2949 [ ac_cv_have_struct_sockaddr_in6="no"
2950 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002951])
2952if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002953 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002954 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002955fi
Damien Miller34132e52000-01-14 15:45:46 +11002956
Damien Miller61e50f12000-05-08 20:49:37 +10002957AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002958 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002959#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002960#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002961 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2962 [ ac_cv_have_struct_in6_addr="yes" ],
2963 [ ac_cv_have_struct_in6_addr="no"
2964 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002965])
2966if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002967 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002968 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002969
2970dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002971 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002972 [
2973#ifdef HAVE_SYS_TYPES_H
2974#include <sys/types.h>
2975#endif
2976#include <netinet/in.h>
2977 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002978fi
Damien Miller34132e52000-01-14 15:45:46 +11002979
Damien Miller61e50f12000-05-08 20:49:37 +10002980AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002981 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002982#include <sys/types.h>
2983#include <sys/socket.h>
2984#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002985 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2986 [ ac_cv_have_struct_addrinfo="yes" ],
2987 [ ac_cv_have_struct_addrinfo="no"
2988 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002989])
2990if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002991 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002992 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002993fi
2994
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002995AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002996 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2997 [[ struct timeval tv; tv.tv_sec = 1;]])],
2998 [ ac_cv_have_struct_timeval="yes" ],
2999 [ ac_cv_have_struct_timeval="no"
3000 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003001])
3002if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003003 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003004 have_struct_timeval=1
3005fi
3006
Tim Rice648f8762011-01-26 12:38:57 -08003007AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08003008
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003009# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003010if test "x$ac_cv_have_int64_t" = "xno" && \
3011 test "x$ac_cv_sizeof_long_int" != "x8" && \
3012 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003013 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3014 echo "an alternative compiler (I.E., GCC) before continuing."
3015 echo ""
3016 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003017else
3018dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003019 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003020 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003021#include <stdio.h>
3022#include <string.h>
3023#ifdef HAVE_SNPRINTF
3024main()
3025{
3026 char buf[50];
3027 char expected_out[50];
3028 int mazsize = 50 ;
3029#if (SIZEOF_LONG_INT == 8)
3030 long int num = 0x7fffffffffffffff;
3031#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003032 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003033#endif
3034 strcpy(expected_out, "9223372036854775807");
3035 snprintf(buf, mazsize, "%lld", num);
3036 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003037 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003038 exit(0);
3039}
3040#else
3041main() { exit(0); }
3042#endif
Tim Rice648f8762011-01-26 12:38:57 -08003043 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003044 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003045 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003046fi
3047
Damien Miller78315eb2000-09-29 23:01:36 +11003048dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08003049OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
3050OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
3051OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
3052OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
3053OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
3054OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
3055OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
3056OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
3057OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
3058OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
3059OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
3060OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
3061OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
3062OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
3063OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
3064OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
3065OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07003066
3067AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08003068AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11003069 [Define if we don't have struct __res_state in resolv.h])],
3070[
3071#include <stdio.h>
3072#if HAVE_SYS_TYPES_H
3073# include <sys/types.h>
3074#endif
3075#include <netinet/in.h>
3076#include <arpa/nameser.h>
3077#include <resolv.h>
3078])
andre2ff7b5d2000-06-03 14:57:40 +00003079
Damien Miller61e50f12000-05-08 20:49:37 +10003080AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3081 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003082 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003083#include <sys/types.h>
3084#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003085 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
3086 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3087 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003088])
3089if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003090 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003091fi
3092
Damien Miller61e50f12000-05-08 20:49:37 +10003093AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3094 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003095 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003096#include <sys/types.h>
3097#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003098 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3099 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3100 [ ac_cv_have___ss_family_in_struct_ss="no"
3101 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003102])
3103if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003104 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003105 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003106fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003107
Damien Millerad833b32000-08-23 10:46:23 +10003108AC_CACHE_CHECK([for pw_class field in struct passwd],
3109 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003110 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3111 [[ struct passwd p; p.pw_class = 0; ]])],
3112 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3113 [ ac_cv_have_pw_class_in_struct_passwd="no"
3114 ])
Damien Millerad833b32000-08-23 10:46:23 +10003115])
3116if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003117 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003118 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003119fi
3120
Kevin Steves82456952001-06-22 21:14:18 +00003121AC_CACHE_CHECK([for pw_expire field in struct passwd],
3122 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003123 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3124 [[ struct passwd p; p.pw_expire = 0; ]])],
3125 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3126 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3127 ])
Kevin Steves82456952001-06-22 21:14:18 +00003128])
3129if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003130 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003131 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003132fi
3133
3134AC_CACHE_CHECK([for pw_change field in struct passwd],
3135 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003136 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3137 [[ struct passwd p; p.pw_change = 0; ]])],
3138 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3139 [ ac_cv_have_pw_change_in_struct_passwd="no"
3140 ])
Kevin Steves82456952001-06-22 21:14:18 +00003141])
3142if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003143 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003144 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003145fi
Damien Miller61e50f12000-05-08 20:49:37 +10003146
Tim Rice28bbb0c2002-05-27 17:37:32 -07003147dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003148AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3149 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003150 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003151#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003152#include <sys/socket.h>
3153#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003154 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003155#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003156#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003157exit(1);
3158#endif
3159struct msghdr m;
3160m.msg_accrights = 0;
3161exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003162 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003163 [ ac_cv_have_accrights_in_msghdr="yes" ],
3164 [ ac_cv_have_accrights_in_msghdr="no" ]
3165 )
3166])
3167if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003168 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003169 [Define if your system uses access rights style
3170 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003171fi
3172
Tim Rice648f8762011-01-26 12:38:57 -08003173AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3174AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003175#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003176#include <sys/stat.h>
3177#ifdef HAVE_SYS_TIME_H
3178# include <sys/time.h>
3179#endif
3180#ifdef HAVE_SYS_MOUNT_H
3181#include <sys/mount.h>
3182#endif
3183#ifdef HAVE_SYS_STATVFS_H
3184#include <sys/statvfs.h>
3185#endif
Tim Rice648f8762011-01-26 12:38:57 -08003186 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3187 [ AC_MSG_RESULT([yes]) ],
3188 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003189
Tim Rice648f8762011-01-26 12:38:57 -08003190 AC_MSG_CHECKING([if fsid_t has member val])
3191 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003192#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003193#include <sys/statvfs.h>
3194 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3195 [ AC_MSG_RESULT([yes])
3196 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3197 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003198
Tim Rice648f8762011-01-26 12:38:57 -08003199 AC_MSG_CHECKING([if f_fsid has member __val])
3200 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003201#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003202#include <sys/statvfs.h>
3203 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3204 [ AC_MSG_RESULT([yes])
3205 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3206 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003207])
Darren Tucker77001382008-06-09 06:17:53 +10003208
Kevin Stevesa44e0352002-04-07 16:18:03 +00003209AC_CACHE_CHECK([for msg_control field in struct msghdr],
3210 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003211 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003212#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003213#include <sys/socket.h>
3214#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003215 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003216#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003217#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003218exit(1);
3219#endif
3220struct msghdr m;
3221m.msg_control = 0;
3222exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003223 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003224 [ ac_cv_have_control_in_msghdr="yes" ],
3225 [ ac_cv_have_control_in_msghdr="no" ]
3226 )
3227])
3228if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003229 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003230 [Define if your system uses ancillary data style
3231 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003232fi
3233
Damien Miller61e50f12000-05-08 20:49:37 +10003234AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003235 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3236 [[ extern char *__progname; printf("%s", __progname); ]])],
3237 [ ac_cv_libc_defines___progname="yes" ],
3238 [ ac_cv_libc_defines___progname="no"
3239 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003240])
3241if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003242 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003243fi
3244
Kevin Steves4846f4a2002-03-22 18:19:53 +00003245AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003246 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3247 [[ printf("%s", __FUNCTION__); ]])],
3248 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3249 [ ac_cv_cc_implements___FUNCTION__="no"
3250 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003251])
3252if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003253 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003254 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003255fi
3256
3257AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003258 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3259 [[ printf("%s", __func__); ]])],
3260 [ ac_cv_cc_implements___func__="yes" ],
3261 [ ac_cv_cc_implements___func__="no"
3262 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003263])
3264if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003265 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003266fi
3267
Damien Miller57f39152005-11-24 19:58:19 +11003268AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003269 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3270#include <stdarg.h>
3271va_list x,y;
3272 ]], [[ va_copy(x,y); ]])],
3273 [ ac_cv_have_va_copy="yes" ],
3274 [ ac_cv_have_va_copy="no"
3275 ])
Damien Miller57f39152005-11-24 19:58:19 +11003276])
3277if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003278 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003279fi
3280
3281AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003282 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3283#include <stdarg.h>
3284va_list x,y;
3285 ]], [[ __va_copy(x,y); ]])],
3286 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3287 ])
Damien Miller57f39152005-11-24 19:58:19 +11003288])
3289if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003290 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003291fi
3292
Damien Miller4f8e6692001-07-14 13:22:53 +10003293AC_CACHE_CHECK([whether getopt has optreset support],
3294 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003295 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3296 [[ extern int optreset; optreset = 0; ]])],
3297 [ ac_cv_have_getopt_optreset="yes" ],
3298 [ ac_cv_have_getopt_optreset="no"
3299 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003300])
3301if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003302 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003303 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003304fi
Damien Millera22ba012000-03-02 23:09:20 +11003305
Damien Millerecbb26d2000-07-15 14:59:14 +10003306AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003307 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3308[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3309 [ ac_cv_libc_defines_sys_errlist="yes" ],
3310 [ ac_cv_libc_defines_sys_errlist="no"
3311 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003312])
3313if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003314 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003315 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003316fi
3317
3318
Damien Miller11fa2cc2000-08-16 10:35:58 +10003319AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003320 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3321[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3322 [ ac_cv_libc_defines_sys_nerr="yes" ],
3323 [ ac_cv_libc_defines_sys_nerr="no"
3324 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003325])
3326if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003327 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003328fi
3329
Darren Tucker5f88d342003-10-15 16:57:57 +10003330# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003331AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3332 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003333 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003334 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003335 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003336 AC_SEARCH_LIBS([res_query], [resolv])
3337 AC_SEARCH_LIBS([dn_expand], [resolv])
3338 AC_MSG_CHECKING([if res_query will link])
3339 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003340#include <sys/types.h>
3341#include <netinet/in.h>
3342#include <arpa/nameser.h>
3343#include <netdb.h>
3344#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003345 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003346 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003347 ]])],
3348 AC_MSG_RESULT([yes]),
3349 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003350 saved_LIBS="$LIBS"
3351 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003352 AC_MSG_CHECKING([for res_query in -lresolv])
3353 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003354#include <sys/types.h>
3355#include <netinet/in.h>
3356#include <arpa/nameser.h>
3357#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003358#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003359 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003360 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003361 ]])],
3362 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003363 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003364 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003365 ])
Tim Rice648f8762011-01-26 12:38:57 -08003366 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003367 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003368 [#include <sys/types.h>
3369 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003370 AC_CHECK_MEMBER([HEADER.ad],
3371 [AC_DEFINE([HAVE_HEADER_AD], [1],
3372 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003373 [#include <arpa/nameser.h>])
3374 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003375
Tim Rice648f8762011-01-26 12:38:57 -08003376AC_MSG_CHECKING([if struct __res_state _res is an extern])
3377AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003378#include <stdio.h>
3379#if HAVE_SYS_TYPES_H
3380# include <sys/types.h>
3381#endif
3382#include <netinet/in.h>
3383#include <arpa/nameser.h>
3384#include <resolv.h>
3385extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003386 ]], [[ ]])],
3387 [AC_MSG_RESULT([yes])
3388 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003389 [Define if you have struct __res_state _res as an extern])
3390 ],
Tim Rice648f8762011-01-26 12:38:57 -08003391 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003392)
3393
Damien Miller73b42d22006-04-22 21:26:08 +10003394# Check whether user wants SELinux support
3395SELINUX_MSG="no"
3396LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003397AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003398 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003399 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003400 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003401 AC_DEFINE([WITH_SELINUX], [1],
3402 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003403 SELINUX_MSG="yes"
3404 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3406 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003407 [ LIBSELINUX="-lselinux"
3408 LIBS="$LIBS -lselinux"
3409 ],
Tim Rice648f8762011-01-26 12:38:57 -08003410 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003411 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003412 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003413 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003414 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003415 fi ]
3416)
Tim Rice648f8762011-01-26 12:38:57 -08003417AC_SUBST([SSHLIBS])
3418AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003419
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003420# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003421KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003422AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003423 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003424 [ if test "x$withval" != "xno" ; then
3425 if test "x$withval" = "xyes" ; then
3426 KRB5ROOT="/usr/local"
3427 else
3428 KRB5ROOT=${withval}
3429 fi
3430
Tim Rice648f8762011-01-26 12:38:57 -08003431 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003432 KRB5_MSG="yes"
3433
Tim Rice648f8762011-01-26 12:38:57 -08003434 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003435 [$KRB5ROOT/bin/krb5-config],
3436 [$KRB5ROOT/bin:$PATH])
3437 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003438
Tim Rice648f8762011-01-26 12:38:57 -08003439 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003440 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003441 AC_MSG_RESULT([yes])
3442 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003443 [Define this if you want GSSAPI
3444 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003445 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003446 else
Tim Rice648f8762011-01-26 12:38:57 -08003447 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003448 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003449 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003450 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3451 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003452 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003453 AC_MSG_CHECKING([whether we are using Heimdal])
3454 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3455 ]], [[ char *tmp = heimdal_version; ]])],
3456 [ AC_MSG_RESULT([yes])
3457 AC_DEFINE([HEIMDAL], [1],
3458 [Define this if you are using the Heimdal
3459 version of Kerberos V5]) ],
3460 [AC_MSG_RESULT([no])
3461 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003462 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003463 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003464 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003465 AC_MSG_CHECKING([whether we are using Heimdal])
3466 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3467 ]], [[ char *tmp = heimdal_version; ]])],
3468 [ AC_MSG_RESULT([yes])
3469 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003470 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003471 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003472 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003473 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003474 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003475 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003476 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003477 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003478
3479 ])
3480 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003481
Tim Rice648f8762011-01-26 12:38:57 -08003482 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3483 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003484 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003485 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3486 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003487 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003488 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3489 $K5LIBS)
3490 ],
3491 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003492
Tim Rice648f8762011-01-26 12:38:57 -08003493 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003494 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003495 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003496 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003497 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003498 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003499 ]
3500 )
3501
3502 oldCPP="$CPPFLAGS"
3503 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003504 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003505 [ CPPFLAGS="$oldCPP" ])
3506
Damien Millera8e06ce2003-11-21 23:48:55 +11003507 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003508 if test ! -z "$need_dash_r" ; then
3509 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3510 fi
3511 if test ! -z "$blibpath" ; then
3512 blibpath="$blibpath:${KRB5ROOT}/lib"
3513 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003514
Tim Rice648f8762011-01-26 12:38:57 -08003515 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3516 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3517 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003518
3519 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003520 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3521 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003522 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003523 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003524)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003525
Damien Millera22ba012000-03-02 23:09:20 +11003526# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003527
Damien Millerf58c6722002-05-13 13:15:42 +10003528PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003529AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003530 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003531 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003532 if test -n "$withval" && test "x$withval" != "xno" && \
3533 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003534 PRIVSEP_PATH=$withval
3535 fi
3536 ]
3537)
Tim Rice648f8762011-01-26 12:38:57 -08003538AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003539
Tim Rice648f8762011-01-26 12:38:57 -08003540AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003541 [ --with-xauth=PATH Specify path to xauth program ],
3542 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003543 if test -n "$withval" && test "x$withval" != "xno" && \
3544 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003545 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003546 fi
3547 ],
3548 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003549 TestPath="$PATH"
3550 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3551 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3552 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3553 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003554 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003555 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003556 xauth_path="/usr/openwin/bin/xauth"
3557 fi
3558 ]
3559)
3560
Damien Miller7d901272003-01-13 16:55:22 +11003561STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003562AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003563 [ --disable-strip Disable calling strip(1) on install],
3564 [
3565 if test "x$enableval" = "xno" ; then
3566 STRIP_OPT=
3567 fi
3568 ]
3569)
Tim Rice648f8762011-01-26 12:38:57 -08003570AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003571
Damien Millera19cf472000-11-29 13:28:50 +11003572if test -z "$xauth_path" ; then
3573 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003574 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003575else
Tim Rice648f8762011-01-26 12:38:57 -08003576 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003577 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003578 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003579 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003580fi
Damien Millera22ba012000-03-02 23:09:20 +11003581
3582# Check for mail directory (last resort if we cannot get it from headers)
3583if test ! -z "$MAIL" ; then
3584 maildir=`dirname $MAIL`
Tim Rice648f8762011-01-26 12:38:57 -08003585 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"],
Tim Rice7df8d392005-09-19 09:33:39 -07003586 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003587fi
3588
Darren Tucker623d92f2004-09-12 22:36:15 +10003589if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003590 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3591 disable_ptmx_check=yes
3592fi
Damien Millera22ba012000-03-02 23:09:20 +11003593if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003594 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003595 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003596 [
Tim Rice648f8762011-01-26 12:38:57 -08003597 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003598 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003599 have_dev_ptmx=1
3600 ]
3601 )
3602 fi
Damien Millera22ba012000-03-02 23:09:20 +11003603fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003604
Darren Tucker623d92f2004-09-12 22:36:15 +10003605if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003606 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003607 [
Tim Rice648f8762011-01-26 12:38:57 -08003608 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003609 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003610 have_dev_ptc=1
3611 ]
3612 )
3613else
3614 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3615fi
Damien Miller204ad072000-03-02 23:56:12 +11003616
Damien Millera22ba012000-03-02 23:09:20 +11003617# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003618AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003619 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003620 [
Damien Miller897741e2001-04-16 10:41:46 +10003621 case "$withval" in
3622 man|cat|doc)
3623 MANTYPE=$withval
3624 ;;
3625 *)
Tim Rice648f8762011-01-26 12:38:57 -08003626 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003627 ;;
3628 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003629 ]
3630)
Ben Lindstrombc709922001-04-18 18:04:21 +00003631if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003632 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003633 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003634 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3635 MANTYPE=doc
3636 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3637 MANTYPE=man
3638 else
3639 MANTYPE=cat
3640 fi
3641fi
Tim Rice648f8762011-01-26 12:38:57 -08003642AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003643if test "$MANTYPE" = "doc"; then
3644 mansubdir=man;
3645else
3646 mansubdir=$MANTYPE;
3647fi
Tim Rice648f8762011-01-26 12:38:57 -08003648AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003649
Damien Millera22ba012000-03-02 23:09:20 +11003650# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003651MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003652AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003653 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003654 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003655 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003656 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003657 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003658 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003659 fi
3660 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003661)
3662
Damien Millera22ba012000-03-02 23:09:20 +11003663# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003664AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003665 [ --without-shadow Disable shadow password support],
3666 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003667 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003668 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003669 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003670 fi
3671 ]
3672)
3673
Damien Miller1f335fb2000-06-26 11:31:33 +10003674if test -z "$disable_shadow" ; then
3675 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003676 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003677#include <sys/types.h>
3678#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003679struct spwd sp;
3680 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3681 [ sp_expire_available=yes ], [
3682 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003683
3684 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003685 AC_MSG_RESULT([yes])
3686 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003687 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003688 else
Tim Rice648f8762011-01-26 12:38:57 -08003689 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003690 fi
3691fi
3692
Damien Millera22ba012000-03-02 23:09:20 +11003693# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003694if test ! -z "$IPADDR_IN_DISPLAY" ; then
3695 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003696 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003697 [Define if you need to use IP address
3698 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003699else
Damien Millera8e06ce2003-11-21 23:48:55 +11003700 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003701 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003702 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3703 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003704 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003705 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003706 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003707 fi
3708 ]
3709 )
3710fi
Damien Miller76112de1999-12-21 11:18:08 +11003711
Darren Tuckere1a790d2003-09-16 11:52:19 +10003712# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003713AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003714 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003715 [ if test "x$enableval" = "xno"; then
3716 AC_MSG_NOTICE([/etc/default/login handling disabled])
3717 etc_default_login=no
3718 else
3719 etc_default_login=yes
3720 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003721 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3722 then
3723 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3724 etc_default_login=no
3725 else
3726 etc_default_login=yes
3727 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003728)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003729
Darren Tucker2f9573d2005-02-10 22:28:54 +11003730if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003731 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003732 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003733 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003734 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003735 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003736 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003737fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003738
Tim Rice43a1c132002-04-17 21:19:14 -07003739dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003740if test $ac_cv_func_login_getcapbool = "yes" && \
3741 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003742 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003743fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003744
Damien Millera22ba012000-03-02 23:09:20 +11003745# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003746SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003747AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003748 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003749 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003750 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003751 AC_MSG_WARN([
3752--with-default-path=PATH has no effect on this system.
3753Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003754 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003755 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003756 AC_MSG_WARN([
3757--with-default-path=PATH will only be used if PATH is not defined in
3758$external_path_file .])
3759 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003760 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003761 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003762 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003763 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003764 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3765 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003766 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003767 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003768 AC_MSG_WARN([
3769If PATH is defined in $external_path_file, ensure the path to scp is included,
3770otherwise scp will not work.])
3771 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003772 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003773 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003774/* find out what STDPATH is */
3775#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003776#ifdef HAVE_PATHS_H
3777# include <paths.h>
3778#endif
3779#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003780# ifdef _PATH_USERPATH /* Irix */
3781# define _PATH_STDPATH _PATH_USERPATH
3782# else
3783# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3784# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003785#endif
3786#include <sys/types.h>
3787#include <sys/stat.h>
3788#include <fcntl.h>
3789#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003790 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003791 FILE *fd;
3792 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003793
Tim Rice59ea0a02001-03-10 13:50:45 -08003794 fd = fopen(DATA,"w");
3795 if(fd == NULL)
3796 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003797
Tim Rice59ea0a02001-03-10 13:50:45 -08003798 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3799 exit(1);
3800
3801 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003802 ]])],
3803 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003804 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3805 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3806 )
3807# make sure $bindir is in USER_PATH so scp will work
3808 t_bindir=`eval echo ${bindir}`
3809 case $t_bindir in
3810 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3811 esac
3812 case $t_bindir in
3813 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3814 esac
3815 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3816 if test $? -ne 0 ; then
3817 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3818 if test $? -ne 0 ; then
3819 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003820 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003821 fi
3822 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003823 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003824)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003825if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003826 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3827 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003828fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003829
Damien Millera18bbd32002-05-13 10:48:57 +10003830# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003831AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003832 [ --with-superuser-path= Specify different path for super-user],
3833 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003834 if test -n "$withval" && test "x$withval" != "xno" && \
3835 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003836 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003837 [Define if you want a different $PATH
3838 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003839 superuser_path=$withval
3840 fi
3841 ]
3842)
3843
3844
Damien Miller61e50f12000-05-08 20:49:37 +10003845AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003846IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003847AC_ARG_WITH(4in6,
3848 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3849 [
3850 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003851 AC_MSG_RESULT([yes])
3852 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003853 [Detect IPv4 in IPv6 mapped addresses
3854 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003855 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003856 else
Tim Rice648f8762011-01-26 12:38:57 -08003857 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003858 fi
Tim Rice648f8762011-01-26 12:38:57 -08003859 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003860 if test "x$inet6_default_4in6" = "xyes"; then
3861 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003862 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003863 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003864 else
3865 AC_MSG_RESULT([no (default)])
3866 fi
3867 ]
3868)
3869
Damien Miller60396b02001-02-18 17:01:00 +11003870# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003871BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003872AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003873 [ --with-bsd-auth Enable BSD auth support],
3874 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003875 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003876 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003877 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003878 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003879 fi
3880 ]
3881)
3882
Damien Millera22ba012000-03-02 23:09:20 +11003883# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003884piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003885# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003886if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003887 piddir=`eval echo ${sysconfdir}`
3888 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003889 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003890 esac
3891fi
3892
Tim Rice648f8762011-01-26 12:38:57 -08003893AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003894 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3895 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003896 if test -n "$withval" && test "x$withval" != "xno" && \
3897 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003898 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003899 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003900 AC_MSG_WARN([** no $piddir directory on this system **])
3901 fi
3902 fi
3903 ]
3904)
3905
Tim Rice648f8762011-01-26 12:38:57 -08003906AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3907 [Specify location of ssh.pid])
3908AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003909
andre2ff7b5d2000-06-03 14:57:40 +00003910dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003911AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003912 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003913 [
3914 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003915 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003916 fi
3917 ]
andre2ff7b5d2000-06-03 14:57:40 +00003918)
Tim Rice648f8762011-01-26 12:38:57 -08003919AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003920 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003921 [
3922 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003923 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003924 fi
3925 ]
andre2ff7b5d2000-06-03 14:57:40 +00003926)
Tim Rice648f8762011-01-26 12:38:57 -08003927AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00003928 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003929 [
3930 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003931 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003932 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003933 fi
3934 ]
andre2ff7b5d2000-06-03 14:57:40 +00003935)
Tim Rice648f8762011-01-26 12:38:57 -08003936AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00003937 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003938 [
3939 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003940 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003941 fi
3942 ]
andre2ff7b5d2000-06-03 14:57:40 +00003943)
Tim Rice648f8762011-01-26 12:38:57 -08003944AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00003945 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003946 [
3947 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003948 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003949 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003950 fi
3951 ]
andre2ff7b5d2000-06-03 14:57:40 +00003952)
Tim Rice648f8762011-01-26 12:38:57 -08003953AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00003954 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003955 [
3956 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003957 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10003958 fi
3959 ]
andre2ff7b5d2000-06-03 14:57:40 +00003960)
Tim Rice648f8762011-01-26 12:38:57 -08003961AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00003962 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003963 [
3964 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003965 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003966 [Define if you don't want to use pututline()
3967 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003968 fi
3969 ]
andre2ff7b5d2000-06-03 14:57:40 +00003970)
Tim Rice648f8762011-01-26 12:38:57 -08003971AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00003972 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003973 [
3974 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003975 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003976 [Define if you don't want to use pututxline()
3977 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003978 fi
3979 ]
andre2ff7b5d2000-06-03 14:57:40 +00003980)
Tim Rice648f8762011-01-26 12:38:57 -08003981AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003982 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003983 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003984 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003985 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08003986 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003987 conf_lastlog_location=$withval
3988 fi
3989 ]
3990)
andre2ff7b5d2000-06-03 14:57:40 +00003991
3992dnl lastlog, [uw]tmpx? detection
3993dnl NOTE: set the paths in the platform section to avoid the
3994dnl need for command-line parameters
3995dnl lastlog and [uw]tmp are subject to a file search if all else fails
3996
3997dnl lastlog detection
3998dnl NOTE: the code itself will detect if lastlog is a directory
3999AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004000AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004001#include <sys/types.h>
4002#include <utmp.h>
4003#ifdef HAVE_LASTLOG_H
4004# include <lastlog.h>
4005#endif
Damien Miller2994e082000-06-04 15:51:47 +10004006#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004007# include <paths.h>
4008#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004009#ifdef HAVE_LOGIN_H
4010# include <login.h>
4011#endif
Tim Rice648f8762011-01-26 12:38:57 -08004012 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
4013 [ AC_MSG_RESULT([yes]) ],
4014 [
4015 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004016 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08004017 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10004018#include <sys/types.h>
4019#include <utmp.h>
4020#ifdef HAVE_LASTLOG_H
4021# include <lastlog.h>
4022#endif
4023#ifdef HAVE_PATHS_H
4024# include <paths.h>
4025#endif
Tim Rice648f8762011-01-26 12:38:57 -08004026 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
4027 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10004028 [
Tim Rice648f8762011-01-26 12:38:57 -08004029 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10004030 system_lastlog_path=no
4031 ])
Tim Rice648f8762011-01-26 12:38:57 -08004032])
Damien Miller2994e082000-06-04 15:51:47 +10004033
andre2ff7b5d2000-06-03 14:57:40 +00004034if test -z "$conf_lastlog_location"; then
4035 if test x"$system_lastlog_path" = x"no" ; then
4036 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004037 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004038 conf_lastlog_location=$f
4039 fi
4040 done
4041 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004042 AC_MSG_WARN([** Cannot find lastlog **])
4043 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004044 fi
4045 fi
4046fi
4047
4048if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004049 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004050 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004051fi
andre2ff7b5d2000-06-03 14:57:40 +00004052
4053dnl utmp detection
4054AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004055AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004056#include <sys/types.h>
4057#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004058#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004059# include <paths.h>
4060#endif
Tim Rice648f8762011-01-26 12:38:57 -08004061 ]], [[ char *utmp = UTMP_FILE; ]])],
4062 [ AC_MSG_RESULT([yes]) ],
4063 [ AC_MSG_RESULT([no])
4064 system_utmp_path=no
4065])
andre2ff7b5d2000-06-03 14:57:40 +00004066if test -z "$conf_utmp_location"; then
4067 if test x"$system_utmp_path" = x"no" ; then
4068 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4069 if test -f $f ; then
4070 conf_utmp_location=$f
4071 fi
4072 done
4073 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004074 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004075 fi
4076 fi
4077fi
4078if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004079 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004080 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004081fi
andre2ff7b5d2000-06-03 14:57:40 +00004082
4083dnl wtmp detection
4084AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004085AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004086#include <sys/types.h>
4087#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004088#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004089# include <paths.h>
4090#endif
Tim Rice648f8762011-01-26 12:38:57 -08004091 ]], [[ char *wtmp = WTMP_FILE; ]])],
4092 [ AC_MSG_RESULT([yes]) ],
4093 [ AC_MSG_RESULT([no])
4094 system_wtmp_path=no
4095])
andre2ff7b5d2000-06-03 14:57:40 +00004096if test -z "$conf_wtmp_location"; then
4097 if test x"$system_wtmp_path" = x"no" ; then
4098 for f in /usr/adm/wtmp /var/log/wtmp; do
4099 if test -f $f ; then
4100 conf_wtmp_location=$f
4101 fi
4102 done
4103 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004104 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004105 fi
4106 fi
4107fi
4108if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004109 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004110 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004111fi
andre2ff7b5d2000-06-03 14:57:40 +00004112
4113
andre2ff7b5d2000-06-03 14:57:40 +00004114dnl wtmpx detection
4115AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004116AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004117#include <sys/types.h>
4118#include <utmp.h>
4119#ifdef HAVE_UTMPX_H
4120#include <utmpx.h>
4121#endif
Damien Miller2994e082000-06-04 15:51:47 +10004122#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004123# include <paths.h>
4124#endif
Tim Rice648f8762011-01-26 12:38:57 -08004125 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4126 [ AC_MSG_RESULT([yes]) ],
4127 [ AC_MSG_RESULT([no])
4128 system_wtmpx_path=no
4129])
andre2ff7b5d2000-06-03 14:57:40 +00004130if test -z "$conf_wtmpx_location"; then
4131 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004132 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004133 fi
4134else
Tim Rice648f8762011-01-26 12:38:57 -08004135 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004136 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004137fi
andre2ff7b5d2000-06-03 14:57:40 +00004138
Damien Miller4018c192000-04-30 09:30:44 +10004139
Damien Miller29ea30d2000-03-17 10:54:15 +11004140if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004141 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4142 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004143fi
4144
Darren Tucker7da23cb2005-08-03 00:20:15 +10004145dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4146dnl Add now.
4147CFLAGS="$CFLAGS $werror_flags"
4148
Darren Tucker627337d2010-04-10 22:58:01 +10004149if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4150 TEST_SSH_IPV6=no
4151else
4152 TEST_SSH_IPV6=yes
4153fi
Tim Rice648f8762011-01-26 12:38:57 -08004154AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4155AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004156
Damien Millerbac2d8a2000-09-05 16:13:06 +11004157AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004158AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4159 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerd8f60022010-02-12 09:34:22 +11004160 ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004161AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004162
Damien Miller7b22d652000-06-18 14:07:04 +10004163# Print summary of options
4164
Damien Miller7b22d652000-06-18 14:07:04 +10004165# Someone please show me a better way :)
4166A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4167B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4168C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4169D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004170E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004171F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004172G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004173H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4174I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4175J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004176
4177echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004178echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004179echo " User binaries: $B"
4180echo " System binaries: $C"
4181echo " Configuration files: $D"
4182echo " Askpass program: $E"
4183echo " Manual pages: $F"
4184echo " PID file: $G"
4185echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004186if test "x$external_path_file" = "x/etc/login.conf" ; then
4187echo " At runtime, sshd will use the path defined in $external_path_file"
4188echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004189else
Damien Millerf58c6722002-05-13 13:15:42 +10004190echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004191 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004192echo " (If PATH is set in $external_path_file it will be used instead. If"
4193echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4194 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004195fi
Damien Millera18bbd32002-05-13 10:48:57 +10004196if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004197echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004198fi
Damien Millerf58c6722002-05-13 13:15:42 +10004199echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004200echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004201echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004202echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004203echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004204echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004205echo " S/KEY support: $SKEY_MSG"
4206echo " TCP Wrappers support: $TCPW_MSG"
4207echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004208echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004209echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004210echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004211echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004212echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4213echo " BSD Auth support: $BSD_AUTH_MSG"
4214echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004215if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004216echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004217fi
4218
Damien Miller7b22d652000-06-18 14:07:04 +10004219echo ""
4220
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004221echo " Host: ${host}"
4222echo " Compiler: ${CC}"
4223echo " Compiler flags: ${CFLAGS}"
4224echo "Preprocessor flags: ${CPPFLAGS}"
4225echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004226echo " Libraries: ${LIBS}"
4227if test ! -z "${SSHDLIBS}"; then
4228echo " +for sshd: ${SSHDLIBS}"
4229fi
Damien Miller71adf122011-01-25 12:16:15 +11004230if test ! -z "${SSHLIBS}"; then
4231echo " +for ssh: ${SSHLIBS}"
4232fi
Damien Miller7b22d652000-06-18 14:07:04 +10004233
4234echo ""
4235
Tim Rice6f1f7582004-05-30 21:38:51 -07004236if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004237 echo "SVR4 style packages are supported with \"make package\""
4238 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004239fi
4240
Damien Miller82cf0ce2000-12-20 13:34:48 +11004241if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004242 echo "PAM is enabled. You may need to install a PAM control file "
4243 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004244 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004245 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004246 echo ""
4247fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004248
Damien Miller6c21c512002-01-22 21:57:53 +11004249if test ! -z "$RAND_HELPER_CMDHASH" ; then
4250 echo "WARNING: you are using the builtin random number collection "
4251 echo "service. Please read WARNING.RNG and request that your OS "
4252 echo "vendor includes kernel-based random number collection in "
4253 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004254 echo ""
4255fi
Damien Miller60396b02001-02-18 17:01:00 +11004256
Damien Millerb4097182004-05-23 14:09:40 +10004257if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004258 echo "WARNING: the operating system that you are using does not"
4259 echo "appear to support getpeereid(), getpeerucred() or the"
4260 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4261 echo "enforce security checks to prevent unauthorised connections to"
4262 echo "ssh-agent. Their absence increases the risk that a malicious"
4263 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004264 echo ""
4265fi
4266
Darren Tuckerd9f88912005-02-20 21:01:48 +11004267if test "$AUDIT_MODULE" = "bsm" ; then
4268 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4269 echo "See the Solaris section in README.platform for details."
4270fi