blob: 0eeb4df78d50e5871c28685d80dce46c8da961f1 [file] [log] [blame]
Damien Miller30a69e72011-01-04 08:16:27 +11001# $Id: configure.ac,v 1.461 2011/01/03 21:16:29 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
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Damien Miller30a69e72011-01-04 08:16:27 +110018AC_REVISION($Revision: 1.461 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
21AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Ben Lindstrom582d3982001-02-06 22:54:30 +000032AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070033AC_PATH_PROG(CAT, cat)
34AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070035AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080036AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110037AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100038AC_PATH_PROG(ENT, ent)
39AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110040AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070043AC_PATH_PROG(SH, sh)
Damien Miller30a69e72011-01-04 08:16:27 +110044AC_PATH_PROG(GROFF, groff)
45AC_PATH_PROG(NROFF, nroff)
46AC_PATH_PROG(MANDOC, mandoc)
Tim Ricef7ba8f62004-06-20 10:37:32 -070047AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110048
Damien Miller30a69e72011-01-04 08:16:27 +110049dnl select manpage formatter
50if test "x$MANDOC" != "x" ; then
51 MANFMT="$MANDOC"
52elif test "x$NROFF" != "x" ; then
53 MANFMT="$NROFF -mandoc"
54elif test "x$GROFF" != "x" ; then
55 MANFMT="$GROFF -mandoc -Tascii"
56else
57 AC_MSG_WARN([no manpage formatted found])
58 MANFMT="false"
59fi
60AC_SUBST(MANFMT)
61
Tim Rice6f1f7582004-05-30 21:38:51 -070062dnl for buildpkg.sh
63AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
64 [/usr/sbin${PATH_SEPARATOR}/etc])
65AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
66 [/usr/sbin${PATH_SEPARATOR}/etc])
67AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110068if test -x /sbin/sh; then
69 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
70else
71 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
72fi
Tim Rice6f1f7582004-05-30 21:38:51 -070073
Damien Millere8bb4502001-09-25 16:39:35 +100074# System features
75AC_SYS_LARGEFILE
76
Damien Miller3f62aba2000-11-29 11:56:35 +110077if test -z "$AR" ; then
78 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
79fi
80
Damien Millerad833b32000-08-23 10:46:23 +100081# Use LOGIN_PROGRAM from environment if possible
82if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070083 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
84 [If your header files don't define LOGIN_PROGRAM,
85 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100086else
87 # Search for login
88 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
89 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
90 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
91 fi
92fi
93
Darren Tucker23bc8d02004-02-06 16:24:31 +110094AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
95if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070096 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
97 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110098fi
99
Damien Miller166bd442000-03-16 10:48:25 +1100100if test -z "$LD" ; then
101 LD=$CC
102fi
103AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -0800104
Damien Miller166bd442000-03-16 10:48:25 +1100105AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +1000106
107AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
108
Darren Tuckerb7918af2008-03-09 11:34:23 +1100109use_stack_protector=1
110AC_ARG_WITH(stackprotect,
Damien Millerda3155e2008-03-27 12:30:18 +1100111 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +1100112 if test "x$withval" = "xno"; then
113 use_stack_protector=0
114 fi ])
115
Damien Millera8e06ce2003-11-21 23:48:55 +1100116if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +1000117 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +1100118 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700119 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000120 1.*) no_attrib_nonnull=1 ;;
121 2.8* | 2.9*)
122 CFLAGS="$CFLAGS -Wsign-compare"
123 no_attrib_nonnull=1
124 ;;
125 2.*) no_attrib_nonnull=1 ;;
Damien Miller73193b32008-07-09 21:07:19 +1000126 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
Damien Miller9527f222010-03-05 15:04:35 +1100127 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100128 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700129 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000130
Darren Tucker330c93f2008-06-16 02:27:48 +1000131 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
132 saved_CFLAGS="$CFLAGS"
133 CFLAGS="$CFLAGS -fno-builtin-memset"
134 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
135#include <string.h>
136int main(void){char b[10]; memset(b, 0, sizeof(b));}
137 ]])],
138 [ AC_MSG_RESULT(yes) ],
139 [ AC_MSG_RESULT(no)
140 CFLAGS="$saved_CFLAGS" ]
141)
142
Darren Tuckerb7918af2008-03-09 11:34:23 +1100143 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100144 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100145 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100146 if test "x$use_stack_protector" = "x1"; then
147 for t in -fstack-protector-all -fstack-protector; do
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100148 AC_MSG_CHECKING(if $CC supports $t)
Darren Tuckerb7918af2008-03-09 11:34:23 +1100149 saved_CFLAGS="$CFLAGS"
150 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100151 CFLAGS="$CFLAGS $t -Werror"
152 LDFLAGS="$LDFLAGS $t -Werror"
153 AC_LINK_IFELSE(
154 [AC_LANG_SOURCE([
Damien Miller7df2e402008-12-08 09:35:36 +1100155#include <stdio.h>
156int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100157 ])],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100158 [ AC_MSG_RESULT(yes)
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100159 CFLAGS="$saved_CFLAGS $t"
160 LDFLAGS="$saved_LDFLAGS $t"
Darren Tuckerb7918af2008-03-09 11:34:23 +1100161 AC_MSG_CHECKING(if $t works)
162 AC_RUN_IFELSE(
163 [AC_LANG_SOURCE([
Damien Miller7df2e402008-12-08 09:35:36 +1100164#include <stdio.h>
165int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
Darren Tuckerb7918af2008-03-09 11:34:23 +1100166 ])],
167 [ AC_MSG_RESULT(yes)
168 break ],
169 [ AC_MSG_RESULT(no) ],
170 [ AC_MSG_WARN([cross compiling: cannot test])
171 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100172 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100173 ],
174 [ AC_MSG_RESULT(no) ]
175 )
176 CFLAGS="$saved_CFLAGS"
177 LDFLAGS="$saved_LDFLAGS"
178 done
179 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100180
Darren Tucker67b37032005-06-03 17:58:31 +1000181 if test -z "$have_llong_max"; then
182 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
183 unset ac_cv_have_decl_LLONG_MAX
184 saved_CFLAGS="$CFLAGS"
185 CFLAGS="$CFLAGS -std=gnu99"
186 AC_CHECK_DECL(LLONG_MAX,
187 [have_llong_max=1],
188 [CFLAGS="$saved_CFLAGS"],
189 [#include <limits.h>]
190 )
191 fi
Damien Miller166bd442000-03-16 10:48:25 +1100192fi
193
Darren Tucker391de5c2007-04-29 14:49:21 +1000194if test "x$no_attrib_nonnull" != "x1" ; then
195 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
196fi
197
Tim Rice88368a32003-12-08 12:35:59 -0800198AC_ARG_WITH(rpath,
199 [ --without-rpath Disable auto-added -R linker paths],
200 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800201 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800202 need_dash_r=""
203 fi
204 if test "x$withval" = "xyes" ; then
205 need_dash_r=1
206 fi
207 ]
208)
209
Tim Rice1cfab232006-10-03 09:34:35 -0700210# Allow user to specify flags
211AC_ARG_WITH(cflags,
212 [ --with-cflags Specify additional flags to pass to compiler],
213 [
214 if test -n "$withval" && test "x$withval" != "xno" && \
215 test "x${withval}" != "xyes"; then
216 CFLAGS="$CFLAGS $withval"
217 fi
218 ]
219)
220AC_ARG_WITH(cppflags,
221 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
222 [
223 if test -n "$withval" && test "x$withval" != "xno" && \
224 test "x${withval}" != "xyes"; then
225 CPPFLAGS="$CPPFLAGS $withval"
226 fi
227 ]
228)
229AC_ARG_WITH(ldflags,
230 [ --with-ldflags Specify additional flags to pass to linker],
231 [
232 if test -n "$withval" && test "x$withval" != "xno" && \
233 test "x${withval}" != "xyes"; then
234 LDFLAGS="$LDFLAGS $withval"
235 fi
236 ]
237)
238AC_ARG_WITH(libs,
239 [ --with-libs Specify additional libraries to link with],
240 [
241 if test -n "$withval" && test "x$withval" != "xno" && \
242 test "x${withval}" != "xyes"; then
243 LIBS="$LIBS $withval"
244 fi
245 ]
246)
247AC_ARG_WITH(Werror,
248 [ --with-Werror Build main code with -Werror],
249 [
250 if test -n "$withval" && test "x$withval" != "xno"; then
251 werror_flags="-Werror"
252 if test "x${withval}" != "xyes"; then
253 werror_flags="$withval"
254 fi
255 fi
256 ]
257)
258
259AC_CHECK_HEADERS( \
260 bstring.h \
261 crypt.h \
262 crypto/sha2.h \
263 dirent.h \
264 endian.h \
265 features.h \
266 fcntl.h \
267 floatingpoint.h \
268 getopt.h \
269 glob.h \
270 ia.h \
271 iaf.h \
272 limits.h \
273 login.h \
274 maillock.h \
275 ndir.h \
276 net/if_tun.h \
277 netdb.h \
278 netgroup.h \
279 pam/pam_appl.h \
280 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000281 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700282 pty.h \
283 readpassphrase.h \
284 rpc/types.h \
285 security/pam_appl.h \
286 sha2.h \
287 shadow.h \
288 stddef.h \
289 stdint.h \
290 string.h \
291 strings.h \
292 sys/audit.h \
293 sys/bitypes.h \
294 sys/bsdtty.h \
295 sys/cdefs.h \
296 sys/dir.h \
297 sys/mman.h \
298 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000299 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700300 sys/prctl.h \
301 sys/pstat.h \
302 sys/select.h \
303 sys/stat.h \
304 sys/stream.h \
305 sys/stropts.h \
306 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000307 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700308 sys/sysmacros.h \
309 sys/time.h \
310 sys/timers.h \
311 sys/un.h \
312 time.h \
313 tmpdir.h \
314 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700315 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700316 unistd.h \
317 usersec.h \
318 util.h \
319 utime.h \
320 utmp.h \
321 utmpx.h \
322 vis.h \
323)
324
325# lastlog.h requires sys/time.h to be included first on Solaris
326AC_CHECK_HEADERS(lastlog.h, [], [], [
327#ifdef HAVE_SYS_TIME_H
328# include <sys/time.h>
329#endif
330])
331
332# sys/ptms.h requires sys/stream.h to be included first on Solaris
333AC_CHECK_HEADERS(sys/ptms.h, [], [], [
334#ifdef HAVE_SYS_STREAM_H
335# include <sys/stream.h>
336#endif
337])
338
339# login_cap.h requires sys/types.h on NetBSD
340AC_CHECK_HEADERS(login_cap.h, [], [], [
341#include <sys/types.h>
342])
343
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000344# older BSDs need sys/param.h before sys/mount.h
345AC_CHECK_HEADERS(sys/mount.h, [], [], [
346#include <sys/param.h>
347])
348
Damien Miller1b06dc32006-08-31 03:24:41 +1000349# Messages for features tested for in target-specific section
350SIA_MSG="no"
351SPC_MSG="no"
Darren Tucker97528352010-11-05 12:03:05 +1100352SP_MSG="no"
Damien Miller1b06dc32006-08-31 03:24:41 +1000353
Damien Millera22ba012000-03-02 23:09:20 +1100354# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100355case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100356*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000357 # Some versions of VAC won't allow macro redefinitions at
358 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
359 # particularly with older versions of vac or xlc.
360 # It also throws errors about null macro argments, but these are
361 # not fatal.
362 AC_MSG_CHECKING(if compiler allows macro redefinitions)
363 AC_COMPILE_IFELSE(
364 [AC_LANG_SOURCE([[
365#define testmacro foo
366#define testmacro bar
367int main(void) { exit(0); }
368 ]])],
369 [ AC_MSG_RESULT(yes) ],
370 [ AC_MSG_RESULT(no)
371 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
372 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
373 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
374 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
375 ]
376 )
377
Damien Millera8e06ce2003-11-21 23:48:55 +1100378 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000379 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800380 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100381 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000382 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000383 if test "$GCC" = "yes"; then
384 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
385 else
386 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
387 fi
388 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000389 if (test -z "$blibflags"); then
390 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
391 AC_TRY_LINK([], [], [blibflags=$tryflags])
392 fi
393 done
394 if (test -z "$blibflags"); then
395 AC_MSG_RESULT(not found)
396 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
397 else
398 AC_MSG_RESULT($blibflags)
399 fi
400 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000401 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700402 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
403 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700404 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000405 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700406 LIBS="$LIBS -ls"
407 ])
408 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100409 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100410 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100411 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000412 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100413 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000414 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
415 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000416 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000417 [(void)loginfailed("user","host","tty",0);],
418 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700419 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
420 [Define if your AIX loginfailed() function
421 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000422 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000423 )],
424 [],
425 [#include <usersec.h>]
426 )
Darren Tucker0f26b132008-02-28 23:16:04 +1100427 AC_CHECK_FUNCS(getgrset setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000428 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000429 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000430 [],
431 [ #include <limits.h>
432 #include <fcntl.h> ]
433 )
Darren Tucker691d5232005-02-15 21:45:57 +1100434 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700435 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
436 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
437 [Define if your platform breaks doing a seteuid before a setuid])
438 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
439 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000440 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700441 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
442 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
443 [Some systems need a utmpx entry for /bin/login to work])
444 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
445 [Define to a Set Process Title type if your system is
446 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100447 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
448 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000449 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100450 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100451*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100452 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100453 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700454 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
455 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
456 AC_DEFINE(DISABLE_SHADOW, 1,
457 [Define if you want to disable shadow passwords])
Tim Rice7df8d392005-09-19 09:33:39 -0700458 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
459 [Define if X11 doesn't support AF_UNIX sockets on that system])
460 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
461 [Define if the concept of ports only accessible to
462 superusers isn't known])
463 AC_DEFINE(DISABLE_FD_PASSING, 1,
464 [Define if your platform needs to skip post auth
465 file descriptor passing])
Tim Rice6761c742010-01-22 10:25:15 -0800466 AC_DEFINE(SSH_IOBUFSZ, 65535, [Windows is sensitive to read buffer size])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100467 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000468*-*-dgux*)
Tim Ricea74000e2009-03-18 11:25:02 -0700469 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
470 [Define if your system choked on IP TOS setting])
Darren Tucker454da0b2003-12-18 12:52:19 +1100471 AC_DEFINE(SETEUID_BREAKS_SETUID)
472 AC_DEFINE(BROKEN_SETREUID)
473 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000474 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000475*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000476 AC_MSG_CHECKING(if we have working getaddrinfo)
477 AC_TRY_RUN([#include <mach-o/dyld.h>
478main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
479 exit(0);
480 else
481 exit(1);
482}], [AC_MSG_RESULT(working)],
483 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700484 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700485 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000486 AC_DEFINE(SETEUID_BREAKS_SETUID)
487 AC_DEFINE(BROKEN_SETREUID)
488 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker528d6fa2007-12-31 21:29:26 +1100489 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
Tim Rice7df8d392005-09-19 09:33:39 -0700490 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
491 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000492 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
493 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
494 [Use tunnel device compatibility to OpenBSD])
495 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
496 [Prepend the address family to IP tunnel traffic])
Darren Tuckeracada072008-02-25 21:05:04 +1100497 m4_pattern_allow(AU_IPv)
498 AC_CHECK_DECL(AU_IPv4, [],
499 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
500 [#include <bsm/audit.h>]
Damien Miller20e231f2009-02-12 13:12:21 +1100501 AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
502 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100503 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000504 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000505*-*-dragonfly*)
506 SSHDLIBS="$SSHDLIBS -lcrypt"
507 ;;
Darren Tuckera83d90f2010-03-26 10:27:33 +1100508*-*-haiku*)
509 LIBS="$LIBS -lbsd "
510 AC_CHECK_LIB(network, socket)
511 AC_DEFINE(HAVE_U_INT64_T)
512 MANTYPE=man
513 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000514*-*-hpux*)
515 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000516 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100517 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000518 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700519 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
520 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000521 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700522 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
523 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000524 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000525 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700526 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000527 AC_CHECK_LIB(xnet, t_error, ,
528 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
529
530 # next, we define all of the options specific to major releases
531 case "$host" in
532 *-*-hpux10*)
533 if test -z "$GCC"; then
534 CFLAGS="$CFLAGS -Ae"
535 fi
536 ;;
537 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700538 AC_DEFINE(PAM_SUN_CODEBASE, 1,
539 [Define if you are using Solaris-derived PAM which
540 passes pam_messages to the conversation function
541 with an extra level of indirection])
542 AC_DEFINE(DISABLE_UTMP, 1,
543 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000544 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
545 check_for_hpux_broken_getaddrinfo=1
546 check_for_conflicting_getspnam=1
547 ;;
548 esac
549
550 # lastly, we define options specific to minor releases
551 case "$host" in
552 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700553 AC_DEFINE(HAVE_SECUREWARE, 1,
554 [Define if you have SecureWare-based
555 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000556 disable_ptmx_check=yes
557 LIBS="$LIBS -lsecpw"
558 ;;
559 esac
Damien Miller1bead332000-04-30 00:47:29 +1000560 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100561*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100562 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700563 AC_DEFINE(BROKEN_INET_NTOA, 1,
564 [Define if you system's inet_ntoa is busted
565 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000566 AC_DEFINE(SETEUID_BREAKS_SETUID)
567 AC_DEFINE(BROKEN_SETREUID)
568 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700569 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
570 [Define if you shouldn't strip 'tty' from your
571 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000572 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100573 ;;
574*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100575 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700576 AC_DEFINE(WITH_IRIX_ARRAY, 1,
577 [Define if you have/want arrays
578 (cluster-wide session managment, not C arrays)])
579 AC_DEFINE(WITH_IRIX_PROJECT, 1,
580 [Define if you want IRIX project management])
581 AC_DEFINE(WITH_IRIX_AUDIT, 1,
582 [Define if you want IRIX audit trails])
583 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
584 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000585 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000586 AC_DEFINE(SETEUID_BREAKS_SETUID)
587 AC_DEFINE(BROKEN_SETREUID)
588 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700589 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000590 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000591 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100592 ;;
Damien Miller90551722009-02-16 15:37:03 +1100593*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
594 check_for_libcrypt_later=1
595 AC_DEFINE(PAM_TTY_KLUDGE)
596 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
597 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
598 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
599 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
600 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100601*-*-linux*)
602 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100603 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000604 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700605 AC_DEFINE(PAM_TTY_KLUDGE, 1,
606 [Work around problematic Linux PAM modules handling of PAM_TTY])
607 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
608 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000609 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700610 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
611 [Define to whatever link() returns for "not supported"
612 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100613 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700614 AC_DEFINE(USE_BTMP)
Darren Tuckerc8802aa2009-12-08 13:39:48 +1100615 AC_DEFINE(LINUX_OOM_ADJUST, 1, [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100616 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000617 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000618 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700619 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
620 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000621 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000622 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100623 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100624 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100625 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100626 AC_DEFINE(SSH_TUN_LINUX, 1,
627 [Open tunnel devices the Linux tun/tap way])
628 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
629 [Use tunnel device compatibility to OpenBSD])
630 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
631 [Prepend the address family to IP tunnel traffic])
632 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100633 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000634mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100635 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000636 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000637 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100638*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000639 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800640 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800641 need_dash_r=1
642 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100643 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
644 AC_CHECK_HEADER([net/if_tap.h], ,
645 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
646 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
647 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100648 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100649*-*-freebsd*)
650 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000651 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100652 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
653 AC_CHECK_HEADER([net/if_tap.h], ,
654 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Darren Tucker54e859f2008-03-02 21:52:27 +1100655 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100656 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000657*-*-bsdi*)
658 AC_DEFINE(SETEUID_BREAKS_SETUID)
659 AC_DEFINE(BROKEN_SETREUID)
660 AC_DEFINE(BROKEN_SETREGID)
661 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000662*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000663 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100664 conf_utmp_location=/etc/utmp
665 conf_wtmp_location=/usr/adm/wtmp
666 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700667 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000668 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000669 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700670 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000671 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000672*-*-openbsd*)
673 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000674 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100675 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000676 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
677 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000678 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100679*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800680 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800681 need_dash_r=1
682 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100683 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000684 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700685 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
686 [Some versions of /bin/login need the TERM supplied
687 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000688 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700689 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
690 [Define if pam_chauthtok wants real uid set
691 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000692 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000693 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700694 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
695 [Define if sshd somehow reacquires a controlling TTY
696 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000697 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
698 in case the name is longer than 8 chars])
Darren Tuckerac9f1b92009-08-28 15:01:20 +1000699 AC_DEFINE(BROKEN_TCGETATTR_ICANON, 1, [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000700 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000701 # hardwire lastlog location (can't detect it on some versions)
702 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000703 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
704 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
705 if test "$sol2ver" -ge 8; then
706 AC_MSG_RESULT(yes)
707 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700708 AC_DEFINE(DISABLE_WTMP, 1,
709 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000710 else
711 AC_MSG_RESULT(no)
712 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000713 AC_ARG_WITH(solaris-contracts,
714 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
715 [
716 AC_CHECK_LIB(contract, ct_tmpl_activate,
717 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
718 [Define if you have Solaris process contracts])
719 SSHDLIBS="$SSHDLIBS -lcontract"
720 AC_SUBST(SSHDLIBS)
721 SPC_MSG="yes" ], )
722 ],
723 )
Darren Tucker97528352010-11-05 12:03:05 +1100724 AC_ARG_WITH(solaris-projects,
725 [ --with-solaris-projects Enable Solaris projects (experimental)],
726 [
727 AC_CHECK_LIB(project, setproject,
728 [ AC_DEFINE(USE_SOLARIS_PROJECTS, 1,
729 [Define if you have Solaris projects])
730 SSHDLIBS="$SSHDLIBS -lproject"
731 AC_SUBST(SSHDLIBS)
732 SP_MSG="yes" ], )
733 ],
734 )
Damien Miller75b1d102000-01-07 14:01:41 +1100735 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000736*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000737 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000738 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100739 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000740 conf_utmp_location=/etc/utmp
741 conf_wtmp_location=/var/adm/wtmp
742 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000743 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000744 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000745*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700746 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000747 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000748 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000749 AC_DEFINE(SETEUID_BREAKS_SETUID)
750 AC_DEFINE(BROKEN_SETREUID)
751 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000752 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000753*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700754 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000755 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100756 # -lresolv needs to be at the end of LIBS or DNS lookups break
757 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100758 IPADDR_IN_DISPLAY=yes
759 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000760 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000761 AC_DEFINE(SETEUID_BREAKS_SETUID)
762 AC_DEFINE(BROKEN_SETREUID)
763 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000764 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000765 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700766 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
767 # Attention: always take care to bind libsocket and libnsl before libc,
768 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000769 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800770# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100771*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100772 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700773 AC_DEFINE(SETEUID_BREAKS_SETUID)
774 AC_DEFINE(BROKEN_SETREUID)
775 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700776 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800777 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100778 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800779# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100780*-*-sysv5*)
Tim Rice641ebf12010-01-17 17:05:39 -0800781 CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf"
Tim Riceeb456542005-08-30 07:12:02 -0700782 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100783 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700784 AC_DEFINE(SETEUID_BREAKS_SETUID)
Tim Rice4a7db1c2010-01-16 12:23:25 -0800785 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Riced546a842003-09-11 22:24:36 -0700786 AC_DEFINE(BROKEN_SETREUID)
787 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700788 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700789 case "$host" in
790 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
791 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700792 AC_DEFINE(BROKEN_LIBIAF, 1,
793 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700794 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice351529c2009-01-07 10:04:12 -0800795 AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
796 AC_CHECK_FUNCS(getluid setluid,,,-lprot)
797 AC_DEFINE(HAVE_SECUREWARE)
798 AC_DEFINE(DISABLE_SHADOW)
799 ],,)
Tim Rice4dbacff2005-06-01 20:09:28 -0700800 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800801 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Tim Rice26767912009-01-07 20:50:08 -0800802 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800803 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700804 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100805 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100806*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100807 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800808# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100809*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800810 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100811 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800812# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100813*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800814 if test -z "$GCC"; then
815 CFLAGS="$CFLAGS -belf"
816 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100817 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000818 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100819 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000820 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000821 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700822 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700823 AC_DEFINE(SETEUID_BREAKS_SETUID)
Tim Rice7ab7b932010-01-17 12:48:22 -0800824 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Riced546a842003-09-11 22:24:36 -0700825 AC_DEFINE(BROKEN_SETREUID)
826 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700827 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700828 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700829 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100830 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700831 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700832 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000833 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000834*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700835 AC_DEFINE(NO_SSH_LASTLOG, 1,
836 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100837 AC_DEFINE(SETEUID_BREAKS_SETUID)
838 AC_DEFINE(BROKEN_SETREUID)
839 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000840 AC_DEFINE(USE_PIPES)
841 AC_DEFINE(DISABLE_FD_PASSING)
842 LDFLAGS="$LDFLAGS"
843 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
844 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000845 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000846*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100847 AC_DEFINE(SETEUID_BREAKS_SETUID)
848 AC_DEFINE(BROKEN_SETREUID)
849 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000850 AC_DEFINE(WITH_ABBREV_NO_TTY)
851 AC_DEFINE(USE_PIPES)
852 AC_DEFINE(DISABLE_FD_PASSING)
853 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100854 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000855 MANTYPE=cat
856 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000857*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100858 AC_DEFINE(SETEUID_BREAKS_SETUID)
859 AC_DEFINE(BROKEN_SETREUID)
860 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000861 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700862 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700863 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000864 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
865 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
866 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700867 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000868*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000869 AC_MSG_CHECKING(for Digital Unix SIA)
870 no_osfsia=""
871 AC_ARG_WITH(osfsia,
872 [ --with-osfsia Enable Digital Unix SIA],
873 [
874 if test "x$withval" = "xno" ; then
875 AC_MSG_RESULT(disabled)
876 no_osfsia=1
877 fi
878 ],
879 )
880 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000881 if test -f /etc/sia/matrix.conf; then
882 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700883 AC_DEFINE(HAVE_OSF_SIA, 1,
884 [Define if you have Digital Unix Security
885 Integration Architecture])
886 AC_DEFINE(DISABLE_LOGIN, 1,
887 [Define if you don't want to use your
888 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000889 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000890 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000891 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000892 else
893 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700894 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
895 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000896 fi
897 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000898 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700899 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000900 AC_DEFINE(BROKEN_SETREUID)
901 AC_DEFINE(BROKEN_SETREGID)
Damien Millerff2e4922008-07-05 09:52:03 +1000902 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000903 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000904
Tim Rice70335a62006-02-04 17:42:58 -0800905*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000906 AC_DEFINE(USE_PIPES)
907 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700908 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
909 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
910 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800911 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100912 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckerbc1bd9d2007-09-27 07:03:20 +1000913 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800914 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000915 case "$host" in
916 *-*-nto-qnx6*)
917 AC_DEFINE(DISABLE_FD_PASSING)
918 ;;
919 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000920 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000921
922*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700923 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
924 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100925 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700926 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
927 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000928
929*-*-lynxos)
930 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700931 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000932 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
933 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100934esac
935
Darren Tucker6eb93042003-06-29 21:30:41 +1000936AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000937AC_RUN_IFELSE(
938 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000939#include <stdio.h>
940int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000941 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000942 [ AC_MSG_RESULT(yes) ],
943 [
944 AC_MSG_RESULT(no)
945 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000946 ],
947 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000948)
949
Darren Tucker0c9653f2005-05-28 15:58:14 +1000950dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100951# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700952AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
953AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000954
Tim Rice1e1ef642003-09-11 22:19:31 -0700955dnl IRIX and Solaris 2.5.1 have dirname() in libgen
956AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
957 AC_CHECK_LIB(gen, dirname,[
958 AC_CACHE_CHECK([for broken dirname],
959 ac_cv_have_broken_dirname, [
960 save_LIBS="$LIBS"
961 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000962 AC_RUN_IFELSE(
963 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700964#include <libgen.h>
965#include <string.h>
966
967int main(int argc, char **argv) {
968 char *s, buf[32];
969
970 strncpy(buf,"/etc", 32);
971 s = dirname(buf);
972 if (!s || strncmp(s, "/", 32) != 0) {
973 exit(1);
974 } else {
975 exit(0);
976 }
977}
Darren Tucker314d89e2005-10-17 23:29:23 +1000978 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700979 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000980 [ ac_cv_have_broken_dirname="yes" ],
981 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700982 )
983 LIBS="$save_LIBS"
984 ])
985 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
986 LIBS="$LIBS -lgen"
987 AC_DEFINE(HAVE_DIRNAME)
988 AC_CHECK_HEADERS(libgen.h)
989 fi
990 ])
991])
992
993AC_CHECK_FUNC(getspnam, ,
994 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700995AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
996 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700997
Tim Rice13aae5e2001-10-21 17:53:58 -0700998dnl zlib is required
999AC_ARG_WITH(zlib,
1000 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001001 [ if test "x$withval" = "xno" ; then
1002 AC_MSG_ERROR([*** zlib is required ***])
1003 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001004 if test -d "$withval/lib"; then
1005 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001006 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001007 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001008 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001009 fi
1010 else
1011 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001012 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001013 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001014 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001015 fi
1016 fi
1017 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001018 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001019 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001020 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001021 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +11001022 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -07001023)
1024
Darren Tucker83d8f282009-08-17 09:35:22 +10001025AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Tim Ricefcb62202004-01-23 18:35:16 -08001026AC_CHECK_LIB(z, deflate, ,
1027 [
1028 saved_CPPFLAGS="$CPPFLAGS"
1029 saved_LDFLAGS="$LDFLAGS"
1030 save_LIBS="$LIBS"
1031 dnl Check default zlib install dir
1032 if test -n "${need_dash_r}"; then
1033 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1034 else
1035 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1036 fi
1037 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1038 LIBS="$LIBS -lz"
1039 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1040 [
1041 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1042 ]
1043 )
1044 ]
1045)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001046
1047AC_ARG_WITH(zlib-version-check,
1048 [ --without-zlib-version-check Disable zlib version check],
1049 [ if test "x$withval" = "xno" ; then
1050 zlib_check_nonfatal=1
1051 fi
1052 ]
1053)
1054
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001055AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +10001056AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001057#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001058#include <zlib.h>
1059int main()
1060{
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001061 int a=0, b=0, c=0, d=0, n, v;
1062 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1063 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001064 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001065 v = a*1000000 + b*10000 + c*100 + d;
1066 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1067
1068 /* 1.1.4 is OK */
1069 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001070 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001071
Darren Tucker41097ed2005-07-25 15:24:21 +10001072 /* 1.2.3 and up are OK */
1073 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001074 exit(0);
1075
Darren Tucker2dcd2392004-01-23 17:13:33 +11001076 exit(2);
1077}
Darren Tucker623d92f2004-09-12 22:36:15 +10001078 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001079 AC_MSG_RESULT(no),
1080 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001081 if test -z "$zlib_check_nonfatal" ; then
1082 AC_MSG_ERROR([*** zlib too old - check config.log ***
1083Your reported zlib version has known security problems. It's possible your
1084vendor has fixed these problems without changing the version number. If you
1085are sure this is the case, you can disable the check by running
1086"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001087If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001088See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001089 else
1090 AC_MSG_WARN([zlib version may have security problems])
1091 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001092 ],
1093 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001094)
Damien Miller6f9c3372000-10-25 10:06:04 +11001095
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001096dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +11001097AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001098 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1099)
Darren Tucker5bfe1682005-11-12 18:42:36 +11001100AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -07001101 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1102 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001103)
Damien Millerab18c411999-11-11 10:40:23 +11001104
Tim Ricee589a292001-11-03 11:09:32 -08001105dnl Checks for libutil functions
1106AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -07001107AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1108 [Define if your libraries define login()])])
Damien Millera7058ec2008-05-20 08:57:06 +10001109AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
Tim Ricee589a292001-11-03 11:09:32 -08001110
Ben Lindstrom8697e082001-02-24 21:41:10 +00001111AC_FUNC_STRFTIME
1112
Damien Miller3c027682001-03-14 11:39:45 +11001113# Check for ALTDIRFUNC glob() extension
1114AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1115AC_EGREP_CPP(FOUNDIT,
1116 [
1117 #include <glob.h>
1118 #ifdef GLOB_ALTDIRFUNC
1119 FOUNDIT
1120 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001121 ],
Damien Miller3c027682001-03-14 11:39:45 +11001122 [
Tim Rice7df8d392005-09-19 09:33:39 -07001123 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1124 [Define if your system glob() function has
1125 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001126 AC_MSG_RESULT(yes)
1127 ],
1128 [
1129 AC_MSG_RESULT(no)
1130 ]
1131)
Damien Millerab18c411999-11-11 10:40:23 +11001132
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001133# Check for g.gl_matchc glob() extension
1134AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001135AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001136 [ #include <glob.h> ],
1137 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001138 [
Tim Rice7df8d392005-09-19 09:33:39 -07001139 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1140 [Define if your system glob() function has
1141 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001142 AC_MSG_RESULT(yes)
1143 ],
1144 [
1145 AC_MSG_RESULT(no)
1146 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001147)
1148
Damien Millera6e121a2010-10-07 21:39:17 +11001149# Check for g.gl_statv glob() extension
1150AC_MSG_CHECKING(for gl_statv and GLOB_KEEPSTAT extensions for glob)
1151AC_TRY_COMPILE(
1152 [ #include <glob.h> ],
1153 [
1154#ifndef GLOB_KEEPSTAT
1155#error "glob does not support GLOB_KEEPSTAT extension"
1156#endif
1157glob_t g;
1158g.gl_statv = NULL;
1159],
1160 [
1161 AC_DEFINE(GLOB_HAS_GL_STATV, 1,
1162 [Define if your system glob() function has
1163 gl_statv options in glob_t])
1164 AC_MSG_RESULT(yes)
1165 ],
1166 [
1167 AC_MSG_RESULT(no)
1168 ]
1169)
1170
Darren Tucker096faec2006-09-01 20:29:10 +10001171AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1172
Damien Miller18bb4732001-03-28 14:35:30 +10001173AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001174AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001175 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001176#include <sys/types.h>
1177#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001178int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001179 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001180 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001181 [
1182 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001183 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001184 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001185 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001186 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001187 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001188 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1189 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001190 ]
1191)
1192
Damien Miller36f49652004-08-15 18:40:59 +10001193AC_MSG_CHECKING([for /proc/pid/fd directory])
1194if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001195 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001196 AC_MSG_RESULT(yes)
1197else
1198 AC_MSG_RESULT(no)
1199fi
1200
Damien Millerc547bf12001-02-16 10:18:12 +11001201# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001202SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001203AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001204 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001205 [
1206 if test "x$withval" != "xno" ; then
1207
1208 if test "x$withval" != "xyes" ; then
1209 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1210 LDFLAGS="$LDFLAGS -L${withval}/lib"
1211 fi
1212
Tim Rice7df8d392005-09-19 09:33:39 -07001213 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001214 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001215 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001216
Tim Rice4cec93f2002-02-26 08:40:48 -08001217 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001218 AC_LINK_IFELSE(
1219 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001220#include <stdio.h>
1221#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001222int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001223 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001224 [AC_MSG_RESULT(yes)],
1225 [
1226 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001227 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1228 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001229 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1230 AC_TRY_COMPILE(
1231 [#include <stdio.h>
1232 #include <skey.h>],
1233 [(void)skeychallenge(NULL,"name","",0);],
1234 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001235 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1236 [Define if your skeychallenge()
1237 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001238 [AC_MSG_RESULT(no)]
1239 )
Damien Millerc547bf12001-02-16 10:18:12 +11001240 fi
1241 ]
1242)
1243
1244# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001245TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001246AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001247 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001248 [
1249 if test "x$withval" != "xno" ; then
1250 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001251 saved_LDFLAGS="$LDFLAGS"
1252 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001253 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001254 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001255 if test -d "${withval}/lib"; then
1256 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001257 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001258 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001259 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001260 fi
1261 else
1262 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001263 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001264 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001265 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001266 fi
1267 fi
1268 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001269 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001270 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001271 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001272 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001273 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001274 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001275 AC_MSG_CHECKING(for libwrap)
1276 AC_TRY_LINK(
1277 [
Damien Miller0ac45002004-04-14 20:14:26 +10001278#include <sys/types.h>
1279#include <sys/socket.h>
1280#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001281#include <tcpd.h>
1282 int deny_severity = 0, allow_severity = 0;
1283 ],
1284 [hosts_access(0);],
1285 [
1286 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001287 AC_DEFINE(LIBWRAP, 1,
1288 [Define if you want
1289 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001290 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001291 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001292 ],
1293 [
1294 AC_MSG_ERROR([*** libwrap missing])
1295 ]
1296 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001297 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001298 fi
1299 ]
1300)
1301
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001302# Check whether user wants libedit support
1303LIBEDIT_MSG="no"
1304AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001305 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001306 [ if test "x$withval" != "xno" ; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001307 if test "x$withval" = "xyes" ; then
1308 AC_PATH_PROG(PKGCONFIG, pkg-config, no)
1309 if test "x$PKGCONFIG" != "xno"; then
1310 AC_MSG_CHECKING(if $PKGCONFIG knows about libedit)
1311 if "$PKGCONFIG" libedit; then
1312 AC_MSG_RESULT(yes)
1313 use_pkgconfig_for_libedit=yes
1314 else
1315 AC_MSG_RESULT(no)
1316 fi
1317 fi
1318 else
Darren Tuckerc373a562005-09-22 20:15:08 +10001319 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1320 if test -n "${need_dash_r}"; then
1321 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1322 else
1323 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1324 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001325 fi
Damien Miller1f789802010-10-11 22:35:22 +11001326 if test "x$use_pkgconfig_for_libedit" = "xyes"; then
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001327 LIBEDIT=`$PKGCONFIG --libs-only-l libedit`
1328 CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`"
1329 else
1330 LIBEDIT="-ledit -lcurses"
1331 fi
1332 OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'`
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001333 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001334 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001335 LIBEDIT_MSG="yes"
1336 AC_SUBST(LIBEDIT)
1337 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001338 [ AC_MSG_ERROR(libedit not found) ],
Darren Tuckerc4ccb122010-04-09 14:04:35 +10001339 [ $OTHERLIBS ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001340 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001341 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001342 AC_COMPILE_IFELSE(
1343 [AC_LANG_SOURCE([[
1344#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001345int main(void)
1346{
1347 int i = H_SETSIZE;
1348 el_init("", NULL, NULL, NULL);
1349 exit(0);
1350}
Tim Ricec1819c82005-08-15 17:48:40 -07001351 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001352 [ AC_MSG_RESULT(yes) ],
1353 [ AC_MSG_RESULT(no)
1354 AC_MSG_ERROR(libedit version is not compatible) ]
1355 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001356 fi ]
1357)
1358
Darren Tuckerd9f88912005-02-20 21:01:48 +11001359AUDIT_MODULE=none
1360AC_ARG_WITH(audit,
1361 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1362 [
1363 AC_MSG_CHECKING(for supported audit module)
1364 case "$withval" in
1365 bsm)
1366 AC_MSG_RESULT(bsm)
1367 AUDIT_MODULE=bsm
1368 dnl Checks for headers, libs and functions
1369 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001370 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1371 [
1372#ifdef HAVE_TIME_H
1373# include <time.h>
1374#endif
1375 ]
1376)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001377 AC_CHECK_LIB(bsm, getaudit, [],
1378 [AC_MSG_ERROR(BSM enabled and required library not found)])
1379 AC_CHECK_FUNCS(getaudit, [],
1380 [AC_MSG_ERROR(BSM enabled and required function not found)])
1381 # These are optional
Darren Tuckeracada072008-02-25 21:05:04 +11001382 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
Tim Rice7df8d392005-09-19 09:33:39 -07001383 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001384 ;;
1385 debug)
1386 AUDIT_MODULE=debug
1387 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001388 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001389 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001390 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001391 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001392 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001393 *)
1394 AC_MSG_ERROR([Unknown audit module $withval])
1395 ;;
1396 esac ]
1397)
1398
Damien Millerfe1f1432003-02-24 15:45:42 +11001399dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001400AC_CHECK_FUNCS( \
1401 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001402 arc4random_buf \
1403 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001404 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001405 b64_ntop \
1406 __b64_ntop \
1407 b64_pton \
1408 __b64_pton \
1409 bcopy \
1410 bindresvport_sa \
1411 clock \
1412 closefrom \
1413 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001414 fchmod \
1415 fchown \
1416 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001417 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001418 futimes \
1419 getaddrinfo \
1420 getcwd \
1421 getgrouplist \
1422 getnameinfo \
1423 getopt \
1424 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001425 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001426 _getpty \
1427 getrlimit \
1428 getttyent \
1429 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001430 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001431 inet_aton \
1432 inet_ntoa \
1433 inet_ntop \
1434 innetgr \
1435 login_getcapbool \
1436 md5_crypt \
1437 memmove \
1438 mkdtemp \
1439 mmap \
1440 ngetaddrinfo \
1441 nsleep \
1442 ogetaddrinfo \
1443 openlog_r \
1444 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001445 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001446 prctl \
1447 pstat \
1448 readpassphrase \
1449 realpath \
1450 recvmsg \
1451 rresvport_af \
1452 sendmsg \
1453 setdtablesize \
1454 setegid \
1455 setenv \
1456 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001457 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001458 setgroups \
1459 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001460 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001461 setpcred \
1462 setproctitle \
1463 setregid \
1464 setreuid \
1465 setrlimit \
1466 setsid \
1467 setvbuf \
1468 sigaction \
1469 sigvec \
1470 snprintf \
1471 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001472 statfs \
1473 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001474 strdup \
1475 strerror \
1476 strlcat \
1477 strlcpy \
1478 strmode \
1479 strnvis \
Darren Tuckeraa74f672010-08-16 13:15:23 +10001480 strptime \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001481 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001482 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001483 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001484 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001485 sysconf \
1486 tcgetpgrp \
Damien Milleraa180632010-10-07 21:25:27 +11001487 timingsafe_bcmp \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001488 truncate \
1489 unsetenv \
1490 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001491 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001492 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001493 vhangup \
1494 vsnprintf \
1495 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001496)
Tim Rice13aae5e2001-10-21 17:53:58 -07001497
Tim Ricec7a8af02010-11-08 14:26:23 -08001498AC_LINK_IFELSE(
1499[
1500#include <ctype.h>
1501int main(void)
1502{
1503 return (isblank('a'));
1504}
1505],
1506 [AC_DEFINE(HAVE_ISBLANK, 1, [Define if you have isblank(3C).])
1507])
1508
Damien Millerb3c9f782010-02-12 10:11:34 +11001509# PKCS#11 support requires dlopen() and co
1510AC_SEARCH_LIBS(dlopen, dl,
1511 AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support])
1512)
1513
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001514# IRIX has a const char return value for gai_strerror()
1515AC_CHECK_FUNCS(gai_strerror,[
1516 AC_DEFINE(HAVE_GAI_STRERROR)
1517 AC_TRY_COMPILE([
1518#include <sys/types.h>
1519#include <sys/socket.h>
1520#include <netdb.h>
1521
1522const char *gai_strerror(int);],[
1523char *str;
1524
1525str = gai_strerror(0);],[
1526 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1527 [Define if gai_strerror() returns const char *])])])
1528
Tim Rice7df8d392005-09-19 09:33:39 -07001529AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1530 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001531
Darren Tuckerf1159b52003-07-07 19:44:01 +10001532dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001533AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001534AC_CHECK_DECL(strsep,
1535 [AC_CHECK_FUNCS(strsep)],
1536 [],
1537 [
1538#ifdef HAVE_STRING_H
1539# include <string.h>
1540#endif
1541 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001542
Darren Tuckerb2427c82003-09-10 15:22:44 +10001543dnl tcsendbreak might be a macro
1544AC_CHECK_DECL(tcsendbreak,
1545 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001546 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001547 [#include <termios.h>]
1548)
1549
Darren Tucker5bb14002004-04-23 18:53:10 +10001550AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1551
Darren Tucker128a0892006-07-12 19:02:56 +10001552AC_CHECK_DECLS(SHUT_RD, , ,
1553 [
1554#include <sys/types.h>
1555#include <sys/socket.h>
1556 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001557
1558AC_CHECK_DECLS(O_NONBLOCK, , ,
1559 [
1560#include <sys/types.h>
1561#ifdef HAVE_SYS_STAT_H
1562# include <sys/stat.h>
1563#endif
1564#ifdef HAVE_FCNTL_H
1565# include <fcntl.h>
1566#endif
1567 ])
1568
Darren Tuckered0b5922006-09-03 22:44:49 +10001569AC_CHECK_DECLS(writev, , , [
1570#include <sys/types.h>
1571#include <sys/uio.h>
1572#include <unistd.h>
1573 ])
1574
Darren Tucker6d862a52007-04-29 14:39:02 +10001575AC_CHECK_DECLS(MAXSYMLINKS, , , [
1576#include <sys/param.h>
1577 ])
1578
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001579AC_CHECK_DECLS(offsetof, , , [
1580#include <stddef.h>
1581 ])
1582
Darren Tucker2a6b0292003-12-31 14:59:17 +11001583AC_CHECK_FUNCS(setresuid, [
1584 dnl Some platorms have setresuid that isn't implemented, test for this
1585 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001586 AC_RUN_IFELSE(
1587 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001588#include <stdlib.h>
1589#include <errno.h>
1590int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001591 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001592 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001593 [AC_DEFINE(BROKEN_SETRESUID, 1,
1594 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001595 AC_MSG_RESULT(not implemented)],
1596 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001597 )
1598])
Darren Tuckere937be32003-12-17 18:53:26 +11001599
Darren Tucker2a6b0292003-12-31 14:59:17 +11001600AC_CHECK_FUNCS(setresgid, [
1601 dnl Some platorms have setresgid that isn't implemented, test for this
1602 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001603 AC_RUN_IFELSE(
1604 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001605#include <stdlib.h>
1606#include <errno.h>
1607int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001608 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001609 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001610 [AC_DEFINE(BROKEN_SETRESGID, 1,
1611 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001612 AC_MSG_RESULT(not implemented)],
1613 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001614 )
1615])
Darren Tuckere937be32003-12-17 18:53:26 +11001616
Damien Millerad833b32000-08-23 10:46:23 +10001617dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001618AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001619dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001620AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001621AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001622dnl Checks for utmpx functions
Darren Tucker261d93a2010-04-09 18:13:27 +10001623AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline getutxuser pututxline)
1624AC_CHECK_FUNCS(setutxdb setutxent utmpxname)
Damien Miller20e231f2009-02-12 13:12:21 +11001625dnl Checks for lastlog functions
1626AC_CHECK_FUNCS(getlastlogxbyname)
Damien Millercedfecc1999-11-15 14:36:53 +11001627
Damien Millera8e06ce2003-11-21 23:48:55 +11001628AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001629 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1630 [AC_CHECK_LIB(bsd, daemon,
1631 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001632)
1633
Damien Millera8e06ce2003-11-21 23:48:55 +11001634AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001635 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1636 [Define if your libraries define getpagesize()])],
1637 [AC_CHECK_LIB(ucb, getpagesize,
1638 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001639)
1640
Damien Millercb170cb2000-07-01 16:52:55 +10001641# Check for broken snprintf
1642if test "x$ac_cv_func_snprintf" = "xyes" ; then
1643 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001644 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001645 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001646#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001647int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001648 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001649 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001650 [
1651 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001652 AC_DEFINE(BROKEN_SNPRINTF, 1,
1653 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001654 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001655 ],
1656 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001657 )
1658fi
1659
Damien Miller57f39152005-11-24 19:58:19 +11001660# If we don't have a working asprintf, then we strongly depend on vsnprintf
1661# returning the right thing on overflow: the number of characters it tried to
1662# create (as per SUSv3)
1663if test "x$ac_cv_func_asprintf" != "xyes" && \
1664 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1665 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1666 AC_RUN_IFELSE(
1667 [AC_LANG_SOURCE([[
1668#include <sys/types.h>
1669#include <stdio.h>
1670#include <stdarg.h>
1671
1672int x_snprintf(char *str,size_t count,const char *fmt,...)
1673{
1674 size_t ret; va_list ap;
1675 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1676 return ret;
1677}
1678int main(void)
1679{
1680 char x[1];
1681 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1682} ]])],
1683 [AC_MSG_RESULT(yes)],
1684 [
1685 AC_MSG_RESULT(no)
1686 AC_DEFINE(BROKEN_SNPRINTF, 1,
1687 [Define if your snprintf is busted])
1688 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1689 ],
1690 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1691 )
1692fi
1693
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001694# On systems where [v]snprintf is broken, but is declared in stdio,
1695# check that the fmt argument is const char * or just char *.
1696# This is only useful for when BROKEN_SNPRINTF
1697AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1698AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1699 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1700 int main(void) { snprintf(0, 0, 0); }
1701 ]])],
1702 [AC_MSG_RESULT(yes)
1703 AC_DEFINE(SNPRINTF_CONST, [const],
1704 [Define as const if snprintf() can declare const char *fmt])],
1705 [AC_MSG_RESULT(no)
1706 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1707
Damien Millerb4097182004-05-23 14:09:40 +10001708# Check for missing getpeereid (or equiv) support
1709NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001710if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001711 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1712 AC_TRY_COMPILE(
1713 [#include <sys/types.h>
1714 #include <sys/socket.h>],
1715 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001716 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001717 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001718 ],
Damien Millerb4097182004-05-23 14:09:40 +10001719 [AC_MSG_RESULT(no)
1720 NO_PEERCHECK=1]
1721 )
1722fi
1723
Damien Millere8328192003-01-07 15:18:32 +11001724dnl see whether mkstemp() requires XXXXXX
1725if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1726AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001727AC_RUN_IFELSE(
1728 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001729#include <stdlib.h>
1730main() { char template[]="conftest.mkstemp-test";
1731if (mkstemp(template) == -1)
1732 exit(1);
1733unlink(template); exit(0);
1734}
Darren Tucker314d89e2005-10-17 23:29:23 +10001735 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001736 [
1737 AC_MSG_RESULT(no)
1738 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001739 [
Damien Millere8328192003-01-07 15:18:32 +11001740 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001741 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001742 ],
1743 [
1744 AC_MSG_RESULT(yes)
1745 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001746 ]
Damien Millere8328192003-01-07 15:18:32 +11001747)
1748fi
1749
Darren Tucker70a3d552003-08-21 17:58:29 +10001750dnl make sure that openpty does not reacquire controlling terminal
1751if test ! -z "$check_for_openpty_ctty_bug"; then
1752 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001753 AC_RUN_IFELSE(
1754 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001755#include <stdio.h>
1756#include <sys/fcntl.h>
1757#include <sys/types.h>
1758#include <sys/wait.h>
1759
1760int
1761main()
1762{
1763 pid_t pid;
1764 int fd, ptyfd, ttyfd, status;
1765
1766 pid = fork();
1767 if (pid < 0) { /* failed */
1768 exit(1);
1769 } else if (pid > 0) { /* parent */
1770 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001771 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001772 exit(WEXITSTATUS(status));
1773 else
1774 exit(2);
1775 } else { /* child */
1776 close(0); close(1); close(2);
1777 setsid();
1778 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1779 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1780 if (fd >= 0)
1781 exit(3); /* Acquired ctty: broken */
1782 else
1783 exit(0); /* Did not acquire ctty: OK */
1784 }
1785}
Darren Tucker314d89e2005-10-17 23:29:23 +10001786 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001787 [
1788 AC_MSG_RESULT(yes)
1789 ],
1790 [
1791 AC_MSG_RESULT(no)
1792 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001793 ],
1794 [
1795 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001796 ]
1797 )
1798fi
1799
Tim Rice8bb561b2005-03-17 16:23:19 -08001800if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1801 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001802 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001803 AC_RUN_IFELSE(
1804 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001805#include <stdio.h>
1806#include <sys/socket.h>
1807#include <netdb.h>
1808#include <errno.h>
1809#include <netinet/in.h>
1810
1811#define TEST_PORT "2222"
1812
1813int
1814main(void)
1815{
1816 int err, sock;
1817 struct addrinfo *gai_ai, *ai, hints;
1818 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1819
1820 memset(&hints, 0, sizeof(hints));
1821 hints.ai_family = PF_UNSPEC;
1822 hints.ai_socktype = SOCK_STREAM;
1823 hints.ai_flags = AI_PASSIVE;
1824
1825 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1826 if (err != 0) {
1827 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1828 exit(1);
1829 }
1830
1831 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1832 if (ai->ai_family != AF_INET6)
1833 continue;
1834
1835 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1836 sizeof(ntop), strport, sizeof(strport),
1837 NI_NUMERICHOST|NI_NUMERICSERV);
1838
1839 if (err != 0) {
1840 if (err == EAI_SYSTEM)
1841 perror("getnameinfo EAI_SYSTEM");
1842 else
1843 fprintf(stderr, "getnameinfo failed: %s\n",
1844 gai_strerror(err));
1845 exit(2);
1846 }
1847
1848 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1849 if (sock < 0)
1850 perror("socket");
1851 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1852 if (errno == EBADF)
1853 exit(3);
1854 }
1855 }
1856 exit(0);
1857}
Darren Tucker314d89e2005-10-17 23:29:23 +10001858 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001859 [
1860 AC_MSG_RESULT(yes)
1861 ],
1862 [
1863 AC_MSG_RESULT(no)
1864 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001865 ],
1866 [
1867 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001868 ]
1869 )
1870fi
1871
Tim Rice8bb561b2005-03-17 16:23:19 -08001872if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1873 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001874 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001875 AC_RUN_IFELSE(
1876 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001877#include <stdio.h>
1878#include <sys/socket.h>
1879#include <netdb.h>
1880#include <errno.h>
1881#include <netinet/in.h>
1882
1883#define TEST_PORT "2222"
1884
1885int
1886main(void)
1887{
1888 int err, sock;
1889 struct addrinfo *gai_ai, *ai, hints;
1890 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1891
1892 memset(&hints, 0, sizeof(hints));
1893 hints.ai_family = PF_UNSPEC;
1894 hints.ai_socktype = SOCK_STREAM;
1895 hints.ai_flags = AI_PASSIVE;
1896
1897 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1898 if (err != 0) {
1899 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1900 exit(1);
1901 }
1902
1903 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1904 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1905 continue;
1906
1907 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1908 sizeof(ntop), strport, sizeof(strport),
1909 NI_NUMERICHOST|NI_NUMERICSERV);
1910
1911 if (ai->ai_family == AF_INET && err != 0) {
1912 perror("getnameinfo");
1913 exit(2);
1914 }
1915 }
1916 exit(0);
1917}
Darren Tucker314d89e2005-10-17 23:29:23 +10001918 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001919 [
1920 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001921 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1922 [Define if you have a getaddrinfo that fails
1923 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001924 ],
1925 [
1926 AC_MSG_RESULT(no)
1927 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001928 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001929 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001930 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001931 ]
1932 )
1933fi
1934
Darren Tuckera56f1912004-11-02 20:30:54 +11001935if test "x$check_for_conflicting_getspnam" = "x1"; then
1936 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1937 AC_COMPILE_IFELSE(
1938 [
1939#include <shadow.h>
1940int main(void) {exit(0);}
1941 ],
1942 [
1943 AC_MSG_RESULT(no)
1944 ],
1945 [
1946 AC_MSG_RESULT(yes)
1947 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1948 [Conflicting defs for getspnam])
1949 ]
1950 )
1951fi
1952
Damien Miller606f8802000-09-16 15:39:56 +11001953AC_FUNC_GETPGRP
1954
Tim Riceaef73712002-05-11 13:17:42 -07001955# Search for OpenSSL
1956saved_CPPFLAGS="$CPPFLAGS"
1957saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001958AC_ARG_WITH(ssl-dir,
1959 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1960 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001961 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001962 case "$withval" in
1963 # Relative paths
1964 ./*|../*) withval="`pwd`/$withval"
1965 esac
Tim Riceaef73712002-05-11 13:17:42 -07001966 if test -d "$withval/lib"; then
1967 if test -n "${need_dash_r}"; then
1968 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1969 else
1970 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1971 fi
Darren Tucker9f8703b2010-04-23 11:12:06 +10001972 elif test -d "$withval/lib64"; then
1973 if test -n "${need_dash_r}"; then
1974 LDFLAGS="-L${withval}/lib64 -R${withval}/lib64 ${LDFLAGS}"
1975 else
1976 LDFLAGS="-L${withval}/lib64 ${LDFLAGS}"
1977 fi
Tim Riceaef73712002-05-11 13:17:42 -07001978 else
1979 if test -n "${need_dash_r}"; then
1980 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1981 else
1982 LDFLAGS="-L${withval} ${LDFLAGS}"
1983 fi
1984 fi
1985 if test -d "$withval/include"; then
1986 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1987 else
1988 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1989 fi
Damien Millera22ba012000-03-02 23:09:20 +11001990 fi
1991 ]
1992)
Tim Rice3d5352e2004-02-12 09:27:21 -08001993LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001994AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1995 [Define if your ssl headers are included
1996 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001997 [
Tim Riceaef73712002-05-11 13:17:42 -07001998 dnl Check default openssl install dir
1999 if test -n "${need_dash_r}"; then
2000 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002001 else
Tim Riceaef73712002-05-11 13:17:42 -07002002 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10002003 fi
Tim Riceaef73712002-05-11 13:17:42 -07002004 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10002005 AC_CHECK_HEADER([openssl/opensslv.h], ,
2006 AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
Tim Riceaef73712002-05-11 13:17:42 -07002007 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
2008 [
2009 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2010 ]
2011 )
2012 ]
2013)
2014
Tim Riced730b782002-08-13 18:52:10 -07002015# Determine OpenSSL header version
2016AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002017AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002018 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07002019#include <stdio.h>
2020#include <string.h>
2021#include <openssl/opensslv.h>
2022#define DATA "conftest.sslincver"
2023int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11002024 FILE *fd;
2025 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002026
Damien Millera8e06ce2003-11-21 23:48:55 +11002027 fd = fopen(DATA,"w");
2028 if(fd == NULL)
2029 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002030
2031 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2032 exit(1);
2033
2034 exit(0);
2035}
Darren Tucker623d92f2004-09-12 22:36:15 +10002036 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002037 [
2038 ssl_header_ver=`cat conftest.sslincver`
2039 AC_MSG_RESULT($ssl_header_ver)
2040 ],
2041 [
2042 AC_MSG_RESULT(not found)
2043 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002044 ],
2045 [
2046 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002047 ]
2048)
2049
2050# Determine OpenSSL library version
2051AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002052AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002053 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07002054#include <stdio.h>
2055#include <string.h>
2056#include <openssl/opensslv.h>
2057#include <openssl/crypto.h>
2058#define DATA "conftest.ssllibver"
2059int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11002060 FILE *fd;
2061 int rc;
Tim Riced730b782002-08-13 18:52:10 -07002062
Damien Millera8e06ce2003-11-21 23:48:55 +11002063 fd = fopen(DATA,"w");
2064 if(fd == NULL)
2065 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07002066
2067 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2068 exit(1);
2069
2070 exit(0);
2071}
Darren Tucker623d92f2004-09-12 22:36:15 +10002072 ]])],
Tim Riced730b782002-08-13 18:52:10 -07002073 [
2074 ssl_library_ver=`cat conftest.ssllibver`
2075 AC_MSG_RESULT($ssl_library_ver)
2076 ],
2077 [
2078 AC_MSG_RESULT(not found)
2079 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002080 ],
2081 [
2082 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07002083 ]
2084)
Damien Millera22ba012000-03-02 23:09:20 +11002085
Damien Miller9975e482007-03-05 11:51:27 +11002086AC_ARG_WITH(openssl-header-check,
2087 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2088 [ if test "x$withval" = "xno" ; then
2089 openssl_check_nonfatal=1
2090 fi
2091 ]
2092)
2093
Damien Millerec932372002-01-22 22:16:03 +11002094# Sanity check OpenSSL headers
2095AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002096AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002097 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11002098#include <string.h>
2099#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002100int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002101 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002102 [
2103 AC_MSG_RESULT(yes)
2104 ],
2105 [
2106 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11002107 if test "x$openssl_check_nonfatal" = "x"; then
2108 AC_MSG_ERROR([Your OpenSSL headers do not match your
2109library. Check config.log for details.
2110If you are sure your installation is consistent, you can disable the check
2111by running "./configure --without-openssl-header-check".
2112Also see contrib/findssl.sh for help identifying header/library mismatches.
2113])
2114 else
2115 AC_MSG_WARN([Your OpenSSL headers do not match your
2116library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002117Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002118 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002119 ],
2120 [
2121 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002122 ]
2123)
2124
Darren Tucker639bbe82006-08-20 20:17:53 +10002125AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2126AC_LINK_IFELSE(
2127 [AC_LANG_SOURCE([[
2128#include <openssl/evp.h>
2129int main(void) { SSLeay_add_all_algorithms(); }
2130 ]])],
2131 [
2132 AC_MSG_RESULT(yes)
2133 ],
2134 [
2135 AC_MSG_RESULT(no)
2136 saved_LIBS="$LIBS"
2137 LIBS="$LIBS -ldl"
2138 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2139 AC_LINK_IFELSE(
2140 [AC_LANG_SOURCE([[
2141#include <openssl/evp.h>
2142int main(void) { SSLeay_add_all_algorithms(); }
2143 ]])],
2144 [
2145 AC_MSG_RESULT(yes)
2146 ],
2147 [
2148 AC_MSG_RESULT(no)
2149 LIBS="$saved_LIBS"
2150 ]
2151 )
2152 ]
2153)
2154
Darren Tuckerebdef762010-12-04 23:20:50 +11002155AC_CHECK_FUNCS(RSA_generate_key_ex DSA_generate_parameters_ex BN_is_prime_ex)
2156
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002157AC_ARG_WITH(ssl-engine,
2158 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2159 [ if test "x$withval" != "xno" ; then
2160 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2161 AC_TRY_COMPILE(
2162 [ #include <openssl/engine.h>],
2163 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10002164ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002165 ],
2166 [ AC_MSG_RESULT(yes)
2167 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2168 [Enable OpenSSL engine support])
2169 ],
2170 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2171 )
2172 fi ]
2173)
2174
Darren Tucker129d0bb2005-12-19 17:40:40 +11002175# Check for OpenSSL without EVP_aes_{192,256}_cbc
2176AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002177AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11002178 [AC_LANG_SOURCE([[
2179#include <string.h>
2180#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11002181int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11002182 ]])],
2183 [
2184 AC_MSG_RESULT(no)
2185 ],
2186 [
2187 AC_MSG_RESULT(yes)
2188 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2189 [libcrypto is missing AES 192 and 256 bit functions])
2190 ]
2191)
2192
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002193AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2194AC_LINK_IFELSE(
2195 [AC_LANG_SOURCE([[
2196#include <string.h>
2197#include <openssl/evp.h>
2198int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2199 ]])],
2200 [
2201 AC_MSG_RESULT(yes)
2202 ],
2203 [
2204 AC_MSG_RESULT(no)
2205 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2206 [Define if EVP_DigestUpdate returns void])
2207 ]
2208)
2209
Tim Rice3d5352e2004-02-12 09:27:21 -08002210# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2211# because the system crypt() is more featureful.
2212if test "x$check_for_libcrypt_before" = "x1"; then
2213 AC_CHECK_LIB(crypt, crypt)
2214fi
2215
Damien Millera8e06ce2003-11-21 23:48:55 +11002216# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002217# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002218if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11002219 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002220fi
2221
Damien Milleraf87af12006-03-15 13:02:28 +11002222# Search for SHA256 support in libc and/or OpenSSL
2223AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2224
Damien Miller6af914a2010-09-10 11:39:26 +10002225# Check complete ECC support in OpenSSL
2226AC_MSG_CHECKING([whether OpenSSL has complete ECC support])
2227AC_LINK_IFELSE(
2228 [AC_LANG_SOURCE([[
2229#include <openssl/ec.h>
2230#include <openssl/evp.h>
2231#include <openssl/objects.h>
2232int main(void) {
2233 EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1);
2234 const EVP_MD *m = EVP_sha512(); /* We need this too */
2235}
2236 ]])],
2237 [
2238 AC_MSG_RESULT(yes)
2239 AC_DEFINE(OPENSSL_HAS_ECC, 1,
2240 [libcrypto includes complete ECC support])
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002241 TEST_SSH_ECC=yes
Damien Miller6af914a2010-09-10 11:39:26 +10002242 ],
2243 [
2244 AC_MSG_RESULT(no)
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002245 TEST_SSH_ECC=no
Damien Miller6af914a2010-09-10 11:39:26 +10002246 ]
2247)
Darren Tuckereab5f0d2010-11-05 18:23:38 +11002248AC_SUBST(TEST_SSH_ECC)
Damien Miller6af914a2010-09-10 11:39:26 +10002249
Tim Rice99203ec2007-03-26 09:35:28 -07002250saved_LIBS="$LIBS"
2251AC_CHECK_LIB(iaf, ia_openinfo, [
2252 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002253 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2254 AC_DEFINE(HAVE_LIBIAF, 1,
2255 [Define if system has libiaf that supports set_id])
2256 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002257])
2258LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002259
2260### Configure cryptographic random number support
2261
2262# Check wheter OpenSSL seeds itself
2263AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002264AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002265 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002266#include <string.h>
2267#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002268int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002269 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002270 [
2271 OPENSSL_SEEDS_ITSELF=yes
2272 AC_MSG_RESULT(yes)
2273 ],
2274 [
2275 AC_MSG_RESULT(no)
2276 # Default to use of the rand helper if OpenSSL doesn't
2277 # seed itself
2278 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002279 ],
2280 [
2281 AC_MSG_WARN([cross compiling: assuming yes])
2282 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002283 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002284 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002285 ]
2286)
2287
Darren Tucker3e6bde42006-08-20 20:03:50 +10002288# Check for PAM libs
2289PAM_MSG="no"
2290AC_ARG_WITH(pam,
2291 [ --with-pam Enable PAM support ],
2292 [
2293 if test "x$withval" != "xno" ; then
2294 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2295 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2296 AC_MSG_ERROR([PAM headers not found])
2297 fi
2298
2299 saved_LIBS="$LIBS"
2300 AC_CHECK_LIB(dl, dlopen, , )
2301 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2302 AC_CHECK_FUNCS(pam_getenvlist)
2303 AC_CHECK_FUNCS(pam_putenv)
2304 LIBS="$saved_LIBS"
2305
2306 PAM_MSG="yes"
2307
Darren Tucker20e9f972007-03-25 18:26:01 +10002308 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002309 AC_DEFINE(USE_PAM, 1,
2310 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002311
Darren Tucker3e6bde42006-08-20 20:03:50 +10002312 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002313 case "$LIBS" in
2314 *-ldl*)
2315 # libdl already in LIBS
2316 ;;
2317 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002318 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002319 ;;
2320 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002321 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002322 fi
2323 ]
2324)
2325
2326# Check for older PAM
2327if test "x$PAM_MSG" = "xyes" ; then
2328 # Check PAM strerror arguments (old PAM)
2329 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2330 AC_TRY_COMPILE(
2331 [
2332#include <stdlib.h>
2333#if defined(HAVE_SECURITY_PAM_APPL_H)
2334#include <security/pam_appl.h>
2335#elif defined (HAVE_PAM_PAM_APPL_H)
2336#include <pam/pam_appl.h>
2337#endif
2338 ],
2339 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2340 [AC_MSG_RESULT(no)],
2341 [
2342 AC_DEFINE(HAVE_OLD_PAM, 1,
2343 [Define if you have an old version of PAM
2344 which takes only one argument to pam_strerror])
2345 AC_MSG_RESULT(yes)
2346 PAM_MSG="yes (old library)"
2347 ]
2348 )
2349fi
Damien Miller6c21c512002-01-22 21:57:53 +11002350
2351# Do we want to force the use of the rand helper?
2352AC_ARG_WITH(rand-helper,
2353 [ --with-rand-helper Use subprocess to gather strong randomness ],
2354 [
2355 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002356 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002357 # the previous test showed it to be unseeded.
2358 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2359 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2360 OPENSSL_SEEDS_ITSELF=yes
2361 USE_RAND_HELPER=""
2362 fi
2363 else
2364 USE_RAND_HELPER=yes
2365 fi
2366 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002367)
Damien Miller6c21c512002-01-22 21:57:53 +11002368
2369# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002370if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002371 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002372 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2373 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002374 RAND_MSG="OpenSSL internal ONLY"
2375 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002376elif test ! -z "$USE_RAND_HELPER" ; then
2377 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002378 RAND_MSG="ssh-rand-helper"
2379 INSTALL_SSH_RAND_HELPER="yes"
2380fi
2381AC_SUBST(INSTALL_SSH_RAND_HELPER)
2382
2383### Configuration of ssh-rand-helper
2384
2385# PRNGD TCP socket
2386AC_ARG_WITH(prngd-port,
2387 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2388 [
Damien Millere996d722002-01-23 11:20:59 +11002389 case "$withval" in
2390 no)
2391 withval=""
2392 ;;
2393 [[0-9]]*)
2394 ;;
2395 *)
2396 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2397 ;;
2398 esac
2399 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002400 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002401 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2402 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002403 fi
2404 ]
2405)
2406
2407# PRNGD Unix domain socket
2408AC_ARG_WITH(prngd-socket,
2409 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2410 [
Damien Millere996d722002-01-23 11:20:59 +11002411 case "$withval" in
2412 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002413 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002414 ;;
2415 no)
2416 withval=""
2417 ;;
2418 /*)
2419 ;;
2420 *)
2421 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2422 ;;
2423 esac
2424
2425 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002426 if test ! -z "$PRNGD_PORT" ; then
2427 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2428 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002429 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002430 AC_MSG_WARN(Entropy socket is not readable)
2431 fi
2432 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002433 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2434 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002435 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002436 ],
2437 [
2438 # Check for existing socket only if we don't have a random device already
2439 if test "$USE_RAND_HELPER" = yes ; then
2440 AC_MSG_CHECKING(for PRNGD/EGD socket)
2441 # Insert other locations here
2442 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2443 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2444 PRNGD_SOCKET="$sock"
2445 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2446 break;
2447 fi
2448 done
2449 if test ! -z "$PRNGD_SOCKET" ; then
2450 AC_MSG_RESULT($PRNGD_SOCKET)
2451 else
2452 AC_MSG_RESULT(not found)
2453 fi
2454 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002455 ]
2456)
2457
2458# Change default command timeout for hashing entropy source
2459entropy_timeout=200
2460AC_ARG_WITH(entropy-timeout,
2461 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2462 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002463 if test -n "$withval" && test "x$withval" != "xno" && \
2464 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002465 entropy_timeout=$withval
2466 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002467 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002468)
Tim Rice7df8d392005-09-19 09:33:39 -07002469AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2470 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002471
Damien Millerd3f6ad22002-06-25 10:24:47 +10002472SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002473AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002474 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002475 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002476 if test -n "$withval" && test "x$withval" != "xno" && \
2477 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002478 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002479 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002480 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002481)
Tim Rice7df8d392005-09-19 09:33:39 -07002482AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2483 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002484AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002485
Tim Rice88f2ab52002-03-17 12:17:34 -08002486# We do this little dance with the search path to insure
2487# that programs that we select for use by installed programs
2488# (which may be run by the super-user) come from trusted
2489# locations before they come from the user's private area.
2490# This should help avoid accidentally configuring some
2491# random version of a program in someone's personal bin.
2492
2493OPATH=$PATH
2494PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002495test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002496test -d /sbin && PATH=$PATH:/sbin
2497test -d /usr/sbin && PATH=$PATH:/usr/sbin
2498PATH=$PATH:/etc:$OPATH
2499
Damien Millera8e06ce2003-11-21 23:48:55 +11002500# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002501OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2502OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2503OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2504OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2505OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2506OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2507OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2508OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2509OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2510OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2511OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2512OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2513OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2514OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2515OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2516OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002517# restore PATH
2518PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002519
2520# Where does ssh-rand-helper get its randomness from?
2521INSTALL_SSH_PRNG_CMDS=""
2522if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2523 if test ! -z "$PRNGD_PORT" ; then
2524 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2525 elif test ! -z "$PRNGD_SOCKET" ; then
2526 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2527 else
2528 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2529 RAND_HELPER_CMDHASH=yes
2530 INSTALL_SSH_PRNG_CMDS="yes"
2531 fi
2532fi
2533AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2534
2535
Ben Lindstromb5628642000-10-18 00:02:25 +00002536# Cheap hack to ensure NEWS-OS libraries are arranged right.
2537if test ! -z "$SONY" ; then
2538 LIBS="$LIBS -liberty";
2539fi
2540
Damien Miller57f39152005-11-24 19:58:19 +11002541# Check for long long datatypes
2542AC_CHECK_TYPES([long long, unsigned long long, long double])
2543
2544# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002545AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002546AC_CHECK_SIZEOF(short int, 2)
2547AC_CHECK_SIZEOF(int, 4)
2548AC_CHECK_SIZEOF(long int, 4)
2549AC_CHECK_SIZEOF(long long int, 8)
2550
Damien Millerfa2bb692002-04-23 23:22:25 +10002551# Sanity check long long for some platforms (AIX)
2552if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2553 ac_cv_sizeof_long_long_int=0
2554fi
2555
Darren Tucker537f1ed2005-10-25 18:38:33 +10002556# compute LLONG_MIN and LLONG_MAX if we don't know them.
2557if test -z "$have_llong_max"; then
2558 AC_MSG_CHECKING([for max value of long long])
2559 AC_RUN_IFELSE(
2560 [AC_LANG_SOURCE([[
2561#include <stdio.h>
2562/* Why is this so damn hard? */
2563#ifdef __GNUC__
2564# undef __GNUC__
2565#endif
2566#define __USE_ISOC99
2567#include <limits.h>
2568#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002569#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2570
2571/*
2572 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2573 * we do this the hard way.
2574 */
2575static int
2576fprint_ll(FILE *f, long long n)
2577{
2578 unsigned int i;
2579 int l[sizeof(long long) * 8];
2580
2581 if (n < 0)
2582 if (fprintf(f, "-") < 0)
2583 return -1;
2584 for (i = 0; n != 0; i++) {
2585 l[i] = my_abs(n % 10);
2586 n /= 10;
2587 }
2588 do {
2589 if (fprintf(f, "%d", l[--i]) < 0)
2590 return -1;
2591 } while (i != 0);
2592 if (fprintf(f, " ") < 0)
2593 return -1;
2594 return 0;
2595}
2596
Darren Tucker537f1ed2005-10-25 18:38:33 +10002597int main(void) {
2598 FILE *f;
2599 long long i, llmin, llmax = 0;
2600
2601 if((f = fopen(DATA,"w")) == NULL)
2602 exit(1);
2603
2604#if defined(LLONG_MIN) && defined(LLONG_MAX)
2605 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2606 llmin = LLONG_MIN;
2607 llmax = LLONG_MAX;
2608#else
2609 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2610 /* This will work on one's complement and two's complement */
2611 for (i = 1; i > llmax; i <<= 1, i++)
2612 llmax = i;
2613 llmin = llmax + 1LL; /* wrap */
2614#endif
2615
2616 /* Sanity check */
2617 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002618 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2619 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002620 fprintf(f, "unknown unknown\n");
2621 exit(2);
2622 }
2623
Darren Tuckerd1450db2006-03-13 19:06:51 +11002624 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002625 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002626 if (fprint_ll(f, llmax) < 0)
2627 exit(4);
2628 if (fclose(f) < 0)
2629 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002630 exit(0);
2631}
2632 ]])],
2633 [
2634 llong_min=`$AWK '{print $1}' conftest.llminmax`
2635 llong_max=`$AWK '{print $2}' conftest.llminmax`
2636
Darren Tucker537f1ed2005-10-25 18:38:33 +10002637 AC_MSG_RESULT($llong_max)
2638 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2639 [max value of long long calculated by configure])
2640 AC_MSG_CHECKING([for min value of long long])
2641 AC_MSG_RESULT($llong_min)
2642 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2643 [min value of long long calculated by configure])
2644 ],
2645 [
2646 AC_MSG_RESULT(not found)
2647 ],
2648 [
2649 AC_MSG_WARN([cross compiling: not checking])
2650 ]
2651 )
2652fi
2653
2654
Damien Millera22ba012000-03-02 23:09:20 +11002655# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002656AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2657 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002658 [ #include <sys/types.h> ],
2659 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002660 [ ac_cv_have_u_int="yes" ],
2661 [ ac_cv_have_u_int="no" ]
2662 )
2663])
2664if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002665 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002666 have_u_int=1
2667fi
2668
Damien Miller61e50f12000-05-08 20:49:37 +10002669AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2670 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002671 [ #include <sys/types.h> ],
2672 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002673 [ ac_cv_have_intxx_t="yes" ],
2674 [ ac_cv_have_intxx_t="no" ]
2675 )
2676])
2677if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002678 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002679 have_intxx_t=1
2680fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002681
2682if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002683 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002684then
2685 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2686 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002687 [ #include <stdint.h> ],
2688 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002689 [
2690 AC_DEFINE(HAVE_INTXX_T)
2691 AC_MSG_RESULT(yes)
2692 ],
2693 [ AC_MSG_RESULT(no) ]
2694 )
2695fi
2696
Damien Miller578783e2000-09-23 14:12:24 +11002697AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2698 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002699 [
2700#include <sys/types.h>
2701#ifdef HAVE_STDINT_H
2702# include <stdint.h>
2703#endif
2704#include <sys/socket.h>
2705#ifdef HAVE_SYS_BITYPES_H
2706# include <sys/bitypes.h>
2707#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002708 ],
2709 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002710 [ ac_cv_have_int64_t="yes" ],
2711 [ ac_cv_have_int64_t="no" ]
2712 )
2713])
2714if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002715 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002716fi
2717
Damien Miller61e50f12000-05-08 20:49:37 +10002718AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2719 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002720 [ #include <sys/types.h> ],
2721 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002722 [ ac_cv_have_u_intxx_t="yes" ],
2723 [ ac_cv_have_u_intxx_t="no" ]
2724 )
2725])
2726if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002727 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002728 have_u_intxx_t=1
2729fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002730
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002731if test -z "$have_u_intxx_t" ; then
2732 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2733 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002734 [ #include <sys/socket.h> ],
2735 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002736 [
2737 AC_DEFINE(HAVE_U_INTXX_T)
2738 AC_MSG_RESULT(yes)
2739 ],
2740 [ AC_MSG_RESULT(no) ]
2741 )
2742fi
2743
Damien Miller578783e2000-09-23 14:12:24 +11002744AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2745 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002746 [ #include <sys/types.h> ],
2747 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002748 [ ac_cv_have_u_int64_t="yes" ],
2749 [ ac_cv_have_u_int64_t="no" ]
2750 )
2751])
2752if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002753 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002754 have_u_int64_t=1
2755fi
2756
Tim Rice4cec93f2002-02-26 08:40:48 -08002757if test -z "$have_u_int64_t" ; then
2758 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2759 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002760 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002761 [ u_int64_t a; a = 1],
2762 [
2763 AC_DEFINE(HAVE_U_INT64_T)
2764 AC_MSG_RESULT(yes)
2765 ],
2766 [ AC_MSG_RESULT(no) ]
2767 )
2768fi
2769
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002770if test -z "$have_u_intxx_t" ; then
2771 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2772 AC_TRY_COMPILE(
2773 [
2774#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002775 ],
2776 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002777 [ ac_cv_have_uintxx_t="yes" ],
2778 [ ac_cv_have_uintxx_t="no" ]
2779 )
2780 ])
2781 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002782 AC_DEFINE(HAVE_UINTXX_T, 1,
2783 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002784 fi
2785fi
2786
2787if test -z "$have_uintxx_t" ; then
2788 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2789 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002790 [ #include <stdint.h> ],
2791 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002792 [
2793 AC_DEFINE(HAVE_UINTXX_T)
2794 AC_MSG_RESULT(yes)
2795 ],
2796 [ AC_MSG_RESULT(no) ]
2797 )
2798fi
2799
Damien Milleredb82922000-06-20 13:25:52 +10002800if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002801 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002802then
2803 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2804 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002805 [
2806#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002807 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002808 [
Damien Miller70494d12000-04-03 15:57:06 +10002809 int8_t a; int16_t b; int32_t c;
2810 u_int8_t e; u_int16_t f; u_int32_t g;
2811 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002812 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002813 [
2814 AC_DEFINE(HAVE_U_INTXX_T)
2815 AC_DEFINE(HAVE_INTXX_T)
2816 AC_MSG_RESULT(yes)
2817 ],
2818 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002819 )
Damien Millerb29ea912000-01-15 14:12:03 +11002820fi
2821
Damien Miller58be7382001-09-15 21:31:54 +10002822
2823AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2824 AC_TRY_COMPILE(
2825 [
2826#include <sys/types.h>
2827 ],
2828 [ u_char foo; foo = 125; ],
2829 [ ac_cv_have_u_char="yes" ],
2830 [ ac_cv_have_u_char="no" ]
2831 )
2832])
2833if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002834 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002835fi
2836
Tim Rice13aae5e2001-10-21 17:53:58 -07002837TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002838
Tim Rice200a5c02002-02-26 22:12:34 -08002839AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Darren Tucker598eaa62008-06-09 03:32:29 +10002840AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2841#include <sys/types.h>
2842#ifdef HAVE_SYS_BITYPES_H
2843#include <sys/bitypes.h>
2844#endif
2845#ifdef HAVE_SYS_STATFS_H
2846#include <sys/statfs.h>
2847#endif
2848#ifdef HAVE_SYS_STATVFS_H
2849#include <sys/statvfs.h>
2850#endif
2851])
Tim Rice4cec93f2002-02-26 08:40:48 -08002852
Darren Tucker30ed6682009-03-07 18:06:22 +11002853AC_CHECK_TYPES([in_addr_t, in_port_t],,,
Damien Miller848b9932005-02-24 12:12:34 +11002854[#include <sys/types.h>
2855#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002856
Damien Miller61e50f12000-05-08 20:49:37 +10002857AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2858 AC_TRY_COMPILE(
2859 [
2860#include <sys/types.h>
2861 ],
2862 [ size_t foo; foo = 1235; ],
2863 [ ac_cv_have_size_t="yes" ],
2864 [ ac_cv_have_size_t="no" ]
2865 )
2866])
2867if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002868 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002869fi
Damien Miller95058511999-12-29 10:36:45 +11002870
Damien Miller615f9392000-05-17 22:53:33 +10002871AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2872 AC_TRY_COMPILE(
2873 [
2874#include <sys/types.h>
2875 ],
2876 [ ssize_t foo; foo = 1235; ],
2877 [ ac_cv_have_ssize_t="yes" ],
2878 [ ac_cv_have_ssize_t="no" ]
2879 )
2880])
2881if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002882 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002883fi
2884
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002885AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2886 AC_TRY_COMPILE(
2887 [
2888#include <time.h>
2889 ],
2890 [ clock_t foo; foo = 1235; ],
2891 [ ac_cv_have_clock_t="yes" ],
2892 [ ac_cv_have_clock_t="no" ]
2893 )
2894])
2895if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002896 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002897fi
2898
Damien Millerb54b40e2000-06-23 08:23:34 +10002899AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2900 AC_TRY_COMPILE(
2901 [
2902#include <sys/types.h>
2903#include <sys/socket.h>
2904 ],
2905 [ sa_family_t foo; foo = 1235; ],
2906 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002907 [ AC_TRY_COMPILE(
2908 [
2909#include <sys/types.h>
2910#include <sys/socket.h>
2911#include <netinet/in.h>
2912 ],
2913 [ sa_family_t foo; foo = 1235; ],
2914 [ ac_cv_have_sa_family_t="yes" ],
2915
Damien Millerb54b40e2000-06-23 08:23:34 +10002916 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002917 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002918 )
2919])
2920if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002921 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2922 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002923fi
2924
Damien Miller0f91b4e2000-06-18 15:43:25 +10002925AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2926 AC_TRY_COMPILE(
2927 [
2928#include <sys/types.h>
2929 ],
2930 [ pid_t foo; foo = 1235; ],
2931 [ ac_cv_have_pid_t="yes" ],
2932 [ ac_cv_have_pid_t="no" ]
2933 )
2934])
2935if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002936 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002937fi
2938
2939AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2940 AC_TRY_COMPILE(
2941 [
2942#include <sys/types.h>
2943 ],
2944 [ mode_t foo; foo = 1235; ],
2945 [ ac_cv_have_mode_t="yes" ],
2946 [ ac_cv_have_mode_t="no" ]
2947 )
2948])
2949if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002950 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002951fi
2952
Damien Miller61e50f12000-05-08 20:49:37 +10002953
2954AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2955 AC_TRY_COMPILE(
2956 [
Damien Miller81171112000-04-23 11:14:01 +10002957#include <sys/types.h>
2958#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002959 ],
2960 [ struct sockaddr_storage s; ],
2961 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2962 [ ac_cv_have_struct_sockaddr_storage="no" ]
2963 )
2964])
2965if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002966 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2967 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002968fi
Damien Miller34132e52000-01-14 15:45:46 +11002969
Damien Miller61e50f12000-05-08 20:49:37 +10002970AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2971 AC_TRY_COMPILE(
2972 [
Damien Miller7b22d652000-06-18 14:07:04 +10002973#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002974#include <netinet/in.h>
2975 ],
2976 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2977 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2978 [ ac_cv_have_struct_sockaddr_in6="no" ]
2979 )
2980])
2981if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002982 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2983 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002984fi
Damien Miller34132e52000-01-14 15:45:46 +11002985
Damien Miller61e50f12000-05-08 20:49:37 +10002986AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2987 AC_TRY_COMPILE(
2988 [
Damien Miller7b22d652000-06-18 14:07:04 +10002989#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002990#include <netinet/in.h>
2991 ],
2992 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2993 [ ac_cv_have_struct_in6_addr="yes" ],
2994 [ ac_cv_have_struct_in6_addr="no" ]
2995 )
2996])
2997if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002998 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2999 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08003000
3001dnl Now check for sin6_scope_id
3002 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
3003 [
3004#ifdef HAVE_SYS_TYPES_H
3005#include <sys/types.h>
3006#endif
3007#include <netinet/in.h>
3008 ])
Damien Miller61e50f12000-05-08 20:49:37 +10003009fi
Damien Miller34132e52000-01-14 15:45:46 +11003010
Damien Miller61e50f12000-05-08 20:49:37 +10003011AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
3012 AC_TRY_COMPILE(
3013 [
Damien Miller81171112000-04-23 11:14:01 +10003014#include <sys/types.h>
3015#include <sys/socket.h>
3016#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003017 ],
3018 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
3019 [ ac_cv_have_struct_addrinfo="yes" ],
3020 [ ac_cv_have_struct_addrinfo="no" ]
3021 )
3022])
3023if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003024 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
3025 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10003026fi
3027
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003028AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
3029 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11003030 [ #include <sys/time.h> ],
3031 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003032 [ ac_cv_have_struct_timeval="yes" ],
3033 [ ac_cv_have_struct_timeval="no" ]
3034 )
3035])
3036if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003037 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00003038 have_struct_timeval=1
3039fi
3040
Tim Rice4e4dc562003-03-18 10:21:40 -08003041AC_CHECK_TYPES(struct timespec)
3042
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003043# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08003044if test "x$ac_cv_have_int64_t" = "xno" && \
3045 test "x$ac_cv_sizeof_long_int" != "x8" && \
3046 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00003047 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3048 echo "an alternative compiler (I.E., GCC) before continuing."
3049 echo ""
3050 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08003051else
3052dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10003053 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10003054 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08003055#include <stdio.h>
3056#include <string.h>
3057#ifdef HAVE_SNPRINTF
3058main()
3059{
3060 char buf[50];
3061 char expected_out[50];
3062 int mazsize = 50 ;
3063#if (SIZEOF_LONG_INT == 8)
3064 long int num = 0x7fffffffffffffff;
3065#else
Kevin Steves6482ec82001-07-15 02:09:28 +00003066 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08003067#endif
3068 strcpy(expected_out, "9223372036854775807");
3069 snprintf(buf, mazsize, "%lld", num);
3070 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11003071 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08003072 exit(0);
3073}
3074#else
3075main() { exit(0); }
3076#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10003077 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10003078 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08003079 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003080fi
3081
Damien Miller78315eb2000-09-29 23:01:36 +11003082dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10003083OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3084OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3085OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3086OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3087OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10003088OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10003089OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3090OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10003091OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10003092OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3093OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3094OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3095OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00003096OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3097OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3098OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3099OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07003100
3101AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11003102AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3103 [Define if we don't have struct __res_state in resolv.h])],
3104[
3105#include <stdio.h>
3106#if HAVE_SYS_TYPES_H
3107# include <sys/types.h>
3108#endif
3109#include <netinet/in.h>
3110#include <arpa/nameser.h>
3111#include <resolv.h>
3112])
andre2ff7b5d2000-06-03 14:57:40 +00003113
Damien Miller61e50f12000-05-08 20:49:37 +10003114AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3115 ac_cv_have_ss_family_in_struct_ss, [
3116 AC_TRY_COMPILE(
3117 [
Damien Miller81171112000-04-23 11:14:01 +10003118#include <sys/types.h>
3119#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003120 ],
3121 [ struct sockaddr_storage s; s.ss_family = 1; ],
3122 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3123 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3124 )
3125])
3126if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003127 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003128fi
3129
Damien Miller61e50f12000-05-08 20:49:37 +10003130AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3131 ac_cv_have___ss_family_in_struct_ss, [
3132 AC_TRY_COMPILE(
3133 [
Damien Miller81171112000-04-23 11:14:01 +10003134#include <sys/types.h>
3135#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003136 ],
3137 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3138 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3139 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3140 )
3141])
3142if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003143 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3144 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003145fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003146
Damien Millerad833b32000-08-23 10:46:23 +10003147AC_CACHE_CHECK([for pw_class field in struct passwd],
3148 ac_cv_have_pw_class_in_struct_passwd, [
3149 AC_TRY_COMPILE(
3150 [
Damien Millerad833b32000-08-23 10:46:23 +10003151#include <pwd.h>
3152 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00003153 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10003154 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3155 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3156 )
3157])
3158if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003159 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3160 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003161fi
3162
Kevin Steves82456952001-06-22 21:14:18 +00003163AC_CACHE_CHECK([for pw_expire field in struct passwd],
3164 ac_cv_have_pw_expire_in_struct_passwd, [
3165 AC_TRY_COMPILE(
3166 [
3167#include <pwd.h>
3168 ],
3169 [ struct passwd p; p.pw_expire = 0; ],
3170 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3171 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3172 )
3173])
3174if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003175 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3176 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003177fi
3178
3179AC_CACHE_CHECK([for pw_change field in struct passwd],
3180 ac_cv_have_pw_change_in_struct_passwd, [
3181 AC_TRY_COMPILE(
3182 [
3183#include <pwd.h>
3184 ],
3185 [ struct passwd p; p.pw_change = 0; ],
3186 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3187 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3188 )
3189])
3190if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003191 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3192 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003193fi
Damien Miller61e50f12000-05-08 20:49:37 +10003194
Tim Rice28bbb0c2002-05-27 17:37:32 -07003195dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003196AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3197 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10003198 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00003199 [
Tim Riceae49fe62002-04-12 10:26:21 -07003200#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003201#include <sys/socket.h>
3202#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07003203int main() {
3204#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003205#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003206exit(1);
3207#endif
3208struct msghdr m;
3209m.msg_accrights = 0;
3210exit(0);
3211}
Kevin Steves939c9db2002-03-22 17:23:25 +00003212 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00003213 [ ac_cv_have_accrights_in_msghdr="yes" ],
3214 [ ac_cv_have_accrights_in_msghdr="no" ]
3215 )
3216])
3217if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003218 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3219 [Define if your system uses access rights style
3220 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003221fi
3222
Darren Tucker32780622009-06-16 16:11:02 +10003223AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
Darren Tucker77001382008-06-09 06:17:53 +10003224AC_TRY_COMPILE([
3225#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003226#include <sys/stat.h>
3227#ifdef HAVE_SYS_TIME_H
3228# include <sys/time.h>
3229#endif
3230#ifdef HAVE_SYS_MOUNT_H
3231#include <sys/mount.h>
3232#endif
3233#ifdef HAVE_SYS_STATVFS_H
3234#include <sys/statvfs.h>
3235#endif
3236], [struct statvfs s; s.f_fsid = 0;],
3237[ AC_MSG_RESULT(yes) ],
3238[ AC_MSG_RESULT(no)
3239
3240 AC_MSG_CHECKING(if fsid_t has member val)
3241 AC_TRY_COMPILE([
3242#include <sys/types.h>
Darren Tucker77001382008-06-09 06:17:53 +10003243#include <sys/statvfs.h>],
Darren Tucker32780622009-06-16 16:11:02 +10003244 [fsid_t t; t.val[0] = 0;],
Darren Tucker77001382008-06-09 06:17:53 +10003245 [ AC_MSG_RESULT(yes)
Darren Tucker32780622009-06-16 16:11:02 +10003246 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3247 [ AC_MSG_RESULT(no) ])
3248
3249 AC_MSG_CHECKING(if f_fsid has member __val)
3250 AC_TRY_COMPILE([
3251#include <sys/types.h>
3252#include <sys/statvfs.h>],
3253 [fsid_t t; t.__val[0] = 0;],
3254 [ AC_MSG_RESULT(yes)
3255 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3256 [ AC_MSG_RESULT(no) ])
3257])
Darren Tucker77001382008-06-09 06:17:53 +10003258
Kevin Stevesa44e0352002-04-07 16:18:03 +00003259AC_CACHE_CHECK([for msg_control field in struct msghdr],
3260 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10003261 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00003262 [
Tim Riceae49fe62002-04-12 10:26:21 -07003263#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003264#include <sys/socket.h>
3265#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07003266int main() {
3267#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003268#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003269exit(1);
3270#endif
3271struct msghdr m;
3272m.msg_control = 0;
3273exit(0);
3274}
Kevin Stevesa44e0352002-04-07 16:18:03 +00003275 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003276 [ ac_cv_have_control_in_msghdr="yes" ],
3277 [ ac_cv_have_control_in_msghdr="no" ]
3278 )
3279])
3280if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003281 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3282 [Define if your system uses ancillary data style
3283 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003284fi
3285
Damien Miller61e50f12000-05-08 20:49:37 +10003286AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003287 AC_TRY_LINK([],
3288 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10003289 [ ac_cv_libc_defines___progname="yes" ],
3290 [ ac_cv_libc_defines___progname="no" ]
3291 )
3292])
3293if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003294 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003295fi
3296
Kevin Steves4846f4a2002-03-22 18:19:53 +00003297AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3298 AC_TRY_LINK([
3299#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003300],
3301 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003302 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3303 [ ac_cv_cc_implements___FUNCTION__="no" ]
3304 )
3305])
3306if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003307 AC_DEFINE(HAVE___FUNCTION__, 1,
3308 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003309fi
3310
3311AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3312 AC_TRY_LINK([
3313#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003314],
3315 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003316 [ ac_cv_cc_implements___func__="yes" ],
3317 [ ac_cv_cc_implements___func__="no" ]
3318 )
3319])
3320if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003321 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003322fi
3323
Damien Miller57f39152005-11-24 19:58:19 +11003324AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3325 AC_TRY_LINK(
3326 [#include <stdarg.h>
3327 va_list x,y;],
3328 [va_copy(x,y);],
3329 [ ac_cv_have_va_copy="yes" ],
3330 [ ac_cv_have_va_copy="no" ]
3331 )
3332])
3333if test "x$ac_cv_have_va_copy" = "xyes" ; then
3334 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3335fi
3336
3337AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3338 AC_TRY_LINK(
3339 [#include <stdarg.h>
3340 va_list x,y;],
3341 [__va_copy(x,y);],
3342 [ ac_cv_have___va_copy="yes" ],
3343 [ ac_cv_have___va_copy="no" ]
3344 )
3345])
3346if test "x$ac_cv_have___va_copy" = "xyes" ; then
3347 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3348fi
3349
Damien Miller4f8e6692001-07-14 13:22:53 +10003350AC_CACHE_CHECK([whether getopt has optreset support],
3351 ac_cv_have_getopt_optreset, [
3352 AC_TRY_LINK(
3353 [
3354#include <getopt.h>
3355 ],
3356 [ extern int optreset; optreset = 0; ],
3357 [ ac_cv_have_getopt_optreset="yes" ],
3358 [ ac_cv_have_getopt_optreset="no" ]
3359 )
3360])
3361if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003362 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3363 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003364fi
Damien Millera22ba012000-03-02 23:09:20 +11003365
Damien Millerecbb26d2000-07-15 14:59:14 +10003366AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003367 AC_TRY_LINK([],
3368 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003369 [ ac_cv_libc_defines_sys_errlist="yes" ],
3370 [ ac_cv_libc_defines_sys_errlist="no" ]
3371 )
3372])
3373if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003374 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3375 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003376fi
3377
3378
Damien Miller11fa2cc2000-08-16 10:35:58 +10003379AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003380 AC_TRY_LINK([],
3381 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003382 [ ac_cv_libc_defines_sys_nerr="yes" ],
3383 [ ac_cv_libc_defines_sys_nerr="no" ]
3384 )
3385])
3386if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003387 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003388fi
3389
Darren Tucker5f88d342003-10-15 16:57:57 +10003390# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003391AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003392 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3393 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003394 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003395 # Needed by our getrrsetbyname()
3396 AC_SEARCH_LIBS(res_query, resolv)
3397 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003398 AC_MSG_CHECKING(if res_query will link)
Darren Tuckere02b49a2009-09-11 14:56:08 +10003399 AC_LINK_IFELSE([
3400#include "confdefs.h"
3401#include <sys/types.h>
3402#include <netinet/in.h>
3403#include <arpa/nameser.h>
3404#include <netdb.h>
3405#include <resolv.h>
3406int main()
3407{
3408 res_query (0, 0, 0, 0, 0);
3409 return 0;
3410}
3411 ],
3412 AC_MSG_RESULT(yes),
Darren Tucker8e968a52004-05-13 11:56:16 +10003413 [AC_MSG_RESULT(no)
3414 saved_LIBS="$LIBS"
3415 LIBS="$LIBS -lresolv"
3416 AC_MSG_CHECKING(for res_query in -lresolv)
3417 AC_LINK_IFELSE([
Darren Tuckere02b49a2009-09-11 14:56:08 +10003418#include "confdefs.h"
3419#include <sys/types.h>
3420#include <netinet/in.h>
3421#include <arpa/nameser.h>
3422#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003423#include <resolv.h>
3424int main()
3425{
3426 res_query (0, 0, 0, 0, 0);
3427 return 0;
3428}
3429 ],
Darren Tuckere02b49a2009-09-11 14:56:08 +10003430 [AC_MSG_RESULT(yes)],
Darren Tucker8e968a52004-05-13 11:56:16 +10003431 [LIBS="$saved_LIBS"
3432 AC_MSG_RESULT(no)])
3433 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003434 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003435 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003436 [#include <sys/types.h>
3437 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003438 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003439 [AC_DEFINE(HAVE_HEADER_AD, 1,
3440 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003441 [#include <arpa/nameser.h>])
3442 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003443
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003444AC_MSG_CHECKING(if struct __res_state _res is an extern)
3445AC_LINK_IFELSE([
3446#include <stdio.h>
3447#if HAVE_SYS_TYPES_H
3448# include <sys/types.h>
3449#endif
3450#include <netinet/in.h>
3451#include <arpa/nameser.h>
3452#include <resolv.h>
3453extern struct __res_state _res;
3454int main() { return 0; }
3455 ],
3456 [AC_MSG_RESULT(yes)
3457 AC_DEFINE(HAVE__RES_EXTERN, 1,
3458 [Define if you have struct __res_state _res as an extern])
3459 ],
3460 [ AC_MSG_RESULT(no) ]
3461)
3462
Damien Miller73b42d22006-04-22 21:26:08 +10003463# Check whether user wants SELinux support
3464SELINUX_MSG="no"
3465LIBSELINUX=""
3466AC_ARG_WITH(selinux,
Damien Miller5b1c8b32008-03-27 12:33:07 +11003467 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003468 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003469 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003470 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3471 SELINUX_MSG="yes"
3472 AC_CHECK_HEADER([selinux/selinux.h], ,
Damien Miller1d2bfc42010-02-10 10:19:29 +11003473 AC_MSG_ERROR(SELinux support requires selinux.h header))
3474 AC_CHECK_LIB(selinux, setexeccon,
3475 [ LIBSELINUX="-lselinux"
3476 LIBS="$LIBS -lselinux"
3477 ],
3478 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003479 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003480 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003481 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003482 fi ]
3483)
Damien Miller73b42d22006-04-22 21:26:08 +10003484
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003485# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003486KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003487AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003488 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003489 [ if test "x$withval" != "xno" ; then
3490 if test "x$withval" = "xyes" ; then
3491 KRB5ROOT="/usr/local"
3492 else
3493 KRB5ROOT=${withval}
3494 fi
3495
Tim Rice7df8d392005-09-19 09:33:39 -07003496 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003497 KRB5_MSG="yes"
3498
Darren Tuckerdad48e72009-09-01 18:26:00 +10003499 AC_PATH_PROG([KRB5CONF],[krb5-config],
3500 [$KRB5ROOT/bin/krb5-config],
3501 [$KRB5ROOT/bin:$PATH])
3502 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003503
3504 AC_MSG_CHECKING(for gssapi support)
3505 if $KRB5CONF | grep gssapi >/dev/null ; then
3506 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003507 AC_DEFINE(GSSAPI, 1,
3508 [Define this if you want GSSAPI
3509 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003510 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003511 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003512 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003513 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003514 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003515 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3516 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003517 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003518 AC_MSG_CHECKING(whether we are using Heimdal)
3519 AC_TRY_COMPILE([ #include <krb5.h> ],
3520 [ char *tmp = heimdal_version; ],
3521 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003522 AC_DEFINE(HEIMDAL, 1,
3523 [Define this if you are using the
3524 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003525 AC_MSG_RESULT(no)
3526 )
3527 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003528 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003529 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003530 AC_MSG_CHECKING(whether we are using Heimdal)
3531 AC_TRY_COMPILE([ #include <krb5.h> ],
3532 [ char *tmp = heimdal_version; ],
3533 [ AC_MSG_RESULT(yes)
3534 AC_DEFINE(HEIMDAL)
Damien Miller41bccf72011-01-02 21:53:07 +11003535 K5LIBS="-lkrb5"
Damien Miller5561e0b2004-04-20 20:28:55 +10003536 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003537 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003538 [K5LIBS="$K5LIBS -lroken"])
Damien Miller41bccf72011-01-02 21:53:07 +11003539 AC_CHECK_LIB(des, des_cbc_encrypt,
3540 [K5LIBS="$K5LIBS -ldes"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003541 ],
3542 [ AC_MSG_RESULT(no)
3543 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3544 ]
3545 )
Damien Miller200d0a72003-06-30 19:21:36 +10003546 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003547
Darren Tucker30fd49e2008-06-14 09:14:46 +10003548 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003549 [ AC_DEFINE(GSSAPI)
Darren Tucker30fd49e2008-06-14 09:14:46 +10003550 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3551 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003552 [ AC_DEFINE(GSSAPI)
Darren Tucker30fd49e2008-06-14 09:14:46 +10003553 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003554 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3555 $K5LIBS)
3556 ],
3557 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003558
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003559 AC_CHECK_HEADER(gssapi.h, ,
3560 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003561 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003562 AC_CHECK_HEADERS(gssapi.h, ,
3563 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003564 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003565 ]
3566 )
3567
3568 oldCPP="$CPPFLAGS"
3569 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3570 AC_CHECK_HEADER(gssapi_krb5.h, ,
3571 [ CPPFLAGS="$oldCPP" ])
3572
Damien Millera8e06ce2003-11-21 23:48:55 +11003573 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003574 if test ! -z "$need_dash_r" ; then
3575 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3576 fi
3577 if test ! -z "$blibpath" ; then
3578 blibpath="$blibpath:${KRB5ROOT}/lib"
3579 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003580
3581 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3582 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3583 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3584
3585 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003586 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3587 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003588 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003589 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003590)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003591
Damien Millera22ba012000-03-02 23:09:20 +11003592# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003593
Damien Millerf58c6722002-05-13 13:15:42 +10003594PRIVSEP_PATH=/var/empty
3595AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003596 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003597 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003598 if test -n "$withval" && test "x$withval" != "xno" && \
3599 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003600 PRIVSEP_PATH=$withval
3601 fi
3602 ]
3603)
3604AC_SUBST(PRIVSEP_PATH)
3605
Damien Millera22ba012000-03-02 23:09:20 +11003606AC_ARG_WITH(xauth,
3607 [ --with-xauth=PATH Specify path to xauth program ],
3608 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003609 if test -n "$withval" && test "x$withval" != "xno" && \
3610 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003611 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003612 fi
3613 ],
3614 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003615 TestPath="$PATH"
3616 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3617 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3618 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3619 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3620 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003621 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003622 xauth_path="/usr/openwin/bin/xauth"
3623 fi
3624 ]
3625)
3626
Damien Miller7d901272003-01-13 16:55:22 +11003627STRIP_OPT=-s
3628AC_ARG_ENABLE(strip,
3629 [ --disable-strip Disable calling strip(1) on install],
3630 [
3631 if test "x$enableval" = "xno" ; then
3632 STRIP_OPT=
3633 fi
3634 ]
3635)
3636AC_SUBST(STRIP_OPT)
3637
Damien Millera19cf472000-11-29 13:28:50 +11003638if test -z "$xauth_path" ; then
3639 XAUTH_PATH="undefined"
3640 AC_SUBST(XAUTH_PATH)
3641else
Tim Rice7df8d392005-09-19 09:33:39 -07003642 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3643 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003644 XAUTH_PATH=$xauth_path
3645 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003646fi
Damien Millera22ba012000-03-02 23:09:20 +11003647
3648# Check for mail directory (last resort if we cannot get it from headers)
3649if test ! -z "$MAIL" ; then
3650 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003651 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3652 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003653fi
3654
Darren Tucker623d92f2004-09-12 22:36:15 +10003655if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003656 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3657 disable_ptmx_check=yes
3658fi
Damien Millera22ba012000-03-02 23:09:20 +11003659if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003660 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003661 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003662 [
Tim Rice7df8d392005-09-19 09:33:39 -07003663 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3664 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003665 have_dev_ptmx=1
3666 ]
3667 )
3668 fi
Damien Millera22ba012000-03-02 23:09:20 +11003669fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003670
Darren Tucker623d92f2004-09-12 22:36:15 +10003671if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003672 AC_CHECK_FILE("/dev/ptc",
3673 [
Tim Rice7df8d392005-09-19 09:33:39 -07003674 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3675 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003676 have_dev_ptc=1
3677 ]
3678 )
3679else
3680 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3681fi
Damien Miller204ad072000-03-02 23:56:12 +11003682
Damien Millera22ba012000-03-02 23:09:20 +11003683# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003684AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003685 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003686 [
Damien Miller897741e2001-04-16 10:41:46 +10003687 case "$withval" in
3688 man|cat|doc)
3689 MANTYPE=$withval
3690 ;;
3691 *)
3692 AC_MSG_ERROR(invalid man type: $withval)
3693 ;;
3694 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003695 ]
3696)
Ben Lindstrombc709922001-04-18 18:04:21 +00003697if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003698 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3699 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003700 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3701 MANTYPE=doc
3702 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3703 MANTYPE=man
3704 else
3705 MANTYPE=cat
3706 fi
3707fi
Damien Miller670a4b82000-01-22 13:53:11 +11003708AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003709if test "$MANTYPE" = "doc"; then
3710 mansubdir=man;
3711else
3712 mansubdir=$MANTYPE;
3713fi
3714AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003715
Damien Millera22ba012000-03-02 23:09:20 +11003716# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003717MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003718AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003719 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003720 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003721 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003722 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3723 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003724 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003725 fi
3726 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003727)
3728
Damien Millera22ba012000-03-02 23:09:20 +11003729# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003730AC_ARG_WITH(shadow,
3731 [ --without-shadow Disable shadow password support],
3732 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003733 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003734 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003735 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003736 fi
3737 ]
3738)
3739
Damien Miller1f335fb2000-06-26 11:31:33 +10003740if test -z "$disable_shadow" ; then
3741 AC_MSG_CHECKING([if the systems has expire shadow information])
3742 AC_TRY_COMPILE(
3743 [
3744#include <sys/types.h>
3745#include <shadow.h>
3746 struct spwd sp;
3747 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3748 [ sp_expire_available=yes ], []
3749 )
3750
3751 if test "x$sp_expire_available" = "xyes" ; then
3752 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003753 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3754 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003755 else
3756 AC_MSG_RESULT(no)
3757 fi
3758fi
3759
Damien Millera22ba012000-03-02 23:09:20 +11003760# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003761if test ! -z "$IPADDR_IN_DISPLAY" ; then
3762 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003763 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3764 [Define if you need to use IP address
3765 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003766else
Damien Millera8e06ce2003-11-21 23:48:55 +11003767 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003768 AC_ARG_WITH(ipaddr-display,
3769 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3770 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003771 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003772 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003773 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003774 fi
3775 ]
3776 )
3777fi
Damien Miller76112de1999-12-21 11:18:08 +11003778
Darren Tuckere1a790d2003-09-16 11:52:19 +10003779# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003780AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003781 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003782 [ if test "x$enableval" = "xno"; then
3783 AC_MSG_NOTICE([/etc/default/login handling disabled])
3784 etc_default_login=no
3785 else
3786 etc_default_login=yes
3787 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003788 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3789 then
3790 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3791 etc_default_login=no
3792 else
3793 etc_default_login=yes
3794 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003795)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003796
Darren Tucker2f9573d2005-02-10 22:28:54 +11003797if test "x$etc_default_login" != "xno"; then
3798 AC_CHECK_FILE("/etc/default/login",
3799 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003800 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003801 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3802 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003803 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003804fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003805
Tim Rice43a1c132002-04-17 21:19:14 -07003806dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003807if test $ac_cv_func_login_getcapbool = "yes" && \
3808 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003809 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003810fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003811
Damien Millera22ba012000-03-02 23:09:20 +11003812# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003813SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003814AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003815 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003816 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003817 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003818 AC_MSG_WARN([
3819--with-default-path=PATH has no effect on this system.
3820Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003821 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003822 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003823 AC_MSG_WARN([
3824--with-default-path=PATH will only be used if PATH is not defined in
3825$external_path_file .])
3826 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003827 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003828 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003829 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003830 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003831 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3832 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003833 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003834 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003835 AC_MSG_WARN([
3836If PATH is defined in $external_path_file, ensure the path to scp is included,
3837otherwise scp will not work.])
3838 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003839 AC_RUN_IFELSE(
3840 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003841/* find out what STDPATH is */
3842#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003843#ifdef HAVE_PATHS_H
3844# include <paths.h>
3845#endif
3846#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003847# ifdef _PATH_USERPATH /* Irix */
3848# define _PATH_STDPATH _PATH_USERPATH
3849# else
3850# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3851# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003852#endif
3853#include <sys/types.h>
3854#include <sys/stat.h>
3855#include <fcntl.h>
3856#define DATA "conftest.stdpath"
3857
3858main()
3859{
3860 FILE *fd;
3861 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003862
Tim Rice59ea0a02001-03-10 13:50:45 -08003863 fd = fopen(DATA,"w");
3864 if(fd == NULL)
3865 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003866
Tim Rice59ea0a02001-03-10 13:50:45 -08003867 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3868 exit(1);
3869
3870 exit(0);
3871}
Darren Tucker314d89e2005-10-17 23:29:23 +10003872 ]])],
3873 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003874 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3875 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3876 )
3877# make sure $bindir is in USER_PATH so scp will work
3878 t_bindir=`eval echo ${bindir}`
3879 case $t_bindir in
3880 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3881 esac
3882 case $t_bindir in
3883 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3884 esac
3885 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3886 if test $? -ne 0 ; then
3887 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3888 if test $? -ne 0 ; then
3889 user_path=$user_path:$t_bindir
3890 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3891 fi
3892 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003893 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003894)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003895if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003896 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003897 AC_SUBST(user_path)
3898fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003899
Damien Millera18bbd32002-05-13 10:48:57 +10003900# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003901AC_ARG_WITH(superuser-path,
3902 [ --with-superuser-path= Specify different path for super-user],
3903 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003904 if test -n "$withval" && test "x$withval" != "xno" && \
3905 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003906 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3907 [Define if you want a different $PATH
3908 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003909 superuser_path=$withval
3910 fi
3911 ]
3912)
3913
3914
Damien Miller61e50f12000-05-08 20:49:37 +10003915AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003916IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003917AC_ARG_WITH(4in6,
3918 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3919 [
3920 if test "x$withval" != "xno" ; then
3921 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003922 AC_DEFINE(IPV4_IN_IPV6, 1,
3923 [Detect IPv4 in IPv6 mapped addresses
3924 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003925 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003926 else
3927 AC_MSG_RESULT(no)
3928 fi
3929 ],[
3930 if test "x$inet6_default_4in6" = "xyes"; then
3931 AC_MSG_RESULT([yes (default)])
3932 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003933 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003934 else
3935 AC_MSG_RESULT([no (default)])
3936 fi
3937 ]
3938)
3939
Damien Miller60396b02001-02-18 17:01:00 +11003940# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003941BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003942AC_ARG_WITH(bsd-auth,
3943 [ --with-bsd-auth Enable BSD auth support],
3944 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003945 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003946 AC_DEFINE(BSD_AUTH, 1,
3947 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003948 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003949 fi
3950 ]
3951)
3952
Damien Millera22ba012000-03-02 23:09:20 +11003953# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003954piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003955# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003956if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003957 piddir=`eval echo ${sysconfdir}`
3958 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003959 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003960 esac
3961fi
3962
Tim Rice88f2ab52002-03-17 12:17:34 -08003963AC_ARG_WITH(pid-dir,
3964 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3965 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003966 if test -n "$withval" && test "x$withval" != "xno" && \
3967 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003968 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003969 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003970 AC_MSG_WARN([** no $piddir directory on this system **])
3971 fi
3972 fi
3973 ]
3974)
3975
Tim Rice7df8d392005-09-19 09:33:39 -07003976AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003977AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003978
andre2ff7b5d2000-06-03 14:57:40 +00003979dnl allow user to disable some login recording features
3980AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003981 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003982 [
3983 if test "x$enableval" = "xno" ; then
3984 AC_DEFINE(DISABLE_LASTLOG)
3985 fi
3986 ]
andre2ff7b5d2000-06-03 14:57:40 +00003987)
3988AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003989 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003990 [
3991 if test "x$enableval" = "xno" ; then
3992 AC_DEFINE(DISABLE_UTMP)
3993 fi
3994 ]
andre2ff7b5d2000-06-03 14:57:40 +00003995)
3996AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003997 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003998 [
3999 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07004000 AC_DEFINE(DISABLE_UTMPX, 1,
4001 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004002 fi
4003 ]
andre2ff7b5d2000-06-03 14:57:40 +00004004)
4005AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00004006 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004007 [
4008 if test "x$enableval" = "xno" ; then
4009 AC_DEFINE(DISABLE_WTMP)
4010 fi
4011 ]
andre2ff7b5d2000-06-03 14:57:40 +00004012)
4013AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00004014 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004015 [
4016 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07004017 AC_DEFINE(DISABLE_WTMPX, 1,
4018 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004019 fi
4020 ]
andre2ff7b5d2000-06-03 14:57:40 +00004021)
4022AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00004023 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004024 [
4025 if test "x$enableval" = "xno" ; then
4026 AC_DEFINE(DISABLE_LOGIN)
4027 fi
4028 ]
andre2ff7b5d2000-06-03 14:57:40 +00004029)
4030AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00004031 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004032 [
4033 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07004034 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4035 [Define if you don't want to use pututline()
4036 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10004037 fi
4038 ]
andre2ff7b5d2000-06-03 14:57:40 +00004039)
4040AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00004041 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10004042 [
4043 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07004044 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4045 [Define if you don't want to use pututxline()
4046 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10004047 fi
4048 ]
andre2ff7b5d2000-06-03 14:57:40 +00004049)
4050AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00004051 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11004052 [
Tim Riceeae17cc2005-03-17 16:52:20 -08004053 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11004054 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08004055 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11004056 conf_lastlog_location=$withval
4057 fi
4058 ]
4059)
andre2ff7b5d2000-06-03 14:57:40 +00004060
4061dnl lastlog, [uw]tmpx? detection
4062dnl NOTE: set the paths in the platform section to avoid the
4063dnl need for command-line parameters
4064dnl lastlog and [uw]tmp are subject to a file search if all else fails
4065
4066dnl lastlog detection
4067dnl NOTE: the code itself will detect if lastlog is a directory
4068AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4069AC_TRY_COMPILE([
4070#include <sys/types.h>
4071#include <utmp.h>
4072#ifdef HAVE_LASTLOG_H
4073# include <lastlog.h>
4074#endif
Damien Miller2994e082000-06-04 15:51:47 +10004075#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004076# include <paths.h>
4077#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004078#ifdef HAVE_LOGIN_H
4079# include <login.h>
4080#endif
andre2ff7b5d2000-06-03 14:57:40 +00004081 ],
4082 [ char *lastlog = LASTLOG_FILE; ],
4083 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10004084 [
4085 AC_MSG_RESULT(no)
4086 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4087 AC_TRY_COMPILE([
4088#include <sys/types.h>
4089#include <utmp.h>
4090#ifdef HAVE_LASTLOG_H
4091# include <lastlog.h>
4092#endif
4093#ifdef HAVE_PATHS_H
4094# include <paths.h>
4095#endif
4096 ],
4097 [ char *lastlog = _PATH_LASTLOG; ],
4098 [ AC_MSG_RESULT(yes) ],
4099 [
andree441aa32000-06-12 22:34:38 +00004100 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10004101 system_lastlog_path=no
4102 ])
4103 ]
andre2ff7b5d2000-06-03 14:57:40 +00004104)
Damien Miller2994e082000-06-04 15:51:47 +10004105
andre2ff7b5d2000-06-03 14:57:40 +00004106if test -z "$conf_lastlog_location"; then
4107 if test x"$system_lastlog_path" = x"no" ; then
4108 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004109 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004110 conf_lastlog_location=$f
4111 fi
4112 done
4113 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004114 AC_MSG_WARN([** Cannot find lastlog **])
4115 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004116 fi
4117 fi
4118fi
4119
4120if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07004121 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4122 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004123fi
andre2ff7b5d2000-06-03 14:57:40 +00004124
4125dnl utmp detection
4126AC_MSG_CHECKING([if your system defines UTMP_FILE])
4127AC_TRY_COMPILE([
4128#include <sys/types.h>
4129#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004130#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004131# include <paths.h>
4132#endif
4133 ],
4134 [ char *utmp = UTMP_FILE; ],
4135 [ AC_MSG_RESULT(yes) ],
4136 [ AC_MSG_RESULT(no)
4137 system_utmp_path=no ]
4138)
4139if test -z "$conf_utmp_location"; then
4140 if test x"$system_utmp_path" = x"no" ; then
4141 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4142 if test -f $f ; then
4143 conf_utmp_location=$f
4144 fi
4145 done
4146 if test -z "$conf_utmp_location"; then
4147 AC_DEFINE(DISABLE_UTMP)
4148 fi
4149 fi
4150fi
4151if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07004152 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4153 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004154fi
andre2ff7b5d2000-06-03 14:57:40 +00004155
4156dnl wtmp detection
4157AC_MSG_CHECKING([if your system defines WTMP_FILE])
4158AC_TRY_COMPILE([
4159#include <sys/types.h>
4160#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004161#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004162# include <paths.h>
4163#endif
4164 ],
4165 [ char *wtmp = WTMP_FILE; ],
4166 [ AC_MSG_RESULT(yes) ],
4167 [ AC_MSG_RESULT(no)
4168 system_wtmp_path=no ]
4169)
4170if test -z "$conf_wtmp_location"; then
4171 if test x"$system_wtmp_path" = x"no" ; then
4172 for f in /usr/adm/wtmp /var/log/wtmp; do
4173 if test -f $f ; then
4174 conf_wtmp_location=$f
4175 fi
4176 done
4177 if test -z "$conf_wtmp_location"; then
4178 AC_DEFINE(DISABLE_WTMP)
4179 fi
4180 fi
4181fi
4182if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07004183 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4184 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004185fi
andre2ff7b5d2000-06-03 14:57:40 +00004186
4187
andre2ff7b5d2000-06-03 14:57:40 +00004188dnl wtmpx detection
4189AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4190AC_TRY_COMPILE([
4191#include <sys/types.h>
4192#include <utmp.h>
4193#ifdef HAVE_UTMPX_H
4194#include <utmpx.h>
4195#endif
Damien Miller2994e082000-06-04 15:51:47 +10004196#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004197# include <paths.h>
4198#endif
4199 ],
4200 [ char *wtmpx = WTMPX_FILE; ],
4201 [ AC_MSG_RESULT(yes) ],
4202 [ AC_MSG_RESULT(no)
4203 system_wtmpx_path=no ]
4204)
4205if test -z "$conf_wtmpx_location"; then
4206 if test x"$system_wtmpx_path" = x"no" ; then
4207 AC_DEFINE(DISABLE_WTMPX)
4208 fi
4209else
Tim Rice7df8d392005-09-19 09:33:39 -07004210 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4211 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004212fi
andre2ff7b5d2000-06-03 14:57:40 +00004213
Damien Miller4018c192000-04-30 09:30:44 +10004214
Damien Miller29ea30d2000-03-17 10:54:15 +11004215if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004216 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4217 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004218fi
4219
Darren Tucker7da23cb2005-08-03 00:20:15 +10004220dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4221dnl Add now.
4222CFLAGS="$CFLAGS $werror_flags"
4223
Darren Tucker627337d2010-04-10 22:58:01 +10004224if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4225 TEST_SSH_IPV6=no
4226else
4227 TEST_SSH_IPV6=yes
4228fi
4229AC_CHECK_DECL(BROKEN_GETADDRINFO, TEST_SSH_IPV6=no)
4230AC_SUBST(TEST_SSH_IPV6, $TEST_SSH_IPV6)
Darren Tucker5d376902008-06-11 04:15:05 +10004231
Damien Millerbac2d8a2000-09-05 16:13:06 +11004232AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004233AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4234 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
Damien Millerd8f60022010-02-12 09:34:22 +11004235 ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004236AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004237
Damien Miller7b22d652000-06-18 14:07:04 +10004238# Print summary of options
4239
Damien Miller7b22d652000-06-18 14:07:04 +10004240# Someone please show me a better way :)
4241A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4242B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4243C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4244D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004245E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004246F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004247G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004248H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4249I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4250J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004251
4252echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004253echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004254echo " User binaries: $B"
4255echo " System binaries: $C"
4256echo " Configuration files: $D"
4257echo " Askpass program: $E"
4258echo " Manual pages: $F"
4259echo " PID file: $G"
4260echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004261if test "x$external_path_file" = "x/etc/login.conf" ; then
4262echo " At runtime, sshd will use the path defined in $external_path_file"
4263echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004264else
Damien Millerf58c6722002-05-13 13:15:42 +10004265echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004266 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004267echo " (If PATH is set in $external_path_file it will be used instead. If"
4268echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4269 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004270fi
Damien Millera18bbd32002-05-13 10:48:57 +10004271if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004272echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004273fi
Damien Millerf58c6722002-05-13 13:15:42 +10004274echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004275echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004276echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004277echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004278echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004279echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004280echo " S/KEY support: $SKEY_MSG"
4281echo " TCP Wrappers support: $TCPW_MSG"
4282echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004283echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004284echo " Solaris process contract support: $SPC_MSG"
Darren Tucker97528352010-11-05 12:03:05 +11004285echo " Solaris project support: $SP_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004286echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004287echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4288echo " BSD Auth support: $BSD_AUTH_MSG"
4289echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004290if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004291echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004292fi
4293
Damien Miller7b22d652000-06-18 14:07:04 +10004294echo ""
4295
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004296echo " Host: ${host}"
4297echo " Compiler: ${CC}"
4298echo " Compiler flags: ${CFLAGS}"
4299echo "Preprocessor flags: ${CPPFLAGS}"
4300echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004301echo " Libraries: ${LIBS}"
4302if test ! -z "${SSHDLIBS}"; then
4303echo " +for sshd: ${SSHDLIBS}"
4304fi
Damien Miller7b22d652000-06-18 14:07:04 +10004305
4306echo ""
4307
Tim Rice6f1f7582004-05-30 21:38:51 -07004308if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004309 echo "SVR4 style packages are supported with \"make package\""
4310 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004311fi
4312
Damien Miller82cf0ce2000-12-20 13:34:48 +11004313if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004314 echo "PAM is enabled. You may need to install a PAM control file "
4315 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004316 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004317 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004318 echo ""
4319fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004320
Damien Miller6c21c512002-01-22 21:57:53 +11004321if test ! -z "$RAND_HELPER_CMDHASH" ; then
4322 echo "WARNING: you are using the builtin random number collection "
4323 echo "service. Please read WARNING.RNG and request that your OS "
4324 echo "vendor includes kernel-based random number collection in "
4325 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004326 echo ""
4327fi
Damien Miller60396b02001-02-18 17:01:00 +11004328
Damien Millerb4097182004-05-23 14:09:40 +10004329if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004330 echo "WARNING: the operating system that you are using does not"
4331 echo "appear to support getpeereid(), getpeerucred() or the"
4332 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4333 echo "enforce security checks to prevent unauthorised connections to"
4334 echo "ssh-agent. Their absence increases the risk that a malicious"
4335 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004336 echo ""
4337fi
4338
Darren Tuckerd9f88912005-02-20 21:01:48 +11004339if test "$AUDIT_MODULE" = "bsm" ; then
4340 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4341 echo "See the Solaris section in README.platform for details."
4342fi