blob: 573c09710318e3cc3a8b2814300ace2c732c30fc [file] [log] [blame]
Damien Millerf22019b2011-05-05 13:48:37 +10001# $Id: configure.ac,v 1.472 2011/05/05 03:48:37 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice648f8762011-01-26 12:38:57 -080017AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org])
Damien Millerf22019b2011-05-05 13:48:37 +100018AC_REVISION($Revision: 1.472 $)
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])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002302 ],
2303 [
2304 AC_MSG_WARN([cross compiling: assuming yes])
Damien Millerf22019b2011-05-05 13:48:37 +10002305 # This is safe, since we will fatal() at runtime if
2306 # OpenSSL is not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002307 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002308 ]
2309)
2310
Damien Millerf22019b2011-05-05 13:48:37 +10002311# PRNGD TCP socket
2312AC_ARG_WITH([prngd-port],
2313 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2314 [
2315 case "$withval" in
2316 no)
2317 withval=""
2318 ;;
2319 [[0-9]]*)
2320 ;;
2321 *)
2322 AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port])
2323 ;;
2324 esac
2325 if test ! -z "$withval" ; then
2326 PRNGD_PORT="$withval"
2327 AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT],
2328 [Port number of PRNGD/EGD random number socket])
2329 fi
2330 ]
2331)
2332
2333# PRNGD Unix domain socket
2334AC_ARG_WITH([prngd-socket],
2335 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2336 [
2337 case "$withval" in
2338 yes)
2339 withval="/var/run/egd-pool"
2340 ;;
2341 no)
2342 withval=""
2343 ;;
2344 /*)
2345 ;;
2346 *)
2347 AC_MSG_ERROR([You must specify an absolute path to the entropy socket])
2348 ;;
2349 esac
2350
2351 if test ! -z "$withval" ; then
2352 if test ! -z "$PRNGD_PORT" ; then
2353 AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket])
2354 fi
2355 if test ! -r "$withval" ; then
2356 AC_MSG_WARN([Entropy socket is not readable])
2357 fi
2358 PRNGD_SOCKET="$withval"
2359 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"],
2360 [Location of PRNGD/EGD random number socket])
2361 fi
2362 ],
2363 [
2364 # Check for existing socket only if we don't have a random device already
2365 if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then
2366 AC_MSG_CHECKING([for PRNGD/EGD socket])
2367 # Insert other locations here
2368 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2369 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2370 PRNGD_SOCKET="$sock"
2371 AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"])
2372 break;
2373 fi
2374 done
2375 if test ! -z "$PRNGD_SOCKET" ; then
2376 AC_MSG_RESULT([$PRNGD_SOCKET])
2377 else
2378 AC_MSG_RESULT([not found])
2379 fi
2380 fi
2381 ]
2382)
2383
2384# Which randomness source do we use?
2385if test ! -z "$PRNGD_PORT" ; then
2386 RAND_MSG="PRNGd port $PRNGD_PORT"
2387elif test ! -z "$PRNGD_SOCKET" ; then
2388 RAND_MSG="PRNGd socket $PRNGD_SOCKET"
2389elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then
2390 AC_DEFINE([OPENSSL_PRNG_ONLY], [1],
2391 [Define if you want OpenSSL's internally seeded PRNG only])
2392 RAND_MSG="OpenSSL internal ONLY"
2393else
2394 AC_MSG_ERROR([OpenSSH has no source of random numbers. Please configure OpenSSL with an entropy source or re-run configure using one of the --with-prngd-port or --with-prngd-socket options])
2395fi
2396
Darren Tucker3e6bde42006-08-20 20:03:50 +10002397# Check for PAM libs
2398PAM_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08002399AC_ARG_WITH([pam],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002400 [ --with-pam Enable PAM support ],
2401 [
2402 if test "x$withval" != "xno" ; then
2403 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2404 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2405 AC_MSG_ERROR([PAM headers not found])
2406 fi
2407
2408 saved_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08002409 AC_CHECK_LIB([dl], [dlopen], , )
2410 AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])])
2411 AC_CHECK_FUNCS([pam_getenvlist])
2412 AC_CHECK_FUNCS([pam_putenv])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002413 LIBS="$saved_LIBS"
2414
2415 PAM_MSG="yes"
2416
Darren Tucker20e9f972007-03-25 18:26:01 +10002417 SSHDLIBS="$SSHDLIBS -lpam"
Tim Rice648f8762011-01-26 12:38:57 -08002418 AC_DEFINE([USE_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002419 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002420
Darren Tucker3e6bde42006-08-20 20:03:50 +10002421 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002422 case "$LIBS" in
2423 *-ldl*)
2424 # libdl already in LIBS
2425 ;;
2426 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002427 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002428 ;;
2429 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002430 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002431 fi
2432 ]
2433)
2434
2435# Check for older PAM
2436if test "x$PAM_MSG" = "xyes" ; then
2437 # Check PAM strerror arguments (old PAM)
2438 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
Tim Rice648f8762011-01-26 12:38:57 -08002439 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker3e6bde42006-08-20 20:03:50 +10002440#include <stdlib.h>
2441#if defined(HAVE_SECURITY_PAM_APPL_H)
2442#include <security/pam_appl.h>
2443#elif defined (HAVE_PAM_PAM_APPL_H)
2444#include <pam/pam_appl.h>
2445#endif
Tim Rice648f8762011-01-26 12:38:57 -08002446 ]], [[
2447(void)pam_strerror((pam_handle_t *)NULL, -1);
2448 ]])], [AC_MSG_RESULT([no])], [
2449 AC_DEFINE([HAVE_OLD_PAM], [1],
Darren Tucker3e6bde42006-08-20 20:03:50 +10002450 [Define if you have an old version of PAM
2451 which takes only one argument to pam_strerror])
Tim Rice648f8762011-01-26 12:38:57 -08002452 AC_MSG_RESULT([yes])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002453 PAM_MSG="yes (old library)"
Tim Rice648f8762011-01-26 12:38:57 -08002454
2455 ])
Darren Tucker3e6bde42006-08-20 20:03:50 +10002456fi
Damien Miller6c21c512002-01-22 21:57:53 +11002457
Damien Millerd3f6ad22002-06-25 10:24:47 +10002458SSH_PRIVSEP_USER=sshd
Tim Rice648f8762011-01-26 12:38:57 -08002459AC_ARG_WITH([privsep-user],
Kevin Stevesc81e1292002-05-13 03:51:40 +00002460 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002461 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002462 if test -n "$withval" && test "x$withval" != "xno" && \
2463 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002464 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002465 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002466 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002467)
Tim Rice648f8762011-01-26 12:38:57 -08002468AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"],
Tim Rice7df8d392005-09-19 09:33:39 -07002469 [non-privileged user for privilege separation])
Tim Rice648f8762011-01-26 12:38:57 -08002470AC_SUBST([SSH_PRIVSEP_USER])
Kevin Steves7ff91122002-04-07 19:22:54 +00002471
Ben Lindstromb5628642000-10-18 00:02:25 +00002472# Cheap hack to ensure NEWS-OS libraries are arranged right.
2473if test ! -z "$SONY" ; then
2474 LIBS="$LIBS -liberty";
2475fi
2476
Damien Miller57f39152005-11-24 19:58:19 +11002477# Check for long long datatypes
2478AC_CHECK_TYPES([long long, unsigned long long, long double])
2479
2480# Check datatype sizes
Tim Rice648f8762011-01-26 12:38:57 -08002481AC_CHECK_SIZEOF([char], [1])
2482AC_CHECK_SIZEOF([short int], [2])
2483AC_CHECK_SIZEOF([int], [4])
2484AC_CHECK_SIZEOF([long int], [4])
2485AC_CHECK_SIZEOF([long long int], [8])
Damien Millerc6398ef1999-11-20 12:18:40 +11002486
Damien Millerfa2bb692002-04-23 23:22:25 +10002487# Sanity check long long for some platforms (AIX)
2488if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2489 ac_cv_sizeof_long_long_int=0
2490fi
2491
Darren Tucker537f1ed2005-10-25 18:38:33 +10002492# compute LLONG_MIN and LLONG_MAX if we don't know them.
2493if test -z "$have_llong_max"; then
2494 AC_MSG_CHECKING([for max value of long long])
2495 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08002496 [AC_LANG_PROGRAM([[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002497#include <stdio.h>
2498/* Why is this so damn hard? */
2499#ifdef __GNUC__
2500# undef __GNUC__
2501#endif
2502#define __USE_ISOC99
2503#include <limits.h>
2504#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002505#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2506
2507/*
2508 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2509 * we do this the hard way.
2510 */
2511static int
2512fprint_ll(FILE *f, long long n)
2513{
2514 unsigned int i;
2515 int l[sizeof(long long) * 8];
2516
2517 if (n < 0)
2518 if (fprintf(f, "-") < 0)
2519 return -1;
2520 for (i = 0; n != 0; i++) {
2521 l[i] = my_abs(n % 10);
2522 n /= 10;
2523 }
2524 do {
2525 if (fprintf(f, "%d", l[--i]) < 0)
2526 return -1;
2527 } while (i != 0);
2528 if (fprintf(f, " ") < 0)
2529 return -1;
2530 return 0;
2531}
Tim Rice648f8762011-01-26 12:38:57 -08002532 ]], [[
Darren Tucker537f1ed2005-10-25 18:38:33 +10002533 FILE *f;
2534 long long i, llmin, llmax = 0;
2535
2536 if((f = fopen(DATA,"w")) == NULL)
2537 exit(1);
2538
2539#if defined(LLONG_MIN) && defined(LLONG_MAX)
2540 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2541 llmin = LLONG_MIN;
2542 llmax = LLONG_MAX;
2543#else
2544 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2545 /* This will work on one's complement and two's complement */
2546 for (i = 1; i > llmax; i <<= 1, i++)
2547 llmax = i;
2548 llmin = llmax + 1LL; /* wrap */
2549#endif
2550
2551 /* Sanity check */
2552 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002553 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2554 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002555 fprintf(f, "unknown unknown\n");
2556 exit(2);
2557 }
2558
Darren Tuckerd1450db2006-03-13 19:06:51 +11002559 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002560 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002561 if (fprint_ll(f, llmax) < 0)
2562 exit(4);
2563 if (fclose(f) < 0)
2564 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002565 exit(0);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002566 ]])],
2567 [
2568 llong_min=`$AWK '{print $1}' conftest.llminmax`
2569 llong_max=`$AWK '{print $2}' conftest.llminmax`
2570
Tim Rice648f8762011-01-26 12:38:57 -08002571 AC_MSG_RESULT([$llong_max])
2572 AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002573 [max value of long long calculated by configure])
2574 AC_MSG_CHECKING([for min value of long long])
Tim Rice648f8762011-01-26 12:38:57 -08002575 AC_MSG_RESULT([$llong_min])
2576 AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL],
Darren Tucker537f1ed2005-10-25 18:38:33 +10002577 [min value of long long calculated by configure])
2578 ],
2579 [
Tim Rice648f8762011-01-26 12:38:57 -08002580 AC_MSG_RESULT([not found])
Darren Tucker537f1ed2005-10-25 18:38:33 +10002581 ],
2582 [
2583 AC_MSG_WARN([cross compiling: not checking])
2584 ]
2585 )
2586fi
2587
2588
Damien Millera22ba012000-03-02 23:09:20 +11002589# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002590AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
Tim Rice648f8762011-01-26 12:38:57 -08002591 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2592 [[ u_int a; a = 1;]])],
2593 [ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no"
2594 ])
Damien Millercaf6dd62000-08-29 11:33:50 +11002595])
2596if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002597 AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002598 have_u_int=1
2599fi
2600
Damien Miller61e50f12000-05-08 20:49:37 +10002601AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002602 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2603 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
2604 [ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no"
2605 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002606])
2607if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002608 AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002609 have_intxx_t=1
2610fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002611
2612if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002613 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002614then
2615 AC_MSG_CHECKING([for intXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2617 [[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002618 [
Tim Rice648f8762011-01-26 12:38:57 -08002619 AC_DEFINE([HAVE_INTXX_T])
2620 AC_MSG_RESULT([yes])
2621 ], [ AC_MSG_RESULT([no])
2622 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002623fi
2624
Damien Miller578783e2000-09-23 14:12:24 +11002625AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002626 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Rice907881e2002-07-18 11:44:50 -07002627#include <sys/types.h>
2628#ifdef HAVE_STDINT_H
2629# include <stdint.h>
2630#endif
2631#include <sys/socket.h>
2632#ifdef HAVE_SYS_BITYPES_H
2633# include <sys/bitypes.h>
2634#endif
Tim Rice648f8762011-01-26 12:38:57 -08002635 ]], [[
2636int64_t a; a = 1;
2637 ]])],
2638 [ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no"
2639 ])
Damien Miller578783e2000-09-23 14:12:24 +11002640])
2641if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002642 AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002643fi
2644
Damien Miller61e50f12000-05-08 20:49:37 +10002645AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2647 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
2648 [ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no"
2649 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002650])
2651if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002652 AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002653 have_u_intxx_t=1
2654fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002655
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002656if test -z "$have_u_intxx_t" ; then
2657 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
Tim Rice648f8762011-01-26 12:38:57 -08002658 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]],
2659 [[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002660 [
Tim Rice648f8762011-01-26 12:38:57 -08002661 AC_DEFINE([HAVE_U_INTXX_T])
2662 AC_MSG_RESULT([yes])
2663 ], [ AC_MSG_RESULT([no])
2664 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002665fi
2666
Damien Miller578783e2000-09-23 14:12:24 +11002667AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002668 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2669 [[ u_int64_t a; a = 1;]])],
2670 [ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no"
2671 ])
Damien Miller578783e2000-09-23 14:12:24 +11002672])
2673if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002674 AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002675 have_u_int64_t=1
2676fi
2677
Tim Rice4cec93f2002-02-26 08:40:48 -08002678if test -z "$have_u_int64_t" ; then
2679 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002680 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]],
2681 [[ u_int64_t a; a = 1]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08002682 [
Tim Rice648f8762011-01-26 12:38:57 -08002683 AC_DEFINE([HAVE_U_INT64_T])
2684 AC_MSG_RESULT([yes])
2685 ], [ AC_MSG_RESULT([no])
2686 ])
Tim Rice4cec93f2002-02-26 08:40:48 -08002687fi
2688
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002689if test -z "$have_u_intxx_t" ; then
2690 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002691 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002692#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08002693 ]], [[
2694 uint8_t a;
2695 uint16_t b;
2696 uint32_t c;
2697 a = b = c = 1;
2698 ]])],
2699 [ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no"
2700 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002701 ])
2702 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002703 AC_DEFINE([HAVE_UINTXX_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002704 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002705 fi
2706fi
2707
2708if test -z "$have_uintxx_t" ; then
2709 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
Tim Rice648f8762011-01-26 12:38:57 -08002710 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]],
2711 [[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002712 [
Tim Rice648f8762011-01-26 12:38:57 -08002713 AC_DEFINE([HAVE_UINTXX_T])
2714 AC_MSG_RESULT([yes])
2715 ], [ AC_MSG_RESULT([no])
2716 ])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002717fi
2718
Damien Milleredb82922000-06-20 13:25:52 +10002719if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002720 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002721then
2722 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
Tim Rice648f8762011-01-26 12:38:57 -08002723 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller61e50f12000-05-08 20:49:37 +10002724#include <sys/bitypes.h>
Tim Rice648f8762011-01-26 12:38:57 -08002725 ]], [[
Damien Miller70494d12000-04-03 15:57:06 +10002726 int8_t a; int16_t b; int32_t c;
2727 u_int8_t e; u_int16_t f; u_int32_t g;
2728 a = b = c = e = f = g = 1;
Tim Rice648f8762011-01-26 12:38:57 -08002729 ]])],
Damien Millerb29ea912000-01-15 14:12:03 +11002730 [
Tim Rice648f8762011-01-26 12:38:57 -08002731 AC_DEFINE([HAVE_U_INTXX_T])
2732 AC_DEFINE([HAVE_INTXX_T])
2733 AC_MSG_RESULT([yes])
2734 ], [AC_MSG_RESULT([no])
2735 ])
Damien Millerb29ea912000-01-15 14:12:03 +11002736fi
2737
Damien Miller58be7382001-09-15 21:31:54 +10002738
2739AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
Tim Rice648f8762011-01-26 12:38:57 -08002740 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2741 [[ u_char foo; foo = 125; ]])],
2742 [ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no"
2743 ])
Damien Miller58be7382001-09-15 21:31:54 +10002744])
2745if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002746 AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002747fi
2748
Tim Rice13aae5e2001-10-21 17:53:58 -07002749TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002750
Tim Rice648f8762011-01-26 12:38:57 -08002751AC_CHECK_TYPES([sig_atomic_t], , , [#include <signal.h>])
2752AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [
Darren Tucker598eaa62008-06-09 03:32:29 +10002753#include <sys/types.h>
2754#ifdef HAVE_SYS_BITYPES_H
2755#include <sys/bitypes.h>
2756#endif
2757#ifdef HAVE_SYS_STATFS_H
2758#include <sys/statfs.h>
2759#endif
2760#ifdef HAVE_SYS_STATVFS_H
2761#include <sys/statvfs.h>
2762#endif
2763])
Tim Rice4cec93f2002-02-26 08:40:48 -08002764
Tim Rice648f8762011-01-26 12:38:57 -08002765AC_CHECK_TYPES([in_addr_t, in_port_t], , ,
Damien Miller848b9932005-02-24 12:12:34 +11002766[#include <sys/types.h>
2767#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002768
Damien Miller61e50f12000-05-08 20:49:37 +10002769AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002770 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2771 [[ size_t foo; foo = 1235; ]])],
2772 [ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no"
2773 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002774])
2775if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002776 AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002777fi
Damien Miller95058511999-12-29 10:36:45 +11002778
Damien Miller615f9392000-05-17 22:53:33 +10002779AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002780 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2781 [[ ssize_t foo; foo = 1235; ]])],
2782 [ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no"
2783 ])
Damien Miller615f9392000-05-17 22:53:33 +10002784])
2785if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002786 AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002787fi
2788
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002789AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]],
2791 [[ clock_t foo; foo = 1235; ]])],
2792 [ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no"
2793 ])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002794])
2795if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002796 AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002797fi
2798
Damien Millerb54b40e2000-06-23 08:23:34 +10002799AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002800 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Millerb54b40e2000-06-23 08:23:34 +10002801#include <sys/types.h>
2802#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002803 ]], [[ sa_family_t foo; foo = 1235; ]])],
2804 [ ac_cv_have_sa_family_t="yes" ],
2805 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller78315eb2000-09-29 23:01:36 +11002806#include <sys/types.h>
2807#include <sys/socket.h>
2808#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002809 ]], [[ sa_family_t foo; foo = 1235; ]])],
Damien Miller78315eb2000-09-29 23:01:36 +11002810 [ ac_cv_have_sa_family_t="yes" ],
Damien Millerb54b40e2000-06-23 08:23:34 +10002811 [ ac_cv_have_sa_family_t="no" ]
2812 )
Tim Rice648f8762011-01-26 12:38:57 -08002813 ])
Damien Millerb54b40e2000-06-23 08:23:34 +10002814])
2815if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002816 AC_DEFINE([HAVE_SA_FAMILY_T], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002817 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002818fi
2819
Damien Miller0f91b4e2000-06-18 15:43:25 +10002820AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002821 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2822 [[ pid_t foo; foo = 1235; ]])],
2823 [ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no"
2824 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002825])
2826if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002827 AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002828fi
2829
2830AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
Tim Rice648f8762011-01-26 12:38:57 -08002831 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]],
2832 [[ mode_t foo; foo = 1235; ]])],
2833 [ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no"
2834 ])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002835])
2836if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002837 AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002838fi
2839
Damien Miller61e50f12000-05-08 20:49:37 +10002840
2841AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
Tim Rice648f8762011-01-26 12:38:57 -08002842 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002843#include <sys/types.h>
2844#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002845 ]], [[ struct sockaddr_storage s; ]])],
2846 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2847 [ ac_cv_have_struct_sockaddr_storage="no"
2848 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002849])
2850if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002851 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002852 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002853fi
Damien Miller34132e52000-01-14 15:45:46 +11002854
Damien Miller61e50f12000-05-08 20:49:37 +10002855AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
Tim Rice648f8762011-01-26 12:38:57 -08002856 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002857#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002858#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002859 ]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])],
2860 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2861 [ ac_cv_have_struct_sockaddr_in6="no"
2862 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002863])
2864if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002865 AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002866 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002867fi
Damien Miller34132e52000-01-14 15:45:46 +11002868
Damien Miller61e50f12000-05-08 20:49:37 +10002869AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
Tim Rice648f8762011-01-26 12:38:57 -08002870 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller7b22d652000-06-18 14:07:04 +10002871#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002872#include <netinet/in.h>
Tim Rice648f8762011-01-26 12:38:57 -08002873 ]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])],
2874 [ ac_cv_have_struct_in6_addr="yes" ],
2875 [ ac_cv_have_struct_in6_addr="no"
2876 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002877])
2878if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002879 AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002880 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002881
2882dnl Now check for sin6_scope_id
Tim Rice648f8762011-01-26 12:38:57 -08002883 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , ,
Tim Rice0f4d2c02008-11-18 21:26:41 -08002884 [
2885#ifdef HAVE_SYS_TYPES_H
2886#include <sys/types.h>
2887#endif
2888#include <netinet/in.h>
2889 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002890fi
Damien Miller34132e52000-01-14 15:45:46 +11002891
Damien Miller61e50f12000-05-08 20:49:37 +10002892AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
Tim Rice648f8762011-01-26 12:38:57 -08002893 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002894#include <sys/types.h>
2895#include <sys/socket.h>
2896#include <netdb.h>
Tim Rice648f8762011-01-26 12:38:57 -08002897 ]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])],
2898 [ ac_cv_have_struct_addrinfo="yes" ],
2899 [ ac_cv_have_struct_addrinfo="no"
2900 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002901])
2902if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002903 AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07002904 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002905fi
2906
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002907AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
Tim Rice648f8762011-01-26 12:38:57 -08002908 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
2909 [[ struct timeval tv; tv.tv_sec = 1;]])],
2910 [ ac_cv_have_struct_timeval="yes" ],
2911 [ ac_cv_have_struct_timeval="no"
2912 ])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002913])
2914if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08002915 AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002916 have_struct_timeval=1
2917fi
2918
Tim Rice648f8762011-01-26 12:38:57 -08002919AC_CHECK_TYPES([struct timespec])
Tim Rice4e4dc562003-03-18 10:21:40 -08002920
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002921# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002922if test "x$ac_cv_have_int64_t" = "xno" && \
2923 test "x$ac_cv_sizeof_long_int" != "x8" && \
2924 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002925 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2926 echo "an alternative compiler (I.E., GCC) before continuing."
2927 echo ""
2928 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002929else
2930dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002931 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002932 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002933#include <stdio.h>
2934#include <string.h>
2935#ifdef HAVE_SNPRINTF
2936main()
2937{
2938 char buf[50];
2939 char expected_out[50];
2940 int mazsize = 50 ;
2941#if (SIZEOF_LONG_INT == 8)
2942 long int num = 0x7fffffffffffffff;
2943#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002944 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002945#endif
2946 strcpy(expected_out, "9223372036854775807");
2947 snprintf(buf, mazsize, "%lld", num);
2948 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002949 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002950 exit(0);
2951}
2952#else
2953main() { exit(0); }
2954#endif
Tim Rice648f8762011-01-26 12:38:57 -08002955 ]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002956 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002957 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002958fi
2959
Damien Miller78315eb2000-09-29 23:01:36 +11002960dnl Checks for structure members
Tim Rice648f8762011-01-26 12:38:57 -08002961OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP])
2962OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX])
2963OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX])
2964OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP])
2965OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP])
2966OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX])
2967OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP])
2968OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP])
2969OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX])
2970OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP])
2971OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX])
2972OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP])
2973OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX])
2974OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP])
2975OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP])
2976OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX])
2977OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX])
Tim Rice13aae5e2001-10-21 17:53:58 -07002978
2979AC_CHECK_MEMBERS([struct stat.st_blksize])
Tim Rice648f8762011-01-26 12:38:57 -08002980AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state],
Darren Tucker58e298d2005-11-25 13:14:58 +11002981 [Define if we don't have struct __res_state in resolv.h])],
2982[
2983#include <stdio.h>
2984#if HAVE_SYS_TYPES_H
2985# include <sys/types.h>
2986#endif
2987#include <netinet/in.h>
2988#include <arpa/nameser.h>
2989#include <resolv.h>
2990])
andre2ff7b5d2000-06-03 14:57:40 +00002991
Damien Miller61e50f12000-05-08 20:49:37 +10002992AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2993 ac_cv_have_ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08002994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10002995#include <sys/types.h>
2996#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08002997 ]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])],
2998 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2999 [ ac_cv_have_ss_family_in_struct_ss="no" ])
Damien Miller61e50f12000-05-08 20:49:37 +10003000])
3001if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003002 AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003003fi
3004
Damien Miller61e50f12000-05-08 20:49:37 +10003005AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3006 ac_cv_have___ss_family_in_struct_ss, [
Tim Rice648f8762011-01-26 12:38:57 -08003007 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller81171112000-04-23 11:14:01 +10003008#include <sys/types.h>
3009#include <sys/socket.h>
Tim Rice648f8762011-01-26 12:38:57 -08003010 ]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])],
3011 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3012 [ ac_cv_have___ss_family_in_struct_ss="no"
3013 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003014])
3015if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003016 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003017 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003018fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003019
Damien Millerad833b32000-08-23 10:46:23 +10003020AC_CACHE_CHECK([for pw_class field in struct passwd],
3021 ac_cv_have_pw_class_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003022 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3023 [[ struct passwd p; p.pw_class = 0; ]])],
3024 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3025 [ ac_cv_have_pw_class_in_struct_passwd="no"
3026 ])
Damien Millerad833b32000-08-23 10:46:23 +10003027])
3028if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003029 AC_DEFINE([HAVE_PW_CLASS_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003030 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003031fi
3032
Kevin Steves82456952001-06-22 21:14:18 +00003033AC_CACHE_CHECK([for pw_expire field in struct passwd],
3034 ac_cv_have_pw_expire_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003035 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3036 [[ struct passwd p; p.pw_expire = 0; ]])],
3037 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3038 [ ac_cv_have_pw_expire_in_struct_passwd="no"
3039 ])
Kevin Steves82456952001-06-22 21:14:18 +00003040])
3041if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003042 AC_DEFINE([HAVE_PW_EXPIRE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003043 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003044fi
3045
3046AC_CACHE_CHECK([for pw_change field in struct passwd],
3047 ac_cv_have_pw_change_in_struct_passwd, [
Tim Rice648f8762011-01-26 12:38:57 -08003048 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <pwd.h> ]],
3049 [[ struct passwd p; p.pw_change = 0; ]])],
3050 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3051 [ ac_cv_have_pw_change_in_struct_passwd="no"
3052 ])
Kevin Steves82456952001-06-22 21:14:18 +00003053])
3054if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003055 AC_DEFINE([HAVE_PW_CHANGE_IN_PASSWD], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003056 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003057fi
Damien Miller61e50f12000-05-08 20:49:37 +10003058
Tim Rice28bbb0c2002-05-27 17:37:32 -07003059dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003060AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3061 ac_cv_have_accrights_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003062 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003063#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003064#include <sys/socket.h>
3065#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003066 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003067#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003068#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003069exit(1);
3070#endif
3071struct msghdr m;
3072m.msg_accrights = 0;
3073exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003074 ]])],
Kevin Steves939c9db2002-03-22 17:23:25 +00003075 [ ac_cv_have_accrights_in_msghdr="yes" ],
3076 [ ac_cv_have_accrights_in_msghdr="no" ]
3077 )
3078])
3079if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003080 AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003081 [Define if your system uses access rights style
3082 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003083fi
3084
Tim Rice648f8762011-01-26 12:38:57 -08003085AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type])
3086AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker77001382008-06-09 06:17:53 +10003087#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003088#include <sys/stat.h>
3089#ifdef HAVE_SYS_TIME_H
3090# include <sys/time.h>
3091#endif
3092#ifdef HAVE_SYS_MOUNT_H
3093#include <sys/mount.h>
3094#endif
3095#ifdef HAVE_SYS_STATVFS_H
3096#include <sys/statvfs.h>
3097#endif
Tim Rice648f8762011-01-26 12:38:57 -08003098 ]], [[ struct statvfs s; s.f_fsid = 0; ]])],
3099 [ AC_MSG_RESULT([yes]) ],
3100 [ AC_MSG_RESULT([no])
Darren Tucker32780622009-06-16 16:11:02 +10003101
Tim Rice648f8762011-01-26 12:38:57 -08003102 AC_MSG_CHECKING([if fsid_t has member val])
3103 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003104#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003105#include <sys/statvfs.h>
3106 ]], [[ fsid_t t; t.val[0] = 0; ]])],
3107 [ AC_MSG_RESULT([yes])
3108 AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ],
3109 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003110
Tim Rice648f8762011-01-26 12:38:57 -08003111 AC_MSG_CHECKING([if f_fsid has member __val])
3112 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Darren Tucker32780622009-06-16 16:11:02 +10003113#include <sys/types.h>
Tim Rice648f8762011-01-26 12:38:57 -08003114#include <sys/statvfs.h>
3115 ]], [[ fsid_t t; t.__val[0] = 0; ]])],
3116 [ AC_MSG_RESULT([yes])
3117 AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ],
3118 [ AC_MSG_RESULT([no]) ])
Darren Tucker32780622009-06-16 16:11:02 +10003119])
Darren Tucker77001382008-06-09 06:17:53 +10003120
Kevin Stevesa44e0352002-04-07 16:18:03 +00003121AC_CACHE_CHECK([for msg_control field in struct msghdr],
3122 ac_cv_have_control_in_msghdr, [
Tim Rice648f8762011-01-26 12:38:57 -08003123 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Tim Riceae49fe62002-04-12 10:26:21 -07003124#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003125#include <sys/socket.h>
3126#include <sys/uio.h>
Tim Rice648f8762011-01-26 12:38:57 -08003127 ]], [[
Tim Rice28bbb0c2002-05-27 17:37:32 -07003128#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003129#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003130exit(1);
3131#endif
3132struct msghdr m;
3133m.msg_control = 0;
3134exit(0);
Tim Rice648f8762011-01-26 12:38:57 -08003135 ]])],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003136 [ ac_cv_have_control_in_msghdr="yes" ],
3137 [ ac_cv_have_control_in_msghdr="no" ]
3138 )
3139])
3140if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003141 AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003142 [Define if your system uses ancillary data style
3143 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003144fi
3145
Damien Miller61e50f12000-05-08 20:49:37 +10003146AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Tim Rice648f8762011-01-26 12:38:57 -08003147 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3148 [[ extern char *__progname; printf("%s", __progname); ]])],
3149 [ ac_cv_libc_defines___progname="yes" ],
3150 [ ac_cv_libc_defines___progname="no"
3151 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003152])
3153if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003154 AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003155fi
3156
Kevin Steves4846f4a2002-03-22 18:19:53 +00003157AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
Tim Rice648f8762011-01-26 12:38:57 -08003158 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3159 [[ printf("%s", __FUNCTION__); ]])],
3160 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3161 [ ac_cv_cc_implements___FUNCTION__="no"
3162 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003163])
3164if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003165 AC_DEFINE([HAVE___FUNCTION__], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003166 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003167fi
3168
3169AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
Tim Rice648f8762011-01-26 12:38:57 -08003170 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]],
3171 [[ printf("%s", __func__); ]])],
3172 [ ac_cv_cc_implements___func__="yes" ],
3173 [ ac_cv_cc_implements___func__="no"
3174 ])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003175])
3176if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003177 AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003178fi
3179
Damien Miller57f39152005-11-24 19:58:19 +11003180AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003181 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3182#include <stdarg.h>
3183va_list x,y;
3184 ]], [[ va_copy(x,y); ]])],
3185 [ ac_cv_have_va_copy="yes" ],
3186 [ ac_cv_have_va_copy="no"
3187 ])
Damien Miller57f39152005-11-24 19:58:19 +11003188])
3189if test "x$ac_cv_have_va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003190 AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003191fi
3192
3193AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
Tim Rice648f8762011-01-26 12:38:57 -08003194 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3195#include <stdarg.h>
3196va_list x,y;
3197 ]], [[ __va_copy(x,y); ]])],
3198 [ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no"
3199 ])
Damien Miller57f39152005-11-24 19:58:19 +11003200])
3201if test "x$ac_cv_have___va_copy" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003202 AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists])
Damien Miller57f39152005-11-24 19:58:19 +11003203fi
3204
Damien Miller4f8e6692001-07-14 13:22:53 +10003205AC_CACHE_CHECK([whether getopt has optreset support],
3206 ac_cv_have_getopt_optreset, [
Tim Rice648f8762011-01-26 12:38:57 -08003207 AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]],
3208 [[ extern int optreset; optreset = 0; ]])],
3209 [ ac_cv_have_getopt_optreset="yes" ],
3210 [ ac_cv_have_getopt_optreset="no"
3211 ])
Damien Miller4f8e6692001-07-14 13:22:53 +10003212])
3213if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003214 AC_DEFINE([HAVE_GETOPT_OPTRESET], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003215 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003216fi
Damien Millera22ba012000-03-02 23:09:20 +11003217
Damien Millerecbb26d2000-07-15 14:59:14 +10003218AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Tim Rice648f8762011-01-26 12:38:57 -08003219 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3220[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])],
3221 [ ac_cv_libc_defines_sys_errlist="yes" ],
3222 [ ac_cv_libc_defines_sys_errlist="no"
3223 ])
Damien Millerecbb26d2000-07-15 14:59:14 +10003224])
3225if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003226 AC_DEFINE([HAVE_SYS_ERRLIST], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003227 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003228fi
3229
3230
Damien Miller11fa2cc2000-08-16 10:35:58 +10003231AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Tim Rice648f8762011-01-26 12:38:57 -08003232 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
3233[[ extern int sys_nerr; printf("%i", sys_nerr);]])],
3234 [ ac_cv_libc_defines_sys_nerr="yes" ],
3235 [ ac_cv_libc_defines_sys_nerr="no"
3236 ])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003237])
3238if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003239 AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003240fi
3241
Darren Tucker5f88d342003-10-15 16:57:57 +10003242# Check libraries needed by DNS fingerprint support
Tim Rice648f8762011-01-26 12:38:57 -08003243AC_SEARCH_LIBS([getrrsetbyname], [resolv],
3244 [AC_DEFINE([HAVE_GETRRSETBYNAME], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003245 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003246 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003247 # Needed by our getrrsetbyname()
Tim Rice648f8762011-01-26 12:38:57 -08003248 AC_SEARCH_LIBS([res_query], [resolv])
3249 AC_SEARCH_LIBS([dn_expand], [resolv])
3250 AC_MSG_CHECKING([if res_query will link])
3251 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003252#include <sys/types.h>
3253#include <netinet/in.h>
3254#include <arpa/nameser.h>
3255#include <netdb.h>
3256#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003257 ]], [[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003258 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003259 ]])],
3260 AC_MSG_RESULT([yes]),
3261 [AC_MSG_RESULT([no])
Darren Tucker8e968a52004-05-13 11:56:16 +10003262 saved_LIBS="$LIBS"
3263 LIBS="$LIBS -lresolv"
Tim Rice648f8762011-01-26 12:38:57 -08003264 AC_MSG_CHECKING([for res_query in -lresolv])
3265 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckere02b49a2009-09-11 14:56:08 +10003266#include <sys/types.h>
3267#include <netinet/in.h>
3268#include <arpa/nameser.h>
3269#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003270#include <resolv.h>
Tim Rice648f8762011-01-26 12:38:57 -08003271 ]], [[
Darren Tucker8e968a52004-05-13 11:56:16 +10003272 res_query (0, 0, 0, 0, 0);
Tim Rice648f8762011-01-26 12:38:57 -08003273 ]])],
3274 [AC_MSG_RESULT([yes])],
Darren Tucker8e968a52004-05-13 11:56:16 +10003275 [LIBS="$saved_LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003276 AC_MSG_RESULT([no])])
Darren Tucker8e968a52004-05-13 11:56:16 +10003277 ])
Tim Rice648f8762011-01-26 12:38:57 -08003278 AC_CHECK_FUNCS([_getshort _getlong])
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003279 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003280 [#include <sys/types.h>
3281 #include <arpa/nameser.h>])
Tim Rice648f8762011-01-26 12:38:57 -08003282 AC_CHECK_MEMBER([HEADER.ad],
3283 [AC_DEFINE([HAVE_HEADER_AD], [1],
3284 [Define if HEADER.ad exists in arpa/nameser.h])], ,
Darren Tucker5f88d342003-10-15 16:57:57 +10003285 [#include <arpa/nameser.h>])
3286 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003287
Tim Rice648f8762011-01-26 12:38:57 -08003288AC_MSG_CHECKING([if struct __res_state _res is an extern])
3289AC_LINK_IFELSE([AC_LANG_PROGRAM([[
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003290#include <stdio.h>
3291#if HAVE_SYS_TYPES_H
3292# include <sys/types.h>
3293#endif
3294#include <netinet/in.h>
3295#include <arpa/nameser.h>
3296#include <resolv.h>
3297extern struct __res_state _res;
Tim Rice648f8762011-01-26 12:38:57 -08003298 ]], [[ ]])],
3299 [AC_MSG_RESULT([yes])
3300 AC_DEFINE([HAVE__RES_EXTERN], [1],
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003301 [Define if you have struct __res_state _res as an extern])
3302 ],
Tim Rice648f8762011-01-26 12:38:57 -08003303 [ AC_MSG_RESULT([no]) ]
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003304)
3305
Damien Miller73b42d22006-04-22 21:26:08 +10003306# Check whether user wants SELinux support
3307SELINUX_MSG="no"
3308LIBSELINUX=""
Tim Rice648f8762011-01-26 12:38:57 -08003309AC_ARG_WITH([selinux],
Damien Miller5b1c8b32008-03-27 12:33:07 +11003310 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003311 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003312 save_LIBS="$LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003313 AC_DEFINE([WITH_SELINUX], [1],
3314 [Define if you want SELinux support.])
Damien Miller73b42d22006-04-22 21:26:08 +10003315 SELINUX_MSG="yes"
3316 AC_CHECK_HEADER([selinux/selinux.h], ,
Tim Rice648f8762011-01-26 12:38:57 -08003317 AC_MSG_ERROR([SELinux support requires selinux.h header]))
3318 AC_CHECK_LIB([selinux], [setexeccon],
Damien Miller1d2bfc42010-02-10 10:19:29 +11003319 [ LIBSELINUX="-lselinux"
3320 LIBS="$LIBS -lselinux"
3321 ],
Tim Rice648f8762011-01-26 12:38:57 -08003322 AC_MSG_ERROR([SELinux support requires libselinux library]))
Damien Miller71adf122011-01-25 12:16:15 +11003323 SSHLIBS="$SSHLIBS $LIBSELINUX"
Darren Tucker20e9f972007-03-25 18:26:01 +10003324 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Tim Rice648f8762011-01-26 12:38:57 -08003325 AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level])
Darren Tuckeradc947d2006-10-07 09:07:20 +10003326 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003327 fi ]
3328)
Tim Rice648f8762011-01-26 12:38:57 -08003329AC_SUBST([SSHLIBS])
3330AC_SUBST([SSHDLIBS])
Damien Miller73b42d22006-04-22 21:26:08 +10003331
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003332# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003333KRB5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003334AC_ARG_WITH([kerberos5],
Damien Millera8e06ce2003-11-21 23:48:55 +11003335 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003336 [ if test "x$withval" != "xno" ; then
3337 if test "x$withval" = "xyes" ; then
3338 KRB5ROOT="/usr/local"
3339 else
3340 KRB5ROOT=${withval}
3341 fi
3342
Tim Rice648f8762011-01-26 12:38:57 -08003343 AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003344 KRB5_MSG="yes"
3345
Tim Rice648f8762011-01-26 12:38:57 -08003346 AC_PATH_PROG([KRB5CONF], [krb5-config],
Darren Tuckerdad48e72009-09-01 18:26:00 +10003347 [$KRB5ROOT/bin/krb5-config],
3348 [$KRB5ROOT/bin:$PATH])
3349 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003350
Tim Rice648f8762011-01-26 12:38:57 -08003351 AC_MSG_CHECKING([for gssapi support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003352 if $KRB5CONF | grep gssapi >/dev/null ; then
Tim Rice648f8762011-01-26 12:38:57 -08003353 AC_MSG_RESULT([yes])
3354 AC_DEFINE([GSSAPI], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003355 [Define this if you want GSSAPI
3356 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003357 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003358 else
Tim Rice648f8762011-01-26 12:38:57 -08003359 AC_MSG_RESULT([no])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003360 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003361 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003362 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3363 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003364 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Tim Rice648f8762011-01-26 12:38:57 -08003365 AC_MSG_CHECKING([whether we are using Heimdal])
3366 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3367 ]], [[ char *tmp = heimdal_version; ]])],
3368 [ AC_MSG_RESULT([yes])
3369 AC_DEFINE([HEIMDAL], [1],
3370 [Define this if you are using the Heimdal
3371 version of Kerberos V5]) ],
3372 [AC_MSG_RESULT([no])
3373 ])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003374 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003375 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003376 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Tim Rice648f8762011-01-26 12:38:57 -08003377 AC_MSG_CHECKING([whether we are using Heimdal])
3378 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h>
3379 ]], [[ char *tmp = heimdal_version; ]])],
3380 [ AC_MSG_RESULT([yes])
3381 AC_DEFINE([HEIMDAL])
Damien Miller41bccf72011-01-02 21:53:07 +11003382 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003383 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Rice648f8762011-01-26 12:38:57 -08003384 AC_CHECK_LIB([roken], [net_write],
Damien Miller5561e0b2004-04-20 20:28:55 +10003385 [K5LIBS="$K5LIBS -lroken"])
Tim Rice648f8762011-01-26 12:38:57 -08003386 AC_CHECK_LIB([des], [des_cbc_encrypt],
Damien Miller41bccf72011-01-02 21:53:07 +11003387 [K5LIBS="$K5LIBS -ldes"])
Tim Rice648f8762011-01-26 12:38:57 -08003388 ], [ AC_MSG_RESULT([no])
Damien Millera8e06ce2003-11-21 23:48:55 +11003389 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
Tim Rice648f8762011-01-26 12:38:57 -08003390
3391 ])
3392 AC_SEARCH_LIBS([dn_expand], [resolv])
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003393
Tim Rice648f8762011-01-26 12:38:57 -08003394 AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context],
3395 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003396 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Tim Rice648f8762011-01-26 12:38:57 -08003397 [ AC_CHECK_LIB([gssapi], [gss_init_sec_context],
3398 [ AC_DEFINE([GSSAPI])
Darren Tucker30fd49e2008-06-14 09:14:46 +10003399 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003400 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3401 $K5LIBS)
3402 ],
3403 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003404
Tim Rice648f8762011-01-26 12:38:57 -08003405 AC_CHECK_HEADER([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003406 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003407 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003408 AC_CHECK_HEADERS([gssapi.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003409 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003410 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003411 ]
3412 )
3413
3414 oldCPP="$CPPFLAGS"
3415 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Tim Rice648f8762011-01-26 12:38:57 -08003416 AC_CHECK_HEADER([gssapi_krb5.h], ,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003417 [ CPPFLAGS="$oldCPP" ])
3418
Damien Millera8e06ce2003-11-21 23:48:55 +11003419 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003420 if test ! -z "$need_dash_r" ; then
3421 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3422 fi
3423 if test ! -z "$blibpath" ; then
3424 blibpath="$blibpath:${KRB5ROOT}/lib"
3425 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003426
Tim Rice648f8762011-01-26 12:38:57 -08003427 AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h])
3428 AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h])
3429 AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h])
Tim Ricefd9e9e32005-09-12 17:36:10 -07003430
3431 LIBS="$LIBS $K5LIBS"
Tim Rice648f8762011-01-26 12:38:57 -08003432 AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1],
3433 [Define this if you want to use libkafs' AFS support])])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003434 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003435 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003436)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003437
Damien Millera22ba012000-03-02 23:09:20 +11003438# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003439
Damien Millerf58c6722002-05-13 13:15:42 +10003440PRIVSEP_PATH=/var/empty
Tim Rice648f8762011-01-26 12:38:57 -08003441AC_ARG_WITH([privsep-path],
Tim Ricecbb90662002-07-08 19:17:10 -07003442 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003443 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003444 if test -n "$withval" && test "x$withval" != "xno" && \
3445 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003446 PRIVSEP_PATH=$withval
3447 fi
3448 ]
3449)
Tim Rice648f8762011-01-26 12:38:57 -08003450AC_SUBST([PRIVSEP_PATH])
Damien Millerf58c6722002-05-13 13:15:42 +10003451
Tim Rice648f8762011-01-26 12:38:57 -08003452AC_ARG_WITH([xauth],
Damien Millera22ba012000-03-02 23:09:20 +11003453 [ --with-xauth=PATH Specify path to xauth program ],
3454 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003455 if test -n "$withval" && test "x$withval" != "xno" && \
3456 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003457 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003458 fi
3459 ],
3460 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003461 TestPath="$PATH"
3462 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3463 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3464 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3465 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
Tim Rice648f8762011-01-26 12:38:57 -08003466 AC_PATH_PROG([xauth_path], [xauth], , [$TestPath])
Damien Milleredb82922000-06-20 13:25:52 +10003467 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003468 xauth_path="/usr/openwin/bin/xauth"
3469 fi
3470 ]
3471)
3472
Damien Miller7d901272003-01-13 16:55:22 +11003473STRIP_OPT=-s
Tim Rice648f8762011-01-26 12:38:57 -08003474AC_ARG_ENABLE([strip],
Damien Miller7d901272003-01-13 16:55:22 +11003475 [ --disable-strip Disable calling strip(1) on install],
3476 [
3477 if test "x$enableval" = "xno" ; then
3478 STRIP_OPT=
3479 fi
3480 ]
3481)
Tim Rice648f8762011-01-26 12:38:57 -08003482AC_SUBST([STRIP_OPT])
Damien Miller7d901272003-01-13 16:55:22 +11003483
Damien Millera19cf472000-11-29 13:28:50 +11003484if test -z "$xauth_path" ; then
3485 XAUTH_PATH="undefined"
Tim Rice648f8762011-01-26 12:38:57 -08003486 AC_SUBST([XAUTH_PATH])
Damien Millera19cf472000-11-29 13:28:50 +11003487else
Tim Rice648f8762011-01-26 12:38:57 -08003488 AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"],
Tim Rice7df8d392005-09-19 09:33:39 -07003489 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003490 XAUTH_PATH=$xauth_path
Tim Rice648f8762011-01-26 12:38:57 -08003491 AC_SUBST([XAUTH_PATH])
Damien Millera22ba012000-03-02 23:09:20 +11003492fi
Damien Millera22ba012000-03-02 23:09:20 +11003493
3494# Check for mail directory (last resort if we cannot get it from headers)
3495if test ! -z "$MAIL" ; then
3496 maildir=`dirname $MAIL`
Tim Rice648f8762011-01-26 12:38:57 -08003497 AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"],
Tim Rice7df8d392005-09-19 09:33:39 -07003498 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003499fi
3500
Darren Tucker623d92f2004-09-12 22:36:15 +10003501if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003502 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3503 disable_ptmx_check=yes
3504fi
Damien Millera22ba012000-03-02 23:09:20 +11003505if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003506 if test "x$disable_ptmx_check" != "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003507 AC_CHECK_FILE(["/dev/ptmx"],
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003508 [
Tim Rice648f8762011-01-26 12:38:57 -08003509 AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003510 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003511 have_dev_ptmx=1
3512 ]
3513 )
3514 fi
Damien Millera22ba012000-03-02 23:09:20 +11003515fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003516
Darren Tucker623d92f2004-09-12 22:36:15 +10003517if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003518 AC_CHECK_FILE(["/dev/ptc"],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003519 [
Tim Rice648f8762011-01-26 12:38:57 -08003520 AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003521 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003522 have_dev_ptc=1
3523 ]
3524 )
3525else
3526 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3527fi
Damien Miller204ad072000-03-02 23:56:12 +11003528
Damien Millera22ba012000-03-02 23:09:20 +11003529# Options from here on. Some of these are preset by platform above
Tim Rice648f8762011-01-26 12:38:57 -08003530AC_ARG_WITH([mantype],
Damien Miller897741e2001-04-16 10:41:46 +10003531 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003532 [
Damien Miller897741e2001-04-16 10:41:46 +10003533 case "$withval" in
3534 man|cat|doc)
3535 MANTYPE=$withval
3536 ;;
3537 *)
Tim Rice648f8762011-01-26 12:38:57 -08003538 AC_MSG_ERROR([invalid man type: $withval])
Damien Miller897741e2001-04-16 10:41:46 +10003539 ;;
3540 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003541 ]
3542)
Ben Lindstrombc709922001-04-18 18:04:21 +00003543if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003544 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
Tim Rice648f8762011-01-26 12:38:57 -08003545 AC_PATH_PROGS([NROFF], [nroff awf], [/bin/false], [$TestPath])
Ben Lindstrombc709922001-04-18 18:04:21 +00003546 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3547 MANTYPE=doc
3548 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3549 MANTYPE=man
3550 else
3551 MANTYPE=cat
3552 fi
3553fi
Tim Rice648f8762011-01-26 12:38:57 -08003554AC_SUBST([MANTYPE])
Ben Lindstrombc709922001-04-18 18:04:21 +00003555if test "$MANTYPE" = "doc"; then
3556 mansubdir=man;
3557else
3558 mansubdir=$MANTYPE;
3559fi
Tim Rice648f8762011-01-26 12:38:57 -08003560AC_SUBST([mansubdir])
Damien Miller8bdeee21999-12-30 15:50:54 +11003561
Damien Millera22ba012000-03-02 23:09:20 +11003562# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003563MD5_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003564AC_ARG_WITH([md5-passwords],
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003565 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003566 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003567 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003568 AC_DEFINE([HAVE_MD5_PASSWORDS], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003569 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003570 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003571 fi
3572 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003573)
3574
Damien Millera22ba012000-03-02 23:09:20 +11003575# Whether to disable shadow password support
Tim Rice648f8762011-01-26 12:38:57 -08003576AC_ARG_WITH([shadow],
Damien Miller76112de1999-12-21 11:18:08 +11003577 [ --without-shadow Disable shadow password support],
3578 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003579 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003580 AC_DEFINE([DISABLE_SHADOW])
Damien Miller1f335fb2000-06-26 11:31:33 +10003581 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003582 fi
3583 ]
3584)
3585
Damien Miller1f335fb2000-06-26 11:31:33 +10003586if test -z "$disable_shadow" ; then
3587 AC_MSG_CHECKING([if the systems has expire shadow information])
Tim Rice648f8762011-01-26 12:38:57 -08003588 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller1f335fb2000-06-26 11:31:33 +10003589#include <sys/types.h>
3590#include <shadow.h>
Tim Rice648f8762011-01-26 12:38:57 -08003591struct spwd sp;
3592 ]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])],
3593 [ sp_expire_available=yes ], [
3594 ])
Damien Miller1f335fb2000-06-26 11:31:33 +10003595
3596 if test "x$sp_expire_available" = "xyes" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003597 AC_MSG_RESULT([yes])
3598 AC_DEFINE([HAS_SHADOW_EXPIRE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003599 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003600 else
Tim Rice648f8762011-01-26 12:38:57 -08003601 AC_MSG_RESULT([no])
Damien Miller1f335fb2000-06-26 11:31:33 +10003602 fi
3603fi
3604
Damien Millera22ba012000-03-02 23:09:20 +11003605# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003606if test ! -z "$IPADDR_IN_DISPLAY" ; then
3607 DISPLAY_HACK_MSG="yes"
Tim Rice648f8762011-01-26 12:38:57 -08003608 AC_DEFINE([IPADDR_IN_DISPLAY], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003609 [Define if you need to use IP address
3610 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003611else
Damien Millera8e06ce2003-11-21 23:48:55 +11003612 DISPLAY_HACK_MSG="no"
Tim Rice648f8762011-01-26 12:38:57 -08003613 AC_ARG_WITH([ipaddr-display],
Damien Miller9a947342000-08-30 10:03:33 +11003614 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3615 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003616 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003617 AC_DEFINE([IPADDR_IN_DISPLAY])
Damien Millera8e06ce2003-11-21 23:48:55 +11003618 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003619 fi
3620 ]
3621 )
3622fi
Damien Miller76112de1999-12-21 11:18:08 +11003623
Darren Tuckere1a790d2003-09-16 11:52:19 +10003624# check for /etc/default/login and use it if present.
Tim Rice648f8762011-01-26 12:38:57 -08003625AC_ARG_ENABLE([etc-default-login],
Darren Tucker1b6f2292005-02-11 16:11:49 +11003626 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003627 [ if test "x$enableval" = "xno"; then
3628 AC_MSG_NOTICE([/etc/default/login handling disabled])
3629 etc_default_login=no
3630 else
3631 etc_default_login=yes
3632 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003633 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3634 then
3635 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3636 etc_default_login=no
3637 else
3638 etc_default_login=yes
3639 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003640)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003641
Darren Tucker2f9573d2005-02-10 22:28:54 +11003642if test "x$etc_default_login" != "xno"; then
Tim Rice648f8762011-01-26 12:38:57 -08003643 AC_CHECK_FILE(["/etc/default/login"],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003644 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003645 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice648f8762011-01-26 12:38:57 -08003646 AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003647 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003648 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003649fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003650
Tim Rice43a1c132002-04-17 21:19:14 -07003651dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003652if test $ac_cv_func_login_getcapbool = "yes" && \
3653 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003654 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003655fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003656
Damien Millera22ba012000-03-02 23:09:20 +11003657# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003658SERVER_PATH_MSG="(default)"
Tim Rice648f8762011-01-26 12:38:57 -08003659AC_ARG_WITH([default-path],
Damien Millerf71d2a52002-05-13 15:14:08 +10003660 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003661 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003662 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003663 AC_MSG_WARN([
3664--with-default-path=PATH has no effect on this system.
3665Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003666 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003667 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003668 AC_MSG_WARN([
3669--with-default-path=PATH will only be used if PATH is not defined in
3670$external_path_file .])
3671 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003672 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003673 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003674 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003675 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003676 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3677 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003678 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003679 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003680 AC_MSG_WARN([
3681If PATH is defined in $external_path_file, ensure the path to scp is included,
3682otherwise scp will not work.])
3683 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003684 AC_RUN_IFELSE(
Tim Rice648f8762011-01-26 12:38:57 -08003685 [AC_LANG_PROGRAM([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003686/* find out what STDPATH is */
3687#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003688#ifdef HAVE_PATHS_H
3689# include <paths.h>
3690#endif
3691#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003692# ifdef _PATH_USERPATH /* Irix */
3693# define _PATH_STDPATH _PATH_USERPATH
3694# else
3695# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3696# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003697#endif
3698#include <sys/types.h>
3699#include <sys/stat.h>
3700#include <fcntl.h>
3701#define DATA "conftest.stdpath"
Tim Rice648f8762011-01-26 12:38:57 -08003702 ]], [[
Tim Rice59ea0a02001-03-10 13:50:45 -08003703 FILE *fd;
3704 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003705
Tim Rice59ea0a02001-03-10 13:50:45 -08003706 fd = fopen(DATA,"w");
3707 if(fd == NULL)
3708 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003709
Tim Rice59ea0a02001-03-10 13:50:45 -08003710 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3711 exit(1);
3712
3713 exit(0);
Darren Tucker314d89e2005-10-17 23:29:23 +10003714 ]])],
3715 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003716 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3717 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3718 )
3719# make sure $bindir is in USER_PATH so scp will work
3720 t_bindir=`eval echo ${bindir}`
3721 case $t_bindir in
3722 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3723 esac
3724 case $t_bindir in
3725 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3726 esac
3727 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3728 if test $? -ne 0 ; then
3729 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3730 if test $? -ne 0 ; then
3731 user_path=$user_path:$t_bindir
Tim Rice648f8762011-01-26 12:38:57 -08003732 AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work])
Tim Rice59ea0a02001-03-10 13:50:45 -08003733 fi
3734 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003735 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003736)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003737if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003738 AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH])
3739 AC_SUBST([user_path])
Tim Rice43a1c132002-04-17 21:19:14 -07003740fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003741
Damien Millera18bbd32002-05-13 10:48:57 +10003742# Set superuser path separately to user path
Tim Rice648f8762011-01-26 12:38:57 -08003743AC_ARG_WITH([superuser-path],
Damien Millera18bbd32002-05-13 10:48:57 +10003744 [ --with-superuser-path= Specify different path for super-user],
3745 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003746 if test -n "$withval" && test "x$withval" != "xno" && \
3747 test "x${withval}" != "xyes"; then
Tim Rice648f8762011-01-26 12:38:57 -08003748 AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"],
Tim Rice7df8d392005-09-19 09:33:39 -07003749 [Define if you want a different $PATH
3750 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003751 superuser_path=$withval
3752 fi
3753 ]
3754)
3755
3756
Damien Miller61e50f12000-05-08 20:49:37 +10003757AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003758IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003759AC_ARG_WITH(4in6,
3760 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3761 [
3762 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003763 AC_MSG_RESULT([yes])
3764 AC_DEFINE([IPV4_IN_IPV6], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003765 [Detect IPv4 in IPv6 mapped addresses
3766 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003767 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003768 else
Tim Rice648f8762011-01-26 12:38:57 -08003769 AC_MSG_RESULT([no])
Damien Miller7bcb0892000-03-11 20:45:40 +11003770 fi
Tim Rice648f8762011-01-26 12:38:57 -08003771 ], [
Damien Miller7bcb0892000-03-11 20:45:40 +11003772 if test "x$inet6_default_4in6" = "xyes"; then
3773 AC_MSG_RESULT([yes (default)])
Tim Rice648f8762011-01-26 12:38:57 -08003774 AC_DEFINE([IPV4_IN_IPV6])
Damien Millera8e06ce2003-11-21 23:48:55 +11003775 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003776 else
3777 AC_MSG_RESULT([no (default)])
3778 fi
3779 ]
3780)
3781
Damien Miller60396b02001-02-18 17:01:00 +11003782# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003783BSD_AUTH_MSG=no
Tim Rice648f8762011-01-26 12:38:57 -08003784AC_ARG_WITH([bsd-auth],
Damien Miller60396b02001-02-18 17:01:00 +11003785 [ --with-bsd-auth Enable BSD auth support],
3786 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003787 if test "x$withval" != "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003788 AC_DEFINE([BSD_AUTH], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003789 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003790 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003791 fi
3792 ]
3793)
3794
Damien Millera22ba012000-03-02 23:09:20 +11003795# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003796piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003797# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003798if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003799 piddir=`eval echo ${sysconfdir}`
3800 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003801 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003802 esac
3803fi
3804
Tim Rice648f8762011-01-26 12:38:57 -08003805AC_ARG_WITH([pid-dir],
Tim Rice88f2ab52002-03-17 12:17:34 -08003806 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3807 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003808 if test -n "$withval" && test "x$withval" != "xno" && \
3809 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003810 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003811 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003812 AC_MSG_WARN([** no $piddir directory on this system **])
3813 fi
3814 fi
3815 ]
3816)
3817
Tim Rice648f8762011-01-26 12:38:57 -08003818AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"],
3819 [Specify location of ssh.pid])
3820AC_SUBST([piddir])
Damien Miller5eed6a22000-01-16 12:05:18 +11003821
andre2ff7b5d2000-06-03 14:57:40 +00003822dnl allow user to disable some login recording features
Tim Rice648f8762011-01-26 12:38:57 -08003823AC_ARG_ENABLE([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003824 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003825 [
3826 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003827 AC_DEFINE([DISABLE_LASTLOG])
Darren Tuckera3020db2003-06-28 12:54:33 +10003828 fi
3829 ]
andre2ff7b5d2000-06-03 14:57:40 +00003830)
Tim Rice648f8762011-01-26 12:38:57 -08003831AC_ARG_ENABLE([utmp],
andre43ca7e22000-06-19 08:23:46 +00003832 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003833 [
3834 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003835 AC_DEFINE([DISABLE_UTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003836 fi
3837 ]
andre2ff7b5d2000-06-03 14:57:40 +00003838)
Tim Rice648f8762011-01-26 12:38:57 -08003839AC_ARG_ENABLE([utmpx],
andre43ca7e22000-06-19 08:23:46 +00003840 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003841 [
3842 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003843 AC_DEFINE([DISABLE_UTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003844 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003845 fi
3846 ]
andre2ff7b5d2000-06-03 14:57:40 +00003847)
Tim Rice648f8762011-01-26 12:38:57 -08003848AC_ARG_ENABLE([wtmp],
andre43ca7e22000-06-19 08:23:46 +00003849 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003850 [
3851 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003852 AC_DEFINE([DISABLE_WTMP])
Darren Tuckera3020db2003-06-28 12:54:33 +10003853 fi
3854 ]
andre2ff7b5d2000-06-03 14:57:40 +00003855)
Tim Rice648f8762011-01-26 12:38:57 -08003856AC_ARG_ENABLE([wtmpx],
andre43ca7e22000-06-19 08:23:46 +00003857 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003858 [
3859 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003860 AC_DEFINE([DISABLE_WTMPX], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003861 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003862 fi
3863 ]
andre2ff7b5d2000-06-03 14:57:40 +00003864)
Tim Rice648f8762011-01-26 12:38:57 -08003865AC_ARG_ENABLE([libutil],
andre43ca7e22000-06-19 08:23:46 +00003866 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003867 [
3868 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003869 AC_DEFINE([DISABLE_LOGIN])
Darren Tuckera3020db2003-06-28 12:54:33 +10003870 fi
3871 ]
andre2ff7b5d2000-06-03 14:57:40 +00003872)
Tim Rice648f8762011-01-26 12:38:57 -08003873AC_ARG_ENABLE([pututline],
andre43ca7e22000-06-19 08:23:46 +00003874 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003875 [
3876 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003877 AC_DEFINE([DISABLE_PUTUTLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003878 [Define if you don't want to use pututline()
3879 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003880 fi
3881 ]
andre2ff7b5d2000-06-03 14:57:40 +00003882)
Tim Rice648f8762011-01-26 12:38:57 -08003883AC_ARG_ENABLE([pututxline],
andre43ca7e22000-06-19 08:23:46 +00003884 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003885 [
3886 if test "x$enableval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003887 AC_DEFINE([DISABLE_PUTUTXLINE], [1],
Tim Rice7df8d392005-09-19 09:33:39 -07003888 [Define if you don't want to use pututxline()
3889 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003890 fi
3891 ]
andre2ff7b5d2000-06-03 14:57:40 +00003892)
Tim Rice648f8762011-01-26 12:38:57 -08003893AC_ARG_WITH([lastlog],
andre43ca7e22000-06-19 08:23:46 +00003894 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003895 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003896 if test "x$withval" = "xno" ; then
Tim Rice648f8762011-01-26 12:38:57 -08003897 AC_DEFINE([DISABLE_LASTLOG])
Tim Rice35cc69d2005-03-17 16:44:25 -08003898 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003899 conf_lastlog_location=$withval
3900 fi
3901 ]
3902)
andre2ff7b5d2000-06-03 14:57:40 +00003903
3904dnl lastlog, [uw]tmpx? detection
3905dnl NOTE: set the paths in the platform section to avoid the
3906dnl need for command-line parameters
3907dnl lastlog and [uw]tmp are subject to a file search if all else fails
3908
3909dnl lastlog detection
3910dnl NOTE: the code itself will detect if lastlog is a directory
3911AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003912AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003913#include <sys/types.h>
3914#include <utmp.h>
3915#ifdef HAVE_LASTLOG_H
3916# include <lastlog.h>
3917#endif
Damien Miller2994e082000-06-04 15:51:47 +10003918#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003919# include <paths.h>
3920#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003921#ifdef HAVE_LOGIN_H
3922# include <login.h>
3923#endif
Tim Rice648f8762011-01-26 12:38:57 -08003924 ]], [[ char *lastlog = LASTLOG_FILE; ]])],
3925 [ AC_MSG_RESULT([yes]) ],
3926 [
3927 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10003928 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
Tim Rice648f8762011-01-26 12:38:57 -08003929 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
Damien Miller2994e082000-06-04 15:51:47 +10003930#include <sys/types.h>
3931#include <utmp.h>
3932#ifdef HAVE_LASTLOG_H
3933# include <lastlog.h>
3934#endif
3935#ifdef HAVE_PATHS_H
3936# include <paths.h>
3937#endif
Tim Rice648f8762011-01-26 12:38:57 -08003938 ]], [[ char *lastlog = _PATH_LASTLOG; ]])],
3939 [ AC_MSG_RESULT([yes]) ],
Damien Miller2994e082000-06-04 15:51:47 +10003940 [
Tim Rice648f8762011-01-26 12:38:57 -08003941 AC_MSG_RESULT([no])
Damien Miller2994e082000-06-04 15:51:47 +10003942 system_lastlog_path=no
3943 ])
Tim Rice648f8762011-01-26 12:38:57 -08003944])
Damien Miller2994e082000-06-04 15:51:47 +10003945
andre2ff7b5d2000-06-03 14:57:40 +00003946if test -z "$conf_lastlog_location"; then
3947 if test x"$system_lastlog_path" = x"no" ; then
3948 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003949 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003950 conf_lastlog_location=$f
3951 fi
3952 done
3953 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003954 AC_MSG_WARN([** Cannot find lastlog **])
3955 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003956 fi
3957 fi
3958fi
3959
3960if test -n "$conf_lastlog_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08003961 AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07003962 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003963fi
andre2ff7b5d2000-06-03 14:57:40 +00003964
3965dnl utmp detection
3966AC_MSG_CHECKING([if your system defines UTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003967AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003968#include <sys/types.h>
3969#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003970#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003971# include <paths.h>
3972#endif
Tim Rice648f8762011-01-26 12:38:57 -08003973 ]], [[ char *utmp = UTMP_FILE; ]])],
3974 [ AC_MSG_RESULT([yes]) ],
3975 [ AC_MSG_RESULT([no])
3976 system_utmp_path=no
3977])
andre2ff7b5d2000-06-03 14:57:40 +00003978if test -z "$conf_utmp_location"; then
3979 if test x"$system_utmp_path" = x"no" ; then
3980 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3981 if test -f $f ; then
3982 conf_utmp_location=$f
3983 fi
3984 done
3985 if test -z "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08003986 AC_DEFINE([DISABLE_UTMP])
andre2ff7b5d2000-06-03 14:57:40 +00003987 fi
3988 fi
3989fi
3990if test -n "$conf_utmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08003991 AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07003992 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003993fi
andre2ff7b5d2000-06-03 14:57:40 +00003994
3995dnl wtmp detection
3996AC_MSG_CHECKING([if your system defines WTMP_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08003997AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00003998#include <sys/types.h>
3999#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004000#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004001# include <paths.h>
4002#endif
Tim Rice648f8762011-01-26 12:38:57 -08004003 ]], [[ char *wtmp = WTMP_FILE; ]])],
4004 [ AC_MSG_RESULT([yes]) ],
4005 [ AC_MSG_RESULT([no])
4006 system_wtmp_path=no
4007])
andre2ff7b5d2000-06-03 14:57:40 +00004008if test -z "$conf_wtmp_location"; then
4009 if test x"$system_wtmp_path" = x"no" ; then
4010 for f in /usr/adm/wtmp /var/log/wtmp; do
4011 if test -f $f ; then
4012 conf_wtmp_location=$f
4013 fi
4014 done
4015 if test -z "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004016 AC_DEFINE([DISABLE_WTMP])
andre2ff7b5d2000-06-03 14:57:40 +00004017 fi
4018 fi
4019fi
4020if test -n "$conf_wtmp_location"; then
Tim Rice648f8762011-01-26 12:38:57 -08004021 AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004022 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004023fi
andre2ff7b5d2000-06-03 14:57:40 +00004024
4025
andre2ff7b5d2000-06-03 14:57:40 +00004026dnl wtmpx detection
4027AC_MSG_CHECKING([if your system defines WTMPX_FILE])
Tim Rice648f8762011-01-26 12:38:57 -08004028AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
andre2ff7b5d2000-06-03 14:57:40 +00004029#include <sys/types.h>
4030#include <utmp.h>
4031#ifdef HAVE_UTMPX_H
4032#include <utmpx.h>
4033#endif
Damien Miller2994e082000-06-04 15:51:47 +10004034#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004035# include <paths.h>
4036#endif
Tim Rice648f8762011-01-26 12:38:57 -08004037 ]], [[ char *wtmpx = WTMPX_FILE; ]])],
4038 [ AC_MSG_RESULT([yes]) ],
4039 [ AC_MSG_RESULT([no])
4040 system_wtmpx_path=no
4041])
andre2ff7b5d2000-06-03 14:57:40 +00004042if test -z "$conf_wtmpx_location"; then
4043 if test x"$system_wtmpx_path" = x"no" ; then
Tim Rice648f8762011-01-26 12:38:57 -08004044 AC_DEFINE([DISABLE_WTMPX])
andre2ff7b5d2000-06-03 14:57:40 +00004045 fi
4046else
Tim Rice648f8762011-01-26 12:38:57 -08004047 AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"],
Tim Rice7df8d392005-09-19 09:33:39 -07004048 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004049fi
andre2ff7b5d2000-06-03 14:57:40 +00004050
Damien Miller4018c192000-04-30 09:30:44 +10004051
Damien Miller29ea30d2000-03-17 10:54:15 +11004052if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004053 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4054 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004055fi
4056
Darren Tucker7da23cb2005-08-03 00:20:15 +10004057dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4058dnl Add now.
4059CFLAGS="$CFLAGS $werror_flags"
4060
Darren Tucker627337d2010-04-10 22:58:01 +10004061if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4062 TEST_SSH_IPV6=no
4063else
4064 TEST_SSH_IPV6=yes
4065fi
Tim Rice648f8762011-01-26 12:38:57 -08004066AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no])
4067AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6])
Darren Tucker5d376902008-06-11 04:15:05 +10004068
Damien Millerbac2d8a2000-09-05 16:13:06 +11004069AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004070AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4071 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerf22019b2011-05-05 13:48:37 +10004072 survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004073AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004074
Damien Miller7b22d652000-06-18 14:07:04 +10004075# Print summary of options
4076
Damien Miller7b22d652000-06-18 14:07:04 +10004077# Someone please show me a better way :)
4078A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4079B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4080C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4081D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004082E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004083F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004084G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004085H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4086I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4087J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004088
4089echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004090echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004091echo " User binaries: $B"
4092echo " System binaries: $C"
4093echo " Configuration files: $D"
4094echo " Askpass program: $E"
4095echo " Manual pages: $F"
4096echo " PID file: $G"
4097echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004098if test "x$external_path_file" = "x/etc/login.conf" ; then
4099echo " At runtime, sshd will use the path defined in $external_path_file"
4100echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004101else
Damien Millerf58c6722002-05-13 13:15:42 +10004102echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004103 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004104echo " (If PATH is set in $external_path_file it will be used instead. If"
4105echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4106 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004107fi
Damien Millera18bbd32002-05-13 10:48:57 +10004108if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004109echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004110fi
Damien Millerf58c6722002-05-13 13:15:42 +10004111echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004112echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004113echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004114echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004115echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004116echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004117echo " S/KEY support: $SKEY_MSG"
4118echo " TCP Wrappers support: $TCPW_MSG"
4119echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004120echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004121echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004122echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004123echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004124echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4125echo " BSD Auth support: $BSD_AUTH_MSG"
4126echo " Random number source: $RAND_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004127
Damien Miller7b22d652000-06-18 14:07:04 +10004128echo ""
4129
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004130echo " Host: ${host}"
4131echo " Compiler: ${CC}"
4132echo " Compiler flags: ${CFLAGS}"
4133echo "Preprocessor flags: ${CPPFLAGS}"
4134echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004135echo " Libraries: ${LIBS}"
4136if test ! -z "${SSHDLIBS}"; then
4137echo " +for sshd: ${SSHDLIBS}"
4138fi
Damien Miller71adf122011-01-25 12:16:15 +11004139if test ! -z "${SSHLIBS}"; then
4140echo " +for ssh: ${SSHLIBS}"
4141fi
Damien Miller7b22d652000-06-18 14:07:04 +10004142
4143echo ""
4144
Tim Rice6f1f7582004-05-30 21:38:51 -07004145if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004146 echo "SVR4 style packages are supported with \"make package\""
4147 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004148fi
4149
Damien Miller82cf0ce2000-12-20 13:34:48 +11004150if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004151 echo "PAM is enabled. You may need to install a PAM control file "
4152 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004153 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004154 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004155 echo ""
4156fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004157
Damien Millerb4097182004-05-23 14:09:40 +10004158if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004159 echo "WARNING: the operating system that you are using does not"
4160 echo "appear to support getpeereid(), getpeerucred() or the"
4161 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4162 echo "enforce security checks to prevent unauthorised connections to"
4163 echo "ssh-agent. Their absence increases the risk that a malicious"
4164 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004165 echo ""
4166fi
4167
Darren Tuckerd9f88912005-02-20 21:01:48 +11004168if test "$AUDIT_MODULE" = "bsm" ; then
4169 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4170 echo "See the Solaris section in README.platform for details."
4171fi