]> andersk Git - gssapi-openssh.git/blame - openssh/configure.ac
Oops, missed a conflict line.
[gssapi-openssh.git] / openssh / configure.ac
CommitLineData
3c0ef626 1# $Id$
2a304a95 2#
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.
3c0ef626 16
34fee935 17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
e00da40d 18AC_REVISION($Revision$)
3c0ef626 19AC_CONFIG_SRCDIR([ssh.c])
20
21AC_CONFIG_HEADER(config.h)
6f25cbdd 22
3c0ef626 23AC_PROG_CC
24AC_CANONICAL_HOST
25AC_C_BIGENDIAN
26
27# Checks for programs.
70791e56 28AC_PROG_AWK
3c0ef626 29AC_PROG_CPP
30AC_PROG_RANLIB
31AC_PROG_INSTALL
e00da40d 32AC_PROG_EGREP
3c0ef626 33AC_PATH_PROG(AR, ar)
1b56ff3d 34AC_PATH_PROG(CAT, cat)
35AC_PATH_PROG(KILL, kill)
3c0ef626 36AC_PATH_PROGS(PERL, perl5 perl)
1c14df9e 37AC_PATH_PROG(SED, sed)
3c0ef626 38AC_SUBST(PERL)
39AC_PATH_PROG(ENT, ent)
40AC_SUBST(ENT)
3c0ef626 41AC_PATH_PROG(TEST_MINUS_S_SH, bash)
42AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
43AC_PATH_PROG(TEST_MINUS_S_SH, sh)
2980ea68 44AC_PATH_PROG(SH, sh)
1b56ff3d 45AC_SUBST(TEST_SHELL,sh)
46
47dnl for buildpkg.sh
48AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
49 [/usr/sbin${PATH_SEPARATOR}/etc])
50AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
51 [/usr/sbin${PATH_SEPARATOR}/etc])
52AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
e00da40d 53if test -x /sbin/sh; then
54 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
55else
56 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
57fi
3c0ef626 58
59# System features
60AC_SYS_LARGEFILE
61
62if test -z "$AR" ; then
63 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
64fi
65
66# Use LOGIN_PROGRAM from environment if possible
67if test ! -z "$LOGIN_PROGRAM" ; then
e00da40d 68 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
69 [If your header files don't define LOGIN_PROGRAM,
70 then use this (detected) from environment and PATH])
3c0ef626 71else
72 # Search for login
73 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
74 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
75 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
76 fi
77fi
78
416fd2a8 79AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
80if test ! -z "$PATH_PASSWD_PROG" ; then
e00da40d 81 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
82 [Full path of your "passwd" program])
416fd2a8 83fi
84
3c0ef626 85if test -z "$LD" ; then
86 LD=$CC
87fi
88AC_SUBST(LD)
34fee935 89
3c0ef626 90AC_C_INLINE
34fee935 91
92AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
93
bd5d5d2a 94use_stack_protector=1
95AC_ARG_WITH(stackprotect,
96 [ --without-stackprotect Don't use compiler's stack protection], [
97 if test "x$withval" = "xno"; then
98 use_stack_protector=0
99 fi ])
100
416fd2a8 101if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
fec930e5 102 CFLAGS="$CFLAGS -Wall -Wpointer-arith"
e00da40d 103 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
34fee935 104 case $GCC_VER in
25d429a2 105 1.*) no_attrib_nonnull=1 ;;
106 2.8* | 2.9*)
107 CFLAGS="$CFLAGS -Wsign-compare"
108 no_attrib_nonnull=1
109 ;;
110 2.*) no_attrib_nonnull=1 ;;
6f25cbdd 111 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
112 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security" ;;
e00da40d 113 *) ;;
34fee935 114 esac
115
6f25cbdd 116 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
117 saved_CFLAGS="$CFLAGS"
118 CFLAGS="$CFLAGS -fno-builtin-memset"
119 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
120#include <string.h>
121int main(void){char b[10]; memset(b, 0, sizeof(b));}
122 ]])],
123 [ AC_MSG_RESULT(yes) ],
124 [ AC_MSG_RESULT(no)
125 CFLAGS="$saved_CFLAGS" ]
126)
127
bd5d5d2a 128 # -fstack-protector-all doesn't always work for some GCC versions
129 # and/or platforms, so we test if we can. If it's not supported
130 # on a give platform gcc will emit a warning so we use -Werror.
131 if test "x$use_stack_protector" = "x1"; then
132 for t in -fstack-protector-all -fstack-protector; do
133 AC_MSG_CHECKING(if $CC supports $t)
134 saved_CFLAGS="$CFLAGS"
135 saved_LDFLAGS="$LDFLAGS"
136 CFLAGS="$CFLAGS $t -Werror"
137 LDFLAGS="$LDFLAGS $t -Werror"
138 AC_LINK_IFELSE(
139 [AC_LANG_SOURCE([
140#include <stdlib.h>
141int main(void){return 0;}
142 ])],
143 [ AC_MSG_RESULT(yes)
144 CFLAGS="$saved_CFLAGS $t"
145 LDFLAGS="$saved_LDFLAGS $t"
146 AC_MSG_CHECKING(if $t works)
147 AC_RUN_IFELSE(
148 [AC_LANG_SOURCE([
149#include <stdlib.h>
150int main(void){exit(0);}
151 ])],
152 [ AC_MSG_RESULT(yes)
153 break ],
154 [ AC_MSG_RESULT(no) ],
155 [ AC_MSG_WARN([cross compiling: cannot test])
156 break ]
157 )
158 ],
159 [ AC_MSG_RESULT(no) ]
160 )
161 CFLAGS="$saved_CFLAGS"
162 LDFLAGS="$saved_LDFLAGS"
163 done
164 fi
165
34fee935 166 if test -z "$have_llong_max"; then
167 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
168 unset ac_cv_have_decl_LLONG_MAX
169 saved_CFLAGS="$CFLAGS"
170 CFLAGS="$CFLAGS -std=gnu99"
171 AC_CHECK_DECL(LLONG_MAX,
172 [have_llong_max=1],
173 [CFLAGS="$saved_CFLAGS"],
174 [#include <limits.h>]
175 )
176 fi
177fi
178
25d429a2 179if test "x$no_attrib_nonnull" != "x1" ; then
180 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
181fi
182
416fd2a8 183AC_ARG_WITH(rpath,
184 [ --without-rpath Disable auto-added -R linker paths],
185 [
34fee935 186 if test "x$withval" = "xno" ; then
416fd2a8 187 need_dash_r=""
188 fi
189 if test "x$withval" = "xyes" ; then
190 need_dash_r=1
191 fi
192 ]
193)
194
2e437378 195# Allow user to specify flags
196AC_ARG_WITH(cflags,
197 [ --with-cflags Specify additional flags to pass to compiler],
198 [
199 if test -n "$withval" && test "x$withval" != "xno" && \
200 test "x${withval}" != "xyes"; then
201 CFLAGS="$CFLAGS $withval"
202 fi
203 ]
204)
205AC_ARG_WITH(cppflags,
206 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
207 [
208 if test -n "$withval" && test "x$withval" != "xno" && \
209 test "x${withval}" != "xyes"; then
210 CPPFLAGS="$CPPFLAGS $withval"
211 fi
212 ]
213)
214AC_ARG_WITH(ldflags,
215 [ --with-ldflags Specify additional flags to pass to linker],
216 [
217 if test -n "$withval" && test "x$withval" != "xno" && \
218 test "x${withval}" != "xyes"; then
219 LDFLAGS="$LDFLAGS $withval"
220 fi
221 ]
222)
223AC_ARG_WITH(libs,
224 [ --with-libs Specify additional libraries to link with],
225 [
226 if test -n "$withval" && test "x$withval" != "xno" && \
227 test "x${withval}" != "xyes"; then
228 LIBS="$LIBS $withval"
229 fi
230 ]
231)
232AC_ARG_WITH(Werror,
233 [ --with-Werror Build main code with -Werror],
234 [
235 if test -n "$withval" && test "x$withval" != "xno"; then
236 werror_flags="-Werror"
237 if test "x${withval}" != "xyes"; then
238 werror_flags="$withval"
239 fi
240 fi
241 ]
242)
243
244AC_CHECK_HEADERS( \
245 bstring.h \
246 crypt.h \
247 crypto/sha2.h \
248 dirent.h \
249 endian.h \
250 features.h \
251 fcntl.h \
252 floatingpoint.h \
253 getopt.h \
254 glob.h \
255 ia.h \
256 iaf.h \
257 limits.h \
258 login.h \
259 maillock.h \
260 ndir.h \
261 net/if_tun.h \
262 netdb.h \
263 netgroup.h \
264 pam/pam_appl.h \
265 paths.h \
25d429a2 266 poll.h \
2e437378 267 pty.h \
268 readpassphrase.h \
269 rpc/types.h \
270 security/pam_appl.h \
271 sha2.h \
272 shadow.h \
273 stddef.h \
274 stdint.h \
275 string.h \
276 strings.h \
277 sys/audit.h \
278 sys/bitypes.h \
279 sys/bsdtty.h \
280 sys/cdefs.h \
281 sys/dir.h \
282 sys/mman.h \
6f25cbdd 283 sys/mount.h \
2e437378 284 sys/ndir.h \
bd5d5d2a 285 sys/poll.h \
2e437378 286 sys/prctl.h \
287 sys/pstat.h \
288 sys/select.h \
289 sys/stat.h \
290 sys/stream.h \
291 sys/stropts.h \
292 sys/strtio.h \
6f25cbdd 293 sys/statvfs.h \
2e437378 294 sys/sysmacros.h \
295 sys/time.h \
296 sys/timers.h \
297 sys/un.h \
298 time.h \
299 tmpdir.h \
300 ttyent.h \
25d429a2 301 ucred.h \
2e437378 302 unistd.h \
303 usersec.h \
304 util.h \
305 utime.h \
306 utmp.h \
307 utmpx.h \
308 vis.h \
309)
310
311# lastlog.h requires sys/time.h to be included first on Solaris
312AC_CHECK_HEADERS(lastlog.h, [], [], [
313#ifdef HAVE_SYS_TIME_H
314# include <sys/time.h>
315#endif
316])
317
318# sys/ptms.h requires sys/stream.h to be included first on Solaris
319AC_CHECK_HEADERS(sys/ptms.h, [], [], [
320#ifdef HAVE_SYS_STREAM_H
321# include <sys/stream.h>
322#endif
323])
324
325# login_cap.h requires sys/types.h on NetBSD
326AC_CHECK_HEADERS(login_cap.h, [], [], [
327#include <sys/types.h>
328])
329
330# Messages for features tested for in target-specific section
331SIA_MSG="no"
332SPC_MSG="no"
333
3c0ef626 334# Check for some target-specific stuff
335case "$host" in
336*-*-aix*)
2e437378 337 # Some versions of VAC won't allow macro redefinitions at
338 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
339 # particularly with older versions of vac or xlc.
340 # It also throws errors about null macro argments, but these are
341 # not fatal.
342 AC_MSG_CHECKING(if compiler allows macro redefinitions)
343 AC_COMPILE_IFELSE(
344 [AC_LANG_SOURCE([[
345#define testmacro foo
346#define testmacro bar
347int main(void) { exit(0); }
348 ]])],
349 [ AC_MSG_RESULT(yes) ],
350 [ AC_MSG_RESULT(no)
351 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
352 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
353 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
354 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
355 ]
356 )
357
416fd2a8 358 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
8bb69cbe 359 if (test -z "$blibpath"); then
416fd2a8 360 blibpath="/usr/lib:/lib"
3c0ef626 361 fi
8bb69cbe 362 saved_LDFLAGS="$LDFLAGS"
2e437378 363 if test "$GCC" = "yes"; then
364 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
365 else
366 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
367 fi
368 for tryflags in $flags ;do
8bb69cbe 369 if (test -z "$blibflags"); then
370 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
371 AC_TRY_LINK([], [], [blibflags=$tryflags])
372 fi
373 done
374 if (test -z "$blibflags"); then
375 AC_MSG_RESULT(not found)
376 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
377 else
378 AC_MSG_RESULT($blibflags)
379 fi
380 LDFLAGS="$saved_LDFLAGS"
70791e56 381 dnl Check for authenticate. Might be in libs.a on older AIXes
e00da40d 382 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
383 [Define if you want to enable AIX4's authenticate function])],
e54b3d7c 384 [AC_CHECK_LIB(s,authenticate,
385 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
386 LIBS="$LIBS -ls"
387 ])
388 ])
34fee935 389 dnl Check for various auth function declarations in headers.
390 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
391 passwdexpired, setauthdb], , , [#include <usersec.h>])
70791e56 392 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
34fee935 393 AC_CHECK_DECLS(loginfailed,
70791e56 394 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
395 AC_TRY_COMPILE(
396 [#include <usersec.h>],
397 [(void)loginfailed("user","host","tty",0);],
398 [AC_MSG_RESULT(yes)
e00da40d 399 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
400 [Define if your AIX loginfailed() function
401 takes 4 arguments (AIX >= 5.2)])],
70791e56 402 [AC_MSG_RESULT(no)]
403 )],
404 [],
405 [#include <usersec.h>]
406 )
bd5d5d2a 407 AC_CHECK_FUNCS(getgrset setauthdb)
2e437378 408 AC_CHECK_DECL(F_CLOSEM,
409 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
410 [],
411 [ #include <limits.h>
412 #include <fcntl.h> ]
413 )
34fee935 414 check_for_aix_broken_getaddrinfo=1
e00da40d 415 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
416 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
417 [Define if your platform breaks doing a seteuid before a setuid])
418 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
419 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
3c0ef626 420 dnl AIX handles lastlog as part of its login message
e00da40d 421 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
422 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
423 [Some systems need a utmpx entry for /bin/login to work])
424 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
425 [Define to a Set Process Title type if your system is
426 supported by bsd-setproctitle.c])
427 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
428 [AIX 5.2 and 5.3 (and presumably newer) require this])
2e437378 429 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
3c0ef626 430 ;;
431*-*-cygwin*)
1c14df9e 432 check_for_libcrypt_later=1
2278ffa1 433 LIBS="$LIBS /usr/lib/textreadmode.o"
e00da40d 434 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
435 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
436 AC_DEFINE(DISABLE_SHADOW, 1,
437 [Define if you want to disable shadow passwords])
438 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
439 [Define if your system choked on IP TOS setting])
440 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
441 [Define if X11 doesn't support AF_UNIX sockets on that system])
442 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
443 [Define if the concept of ports only accessible to
444 superusers isn't known])
445 AC_DEFINE(DISABLE_FD_PASSING, 1,
446 [Define if your platform needs to skip post auth
447 file descriptor passing])
3c0ef626 448 ;;
449*-*-dgux*)
450 AC_DEFINE(IP_TOS_IS_BROKEN)
416fd2a8 451 AC_DEFINE(SETEUID_BREAKS_SETUID)
452 AC_DEFINE(BROKEN_SETREUID)
453 AC_DEFINE(BROKEN_SETREGID)
3c0ef626 454 ;;
455*-*-darwin*)
2278ffa1 456 AC_DEFINE(BROKEN_GETADDRINFO, 1, [Define if getaddrinfo is broken)])
457 AC_DEFINE(BROKEN_GETADDRINFO)
70791e56 458 AC_DEFINE(SETEUID_BREAKS_SETUID)
459 AC_DEFINE(BROKEN_SETREUID)
460 AC_DEFINE(BROKEN_SETREGID)
bd5d5d2a 461 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
e00da40d 462 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
463 [Define if your resolver libs need this for getrrsetbyname])
2e437378 464 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
465 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
466 [Use tunnel device compatibility to OpenBSD])
467 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
468 [Prepend the address family to IP tunnel traffic])
bd5d5d2a 469 m4_pattern_allow(AU_IPv)
470 AC_CHECK_DECL(AU_IPv4, [],
471 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
472 [#include <bsm/audit.h>]
473 )
2e437378 474 AC_MSG_CHECKING(if we have the Security Authorization Session API)
475 AC_TRY_COMPILE([#include <Security/AuthSession.h>],
476 [SessionCreate(0, 0);],
477 [ac_cv_use_security_session_api="yes"
478 AC_DEFINE(USE_SECURITY_SESSION_API, 1,
e00da40d 479 [platform has the Security Authorization Session API])
2e437378 480 LIBS="$LIBS -framework Security"
481 AC_MSG_RESULT(yes)],
482 [ac_cv_use_security_session_api="no"
483 AC_MSG_RESULT(no)])
484 AC_MSG_CHECKING(if we have an in-memory credentials cache)
485 AC_TRY_COMPILE(
486 [#include <Kerberos/Kerberos.h>],
487 [cc_context_t c;
488 (void) cc_initialize (&c, 0, NULL, NULL);],
489 [AC_DEFINE(USE_CCAPI, 1,
e00da40d 490 [platform uses an in-memory credentials cache])
2e437378 491 LIBS="$LIBS -framework Security"
492 AC_MSG_RESULT(yes)
493 if test "x$ac_cv_use_security_session_api" = "xno"; then
494 AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***)
495 fi],
496 [AC_MSG_RESULT(no)]
497 )
bd5d5d2a 498 ;;
2e437378 499*-*-dragonfly*)
500 SSHDLIBS="$SSHDLIBS -lcrypt"
3c0ef626 501 ;;
34fee935 502*-*-hpux*)
503 # first we define all of the options common to all HP-UX releases
3c0ef626 504 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
505 IPADDR_IN_DISPLAY=yes
3c0ef626 506 AC_DEFINE(USE_PIPES)
e00da40d 507 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
508 [Define if your login program cannot handle end of options ("--")])
2980ea68 509 AC_DEFINE(LOGIN_NEEDS_UTMPX)
e00da40d 510 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
511 [String used in /etc/passwd to denote locked account])
70791e56 512 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
e00da40d 513 MAIL="/var/mail/username"
e54b3d7c 514 LIBS="$LIBS -lsec"
34fee935 515 AC_CHECK_LIB(xnet, t_error, ,
516 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
517
518 # next, we define all of the options specific to major releases
519 case "$host" in
520 *-*-hpux10*)
521 if test -z "$GCC"; then
522 CFLAGS="$CFLAGS -Ae"
523 fi
524 ;;
525 *-*-hpux11*)
e00da40d 526 AC_DEFINE(PAM_SUN_CODEBASE, 1,
527 [Define if you are using Solaris-derived PAM which
528 passes pam_messages to the conversation function
529 with an extra level of indirection])
530 AC_DEFINE(DISABLE_UTMP, 1,
531 [Define if you don't want to use utmp])
34fee935 532 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
533 check_for_hpux_broken_getaddrinfo=1
534 check_for_conflicting_getspnam=1
535 ;;
536 esac
537
538 # lastly, we define options specific to minor releases
539 case "$host" in
540 *-*-hpux10.26)
e00da40d 541 AC_DEFINE(HAVE_SECUREWARE, 1,
542 [Define if you have SecureWare-based
543 protected password database])
34fee935 544 disable_ptmx_check=yes
545 LIBS="$LIBS -lsecpw"
546 ;;
547 esac
3c0ef626 548 ;;
549*-*-irix5*)
3c0ef626 550 PATH="$PATH:/usr/etc"
e00da40d 551 AC_DEFINE(BROKEN_INET_NTOA, 1,
552 [Define if you system's inet_ntoa is busted
553 (e.g. Irix gcc issue)])
416fd2a8 554 AC_DEFINE(SETEUID_BREAKS_SETUID)
555 AC_DEFINE(BROKEN_SETREUID)
556 AC_DEFINE(BROKEN_SETREGID)
e00da40d 557 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
558 [Define if you shouldn't strip 'tty' from your
559 ttyname in [uw]tmp])
70791e56 560 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
3c0ef626 561 ;;
562*-*-irix6*)
3c0ef626 563 PATH="$PATH:/usr/etc"
e00da40d 564 AC_DEFINE(WITH_IRIX_ARRAY, 1,
565 [Define if you have/want arrays
566 (cluster-wide session managment, not C arrays)])
567 AC_DEFINE(WITH_IRIX_PROJECT, 1,
568 [Define if you want IRIX project management])
569 AC_DEFINE(WITH_IRIX_AUDIT, 1,
570 [Define if you want IRIX audit trails])
571 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
572 [Define if you want IRIX kernel jobs])])
3c0ef626 573 AC_DEFINE(BROKEN_INET_NTOA)
70791e56 574 AC_DEFINE(SETEUID_BREAKS_SETUID)
575 AC_DEFINE(BROKEN_SETREUID)
576 AC_DEFINE(BROKEN_SETREGID)
e00da40d 577 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
2980ea68 578 AC_DEFINE(WITH_ABBREV_NO_TTY)
70791e56 579 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
3c0ef626 580 ;;
581*-*-linux*)
582 no_dev_ptmx=1
583 check_for_libcrypt_later=1
70791e56 584 check_for_openpty_ctty_bug=1
e00da40d 585 AC_DEFINE(PAM_TTY_KLUDGE, 1,
586 [Work around problematic Linux PAM modules handling of PAM_TTY])
587 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
588 [String used in /etc/passwd to denote locked account])
70791e56 589 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
e00da40d 590 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
591 [Define to whatever link() returns for "not supported"
592 if it doesn't return EOPNOTSUPP.])
34fee935 593 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
e00da40d 594 AC_DEFINE(USE_BTMP)
3c0ef626 595 inet6_default_4in6=yes
70791e56 596 case `uname -r` in
597 1.*|2.0.*)
e00da40d 598 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
599 [Define if cmsg_type is not passed correctly])
70791e56 600 ;;
601 esac
e00da40d 602 # tun(4) forwarding compat code
603 AC_CHECK_HEADERS(linux/if_tun.h)
604 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
605 AC_DEFINE(SSH_TUN_LINUX, 1,
606 [Open tunnel devices the Linux tun/tap way])
607 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
608 [Use tunnel device compatibility to OpenBSD])
609 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
610 [Prepend the address family to IP tunnel traffic])
611 fi
3c0ef626 612 ;;
613mips-sony-bsd|mips-sony-newsos4)
e00da40d 614 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
3c0ef626 615 SONY=1
3c0ef626 616 ;;
617*-*-netbsd*)
e54b3d7c 618 check_for_libcrypt_before=1
34fee935 619 if test "x$withval" != "xno" ; then
416fd2a8 620 need_dash_r=1
621 fi
e00da40d 622 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
623 AC_CHECK_HEADER([net/if_tap.h], ,
624 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
625 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
626 [Prepend the address family to IP tunnel traffic])
3c0ef626 627 ;;
628*-*-freebsd*)
629 check_for_libcrypt_later=1
e00da40d 630 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
631 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
632 AC_CHECK_HEADER([net/if_tap.h], ,
633 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
bd5d5d2a 634 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
3c0ef626 635 ;;
70791e56 636*-*-bsdi*)
637 AC_DEFINE(SETEUID_BREAKS_SETUID)
638 AC_DEFINE(BROKEN_SETREUID)
639 AC_DEFINE(BROKEN_SETREGID)
640 ;;
3c0ef626 641*-next-*)
642 conf_lastlog_location="/usr/adm/lastlog"
643 conf_utmp_location=/etc/utmp
644 conf_wtmp_location=/usr/adm/wtmp
645 MAIL=/usr/spool/mail
e00da40d 646 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
3c0ef626 647 AC_DEFINE(BROKEN_REALPATH)
648 AC_DEFINE(USE_PIPES)
e00da40d 649 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
3c0ef626 650 ;;
34fee935 651*-*-openbsd*)
652 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
e00da40d 653 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
654 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
2e437378 655 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
656 [syslog_r function is safe to use in in a signal handler])
34fee935 657 ;;
3c0ef626 658*-*-solaris*)
34fee935 659 if test "x$withval" != "xno" ; then
2a304a95 660 need_dash_r=1
661 fi
3c0ef626 662 AC_DEFINE(PAM_SUN_CODEBASE)
663 AC_DEFINE(LOGIN_NEEDS_UTMPX)
e00da40d 664 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
665 [Some versions of /bin/login need the TERM supplied
666 on the commandline])
3c0ef626 667 AC_DEFINE(PAM_TTY_KLUDGE)
e00da40d 668 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
669 [Define if pam_chauthtok wants real uid set
670 to the unpriv'ed user])
70791e56 671 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
672 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
e00da40d 673 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
674 [Define if sshd somehow reacquires a controlling TTY
675 after setsid()])
2e437378 676 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
677 in case the name is longer than 8 chars])
70791e56 678 external_path_file=/etc/default/login
3c0ef626 679 # hardwire lastlog location (can't detect it on some versions)
680 conf_lastlog_location="/var/adm/lastlog"
681 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
682 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
683 if test "$sol2ver" -ge 8; then
684 AC_MSG_RESULT(yes)
685 AC_DEFINE(DISABLE_UTMP)
e00da40d 686 AC_DEFINE(DISABLE_WTMP, 1,
687 [Define if you don't want to use wtmp])
3c0ef626 688 else
689 AC_MSG_RESULT(no)
690 fi
2e437378 691 AC_ARG_WITH(solaris-contracts,
692 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
693 [
694 AC_CHECK_LIB(contract, ct_tmpl_activate,
695 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
696 [Define if you have Solaris process contracts])
697 SSHDLIBS="$SSHDLIBS -lcontract"
698 AC_SUBST(SSHDLIBS)
699 SPC_MSG="yes" ], )
700 ],
701 )
3c0ef626 702 ;;
703*-*-sunos4*)
704 CPPFLAGS="$CPPFLAGS -DSUNOS4"
705 AC_CHECK_FUNCS(getpwanam)
706 AC_DEFINE(PAM_SUN_CODEBASE)
3c0ef626 707 conf_utmp_location=/etc/utmp
708 conf_wtmp_location=/var/adm/wtmp
709 conf_lastlog_location=/var/adm/lastlog
710 AC_DEFINE(USE_PIPES)
711 ;;
712*-ncr-sysv*)
3c0ef626 713 LIBS="$LIBS -lc89"
e9a17296 714 AC_DEFINE(USE_PIPES)
70791e56 715 AC_DEFINE(SSHD_ACQUIRES_CTTY)
716 AC_DEFINE(SETEUID_BREAKS_SETUID)
717 AC_DEFINE(BROKEN_SETREUID)
718 AC_DEFINE(BROKEN_SETREGID)
3c0ef626 719 ;;
720*-sni-sysv*)
3c0ef626 721 # /usr/ucblib MUST NOT be searched on ReliantUNIX
416fd2a8 722 AC_CHECK_LIB(dl, dlsym, ,)
e00da40d 723 # -lresolv needs to be at the end of LIBS or DNS lookups break
724 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
3c0ef626 725 IPADDR_IN_DISPLAY=yes
726 AC_DEFINE(USE_PIPES)
727 AC_DEFINE(IP_TOS_IS_BROKEN)
416fd2a8 728 AC_DEFINE(SETEUID_BREAKS_SETUID)
729 AC_DEFINE(BROKEN_SETREUID)
730 AC_DEFINE(BROKEN_SETREGID)
70791e56 731 AC_DEFINE(SSHD_ACQUIRES_CTTY)
732 external_path_file=/etc/default/login
3c0ef626 733 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
734 # Attention: always take care to bind libsocket and libnsl before libc,
735 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
736 ;;
34fee935 737# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
3c0ef626 738*-*-sysv4.2*)
3c0ef626 739 AC_DEFINE(USE_PIPES)
70791e56 740 AC_DEFINE(SETEUID_BREAKS_SETUID)
741 AC_DEFINE(BROKEN_SETREUID)
742 AC_DEFINE(BROKEN_SETREGID)
34fee935 743 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
e00da40d 744 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
3c0ef626 745 ;;
34fee935 746# UnixWare 7.x, OpenUNIX 8
3c0ef626 747*-*-sysv5*)
34fee935 748 check_for_libcrypt_later=1
749 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
3c0ef626 750 AC_DEFINE(USE_PIPES)
70791e56 751 AC_DEFINE(SETEUID_BREAKS_SETUID)
752 AC_DEFINE(BROKEN_SETREUID)
753 AC_DEFINE(BROKEN_SETREGID)
e00da40d 754 AC_DEFINE(PASSWD_NEEDS_USERNAME)
34fee935 755 case "$host" in
756 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
757 TEST_SHELL=/u95/bin/sh
e00da40d 758 AC_DEFINE(BROKEN_LIBIAF, 1,
759 [ia_uinfo routines not supported by OS yet])
2e437378 760 AC_DEFINE(BROKEN_UPDWTMPX)
e00da40d 761 ;;
762 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
34fee935 763 ;;
764 esac
3c0ef626 765 ;;
766*-*-sysv*)
3c0ef626 767 ;;
34fee935 768# SCO UNIX and OEM versions of SCO UNIX
3c0ef626 769*-*-sco3.2v4*)
34fee935 770 AC_MSG_ERROR("This Platform is no longer supported.")
3c0ef626 771 ;;
34fee935 772# SCO OpenServer 5.x
3c0ef626 773*-*-sco3.2v5*)
1c14df9e 774 if test -z "$GCC"; then
775 CFLAGS="$CFLAGS -belf"
776 fi
3c0ef626 777 LIBS="$LIBS -lprot -lx -ltinfo -lm"
778 no_dev_ptmx=1
3c0ef626 779 AC_DEFINE(USE_PIPES)
2980ea68 780 AC_DEFINE(HAVE_SECUREWARE)
3c0ef626 781 AC_DEFINE(DISABLE_SHADOW)
e54b3d7c 782 AC_DEFINE(DISABLE_FD_PASSING)
70791e56 783 AC_DEFINE(SETEUID_BREAKS_SETUID)
784 AC_DEFINE(BROKEN_SETREUID)
785 AC_DEFINE(BROKEN_SETREGID)
786 AC_DEFINE(WITH_ABBREV_NO_TTY)
1b56ff3d 787 AC_DEFINE(BROKEN_UPDWTMPX)
e00da40d 788 AC_DEFINE(PASSWD_NEEDS_USERNAME)
3c0ef626 789 AC_CHECK_FUNCS(getluid setluid)
790 MANTYPE=man
1b56ff3d 791 TEST_SHELL=ksh
3c0ef626 792 ;;
e54b3d7c 793*-*-unicosmk*)
e00da40d 794 AC_DEFINE(NO_SSH_LASTLOG, 1,
795 [Define if you don't want to use lastlog in session.c])
416fd2a8 796 AC_DEFINE(SETEUID_BREAKS_SETUID)
797 AC_DEFINE(BROKEN_SETREUID)
798 AC_DEFINE(BROKEN_SETREGID)
e54b3d7c 799 AC_DEFINE(USE_PIPES)
800 AC_DEFINE(DISABLE_FD_PASSING)
801 LDFLAGS="$LDFLAGS"
802 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
803 MANTYPE=cat
804 ;;
70791e56 805*-*-unicosmp*)
416fd2a8 806 AC_DEFINE(SETEUID_BREAKS_SETUID)
807 AC_DEFINE(BROKEN_SETREUID)
808 AC_DEFINE(BROKEN_SETREGID)
70791e56 809 AC_DEFINE(WITH_ABBREV_NO_TTY)
810 AC_DEFINE(USE_PIPES)
811 AC_DEFINE(DISABLE_FD_PASSING)
812 LDFLAGS="$LDFLAGS"
416fd2a8 813 LIBS="$LIBS -lgen -lacid -ldb"
70791e56 814 MANTYPE=cat
815 ;;
3c0ef626 816*-*-unicos*)
416fd2a8 817 AC_DEFINE(SETEUID_BREAKS_SETUID)
818 AC_DEFINE(BROKEN_SETREUID)
819 AC_DEFINE(BROKEN_SETREGID)
3c0ef626 820 AC_DEFINE(USE_PIPES)
e54b3d7c 821 AC_DEFINE(DISABLE_FD_PASSING)
822 AC_DEFINE(NO_SSH_LASTLOG)
823 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
824 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
825 MANTYPE=cat
3c0ef626 826 ;;
827*-dec-osf*)
828 AC_MSG_CHECKING(for Digital Unix SIA)
829 no_osfsia=""
830 AC_ARG_WITH(osfsia,
831 [ --with-osfsia Enable Digital Unix SIA],
832 [
833 if test "x$withval" = "xno" ; then
834 AC_MSG_RESULT(disabled)
835 no_osfsia=1
836 fi
837 ],
838 )
839 if test -z "$no_osfsia" ; then
840 if test -f /etc/sia/matrix.conf; then
841 AC_MSG_RESULT(yes)
e00da40d 842 AC_DEFINE(HAVE_OSF_SIA, 1,
843 [Define if you have Digital Unix Security
844 Integration Architecture])
845 AC_DEFINE(DISABLE_LOGIN, 1,
846 [Define if you don't want to use your
847 system's login() call])
1c14df9e 848 AC_DEFINE(DISABLE_FD_PASSING)
3c0ef626 849 LIBS="$LIBS -lsecurity -ldb -lm -laud"
2e437378 850 SIA_MSG="yes"
3c0ef626 851 else
852 AC_MSG_RESULT(no)
e00da40d 853 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
854 [String used in /etc/passwd to denote locked account])
3c0ef626 855 fi
856 fi
70791e56 857 AC_DEFINE(BROKEN_GETADDRINFO)
858 AC_DEFINE(SETEUID_BREAKS_SETUID)
859 AC_DEFINE(BROKEN_SETREUID)
860 AC_DEFINE(BROKEN_SETREGID)
6f25cbdd 861 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
3c0ef626 862 ;;
863
e00da40d 864*-*-nto-qnx*)
3c0ef626 865 AC_DEFINE(USE_PIPES)
866 AC_DEFINE(NO_X11_UNIX_SOCKETS)
e00da40d 867 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
868 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
869 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
870 AC_DEFINE(DISABLE_LASTLOG)
2e437378 871 AC_DEFINE(SSHD_ACQUIRES_CTTY)
bd5d5d2a 872 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
2e437378 873 enable_etc_default_login=no # has incompatible /etc/default/login
25d429a2 874 case "$host" in
875 *-*-nto-qnx6*)
876 AC_DEFINE(DISABLE_FD_PASSING)
877 ;;
878 esac
3c0ef626 879 ;;
34fee935 880
881*-*-ultrix*)
e00da40d 882 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
883 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
884 AC_DEFINE(NEED_SETPGRP)
34fee935 885 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
886 ;;
887
888*-*-lynxos)
889 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
e00da40d 890 AC_DEFINE(MISSING_HOWMANY)
34fee935 891 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
892 ;;
3c0ef626 893esac
894
70791e56 895AC_MSG_CHECKING(compiler and flags for sanity)
34fee935 896AC_RUN_IFELSE(
897 [AC_LANG_SOURCE([
70791e56 898#include <stdio.h>
899int main(){exit(0);}
34fee935 900 ])],
70791e56 901 [ AC_MSG_RESULT(yes) ],
902 [
903 AC_MSG_RESULT(no)
904 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
34fee935 905 ],
906 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
907)
908
909dnl Checks for header files.
3c0ef626 910# Checks for libraries.
911AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
912AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
913
70791e56 914dnl IRIX and Solaris 2.5.1 have dirname() in libgen
915AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
916 AC_CHECK_LIB(gen, dirname,[
917 AC_CACHE_CHECK([for broken dirname],
918 ac_cv_have_broken_dirname, [
919 save_LIBS="$LIBS"
920 LIBS="$LIBS -lgen"
e00da40d 921 AC_RUN_IFELSE(
922 [AC_LANG_SOURCE([[
70791e56 923#include <libgen.h>
924#include <string.h>
925
926int main(int argc, char **argv) {
927 char *s, buf[32];
928
929 strncpy(buf,"/etc", 32);
930 s = dirname(buf);
931 if (!s || strncmp(s, "/", 32) != 0) {
932 exit(1);
933 } else {
934 exit(0);
935 }
936}
e00da40d 937 ]])],
938 [ ac_cv_have_broken_dirname="no" ],
939 [ ac_cv_have_broken_dirname="yes" ],
70791e56 940 [ ac_cv_have_broken_dirname="no" ],
70791e56 941 )
942 LIBS="$save_LIBS"
943 ])
944 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
945 LIBS="$LIBS -lgen"
946 AC_DEFINE(HAVE_DIRNAME)
947 AC_CHECK_HEADERS(libgen.h)
948 fi
949 ])
950])
951
3c0ef626 952AC_CHECK_FUNC(getspnam, ,
953 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
e00da40d 954AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
955 [Define if you have the basename function.]))
3c0ef626 956
957dnl zlib is required
958AC_ARG_WITH(zlib,
959 [ --with-zlib=PATH Use zlib in PATH],
34fee935 960 [ if test "x$withval" = "xno" ; then
961 AC_MSG_ERROR([*** zlib is required ***])
962 elif test "x$withval" != "xyes"; then
3c0ef626 963 if test -d "$withval/lib"; then
964 if test -n "${need_dash_r}"; then
965 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
966 else
967 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
968 fi
969 else
970 if test -n "${need_dash_r}"; then
971 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
972 else
973 LDFLAGS="-L${withval} ${LDFLAGS}"
974 fi
975 fi
976 if test -d "$withval/include"; then
977 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
978 else
979 CPPFLAGS="-I${withval} ${CPPFLAGS}"
980 fi
34fee935 981 fi ]
3c0ef626 982)
983
416fd2a8 984AC_CHECK_LIB(z, deflate, ,
985 [
986 saved_CPPFLAGS="$CPPFLAGS"
987 saved_LDFLAGS="$LDFLAGS"
988 save_LIBS="$LIBS"
989 dnl Check default zlib install dir
990 if test -n "${need_dash_r}"; then
991 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
992 else
993 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
994 fi
995 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
996 LIBS="$LIBS -lz"
997 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
998 [
999 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1000 ]
1001 )
1002 ]
1003)
1004AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
1005
1006AC_ARG_WITH(zlib-version-check,
1007 [ --without-zlib-version-check Disable zlib version check],
1008 [ if test "x$withval" = "xno" ; then
1009 zlib_check_nonfatal=1
1010 fi
1011 ]
1012)
1013
34fee935 1014AC_MSG_CHECKING(for possibly buggy zlib)
1015AC_RUN_IFELSE([AC_LANG_SOURCE([[
1016#include <stdio.h>
416fd2a8 1017#include <zlib.h>
1018int main()
1019{
34fee935 1020 int a=0, b=0, c=0, d=0, n, v;
1021 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1022 if (n != 3 && n != 4)
416fd2a8 1023 exit(1);
34fee935 1024 v = a*1000000 + b*10000 + c*100 + d;
1025 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1026
1027 /* 1.1.4 is OK */
1028 if (a == 1 && b == 1 && c >= 4)
416fd2a8 1029 exit(0);
34fee935 1030
1031 /* 1.2.3 and up are OK */
1032 if (v >= 1020300)
1033 exit(0);
1034
416fd2a8 1035 exit(2);
1036}
34fee935 1037 ]])],
1038 AC_MSG_RESULT(no),
1039 [ AC_MSG_RESULT(yes)
416fd2a8 1040 if test -z "$zlib_check_nonfatal" ; then
1041 AC_MSG_ERROR([*** zlib too old - check config.log ***
1042Your reported zlib version has known security problems. It's possible your
1043vendor has fixed these problems without changing the version number. If you
1044are sure this is the case, you can disable the check by running
1045"./configure --without-zlib-version-check".
34fee935 1046If you are in doubt, upgrade zlib to version 1.2.3 or greater.
1047See http://www.gzip.org/zlib/ for details.])
416fd2a8 1048 else
1049 AC_MSG_WARN([zlib version may have security problems])
1050 fi
34fee935 1051 ],
1052 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
416fd2a8 1053)
3c0ef626 1054
3c0ef626 1055dnl UnixWare 2.x
416fd2a8 1056AC_CHECK_FUNC(strcasecmp,
3c0ef626 1057 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1058)
e00da40d 1059AC_CHECK_FUNCS(utimes,
e54b3d7c 1060 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1061 LIBS="$LIBS -lc89"]) ]
3c0ef626 1062)
1063
1064dnl Checks for libutil functions
1065AC_CHECK_HEADERS(libutil.h)
e00da40d 1066AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1067 [Define if your libraries define login()])])
6f25cbdd 1068AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
3c0ef626 1069
1070AC_FUNC_STRFTIME
1071
3c0ef626 1072# Check for ALTDIRFUNC glob() extension
1073AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1074AC_EGREP_CPP(FOUNDIT,
1075 [
1076 #include <glob.h>
1077 #ifdef GLOB_ALTDIRFUNC
1078 FOUNDIT
1079 #endif
416fd2a8 1080 ],
3c0ef626 1081 [
e00da40d 1082 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1083 [Define if your system glob() function has
1084 the GLOB_ALTDIRFUNC extension])
3c0ef626 1085 AC_MSG_RESULT(yes)
1086 ],
1087 [
1088 AC_MSG_RESULT(no)
1089 ]
1090)
1091
1092# Check for g.gl_matchc glob() extension
1093AC_MSG_CHECKING(for gl_matchc field in glob_t)
2e437378 1094AC_TRY_COMPILE(
1095 [ #include <glob.h> ],
1096 [glob_t g; g.gl_matchc = 1;],
416fd2a8 1097 [
e00da40d 1098 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1099 [Define if your system glob() function has
1100 gl_matchc options in glob_t])
416fd2a8 1101 AC_MSG_RESULT(yes)
1102 ],
1103 [
1104 AC_MSG_RESULT(no)
1105 ]
3c0ef626 1106)
1107
2e437378 1108AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1109
3c0ef626 1110AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
34fee935 1111AC_RUN_IFELSE(
1112 [AC_LANG_SOURCE([[
3c0ef626 1113#include <sys/types.h>
1114#include <dirent.h>
e54b3d7c 1115int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
34fee935 1116 ]])],
416fd2a8 1117 [AC_MSG_RESULT(yes)],
3c0ef626 1118 [
1119 AC_MSG_RESULT(no)
e00da40d 1120 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1121 [Define if your struct dirent expects you to
1122 allocate extra space for d_name])
34fee935 1123 ],
1124 [
1125 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1126 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
3c0ef626 1127 ]
1128)
1129
c2397a66 1130# Check whether the user wants GSSAPI mechglue support
1131AC_ARG_WITH(mechglue,
1132 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
1133 [
1134 AC_MSG_CHECKING(for mechglue library)
1135
1136 if test -e ${withval}/libgssapi.a ; then
1137 mechglue_lib=${withval}/libgssapi.a
1138 elif test -e ${withval}/lib/libgssapi.a ; then
1139 mechglue_lib=${withval}/lib/libgssapi.a
1140 else
1141 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
1142 fi
1143 LIBS="$LIBS ${mechglue_lib}"
1144 AC_MSG_RESULT(${mechglue_lib})
1145
c2397a66 1146 AC_CHECK_LIB(dl, dlopen, , )
1147 if test $ac_cv_lib_dl_dlopen = yes; then
1148 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
1149 fi
1150
1151 AC_DEFINE(GSSAPI)
e00da40d 1152 AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.])
c2397a66 1153 GSSAPI="mechglue"
1154
1155 ]
1156)
1157
1158
d905e828 1159# Check whether the user wants GSI (Globus) support
1160gsi_path="no"
1161AC_ARG_WITH(gsi,
70791e56 1162 [ --with-gsi Enable Globus GSI authentication support],
d905e828 1163 [
1164 gsi_path="$withval"
1165 ]
1166)
1167
1168AC_ARG_WITH(globus,
70791e56 1169 [ --with-globus Enable Globus GSI authentication support],
d905e828 1170 [
1171 gsi_path="$withval"
1172 ]
1173)
1174
70791e56 1175AC_ARG_WITH(globus-static,
1176 [ --with-globus-static Link statically with Globus GSI libraries],
1177 [
1178 gsi_static=1
416fd2a8 1179 if test "x$gsi_path" = "xno" ; then
e2dec4b2 1180 gsi_path="$withval"
1181 fi
70791e56 1182 ]
1183)
1184
d905e828 1185# Check whether the user has a Globus flavor type
1186globus_flavor_type="no"
1187AC_ARG_WITH(globus-flavor,
70791e56 1188 [ --with-globus-flavor=TYPE Specify Globus flavor type (ex: gcc32dbg)],
d905e828 1189 [
1190 globus_flavor_type="$withval"
416fd2a8 1191 if test "x$gsi_path" = "xno" ; then
70791e56 1192 gsi_path="yes"
1193 fi
d905e828 1194 ]
1195)
1196
1197if test "x$gsi_path" != "xno" ; then
1198 # Globus GSSAPI configuration
88928908 1199 AC_MSG_CHECKING(for Globus GSI)
e00da40d 1200 AC_DEFINE(GSI, 1, [Define if you want GSI/Globus authentication support.])
d905e828 1201
c2397a66 1202 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
70791e56 1203 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus GSI.])
c2397a66 1204 fi
1205 if test -z "$GSSAPI"; then
1206 AC_DEFINE(GSSAPI)
1207 GSSAPI="GSI"
1208 fi
1209
70791e56 1210 if test "x$gsi_path" = "xyes" ; then
1211 if test -z "$GLOBUS_LOCATION" ; then
1212 AC_MSG_ERROR(GLOBUS_LOCATION environment variable must be set.)
1213 else
1214 gsi_path="$GLOBUS_LOCATION"
1215 fi
1216 fi
1217 GLOBUS_LOCATION="$gsi_path"
1218 export GLOBUS_LOCATION
1219 if test ! -d "$GLOBUS_LOCATION" ; then
1220 AC_MSG_ERROR(Cannot find Globus installation. Set GLOBUS_LOCATION environment variable.)
d905e828 1221 fi
d905e828 1222
1223 if test "x$globus_flavor_type" = "xno" ; then
88928908 1224 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
1225 fi
1226 if test "x$globus_flavor_type" = "xyes" ; then
1227 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
2d8588fd 1228 fi
9a370734 1229 AC_MSG_RESULT(yes)
2d8588fd 1230
9a370734 1231 AC_MSG_CHECKING(for Globus include path)
88928908 1232 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
1233 if test ! -d "$GLOBUS_INCLUDE" ; then
1234 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
1235 fi
1236 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
9a370734 1237 AC_MSG_RESULT(yes)
1238
5838d7f9 1239 #
1240 # Find GPT linkline helper
1241 #
1242
1243 AC_MSG_CHECKING(for GPT linkline helper)
9a370734 1244 if test -x $GPT_LOCATION/sbin/gpt_build_config ; then
5838d7f9 1245 gpt_linkline_helper="$GPT_LOCATION/sbin/gpt_build_config"
1246 elif test -x ${gsi_path}/sbin/gpt_build_config ; then
1247 gpt_linkline_helper="${gsi_path}/sbin/gpt_build_config"
2d8588fd 1248 else
9a370734 1249 AC_MSG_ERROR(Cannot find gpt_build_config: GPT installation is incomplete)
2d8588fd 1250 fi
06779745 1251 AC_MSG_RESULT(yes)
5838d7f9 1252
1253 #
1254 # Build Globus linkline
1255 #
1256
70791e56 1257 if test -n "${gsi_static}"; then
1258 ${gpt_linkline_helper} -f ${globus_flavor_type} -link static -src pkg_data_src.gpt
1259 else
1260 ${gpt_linkline_helper} -f ${globus_flavor_type} -link shared -src pkg_data_src.gpt
1261 fi
5838d7f9 1262 . ./gpt_build_temp.sh
70791e56 1263 if test -n "${need_dash_r}"; then
8ecf4c4d 1264 GSI_LDFLAGS="-L${gsi_path}/lib -R${gsi_path}/lib"
70791e56 1265 else
1266 GSI_LDFLAGS="-L${gsi_path}/lib"
1267 fi
5838d7f9 1268 GSI_LIBS="$GPT_CONFIG_PGM_LINKS"
92f152c3 1269 LD_LIBRARY_PATH="${gsi_path}/lib:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH
5838d7f9 1270
1271 #
1272 # Test Globus linkline
1273 #
1274
1275 AC_MSG_CHECKING(for Globus linkline)
88928908 1276 if test -z "$GSI_LIBS" ; then
9a370734 1277 AC_MSG_ERROR(gpt_build_config failed)
d905e828 1278 fi
9a370734 1279 AC_MSG_RESULT(yes)
d905e828 1280
416fd2a8 1281 AC_DEFINE(HAVE_GSSAPI_H)
1282
be1e4578 1283 LIBS="$LIBS $GSI_LIBS $GPT_CONFIG_LIBS"
70791e56 1284 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
be1e4578 1285 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS $GPT_CONFIG_INCLUDES"
1286 CFLAGS="$CFLAGS $GPT_CONFIG_CFLAGS"
88928908 1287
9a370734 1288 AC_MSG_CHECKING(that Globus linkline works)
88928908 1289 # test that we got the libraries OK
ffa83338 1290 AC_TRY_LINK(
1291 [],
1292 [],
1293 [
1294 AC_MSG_RESULT(yes)
1295 ],
1296 [
88928908 1297 AC_MSG_ERROR(link with Globus libraries failed)
ffa83338 1298 ]
1299 )
e00da40d 1300 AC_CHECK_FUNCS(globus_gss_assist_map_and_authorize)
88928908 1301 INSTALL_GSISSH="yes"
1302else
1303 INSTALL_GSISSH=""
d905e828 1304fi
c2397a66 1305# End Globus/GSI section
d905e828 1306
1b56ff3d 1307AC_MSG_CHECKING([for /proc/pid/fd directory])
1308if test -d "/proc/$$/fd" ; then
e00da40d 1309 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1b56ff3d 1310 AC_MSG_RESULT(yes)
1311else
1312 AC_MSG_RESULT(no)
1313fi
1314
3c0ef626 1315# Check whether user wants S/Key support
416fd2a8 1316SKEY_MSG="no"
3c0ef626 1317AC_ARG_WITH(skey,
34fee935 1318 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
3c0ef626 1319 [
1320 if test "x$withval" != "xno" ; then
1321
1322 if test "x$withval" != "xyes" ; then
1323 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1324 LDFLAGS="$LDFLAGS -L${withval}/lib"
1325 fi
1326
e00da40d 1327 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
3c0ef626 1328 LIBS="-lskey $LIBS"
416fd2a8 1329 SKEY_MSG="yes"
34fee935 1330
e9a17296 1331 AC_MSG_CHECKING([for s/key support])
e00da40d 1332 AC_LINK_IFELSE(
1333 [AC_LANG_SOURCE([[
e9a17296 1334#include <stdio.h>
1335#include <skey.h>
e54b3d7c 1336int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
e00da40d 1337 ]])],
e9a17296 1338 [AC_MSG_RESULT(yes)],
3c0ef626 1339 [
e9a17296 1340 AC_MSG_RESULT(no)
3c0ef626 1341 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1342 ])
2a304a95 1343 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1344 AC_TRY_COMPILE(
1345 [#include <stdio.h>
1346 #include <skey.h>],
1347 [(void)skeychallenge(NULL,"name","",0);],
1348 [AC_MSG_RESULT(yes)
e00da40d 1349 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1350 [Define if your skeychallenge()
1351 function takes 4 arguments (NetBSD)])],
2a304a95 1352 [AC_MSG_RESULT(no)]
1353 )
3c0ef626 1354 fi
1355 ]
1356)
1357
1358# Check whether user wants TCP wrappers support
1359TCPW_MSG="no"
1360AC_ARG_WITH(tcp-wrappers,
34fee935 1361 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
3c0ef626 1362 [
1363 if test "x$withval" != "xno" ; then
1364 saved_LIBS="$LIBS"
1365 saved_LDFLAGS="$LDFLAGS"
1366 saved_CPPFLAGS="$CPPFLAGS"
34fee935 1367 if test -n "${withval}" && \
1368 test "x${withval}" != "xyes"; then
3c0ef626 1369 if test -d "${withval}/lib"; then
1370 if test -n "${need_dash_r}"; then
1371 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1372 else
1373 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1374 fi
1375 else
1376 if test -n "${need_dash_r}"; then
1377 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1378 else
1379 LDFLAGS="-L${withval} ${LDFLAGS}"
1380 fi
1381 fi
1382 if test -d "${withval}/include"; then
1383 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1384 else
1385 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1386 fi
1387 fi
25d429a2 1388 LIBS="-lwrap $LIBS"
3c0ef626 1389 AC_MSG_CHECKING(for libwrap)
1390 AC_TRY_LINK(
1391 [
2a304a95 1392#include <sys/types.h>
1393#include <sys/socket.h>
1394#include <netinet/in.h>
3c0ef626 1395#include <tcpd.h>
1396 int deny_severity = 0, allow_severity = 0;
1397 ],
1398 [hosts_access(0);],
1399 [
1400 AC_MSG_RESULT(yes)
e00da40d 1401 AC_DEFINE(LIBWRAP, 1,
1402 [Define if you want
1403 TCP Wrappers support])
25d429a2 1404 SSHDLIBS="$SSHDLIBS -lwrap"
3c0ef626 1405 TCPW_MSG="yes"
1406 ],
1407 [
1408 AC_MSG_ERROR([*** libwrap missing])
1409 ]
1410 )
e9a17296 1411 LIBS="$saved_LIBS"
3c0ef626 1412 fi
1413 ]
1414)
1415
34fee935 1416# Check whether user wants libedit support
1417LIBEDIT_MSG="no"
1418AC_ARG_WITH(libedit,
1419 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1420 [ if test "x$withval" != "xno" ; then
1421 if test "x$withval" != "xyes"; then
e00da40d 1422 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1423 if test -n "${need_dash_r}"; then
1424 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1425 else
1426 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1427 fi
34fee935 1428 fi
1429 AC_CHECK_LIB(edit, el_init,
e00da40d 1430 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
34fee935 1431 LIBEDIT="-ledit -lcurses"
1432 LIBEDIT_MSG="yes"
1433 AC_SUBST(LIBEDIT)
1434 ],
1435 [ AC_MSG_ERROR(libedit not found) ],
1436 [ -lcurses ]
1437 )
1438 AC_MSG_CHECKING(if libedit version is compatible)
1439 AC_COMPILE_IFELSE(
1440 [AC_LANG_SOURCE([[
1441#include <histedit.h>
1442int main(void)
1443{
1444 int i = H_SETSIZE;
1445 el_init("", NULL, NULL, NULL);
1446 exit(0);
1447}
1448 ]])],
1449 [ AC_MSG_RESULT(yes) ],
1450 [ AC_MSG_RESULT(no)
1451 AC_MSG_ERROR(libedit version is not compatible) ]
1452 )
1453 fi ]
1454)
1455
1456AUDIT_MODULE=none
1457AC_ARG_WITH(audit,
1458 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1459 [
1460 AC_MSG_CHECKING(for supported audit module)
1461 case "$withval" in
1462 bsm)
1463 AC_MSG_RESULT(bsm)
1464 AUDIT_MODULE=bsm
1465 dnl Checks for headers, libs and functions
1466 AC_CHECK_HEADERS(bsm/audit.h, [],
2e437378 1467 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1468 [
1469#ifdef HAVE_TIME_H
1470# include <time.h>
1471#endif
1472 ]
1473)
34fee935 1474 AC_CHECK_LIB(bsm, getaudit, [],
1475 [AC_MSG_ERROR(BSM enabled and required library not found)])
1476 AC_CHECK_FUNCS(getaudit, [],
1477 [AC_MSG_ERROR(BSM enabled and required function not found)])
1478 # These are optional
bd5d5d2a 1479 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
e00da40d 1480 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
34fee935 1481 ;;
1482 debug)
1483 AUDIT_MODULE=debug
1484 AC_MSG_RESULT(debug)
e00da40d 1485 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
34fee935 1486 ;;
1487 no)
1488 AC_MSG_RESULT(no)
1489 ;;
1490 *)
1491 AC_MSG_ERROR([Unknown audit module $withval])
1492 ;;
1493 esac ]
1494)
1495
1c14df9e 1496dnl Checks for library functions. Please keep in alphabetical order
34fee935 1497AC_CHECK_FUNCS( \
1498 arc4random \
6f25cbdd 1499 arc4random_buf \
1500 arc4random_uniform \
e00da40d 1501 asprintf \
34fee935 1502 b64_ntop \
1503 __b64_ntop \
1504 b64_pton \
1505 __b64_pton \
1506 bcopy \
1507 bindresvport_sa \
1508 clock \
1509 closefrom \
1510 dirfd \
1511 fchmod \
1512 fchown \
1513 freeaddrinfo \
6f25cbdd 1514 fstatvfs \
34fee935 1515 futimes \
1516 getaddrinfo \
1517 getcwd \
1518 getgrouplist \
1519 getnameinfo \
1520 getopt \
1521 getpeereid \
25d429a2 1522 getpeerucred \
34fee935 1523 _getpty \
1524 getrlimit \
1525 getttyent \
1526 glob \
1527 inet_aton \
1528 inet_ntoa \
1529 inet_ntop \
1530 innetgr \
1531 login_getcapbool \
1532 md5_crypt \
1533 memmove \
1534 mkdtemp \
1535 mmap \
1536 ngetaddrinfo \
1537 nsleep \
1538 ogetaddrinfo \
1539 openlog_r \
1540 openpty \
25d429a2 1541 poll \
34fee935 1542 prctl \
1543 pstat \
1544 readpassphrase \
1545 realpath \
1546 recvmsg \
1547 rresvport_af \
1548 sendmsg \
1549 setdtablesize \
1550 setegid \
1551 setenv \
1552 seteuid \
1553 setgroups \
1554 setlogin \
1555 setpcred \
1556 setproctitle \
1557 setregid \
1558 setreuid \
1559 setrlimit \
1560 setsid \
1561 setvbuf \
1562 sigaction \
1563 sigvec \
1564 snprintf \
1565 socketpair \
6f25cbdd 1566 statfs \
1567 statvfs \
34fee935 1568 strdup \
1569 strerror \
1570 strlcat \
1571 strlcpy \
1572 strmode \
1573 strnvis \
1574 strtonum \
1575 strtoll \
1576 strtoul \
25d429a2 1577 swap32 \
34fee935 1578 sysconf \
1579 tcgetpgrp \
1580 truncate \
1581 unsetenv \
1582 updwtmpx \
e00da40d 1583 vasprintf \
34fee935 1584 vhangup \
1585 vsnprintf \
1586 waitpid \
70791e56 1587)
1588
1589# IRIX has a const char return value for gai_strerror()
1590AC_CHECK_FUNCS(gai_strerror,[
1591 AC_DEFINE(HAVE_GAI_STRERROR)
1592 AC_TRY_COMPILE([
1593#include <sys/types.h>
1594#include <sys/socket.h>
1595#include <netdb.h>
1c14df9e 1596
70791e56 1597const char *gai_strerror(int);],[
1598char *str;
1c14df9e 1599
70791e56 1600str = gai_strerror(0);],[
1601 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1602 [Define if gai_strerror() returns const char *])])])
88928908 1603
e00da40d 1604AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1605 [Some systems put nanosleep outside of libc]))
3c0ef626 1606
70791e56 1607dnl Make sure prototypes are defined for these before using them.
70791e56 1608AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
34fee935 1609AC_CHECK_DECL(strsep,
1610 [AC_CHECK_FUNCS(strsep)],
1611 [],
1612 [
1613#ifdef HAVE_STRING_H
1614# include <string.h>
1615#endif
1616 ])
3c0ef626 1617
70791e56 1618dnl tcsendbreak might be a macro
1619AC_CHECK_DECL(tcsendbreak,
1620 [AC_DEFINE(HAVE_TCSENDBREAK)],
416fd2a8 1621 [AC_CHECK_FUNCS(tcsendbreak)],
70791e56 1622 [#include <termios.h>]
1623)
3c0ef626 1624
1b56ff3d 1625AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1626
2e437378 1627AC_CHECK_DECLS(SHUT_RD, , ,
1628 [
1629#include <sys/types.h>
1630#include <sys/socket.h>
1631 ])
1632
1633AC_CHECK_DECLS(O_NONBLOCK, , ,
1634 [
1635#include <sys/types.h>
1636#ifdef HAVE_SYS_STAT_H
1637# include <sys/stat.h>
1638#endif
1639#ifdef HAVE_FCNTL_H
1640# include <fcntl.h>
1641#endif
1642 ])
1643
1644AC_CHECK_DECLS(writev, , , [
1645#include <sys/types.h>
1646#include <sys/uio.h>
1647#include <unistd.h>
1648 ])
1649
25d429a2 1650AC_CHECK_DECLS(MAXSYMLINKS, , , [
1651#include <sys/param.h>
1652 ])
1653
1654AC_CHECK_DECLS(offsetof, , , [
1655#include <stddef.h>
1656 ])
1657
416fd2a8 1658AC_CHECK_FUNCS(setresuid, [
1659 dnl Some platorms have setresuid that isn't implemented, test for this
1660 AC_MSG_CHECKING(if setresuid seems to work)
34fee935 1661 AC_RUN_IFELSE(
1662 [AC_LANG_SOURCE([[
416fd2a8 1663#include <stdlib.h>
1664#include <errno.h>
1665int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
34fee935 1666 ]])],
416fd2a8 1667 [AC_MSG_RESULT(yes)],
e00da40d 1668 [AC_DEFINE(BROKEN_SETRESUID, 1,
1669 [Define if your setresuid() is broken])
34fee935 1670 AC_MSG_RESULT(not implemented)],
1671 [AC_MSG_WARN([cross compiling: not checking setresuid])]
416fd2a8 1672 )
1673])
1674
1675AC_CHECK_FUNCS(setresgid, [
1676 dnl Some platorms have setresgid that isn't implemented, test for this
1677 AC_MSG_CHECKING(if setresgid seems to work)
34fee935 1678 AC_RUN_IFELSE(
1679 [AC_LANG_SOURCE([[
416fd2a8 1680#include <stdlib.h>
1681#include <errno.h>
1682int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
34fee935 1683 ]])],
416fd2a8 1684 [AC_MSG_RESULT(yes)],
e00da40d 1685 [AC_DEFINE(BROKEN_SETRESGID, 1,
1686 [Define if your setresgid() is broken])
34fee935 1687 AC_MSG_RESULT(not implemented)],
1688 [AC_MSG_WARN([cross compiling: not checking setresuid])]
416fd2a8 1689 )
1690])
1691
3c0ef626 1692dnl Checks for time functions
1693AC_CHECK_FUNCS(gettimeofday time)
1694dnl Checks for utmp functions
1695AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1696AC_CHECK_FUNCS(utmpname)
1697dnl Checks for utmpx functions
1698AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1699AC_CHECK_FUNCS(setutxent utmpxname)
1700
416fd2a8 1701AC_CHECK_FUNC(daemon,
e00da40d 1702 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1703 [AC_CHECK_LIB(bsd, daemon,
1704 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
3c0ef626 1705)
1706
416fd2a8 1707AC_CHECK_FUNC(getpagesize,
e00da40d 1708 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1709 [Define if your libraries define getpagesize()])],
1710 [AC_CHECK_LIB(ucb, getpagesize,
1711 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
3c0ef626 1712)
1713
1714# Check for broken snprintf
1715if test "x$ac_cv_func_snprintf" = "xyes" ; then
1716 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
34fee935 1717 AC_RUN_IFELSE(
1718 [AC_LANG_SOURCE([[
3c0ef626 1719#include <stdio.h>
e54b3d7c 1720int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
34fee935 1721 ]])],
416fd2a8 1722 [AC_MSG_RESULT(yes)],
3c0ef626 1723 [
1724 AC_MSG_RESULT(no)
e00da40d 1725 AC_DEFINE(BROKEN_SNPRINTF, 1,
1726 [Define if your snprintf is busted])
3c0ef626 1727 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
34fee935 1728 ],
1729 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
3c0ef626 1730 )
1731fi
1732
e00da40d 1733# If we don't have a working asprintf, then we strongly depend on vsnprintf
1734# returning the right thing on overflow: the number of characters it tried to
1735# create (as per SUSv3)
1736if test "x$ac_cv_func_asprintf" != "xyes" && \
1737 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1738 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1739 AC_RUN_IFELSE(
1740 [AC_LANG_SOURCE([[
1741#include <sys/types.h>
1742#include <stdio.h>
1743#include <stdarg.h>
1744
1745int x_snprintf(char *str,size_t count,const char *fmt,...)
1746{
1747 size_t ret; va_list ap;
1748 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1749 return ret;
1750}
1751int main(void)
1752{
1753 char x[1];
1754 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1755} ]])],
1756 [AC_MSG_RESULT(yes)],
1757 [
1758 AC_MSG_RESULT(no)
1759 AC_DEFINE(BROKEN_SNPRINTF, 1,
1760 [Define if your snprintf is busted])
1761 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1762 ],
1763 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1764 )
1765fi
1766
1767# On systems where [v]snprintf is broken, but is declared in stdio,
1768# check that the fmt argument is const char * or just char *.
1769# This is only useful for when BROKEN_SNPRINTF
1770AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1771AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1772 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1773 int main(void) { snprintf(0, 0, 0); }
1774 ]])],
1775 [AC_MSG_RESULT(yes)
1776 AC_DEFINE(SNPRINTF_CONST, [const],
1777 [Define as const if snprintf() can declare const char *fmt])],
1778 [AC_MSG_RESULT(no)
1779 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1780
1b56ff3d 1781# Check for missing getpeereid (or equiv) support
1782NO_PEERCHECK=""
25d429a2 1783if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
1b56ff3d 1784 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1785 AC_TRY_COMPILE(
1786 [#include <sys/types.h>
1787 #include <sys/socket.h>],
1788 [int i = SO_PEERCRED;],
34fee935 1789 [ AC_MSG_RESULT(yes)
e00da40d 1790 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
34fee935 1791 ],
1b56ff3d 1792 [AC_MSG_RESULT(no)
1793 NO_PEERCHECK=1]
1794 )
1795fi
1796
1c14df9e 1797dnl see whether mkstemp() requires XXXXXX
1798if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1799AC_MSG_CHECKING([for (overly) strict mkstemp])
e00da40d 1800AC_RUN_IFELSE(
1801 [AC_LANG_SOURCE([[
1c14df9e 1802#include <stdlib.h>
1803main() { char template[]="conftest.mkstemp-test";
1804if (mkstemp(template) == -1)
1805 exit(1);
1806unlink(template); exit(0);
1807}
e00da40d 1808 ]])],
1c14df9e 1809 [
1810 AC_MSG_RESULT(no)
1811 ],
416fd2a8 1812 [
1c14df9e 1813 AC_MSG_RESULT(yes)
e00da40d 1814 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1c14df9e 1815 ],
1816 [
1817 AC_MSG_RESULT(yes)
1818 AC_DEFINE(HAVE_STRICT_MKSTEMP)
416fd2a8 1819 ]
1c14df9e 1820)
1821fi
1822
70791e56 1823dnl make sure that openpty does not reacquire controlling terminal
1824if test ! -z "$check_for_openpty_ctty_bug"; then
1825 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
e00da40d 1826 AC_RUN_IFELSE(
1827 [AC_LANG_SOURCE([[
70791e56 1828#include <stdio.h>
1829#include <sys/fcntl.h>
1830#include <sys/types.h>
1831#include <sys/wait.h>
1832
1833int
1834main()
1835{
1836 pid_t pid;
1837 int fd, ptyfd, ttyfd, status;
1838
1839 pid = fork();
1840 if (pid < 0) { /* failed */
1841 exit(1);
1842 } else if (pid > 0) { /* parent */
1843 waitpid(pid, &status, 0);
416fd2a8 1844 if (WIFEXITED(status))
70791e56 1845 exit(WEXITSTATUS(status));
1846 else
1847 exit(2);
1848 } else { /* child */
1849 close(0); close(1); close(2);
1850 setsid();
1851 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1852 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1853 if (fd >= 0)
1854 exit(3); /* Acquired ctty: broken */
1855 else
1856 exit(0); /* Did not acquire ctty: OK */
1857 }
1858}
e00da40d 1859 ]])],
70791e56 1860 [
1861 AC_MSG_RESULT(yes)
1862 ],
1863 [
1864 AC_MSG_RESULT(no)
1865 AC_DEFINE(SSHD_ACQUIRES_CTTY)
e00da40d 1866 ],
1867 [
1868 AC_MSG_RESULT(cross-compiling, assuming yes)
70791e56 1869 ]
1870 )
1871fi
1872
34fee935 1873if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1874 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
2a304a95 1875 AC_MSG_CHECKING(if getaddrinfo seems to work)
e00da40d 1876 AC_RUN_IFELSE(
1877 [AC_LANG_SOURCE([[
2a304a95 1878#include <stdio.h>
1879#include <sys/socket.h>
1880#include <netdb.h>
1881#include <errno.h>
1882#include <netinet/in.h>
1883
1884#define TEST_PORT "2222"
1885
1886int
1887main(void)
1888{
1889 int err, sock;
1890 struct addrinfo *gai_ai, *ai, hints;
1891 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1892
1893 memset(&hints, 0, sizeof(hints));
1894 hints.ai_family = PF_UNSPEC;
1895 hints.ai_socktype = SOCK_STREAM;
1896 hints.ai_flags = AI_PASSIVE;
1897
1898 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1899 if (err != 0) {
1900 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1901 exit(1);
1902 }
1903
1904 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1905 if (ai->ai_family != AF_INET6)
1906 continue;
1907
1908 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1909 sizeof(ntop), strport, sizeof(strport),
1910 NI_NUMERICHOST|NI_NUMERICSERV);
1911
1912 if (err != 0) {
1913 if (err == EAI_SYSTEM)
1914 perror("getnameinfo EAI_SYSTEM");
1915 else
1916 fprintf(stderr, "getnameinfo failed: %s\n",
1917 gai_strerror(err));
1918 exit(2);
1919 }
1920
1921 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1922 if (sock < 0)
1923 perror("socket");
1924 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1925 if (errno == EBADF)
1926 exit(3);
1927 }
1928 }
1929 exit(0);
1930}
e00da40d 1931 ]])],
2a304a95 1932 [
1933 AC_MSG_RESULT(yes)
1934 ],
1935 [
1936 AC_MSG_RESULT(no)
1937 AC_DEFINE(BROKEN_GETADDRINFO)
e00da40d 1938 ],
1939 [
1940 AC_MSG_RESULT(cross-compiling, assuming yes)
2a304a95 1941 ]
1942 )
1943fi
1944
34fee935 1945if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1946 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1947 AC_MSG_CHECKING(if getaddrinfo seems to work)
e00da40d 1948 AC_RUN_IFELSE(
1949 [AC_LANG_SOURCE([[
34fee935 1950#include <stdio.h>
1951#include <sys/socket.h>
1952#include <netdb.h>
1953#include <errno.h>
1954#include <netinet/in.h>
1955
1956#define TEST_PORT "2222"
1957
1958int
1959main(void)
1960{
1961 int err, sock;
1962 struct addrinfo *gai_ai, *ai, hints;
1963 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1964
1965 memset(&hints, 0, sizeof(hints));
1966 hints.ai_family = PF_UNSPEC;
1967 hints.ai_socktype = SOCK_STREAM;
1968 hints.ai_flags = AI_PASSIVE;
1969
1970 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1971 if (err != 0) {
1972 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1973 exit(1);
1974 }
1975
1976 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1977 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1978 continue;
1979
1980 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1981 sizeof(ntop), strport, sizeof(strport),
1982 NI_NUMERICHOST|NI_NUMERICSERV);
1983
1984 if (ai->ai_family == AF_INET && err != 0) {
1985 perror("getnameinfo");
1986 exit(2);
1987 }
1988 }
1989 exit(0);
1990}
e00da40d 1991 ]])],
34fee935 1992 [
1993 AC_MSG_RESULT(yes)
e00da40d 1994 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1995 [Define if you have a getaddrinfo that fails
1996 for the all-zeros IPv6 address])
34fee935 1997 ],
1998 [
1999 AC_MSG_RESULT(no)
2000 AC_DEFINE(BROKEN_GETADDRINFO)
e00da40d 2001 ],
2e437378 2002 [
e00da40d 2003 AC_MSG_RESULT(cross-compiling, assuming no)
34fee935 2004 ]
2005 )
2006fi
2007
2008if test "x$check_for_conflicting_getspnam" = "x1"; then
2009 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
2010 AC_COMPILE_IFELSE(
2011 [
2012#include <shadow.h>
2013int main(void) {exit(0);}
2014 ],
2015 [
2016 AC_MSG_RESULT(no)
2017 ],
2018 [
2019 AC_MSG_RESULT(yes)
2020 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
2021 [Conflicting defs for getspnam])
2022 ]
2023 )
2024fi
2025
3c0ef626 2026AC_FUNC_GETPGRP
2027
2980ea68 2028# Search for OpenSSL
2029saved_CPPFLAGS="$CPPFLAGS"
2030saved_LDFLAGS="$LDFLAGS"
3c0ef626 2031AC_ARG_WITH(ssl-dir,
2032 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
2033 [
2034 if test "x$withval" != "xno" ; then
34fee935 2035 case "$withval" in
2036 # Relative paths
2037 ./*|../*) withval="`pwd`/$withval"
2038 esac
2980ea68 2039 if test -d "$withval/lib"; then
2040 if test -n "${need_dash_r}"; then
2041 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2042 else
2043 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
3c0ef626 2044 fi
2045 else
2980ea68 2046 if test -n "${need_dash_r}"; then
2047 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2048 else
2049 LDFLAGS="-L${withval} ${LDFLAGS}"
3c0ef626 2050 fi
2051 fi
2980ea68 2052 if test -d "$withval/include"; then
2053 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
3c0ef626 2054 else
2980ea68 2055 CPPFLAGS="-I${withval} ${CPPFLAGS}"
3c0ef626 2056 fi
2057 fi
2980ea68 2058 ]
2059)
3c0ef626 2060
88928908 2061if test -z "$GSI_LIBS" ; then
416fd2a8 2062LIBS="-lcrypto $LIBS"
88928908 2063fi
e00da40d 2064AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
2065 [Define if your ssl headers are included
2066 with #include <openssl/header.h>]),
3c0ef626 2067 [
2980ea68 2068 dnl Check default openssl install dir
2069 if test -n "${need_dash_r}"; then
2070 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
3c0ef626 2071 else
2980ea68 2072 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
3c0ef626 2073 fi
2980ea68 2074 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2075 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
2076 [
2077 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2078 ]
2079 )
2080 ]
2081)
2082
e54b3d7c 2083# Determine OpenSSL header version
2084AC_MSG_CHECKING([OpenSSL header version])
34fee935 2085AC_RUN_IFELSE(
2086 [AC_LANG_SOURCE([[
e54b3d7c 2087#include <stdio.h>
2088#include <string.h>
2089#include <openssl/opensslv.h>
2090#define DATA "conftest.sslincver"
2091int main(void) {
416fd2a8 2092 FILE *fd;
2093 int rc;
e54b3d7c 2094
416fd2a8 2095 fd = fopen(DATA,"w");
2096 if(fd == NULL)
2097 exit(1);
e54b3d7c 2098
2099 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2100 exit(1);
2101
2102 exit(0);
2103}
34fee935 2104 ]])],
e54b3d7c 2105 [
2106 ssl_header_ver=`cat conftest.sslincver`
2107 AC_MSG_RESULT($ssl_header_ver)
2108 ],
2109 [
2110 AC_MSG_RESULT(not found)
2111 AC_MSG_ERROR(OpenSSL version header not found.)
34fee935 2112 ],
2113 [
2114 AC_MSG_WARN([cross compiling: not checking])
e54b3d7c 2115 ]
2116)
2117
2118# Determine OpenSSL library version
2119AC_MSG_CHECKING([OpenSSL library version])
34fee935 2120AC_RUN_IFELSE(
2121 [AC_LANG_SOURCE([[
e54b3d7c 2122#include <stdio.h>
2123#include <string.h>
2124#include <openssl/opensslv.h>
2125#include <openssl/crypto.h>
2126#define DATA "conftest.ssllibver"
2127int main(void) {
416fd2a8 2128 FILE *fd;
2129 int rc;
e54b3d7c 2130
416fd2a8 2131 fd = fopen(DATA,"w");
2132 if(fd == NULL)
2133 exit(1);
e54b3d7c 2134
2135 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2136 exit(1);
2137
2138 exit(0);
2139}
34fee935 2140 ]])],
e54b3d7c 2141 [
2142 ssl_library_ver=`cat conftest.ssllibver`
2143 AC_MSG_RESULT($ssl_library_ver)
2144 ],
2145 [
2146 AC_MSG_RESULT(not found)
2147 AC_MSG_ERROR(OpenSSL library not found.)
34fee935 2148 ],
2149 [
2150 AC_MSG_WARN([cross compiling: not checking])
e54b3d7c 2151 ]
2152)
3c0ef626 2153
2278ffa1 2154AC_ARG_WITH(openssl-header-check,
2155 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2156 [ if test "x$withval" = "xno" ; then
2157 openssl_check_nonfatal=1
2158 fi
2159 ]
2160)
2161
e9a17296 2162# Sanity check OpenSSL headers
2163AC_MSG_CHECKING([whether OpenSSL's headers match the library])
34fee935 2164AC_RUN_IFELSE(
2165 [AC_LANG_SOURCE([[
e9a17296 2166#include <string.h>
2167#include <openssl/opensslv.h>
e54b3d7c 2168int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
34fee935 2169 ]])],
e9a17296 2170 [
2171 AC_MSG_RESULT(yes)
2172 ],
2173 [
2174 AC_MSG_RESULT(no)
2278ffa1 2175 if test "x$openssl_check_nonfatal" = "x"; then
2176 AC_MSG_ERROR([Your OpenSSL headers do not match your
2177library. Check config.log for details.
2178If you are sure your installation is consistent, you can disable the check
2179by running "./configure --without-openssl-header-check".
2180Also see contrib/findssl.sh for help identifying header/library mismatches.
2181])
2182 else
2183 AC_MSG_WARN([Your OpenSSL headers do not match your
2184library. Check config.log for details.
70791e56 2185Also see contrib/findssl.sh for help identifying header/library mismatches.])
2278ffa1 2186 fi
34fee935 2187 ],
2188 [
2189 AC_MSG_WARN([cross compiling: not checking])
e9a17296 2190 ]
2191)
2192
2e437378 2193AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2194AC_LINK_IFELSE(
2195 [AC_LANG_SOURCE([[
2196#include <openssl/evp.h>
2197int main(void) { SSLeay_add_all_algorithms(); }
2198 ]])],
2199 [
2200 AC_MSG_RESULT(yes)
2201 ],
2202 [
2203 AC_MSG_RESULT(no)
2204 saved_LIBS="$LIBS"
2205 LIBS="$LIBS -ldl"
2206 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2207 AC_LINK_IFELSE(
2208 [AC_LANG_SOURCE([[
2209#include <openssl/evp.h>
2210int main(void) { SSLeay_add_all_algorithms(); }
2211 ]])],
2212 [
2213 AC_MSG_RESULT(yes)
2214 ],
2215 [
2216 AC_MSG_RESULT(no)
2217 LIBS="$saved_LIBS"
2218 ]
2219 )
2220 ]
2221)
2222
2223AC_ARG_WITH(ssl-engine,
2224 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2225 [ if test "x$withval" != "xno" ; then
2226 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2227 AC_TRY_COMPILE(
2228 [ #include <openssl/engine.h>],
2229 [
2230ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2231 ],
2232 [ AC_MSG_RESULT(yes)
2233 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2234 [Enable OpenSSL engine support])
2235 ],
2236 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2237 )
2238 fi ]
2239)
2240
e00da40d 2241# Check for OpenSSL without EVP_aes_{192,256}_cbc
2242AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2e437378 2243AC_LINK_IFELSE(
e00da40d 2244 [AC_LANG_SOURCE([[
2245#include <string.h>
2246#include <openssl/evp.h>
2247int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2248 ]])],
2249 [
2250 AC_MSG_RESULT(no)
2251 ],
2252 [
2253 AC_MSG_RESULT(yes)
2254 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2255 [libcrypto is missing AES 192 and 256 bit functions])
2256 ]
2257)
2258
416fd2a8 2259# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2260# because the system crypt() is more featureful.
2261if test "x$check_for_libcrypt_before" = "x1"; then
2262 AC_CHECK_LIB(crypt, crypt)
2263fi
2264
2265# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2266# version in OpenSSL.
70791e56 2267if test "x$check_for_libcrypt_later" = "x1"; then
3c0ef626 2268 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2269fi
2270
2e437378 2271# Search for SHA256 support in libc and/or OpenSSL
2272AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2273
25d429a2 2274saved_LIBS="$LIBS"
2275AC_CHECK_LIB(iaf, ia_openinfo, [
2276 LIBS="$LIBS -liaf"
bd5d5d2a 2277 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2278 AC_DEFINE(HAVE_LIBIAF, 1,
2279 [Define if system has libiaf that supports set_id])
2280 ])
25d429a2 2281])
2282LIBS="$saved_LIBS"
e9a17296 2283
2284### Configure cryptographic random number support
2285
2286# Check wheter OpenSSL seeds itself
2287AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
34fee935 2288AC_RUN_IFELSE(
2289 [AC_LANG_SOURCE([[
e9a17296 2290#include <string.h>
2291#include <openssl/rand.h>
e54b3d7c 2292int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
34fee935 2293 ]])],
e9a17296 2294 [
2295 OPENSSL_SEEDS_ITSELF=yes
2296 AC_MSG_RESULT(yes)
2297 ],
2298 [
2299 AC_MSG_RESULT(no)
2300 # Default to use of the rand helper if OpenSSL doesn't
2301 # seed itself
2302 USE_RAND_HELPER=yes
34fee935 2303 ],
2304 [
2305 AC_MSG_WARN([cross compiling: assuming yes])
2306 # This is safe, since all recent OpenSSL versions will
2307 # complain at runtime if not seeded correctly.
2308 OPENSSL_SEEDS_ITSELF=yes
e9a17296 2309 ]
2310)
2311
2e437378 2312# Check for PAM libs
2313PAM_MSG="no"
2314AC_ARG_WITH(pam,
2315 [ --with-pam Enable PAM support ],
2316 [
2317 if test "x$withval" != "xno" ; then
2318 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2319 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2320 AC_MSG_ERROR([PAM headers not found])
2321 fi
2322
2323 saved_LIBS="$LIBS"
2324 AC_CHECK_LIB(dl, dlopen, , )
2325 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2326 AC_CHECK_FUNCS(pam_getenvlist)
2327 AC_CHECK_FUNCS(pam_putenv)
2328 LIBS="$saved_LIBS"
2329
2330 PAM_MSG="yes"
2331
25d429a2 2332 SSHDLIBS="$SSHDLIBS -lpam"
2e437378 2333 AC_DEFINE(USE_PAM, 1,
2334 [Define if you want to enable PAM support])
2335
2336 if test $ac_cv_lib_dl_dlopen = yes; then
2337 case "$LIBS" in
2338 *-ldl*)
2339 # libdl already in LIBS
2340 ;;
2341 *)
25d429a2 2342 SSHDLIBS="$SSHDLIBS -ldl"
2e437378 2343 ;;
2344 esac
2345 fi
2e437378 2346 fi
2347 ],
2348 [
2349 saved_LIBS="$LIBS"
2350 AC_CHECK_LIB(dl, dlopen, , )
2351 AC_CHECK_LIB(pam, pam_set_item, , )
2352 AC_CHECK_FUNCS(pam_getenvlist)
2353 AC_CHECK_FUNCS(pam_putenv)
2354 LIBS="$saved_LIBS"
2355
2356 if (test "x$ac_cv_header_security_pam_appl_h" = "xyes" || \
2357 test "x$ac_cv_header_pam_pam_appl_h" = "xyes") &&
2358 test "x$ac_cv_lib_pam_pam_set_item" = "xyes" ; then
2359
2360 PAM_MSG="yes"
2361
2362 LIBPAM="-lpam"
2363
2364 if test $ac_cv_lib_dl_dlopen = yes; then
2365 case "$LIBS" in
2366 *-ldl*)
2367 # libdl already in LIBS
2368 ;;
2369 *)
2370 LIBPAM="$LIBPAM -ldl"
2371 ;;
2372 esac
2373 fi
2374 AC_SUBST(LIBPAM)
2375 fi
2376 ]
2377)
2378
2379# Check for older PAM
2380if test "x$PAM_MSG" = "xyes" ; then
2381 # Check PAM strerror arguments (old PAM)
2382 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2383 AC_TRY_COMPILE(
2384 [
2385#include <stdlib.h>
2386#if defined(HAVE_SECURITY_PAM_APPL_H)
2387#include <security/pam_appl.h>
2388#elif defined (HAVE_PAM_PAM_APPL_H)
2389#include <pam/pam_appl.h>
2390#endif
2391 ],
2392 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2393 [AC_MSG_RESULT(no)],
2394 [
2395 AC_DEFINE(HAVE_OLD_PAM, 1,
2396 [Define if you have an old version of PAM
2397 which takes only one argument to pam_strerror])
2398 AC_MSG_RESULT(yes)
2399 PAM_MSG="yes (old library)"
2400 ]
2401 )
2402fi
e9a17296 2403
2404# Do we want to force the use of the rand helper?
2405AC_ARG_WITH(rand-helper,
2406 [ --with-rand-helper Use subprocess to gather strong randomness ],
2407 [
2408 if test "x$withval" = "xno" ; then
416fd2a8 2409 # Force use of OpenSSL's internal RNG, even if
e9a17296 2410 # the previous test showed it to be unseeded.
2411 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2412 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2413 OPENSSL_SEEDS_ITSELF=yes
2414 USE_RAND_HELPER=""
2415 fi
2416 else
2417 USE_RAND_HELPER=yes
2418 fi
2419 ],
34fee935 2420)
e9a17296 2421
2422# Which randomness source do we use?
34fee935 2423if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
e9a17296 2424 # OpenSSL only
e00da40d 2425 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2426 [Define if you want OpenSSL's internally seeded PRNG only])
e9a17296 2427 RAND_MSG="OpenSSL internal ONLY"
2428 INSTALL_SSH_RAND_HELPER=""
2429elif test ! -z "$USE_RAND_HELPER" ; then
2430 # install rand helper
2431 RAND_MSG="ssh-rand-helper"
2432 INSTALL_SSH_RAND_HELPER="yes"
2433fi
2434AC_SUBST(INSTALL_SSH_RAND_HELPER)
2435
2436### Configuration of ssh-rand-helper
2437
2438# PRNGD TCP socket
2439AC_ARG_WITH(prngd-port,
2440 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2441 [
2442 case "$withval" in
2443 no)
2444 withval=""
2445 ;;
2446 [[0-9]]*)
2447 ;;
2448 *)
2449 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2450 ;;
2451 esac
2452 if test ! -z "$withval" ; then
2453 PRNGD_PORT="$withval"
e00da40d 2454 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2455 [Port number of PRNGD/EGD random number socket])
e9a17296 2456 fi
2457 ]
2458)
2459
2460# PRNGD Unix domain socket
2461AC_ARG_WITH(prngd-socket,
2462 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2463 [
2464 case "$withval" in
2465 yes)
2466 withval="/var/run/egd-pool"
2467 ;;
2468 no)
2469 withval=""
2470 ;;
2471 /*)
2472 ;;
2473 *)
2474 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2475 ;;
2476 esac
2477
2478 if test ! -z "$withval" ; then
2479 if test ! -z "$PRNGD_PORT" ; then
2480 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2481 fi
2482 if test ! -r "$withval" ; then
2483 AC_MSG_WARN(Entropy socket is not readable)
2484 fi
2485 PRNGD_SOCKET="$withval"
e00da40d 2486 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2487 [Location of PRNGD/EGD random number socket])
e9a17296 2488 fi
2489 ],
2490 [
2491 # Check for existing socket only if we don't have a random device already
2492 if test "$USE_RAND_HELPER" = yes ; then
2493 AC_MSG_CHECKING(for PRNGD/EGD socket)
2494 # Insert other locations here
2495 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2496 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2497 PRNGD_SOCKET="$sock"
2498 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2499 break;
2500 fi
2501 done
2502 if test ! -z "$PRNGD_SOCKET" ; then
2503 AC_MSG_RESULT($PRNGD_SOCKET)
2504 else
2505 AC_MSG_RESULT(not found)
2506 fi
2507 fi
2508 ]
2509)
2510
2511# Change default command timeout for hashing entropy source
2512entropy_timeout=200
2513AC_ARG_WITH(entropy-timeout,
2514 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2515 [
34fee935 2516 if test -n "$withval" && test "x$withval" != "xno" && \
2517 test "x${withval}" != "xyes"; then
e9a17296 2518 entropy_timeout=$withval
2519 fi
34fee935 2520 ]
e9a17296 2521)
e00da40d 2522AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2523 [Builtin PRNG command timeout])
e9a17296 2524
ff2d7a98 2525SSH_PRIVSEP_USER=sshd
2980ea68 2526AC_ARG_WITH(privsep-user,
2527 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2528 [
34fee935 2529 if test -n "$withval" && test "x$withval" != "xno" && \
2530 test "x${withval}" != "xyes"; then
ff2d7a98 2531 SSH_PRIVSEP_USER=$withval
2980ea68 2532 fi
34fee935 2533 ]
2980ea68 2534)
e00da40d 2535AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2536 [non-privileged user for privilege separation])
ff2d7a98 2537AC_SUBST(SSH_PRIVSEP_USER)
2980ea68 2538
2539# We do this little dance with the search path to insure
2540# that programs that we select for use by installed programs
2541# (which may be run by the super-user) come from trusted
2542# locations before they come from the user's private area.
2543# This should help avoid accidentally configuring some
2544# random version of a program in someone's personal bin.
2545
2546OPATH=$PATH
2547PATH=/bin:/usr/bin
2548test -h /bin 2> /dev/null && PATH=/usr/bin
2549test -d /sbin && PATH=$PATH:/sbin
2550test -d /usr/sbin && PATH=$PATH:/usr/sbin
2551PATH=$PATH:/etc:$OPATH
2552
416fd2a8 2553# These programs are used by the command hashing source to gather entropy
e9a17296 2554OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2555OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2556OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2557OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2558OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2559OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2560OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2561OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2562OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2563OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2564OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2565OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2566OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2567OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2568OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2569OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2980ea68 2570# restore PATH
2571PATH=$OPATH
e9a17296 2572
2573# Where does ssh-rand-helper get its randomness from?
2574INSTALL_SSH_PRNG_CMDS=""
2575if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2576 if test ! -z "$PRNGD_PORT" ; then
2577 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2578 elif test ! -z "$PRNGD_SOCKET" ; then
2579 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2580 else
2581 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2582 RAND_HELPER_CMDHASH=yes
2583 INSTALL_SSH_PRNG_CMDS="yes"
2584 fi
2585fi
2586AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2587
2588
3c0ef626 2589# Cheap hack to ensure NEWS-OS libraries are arranged right.
2590if test ! -z "$SONY" ; then
2591 LIBS="$LIBS -liberty";
2592fi
2593
e00da40d 2594# Check for long long datatypes
2595AC_CHECK_TYPES([long long, unsigned long long, long double])
2596
2597# Check datatype sizes
3c0ef626 2598AC_CHECK_SIZEOF(char, 1)
2599AC_CHECK_SIZEOF(short int, 2)
2600AC_CHECK_SIZEOF(int, 4)
2601AC_CHECK_SIZEOF(long int, 4)
2602AC_CHECK_SIZEOF(long long int, 8)
2603
2980ea68 2604# Sanity check long long for some platforms (AIX)
2605if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2606 ac_cv_sizeof_long_long_int=0
2607fi
2608
e00da40d 2609# compute LLONG_MIN and LLONG_MAX if we don't know them.
2610if test -z "$have_llong_max"; then
2611 AC_MSG_CHECKING([for max value of long long])
2612 AC_RUN_IFELSE(
2613 [AC_LANG_SOURCE([[
2614#include <stdio.h>
2615/* Why is this so damn hard? */
2616#ifdef __GNUC__
2617# undef __GNUC__
2618#endif
2619#define __USE_ISOC99
2620#include <limits.h>
2621#define DATA "conftest.llminmax"
2e437378 2622#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2623
2624/*
2625 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2626 * we do this the hard way.
2627 */
2628static int
2629fprint_ll(FILE *f, long long n)
2630{
2631 unsigned int i;
2632 int l[sizeof(long long) * 8];
2633
2634 if (n < 0)
2635 if (fprintf(f, "-") < 0)
2636 return -1;
2637 for (i = 0; n != 0; i++) {
2638 l[i] = my_abs(n % 10);
2639 n /= 10;
2640 }
2641 do {
2642 if (fprintf(f, "%d", l[--i]) < 0)
2643 return -1;
2644 } while (i != 0);
2645 if (fprintf(f, " ") < 0)
2646 return -1;
2647 return 0;
2648}
2649
e00da40d 2650int main(void) {
2651 FILE *f;
2652 long long i, llmin, llmax = 0;
2653
2654 if((f = fopen(DATA,"w")) == NULL)
2655 exit(1);
2656
2657#if defined(LLONG_MIN) && defined(LLONG_MAX)
2658 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2659 llmin = LLONG_MIN;
2660 llmax = LLONG_MAX;
2661#else
2662 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2663 /* This will work on one's complement and two's complement */
2664 for (i = 1; i > llmax; i <<= 1, i++)
2665 llmax = i;
2666 llmin = llmax + 1LL; /* wrap */
2667#endif
2668
2669 /* Sanity check */
2670 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2e437378 2671 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2672 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
e00da40d 2673 fprintf(f, "unknown unknown\n");
2674 exit(2);
2675 }
2676
2e437378 2677 if (fprint_ll(f, llmin) < 0)
e00da40d 2678 exit(3);
2e437378 2679 if (fprint_ll(f, llmax) < 0)
2680 exit(4);
2681 if (fclose(f) < 0)
2682 exit(5);
e00da40d 2683 exit(0);
2684}
2685 ]])],
2686 [
2687 llong_min=`$AWK '{print $1}' conftest.llminmax`
2688 llong_max=`$AWK '{print $2}' conftest.llminmax`
2689
e00da40d 2690 AC_MSG_RESULT($llong_max)
2691 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2692 [max value of long long calculated by configure])
2693 AC_MSG_CHECKING([for min value of long long])
2694 AC_MSG_RESULT($llong_min)
2695 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2696 [min value of long long calculated by configure])
2697 ],
2698 [
2699 AC_MSG_RESULT(not found)
2700 ],
2701 [
2702 AC_MSG_WARN([cross compiling: not checking])
2703 ]
2704 )
2705fi
2706
2707
3c0ef626 2708# More checks for data types
2709AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2710 AC_TRY_COMPILE(
416fd2a8 2711 [ #include <sys/types.h> ],
2712 [ u_int a; a = 1;],
3c0ef626 2713 [ ac_cv_have_u_int="yes" ],
2714 [ ac_cv_have_u_int="no" ]
2715 )
2716])
2717if test "x$ac_cv_have_u_int" = "xyes" ; then
e00da40d 2718 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
3c0ef626 2719 have_u_int=1
2720fi
2721
2722AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2723 AC_TRY_COMPILE(
416fd2a8 2724 [ #include <sys/types.h> ],
2725 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
3c0ef626 2726 [ ac_cv_have_intxx_t="yes" ],
2727 [ ac_cv_have_intxx_t="no" ]
2728 )
2729])
2730if test "x$ac_cv_have_intxx_t" = "xyes" ; then
e00da40d 2731 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
3c0ef626 2732 have_intxx_t=1
2733fi
2734
2735if (test -z "$have_intxx_t" && \
416fd2a8 2736 test "x$ac_cv_header_stdint_h" = "xyes")
3c0ef626 2737then
2738 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2739 AC_TRY_COMPILE(
416fd2a8 2740 [ #include <stdint.h> ],
2741 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
3c0ef626 2742 [
2743 AC_DEFINE(HAVE_INTXX_T)
2744 AC_MSG_RESULT(yes)
2745 ],
2746 [ AC_MSG_RESULT(no) ]
2747 )
2748fi
2749
2750AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2751 AC_TRY_COMPILE(
e54b3d7c 2752 [
2753#include <sys/types.h>
2754#ifdef HAVE_STDINT_H
2755# include <stdint.h>
2756#endif
2757#include <sys/socket.h>
2758#ifdef HAVE_SYS_BITYPES_H
2759# include <sys/bitypes.h>
2760#endif
416fd2a8 2761 ],
2762 [ int64_t a; a = 1;],
3c0ef626 2763 [ ac_cv_have_int64_t="yes" ],
2764 [ ac_cv_have_int64_t="no" ]
2765 )
2766])
2767if test "x$ac_cv_have_int64_t" = "xyes" ; then
e00da40d 2768 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
e9a17296 2769fi
2770
3c0ef626 2771AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2772 AC_TRY_COMPILE(
416fd2a8 2773 [ #include <sys/types.h> ],
2774 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
3c0ef626 2775 [ ac_cv_have_u_intxx_t="yes" ],
2776 [ ac_cv_have_u_intxx_t="no" ]
2777 )
2778])
2779if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
e00da40d 2780 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
3c0ef626 2781 have_u_intxx_t=1
2782fi
2783
2784if test -z "$have_u_intxx_t" ; then
2785 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2786 AC_TRY_COMPILE(
416fd2a8 2787 [ #include <sys/socket.h> ],
2788 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
3c0ef626 2789 [
2790 AC_DEFINE(HAVE_U_INTXX_T)
2791 AC_MSG_RESULT(yes)
2792 ],
2793 [ AC_MSG_RESULT(no) ]
2794 )
2795fi
2796
2797AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2798 AC_TRY_COMPILE(
416fd2a8 2799 [ #include <sys/types.h> ],
2800 [ u_int64_t a; a = 1;],
3c0ef626 2801 [ ac_cv_have_u_int64_t="yes" ],
2802 [ ac_cv_have_u_int64_t="no" ]
2803 )
2804])
2805if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
e00da40d 2806 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
3c0ef626 2807 have_u_int64_t=1
2808fi
2809
e9a17296 2810if test -z "$have_u_int64_t" ; then
2811 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2812 AC_TRY_COMPILE(
416fd2a8 2813 [ #include <sys/bitypes.h> ],
e9a17296 2814 [ u_int64_t a; a = 1],
2815 [
2816 AC_DEFINE(HAVE_U_INT64_T)
2817 AC_MSG_RESULT(yes)
2818 ],
2819 [ AC_MSG_RESULT(no) ]
2820 )
2821fi
2822
3c0ef626 2823if test -z "$have_u_intxx_t" ; then
2824 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2825 AC_TRY_COMPILE(
2826 [
2827#include <sys/types.h>
416fd2a8 2828 ],
2829 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
3c0ef626 2830 [ ac_cv_have_uintxx_t="yes" ],
2831 [ ac_cv_have_uintxx_t="no" ]
2832 )
2833 ])
2834 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
e00da40d 2835 AC_DEFINE(HAVE_UINTXX_T, 1,
2836 [define if you have uintxx_t data type])
3c0ef626 2837 fi
2838fi
2839
2840if test -z "$have_uintxx_t" ; then
2841 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2842 AC_TRY_COMPILE(
416fd2a8 2843 [ #include <stdint.h> ],
2844 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
3c0ef626 2845 [
2846 AC_DEFINE(HAVE_UINTXX_T)
2847 AC_MSG_RESULT(yes)
2848 ],
2849 [ AC_MSG_RESULT(no) ]
2850 )
2851fi
2852
2853if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
416fd2a8 2854 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
3c0ef626 2855then
2856 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2857 AC_TRY_COMPILE(
2858 [
2859#include <sys/bitypes.h>
416fd2a8 2860 ],
3c0ef626 2861 [
2862 int8_t a; int16_t b; int32_t c;
2863 u_int8_t e; u_int16_t f; u_int32_t g;
2864 a = b = c = e = f = g = 1;
416fd2a8 2865 ],
3c0ef626 2866 [
2867 AC_DEFINE(HAVE_U_INTXX_T)
2868 AC_DEFINE(HAVE_INTXX_T)
2869 AC_MSG_RESULT(yes)
2870 ],
2871 [AC_MSG_RESULT(no)]
416fd2a8 2872 )
3c0ef626 2873fi
2874
2875
2876AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2877 AC_TRY_COMPILE(
2878 [
2879#include <sys/types.h>
2880 ],
2881 [ u_char foo; foo = 125; ],
2882 [ ac_cv_have_u_char="yes" ],
2883 [ ac_cv_have_u_char="no" ]
2884 )
2885])
2886if test "x$ac_cv_have_u_char" = "xyes" ; then
e00da40d 2887 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
3c0ef626 2888fi
2889
2890TYPE_SOCKLEN_T
2891
e9a17296 2892AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
6f25cbdd 2893AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2894#include <sys/types.h>
2895#ifdef HAVE_SYS_BITYPES_H
2896#include <sys/bitypes.h>
2897#endif
2898#ifdef HAVE_SYS_STATFS_H
2899#include <sys/statfs.h>
2900#endif
2901#ifdef HAVE_SYS_STATVFS_H
2902#include <sys/statvfs.h>
2903#endif
2904])
e9a17296 2905
34fee935 2906AC_CHECK_TYPES(in_addr_t,,,
2907[#include <sys/types.h>
2908#include <netinet/in.h>])
2909
3c0ef626 2910AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2911 AC_TRY_COMPILE(
2912 [
2913#include <sys/types.h>
2914 ],
2915 [ size_t foo; foo = 1235; ],
2916 [ ac_cv_have_size_t="yes" ],
2917 [ ac_cv_have_size_t="no" ]
2918 )
2919])
2920if test "x$ac_cv_have_size_t" = "xyes" ; then
e00da40d 2921 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
3c0ef626 2922fi
2923
2924AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2925 AC_TRY_COMPILE(
2926 [
2927#include <sys/types.h>
2928 ],
2929 [ ssize_t foo; foo = 1235; ],
2930 [ ac_cv_have_ssize_t="yes" ],
2931 [ ac_cv_have_ssize_t="no" ]
2932 )
2933])
2934if test "x$ac_cv_have_ssize_t" = "xyes" ; then
e00da40d 2935 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
3c0ef626 2936fi
2937
2938AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2939 AC_TRY_COMPILE(
2940 [
2941#include <time.h>
2942 ],
2943 [ clock_t foo; foo = 1235; ],
2944 [ ac_cv_have_clock_t="yes" ],
2945 [ ac_cv_have_clock_t="no" ]
2946 )
2947])
2948if test "x$ac_cv_have_clock_t" = "xyes" ; then
e00da40d 2949 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
3c0ef626 2950fi
2951
2952AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2953 AC_TRY_COMPILE(
2954 [
2955#include <sys/types.h>
2956#include <sys/socket.h>
2957 ],
2958 [ sa_family_t foo; foo = 1235; ],
2959 [ ac_cv_have_sa_family_t="yes" ],
2960 [ AC_TRY_COMPILE(
2961 [
2962#include <sys/types.h>
2963#include <sys/socket.h>
2964#include <netinet/in.h>
2965 ],
2966 [ sa_family_t foo; foo = 1235; ],
2967 [ ac_cv_have_sa_family_t="yes" ],
2968
2969 [ ac_cv_have_sa_family_t="no" ]
2970 )]
2971 )
2972])
2973if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
e00da40d 2974 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2975 [define if you have sa_family_t data type])
3c0ef626 2976fi
2977
2978AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2979 AC_TRY_COMPILE(
2980 [
2981#include <sys/types.h>
2982 ],
2983 [ pid_t foo; foo = 1235; ],
2984 [ ac_cv_have_pid_t="yes" ],
2985 [ ac_cv_have_pid_t="no" ]
2986 )
2987])
2988if test "x$ac_cv_have_pid_t" = "xyes" ; then
e00da40d 2989 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
3c0ef626 2990fi
2991
2992AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2993 AC_TRY_COMPILE(
2994 [
2995#include <sys/types.h>
2996 ],
2997 [ mode_t foo; foo = 1235; ],
2998 [ ac_cv_have_mode_t="yes" ],
2999 [ ac_cv_have_mode_t="no" ]
3000 )
3001])
3002if test "x$ac_cv_have_mode_t" = "xyes" ; then
e00da40d 3003 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
3c0ef626 3004fi
3005
3006
3007AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
3008 AC_TRY_COMPILE(
3009 [
3010#include <sys/types.h>
3011#include <sys/socket.h>
3012 ],
3013 [ struct sockaddr_storage s; ],
3014 [ ac_cv_have_struct_sockaddr_storage="yes" ],
3015 [ ac_cv_have_struct_sockaddr_storage="no" ]
3016 )
3017])
3018if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
e00da40d 3019 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
3020 [define if you have struct sockaddr_storage data type])
3c0ef626 3021fi
3022
3023AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
3024 AC_TRY_COMPILE(
3025 [
3026#include <sys/types.h>
3027#include <netinet/in.h>
3028 ],
3029 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
3030 [ ac_cv_have_struct_sockaddr_in6="yes" ],
3031 [ ac_cv_have_struct_sockaddr_in6="no" ]
3032 )
3033])
3034if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
e00da40d 3035 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
3036 [define if you have struct sockaddr_in6 data type])
3c0ef626 3037fi
3038
3039AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
3040 AC_TRY_COMPILE(
3041 [
3042#include <sys/types.h>
3043#include <netinet/in.h>
3044 ],
3045 [ struct in6_addr s; s.s6_addr[0] = 0; ],
3046 [ ac_cv_have_struct_in6_addr="yes" ],
3047 [ ac_cv_have_struct_in6_addr="no" ]
3048 )
3049])
3050if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
e00da40d 3051 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
3052 [define if you have struct in6_addr data type])
3c0ef626 3053fi
3054
3055AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
3056 AC_TRY_COMPILE(
3057 [
3058#include <sys/types.h>
3059#include <sys/socket.h>
3060#include <netdb.h>
3061 ],
3062 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
3063 [ ac_cv_have_struct_addrinfo="yes" ],
3064 [ ac_cv_have_struct_addrinfo="no" ]
3065 )
3066])
3067if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
e00da40d 3068 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
3069 [define if you have struct addrinfo data type])
3c0ef626 3070fi
3071
3072AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
3073 AC_TRY_COMPILE(
416fd2a8 3074 [ #include <sys/time.h> ],
3075 [ struct timeval tv; tv.tv_sec = 1;],
3c0ef626 3076 [ ac_cv_have_struct_timeval="yes" ],
3077 [ ac_cv_have_struct_timeval="no" ]
3078 )
3079])
3080if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
e00da40d 3081 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
3c0ef626 3082 have_struct_timeval=1
3083fi
3084
1c14df9e 3085AC_CHECK_TYPES(struct timespec)
3086
3087# We need int64_t or else certian parts of the compile will fail.
34fee935 3088if test "x$ac_cv_have_int64_t" = "xno" && \
3089 test "x$ac_cv_sizeof_long_int" != "x8" && \
3090 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1c14df9e 3091 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3092 echo "an alternative compiler (I.E., GCC) before continuing."
3093 echo ""
3094 exit 1;
3c0ef626 3095else
3096dnl test snprintf (broken on SCO w/gcc)
34fee935 3097 AC_RUN_IFELSE(
3098 [AC_LANG_SOURCE([[
3c0ef626 3099#include <stdio.h>
3100#include <string.h>
3101#ifdef HAVE_SNPRINTF
3102main()
3103{
3104 char buf[50];
3105 char expected_out[50];
3106 int mazsize = 50 ;
3107#if (SIZEOF_LONG_INT == 8)
3108 long int num = 0x7fffffffffffffff;
3109#else
3110 long long num = 0x7fffffffffffffffll;
3111#endif
3112 strcpy(expected_out, "9223372036854775807");
3113 snprintf(buf, mazsize, "%lld", num);
3114 if(strcmp(buf, expected_out) != 0)
416fd2a8 3115 exit(1);
3c0ef626 3116 exit(0);
3117}
3118#else
3119main() { exit(0); }
3120#endif
34fee935 3121 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
3122 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
3c0ef626 3123 )
3124fi
3c0ef626 3125
3126dnl Checks for structure members
3127OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3128OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3129OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3130OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3131OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
3132OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
3133OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3134OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
3135OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
3136OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3137OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3138OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3139OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3140OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3141OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3142OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3143OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3144
3145AC_CHECK_MEMBERS([struct stat.st_blksize])
e00da40d 3146AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3147 [Define if we don't have struct __res_state in resolv.h])],
3148[
3149#include <stdio.h>
3150#if HAVE_SYS_TYPES_H
3151# include <sys/types.h>
3152#endif
3153#include <netinet/in.h>
3154#include <arpa/nameser.h>
3155#include <resolv.h>
3156])
3c0ef626 3157
3158AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3159 ac_cv_have_ss_family_in_struct_ss, [
3160 AC_TRY_COMPILE(
3161 [
3162#include <sys/types.h>
3163#include <sys/socket.h>
3164 ],
3165 [ struct sockaddr_storage s; s.ss_family = 1; ],
3166 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3167 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3168 )
3169])
3170if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
e00da40d 3171 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3c0ef626 3172fi
3173
3174AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3175 ac_cv_have___ss_family_in_struct_ss, [
3176 AC_TRY_COMPILE(
3177 [
3178#include <sys/types.h>
3179#include <sys/socket.h>
3180 ],
3181 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3182 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3183 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3184 )
3185])
3186if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
e00da40d 3187 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3188 [Fields in struct sockaddr_storage])
3c0ef626 3189fi
3190
3191AC_CACHE_CHECK([for pw_class field in struct passwd],
3192 ac_cv_have_pw_class_in_struct_passwd, [
3193 AC_TRY_COMPILE(
3194 [
3195#include <pwd.h>
3196 ],
3197 [ struct passwd p; p.pw_class = 0; ],
3198 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3199 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3200 )
3201])
3202if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
e00da40d 3203 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3204 [Define if your password has a pw_class field])
3c0ef626 3205fi
3206
3207AC_CACHE_CHECK([for pw_expire field in struct passwd],
3208 ac_cv_have_pw_expire_in_struct_passwd, [
3209 AC_TRY_COMPILE(
3210 [
3211#include <pwd.h>
3212 ],
3213 [ struct passwd p; p.pw_expire = 0; ],
3214 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3215 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3216 )
3217])
3218if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
e00da40d 3219 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3220 [Define if your password has a pw_expire field])
3c0ef626 3221fi
3222
3223AC_CACHE_CHECK([for pw_change field in struct passwd],
3224 ac_cv_have_pw_change_in_struct_passwd, [
3225 AC_TRY_COMPILE(
3226 [
3227#include <pwd.h>
3228 ],
3229 [ struct passwd p; p.pw_change = 0; ],
3230 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3231 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3232 )
3233])
3234if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
e00da40d 3235 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3236 [Define if your password has a pw_change field])
3c0ef626 3237fi
3238
078f71c2 3239dnl make sure we're using the real structure members and not defines
2980ea68 3240AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3241 ac_cv_have_accrights_in_msghdr, [
34fee935 3242 AC_COMPILE_IFELSE(
2980ea68 3243 [
3244#include <sys/types.h>
3245#include <sys/socket.h>
3246#include <sys/uio.h>
078f71c2 3247int main() {
3248#ifdef msg_accrights
34fee935 3249#error "msg_accrights is a macro"
078f71c2 3250exit(1);
3251#endif
3252struct msghdr m;
3253m.msg_accrights = 0;
3254exit(0);
3255}
2980ea68 3256 ],
2980ea68 3257 [ ac_cv_have_accrights_in_msghdr="yes" ],
3258 [ ac_cv_have_accrights_in_msghdr="no" ]
3259 )
3260])
3261if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
e00da40d 3262 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3263 [Define if your system uses access rights style
3264 file descriptor passing])
2980ea68 3265fi
3266
6f25cbdd 3267AC_MSG_CHECKING(if f_fsid has val members)
3268AC_TRY_COMPILE([
3269#include <sys/types.h>
3270#include <sys/statvfs.h>],
3271[struct fsid_t t; t.val[0] = 0;],
3272 [ AC_MSG_RESULT(yes)
3273 AC_DEFINE(FSID_HAS_VAL, 1, f_fsid has members) ],
3274 [ AC_MSG_RESULT(no) ]
3275)
3276
2980ea68 3277AC_CACHE_CHECK([for msg_control field in struct msghdr],
3278 ac_cv_have_control_in_msghdr, [
34fee935 3279 AC_COMPILE_IFELSE(
2980ea68 3280 [
3281#include <sys/types.h>
3282#include <sys/socket.h>
3283#include <sys/uio.h>
078f71c2 3284int main() {
3285#ifdef msg_control
34fee935 3286#error "msg_control is a macro"
078f71c2 3287exit(1);
3288#endif
3289struct msghdr m;
3290m.msg_control = 0;
3291exit(0);
3292}
2980ea68 3293 ],
2980ea68 3294 [ ac_cv_have_control_in_msghdr="yes" ],
3295 [ ac_cv_have_control_in_msghdr="no" ]
3296 )
3297])
3298if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
e00da40d 3299 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3300 [Define if your system uses ancillary data style
3301 file descriptor passing])
2980ea68 3302fi
3303
3c0ef626 3304AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
416fd2a8 3305 AC_TRY_LINK([],
3306 [ extern char *__progname; printf("%s", __progname); ],
3c0ef626 3307 [ ac_cv_libc_defines___progname="yes" ],
3308 [ ac_cv_libc_defines___progname="no" ]
3309 )
3310])
3311if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
e00da40d 3312 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3c0ef626 3313fi
3314
2980ea68 3315AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3316 AC_TRY_LINK([
3317#include <stdio.h>
416fd2a8 3318],
3319 [ printf("%s", __FUNCTION__); ],
2980ea68 3320 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3321 [ ac_cv_cc_implements___FUNCTION__="no" ]
3322 )
3323])
3324if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
e00da40d 3325 AC_DEFINE(HAVE___FUNCTION__, 1,
3326 [Define if compiler implements __FUNCTION__])
2980ea68 3327fi
3328
3329AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3330 AC_TRY_LINK([
3331#include <stdio.h>
416fd2a8 3332],
3333 [ printf("%s", __func__); ],
2980ea68 3334 [ ac_cv_cc_implements___func__="yes" ],
3335 [ ac_cv_cc_implements___func__="no" ]
3336 )
3337])
3338if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
e00da40d 3339 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3340fi
3341
3342AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3343 AC_TRY_LINK(
3344 [#include <stdarg.h>
3345 va_list x,y;],
3346 [va_copy(x,y);],
3347 [ ac_cv_have_va_copy="yes" ],
3348 [ ac_cv_have_va_copy="no" ]
3349 )
3350])
3351if test "x$ac_cv_have_va_copy" = "xyes" ; then
3352 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3353fi
3354
3355AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3356 AC_TRY_LINK(
3357 [#include <stdarg.h>
3358 va_list x,y;],
3359 [__va_copy(x,y);],
3360 [ ac_cv_have___va_copy="yes" ],
3361 [ ac_cv_have___va_copy="no" ]
3362 )
3363])
3364if test "x$ac_cv_have___va_copy" = "xyes" ; then
3365 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2980ea68 3366fi
3367
3c0ef626 3368AC_CACHE_CHECK([whether getopt has optreset support],
3369 ac_cv_have_getopt_optreset, [
3370 AC_TRY_LINK(
3371 [
3372#include <getopt.h>
3373 ],
3374 [ extern int optreset; optreset = 0; ],
3375 [ ac_cv_have_getopt_optreset="yes" ],
3376 [ ac_cv_have_getopt_optreset="no" ]
3377 )
3378])
3379if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
e00da40d 3380 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3381 [Define if your getopt(3) defines and uses optreset])
3c0ef626 3382fi
3383
3384AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
416fd2a8 3385 AC_TRY_LINK([],
3386 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3c0ef626 3387 [ ac_cv_libc_defines_sys_errlist="yes" ],
3388 [ ac_cv_libc_defines_sys_errlist="no" ]
3389 )
3390])
3391if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
e00da40d 3392 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3393 [Define if your system defines sys_errlist[]])
3c0ef626 3394fi
3395
3396
3397AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
416fd2a8 3398 AC_TRY_LINK([],
3399 [ extern int sys_nerr; printf("%i", sys_nerr);],
3c0ef626 3400 [ ac_cv_libc_defines_sys_nerr="yes" ],
3401 [ ac_cv_libc_defines_sys_nerr="no" ]
3402 )
3403])
3404if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
e00da40d 3405 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3c0ef626 3406fi
3407
416fd2a8 3408SCARD_MSG="no"
2980ea68 3409# Check whether user wants sectok support
3410AC_ARG_WITH(sectok,
3411 [ --with-sectok Enable smartcard support using libsectok],
3c0ef626 3412 [
3413 if test "x$withval" != "xno" ; then
3414 if test "x$withval" != "xyes" ; then
3415 CPPFLAGS="$CPPFLAGS -I${withval}"
3416 LDFLAGS="$LDFLAGS -L${withval}"
3417 if test ! -z "$need_dash_r" ; then
3418 LDFLAGS="$LDFLAGS -R${withval}"
3419 fi
3420 if test ! -z "$blibpath" ; then
3421 blibpath="$blibpath:${withval}"
3422 fi
3423 fi
3424 AC_CHECK_HEADERS(sectok.h)
3425 if test "$ac_cv_header_sectok_h" != yes; then
3426 AC_MSG_ERROR(Can't find sectok.h)
3427 fi
3428 AC_CHECK_LIB(sectok, sectok_open)
3429 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3430 AC_MSG_ERROR(Can't find libsectok)
3431 fi
e00da40d 3432 AC_DEFINE(SMARTCARD, 1,
3433 [Define if you want smartcard support])
3434 AC_DEFINE(USE_SECTOK, 1,
3435 [Define if you want smartcard support
3436 using sectok])
416fd2a8 3437 SCARD_MSG="yes, using sectok"
3c0ef626 3438 fi
3439 ]
3440)
3441
2980ea68 3442# Check whether user wants OpenSC support
34fee935 3443OPENSC_CONFIG="no"
2980ea68 3444AC_ARG_WITH(opensc,
e00da40d 3445 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
34fee935 3446 [
3447 if test "x$withval" != "xno" ; then
3448 if test "x$withval" != "xyes" ; then
3449 OPENSC_CONFIG=$withval/bin/opensc-config
3450 else
3451 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3452 fi
3453 if test "$OPENSC_CONFIG" != "no"; then
3454 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3455 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3456 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2e437378 3457 LIBS="$LIBS $LIBOPENSC_LIBS"
34fee935 3458 AC_DEFINE(SMARTCARD)
e00da40d 3459 AC_DEFINE(USE_OPENSC, 1,
3460 [Define if you want smartcard support
3461 using OpenSC])
34fee935 3462 SCARD_MSG="yes, using OpenSC"
3463 fi
3464 fi
3465 ]
3466)
2980ea68 3467
416fd2a8 3468# Check libraries needed by DNS fingerprint support
3469AC_SEARCH_LIBS(getrrsetbyname, resolv,
e00da40d 3470 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3471 [Define if getrrsetbyname() exists])],
70791e56 3472 [
416fd2a8 3473 # Needed by our getrrsetbyname()
3474 AC_SEARCH_LIBS(res_query, resolv)
3475 AC_SEARCH_LIBS(dn_expand, resolv)
1b56ff3d 3476 AC_MSG_CHECKING(if res_query will link)
3477 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3478 [AC_MSG_RESULT(no)
3479 saved_LIBS="$LIBS"
3480 LIBS="$LIBS -lresolv"
3481 AC_MSG_CHECKING(for res_query in -lresolv)
3482 AC_LINK_IFELSE([
3483#include <resolv.h>
3484int main()
3485{
3486 res_query (0, 0, 0, 0, 0);
3487 return 0;
3488}
3489 ],
3490 [LIBS="$LIBS -lresolv"
3491 AC_MSG_RESULT(yes)],
3492 [LIBS="$saved_LIBS"
3493 AC_MSG_RESULT(no)])
3494 ])
416fd2a8 3495 AC_CHECK_FUNCS(_getshort _getlong)
34fee935 3496 AC_CHECK_DECLS([_getshort, _getlong], , ,
3497 [#include <sys/types.h>
3498 #include <arpa/nameser.h>])
416fd2a8 3499 AC_CHECK_MEMBER(HEADER.ad,
e00da40d 3500 [AC_DEFINE(HAVE_HEADER_AD, 1,
3501 [Define if HEADER.ad exists in arpa/nameser.h])],,
416fd2a8 3502 [#include <arpa/nameser.h>])
3503 ])
70791e56 3504
25d429a2 3505AC_MSG_CHECKING(if struct __res_state _res is an extern)
3506AC_LINK_IFELSE([
3507#include <stdio.h>
3508#if HAVE_SYS_TYPES_H
3509# include <sys/types.h>
3510#endif
3511#include <netinet/in.h>
3512#include <arpa/nameser.h>
3513#include <resolv.h>
3514extern struct __res_state _res;
3515int main() { return 0; }
3516 ],
3517 [AC_MSG_RESULT(yes)
3518 AC_DEFINE(HAVE__RES_EXTERN, 1,
3519 [Define if you have struct __res_state _res as an extern])
3520 ],
3521 [ AC_MSG_RESULT(no) ]
3522)
3523
2e437378 3524# Check whether user wants SELinux support
3525SELINUX_MSG="no"
3526LIBSELINUX=""
3527AC_ARG_WITH(selinux,
bd5d5d2a 3528 [ --with-selinux Enable SELinux support],
2e437378 3529 [ if test "x$withval" != "xno" ; then
25d429a2 3530 save_LIBS="$LIBS"
2e437378 3531 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3532 SELINUX_MSG="yes"
3533 AC_CHECK_HEADER([selinux/selinux.h], ,
3534 AC_MSG_ERROR(SELinux support requires selinux.h header))
3535 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3536 AC_MSG_ERROR(SELinux support requires libselinux library))
25d429a2 3537 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
2e437378 3538 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3539 LIBS="$save_LIBS"
3540 fi ]
3541)
2e437378 3542
d905e828 3543# Check whether user wants Kerberos 5 support
416fd2a8 3544KRB5_MSG="no"
d905e828 3545AC_ARG_WITH(kerberos5,
416fd2a8 3546 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3547 [ if test "x$withval" != "xno" ; then
3548 if test "x$withval" = "xyes" ; then
3549 KRB5ROOT="/usr/local"
3550 else
3551 KRB5ROOT=${withval}
3552 fi
3553
e00da40d 3554 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
416fd2a8 3555 KRB5_MSG="yes"
3556
3557 AC_MSG_CHECKING(for krb5-config)
3558 if test -x $KRB5ROOT/bin/krb5-config ; then
3559 KRB5CONF=$KRB5ROOT/bin/krb5-config
3560 AC_MSG_RESULT($KRB5CONF)
3561
3562 AC_MSG_CHECKING(for gssapi support)
3563 if $KRB5CONF | grep gssapi >/dev/null ; then
3564 AC_MSG_RESULT(yes)
e00da40d 3565 AC_DEFINE(GSSAPI, 1,
3566 [Define this if you want GSSAPI
3567 support in the version 2 protocol])
416fd2a8 3568 k5confopts=gssapi
3569 else
3570 AC_MSG_RESULT(no)
3571 k5confopts=""
3572 fi
3573 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3574 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3575 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3576 AC_MSG_CHECKING(whether we are using Heimdal)
3577 AC_TRY_COMPILE([ #include <krb5.h> ],
3578 [ char *tmp = heimdal_version; ],
3579 [ AC_MSG_RESULT(yes)
e00da40d 3580 AC_DEFINE(HEIMDAL, 1,
3581 [Define this if you are using the
3582 Heimdal version of Kerberos V5]) ],
416fd2a8 3583 AC_MSG_RESULT(no)
3584 )
3585 else
3586 AC_MSG_RESULT(no)
d905e828 3587 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
416fd2a8 3588 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3589 AC_MSG_CHECKING(whether we are using Heimdal)
3590 AC_TRY_COMPILE([ #include <krb5.h> ],
3591 [ char *tmp = heimdal_version; ],
3592 [ AC_MSG_RESULT(yes)
3593 AC_DEFINE(HEIMDAL)
1b56ff3d 3594 K5LIBS="-lkrb5 -ldes"
3595 K5LIBS="$K5LIBS -lcom_err -lasn1"
34fee935 3596 AC_CHECK_LIB(roken, net_write,
1b56ff3d 3597 [K5LIBS="$K5LIBS -lroken"])
416fd2a8 3598 ],
3599 [ AC_MSG_RESULT(no)
3600 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3601 ]
3602 )
70791e56 3603 AC_SEARCH_LIBS(dn_expand, resolv)
3604
6f25cbdd 3605 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
70791e56 3606 [ AC_DEFINE(GSSAPI)
6f25cbdd 3607 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3608 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
70791e56 3609 [ AC_DEFINE(GSSAPI)
6f25cbdd 3610 K5LIBS="-lgssapi $K5LIBS" ],
70791e56 3611 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3612 $K5LIBS)
3613 ],
3614 $K5LIBS)
34fee935 3615
70791e56 3616 AC_CHECK_HEADER(gssapi.h, ,
3617 [ unset ac_cv_header_gssapi_h
416fd2a8 3618 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
70791e56 3619 AC_CHECK_HEADERS(gssapi.h, ,
3620 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
416fd2a8 3621 )
70791e56 3622 ]
3623 )
3624
3625 oldCPP="$CPPFLAGS"
3626 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3627 AC_CHECK_HEADER(gssapi_krb5.h, ,
3628 [ CPPFLAGS="$oldCPP" ])
d905e828 3629
c2397a66 3630 # If we're using some other GSSAPI
3631 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3632 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
3633 fi
d905e828 3634
416fd2a8 3635 if test -z "$GSSAPI"; then
3636 GSSAPI="KRB5";
3637 fi
c2397a66 3638
d905e828 3639 oldCPP="$CPPFLAGS"
3640 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3641 AC_CHECK_HEADER(gssapi_krb5.h, ,
3642 [ CPPFLAGS="$oldCPP" ])
3643
d905e828 3644 fi
416fd2a8 3645 if test ! -z "$need_dash_r" ; then
3646 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3647 fi
3648 if test ! -z "$blibpath" ; then
3649 blibpath="$blibpath:${KRB5ROOT}/lib"
3650 fi
416fd2a8 3651
e00da40d 3652 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3653 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3654 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
416fd2a8 3655
e00da40d 3656 LIBS="$LIBS $K5LIBS"
3657 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3658 [Define this if you want to use libkafs' AFS support]))
3659 fi
416fd2a8 3660 ]
d905e828 3661)
3c0ef626 3662
f2fd21a2 3663# Check whether user wants AFS_KRB5 support
3664AFS_KRB5_MSG="no"
3665AC_ARG_WITH(afs-krb5,
3666 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
3667 [
3668 if test "x$withval" != "xno" ; then
3669
3670 if test "x$withval" != "xyes" ; then
e00da40d 3671 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3672 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
f2fd21a2 3673 else
e00da40d 3674 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3675 "/usr/bin/aklog",
3676 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
f2fd21a2 3677 fi
3678
416fd2a8 3679 if test -z "$KRB5ROOT" ; then
f2fd21a2 3680 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3681 fi
3682
2a304a95 3683 LIBS="-lkrbafs -lkrb4 $LIBS"
f2fd21a2 3684 if test ! -z "$AFS_LIBS" ; then
3685 LIBS="$LIBS $AFS_LIBS"
3686 fi
e00da40d 3687 AC_DEFINE(AFS_KRB5, 1,
3688 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
f2fd21a2 3689 AFS_KRB5_MSG="yes"
3690 fi
3691 ]
3692)
3c0ef626 3693
88928908 3694AC_ARG_WITH(session-hooks,
3695 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
e00da40d 3696 [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
88928908 3697)
3698
3c0ef626 3699# Looking for programs, paths and files
3c0ef626 3700
2980ea68 3701PRIVSEP_PATH=/var/empty
3702AC_ARG_WITH(privsep-path,
e54b3d7c 3703 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2980ea68 3704 [
34fee935 3705 if test -n "$withval" && test "x$withval" != "xno" && \
3706 test "x${withval}" != "xyes"; then
2980ea68 3707 PRIVSEP_PATH=$withval
3708 fi
3709 ]
3710)
3711AC_SUBST(PRIVSEP_PATH)
3712
3c0ef626 3713AC_ARG_WITH(xauth,
3714 [ --with-xauth=PATH Specify path to xauth program ],
3715 [
34fee935 3716 if test -n "$withval" && test "x$withval" != "xno" && \
3717 test "x${withval}" != "xyes"; then
3c0ef626 3718 xauth_path=$withval
3719 fi
3720 ],
3721 [
e54b3d7c 3722 TestPath="$PATH"
3723 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3724 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3725 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3726 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3727 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3c0ef626 3728 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3729 xauth_path="/usr/openwin/bin/xauth"
3730 fi
3731 ]
3732)
3733
6f25cbdd 3734# strip causes problems with GSI libraries...
3735if test -z "$GSI_LIBS" ; then
1c14df9e 3736STRIP_OPT=-s
6f25cbdd 3737fi
1c14df9e 3738AC_ARG_ENABLE(strip,
3739 [ --disable-strip Disable calling strip(1) on install],
3740 [
3741 if test "x$enableval" = "xno" ; then
3742 STRIP_OPT=
3743 fi
3744 ]
3745)
3746AC_SUBST(STRIP_OPT)
3747
3c0ef626 3748if test -z "$xauth_path" ; then
3749 XAUTH_PATH="undefined"
3750 AC_SUBST(XAUTH_PATH)
3751else
e00da40d 3752 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3753 [Define if xauth is found in your path])
3c0ef626 3754 XAUTH_PATH=$xauth_path
3755 AC_SUBST(XAUTH_PATH)
3756fi
3c0ef626 3757
3758# Check for mail directory (last resort if we cannot get it from headers)
3759if test ! -z "$MAIL" ; then
3760 maildir=`dirname $MAIL`
e00da40d 3761 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3762 [Set this to your mail directory if you don't have maillock.h])
3c0ef626 3763fi
3764
34fee935 3765if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3766 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3767 disable_ptmx_check=yes
3768fi
3c0ef626 3769if test -z "$no_dev_ptmx" ; then
2980ea68 3770 if test "x$disable_ptmx_check" != "xyes" ; then
416fd2a8 3771 AC_CHECK_FILE("/dev/ptmx",
2980ea68 3772 [
e00da40d 3773 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3774 [Define if you have /dev/ptmx])
2980ea68 3775 have_dev_ptmx=1
3776 ]
3777 )
3778 fi
3c0ef626 3779fi
34fee935 3780
3781if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3782 AC_CHECK_FILE("/dev/ptc",
3783 [
e00da40d 3784 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3785 [Define if you have /dev/ptc])
34fee935 3786 have_dev_ptc=1
3787 ]
3788 )
3789else
3790 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3791fi
3c0ef626 3792
3793# Options from here on. Some of these are preset by platform above
3c0ef626 3794AC_ARG_WITH(mantype,
3795 [ --with-mantype=man|cat|doc Set man page type],
3796 [
3797 case "$withval" in
3798 man|cat|doc)
3799 MANTYPE=$withval
3800 ;;
3801 *)
3802 AC_MSG_ERROR(invalid man type: $withval)
3803 ;;
3804 esac
3805 ]
3806)
3807if test -z "$MANTYPE"; then
e54b3d7c 3808 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3809 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3c0ef626 3810 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3811 MANTYPE=doc
3812 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3813 MANTYPE=man
3814 else
3815 MANTYPE=cat
3816 fi
3817fi
3818AC_SUBST(MANTYPE)
3819if test "$MANTYPE" = "doc"; then
3820 mansubdir=man;
3821else
3822 mansubdir=$MANTYPE;
3823fi
3824AC_SUBST(mansubdir)
3825
3826# Check whether to enable MD5 passwords
416fd2a8 3827MD5_MSG="no"
3c0ef626 3828AC_ARG_WITH(md5-passwords,
3829 [ --with-md5-passwords Enable use of MD5 passwords],
3830 [
3831 if test "x$withval" != "xno" ; then
e00da40d 3832 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3833 [Define if you want to allow MD5 passwords])
416fd2a8 3834 MD5_MSG="yes"
3c0ef626 3835 fi
3836 ]
3837)
3838
3839# Whether to disable shadow password support
3840AC_ARG_WITH(shadow,
3841 [ --without-shadow Disable shadow password support],
3842 [
34fee935 3843 if test "x$withval" = "xno" ; then
3c0ef626 3844 AC_DEFINE(DISABLE_SHADOW)
3845 disable_shadow=yes
3846 fi
3847 ]
3848)
3849
3850if test -z "$disable_shadow" ; then
3851 AC_MSG_CHECKING([if the systems has expire shadow information])
3852 AC_TRY_COMPILE(
3853 [
3854#include <sys/types.h>
3855#include <shadow.h>
3856 struct spwd sp;
3857 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3858 [ sp_expire_available=yes ], []
3859 )
3860
3861 if test "x$sp_expire_available" = "xyes" ; then
3862 AC_MSG_RESULT(yes)
e00da40d 3863 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3864 [Define if you want to use shadow password expire field])
3c0ef626 3865 else
3866 AC_MSG_RESULT(no)
3867 fi
3868fi
3869
3870# Use ip address instead of hostname in $DISPLAY
3871if test ! -z "$IPADDR_IN_DISPLAY" ; then
3872 DISPLAY_HACK_MSG="yes"
e00da40d 3873 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3874 [Define if you need to use IP address
3875 instead of hostname in $DISPLAY])
3c0ef626 3876else
416fd2a8 3877 DISPLAY_HACK_MSG="no"
3c0ef626 3878 AC_ARG_WITH(ipaddr-display,
3879 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3880 [
34fee935 3881 if test "x$withval" != "xno" ; then
3c0ef626 3882 AC_DEFINE(IPADDR_IN_DISPLAY)
416fd2a8 3883 DISPLAY_HACK_MSG="yes"
3c0ef626 3884 fi
3885 ]
3886 )
3887fi
3888
70791e56 3889# check for /etc/default/login and use it if present.
3890AC_ARG_ENABLE(etc-default-login,
34fee935 3891 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3892 [ if test "x$enableval" = "xno"; then
3893 AC_MSG_NOTICE([/etc/default/login handling disabled])
3894 etc_default_login=no
3895 else
3896 etc_default_login=yes
3897 fi ],
e00da40d 3898 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3899 then
3900 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3901 etc_default_login=no
3902 else
3903 etc_default_login=yes
3904 fi ]
34fee935 3905)
3906
3907if test "x$etc_default_login" != "xno"; then
3908 AC_CHECK_FILE("/etc/default/login",
3909 [ external_path_file=/etc/default/login ])
e00da40d 3910 if test "x$external_path_file" = "x/etc/default/login"; then
3911 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3912 [Define if your system has /etc/default/login])
34fee935 3913 fi
70791e56 3914fi
70791e56 3915
2980ea68 3916dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
34fee935 3917if test $ac_cv_func_login_getcapbool = "yes" && \
3918 test $ac_cv_header_login_cap_h = "yes" ; then
70791e56 3919 external_path_file=/etc/login.conf
2980ea68 3920fi
70791e56 3921
3c0ef626 3922# Whether to mess with the default path
416fd2a8 3923SERVER_PATH_MSG="(default)"
3c0ef626 3924AC_ARG_WITH(default-path,
2980ea68 3925 [ --with-default-path= Specify default \$PATH environment for server],
3c0ef626 3926 [
70791e56 3927 if test "x$external_path_file" = "x/etc/login.conf" ; then
2980ea68 3928 AC_MSG_WARN([
3929--with-default-path=PATH has no effect on this system.
3930Edit /etc/login.conf instead.])
34fee935 3931 elif test "x$withval" != "xno" ; then
70791e56 3932 if test ! -z "$external_path_file" ; then
3933 AC_MSG_WARN([
3934--with-default-path=PATH will only be used if PATH is not defined in
3935$external_path_file .])
3936 fi
3c0ef626 3937 user_path="$withval"
416fd2a8 3938 SERVER_PATH_MSG="$withval"
3c0ef626 3939 fi
3940 ],
70791e56 3941 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3942 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2980ea68 3943 else
70791e56 3944 if test ! -z "$external_path_file" ; then
3945 AC_MSG_WARN([
3946If PATH is defined in $external_path_file, ensure the path to scp is included,
3947otherwise scp will not work.])
3948 fi
e00da40d 3949 AC_RUN_IFELSE(
3950 [AC_LANG_SOURCE([[
3c0ef626 3951/* find out what STDPATH is */
3952#include <stdio.h>
3953#ifdef HAVE_PATHS_H
3954# include <paths.h>
3955#endif
3956#ifndef _PATH_STDPATH
1c14df9e 3957# ifdef _PATH_USERPATH /* Irix */
3958# define _PATH_STDPATH _PATH_USERPATH
3959# else
3960# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3961# endif
3c0ef626 3962#endif
3963#include <sys/types.h>
3964#include <sys/stat.h>
3965#include <fcntl.h>
3966#define DATA "conftest.stdpath"
3967
3968main()
3969{
3970 FILE *fd;
3971 int rc;
34fee935 3972
3c0ef626 3973 fd = fopen(DATA,"w");
3974 if(fd == NULL)
3975 exit(1);
34fee935 3976
3c0ef626 3977 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3978 exit(1);
3979
3980 exit(0);
3981}
e00da40d 3982 ]])],
3983 [ user_path=`cat conftest.stdpath` ],
3c0ef626 3984 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3985 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3986 )
131757f3 3987 fi ]
3988)
70791e56 3989if test "x$external_path_file" != "x/etc/login.conf" ; then
e00da40d 3990 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
2980ea68 3991 AC_SUBST(user_path)
3992fi
3993
3994# Set superuser path separately to user path
3995AC_ARG_WITH(superuser-path,
3996 [ --with-superuser-path= Specify different path for super-user],
3997 [
34fee935 3998 if test -n "$withval" && test "x$withval" != "xno" && \
3999 test "x${withval}" != "xyes"; then
e00da40d 4000 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
4001 [Define if you want a different $PATH
4002 for the superuser])
2980ea68 4003 superuser_path=$withval
4004 fi
3c0ef626 4005 ]
4006)
2980ea68 4007
3c0ef626 4008
3c0ef626 4009AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
416fd2a8 4010IPV4_IN6_HACK_MSG="no"
3c0ef626 4011AC_ARG_WITH(4in6,
4012 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4013 [
4014 if test "x$withval" != "xno" ; then
4015 AC_MSG_RESULT(yes)
e00da40d 4016 AC_DEFINE(IPV4_IN_IPV6, 1,
4017 [Detect IPv4 in IPv6 mapped addresses
4018 and treat as IPv4])
416fd2a8 4019 IPV4_IN6_HACK_MSG="yes"
3c0ef626 4020 else
4021 AC_MSG_RESULT(no)
4022 fi
4023 ],[
4024 if test "x$inet6_default_4in6" = "xyes"; then
4025 AC_MSG_RESULT([yes (default)])
4026 AC_DEFINE(IPV4_IN_IPV6)
416fd2a8 4027 IPV4_IN6_HACK_MSG="yes"
3c0ef626 4028 else
4029 AC_MSG_RESULT([no (default)])
4030 fi
4031 ]
4032)
4033
4034# Whether to enable BSD auth support
e9a17296 4035BSD_AUTH_MSG=no
3c0ef626 4036AC_ARG_WITH(bsd-auth,
4037 [ --with-bsd-auth Enable BSD auth support],
4038 [
34fee935 4039 if test "x$withval" != "xno" ; then
e00da40d 4040 AC_DEFINE(BSD_AUTH, 1,
4041 [Define if you have BSD auth support])
e9a17296 4042 BSD_AUTH_MSG=yes
3c0ef626 4043 fi
4044 ]
4045)
4046
34fee935 4047# Where to place sshd.pid
4048piddir=/var/run
4049# make sure the directory exists
4050if test ! -d $piddir ; then
4051 piddir=`eval echo ${sysconfdir}`
4052 case $piddir in
4053 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
4054 esac
4055fi
4056
4057AC_ARG_WITH(pid-dir,
4058 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4059 [
4060 if test -n "$withval" && test "x$withval" != "xno" && \
4061 test "x${withval}" != "xyes"; then
4062 piddir=$withval
4063 if test ! -d $piddir ; then
4064 AC_MSG_WARN([** no $piddir directory on this system **])
4065 fi
4066 fi
4067 ]
4068)
4069
e00da40d 4070AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
34fee935 4071AC_SUBST(piddir)
4072
3c0ef626 4073dnl allow user to disable some login recording features
4074AC_ARG_ENABLE(lastlog,
4075 [ --disable-lastlog disable use of lastlog even if detected [no]],
70791e56 4076 [
4077 if test "x$enableval" = "xno" ; then
4078 AC_DEFINE(DISABLE_LASTLOG)
4079 fi
4080 ]
3c0ef626 4081)
4082AC_ARG_ENABLE(utmp,
4083 [ --disable-utmp disable use of utmp even if detected [no]],
70791e56 4084 [
4085 if test "x$enableval" = "xno" ; then
4086 AC_DEFINE(DISABLE_UTMP)
4087 fi
4088 ]
3c0ef626 4089)
4090AC_ARG_ENABLE(utmpx,
4091 [ --disable-utmpx disable use of utmpx even if detected [no]],
70791e56 4092 [
4093 if test "x$enableval" = "xno" ; then
e00da40d 4094 AC_DEFINE(DISABLE_UTMPX, 1,
4095 [Define if you don't want to use utmpx])
70791e56 4096 fi
4097 ]
3c0ef626 4098)
4099AC_ARG_ENABLE(wtmp,
4100 [ --disable-wtmp disable use of wtmp even if detected [no]],
70791e56 4101 [
4102 if test "x$enableval" = "xno" ; then
4103 AC_DEFINE(DISABLE_WTMP)
4104 fi
4105 ]
3c0ef626 4106)
4107AC_ARG_ENABLE(wtmpx,
4108 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
70791e56 4109 [
4110 if test "x$enableval" = "xno" ; then
e00da40d 4111 AC_DEFINE(DISABLE_WTMPX, 1,
4112 [Define if you don't want to use wtmpx])
70791e56 4113 fi
4114 ]
3c0ef626 4115)
4116AC_ARG_ENABLE(libutil,
4117 [ --disable-libutil disable use of libutil (login() etc.) [no]],
70791e56 4118 [
4119 if test "x$enableval" = "xno" ; then
4120 AC_DEFINE(DISABLE_LOGIN)
4121 fi
4122 ]
3c0ef626 4123)
4124AC_ARG_ENABLE(pututline,
4125 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
70791e56 4126 [
4127 if test "x$enableval" = "xno" ; then
e00da40d 4128 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4129 [Define if you don't want to use pututline()
4130 etc. to write [uw]tmp])
70791e56 4131 fi
4132 ]
3c0ef626 4133)
4134AC_ARG_ENABLE(pututxline,
4135 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
70791e56 4136 [
4137 if test "x$enableval" = "xno" ; then
e00da40d 4138 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4139 [Define if you don't want to use pututxline()
4140 etc. to write [uw]tmpx])
70791e56 4141 fi
4142 ]
3c0ef626 4143)
4144AC_ARG_WITH(lastlog,
4145 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
4146 [
34fee935 4147 if test "x$withval" = "xno" ; then
3c0ef626 4148 AC_DEFINE(DISABLE_LASTLOG)
34fee935 4149 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3c0ef626 4150 conf_lastlog_location=$withval
4151 fi
4152 ]
4153)
4154
4155dnl lastlog, [uw]tmpx? detection
4156dnl NOTE: set the paths in the platform section to avoid the
4157dnl need for command-line parameters
4158dnl lastlog and [uw]tmp are subject to a file search if all else fails
4159
4160dnl lastlog detection
4161dnl NOTE: the code itself will detect if lastlog is a directory
4162AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4163AC_TRY_COMPILE([
4164#include <sys/types.h>
4165#include <utmp.h>
4166#ifdef HAVE_LASTLOG_H
4167# include <lastlog.h>
4168#endif
4169#ifdef HAVE_PATHS_H
4170# include <paths.h>
4171#endif
4172#ifdef HAVE_LOGIN_H
4173# include <login.h>
4174#endif
4175 ],
4176 [ char *lastlog = LASTLOG_FILE; ],
4177 [ AC_MSG_RESULT(yes) ],
4178 [
4179 AC_MSG_RESULT(no)
4180 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4181 AC_TRY_COMPILE([
4182#include <sys/types.h>
4183#include <utmp.h>
4184#ifdef HAVE_LASTLOG_H
4185# include <lastlog.h>
4186#endif
4187#ifdef HAVE_PATHS_H
4188# include <paths.h>
4189#endif
4190 ],
4191 [ char *lastlog = _PATH_LASTLOG; ],
4192 [ AC_MSG_RESULT(yes) ],
4193 [
4194 AC_MSG_RESULT(no)
4195 system_lastlog_path=no
4196 ])
4197 ]
4198)
4199
4200if test -z "$conf_lastlog_location"; then
4201 if test x"$system_lastlog_path" = x"no" ; then
4202 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4203 if (test -d "$f" || test -f "$f") ; then
4204 conf_lastlog_location=$f
4205 fi
4206 done
4207 if test -z "$conf_lastlog_location"; then
4208 AC_MSG_WARN([** Cannot find lastlog **])
4209 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4210 fi
4211 fi
4212fi
4213
4214if test -n "$conf_lastlog_location"; then
e00da40d 4215 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4216 [Define if you want to specify the path to your lastlog file])
34fee935 4217fi
3c0ef626 4218
4219dnl utmp detection
4220AC_MSG_CHECKING([if your system defines UTMP_FILE])
4221AC_TRY_COMPILE([
4222#include <sys/types.h>
4223#include <utmp.h>
4224#ifdef HAVE_PATHS_H
4225# include <paths.h>
4226#endif
4227 ],
4228 [ char *utmp = UTMP_FILE; ],
4229 [ AC_MSG_RESULT(yes) ],
4230 [ AC_MSG_RESULT(no)
4231 system_utmp_path=no ]
4232)
4233if test -z "$conf_utmp_location"; then
4234 if test x"$system_utmp_path" = x"no" ; then
4235 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4236 if test -f $f ; then
4237 conf_utmp_location=$f
4238 fi
4239 done
4240 if test -z "$conf_utmp_location"; then
4241 AC_DEFINE(DISABLE_UTMP)
4242 fi
4243 fi
4244fi
4245if test -n "$conf_utmp_location"; then
e00da40d 4246 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4247 [Define if you want to specify the path to your utmp file])
34fee935 4248fi
3c0ef626 4249
4250dnl wtmp detection
4251AC_MSG_CHECKING([if your system defines WTMP_FILE])
4252AC_TRY_COMPILE([
4253#include <sys/types.h>
4254#include <utmp.h>
4255#ifdef HAVE_PATHS_H
4256# include <paths.h>
4257#endif
4258 ],
4259 [ char *wtmp = WTMP_FILE; ],
4260 [ AC_MSG_RESULT(yes) ],
4261 [ AC_MSG_RESULT(no)
4262 system_wtmp_path=no ]
4263)
4264if test -z "$conf_wtmp_location"; then
4265 if test x"$system_wtmp_path" = x"no" ; then
4266 for f in /usr/adm/wtmp /var/log/wtmp; do
4267 if test -f $f ; then
4268 conf_wtmp_location=$f
4269 fi
4270 done
4271 if test -z "$conf_wtmp_location"; then
4272 AC_DEFINE(DISABLE_WTMP)
4273 fi
4274 fi
4275fi
4276if test -n "$conf_wtmp_location"; then
e00da40d 4277 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4278 [Define if you want to specify the path to your wtmp file])
34fee935 4279fi
3c0ef626 4280
4281
4282dnl utmpx detection - I don't know any system so perverse as to require
4283dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4284dnl there, though.
4285AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4286AC_TRY_COMPILE([
4287#include <sys/types.h>
4288#include <utmp.h>
4289#ifdef HAVE_UTMPX_H
4290#include <utmpx.h>
4291#endif
4292#ifdef HAVE_PATHS_H
4293# include <paths.h>
4294#endif
4295 ],
4296 [ char *utmpx = UTMPX_FILE; ],
4297 [ AC_MSG_RESULT(yes) ],
4298 [ AC_MSG_RESULT(no)
4299 system_utmpx_path=no ]
4300)
4301if test -z "$conf_utmpx_location"; then
4302 if test x"$system_utmpx_path" = x"no" ; then
4303 AC_DEFINE(DISABLE_UTMPX)
4304 fi
4305else
e00da40d 4306 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4307 [Define if you want to specify the path to your utmpx file])
34fee935 4308fi
3c0ef626 4309
4310dnl wtmpx detection
4311AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4312AC_TRY_COMPILE([
4313#include <sys/types.h>
4314#include <utmp.h>
4315#ifdef HAVE_UTMPX_H
4316#include <utmpx.h>
4317#endif
4318#ifdef HAVE_PATHS_H
4319# include <paths.h>
4320#endif
4321 ],
4322 [ char *wtmpx = WTMPX_FILE; ],
4323 [ AC_MSG_RESULT(yes) ],
4324 [ AC_MSG_RESULT(no)
4325 system_wtmpx_path=no ]
4326)
4327if test -z "$conf_wtmpx_location"; then
4328 if test x"$system_wtmpx_path" = x"no" ; then
4329 AC_DEFINE(DISABLE_WTMPX)
4330 fi
4331else
e00da40d 4332 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4333 [Define if you want to specify the path to your wtmpx file])
34fee935 4334fi
3c0ef626 4335
4336
3c0ef626 4337if test ! -z "$blibpath" ; then
8bb69cbe 4338 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4339 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3c0ef626 4340fi
4341
34fee935 4342dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4343dnl Add now.
4344CFLAGS="$CFLAGS $werror_flags"
4345
6f25cbdd 4346if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
4347 test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4348 AC_SUBST(TEST_SSH_IPV6, no)
4349else
4350 AC_SUBST(TEST_SSH_IPV6, yes)
4351fi
4352
e9a17296 4353AC_EXEEXT
2e437378 4354AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4355 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
34fee935 4356 scard/Makefile ssh_prng_cmds survey.sh])
3c0ef626 4357AC_OUTPUT
4358
4359# Print summary of options
4360
3c0ef626 4361# Someone please show me a better way :)
4362A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4363B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4364C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4365D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4366E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4367F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2980ea68 4368H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4369I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4370J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3c0ef626 4371
4372echo ""
4373echo "OpenSSH has been configured with the following options:"
2980ea68 4374echo " User binaries: $B"
4375echo " System binaries: $C"
4376echo " Configuration files: $D"
4377echo " Askpass program: $E"
4378echo " Manual pages: $F"
2980ea68 4379echo " Privilege separation chroot path: $H"
70791e56 4380if test "x$external_path_file" = "x/etc/login.conf" ; then
4381echo " At runtime, sshd will use the path defined in $external_path_file"
4382echo " Make sure the path to scp is present, otherwise scp will not work"
2980ea68 4383else
4384echo " sshd default user PATH: $I"
70791e56 4385 if test ! -z "$external_path_file"; then
4386echo " (If PATH is set in $external_path_file it will be used instead. If"
4387echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4388 fi
2980ea68 4389fi
4390if test ! -z "$superuser_path" ; then
4391echo " sshd superuser user PATH: $J"
4392fi
4393echo " Manpage format: $MANTYPE"
70791e56 4394echo " PAM support: $PAM_MSG"
2e437378 4395echo " OSF SIA support: $SIA_MSG"
2980ea68 4396echo " KerberosV support: $KRB5_MSG"
2e437378 4397echo " SELinux support: $SELINUX_MSG"
2980ea68 4398echo " Smartcard support: $SCARD_MSG"
2980ea68 4399echo " S/KEY support: $SKEY_MSG"
4400echo " TCP Wrappers support: $TCPW_MSG"
4401echo " MD5 password support: $MD5_MSG"
34fee935 4402echo " libedit support: $LIBEDIT_MSG"
2e437378 4403echo " Solaris process contract support: $SPC_MSG"
2980ea68 4404echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2980ea68 4405echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4406echo " BSD Auth support: $BSD_AUTH_MSG"
4407echo " Random number source: $RAND_MSG"
e9a17296 4408if test ! -z "$USE_RAND_HELPER" ; then
2980ea68 4409echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3c0ef626 4410fi
4411
4412echo ""
4413
4414echo " Host: ${host}"
4415echo " Compiler: ${CC}"
4416echo " Compiler flags: ${CFLAGS}"
4417echo "Preprocessor flags: ${CPPFLAGS}"
4418echo " Linker flags: ${LDFLAGS}"
25d429a2 4419echo " Libraries: ${LIBS}"
4420if test ! -z "${SSHDLIBS}"; then
4421echo " +for sshd: ${SSHDLIBS}"
4422fi
3c0ef626 4423
4424echo ""
4425
1b56ff3d 4426if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
34fee935 4427 echo "SVR4 style packages are supported with \"make package\""
4428 echo ""
1b56ff3d 4429fi
4430
3c0ef626 4431if test "x$PAM_MSG" = "xyes" ; then
e9a17296 4432 echo "PAM is enabled. You may need to install a PAM control file "
4433 echo "for sshd, otherwise password authentication may fail. "
416fd2a8 4434 echo "Example PAM control files can be found in the contrib/ "
e9a17296 4435 echo "subdirectory"
3c0ef626 4436 echo ""
4437fi
4438
e9a17296 4439if test ! -z "$RAND_HELPER_CMDHASH" ; then
4440 echo "WARNING: you are using the builtin random number collection "
4441 echo "service. Please read WARNING.RNG and request that your OS "
4442 echo "vendor includes kernel-based random number collection in "
4443 echo "future versions of your OS."
3c0ef626 4444 echo ""
4445fi
4446
1b56ff3d 4447if test ! -z "$NO_PEERCHECK" ; then
25d429a2 4448 echo "WARNING: the operating system that you are using does not"
4449 echo "appear to support getpeereid(), getpeerucred() or the"
4450 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4451 echo "enforce security checks to prevent unauthorised connections to"
4452 echo "ssh-agent. Their absence increases the risk that a malicious"
4453 echo "user can connect to your agent."
1b56ff3d 4454 echo ""
4455fi
4456
34fee935 4457if test "$AUDIT_MODULE" = "bsm" ; then
4458 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4459 echo "See the Solaris section in README.platform for details."
4460fi
This page took 6.739504 seconds and 5 git commands to generate.