blob: a105de71d2ab53ae9bf2d03c46b2b2746b84be0d [file] [log] [blame]
Tim Rice4a7db1c2010-01-16 12:23:25 -08001# $Id: configure.ac,v 1.436 2010/01/16 20:23:25 tim Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Tim Rice4a7db1c2010-01-16 12:23:25 -080018AC_REVISION($Revision: 1.436 $)
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)
Tim Ricef7ba8f62004-06-20 10:37:32 -070044AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110045
Tim Rice6f1f7582004-05-30 21:38:51 -070046dnl for buildpkg.sh
47AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110052if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54else
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56fi
Tim Rice6f1f7582004-05-30 21:38:51 -070057
Damien Millere8bb4502001-09-25 16:39:35 +100058# System features
59AC_SYS_LARGEFILE
60
Damien Miller3f62aba2000-11-29 11:56:35 +110061if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63fi
64
Damien Millerad833b32000-08-23 10:46:23 +100065# Use LOGIN_PROGRAM from environment if possible
66if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070067 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100070else
71 # Search for login
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75 fi
76fi
77
Darren Tucker23bc8d02004-02-06 16:24:31 +110078AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070080 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110082fi
83
Damien Miller166bd442000-03-16 10:48:25 +110084if test -z "$LD" ; then
85 LD=$CC
86fi
87AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080088
Damien Miller166bd442000-03-16 10:48:25 +110089AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100090
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
Darren Tuckerb7918af2008-03-09 11:34:23 +110093use_stack_protector=1
94AC_ARG_WITH(stackprotect,
Damien Millerda3155e2008-03-27 12:30:18 +110095 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +110096 if test "x$withval" = "xno"; then
97 use_stack_protector=0
98 fi ])
99
Damien Millera8e06ce2003-11-21 23:48:55 +1100100if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +1000101 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +1100102 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700103 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000104 1.*) no_attrib_nonnull=1 ;;
105 2.8* | 2.9*)
106 CFLAGS="$CFLAGS -Wsign-compare"
107 no_attrib_nonnull=1
108 ;;
109 2.*) no_attrib_nonnull=1 ;;
Damien Miller73193b32008-07-09 21:07:19 +1000110 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
111 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100112 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700113 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000114
Darren Tucker330c93f2008-06-16 02:27:48 +1000115 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
116 saved_CFLAGS="$CFLAGS"
117 CFLAGS="$CFLAGS -fno-builtin-memset"
118 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
119#include <string.h>
120int main(void){char b[10]; memset(b, 0, sizeof(b));}
121 ]])],
122 [ AC_MSG_RESULT(yes) ],
123 [ AC_MSG_RESULT(no)
124 CFLAGS="$saved_CFLAGS" ]
125)
126
Darren Tuckerb7918af2008-03-09 11:34:23 +1100127 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100128 # and/or platforms, so we test if we can. If it's not supported
Damien Miller7df2e402008-12-08 09:35:36 +1100129 # on a given platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100130 if test "x$use_stack_protector" = "x1"; then
131 for t in -fstack-protector-all -fstack-protector; do
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100132 AC_MSG_CHECKING(if $CC supports $t)
Darren Tuckerb7918af2008-03-09 11:34:23 +1100133 saved_CFLAGS="$CFLAGS"
134 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100135 CFLAGS="$CFLAGS $t -Werror"
136 LDFLAGS="$LDFLAGS $t -Werror"
137 AC_LINK_IFELSE(
138 [AC_LANG_SOURCE([
Damien Miller7df2e402008-12-08 09:35:36 +1100139#include <stdio.h>
140int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100141 ])],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100142 [ AC_MSG_RESULT(yes)
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100143 CFLAGS="$saved_CFLAGS $t"
144 LDFLAGS="$saved_LDFLAGS $t"
Darren Tuckerb7918af2008-03-09 11:34:23 +1100145 AC_MSG_CHECKING(if $t works)
146 AC_RUN_IFELSE(
147 [AC_LANG_SOURCE([
Damien Miller7df2e402008-12-08 09:35:36 +1100148#include <stdio.h>
149int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
Darren Tuckerb7918af2008-03-09 11:34:23 +1100150 ])],
151 [ AC_MSG_RESULT(yes)
152 break ],
153 [ AC_MSG_RESULT(no) ],
154 [ AC_MSG_WARN([cross compiling: cannot test])
155 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100156 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100157 ],
158 [ AC_MSG_RESULT(no) ]
159 )
160 CFLAGS="$saved_CFLAGS"
161 LDFLAGS="$saved_LDFLAGS"
162 done
163 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100164
Darren Tucker67b37032005-06-03 17:58:31 +1000165 if test -z "$have_llong_max"; then
166 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
167 unset ac_cv_have_decl_LLONG_MAX
168 saved_CFLAGS="$CFLAGS"
169 CFLAGS="$CFLAGS -std=gnu99"
170 AC_CHECK_DECL(LLONG_MAX,
171 [have_llong_max=1],
172 [CFLAGS="$saved_CFLAGS"],
173 [#include <limits.h>]
174 )
175 fi
Damien Miller166bd442000-03-16 10:48:25 +1100176fi
177
Darren Tucker391de5c2007-04-29 14:49:21 +1000178if test "x$no_attrib_nonnull" != "x1" ; then
179 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
180fi
181
Tim Rice88368a32003-12-08 12:35:59 -0800182AC_ARG_WITH(rpath,
183 [ --without-rpath Disable auto-added -R linker paths],
184 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800185 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800186 need_dash_r=""
187 fi
188 if test "x$withval" = "xyes" ; then
189 need_dash_r=1
190 fi
191 ]
192)
193
Tim Rice1cfab232006-10-03 09:34:35 -0700194# Allow user to specify flags
195AC_ARG_WITH(cflags,
196 [ --with-cflags Specify additional flags to pass to compiler],
197 [
198 if test -n "$withval" && test "x$withval" != "xno" && \
199 test "x${withval}" != "xyes"; then
200 CFLAGS="$CFLAGS $withval"
201 fi
202 ]
203)
204AC_ARG_WITH(cppflags,
205 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
206 [
207 if test -n "$withval" && test "x$withval" != "xno" && \
208 test "x${withval}" != "xyes"; then
209 CPPFLAGS="$CPPFLAGS $withval"
210 fi
211 ]
212)
213AC_ARG_WITH(ldflags,
214 [ --with-ldflags Specify additional flags to pass to linker],
215 [
216 if test -n "$withval" && test "x$withval" != "xno" && \
217 test "x${withval}" != "xyes"; then
218 LDFLAGS="$LDFLAGS $withval"
219 fi
220 ]
221)
222AC_ARG_WITH(libs,
223 [ --with-libs Specify additional libraries to link with],
224 [
225 if test -n "$withval" && test "x$withval" != "xno" && \
226 test "x${withval}" != "xyes"; then
227 LIBS="$LIBS $withval"
228 fi
229 ]
230)
231AC_ARG_WITH(Werror,
232 [ --with-Werror Build main code with -Werror],
233 [
234 if test -n "$withval" && test "x$withval" != "xno"; then
235 werror_flags="-Werror"
236 if test "x${withval}" != "xyes"; then
237 werror_flags="$withval"
238 fi
239 fi
240 ]
241)
242
243AC_CHECK_HEADERS( \
244 bstring.h \
245 crypt.h \
246 crypto/sha2.h \
247 dirent.h \
248 endian.h \
249 features.h \
250 fcntl.h \
251 floatingpoint.h \
252 getopt.h \
253 glob.h \
254 ia.h \
255 iaf.h \
256 limits.h \
257 login.h \
258 maillock.h \
259 ndir.h \
260 net/if_tun.h \
261 netdb.h \
262 netgroup.h \
263 pam/pam_appl.h \
264 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000265 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700266 pty.h \
267 readpassphrase.h \
268 rpc/types.h \
269 security/pam_appl.h \
270 sha2.h \
271 shadow.h \
272 stddef.h \
273 stdint.h \
274 string.h \
275 strings.h \
276 sys/audit.h \
277 sys/bitypes.h \
278 sys/bsdtty.h \
279 sys/cdefs.h \
280 sys/dir.h \
281 sys/mman.h \
282 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000283 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700284 sys/prctl.h \
285 sys/pstat.h \
286 sys/select.h \
287 sys/stat.h \
288 sys/stream.h \
289 sys/stropts.h \
290 sys/strtio.h \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +1000291 sys/statvfs.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700292 sys/sysmacros.h \
293 sys/time.h \
294 sys/timers.h \
295 sys/un.h \
296 time.h \
297 tmpdir.h \
298 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700299 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700300 unistd.h \
301 usersec.h \
302 util.h \
303 utime.h \
304 utmp.h \
305 utmpx.h \
306 vis.h \
307)
308
309# lastlog.h requires sys/time.h to be included first on Solaris
310AC_CHECK_HEADERS(lastlog.h, [], [], [
311#ifdef HAVE_SYS_TIME_H
312# include <sys/time.h>
313#endif
314])
315
316# sys/ptms.h requires sys/stream.h to be included first on Solaris
317AC_CHECK_HEADERS(sys/ptms.h, [], [], [
318#ifdef HAVE_SYS_STREAM_H
319# include <sys/stream.h>
320#endif
321])
322
323# login_cap.h requires sys/types.h on NetBSD
324AC_CHECK_HEADERS(login_cap.h, [], [], [
325#include <sys/types.h>
326])
327
Darren Tuckerc4b22ca2009-07-12 21:56:29 +1000328# older BSDs need sys/param.h before sys/mount.h
329AC_CHECK_HEADERS(sys/mount.h, [], [], [
330#include <sys/param.h>
331])
332
Damien Miller1b06dc32006-08-31 03:24:41 +1000333# Messages for features tested for in target-specific section
334SIA_MSG="no"
335SPC_MSG="no"
336
Damien Millera22ba012000-03-02 23:09:20 +1100337# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100338case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100339*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000340 # Some versions of VAC won't allow macro redefinitions at
341 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
342 # particularly with older versions of vac or xlc.
343 # It also throws errors about null macro argments, but these are
344 # not fatal.
345 AC_MSG_CHECKING(if compiler allows macro redefinitions)
346 AC_COMPILE_IFELSE(
347 [AC_LANG_SOURCE([[
348#define testmacro foo
349#define testmacro bar
350int main(void) { exit(0); }
351 ]])],
352 [ AC_MSG_RESULT(yes) ],
353 [ AC_MSG_RESULT(no)
354 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
355 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
356 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
357 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
358 ]
359 )
360
Damien Millera8e06ce2003-11-21 23:48:55 +1100361 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000362 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800363 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100364 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000365 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000366 if test "$GCC" = "yes"; then
367 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
368 else
369 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
370 fi
371 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000372 if (test -z "$blibflags"); then
373 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
374 AC_TRY_LINK([], [], [blibflags=$tryflags])
375 fi
376 done
377 if (test -z "$blibflags"); then
378 AC_MSG_RESULT(not found)
379 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
380 else
381 AC_MSG_RESULT($blibflags)
382 fi
383 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000384 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700385 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
386 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700387 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000388 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700389 LIBS="$LIBS -ls"
390 ])
391 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100392 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100393 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100394 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000395 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100396 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000397 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
398 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000399 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000400 [(void)loginfailed("user","host","tty",0);],
401 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700402 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
403 [Define if your AIX loginfailed() function
404 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000405 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000406 )],
407 [],
408 [#include <usersec.h>]
409 )
Darren Tucker0f26b132008-02-28 23:16:04 +1100410 AC_CHECK_FUNCS(getgrset setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000411 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000412 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000413 [],
414 [ #include <limits.h>
415 #include <fcntl.h> ]
416 )
Darren Tucker691d5232005-02-15 21:45:57 +1100417 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700418 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
419 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
420 [Define if your platform breaks doing a seteuid before a setuid])
421 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
422 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000423 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700424 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
425 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
426 [Some systems need a utmpx entry for /bin/login to work])
427 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
428 [Define to a Set Process Title type if your system is
429 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100430 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
431 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000432 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100433 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100434*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100435 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100436 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700437 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
438 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
439 AC_DEFINE(DISABLE_SHADOW, 1,
440 [Define if you want to disable shadow passwords])
Tim Rice7df8d392005-09-19 09:33:39 -0700441 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
442 [Define if X11 doesn't support AF_UNIX sockets on that system])
443 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
444 [Define if the concept of ports only accessible to
445 superusers isn't known])
446 AC_DEFINE(DISABLE_FD_PASSING, 1,
447 [Define if your platform needs to skip post auth
448 file descriptor passing])
Darren Tucker86e30a02009-08-28 11:21:06 +1000449 AC_DEFINE(SSH_IOBUFSZ, 65536, [Windows is sensitive to read buffer size])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100450 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000451*-*-dgux*)
Tim Ricea74000e2009-03-18 11:25:02 -0700452 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
453 [Define if your system choked on IP TOS setting])
Darren Tucker454da0b2003-12-18 12:52:19 +1100454 AC_DEFINE(SETEUID_BREAKS_SETUID)
455 AC_DEFINE(BROKEN_SETREUID)
456 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000457 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000458*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000459 AC_MSG_CHECKING(if we have working getaddrinfo)
460 AC_TRY_RUN([#include <mach-o/dyld.h>
461main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
462 exit(0);
463 else
464 exit(1);
465}], [AC_MSG_RESULT(working)],
466 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700467 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700468 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000469 AC_DEFINE(SETEUID_BREAKS_SETUID)
470 AC_DEFINE(BROKEN_SETREUID)
471 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker528d6fa2007-12-31 21:29:26 +1100472 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
Tim Rice7df8d392005-09-19 09:33:39 -0700473 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
474 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000475 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
476 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
477 [Use tunnel device compatibility to OpenBSD])
478 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
479 [Prepend the address family to IP tunnel traffic])
Darren Tuckeracada072008-02-25 21:05:04 +1100480 m4_pattern_allow(AU_IPv)
481 AC_CHECK_DECL(AU_IPv4, [],
482 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
483 [#include <bsm/audit.h>]
Damien Miller20e231f2009-02-12 13:12:21 +1100484 AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
485 [Define if pututxline updates lastlog too])
Darren Tuckeracada072008-02-25 21:05:04 +1100486 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000487 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000488*-*-dragonfly*)
489 SSHDLIBS="$SSHDLIBS -lcrypt"
490 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000491*-*-hpux*)
492 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000493 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100494 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000495 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700496 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
497 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000498 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700499 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
500 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000501 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000502 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700503 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000504 AC_CHECK_LIB(xnet, t_error, ,
505 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
506
507 # next, we define all of the options specific to major releases
508 case "$host" in
509 *-*-hpux10*)
510 if test -z "$GCC"; then
511 CFLAGS="$CFLAGS -Ae"
512 fi
513 ;;
514 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700515 AC_DEFINE(PAM_SUN_CODEBASE, 1,
516 [Define if you are using Solaris-derived PAM which
517 passes pam_messages to the conversation function
518 with an extra level of indirection])
519 AC_DEFINE(DISABLE_UTMP, 1,
520 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000521 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
522 check_for_hpux_broken_getaddrinfo=1
523 check_for_conflicting_getspnam=1
524 ;;
525 esac
526
527 # lastly, we define options specific to minor releases
528 case "$host" in
529 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700530 AC_DEFINE(HAVE_SECUREWARE, 1,
531 [Define if you have SecureWare-based
532 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000533 disable_ptmx_check=yes
534 LIBS="$LIBS -lsecpw"
535 ;;
536 esac
Damien Miller1bead332000-04-30 00:47:29 +1000537 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100538*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100539 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700540 AC_DEFINE(BROKEN_INET_NTOA, 1,
541 [Define if you system's inet_ntoa is busted
542 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000543 AC_DEFINE(SETEUID_BREAKS_SETUID)
544 AC_DEFINE(BROKEN_SETREUID)
545 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700546 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
547 [Define if you shouldn't strip 'tty' from your
548 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000549 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100550 ;;
551*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100552 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700553 AC_DEFINE(WITH_IRIX_ARRAY, 1,
554 [Define if you have/want arrays
555 (cluster-wide session managment, not C arrays)])
556 AC_DEFINE(WITH_IRIX_PROJECT, 1,
557 [Define if you want IRIX project management])
558 AC_DEFINE(WITH_IRIX_AUDIT, 1,
559 [Define if you want IRIX audit trails])
560 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
561 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000562 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000563 AC_DEFINE(SETEUID_BREAKS_SETUID)
564 AC_DEFINE(BROKEN_SETREUID)
565 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700566 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000567 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000568 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100569 ;;
Damien Miller90551722009-02-16 15:37:03 +1100570*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
571 check_for_libcrypt_later=1
572 AC_DEFINE(PAM_TTY_KLUDGE)
573 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
574 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
575 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
576 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
577 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100578*-*-linux*)
579 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100580 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000581 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700582 AC_DEFINE(PAM_TTY_KLUDGE, 1,
583 [Work around problematic Linux PAM modules handling of PAM_TTY])
584 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
585 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000586 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700587 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
588 [Define to whatever link() returns for "not supported"
589 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100590 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700591 AC_DEFINE(USE_BTMP)
Darren Tuckerc8802aa2009-12-08 13:39:48 +1100592 AC_DEFINE(LINUX_OOM_ADJUST, 1, [Adjust Linux out-of-memory killer])
Damien Miller7bcb0892000-03-11 20:45:40 +1100593 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000594 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000595 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700596 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
597 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000598 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000599 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100600 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100601 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100602 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100603 AC_DEFINE(SSH_TUN_LINUX, 1,
604 [Open tunnel devices the Linux tun/tap way])
605 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
606 [Use tunnel device compatibility to OpenBSD])
607 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
608 [Prepend the address family to IP tunnel traffic])
609 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100610 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000611mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100612 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000613 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000614 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100615*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000616 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800617 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800618 need_dash_r=1
619 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100620 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
621 AC_CHECK_HEADER([net/if_tap.h], ,
622 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
623 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
624 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100625 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100626*-*-freebsd*)
627 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000628 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100629 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
630 AC_CHECK_HEADER([net/if_tap.h], ,
631 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Darren Tucker54e859f2008-03-02 21:52:27 +1100632 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100633 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000634*-*-bsdi*)
635 AC_DEFINE(SETEUID_BREAKS_SETUID)
636 AC_DEFINE(BROKEN_SETREUID)
637 AC_DEFINE(BROKEN_SETREGID)
638 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000639*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000640 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100641 conf_utmp_location=/etc/utmp
642 conf_wtmp_location=/usr/adm/wtmp
643 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700644 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000645 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000646 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700647 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000648 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000649*-*-openbsd*)
650 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000651 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100652 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000653 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
654 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000655 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100656*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800657 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800658 need_dash_r=1
659 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100660 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000661 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700662 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
663 [Some versions of /bin/login need the TERM supplied
664 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000665 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700666 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
667 [Define if pam_chauthtok wants real uid set
668 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000669 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000670 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700671 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
672 [Define if sshd somehow reacquires a controlling TTY
673 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000674 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
675 in case the name is longer than 8 chars])
Darren Tuckerac9f1b92009-08-28 15:01:20 +1000676 AC_DEFINE(BROKEN_TCGETATTR_ICANON, 1, [tcgetattr with ICANON may hang])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000677 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000678 # hardwire lastlog location (can't detect it on some versions)
679 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000680 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
681 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
682 if test "$sol2ver" -ge 8; then
683 AC_MSG_RESULT(yes)
684 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700685 AC_DEFINE(DISABLE_WTMP, 1,
686 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000687 else
688 AC_MSG_RESULT(no)
689 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000690 AC_ARG_WITH(solaris-contracts,
691 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
692 [
693 AC_CHECK_LIB(contract, ct_tmpl_activate,
694 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
695 [Define if you have Solaris process contracts])
696 SSHDLIBS="$SSHDLIBS -lcontract"
697 AC_SUBST(SSHDLIBS)
698 SPC_MSG="yes" ], )
699 ],
700 )
Damien Miller75b1d102000-01-07 14:01:41 +1100701 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000702*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000703 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000704 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100705 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000706 conf_utmp_location=/etc/utmp
707 conf_wtmp_location=/var/adm/wtmp
708 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000709 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000710 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000711*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700712 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000713 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000714 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000715 AC_DEFINE(SETEUID_BREAKS_SETUID)
716 AC_DEFINE(BROKEN_SETREUID)
717 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000718 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000719*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700720 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000721 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100722 # -lresolv needs to be at the end of LIBS or DNS lookups break
723 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100724 IPADDR_IN_DISPLAY=yes
725 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000726 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000727 AC_DEFINE(SETEUID_BREAKS_SETUID)
728 AC_DEFINE(BROKEN_SETREUID)
729 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000730 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000731 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700732 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
733 # Attention: always take care to bind libsocket and libnsl before libc,
734 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000735 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800736# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100737*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100738 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700739 AC_DEFINE(SETEUID_BREAKS_SETUID)
740 AC_DEFINE(BROKEN_SETREUID)
741 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700742 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800743 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100744 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800745# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100746*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700747 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100748 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700749 AC_DEFINE(SETEUID_BREAKS_SETUID)
Tim Rice4a7db1c2010-01-16 12:23:25 -0800750 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Riced546a842003-09-11 22:24:36 -0700751 AC_DEFINE(BROKEN_SETREUID)
752 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700753 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700754 case "$host" in
755 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
756 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700757 AC_DEFINE(BROKEN_LIBIAF, 1,
758 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700759 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice351529c2009-01-07 10:04:12 -0800760 AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
761 AC_CHECK_FUNCS(getluid setluid,,,-lprot)
762 AC_DEFINE(HAVE_SECUREWARE)
763 AC_DEFINE(DISABLE_SHADOW)
764 ],,)
Tim Rice4dbacff2005-06-01 20:09:28 -0700765 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800766 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Tim Rice26767912009-01-07 20:50:08 -0800767 check_for_libcrypt_later=1
Tim Rice46259d82005-11-28 18:40:34 -0800768 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700769 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100770 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100771*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100772 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800773# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100774*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800775 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100776 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800777# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100778*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800779 if test -z "$GCC"; then
780 CFLAGS="$CFLAGS -belf"
781 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100782 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000783 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100784 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000785 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000786 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700787 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700788 AC_DEFINE(SETEUID_BREAKS_SETUID)
789 AC_DEFINE(BROKEN_SETREUID)
790 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700791 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700792 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700793 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100794 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700795 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700796 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000797 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000798*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700799 AC_DEFINE(NO_SSH_LASTLOG, 1,
800 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100801 AC_DEFINE(SETEUID_BREAKS_SETUID)
802 AC_DEFINE(BROKEN_SETREUID)
803 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000804 AC_DEFINE(USE_PIPES)
805 AC_DEFINE(DISABLE_FD_PASSING)
806 LDFLAGS="$LDFLAGS"
807 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
808 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000809 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000810*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100811 AC_DEFINE(SETEUID_BREAKS_SETUID)
812 AC_DEFINE(BROKEN_SETREUID)
813 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000814 AC_DEFINE(WITH_ABBREV_NO_TTY)
815 AC_DEFINE(USE_PIPES)
816 AC_DEFINE(DISABLE_FD_PASSING)
817 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100818 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000819 MANTYPE=cat
820 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000821*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100822 AC_DEFINE(SETEUID_BREAKS_SETUID)
823 AC_DEFINE(BROKEN_SETREUID)
824 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000825 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700826 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700827 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000828 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
829 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
830 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700831 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000832*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000833 AC_MSG_CHECKING(for Digital Unix SIA)
834 no_osfsia=""
835 AC_ARG_WITH(osfsia,
836 [ --with-osfsia Enable Digital Unix SIA],
837 [
838 if test "x$withval" = "xno" ; then
839 AC_MSG_RESULT(disabled)
840 no_osfsia=1
841 fi
842 ],
843 )
844 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000845 if test -f /etc/sia/matrix.conf; then
846 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700847 AC_DEFINE(HAVE_OSF_SIA, 1,
848 [Define if you have Digital Unix Security
849 Integration Architecture])
850 AC_DEFINE(DISABLE_LOGIN, 1,
851 [Define if you don't want to use your
852 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000853 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000854 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000855 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000856 else
857 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700858 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
859 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000860 fi
861 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000862 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700863 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000864 AC_DEFINE(BROKEN_SETREUID)
865 AC_DEFINE(BROKEN_SETREGID)
Damien Millerff2e4922008-07-05 09:52:03 +1000866 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
Damien Millerb8c656e2000-06-28 15:22:41 +1000867 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000868
Tim Rice70335a62006-02-04 17:42:58 -0800869*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000870 AC_DEFINE(USE_PIPES)
871 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700872 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
873 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
874 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800875 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100876 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckerbc1bd9d2007-09-27 07:03:20 +1000877 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800878 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000879 case "$host" in
880 *-*-nto-qnx6*)
881 AC_DEFINE(DISABLE_FD_PASSING)
882 ;;
883 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000884 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000885
886*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700887 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
888 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100889 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700890 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
891 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000892
893*-*-lynxos)
894 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700895 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000896 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
897 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100898esac
899
Darren Tucker6eb93042003-06-29 21:30:41 +1000900AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000901AC_RUN_IFELSE(
902 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000903#include <stdio.h>
904int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000905 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000906 [ AC_MSG_RESULT(yes) ],
907 [
908 AC_MSG_RESULT(no)
909 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000910 ],
911 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000912)
913
Darren Tucker0c9653f2005-05-28 15:58:14 +1000914dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100915# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700916AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
917AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000918
Tim Rice1e1ef642003-09-11 22:19:31 -0700919dnl IRIX and Solaris 2.5.1 have dirname() in libgen
920AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
921 AC_CHECK_LIB(gen, dirname,[
922 AC_CACHE_CHECK([for broken dirname],
923 ac_cv_have_broken_dirname, [
924 save_LIBS="$LIBS"
925 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000926 AC_RUN_IFELSE(
927 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700928#include <libgen.h>
929#include <string.h>
930
931int main(int argc, char **argv) {
932 char *s, buf[32];
933
934 strncpy(buf,"/etc", 32);
935 s = dirname(buf);
936 if (!s || strncmp(s, "/", 32) != 0) {
937 exit(1);
938 } else {
939 exit(0);
940 }
941}
Darren Tucker314d89e2005-10-17 23:29:23 +1000942 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700943 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000944 [ ac_cv_have_broken_dirname="yes" ],
945 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700946 )
947 LIBS="$save_LIBS"
948 ])
949 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
950 LIBS="$LIBS -lgen"
951 AC_DEFINE(HAVE_DIRNAME)
952 AC_CHECK_HEADERS(libgen.h)
953 fi
954 ])
955])
956
957AC_CHECK_FUNC(getspnam, ,
958 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700959AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
960 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700961
Tim Rice13aae5e2001-10-21 17:53:58 -0700962dnl zlib is required
963AC_ARG_WITH(zlib,
964 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100965 [ if test "x$withval" = "xno" ; then
966 AC_MSG_ERROR([*** zlib is required ***])
967 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700968 if test -d "$withval/lib"; then
969 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700970 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700971 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700972 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700973 fi
974 else
975 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700976 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700977 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700978 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700979 fi
980 fi
981 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700982 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700983 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700984 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700985 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100986 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700987)
988
Darren Tucker83d8f282009-08-17 09:35:22 +1000989AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Tim Ricefcb62202004-01-23 18:35:16 -0800990AC_CHECK_LIB(z, deflate, ,
991 [
992 saved_CPPFLAGS="$CPPFLAGS"
993 saved_LDFLAGS="$LDFLAGS"
994 save_LIBS="$LIBS"
995 dnl Check default zlib install dir
996 if test -n "${need_dash_r}"; then
997 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
998 else
999 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1000 fi
1001 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1002 LIBS="$LIBS -lz"
1003 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1004 [
1005 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1006 ]
1007 )
1008 ]
1009)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001010
1011AC_ARG_WITH(zlib-version-check,
1012 [ --without-zlib-version-check Disable zlib version check],
1013 [ if test "x$withval" = "xno" ; then
1014 zlib_check_nonfatal=1
1015 fi
1016 ]
1017)
1018
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001019AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +10001020AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001021#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +11001022#include <zlib.h>
1023int main()
1024{
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001025 int a=0, b=0, c=0, d=0, n, v;
1026 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1027 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001028 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001029 v = a*1000000 + b*10000 + c*100 + d;
1030 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1031
1032 /* 1.1.4 is OK */
1033 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +11001034 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001035
Darren Tucker41097ed2005-07-25 15:24:21 +10001036 /* 1.2.3 and up are OK */
1037 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001038 exit(0);
1039
Darren Tucker2dcd2392004-01-23 17:13:33 +11001040 exit(2);
1041}
Darren Tucker623d92f2004-09-12 22:36:15 +10001042 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001043 AC_MSG_RESULT(no),
1044 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001045 if test -z "$zlib_check_nonfatal" ; then
1046 AC_MSG_ERROR([*** zlib too old - check config.log ***
1047Your reported zlib version has known security problems. It's possible your
1048vendor has fixed these problems without changing the version number. If you
1049are sure this is the case, you can disable the check by running
1050"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001051If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001052See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001053 else
1054 AC_MSG_WARN([zlib version may have security problems])
1055 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001056 ],
1057 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001058)
Damien Miller6f9c3372000-10-25 10:06:04 +11001059
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001060dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +11001061AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001062 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1063)
Darren Tucker5bfe1682005-11-12 18:42:36 +11001064AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -07001065 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1066 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001067)
Damien Millerab18c411999-11-11 10:40:23 +11001068
Tim Ricee589a292001-11-03 11:09:32 -08001069dnl Checks for libutil functions
1070AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -07001071AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1072 [Define if your libraries define login()])])
Damien Millera7058ec2008-05-20 08:57:06 +10001073AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
Tim Ricee589a292001-11-03 11:09:32 -08001074
Ben Lindstrom8697e082001-02-24 21:41:10 +00001075AC_FUNC_STRFTIME
1076
Damien Miller3c027682001-03-14 11:39:45 +11001077# Check for ALTDIRFUNC glob() extension
1078AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1079AC_EGREP_CPP(FOUNDIT,
1080 [
1081 #include <glob.h>
1082 #ifdef GLOB_ALTDIRFUNC
1083 FOUNDIT
1084 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001085 ],
Damien Miller3c027682001-03-14 11:39:45 +11001086 [
Tim Rice7df8d392005-09-19 09:33:39 -07001087 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1088 [Define if your system glob() function has
1089 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001090 AC_MSG_RESULT(yes)
1091 ],
1092 [
1093 AC_MSG_RESULT(no)
1094 ]
1095)
Damien Millerab18c411999-11-11 10:40:23 +11001096
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001097# Check for g.gl_matchc glob() extension
1098AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001099AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001100 [ #include <glob.h> ],
1101 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001102 [
Tim Rice7df8d392005-09-19 09:33:39 -07001103 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1104 [Define if your system glob() function has
1105 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001106 AC_MSG_RESULT(yes)
1107 ],
1108 [
1109 AC_MSG_RESULT(no)
1110 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001111)
1112
Darren Tucker096faec2006-09-01 20:29:10 +10001113AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1114
Damien Miller18bb4732001-03-28 14:35:30 +10001115AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001116AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001117 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001118#include <sys/types.h>
1119#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001120int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001121 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001122 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001123 [
1124 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001125 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001126 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001127 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001128 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001129 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001130 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1131 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001132 ]
1133)
1134
Damien Miller36f49652004-08-15 18:40:59 +10001135AC_MSG_CHECKING([for /proc/pid/fd directory])
1136if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001137 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001138 AC_MSG_RESULT(yes)
1139else
1140 AC_MSG_RESULT(no)
1141fi
1142
Damien Millerc547bf12001-02-16 10:18:12 +11001143# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001144SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001145AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001146 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001147 [
1148 if test "x$withval" != "xno" ; then
1149
1150 if test "x$withval" != "xyes" ; then
1151 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1152 LDFLAGS="$LDFLAGS -L${withval}/lib"
1153 fi
1154
Tim Rice7df8d392005-09-19 09:33:39 -07001155 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001156 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001157 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001158
Tim Rice4cec93f2002-02-26 08:40:48 -08001159 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001160 AC_LINK_IFELSE(
1161 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001162#include <stdio.h>
1163#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001164int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001165 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001166 [AC_MSG_RESULT(yes)],
1167 [
1168 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001169 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1170 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001171 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1172 AC_TRY_COMPILE(
1173 [#include <stdio.h>
1174 #include <skey.h>],
1175 [(void)skeychallenge(NULL,"name","",0);],
1176 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001177 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1178 [Define if your skeychallenge()
1179 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001180 [AC_MSG_RESULT(no)]
1181 )
Damien Millerc547bf12001-02-16 10:18:12 +11001182 fi
1183 ]
1184)
1185
1186# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001187TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001188AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001189 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001190 [
1191 if test "x$withval" != "xno" ; then
1192 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001193 saved_LDFLAGS="$LDFLAGS"
1194 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001195 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001196 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001197 if test -d "${withval}/lib"; then
1198 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001199 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001200 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001201 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001202 fi
1203 else
1204 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001205 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001206 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001207 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001208 fi
1209 fi
1210 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001211 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001212 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001213 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001214 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001215 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001216 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001217 AC_MSG_CHECKING(for libwrap)
1218 AC_TRY_LINK(
1219 [
Damien Miller0ac45002004-04-14 20:14:26 +10001220#include <sys/types.h>
1221#include <sys/socket.h>
1222#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001223#include <tcpd.h>
1224 int deny_severity = 0, allow_severity = 0;
1225 ],
1226 [hosts_access(0);],
1227 [
1228 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001229 AC_DEFINE(LIBWRAP, 1,
1230 [Define if you want
1231 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001232 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001233 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001234 ],
1235 [
1236 AC_MSG_ERROR([*** libwrap missing])
1237 ]
1238 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001239 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001240 fi
1241 ]
1242)
1243
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001244# Check whether user wants libedit support
1245LIBEDIT_MSG="no"
1246AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001247 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001248 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001249 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001250 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1251 if test -n "${need_dash_r}"; then
1252 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1253 else
1254 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1255 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001256 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001257 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001258 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001259 LIBEDIT="-ledit -lcurses"
1260 LIBEDIT_MSG="yes"
1261 AC_SUBST(LIBEDIT)
1262 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001263 [ AC_MSG_ERROR(libedit not found) ],
1264 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001265 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001266 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001267 AC_COMPILE_IFELSE(
1268 [AC_LANG_SOURCE([[
1269#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001270int main(void)
1271{
1272 int i = H_SETSIZE;
1273 el_init("", NULL, NULL, NULL);
1274 exit(0);
1275}
Tim Ricec1819c82005-08-15 17:48:40 -07001276 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001277 [ AC_MSG_RESULT(yes) ],
1278 [ AC_MSG_RESULT(no)
1279 AC_MSG_ERROR(libedit version is not compatible) ]
1280 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001281 fi ]
1282)
1283
Darren Tuckerd9f88912005-02-20 21:01:48 +11001284AUDIT_MODULE=none
1285AC_ARG_WITH(audit,
1286 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1287 [
1288 AC_MSG_CHECKING(for supported audit module)
1289 case "$withval" in
1290 bsm)
1291 AC_MSG_RESULT(bsm)
1292 AUDIT_MODULE=bsm
1293 dnl Checks for headers, libs and functions
1294 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001295 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1296 [
1297#ifdef HAVE_TIME_H
1298# include <time.h>
1299#endif
1300 ]
1301)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001302 AC_CHECK_LIB(bsm, getaudit, [],
1303 [AC_MSG_ERROR(BSM enabled and required library not found)])
1304 AC_CHECK_FUNCS(getaudit, [],
1305 [AC_MSG_ERROR(BSM enabled and required function not found)])
1306 # These are optional
Darren Tuckeracada072008-02-25 21:05:04 +11001307 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
Tim Rice7df8d392005-09-19 09:33:39 -07001308 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001309 ;;
1310 debug)
1311 AUDIT_MODULE=debug
1312 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001313 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001314 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001315 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001316 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001317 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001318 *)
1319 AC_MSG_ERROR([Unknown audit module $withval])
1320 ;;
1321 esac ]
1322)
1323
Damien Millerfe1f1432003-02-24 15:45:42 +11001324dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001325AC_CHECK_FUNCS( \
1326 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001327 arc4random_buf \
1328 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001329 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001330 b64_ntop \
1331 __b64_ntop \
1332 b64_pton \
1333 __b64_pton \
1334 bcopy \
1335 bindresvport_sa \
1336 clock \
1337 closefrom \
1338 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001339 fchmod \
1340 fchown \
1341 freeaddrinfo \
Darren Tucker598eaa62008-06-09 03:32:29 +10001342 fstatvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001343 futimes \
1344 getaddrinfo \
1345 getcwd \
1346 getgrouplist \
1347 getnameinfo \
1348 getopt \
1349 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001350 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001351 _getpty \
1352 getrlimit \
1353 getttyent \
1354 glob \
Darren Tucker909a3902010-01-15 12:38:30 +11001355 group_from_gid \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001356 inet_aton \
1357 inet_ntoa \
1358 inet_ntop \
1359 innetgr \
1360 login_getcapbool \
1361 md5_crypt \
1362 memmove \
1363 mkdtemp \
1364 mmap \
1365 ngetaddrinfo \
1366 nsleep \
1367 ogetaddrinfo \
1368 openlog_r \
1369 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001370 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001371 prctl \
1372 pstat \
1373 readpassphrase \
1374 realpath \
1375 recvmsg \
1376 rresvport_af \
1377 sendmsg \
1378 setdtablesize \
1379 setegid \
1380 setenv \
1381 seteuid \
Darren Tucker909a3902010-01-15 12:38:30 +11001382 setgroupent \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001383 setgroups \
1384 setlogin \
Darren Tucker909a3902010-01-15 12:38:30 +11001385 setpassent\
Darren Tucker0c9653f2005-05-28 15:58:14 +10001386 setpcred \
1387 setproctitle \
1388 setregid \
1389 setreuid \
1390 setrlimit \
1391 setsid \
1392 setvbuf \
1393 sigaction \
1394 sigvec \
1395 snprintf \
1396 socketpair \
Darren Tucker5b2e2ba2008-06-08 09:25:28 +10001397 statfs \
1398 statvfs \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001399 strdup \
1400 strerror \
1401 strlcat \
1402 strlcpy \
1403 strmode \
1404 strnvis \
1405 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001406 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001407 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001408 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001409 sysconf \
1410 tcgetpgrp \
1411 truncate \
1412 unsetenv \
1413 updwtmpx \
Darren Tucker909a3902010-01-15 12:38:30 +11001414 user_from_uid \
Damien Miller57f39152005-11-24 19:58:19 +11001415 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001416 vhangup \
1417 vsnprintf \
1418 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001419)
Tim Rice13aae5e2001-10-21 17:53:58 -07001420
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001421# IRIX has a const char return value for gai_strerror()
1422AC_CHECK_FUNCS(gai_strerror,[
1423 AC_DEFINE(HAVE_GAI_STRERROR)
1424 AC_TRY_COMPILE([
1425#include <sys/types.h>
1426#include <sys/socket.h>
1427#include <netdb.h>
1428
1429const char *gai_strerror(int);],[
1430char *str;
1431
1432str = gai_strerror(0);],[
1433 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1434 [Define if gai_strerror() returns const char *])])])
1435
Tim Rice7df8d392005-09-19 09:33:39 -07001436AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1437 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001438
Darren Tuckerf1159b52003-07-07 19:44:01 +10001439dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001440AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001441AC_CHECK_DECL(strsep,
1442 [AC_CHECK_FUNCS(strsep)],
1443 [],
1444 [
1445#ifdef HAVE_STRING_H
1446# include <string.h>
1447#endif
1448 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001449
Darren Tuckerb2427c82003-09-10 15:22:44 +10001450dnl tcsendbreak might be a macro
1451AC_CHECK_DECL(tcsendbreak,
1452 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001453 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001454 [#include <termios.h>]
1455)
1456
Darren Tucker5bb14002004-04-23 18:53:10 +10001457AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1458
Darren Tucker128a0892006-07-12 19:02:56 +10001459AC_CHECK_DECLS(SHUT_RD, , ,
1460 [
1461#include <sys/types.h>
1462#include <sys/socket.h>
1463 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001464
1465AC_CHECK_DECLS(O_NONBLOCK, , ,
1466 [
1467#include <sys/types.h>
1468#ifdef HAVE_SYS_STAT_H
1469# include <sys/stat.h>
1470#endif
1471#ifdef HAVE_FCNTL_H
1472# include <fcntl.h>
1473#endif
1474 ])
1475
Darren Tuckered0b5922006-09-03 22:44:49 +10001476AC_CHECK_DECLS(writev, , , [
1477#include <sys/types.h>
1478#include <sys/uio.h>
1479#include <unistd.h>
1480 ])
1481
Darren Tucker6d862a52007-04-29 14:39:02 +10001482AC_CHECK_DECLS(MAXSYMLINKS, , , [
1483#include <sys/param.h>
1484 ])
1485
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001486AC_CHECK_DECLS(offsetof, , , [
1487#include <stddef.h>
1488 ])
1489
Darren Tucker2a6b0292003-12-31 14:59:17 +11001490AC_CHECK_FUNCS(setresuid, [
1491 dnl Some platorms have setresuid that isn't implemented, test for this
1492 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001493 AC_RUN_IFELSE(
1494 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001495#include <stdlib.h>
1496#include <errno.h>
1497int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001498 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001499 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001500 [AC_DEFINE(BROKEN_SETRESUID, 1,
1501 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001502 AC_MSG_RESULT(not implemented)],
1503 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001504 )
1505])
Darren Tuckere937be32003-12-17 18:53:26 +11001506
Darren Tucker2a6b0292003-12-31 14:59:17 +11001507AC_CHECK_FUNCS(setresgid, [
1508 dnl Some platorms have setresgid that isn't implemented, test for this
1509 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001510 AC_RUN_IFELSE(
1511 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001512#include <stdlib.h>
1513#include <errno.h>
1514int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001515 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001516 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001517 [AC_DEFINE(BROKEN_SETRESGID, 1,
1518 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001519 AC_MSG_RESULT(not implemented)],
1520 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001521 )
1522])
Darren Tuckere937be32003-12-17 18:53:26 +11001523
Damien Millerad833b32000-08-23 10:46:23 +10001524dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001525AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001526dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001527AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001528AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001529dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001530AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001531AC_CHECK_FUNCS(setutxent utmpxname)
Damien Miller20e231f2009-02-12 13:12:21 +11001532dnl Checks for lastlog functions
1533AC_CHECK_FUNCS(getlastlogxbyname)
Damien Millercedfecc1999-11-15 14:36:53 +11001534
Damien Millera8e06ce2003-11-21 23:48:55 +11001535AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001536 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1537 [AC_CHECK_LIB(bsd, daemon,
1538 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001539)
1540
Damien Millera8e06ce2003-11-21 23:48:55 +11001541AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001542 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1543 [Define if your libraries define getpagesize()])],
1544 [AC_CHECK_LIB(ucb, getpagesize,
1545 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001546)
1547
Damien Millercb170cb2000-07-01 16:52:55 +10001548# Check for broken snprintf
1549if test "x$ac_cv_func_snprintf" = "xyes" ; then
1550 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001551 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001552 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001553#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001554int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001555 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001556 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001557 [
1558 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001559 AC_DEFINE(BROKEN_SNPRINTF, 1,
1560 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001561 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001562 ],
1563 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001564 )
1565fi
1566
Damien Miller57f39152005-11-24 19:58:19 +11001567# If we don't have a working asprintf, then we strongly depend on vsnprintf
1568# returning the right thing on overflow: the number of characters it tried to
1569# create (as per SUSv3)
1570if test "x$ac_cv_func_asprintf" != "xyes" && \
1571 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1572 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1573 AC_RUN_IFELSE(
1574 [AC_LANG_SOURCE([[
1575#include <sys/types.h>
1576#include <stdio.h>
1577#include <stdarg.h>
1578
1579int x_snprintf(char *str,size_t count,const char *fmt,...)
1580{
1581 size_t ret; va_list ap;
1582 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1583 return ret;
1584}
1585int main(void)
1586{
1587 char x[1];
1588 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1589} ]])],
1590 [AC_MSG_RESULT(yes)],
1591 [
1592 AC_MSG_RESULT(no)
1593 AC_DEFINE(BROKEN_SNPRINTF, 1,
1594 [Define if your snprintf is busted])
1595 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1596 ],
1597 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1598 )
1599fi
1600
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001601# On systems where [v]snprintf is broken, but is declared in stdio,
1602# check that the fmt argument is const char * or just char *.
1603# This is only useful for when BROKEN_SNPRINTF
1604AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1605AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1606 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1607 int main(void) { snprintf(0, 0, 0); }
1608 ]])],
1609 [AC_MSG_RESULT(yes)
1610 AC_DEFINE(SNPRINTF_CONST, [const],
1611 [Define as const if snprintf() can declare const char *fmt])],
1612 [AC_MSG_RESULT(no)
1613 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1614
Damien Millerb4097182004-05-23 14:09:40 +10001615# Check for missing getpeereid (or equiv) support
1616NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001617if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001618 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1619 AC_TRY_COMPILE(
1620 [#include <sys/types.h>
1621 #include <sys/socket.h>],
1622 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001623 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001624 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001625 ],
Damien Millerb4097182004-05-23 14:09:40 +10001626 [AC_MSG_RESULT(no)
1627 NO_PEERCHECK=1]
1628 )
1629fi
1630
Damien Millere8328192003-01-07 15:18:32 +11001631dnl see whether mkstemp() requires XXXXXX
1632if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1633AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001634AC_RUN_IFELSE(
1635 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001636#include <stdlib.h>
1637main() { char template[]="conftest.mkstemp-test";
1638if (mkstemp(template) == -1)
1639 exit(1);
1640unlink(template); exit(0);
1641}
Darren Tucker314d89e2005-10-17 23:29:23 +10001642 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001643 [
1644 AC_MSG_RESULT(no)
1645 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001646 [
Damien Millere8328192003-01-07 15:18:32 +11001647 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001648 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001649 ],
1650 [
1651 AC_MSG_RESULT(yes)
1652 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001653 ]
Damien Millere8328192003-01-07 15:18:32 +11001654)
1655fi
1656
Darren Tucker70a3d552003-08-21 17:58:29 +10001657dnl make sure that openpty does not reacquire controlling terminal
1658if test ! -z "$check_for_openpty_ctty_bug"; then
1659 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001660 AC_RUN_IFELSE(
1661 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001662#include <stdio.h>
1663#include <sys/fcntl.h>
1664#include <sys/types.h>
1665#include <sys/wait.h>
1666
1667int
1668main()
1669{
1670 pid_t pid;
1671 int fd, ptyfd, ttyfd, status;
1672
1673 pid = fork();
1674 if (pid < 0) { /* failed */
1675 exit(1);
1676 } else if (pid > 0) { /* parent */
1677 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001678 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001679 exit(WEXITSTATUS(status));
1680 else
1681 exit(2);
1682 } else { /* child */
1683 close(0); close(1); close(2);
1684 setsid();
1685 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1686 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1687 if (fd >= 0)
1688 exit(3); /* Acquired ctty: broken */
1689 else
1690 exit(0); /* Did not acquire ctty: OK */
1691 }
1692}
Darren Tucker314d89e2005-10-17 23:29:23 +10001693 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001694 [
1695 AC_MSG_RESULT(yes)
1696 ],
1697 [
1698 AC_MSG_RESULT(no)
1699 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001700 ],
1701 [
1702 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001703 ]
1704 )
1705fi
1706
Tim Rice8bb561b2005-03-17 16:23:19 -08001707if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1708 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001709 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001710 AC_RUN_IFELSE(
1711 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001712#include <stdio.h>
1713#include <sys/socket.h>
1714#include <netdb.h>
1715#include <errno.h>
1716#include <netinet/in.h>
1717
1718#define TEST_PORT "2222"
1719
1720int
1721main(void)
1722{
1723 int err, sock;
1724 struct addrinfo *gai_ai, *ai, hints;
1725 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1726
1727 memset(&hints, 0, sizeof(hints));
1728 hints.ai_family = PF_UNSPEC;
1729 hints.ai_socktype = SOCK_STREAM;
1730 hints.ai_flags = AI_PASSIVE;
1731
1732 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1733 if (err != 0) {
1734 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1735 exit(1);
1736 }
1737
1738 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1739 if (ai->ai_family != AF_INET6)
1740 continue;
1741
1742 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1743 sizeof(ntop), strport, sizeof(strport),
1744 NI_NUMERICHOST|NI_NUMERICSERV);
1745
1746 if (err != 0) {
1747 if (err == EAI_SYSTEM)
1748 perror("getnameinfo EAI_SYSTEM");
1749 else
1750 fprintf(stderr, "getnameinfo failed: %s\n",
1751 gai_strerror(err));
1752 exit(2);
1753 }
1754
1755 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1756 if (sock < 0)
1757 perror("socket");
1758 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1759 if (errno == EBADF)
1760 exit(3);
1761 }
1762 }
1763 exit(0);
1764}
Darren Tucker314d89e2005-10-17 23:29:23 +10001765 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001766 [
1767 AC_MSG_RESULT(yes)
1768 ],
1769 [
1770 AC_MSG_RESULT(no)
1771 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001772 ],
1773 [
1774 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001775 ]
1776 )
1777fi
1778
Tim Rice8bb561b2005-03-17 16:23:19 -08001779if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1780 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001781 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001782 AC_RUN_IFELSE(
1783 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001784#include <stdio.h>
1785#include <sys/socket.h>
1786#include <netdb.h>
1787#include <errno.h>
1788#include <netinet/in.h>
1789
1790#define TEST_PORT "2222"
1791
1792int
1793main(void)
1794{
1795 int err, sock;
1796 struct addrinfo *gai_ai, *ai, hints;
1797 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1798
1799 memset(&hints, 0, sizeof(hints));
1800 hints.ai_family = PF_UNSPEC;
1801 hints.ai_socktype = SOCK_STREAM;
1802 hints.ai_flags = AI_PASSIVE;
1803
1804 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1805 if (err != 0) {
1806 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1807 exit(1);
1808 }
1809
1810 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1811 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1812 continue;
1813
1814 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1815 sizeof(ntop), strport, sizeof(strport),
1816 NI_NUMERICHOST|NI_NUMERICSERV);
1817
1818 if (ai->ai_family == AF_INET && err != 0) {
1819 perror("getnameinfo");
1820 exit(2);
1821 }
1822 }
1823 exit(0);
1824}
Darren Tucker314d89e2005-10-17 23:29:23 +10001825 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001826 [
1827 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001828 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1829 [Define if you have a getaddrinfo that fails
1830 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001831 ],
1832 [
1833 AC_MSG_RESULT(no)
1834 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001835 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001836 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001837 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001838 ]
1839 )
1840fi
1841
Darren Tuckera56f1912004-11-02 20:30:54 +11001842if test "x$check_for_conflicting_getspnam" = "x1"; then
1843 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1844 AC_COMPILE_IFELSE(
1845 [
1846#include <shadow.h>
1847int main(void) {exit(0);}
1848 ],
1849 [
1850 AC_MSG_RESULT(no)
1851 ],
1852 [
1853 AC_MSG_RESULT(yes)
1854 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1855 [Conflicting defs for getspnam])
1856 ]
1857 )
1858fi
1859
Damien Miller606f8802000-09-16 15:39:56 +11001860AC_FUNC_GETPGRP
1861
Tim Riceaef73712002-05-11 13:17:42 -07001862# Search for OpenSSL
1863saved_CPPFLAGS="$CPPFLAGS"
1864saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001865AC_ARG_WITH(ssl-dir,
1866 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1867 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001868 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001869 case "$withval" in
1870 # Relative paths
1871 ./*|../*) withval="`pwd`/$withval"
1872 esac
Tim Riceaef73712002-05-11 13:17:42 -07001873 if test -d "$withval/lib"; then
1874 if test -n "${need_dash_r}"; then
1875 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1876 else
1877 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1878 fi
1879 else
1880 if test -n "${need_dash_r}"; then
1881 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1882 else
1883 LDFLAGS="-L${withval} ${LDFLAGS}"
1884 fi
1885 fi
1886 if test -d "$withval/include"; then
1887 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1888 else
1889 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1890 fi
Damien Millera22ba012000-03-02 23:09:20 +11001891 fi
1892 ]
1893)
Tim Rice3d5352e2004-02-12 09:27:21 -08001894LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001895AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1896 [Define if your ssl headers are included
1897 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001898 [
Tim Riceaef73712002-05-11 13:17:42 -07001899 dnl Check default openssl install dir
1900 if test -n "${need_dash_r}"; then
1901 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001902 else
Tim Riceaef73712002-05-11 13:17:42 -07001903 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001904 fi
Tim Riceaef73712002-05-11 13:17:42 -07001905 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
Darren Tucker83d8f282009-08-17 09:35:22 +10001906 AC_CHECK_HEADER([openssl/opensslv.h], ,
1907 AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
Tim Riceaef73712002-05-11 13:17:42 -07001908 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1909 [
1910 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1911 ]
1912 )
1913 ]
1914)
1915
Tim Riced730b782002-08-13 18:52:10 -07001916# Determine OpenSSL header version
1917AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001918AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001919 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001920#include <stdio.h>
1921#include <string.h>
1922#include <openssl/opensslv.h>
1923#define DATA "conftest.sslincver"
1924int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001925 FILE *fd;
1926 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001927
Damien Millera8e06ce2003-11-21 23:48:55 +11001928 fd = fopen(DATA,"w");
1929 if(fd == NULL)
1930 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001931
1932 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1933 exit(1);
1934
1935 exit(0);
1936}
Darren Tucker623d92f2004-09-12 22:36:15 +10001937 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001938 [
1939 ssl_header_ver=`cat conftest.sslincver`
1940 AC_MSG_RESULT($ssl_header_ver)
1941 ],
1942 [
1943 AC_MSG_RESULT(not found)
1944 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001945 ],
1946 [
1947 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001948 ]
1949)
1950
1951# Determine OpenSSL library version
1952AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001953AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001954 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001955#include <stdio.h>
1956#include <string.h>
1957#include <openssl/opensslv.h>
1958#include <openssl/crypto.h>
1959#define DATA "conftest.ssllibver"
1960int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001961 FILE *fd;
1962 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001963
Damien Millera8e06ce2003-11-21 23:48:55 +11001964 fd = fopen(DATA,"w");
1965 if(fd == NULL)
1966 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001967
1968 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1969 exit(1);
1970
1971 exit(0);
1972}
Darren Tucker623d92f2004-09-12 22:36:15 +10001973 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001974 [
1975 ssl_library_ver=`cat conftest.ssllibver`
1976 AC_MSG_RESULT($ssl_library_ver)
1977 ],
1978 [
1979 AC_MSG_RESULT(not found)
1980 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001981 ],
1982 [
1983 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001984 ]
1985)
Damien Millera22ba012000-03-02 23:09:20 +11001986
Damien Miller9975e482007-03-05 11:51:27 +11001987AC_ARG_WITH(openssl-header-check,
1988 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1989 [ if test "x$withval" = "xno" ; then
1990 openssl_check_nonfatal=1
1991 fi
1992 ]
1993)
1994
Damien Millerec932372002-01-22 22:16:03 +11001995# Sanity check OpenSSL headers
1996AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001997AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001998 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001999#include <string.h>
2000#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002001int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002002 ]])],
Damien Millerec932372002-01-22 22:16:03 +11002003 [
2004 AC_MSG_RESULT(yes)
2005 ],
2006 [
2007 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11002008 if test "x$openssl_check_nonfatal" = "x"; then
2009 AC_MSG_ERROR([Your OpenSSL headers do not match your
2010library. Check config.log for details.
2011If you are sure your installation is consistent, you can disable the check
2012by running "./configure --without-openssl-header-check".
2013Also see contrib/findssl.sh for help identifying header/library mismatches.
2014])
2015 else
2016 AC_MSG_WARN([Your OpenSSL headers do not match your
2017library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10002018Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11002019 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002020 ],
2021 [
2022 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11002023 ]
2024)
2025
Darren Tucker639bbe82006-08-20 20:17:53 +10002026AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2027AC_LINK_IFELSE(
2028 [AC_LANG_SOURCE([[
2029#include <openssl/evp.h>
2030int main(void) { SSLeay_add_all_algorithms(); }
2031 ]])],
2032 [
2033 AC_MSG_RESULT(yes)
2034 ],
2035 [
2036 AC_MSG_RESULT(no)
2037 saved_LIBS="$LIBS"
2038 LIBS="$LIBS -ldl"
2039 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2040 AC_LINK_IFELSE(
2041 [AC_LANG_SOURCE([[
2042#include <openssl/evp.h>
2043int main(void) { SSLeay_add_all_algorithms(); }
2044 ]])],
2045 [
2046 AC_MSG_RESULT(yes)
2047 ],
2048 [
2049 AC_MSG_RESULT(no)
2050 LIBS="$saved_LIBS"
2051 ]
2052 )
2053 ]
2054)
2055
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002056AC_ARG_WITH(ssl-engine,
2057 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2058 [ if test "x$withval" != "xno" ; then
2059 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2060 AC_TRY_COMPILE(
2061 [ #include <openssl/engine.h>],
2062 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10002063ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002064 ],
2065 [ AC_MSG_RESULT(yes)
2066 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2067 [Enable OpenSSL engine support])
2068 ],
2069 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2070 )
2071 fi ]
2072)
2073
Darren Tucker129d0bb2005-12-19 17:40:40 +11002074# Check for OpenSSL without EVP_aes_{192,256}_cbc
2075AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002076AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11002077 [AC_LANG_SOURCE([[
2078#include <string.h>
2079#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11002080int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11002081 ]])],
2082 [
2083 AC_MSG_RESULT(no)
2084 ],
2085 [
2086 AC_MSG_RESULT(yes)
2087 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2088 [libcrypto is missing AES 192 and 256 bit functions])
2089 ]
2090)
2091
Darren Tucker3e7e15f2009-03-07 22:22:35 +11002092AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2093AC_LINK_IFELSE(
2094 [AC_LANG_SOURCE([[
2095#include <string.h>
2096#include <openssl/evp.h>
2097int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2098 ]])],
2099 [
2100 AC_MSG_RESULT(yes)
2101 ],
2102 [
2103 AC_MSG_RESULT(no)
2104 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2105 [Define if EVP_DigestUpdate returns void])
2106 ]
2107)
2108
Tim Rice3d5352e2004-02-12 09:27:21 -08002109# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2110# because the system crypt() is more featureful.
2111if test "x$check_for_libcrypt_before" = "x1"; then
2112 AC_CHECK_LIB(crypt, crypt)
2113fi
2114
Damien Millera8e06ce2003-11-21 23:48:55 +11002115# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002116# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002117if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11002118 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002119fi
2120
Damien Milleraf87af12006-03-15 13:02:28 +11002121# Search for SHA256 support in libc and/or OpenSSL
2122AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2123
Tim Rice99203ec2007-03-26 09:35:28 -07002124saved_LIBS="$LIBS"
2125AC_CHECK_LIB(iaf, ia_openinfo, [
2126 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002127 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2128 AC_DEFINE(HAVE_LIBIAF, 1,
2129 [Define if system has libiaf that supports set_id])
2130 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002131])
2132LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002133
2134### Configure cryptographic random number support
2135
2136# Check wheter OpenSSL seeds itself
2137AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002138AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002139 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002140#include <string.h>
2141#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002142int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002143 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002144 [
2145 OPENSSL_SEEDS_ITSELF=yes
2146 AC_MSG_RESULT(yes)
2147 ],
2148 [
2149 AC_MSG_RESULT(no)
2150 # Default to use of the rand helper if OpenSSL doesn't
2151 # seed itself
2152 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002153 ],
2154 [
2155 AC_MSG_WARN([cross compiling: assuming yes])
2156 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002157 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002158 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002159 ]
2160)
2161
Darren Tucker3e6bde42006-08-20 20:03:50 +10002162# Check for PAM libs
2163PAM_MSG="no"
2164AC_ARG_WITH(pam,
2165 [ --with-pam Enable PAM support ],
2166 [
2167 if test "x$withval" != "xno" ; then
2168 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2169 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2170 AC_MSG_ERROR([PAM headers not found])
2171 fi
2172
2173 saved_LIBS="$LIBS"
2174 AC_CHECK_LIB(dl, dlopen, , )
2175 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2176 AC_CHECK_FUNCS(pam_getenvlist)
2177 AC_CHECK_FUNCS(pam_putenv)
2178 LIBS="$saved_LIBS"
2179
2180 PAM_MSG="yes"
2181
Darren Tucker20e9f972007-03-25 18:26:01 +10002182 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002183 AC_DEFINE(USE_PAM, 1,
2184 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002185
Darren Tucker3e6bde42006-08-20 20:03:50 +10002186 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002187 case "$LIBS" in
2188 *-ldl*)
2189 # libdl already in LIBS
2190 ;;
2191 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002192 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002193 ;;
2194 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002195 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002196 fi
2197 ]
2198)
2199
2200# Check for older PAM
2201if test "x$PAM_MSG" = "xyes" ; then
2202 # Check PAM strerror arguments (old PAM)
2203 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2204 AC_TRY_COMPILE(
2205 [
2206#include <stdlib.h>
2207#if defined(HAVE_SECURITY_PAM_APPL_H)
2208#include <security/pam_appl.h>
2209#elif defined (HAVE_PAM_PAM_APPL_H)
2210#include <pam/pam_appl.h>
2211#endif
2212 ],
2213 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2214 [AC_MSG_RESULT(no)],
2215 [
2216 AC_DEFINE(HAVE_OLD_PAM, 1,
2217 [Define if you have an old version of PAM
2218 which takes only one argument to pam_strerror])
2219 AC_MSG_RESULT(yes)
2220 PAM_MSG="yes (old library)"
2221 ]
2222 )
2223fi
Damien Miller6c21c512002-01-22 21:57:53 +11002224
2225# Do we want to force the use of the rand helper?
2226AC_ARG_WITH(rand-helper,
2227 [ --with-rand-helper Use subprocess to gather strong randomness ],
2228 [
2229 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002230 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002231 # the previous test showed it to be unseeded.
2232 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2233 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2234 OPENSSL_SEEDS_ITSELF=yes
2235 USE_RAND_HELPER=""
2236 fi
2237 else
2238 USE_RAND_HELPER=yes
2239 fi
2240 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002241)
Damien Miller6c21c512002-01-22 21:57:53 +11002242
2243# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002244if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002245 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002246 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2247 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002248 RAND_MSG="OpenSSL internal ONLY"
2249 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002250elif test ! -z "$USE_RAND_HELPER" ; then
2251 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002252 RAND_MSG="ssh-rand-helper"
2253 INSTALL_SSH_RAND_HELPER="yes"
2254fi
2255AC_SUBST(INSTALL_SSH_RAND_HELPER)
2256
2257### Configuration of ssh-rand-helper
2258
2259# PRNGD TCP socket
2260AC_ARG_WITH(prngd-port,
2261 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2262 [
Damien Millere996d722002-01-23 11:20:59 +11002263 case "$withval" in
2264 no)
2265 withval=""
2266 ;;
2267 [[0-9]]*)
2268 ;;
2269 *)
2270 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2271 ;;
2272 esac
2273 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002274 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002275 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2276 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002277 fi
2278 ]
2279)
2280
2281# PRNGD Unix domain socket
2282AC_ARG_WITH(prngd-socket,
2283 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2284 [
Damien Millere996d722002-01-23 11:20:59 +11002285 case "$withval" in
2286 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002287 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002288 ;;
2289 no)
2290 withval=""
2291 ;;
2292 /*)
2293 ;;
2294 *)
2295 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2296 ;;
2297 esac
2298
2299 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002300 if test ! -z "$PRNGD_PORT" ; then
2301 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2302 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002303 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002304 AC_MSG_WARN(Entropy socket is not readable)
2305 fi
2306 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002307 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2308 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002309 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002310 ],
2311 [
2312 # Check for existing socket only if we don't have a random device already
2313 if test "$USE_RAND_HELPER" = yes ; then
2314 AC_MSG_CHECKING(for PRNGD/EGD socket)
2315 # Insert other locations here
2316 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2317 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2318 PRNGD_SOCKET="$sock"
2319 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2320 break;
2321 fi
2322 done
2323 if test ! -z "$PRNGD_SOCKET" ; then
2324 AC_MSG_RESULT($PRNGD_SOCKET)
2325 else
2326 AC_MSG_RESULT(not found)
2327 fi
2328 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002329 ]
2330)
2331
2332# Change default command timeout for hashing entropy source
2333entropy_timeout=200
2334AC_ARG_WITH(entropy-timeout,
2335 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2336 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002337 if test -n "$withval" && test "x$withval" != "xno" && \
2338 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002339 entropy_timeout=$withval
2340 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002341 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002342)
Tim Rice7df8d392005-09-19 09:33:39 -07002343AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2344 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002345
Damien Millerd3f6ad22002-06-25 10:24:47 +10002346SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002347AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002348 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002349 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002350 if test -n "$withval" && test "x$withval" != "xno" && \
2351 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002352 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002353 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002354 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002355)
Tim Rice7df8d392005-09-19 09:33:39 -07002356AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2357 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002358AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002359
Tim Rice88f2ab52002-03-17 12:17:34 -08002360# We do this little dance with the search path to insure
2361# that programs that we select for use by installed programs
2362# (which may be run by the super-user) come from trusted
2363# locations before they come from the user's private area.
2364# This should help avoid accidentally configuring some
2365# random version of a program in someone's personal bin.
2366
2367OPATH=$PATH
2368PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002369test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002370test -d /sbin && PATH=$PATH:/sbin
2371test -d /usr/sbin && PATH=$PATH:/usr/sbin
2372PATH=$PATH:/etc:$OPATH
2373
Damien Millera8e06ce2003-11-21 23:48:55 +11002374# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002375OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2376OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2377OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2378OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2379OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2380OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2381OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2382OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2383OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2384OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2385OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2386OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2387OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2388OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2389OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2390OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002391# restore PATH
2392PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002393
2394# Where does ssh-rand-helper get its randomness from?
2395INSTALL_SSH_PRNG_CMDS=""
2396if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2397 if test ! -z "$PRNGD_PORT" ; then
2398 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2399 elif test ! -z "$PRNGD_SOCKET" ; then
2400 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2401 else
2402 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2403 RAND_HELPER_CMDHASH=yes
2404 INSTALL_SSH_PRNG_CMDS="yes"
2405 fi
2406fi
2407AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2408
2409
Ben Lindstromb5628642000-10-18 00:02:25 +00002410# Cheap hack to ensure NEWS-OS libraries are arranged right.
2411if test ! -z "$SONY" ; then
2412 LIBS="$LIBS -liberty";
2413fi
2414
Damien Miller57f39152005-11-24 19:58:19 +11002415# Check for long long datatypes
2416AC_CHECK_TYPES([long long, unsigned long long, long double])
2417
2418# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002419AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002420AC_CHECK_SIZEOF(short int, 2)
2421AC_CHECK_SIZEOF(int, 4)
2422AC_CHECK_SIZEOF(long int, 4)
2423AC_CHECK_SIZEOF(long long int, 8)
2424
Damien Millerfa2bb692002-04-23 23:22:25 +10002425# Sanity check long long for some platforms (AIX)
2426if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2427 ac_cv_sizeof_long_long_int=0
2428fi
2429
Darren Tucker537f1ed2005-10-25 18:38:33 +10002430# compute LLONG_MIN and LLONG_MAX if we don't know them.
2431if test -z "$have_llong_max"; then
2432 AC_MSG_CHECKING([for max value of long long])
2433 AC_RUN_IFELSE(
2434 [AC_LANG_SOURCE([[
2435#include <stdio.h>
2436/* Why is this so damn hard? */
2437#ifdef __GNUC__
2438# undef __GNUC__
2439#endif
2440#define __USE_ISOC99
2441#include <limits.h>
2442#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002443#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2444
2445/*
2446 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2447 * we do this the hard way.
2448 */
2449static int
2450fprint_ll(FILE *f, long long n)
2451{
2452 unsigned int i;
2453 int l[sizeof(long long) * 8];
2454
2455 if (n < 0)
2456 if (fprintf(f, "-") < 0)
2457 return -1;
2458 for (i = 0; n != 0; i++) {
2459 l[i] = my_abs(n % 10);
2460 n /= 10;
2461 }
2462 do {
2463 if (fprintf(f, "%d", l[--i]) < 0)
2464 return -1;
2465 } while (i != 0);
2466 if (fprintf(f, " ") < 0)
2467 return -1;
2468 return 0;
2469}
2470
Darren Tucker537f1ed2005-10-25 18:38:33 +10002471int main(void) {
2472 FILE *f;
2473 long long i, llmin, llmax = 0;
2474
2475 if((f = fopen(DATA,"w")) == NULL)
2476 exit(1);
2477
2478#if defined(LLONG_MIN) && defined(LLONG_MAX)
2479 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2480 llmin = LLONG_MIN;
2481 llmax = LLONG_MAX;
2482#else
2483 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2484 /* This will work on one's complement and two's complement */
2485 for (i = 1; i > llmax; i <<= 1, i++)
2486 llmax = i;
2487 llmin = llmax + 1LL; /* wrap */
2488#endif
2489
2490 /* Sanity check */
2491 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002492 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2493 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002494 fprintf(f, "unknown unknown\n");
2495 exit(2);
2496 }
2497
Darren Tuckerd1450db2006-03-13 19:06:51 +11002498 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002499 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002500 if (fprint_ll(f, llmax) < 0)
2501 exit(4);
2502 if (fclose(f) < 0)
2503 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002504 exit(0);
2505}
2506 ]])],
2507 [
2508 llong_min=`$AWK '{print $1}' conftest.llminmax`
2509 llong_max=`$AWK '{print $2}' conftest.llminmax`
2510
Darren Tucker537f1ed2005-10-25 18:38:33 +10002511 AC_MSG_RESULT($llong_max)
2512 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2513 [max value of long long calculated by configure])
2514 AC_MSG_CHECKING([for min value of long long])
2515 AC_MSG_RESULT($llong_min)
2516 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2517 [min value of long long calculated by configure])
2518 ],
2519 [
2520 AC_MSG_RESULT(not found)
2521 ],
2522 [
2523 AC_MSG_WARN([cross compiling: not checking])
2524 ]
2525 )
2526fi
2527
2528
Damien Millera22ba012000-03-02 23:09:20 +11002529# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002530AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2531 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002532 [ #include <sys/types.h> ],
2533 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002534 [ ac_cv_have_u_int="yes" ],
2535 [ ac_cv_have_u_int="no" ]
2536 )
2537])
2538if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002539 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002540 have_u_int=1
2541fi
2542
Damien Miller61e50f12000-05-08 20:49:37 +10002543AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2544 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002545 [ #include <sys/types.h> ],
2546 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002547 [ ac_cv_have_intxx_t="yes" ],
2548 [ ac_cv_have_intxx_t="no" ]
2549 )
2550])
2551if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002552 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002553 have_intxx_t=1
2554fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002555
2556if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002557 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002558then
2559 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2560 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002561 [ #include <stdint.h> ],
2562 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002563 [
2564 AC_DEFINE(HAVE_INTXX_T)
2565 AC_MSG_RESULT(yes)
2566 ],
2567 [ AC_MSG_RESULT(no) ]
2568 )
2569fi
2570
Damien Miller578783e2000-09-23 14:12:24 +11002571AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2572 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002573 [
2574#include <sys/types.h>
2575#ifdef HAVE_STDINT_H
2576# include <stdint.h>
2577#endif
2578#include <sys/socket.h>
2579#ifdef HAVE_SYS_BITYPES_H
2580# include <sys/bitypes.h>
2581#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002582 ],
2583 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002584 [ ac_cv_have_int64_t="yes" ],
2585 [ ac_cv_have_int64_t="no" ]
2586 )
2587])
2588if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002589 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002590fi
2591
Damien Miller61e50f12000-05-08 20:49:37 +10002592AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2593 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002594 [ #include <sys/types.h> ],
2595 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002596 [ ac_cv_have_u_intxx_t="yes" ],
2597 [ ac_cv_have_u_intxx_t="no" ]
2598 )
2599])
2600if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002601 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002602 have_u_intxx_t=1
2603fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002604
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002605if test -z "$have_u_intxx_t" ; then
2606 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2607 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002608 [ #include <sys/socket.h> ],
2609 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002610 [
2611 AC_DEFINE(HAVE_U_INTXX_T)
2612 AC_MSG_RESULT(yes)
2613 ],
2614 [ AC_MSG_RESULT(no) ]
2615 )
2616fi
2617
Damien Miller578783e2000-09-23 14:12:24 +11002618AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2619 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002620 [ #include <sys/types.h> ],
2621 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002622 [ ac_cv_have_u_int64_t="yes" ],
2623 [ ac_cv_have_u_int64_t="no" ]
2624 )
2625])
2626if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002627 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002628 have_u_int64_t=1
2629fi
2630
Tim Rice4cec93f2002-02-26 08:40:48 -08002631if test -z "$have_u_int64_t" ; then
2632 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2633 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002634 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002635 [ u_int64_t a; a = 1],
2636 [
2637 AC_DEFINE(HAVE_U_INT64_T)
2638 AC_MSG_RESULT(yes)
2639 ],
2640 [ AC_MSG_RESULT(no) ]
2641 )
2642fi
2643
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002644if test -z "$have_u_intxx_t" ; then
2645 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2646 AC_TRY_COMPILE(
2647 [
2648#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002649 ],
2650 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002651 [ ac_cv_have_uintxx_t="yes" ],
2652 [ ac_cv_have_uintxx_t="no" ]
2653 )
2654 ])
2655 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002656 AC_DEFINE(HAVE_UINTXX_T, 1,
2657 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002658 fi
2659fi
2660
2661if test -z "$have_uintxx_t" ; then
2662 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2663 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002664 [ #include <stdint.h> ],
2665 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002666 [
2667 AC_DEFINE(HAVE_UINTXX_T)
2668 AC_MSG_RESULT(yes)
2669 ],
2670 [ AC_MSG_RESULT(no) ]
2671 )
2672fi
2673
Damien Milleredb82922000-06-20 13:25:52 +10002674if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002675 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002676then
2677 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2678 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002679 [
2680#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002681 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002682 [
Damien Miller70494d12000-04-03 15:57:06 +10002683 int8_t a; int16_t b; int32_t c;
2684 u_int8_t e; u_int16_t f; u_int32_t g;
2685 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002686 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002687 [
2688 AC_DEFINE(HAVE_U_INTXX_T)
2689 AC_DEFINE(HAVE_INTXX_T)
2690 AC_MSG_RESULT(yes)
2691 ],
2692 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002693 )
Damien Millerb29ea912000-01-15 14:12:03 +11002694fi
2695
Damien Miller58be7382001-09-15 21:31:54 +10002696
2697AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2698 AC_TRY_COMPILE(
2699 [
2700#include <sys/types.h>
2701 ],
2702 [ u_char foo; foo = 125; ],
2703 [ ac_cv_have_u_char="yes" ],
2704 [ ac_cv_have_u_char="no" ]
2705 )
2706])
2707if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002708 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002709fi
2710
Tim Rice13aae5e2001-10-21 17:53:58 -07002711TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002712
Tim Rice200a5c02002-02-26 22:12:34 -08002713AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Darren Tucker598eaa62008-06-09 03:32:29 +10002714AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2715#include <sys/types.h>
2716#ifdef HAVE_SYS_BITYPES_H
2717#include <sys/bitypes.h>
2718#endif
2719#ifdef HAVE_SYS_STATFS_H
2720#include <sys/statfs.h>
2721#endif
2722#ifdef HAVE_SYS_STATVFS_H
2723#include <sys/statvfs.h>
2724#endif
2725])
Tim Rice4cec93f2002-02-26 08:40:48 -08002726
Darren Tucker30ed6682009-03-07 18:06:22 +11002727AC_CHECK_TYPES([in_addr_t, in_port_t],,,
Damien Miller848b9932005-02-24 12:12:34 +11002728[#include <sys/types.h>
2729#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002730
Damien Miller61e50f12000-05-08 20:49:37 +10002731AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2732 AC_TRY_COMPILE(
2733 [
2734#include <sys/types.h>
2735 ],
2736 [ size_t foo; foo = 1235; ],
2737 [ ac_cv_have_size_t="yes" ],
2738 [ ac_cv_have_size_t="no" ]
2739 )
2740])
2741if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002742 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002743fi
Damien Miller95058511999-12-29 10:36:45 +11002744
Damien Miller615f9392000-05-17 22:53:33 +10002745AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2746 AC_TRY_COMPILE(
2747 [
2748#include <sys/types.h>
2749 ],
2750 [ ssize_t foo; foo = 1235; ],
2751 [ ac_cv_have_ssize_t="yes" ],
2752 [ ac_cv_have_ssize_t="no" ]
2753 )
2754])
2755if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002756 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002757fi
2758
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002759AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2760 AC_TRY_COMPILE(
2761 [
2762#include <time.h>
2763 ],
2764 [ clock_t foo; foo = 1235; ],
2765 [ ac_cv_have_clock_t="yes" ],
2766 [ ac_cv_have_clock_t="no" ]
2767 )
2768])
2769if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002770 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002771fi
2772
Damien Millerb54b40e2000-06-23 08:23:34 +10002773AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2774 AC_TRY_COMPILE(
2775 [
2776#include <sys/types.h>
2777#include <sys/socket.h>
2778 ],
2779 [ sa_family_t foo; foo = 1235; ],
2780 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002781 [ AC_TRY_COMPILE(
2782 [
2783#include <sys/types.h>
2784#include <sys/socket.h>
2785#include <netinet/in.h>
2786 ],
2787 [ sa_family_t foo; foo = 1235; ],
2788 [ ac_cv_have_sa_family_t="yes" ],
2789
Damien Millerb54b40e2000-06-23 08:23:34 +10002790 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002791 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002792 )
2793])
2794if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002795 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2796 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002797fi
2798
Damien Miller0f91b4e2000-06-18 15:43:25 +10002799AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2800 AC_TRY_COMPILE(
2801 [
2802#include <sys/types.h>
2803 ],
2804 [ pid_t foo; foo = 1235; ],
2805 [ ac_cv_have_pid_t="yes" ],
2806 [ ac_cv_have_pid_t="no" ]
2807 )
2808])
2809if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002810 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002811fi
2812
2813AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2814 AC_TRY_COMPILE(
2815 [
2816#include <sys/types.h>
2817 ],
2818 [ mode_t foo; foo = 1235; ],
2819 [ ac_cv_have_mode_t="yes" ],
2820 [ ac_cv_have_mode_t="no" ]
2821 )
2822])
2823if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002824 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002825fi
2826
Damien Miller61e50f12000-05-08 20:49:37 +10002827
2828AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2829 AC_TRY_COMPILE(
2830 [
Damien Miller81171112000-04-23 11:14:01 +10002831#include <sys/types.h>
2832#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002833 ],
2834 [ struct sockaddr_storage s; ],
2835 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2836 [ ac_cv_have_struct_sockaddr_storage="no" ]
2837 )
2838])
2839if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002840 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2841 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002842fi
Damien Miller34132e52000-01-14 15:45:46 +11002843
Damien Miller61e50f12000-05-08 20:49:37 +10002844AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2845 AC_TRY_COMPILE(
2846 [
Damien Miller7b22d652000-06-18 14:07:04 +10002847#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002848#include <netinet/in.h>
2849 ],
2850 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2851 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2852 [ ac_cv_have_struct_sockaddr_in6="no" ]
2853 )
2854])
2855if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002856 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2857 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002858fi
Damien Miller34132e52000-01-14 15:45:46 +11002859
Damien Miller61e50f12000-05-08 20:49:37 +10002860AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2861 AC_TRY_COMPILE(
2862 [
Damien Miller7b22d652000-06-18 14:07:04 +10002863#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002864#include <netinet/in.h>
2865 ],
2866 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2867 [ ac_cv_have_struct_in6_addr="yes" ],
2868 [ ac_cv_have_struct_in6_addr="no" ]
2869 )
2870])
2871if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002872 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2873 [define if you have struct in6_addr data type])
Tim Rice0f4d2c02008-11-18 21:26:41 -08002874
2875dnl Now check for sin6_scope_id
2876 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
2877 [
2878#ifdef HAVE_SYS_TYPES_H
2879#include <sys/types.h>
2880#endif
2881#include <netinet/in.h>
2882 ])
Damien Miller61e50f12000-05-08 20:49:37 +10002883fi
Damien Miller34132e52000-01-14 15:45:46 +11002884
Damien Miller61e50f12000-05-08 20:49:37 +10002885AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2886 AC_TRY_COMPILE(
2887 [
Damien Miller81171112000-04-23 11:14:01 +10002888#include <sys/types.h>
2889#include <sys/socket.h>
2890#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002891 ],
2892 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2893 [ ac_cv_have_struct_addrinfo="yes" ],
2894 [ ac_cv_have_struct_addrinfo="no" ]
2895 )
2896])
2897if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002898 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2899 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002900fi
2901
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002902AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2903 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002904 [ #include <sys/time.h> ],
2905 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002906 [ ac_cv_have_struct_timeval="yes" ],
2907 [ ac_cv_have_struct_timeval="no" ]
2908 )
2909])
2910if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002911 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002912 have_struct_timeval=1
2913fi
2914
Tim Rice4e4dc562003-03-18 10:21:40 -08002915AC_CHECK_TYPES(struct timespec)
2916
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002917# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002918if test "x$ac_cv_have_int64_t" = "xno" && \
2919 test "x$ac_cv_sizeof_long_int" != "x8" && \
2920 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002921 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2922 echo "an alternative compiler (I.E., GCC) before continuing."
2923 echo ""
2924 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002925else
2926dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002927 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002928 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002929#include <stdio.h>
2930#include <string.h>
2931#ifdef HAVE_SNPRINTF
2932main()
2933{
2934 char buf[50];
2935 char expected_out[50];
2936 int mazsize = 50 ;
2937#if (SIZEOF_LONG_INT == 8)
2938 long int num = 0x7fffffffffffffff;
2939#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002940 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002941#endif
2942 strcpy(expected_out, "9223372036854775807");
2943 snprintf(buf, mazsize, "%lld", num);
2944 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002945 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002946 exit(0);
2947}
2948#else
2949main() { exit(0); }
2950#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002951 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002952 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002953 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002954fi
2955
Damien Miller78315eb2000-09-29 23:01:36 +11002956dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002957OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2958OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2959OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2960OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2961OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002962OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002963OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2964OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002965OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002966OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2967OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2968OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2969OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002970OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2971OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2972OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2973OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002974
2975AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002976AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2977 [Define if we don't have struct __res_state in resolv.h])],
2978[
2979#include <stdio.h>
2980#if HAVE_SYS_TYPES_H
2981# include <sys/types.h>
2982#endif
2983#include <netinet/in.h>
2984#include <arpa/nameser.h>
2985#include <resolv.h>
2986])
andre2ff7b5d2000-06-03 14:57:40 +00002987
Damien Miller61e50f12000-05-08 20:49:37 +10002988AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2989 ac_cv_have_ss_family_in_struct_ss, [
2990 AC_TRY_COMPILE(
2991 [
Damien Miller81171112000-04-23 11:14:01 +10002992#include <sys/types.h>
2993#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002994 ],
2995 [ struct sockaddr_storage s; s.ss_family = 1; ],
2996 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2997 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2998 )
2999])
3000if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003001 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003002fi
3003
Damien Miller61e50f12000-05-08 20:49:37 +10003004AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3005 ac_cv_have___ss_family_in_struct_ss, [
3006 AC_TRY_COMPILE(
3007 [
Damien Miller81171112000-04-23 11:14:01 +10003008#include <sys/types.h>
3009#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10003010 ],
3011 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3012 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3013 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3014 )
3015])
3016if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003017 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3018 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10003019fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11003020
Damien Millerad833b32000-08-23 10:46:23 +10003021AC_CACHE_CHECK([for pw_class field in struct passwd],
3022 ac_cv_have_pw_class_in_struct_passwd, [
3023 AC_TRY_COMPILE(
3024 [
Damien Millerad833b32000-08-23 10:46:23 +10003025#include <pwd.h>
3026 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00003027 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10003028 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3029 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3030 )
3031])
3032if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003033 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3034 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10003035fi
3036
Kevin Steves82456952001-06-22 21:14:18 +00003037AC_CACHE_CHECK([for pw_expire field in struct passwd],
3038 ac_cv_have_pw_expire_in_struct_passwd, [
3039 AC_TRY_COMPILE(
3040 [
3041#include <pwd.h>
3042 ],
3043 [ struct passwd p; p.pw_expire = 0; ],
3044 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3045 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3046 )
3047])
3048if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003049 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3050 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00003051fi
3052
3053AC_CACHE_CHECK([for pw_change field in struct passwd],
3054 ac_cv_have_pw_change_in_struct_passwd, [
3055 AC_TRY_COMPILE(
3056 [
3057#include <pwd.h>
3058 ],
3059 [ struct passwd p; p.pw_change = 0; ],
3060 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3061 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3062 )
3063])
3064if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003065 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3066 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00003067fi
Damien Miller61e50f12000-05-08 20:49:37 +10003068
Tim Rice28bbb0c2002-05-27 17:37:32 -07003069dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00003070AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3071 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10003072 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00003073 [
Tim Riceae49fe62002-04-12 10:26:21 -07003074#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00003075#include <sys/socket.h>
3076#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07003077int main() {
3078#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10003079#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003080exit(1);
3081#endif
3082struct msghdr m;
3083m.msg_accrights = 0;
3084exit(0);
3085}
Kevin Steves939c9db2002-03-22 17:23:25 +00003086 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00003087 [ ac_cv_have_accrights_in_msghdr="yes" ],
3088 [ ac_cv_have_accrights_in_msghdr="no" ]
3089 )
3090])
3091if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003092 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3093 [Define if your system uses access rights style
3094 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003095fi
3096
Darren Tucker32780622009-06-16 16:11:02 +10003097AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
Darren Tucker77001382008-06-09 06:17:53 +10003098AC_TRY_COMPILE([
3099#include <sys/types.h>
Darren Tucker32780622009-06-16 16:11:02 +10003100#include <sys/stat.h>
3101#ifdef HAVE_SYS_TIME_H
3102# include <sys/time.h>
3103#endif
3104#ifdef HAVE_SYS_MOUNT_H
3105#include <sys/mount.h>
3106#endif
3107#ifdef HAVE_SYS_STATVFS_H
3108#include <sys/statvfs.h>
3109#endif
3110], [struct statvfs s; s.f_fsid = 0;],
3111[ AC_MSG_RESULT(yes) ],
3112[ AC_MSG_RESULT(no)
3113
3114 AC_MSG_CHECKING(if fsid_t has member val)
3115 AC_TRY_COMPILE([
3116#include <sys/types.h>
Darren Tucker77001382008-06-09 06:17:53 +10003117#include <sys/statvfs.h>],
Darren Tucker32780622009-06-16 16:11:02 +10003118 [fsid_t t; t.val[0] = 0;],
Darren Tucker77001382008-06-09 06:17:53 +10003119 [ AC_MSG_RESULT(yes)
Darren Tucker32780622009-06-16 16:11:02 +10003120 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3121 [ AC_MSG_RESULT(no) ])
3122
3123 AC_MSG_CHECKING(if f_fsid has member __val)
3124 AC_TRY_COMPILE([
3125#include <sys/types.h>
3126#include <sys/statvfs.h>],
3127 [fsid_t t; t.__val[0] = 0;],
3128 [ AC_MSG_RESULT(yes)
3129 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3130 [ AC_MSG_RESULT(no) ])
3131])
Darren Tucker77001382008-06-09 06:17:53 +10003132
Kevin Stevesa44e0352002-04-07 16:18:03 +00003133AC_CACHE_CHECK([for msg_control field in struct msghdr],
3134 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10003135 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00003136 [
Tim Riceae49fe62002-04-12 10:26:21 -07003137#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003138#include <sys/socket.h>
3139#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07003140int main() {
3141#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003142#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003143exit(1);
3144#endif
3145struct msghdr m;
3146m.msg_control = 0;
3147exit(0);
3148}
Kevin Stevesa44e0352002-04-07 16:18:03 +00003149 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003150 [ ac_cv_have_control_in_msghdr="yes" ],
3151 [ ac_cv_have_control_in_msghdr="no" ]
3152 )
3153])
3154if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003155 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3156 [Define if your system uses ancillary data style
3157 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003158fi
3159
Damien Miller61e50f12000-05-08 20:49:37 +10003160AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003161 AC_TRY_LINK([],
3162 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10003163 [ ac_cv_libc_defines___progname="yes" ],
3164 [ ac_cv_libc_defines___progname="no" ]
3165 )
3166])
3167if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003168 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003169fi
3170
Kevin Steves4846f4a2002-03-22 18:19:53 +00003171AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3172 AC_TRY_LINK([
3173#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003174],
3175 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003176 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3177 [ ac_cv_cc_implements___FUNCTION__="no" ]
3178 )
3179])
3180if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003181 AC_DEFINE(HAVE___FUNCTION__, 1,
3182 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003183fi
3184
3185AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3186 AC_TRY_LINK([
3187#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003188],
3189 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003190 [ ac_cv_cc_implements___func__="yes" ],
3191 [ ac_cv_cc_implements___func__="no" ]
3192 )
3193])
3194if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003195 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003196fi
3197
Damien Miller57f39152005-11-24 19:58:19 +11003198AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3199 AC_TRY_LINK(
3200 [#include <stdarg.h>
3201 va_list x,y;],
3202 [va_copy(x,y);],
3203 [ ac_cv_have_va_copy="yes" ],
3204 [ ac_cv_have_va_copy="no" ]
3205 )
3206])
3207if test "x$ac_cv_have_va_copy" = "xyes" ; then
3208 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3209fi
3210
3211AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3212 AC_TRY_LINK(
3213 [#include <stdarg.h>
3214 va_list x,y;],
3215 [__va_copy(x,y);],
3216 [ ac_cv_have___va_copy="yes" ],
3217 [ ac_cv_have___va_copy="no" ]
3218 )
3219])
3220if test "x$ac_cv_have___va_copy" = "xyes" ; then
3221 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3222fi
3223
Damien Miller4f8e6692001-07-14 13:22:53 +10003224AC_CACHE_CHECK([whether getopt has optreset support],
3225 ac_cv_have_getopt_optreset, [
3226 AC_TRY_LINK(
3227 [
3228#include <getopt.h>
3229 ],
3230 [ extern int optreset; optreset = 0; ],
3231 [ ac_cv_have_getopt_optreset="yes" ],
3232 [ ac_cv_have_getopt_optreset="no" ]
3233 )
3234])
3235if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003236 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3237 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003238fi
Damien Millera22ba012000-03-02 23:09:20 +11003239
Damien Millerecbb26d2000-07-15 14:59:14 +10003240AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003241 AC_TRY_LINK([],
3242 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003243 [ ac_cv_libc_defines_sys_errlist="yes" ],
3244 [ ac_cv_libc_defines_sys_errlist="no" ]
3245 )
3246])
3247if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003248 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3249 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003250fi
3251
3252
Damien Miller11fa2cc2000-08-16 10:35:58 +10003253AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003254 AC_TRY_LINK([],
3255 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003256 [ ac_cv_libc_defines_sys_nerr="yes" ],
3257 [ ac_cv_libc_defines_sys_nerr="no" ]
3258 )
3259])
3260if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003261 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003262fi
3263
Damien Millera8e06ce2003-11-21 23:48:55 +11003264SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003265# Check whether user wants sectok support
3266AC_ARG_WITH(sectok,
3267 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003268 [
3269 if test "x$withval" != "xno" ; then
3270 if test "x$withval" != "xyes" ; then
3271 CPPFLAGS="$CPPFLAGS -I${withval}"
3272 LDFLAGS="$LDFLAGS -L${withval}"
3273 if test ! -z "$need_dash_r" ; then
3274 LDFLAGS="$LDFLAGS -R${withval}"
3275 fi
3276 if test ! -z "$blibpath" ; then
3277 blibpath="$blibpath:${withval}"
3278 fi
3279 fi
3280 AC_CHECK_HEADERS(sectok.h)
3281 if test "$ac_cv_header_sectok_h" != yes; then
3282 AC_MSG_ERROR(Can't find sectok.h)
3283 fi
3284 AC_CHECK_LIB(sectok, sectok_open)
3285 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3286 AC_MSG_ERROR(Can't find libsectok)
3287 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003288 AC_DEFINE(SMARTCARD, 1,
3289 [Define if you want smartcard support])
3290 AC_DEFINE(USE_SECTOK, 1,
3291 [Define if you want smartcard support
3292 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003293 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003294 fi
3295 ]
3296)
3297
3298# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003299OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003300AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003301 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003302 [
3303 if test "x$withval" != "xno" ; then
Darren Tucker15333112009-12-07 11:15:43 +11003304 AC_PATH_PROG(PKGCONFIG, pkg-config, no)
3305 AC_MSG_CHECKING(how to get opensc config)
3306 if test "x$withval" != "xyes" -a "x$PKGCONFIG" = "xno"; then
3307 OPENSC_CONFIG="$withval/bin/opensc-config"
3308 elif test -f "$withval/src/libopensc/libopensc.pc"; then
3309 OPENSC_CONFIG="$PKGCONFIG $withval/src/libopensc/libopensc.pc"
3310 elif test "x$PKGCONFIG" != "xno"; then
3311 OPENSC_CONFIG="$PKGCONFIG libopensc"
Tim Rice12ee8e22005-03-17 13:37:04 -08003312 else
Darren Tucker15333112009-12-07 11:15:43 +11003313 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
Tim Rice12ee8e22005-03-17 13:37:04 -08003314 fi
Darren Tucker15333112009-12-07 11:15:43 +11003315 AC_MSG_RESULT($OPENSC_CONFIG)
Tim Rice12ee8e22005-03-17 13:37:04 -08003316 if test "$OPENSC_CONFIG" != "no"; then
3317 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3318 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3319 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003320 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003321 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003322 AC_DEFINE(USE_OPENSC, 1,
3323 [Define if you want smartcard support
3324 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003325 SCARD_MSG="yes, using OpenSC"
3326 fi
3327 fi
3328 ]
3329)
Damien Miller85de5802001-09-18 14:01:11 +10003330
Darren Tucker5f88d342003-10-15 16:57:57 +10003331# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003332AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003333 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3334 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003335 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003336 # Needed by our getrrsetbyname()
3337 AC_SEARCH_LIBS(res_query, resolv)
3338 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003339 AC_MSG_CHECKING(if res_query will link)
Darren Tuckere02b49a2009-09-11 14:56:08 +10003340 AC_LINK_IFELSE([
3341#include "confdefs.h"
3342#include <sys/types.h>
3343#include <netinet/in.h>
3344#include <arpa/nameser.h>
3345#include <netdb.h>
3346#include <resolv.h>
3347int main()
3348{
3349 res_query (0, 0, 0, 0, 0);
3350 return 0;
3351}
3352 ],
3353 AC_MSG_RESULT(yes),
Darren Tucker8e968a52004-05-13 11:56:16 +10003354 [AC_MSG_RESULT(no)
3355 saved_LIBS="$LIBS"
3356 LIBS="$LIBS -lresolv"
3357 AC_MSG_CHECKING(for res_query in -lresolv)
3358 AC_LINK_IFELSE([
Darren Tuckere02b49a2009-09-11 14:56:08 +10003359#include "confdefs.h"
3360#include <sys/types.h>
3361#include <netinet/in.h>
3362#include <arpa/nameser.h>
3363#include <netdb.h>
Darren Tucker8e968a52004-05-13 11:56:16 +10003364#include <resolv.h>
3365int main()
3366{
3367 res_query (0, 0, 0, 0, 0);
3368 return 0;
3369}
3370 ],
Darren Tuckere02b49a2009-09-11 14:56:08 +10003371 [AC_MSG_RESULT(yes)],
Darren Tucker8e968a52004-05-13 11:56:16 +10003372 [LIBS="$saved_LIBS"
3373 AC_MSG_RESULT(no)])
3374 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003375 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003376 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003377 [#include <sys/types.h>
3378 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003379 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003380 [AC_DEFINE(HAVE_HEADER_AD, 1,
3381 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003382 [#include <arpa/nameser.h>])
3383 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003384
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003385AC_MSG_CHECKING(if struct __res_state _res is an extern)
3386AC_LINK_IFELSE([
3387#include <stdio.h>
3388#if HAVE_SYS_TYPES_H
3389# include <sys/types.h>
3390#endif
3391#include <netinet/in.h>
3392#include <arpa/nameser.h>
3393#include <resolv.h>
3394extern struct __res_state _res;
3395int main() { return 0; }
3396 ],
3397 [AC_MSG_RESULT(yes)
3398 AC_DEFINE(HAVE__RES_EXTERN, 1,
3399 [Define if you have struct __res_state _res as an extern])
3400 ],
3401 [ AC_MSG_RESULT(no) ]
3402)
3403
Damien Miller73b42d22006-04-22 21:26:08 +10003404# Check whether user wants SELinux support
3405SELINUX_MSG="no"
3406LIBSELINUX=""
3407AC_ARG_WITH(selinux,
Damien Miller5b1c8b32008-03-27 12:33:07 +11003408 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003409 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003410 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003411 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3412 SELINUX_MSG="yes"
3413 AC_CHECK_HEADER([selinux/selinux.h], ,
3414 AC_MSG_ERROR(SELinux support requires selinux.h header))
3415 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3416 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003417 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003418 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003419 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003420 fi ]
3421)
Damien Miller73b42d22006-04-22 21:26:08 +10003422
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003423# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003424KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003425AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003426 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003427 [ if test "x$withval" != "xno" ; then
3428 if test "x$withval" = "xyes" ; then
3429 KRB5ROOT="/usr/local"
3430 else
3431 KRB5ROOT=${withval}
3432 fi
3433
Tim Rice7df8d392005-09-19 09:33:39 -07003434 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003435 KRB5_MSG="yes"
3436
Darren Tuckerdad48e72009-09-01 18:26:00 +10003437 AC_PATH_PROG([KRB5CONF],[krb5-config],
3438 [$KRB5ROOT/bin/krb5-config],
3439 [$KRB5ROOT/bin:$PATH])
3440 if test -x $KRB5CONF ; then
Darren Tucker1d3ca582004-01-22 12:05:34 +11003441
3442 AC_MSG_CHECKING(for gssapi support)
3443 if $KRB5CONF | grep gssapi >/dev/null ; then
3444 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003445 AC_DEFINE(GSSAPI, 1,
3446 [Define this if you want GSSAPI
3447 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003448 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003449 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003450 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003451 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003452 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003453 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3454 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003455 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003456 AC_MSG_CHECKING(whether we are using Heimdal)
3457 AC_TRY_COMPILE([ #include <krb5.h> ],
3458 [ char *tmp = heimdal_version; ],
3459 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003460 AC_DEFINE(HEIMDAL, 1,
3461 [Define this if you are using the
3462 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003463 AC_MSG_RESULT(no)
3464 )
3465 else
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003466 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003467 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003468 AC_MSG_CHECKING(whether we are using Heimdal)
3469 AC_TRY_COMPILE([ #include <krb5.h> ],
3470 [ char *tmp = heimdal_version; ],
3471 [ AC_MSG_RESULT(yes)
3472 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003473 K5LIBS="-lkrb5 -ldes"
3474 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003475 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003476 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003477 ],
3478 [ AC_MSG_RESULT(no)
3479 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3480 ]
3481 )
Damien Miller200d0a72003-06-30 19:21:36 +10003482 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003483
Darren Tucker30fd49e2008-06-14 09:14:46 +10003484 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003485 [ AC_DEFINE(GSSAPI)
Darren Tucker30fd49e2008-06-14 09:14:46 +10003486 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3487 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003488 [ AC_DEFINE(GSSAPI)
Darren Tucker30fd49e2008-06-14 09:14:46 +10003489 K5LIBS="-lgssapi $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003490 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3491 $K5LIBS)
3492 ],
3493 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003494
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003495 AC_CHECK_HEADER(gssapi.h, ,
3496 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003497 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003498 AC_CHECK_HEADERS(gssapi.h, ,
3499 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003500 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003501 ]
3502 )
3503
3504 oldCPP="$CPPFLAGS"
3505 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3506 AC_CHECK_HEADER(gssapi_krb5.h, ,
3507 [ CPPFLAGS="$oldCPP" ])
3508
Damien Millera8e06ce2003-11-21 23:48:55 +11003509 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003510 if test ! -z "$need_dash_r" ; then
3511 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3512 fi
3513 if test ! -z "$blibpath" ; then
3514 blibpath="$blibpath:${KRB5ROOT}/lib"
3515 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003516
3517 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3518 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3519 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3520
3521 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003522 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3523 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003524 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003525 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003526)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003527
Damien Millera22ba012000-03-02 23:09:20 +11003528# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003529
Damien Millerf58c6722002-05-13 13:15:42 +10003530PRIVSEP_PATH=/var/empty
3531AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003532 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003533 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003534 if test -n "$withval" && test "x$withval" != "xno" && \
3535 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003536 PRIVSEP_PATH=$withval
3537 fi
3538 ]
3539)
3540AC_SUBST(PRIVSEP_PATH)
3541
Damien Millera22ba012000-03-02 23:09:20 +11003542AC_ARG_WITH(xauth,
3543 [ --with-xauth=PATH Specify path to xauth program ],
3544 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003545 if test -n "$withval" && test "x$withval" != "xno" && \
3546 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003547 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003548 fi
3549 ],
3550 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003551 TestPath="$PATH"
3552 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3553 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3554 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3555 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3556 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003557 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003558 xauth_path="/usr/openwin/bin/xauth"
3559 fi
3560 ]
3561)
3562
Damien Miller7d901272003-01-13 16:55:22 +11003563STRIP_OPT=-s
3564AC_ARG_ENABLE(strip,
3565 [ --disable-strip Disable calling strip(1) on install],
3566 [
3567 if test "x$enableval" = "xno" ; then
3568 STRIP_OPT=
3569 fi
3570 ]
3571)
3572AC_SUBST(STRIP_OPT)
3573
Damien Millera19cf472000-11-29 13:28:50 +11003574if test -z "$xauth_path" ; then
3575 XAUTH_PATH="undefined"
3576 AC_SUBST(XAUTH_PATH)
3577else
Tim Rice7df8d392005-09-19 09:33:39 -07003578 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3579 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003580 XAUTH_PATH=$xauth_path
3581 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003582fi
Damien Millera22ba012000-03-02 23:09:20 +11003583
3584# Check for mail directory (last resort if we cannot get it from headers)
3585if test ! -z "$MAIL" ; then
3586 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003587 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3588 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003589fi
3590
Darren Tucker623d92f2004-09-12 22:36:15 +10003591if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003592 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3593 disable_ptmx_check=yes
3594fi
Damien Millera22ba012000-03-02 23:09:20 +11003595if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003596 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003597 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003598 [
Tim Rice7df8d392005-09-19 09:33:39 -07003599 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3600 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003601 have_dev_ptmx=1
3602 ]
3603 )
3604 fi
Damien Millera22ba012000-03-02 23:09:20 +11003605fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003606
Darren Tucker623d92f2004-09-12 22:36:15 +10003607if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003608 AC_CHECK_FILE("/dev/ptc",
3609 [
Tim Rice7df8d392005-09-19 09:33:39 -07003610 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3611 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003612 have_dev_ptc=1
3613 ]
3614 )
3615else
3616 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3617fi
Damien Miller204ad072000-03-02 23:56:12 +11003618
Damien Millera22ba012000-03-02 23:09:20 +11003619# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003620AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003621 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003622 [
Damien Miller897741e2001-04-16 10:41:46 +10003623 case "$withval" in
3624 man|cat|doc)
3625 MANTYPE=$withval
3626 ;;
3627 *)
3628 AC_MSG_ERROR(invalid man type: $withval)
3629 ;;
3630 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003631 ]
3632)
Ben Lindstrombc709922001-04-18 18:04:21 +00003633if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003634 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3635 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003636 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3637 MANTYPE=doc
3638 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3639 MANTYPE=man
3640 else
3641 MANTYPE=cat
3642 fi
3643fi
Damien Miller670a4b82000-01-22 13:53:11 +11003644AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003645if test "$MANTYPE" = "doc"; then
3646 mansubdir=man;
3647else
3648 mansubdir=$MANTYPE;
3649fi
3650AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003651
Damien Millera22ba012000-03-02 23:09:20 +11003652# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003653MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003654AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003655 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003656 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003657 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003658 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3659 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003660 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003661 fi
3662 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003663)
3664
Damien Millera22ba012000-03-02 23:09:20 +11003665# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003666AC_ARG_WITH(shadow,
3667 [ --without-shadow Disable shadow password support],
3668 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003669 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003670 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003671 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003672 fi
3673 ]
3674)
3675
Damien Miller1f335fb2000-06-26 11:31:33 +10003676if test -z "$disable_shadow" ; then
3677 AC_MSG_CHECKING([if the systems has expire shadow information])
3678 AC_TRY_COMPILE(
3679 [
3680#include <sys/types.h>
3681#include <shadow.h>
3682 struct spwd sp;
3683 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3684 [ sp_expire_available=yes ], []
3685 )
3686
3687 if test "x$sp_expire_available" = "xyes" ; then
3688 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003689 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3690 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003691 else
3692 AC_MSG_RESULT(no)
3693 fi
3694fi
3695
Damien Millera22ba012000-03-02 23:09:20 +11003696# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003697if test ! -z "$IPADDR_IN_DISPLAY" ; then
3698 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003699 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3700 [Define if you need to use IP address
3701 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003702else
Damien Millera8e06ce2003-11-21 23:48:55 +11003703 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003704 AC_ARG_WITH(ipaddr-display,
3705 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3706 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003707 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003708 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003709 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003710 fi
3711 ]
3712 )
3713fi
Damien Miller76112de1999-12-21 11:18:08 +11003714
Darren Tuckere1a790d2003-09-16 11:52:19 +10003715# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003716AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003717 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003718 [ if test "x$enableval" = "xno"; then
3719 AC_MSG_NOTICE([/etc/default/login handling disabled])
3720 etc_default_login=no
3721 else
3722 etc_default_login=yes
3723 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003724 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3725 then
3726 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3727 etc_default_login=no
3728 else
3729 etc_default_login=yes
3730 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003731)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003732
Darren Tucker2f9573d2005-02-10 22:28:54 +11003733if test "x$etc_default_login" != "xno"; then
3734 AC_CHECK_FILE("/etc/default/login",
3735 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003736 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003737 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3738 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003739 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003740fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003741
Tim Rice43a1c132002-04-17 21:19:14 -07003742dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003743if test $ac_cv_func_login_getcapbool = "yes" && \
3744 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003745 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003746fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003747
Damien Millera22ba012000-03-02 23:09:20 +11003748# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003749SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003750AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003751 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003752 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003753 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003754 AC_MSG_WARN([
3755--with-default-path=PATH has no effect on this system.
3756Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003757 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003758 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003759 AC_MSG_WARN([
3760--with-default-path=PATH will only be used if PATH is not defined in
3761$external_path_file .])
3762 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003763 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003764 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003765 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003766 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003767 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3768 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003769 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003770 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003771 AC_MSG_WARN([
3772If PATH is defined in $external_path_file, ensure the path to scp is included,
3773otherwise scp will not work.])
3774 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003775 AC_RUN_IFELSE(
3776 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003777/* find out what STDPATH is */
3778#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003779#ifdef HAVE_PATHS_H
3780# include <paths.h>
3781#endif
3782#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003783# ifdef _PATH_USERPATH /* Irix */
3784# define _PATH_STDPATH _PATH_USERPATH
3785# else
3786# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3787# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003788#endif
3789#include <sys/types.h>
3790#include <sys/stat.h>
3791#include <fcntl.h>
3792#define DATA "conftest.stdpath"
3793
3794main()
3795{
3796 FILE *fd;
3797 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003798
Tim Rice59ea0a02001-03-10 13:50:45 -08003799 fd = fopen(DATA,"w");
3800 if(fd == NULL)
3801 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003802
Tim Rice59ea0a02001-03-10 13:50:45 -08003803 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3804 exit(1);
3805
3806 exit(0);
3807}
Darren Tucker314d89e2005-10-17 23:29:23 +10003808 ]])],
3809 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003810 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3811 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3812 )
3813# make sure $bindir is in USER_PATH so scp will work
3814 t_bindir=`eval echo ${bindir}`
3815 case $t_bindir in
3816 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3817 esac
3818 case $t_bindir in
3819 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3820 esac
3821 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3822 if test $? -ne 0 ; then
3823 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3824 if test $? -ne 0 ; then
3825 user_path=$user_path:$t_bindir
3826 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3827 fi
3828 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003829 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003830)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003831if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003832 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003833 AC_SUBST(user_path)
3834fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003835
Damien Millera18bbd32002-05-13 10:48:57 +10003836# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003837AC_ARG_WITH(superuser-path,
3838 [ --with-superuser-path= Specify different path for super-user],
3839 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003840 if test -n "$withval" && test "x$withval" != "xno" && \
3841 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003842 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3843 [Define if you want a different $PATH
3844 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003845 superuser_path=$withval
3846 fi
3847 ]
3848)
3849
3850
Damien Miller61e50f12000-05-08 20:49:37 +10003851AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003852IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003853AC_ARG_WITH(4in6,
3854 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3855 [
3856 if test "x$withval" != "xno" ; then
3857 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003858 AC_DEFINE(IPV4_IN_IPV6, 1,
3859 [Detect IPv4 in IPv6 mapped addresses
3860 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003861 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003862 else
3863 AC_MSG_RESULT(no)
3864 fi
3865 ],[
3866 if test "x$inet6_default_4in6" = "xyes"; then
3867 AC_MSG_RESULT([yes (default)])
3868 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003869 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003870 else
3871 AC_MSG_RESULT([no (default)])
3872 fi
3873 ]
3874)
3875
Damien Miller60396b02001-02-18 17:01:00 +11003876# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003877BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003878AC_ARG_WITH(bsd-auth,
3879 [ --with-bsd-auth Enable BSD auth support],
3880 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003881 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003882 AC_DEFINE(BSD_AUTH, 1,
3883 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003884 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003885 fi
3886 ]
3887)
3888
Damien Millera22ba012000-03-02 23:09:20 +11003889# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003890piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003891# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003892if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003893 piddir=`eval echo ${sysconfdir}`
3894 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003895 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003896 esac
3897fi
3898
Tim Rice88f2ab52002-03-17 12:17:34 -08003899AC_ARG_WITH(pid-dir,
3900 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3901 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003902 if test -n "$withval" && test "x$withval" != "xno" && \
3903 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003904 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003905 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003906 AC_MSG_WARN([** no $piddir directory on this system **])
3907 fi
3908 fi
3909 ]
3910)
3911
Tim Rice7df8d392005-09-19 09:33:39 -07003912AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003913AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003914
andre2ff7b5d2000-06-03 14:57:40 +00003915dnl allow user to disable some login recording features
3916AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003917 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003918 [
3919 if test "x$enableval" = "xno" ; then
3920 AC_DEFINE(DISABLE_LASTLOG)
3921 fi
3922 ]
andre2ff7b5d2000-06-03 14:57:40 +00003923)
3924AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003925 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003926 [
3927 if test "x$enableval" = "xno" ; then
3928 AC_DEFINE(DISABLE_UTMP)
3929 fi
3930 ]
andre2ff7b5d2000-06-03 14:57:40 +00003931)
3932AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003933 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003934 [
3935 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003936 AC_DEFINE(DISABLE_UTMPX, 1,
3937 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003938 fi
3939 ]
andre2ff7b5d2000-06-03 14:57:40 +00003940)
3941AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003942 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003943 [
3944 if test "x$enableval" = "xno" ; then
3945 AC_DEFINE(DISABLE_WTMP)
3946 fi
3947 ]
andre2ff7b5d2000-06-03 14:57:40 +00003948)
3949AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003950 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003951 [
3952 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003953 AC_DEFINE(DISABLE_WTMPX, 1,
3954 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003955 fi
3956 ]
andre2ff7b5d2000-06-03 14:57:40 +00003957)
3958AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003959 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003960 [
3961 if test "x$enableval" = "xno" ; then
3962 AC_DEFINE(DISABLE_LOGIN)
3963 fi
3964 ]
andre2ff7b5d2000-06-03 14:57:40 +00003965)
3966AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003967 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003968 [
3969 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003970 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3971 [Define if you don't want to use pututline()
3972 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003973 fi
3974 ]
andre2ff7b5d2000-06-03 14:57:40 +00003975)
3976AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003977 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003978 [
3979 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003980 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3981 [Define if you don't want to use pututxline()
3982 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003983 fi
3984 ]
andre2ff7b5d2000-06-03 14:57:40 +00003985)
3986AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003987 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003988 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003989 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003990 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003991 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003992 conf_lastlog_location=$withval
3993 fi
3994 ]
3995)
andre2ff7b5d2000-06-03 14:57:40 +00003996
3997dnl lastlog, [uw]tmpx? detection
3998dnl NOTE: set the paths in the platform section to avoid the
3999dnl need for command-line parameters
4000dnl lastlog and [uw]tmp are subject to a file search if all else fails
4001
4002dnl lastlog detection
4003dnl NOTE: the code itself will detect if lastlog is a directory
4004AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4005AC_TRY_COMPILE([
4006#include <sys/types.h>
4007#include <utmp.h>
4008#ifdef HAVE_LASTLOG_H
4009# include <lastlog.h>
4010#endif
Damien Miller2994e082000-06-04 15:51:47 +10004011#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004012# include <paths.h>
4013#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00004014#ifdef HAVE_LOGIN_H
4015# include <login.h>
4016#endif
andre2ff7b5d2000-06-03 14:57:40 +00004017 ],
4018 [ char *lastlog = LASTLOG_FILE; ],
4019 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10004020 [
4021 AC_MSG_RESULT(no)
4022 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4023 AC_TRY_COMPILE([
4024#include <sys/types.h>
4025#include <utmp.h>
4026#ifdef HAVE_LASTLOG_H
4027# include <lastlog.h>
4028#endif
4029#ifdef HAVE_PATHS_H
4030# include <paths.h>
4031#endif
4032 ],
4033 [ char *lastlog = _PATH_LASTLOG; ],
4034 [ AC_MSG_RESULT(yes) ],
4035 [
andree441aa32000-06-12 22:34:38 +00004036 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10004037 system_lastlog_path=no
4038 ])
4039 ]
andre2ff7b5d2000-06-03 14:57:40 +00004040)
Damien Miller2994e082000-06-04 15:51:47 +10004041
andre2ff7b5d2000-06-03 14:57:40 +00004042if test -z "$conf_lastlog_location"; then
4043 if test x"$system_lastlog_path" = x"no" ; then
4044 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10004045 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00004046 conf_lastlog_location=$f
4047 fi
4048 done
4049 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00004050 AC_MSG_WARN([** Cannot find lastlog **])
4051 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00004052 fi
4053 fi
4054fi
4055
4056if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07004057 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4058 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004059fi
andre2ff7b5d2000-06-03 14:57:40 +00004060
4061dnl utmp detection
4062AC_MSG_CHECKING([if your system defines UTMP_FILE])
4063AC_TRY_COMPILE([
4064#include <sys/types.h>
4065#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004066#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004067# include <paths.h>
4068#endif
4069 ],
4070 [ char *utmp = UTMP_FILE; ],
4071 [ AC_MSG_RESULT(yes) ],
4072 [ AC_MSG_RESULT(no)
4073 system_utmp_path=no ]
4074)
4075if test -z "$conf_utmp_location"; then
4076 if test x"$system_utmp_path" = x"no" ; then
4077 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4078 if test -f $f ; then
4079 conf_utmp_location=$f
4080 fi
4081 done
4082 if test -z "$conf_utmp_location"; then
4083 AC_DEFINE(DISABLE_UTMP)
4084 fi
4085 fi
4086fi
4087if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07004088 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4089 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004090fi
andre2ff7b5d2000-06-03 14:57:40 +00004091
4092dnl wtmp detection
4093AC_MSG_CHECKING([if your system defines WTMP_FILE])
4094AC_TRY_COMPILE([
4095#include <sys/types.h>
4096#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10004097#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004098# include <paths.h>
4099#endif
4100 ],
4101 [ char *wtmp = WTMP_FILE; ],
4102 [ AC_MSG_RESULT(yes) ],
4103 [ AC_MSG_RESULT(no)
4104 system_wtmp_path=no ]
4105)
4106if test -z "$conf_wtmp_location"; then
4107 if test x"$system_wtmp_path" = x"no" ; then
4108 for f in /usr/adm/wtmp /var/log/wtmp; do
4109 if test -f $f ; then
4110 conf_wtmp_location=$f
4111 fi
4112 done
4113 if test -z "$conf_wtmp_location"; then
4114 AC_DEFINE(DISABLE_WTMP)
4115 fi
4116 fi
4117fi
4118if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07004119 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4120 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004121fi
andre2ff7b5d2000-06-03 14:57:40 +00004122
4123
4124dnl utmpx detection - I don't know any system so perverse as to require
4125dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4126dnl there, though.
4127AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4128AC_TRY_COMPILE([
4129#include <sys/types.h>
4130#include <utmp.h>
4131#ifdef HAVE_UTMPX_H
4132#include <utmpx.h>
4133#endif
Damien Miller2994e082000-06-04 15:51:47 +10004134#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004135# include <paths.h>
4136#endif
4137 ],
4138 [ char *utmpx = UTMPX_FILE; ],
4139 [ AC_MSG_RESULT(yes) ],
4140 [ AC_MSG_RESULT(no)
4141 system_utmpx_path=no ]
4142)
4143if test -z "$conf_utmpx_location"; then
4144 if test x"$system_utmpx_path" = x"no" ; then
4145 AC_DEFINE(DISABLE_UTMPX)
4146 fi
4147else
Tim Rice7df8d392005-09-19 09:33:39 -07004148 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4149 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004150fi
andre2ff7b5d2000-06-03 14:57:40 +00004151
4152dnl wtmpx detection
4153AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4154AC_TRY_COMPILE([
4155#include <sys/types.h>
4156#include <utmp.h>
4157#ifdef HAVE_UTMPX_H
4158#include <utmpx.h>
4159#endif
Damien Miller2994e082000-06-04 15:51:47 +10004160#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004161# include <paths.h>
4162#endif
4163 ],
4164 [ char *wtmpx = WTMPX_FILE; ],
4165 [ AC_MSG_RESULT(yes) ],
4166 [ AC_MSG_RESULT(no)
4167 system_wtmpx_path=no ]
4168)
4169if test -z "$conf_wtmpx_location"; then
4170 if test x"$system_wtmpx_path" = x"no" ; then
4171 AC_DEFINE(DISABLE_WTMPX)
4172 fi
4173else
Tim Rice7df8d392005-09-19 09:33:39 -07004174 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4175 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004176fi
andre2ff7b5d2000-06-03 14:57:40 +00004177
Damien Miller4018c192000-04-30 09:30:44 +10004178
Damien Miller29ea30d2000-03-17 10:54:15 +11004179if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004180 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4181 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004182fi
4183
Darren Tucker7da23cb2005-08-03 00:20:15 +10004184dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4185dnl Add now.
4186CFLAGS="$CFLAGS $werror_flags"
4187
Darren Tucker5d376902008-06-11 04:15:05 +10004188if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
4189 test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4190 AC_SUBST(TEST_SSH_IPV6, no)
4191else
4192 AC_SUBST(TEST_SSH_IPV6, yes)
4193fi
4194
Damien Millerbac2d8a2000-09-05 16:13:06 +11004195AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004196AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4197 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4198 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004199AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004200
Damien Miller7b22d652000-06-18 14:07:04 +10004201# Print summary of options
4202
Damien Miller7b22d652000-06-18 14:07:04 +10004203# Someone please show me a better way :)
4204A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4205B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4206C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4207D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004208E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004209F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004210G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004211H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4212I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4213J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004214
4215echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004216echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004217echo " User binaries: $B"
4218echo " System binaries: $C"
4219echo " Configuration files: $D"
4220echo " Askpass program: $E"
4221echo " Manual pages: $F"
4222echo " PID file: $G"
4223echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004224if test "x$external_path_file" = "x/etc/login.conf" ; then
4225echo " At runtime, sshd will use the path defined in $external_path_file"
4226echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004227else
Damien Millerf58c6722002-05-13 13:15:42 +10004228echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004229 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004230echo " (If PATH is set in $external_path_file it will be used instead. If"
4231echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4232 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004233fi
Damien Millera18bbd32002-05-13 10:48:57 +10004234if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004235echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004236fi
Damien Millerf58c6722002-05-13 13:15:42 +10004237echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004238echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004239echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004240echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004241echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004242echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004243echo " S/KEY support: $SKEY_MSG"
4244echo " TCP Wrappers support: $TCPW_MSG"
4245echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004246echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004247echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004248echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004249echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4250echo " BSD Auth support: $BSD_AUTH_MSG"
4251echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004252if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004253echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004254fi
4255
Damien Miller7b22d652000-06-18 14:07:04 +10004256echo ""
4257
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004258echo " Host: ${host}"
4259echo " Compiler: ${CC}"
4260echo " Compiler flags: ${CFLAGS}"
4261echo "Preprocessor flags: ${CPPFLAGS}"
4262echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004263echo " Libraries: ${LIBS}"
4264if test ! -z "${SSHDLIBS}"; then
4265echo " +for sshd: ${SSHDLIBS}"
4266fi
Damien Miller7b22d652000-06-18 14:07:04 +10004267
4268echo ""
4269
Tim Rice6f1f7582004-05-30 21:38:51 -07004270if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004271 echo "SVR4 style packages are supported with \"make package\""
4272 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004273fi
4274
Damien Miller82cf0ce2000-12-20 13:34:48 +11004275if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004276 echo "PAM is enabled. You may need to install a PAM control file "
4277 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004278 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004279 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004280 echo ""
4281fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004282
Damien Miller6c21c512002-01-22 21:57:53 +11004283if test ! -z "$RAND_HELPER_CMDHASH" ; then
4284 echo "WARNING: you are using the builtin random number collection "
4285 echo "service. Please read WARNING.RNG and request that your OS "
4286 echo "vendor includes kernel-based random number collection in "
4287 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004288 echo ""
4289fi
Damien Miller60396b02001-02-18 17:01:00 +11004290
Damien Millerb4097182004-05-23 14:09:40 +10004291if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004292 echo "WARNING: the operating system that you are using does not"
4293 echo "appear to support getpeereid(), getpeerucred() or the"
4294 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4295 echo "enforce security checks to prevent unauthorised connections to"
4296 echo "ssh-agent. Their absence increases the risk that a malicious"
4297 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004298 echo ""
4299fi
4300
Darren Tuckerd9f88912005-02-20 21:01:48 +11004301if test "$AUDIT_MODULE" = "bsm" ; then
4302 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4303 echo "See the Solaris section in README.platform for details."
4304fi