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