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