| 1 |
# |
| 2 |
# Copyright (c) 1999-2004 Damien Miller |
| 3 |
# |
| 4 |
# Permission to use, copy, modify, and distribute this software for any |
| 5 |
# purpose with or without fee is hereby granted, provided that the above |
| 6 |
# copyright notice and this permission notice appear in all copies. |
| 7 |
# |
| 8 |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 9 |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 10 |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 11 |
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 12 |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 13 |
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 14 |
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 |
|
| 16 |
AC_INIT([OpenSSH], [Portable], [[email protected]]) |
| 17 |
AC_CONFIG_MACRO_DIR([m4]) |
| 18 |
AC_CONFIG_SRCDIR([ssh.c]) |
| 19 |
|
| 20 |
# Check for stale configure as early as possible. |
| 21 |
for i in $srcdir/configure.ac $srcdir/m4/*.m4; do |
| 22 |
if test "$i" -nt "$srcdir/configure"; then |
| 23 |
AC_MSG_ERROR([$i newer than configure, run autoreconf]) |
| 24 |
fi |
| 25 |
done |
| 26 |
|
| 27 |
AC_LANG([C]) |
| 28 |
|
| 29 |
AC_CONFIG_HEADERS([config.h]) |
| 30 |
AC_PROG_CC([cc gcc clang]) |
| 31 |
|
| 32 |
# XXX relax this after reimplementing logit() etc. |
| 33 |
AC_MSG_CHECKING([if $CC supports C99-style variadic macros]) |
| 34 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 35 |
int f(int a, int b, int c) { return a + b + c; } |
| 36 |
#define F(a, ...) f(a, __VA_ARGS__) |
| 37 |
]], [[return F(1, 2, -3);]])], |
| 38 |
[ AC_MSG_RESULT([yes]) ], |
| 39 |
[ AC_MSG_ERROR([*** OpenSSH requires support for C99-style variadic macros]) ] |
| 40 |
) |
| 41 |
|
| 42 |
AC_CANONICAL_HOST |
| 43 |
AC_C_BIGENDIAN |
| 44 |
|
| 45 |
# Checks for programs. |
| 46 |
AC_PROG_AWK |
| 47 |
AC_PROG_CPP |
| 48 |
AC_PROG_RANLIB |
| 49 |
AC_PROG_INSTALL |
| 50 |
AC_PROG_EGREP |
| 51 |
AC_PROG_MKDIR_P |
| 52 |
AC_CHECK_TOOLS([AR], [ar]) |
| 53 |
AC_PATH_PROG([CAT], [cat]) |
| 54 |
AC_PATH_PROG([KILL], [kill]) |
| 55 |
AC_PATH_PROG([SED], [sed]) |
| 56 |
AC_PATH_PROG([TEST_MINUS_S_SH], [bash]) |
| 57 |
AC_PATH_PROG([TEST_MINUS_S_SH], [ksh]) |
| 58 |
AC_PATH_PROG([TEST_MINUS_S_SH], [sh]) |
| 59 |
AC_PATH_PROG([SH], [bash]) |
| 60 |
AC_PATH_PROG([SH], [ksh]) |
| 61 |
AC_PATH_PROG([SH], [sh]) |
| 62 |
AC_PATH_PROG([GROFF], [groff]) |
| 63 |
AC_PATH_PROG([NROFF], [nroff awf]) |
| 64 |
AC_PATH_PROG([MANDOC], [mandoc]) |
| 65 |
AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no]) |
| 66 |
AC_SUBST([TEST_SHELL], [sh]) |
| 67 |
|
| 68 |
dnl select manpage formatter to be used to build "cat" format pages. |
| 69 |
if test "x$MANDOC" != "x" ; then |
| 70 |
MANFMT="$MANDOC" |
| 71 |
elif test "x$NROFF" != "x" ; then |
| 72 |
MANFMT="$NROFF -mandoc" |
| 73 |
elif test "x$GROFF" != "x" ; then |
| 74 |
MANFMT="$GROFF -mandoc -Tascii" |
| 75 |
else |
| 76 |
AC_MSG_WARN([no manpage formatter found]) |
| 77 |
MANFMT="false" |
| 78 |
fi |
| 79 |
AC_SUBST([MANFMT]) |
| 80 |
|
| 81 |
dnl for buildpkg.sh |
| 82 |
AC_PATH_PROG([PATH_GROUPADD_PROG], [groupadd], [groupadd], |
| 83 |
[/usr/sbin${PATH_SEPARATOR}/etc]) |
| 84 |
AC_PATH_PROG([PATH_USERADD_PROG], [useradd], [useradd], |
| 85 |
[/usr/sbin${PATH_SEPARATOR}/etc]) |
| 86 |
AC_CHECK_PROG([MAKE_PACKAGE_SUPPORTED], [pkgmk], [yes], [no]) |
| 87 |
if test -x /sbin/sh; then |
| 88 |
AC_SUBST([STARTUP_SCRIPT_SHELL], [/sbin/sh]) |
| 89 |
else |
| 90 |
AC_SUBST([STARTUP_SCRIPT_SHELL], [/bin/sh]) |
| 91 |
fi |
| 92 |
|
| 93 |
# System features |
| 94 |
AC_SYS_LARGEFILE |
| 95 |
|
| 96 |
if test -z "$AR" ; then |
| 97 |
AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***]) |
| 98 |
fi |
| 99 |
|
| 100 |
AC_PATH_PROG([PATH_PASSWD_PROG], [passwd]) |
| 101 |
if test ! -z "$PATH_PASSWD_PROG" ; then |
| 102 |
AC_DEFINE_UNQUOTED([_PATH_PASSWD_PROG], ["$PATH_PASSWD_PROG"], |
| 103 |
[Full path of your "passwd" program]) |
| 104 |
fi |
| 105 |
|
| 106 |
dnl Since autoconf doesn't support it very well, we no longer allow users to |
| 107 |
dnl override LD, however keeping the hook here for now in case there's a use |
| 108 |
dnl use case we overlooked and someone needs to re-enable it. Unless a good |
| 109 |
dnl reason is found we'll be removing this in future. |
| 110 |
LD="$CC" |
| 111 |
AC_SUBST([LD]) |
| 112 |
|
| 113 |
AC_C_INLINE |
| 114 |
|
| 115 |
AC_CHECK_DECL([LLONG_MAX], [have_llong_max=1], , [#include <limits.h>]) |
| 116 |
AC_CHECK_DECL([LONG_LONG_MAX], [have_long_long_max=1], , [#include <limits.h>]) |
| 117 |
AC_CHECK_DECL([RLIMIT_NPROC], |
| 118 |
[AC_DEFINE([HAVE_RLIMIT_NPROC], [], [sys/resource.h has RLIMIT_NPROC])], , [ |
| 119 |
#include <sys/types.h> |
| 120 |
#include <sys/resource.h> |
| 121 |
]) |
| 122 |
AC_CHECK_DECL([PR_SET_NO_NEW_PRIVS], [have_linux_no_new_privs=1], , [ |
| 123 |
#include <sys/types.h> |
| 124 |
#include <linux/prctl.h> |
| 125 |
]) |
| 126 |
|
| 127 |
openssl=yes |
| 128 |
openssl_bin=openssl |
| 129 |
AC_ARG_WITH([openssl], |
| 130 |
[ --without-openssl Disable use of OpenSSL; use only limited internal crypto **EXPERIMENTAL** ], |
| 131 |
[ if test "x$withval" = "xno" ; then |
| 132 |
openssl=no |
| 133 |
openssl_bin="" |
| 134 |
fi |
| 135 |
] |
| 136 |
) |
| 137 |
AC_MSG_CHECKING([whether OpenSSL will be used for cryptography]) |
| 138 |
if test "x$openssl" = "xyes" ; then |
| 139 |
AC_MSG_RESULT([yes]) |
| 140 |
AC_DEFINE_UNQUOTED([WITH_OPENSSL], [1], [use libcrypto for cryptography]) |
| 141 |
else |
| 142 |
AC_MSG_RESULT([no]) |
| 143 |
fi |
| 144 |
|
| 145 |
use_stack_protector=1 |
| 146 |
use_toolchain_hardening=1 |
| 147 |
use_retpoline=1 |
| 148 |
AC_ARG_WITH([stackprotect], |
| 149 |
[ --without-stackprotect Don't use compiler's stack protection], [ |
| 150 |
if test "x$withval" = "xno"; then |
| 151 |
use_stack_protector=0 |
| 152 |
fi ]) |
| 153 |
AC_ARG_WITH([hardening], |
| 154 |
[ --without-hardening Don't use toolchain hardening flags], [ |
| 155 |
if test "x$withval" = "xno"; then |
| 156 |
use_toolchain_hardening=0 |
| 157 |
fi ]) |
| 158 |
AC_ARG_WITH([retpoline], |
| 159 |
[ --without-retpoline Enable retpoline spectre mitigation], [ |
| 160 |
if test "x$withval" = "xno"; then |
| 161 |
use_retpoline=0 |
| 162 |
fi ]) |
| 163 |
|
| 164 |
# We use -Werror for the tests only so that we catch warnings like "this is |
| 165 |
# on by default" for things like -fPIE. |
| 166 |
AC_MSG_CHECKING([if $CC supports -Werror]) |
| 167 |
saved_CFLAGS="$CFLAGS" |
| 168 |
CFLAGS="$CFLAGS -Werror" |
| 169 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])], |
| 170 |
[ AC_MSG_RESULT([yes]) |
| 171 |
WERROR="-Werror"], |
| 172 |
[ AC_MSG_RESULT([no]) |
| 173 |
WERROR="" ] |
| 174 |
) |
| 175 |
CFLAGS="$saved_CFLAGS" |
| 176 |
|
| 177 |
if test "$GCC" = "yes" || test "$GCC" = "egcs"; then |
| 178 |
AC_MSG_CHECKING([gcc version]) |
| 179 |
GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` |
| 180 |
case "$GCC_VER" in |
| 181 |
1.*) no_attrib_nonnull=1 ;; |
| 182 |
2.8* | 2.9*) |
| 183 |
no_attrib_nonnull=1 |
| 184 |
;; |
| 185 |
2.*) no_attrib_nonnull=1 ;; |
| 186 |
*) ;; |
| 187 |
esac |
| 188 |
AC_MSG_RESULT([$GCC_VER]) |
| 189 |
|
| 190 |
AC_MSG_CHECKING([clang version]) |
| 191 |
ver="`$CC -v 2>&1`" |
| 192 |
if echo "$ver" | grep "Apple" >/dev/null; then |
| 193 |
CLANG_VER=apple-`echo "$ver" | grep 'clang version' | \ |
| 194 |
$SED 's/.*clang version //g' | $AWK '{print $1}'` |
| 195 |
else |
| 196 |
CLANG_VER=`echo "$ver" | grep 'clang version' | \ |
| 197 |
$SED 's/.*clang version //g' | $AWK '{print $1}'` |
| 198 |
fi |
| 199 |
AC_MSG_RESULT([$CLANG_VER]) |
| 200 |
|
| 201 |
OSSH_CHECK_CFLAG_COMPILE([-pipe]) |
| 202 |
OSSH_CHECK_CFLAG_COMPILE([-Wunknown-warning-option]) |
| 203 |
OSSH_CHECK_CFLAG_COMPILE([-Wno-error=format-truncation]) |
| 204 |
OSSH_CHECK_CFLAG_COMPILE([-Qunused-arguments]) |
| 205 |
OSSH_CHECK_CFLAG_COMPILE([-Wall]) |
| 206 |
OSSH_CHECK_CFLAG_COMPILE([-Wextra]) |
| 207 |
OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) |
| 208 |
OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) |
| 209 |
OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) |
| 210 |
OSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) |
| 211 |
OSSH_CHECK_CFLAG_COMPILE([-Wsizeof-pointer-memaccess]) |
| 212 |
OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign]) |
| 213 |
OSSH_CHECK_CFLAG_COMPILE([-Wunused-parameter], [-Wno-unused-parameter]) |
| 214 |
OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result]) |
| 215 |
OSSH_CHECK_CFLAG_COMPILE([-Wimplicit-fallthrough]) |
| 216 |
OSSH_CHECK_CFLAG_COMPILE([-Wmisleading-indentation]) |
| 217 |
OSSH_CHECK_CFLAG_COMPILE([-Wbitwise-instead-of-logical]) |
| 218 |
OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) |
| 219 |
if test "x$use_toolchain_hardening" = "x1"; then |
| 220 |
OSSH_CHECK_CFLAG_COMPILE([-D_FORTIFY_SOURCE=2]) |
| 221 |
OSSH_CHECK_LDFLAG_LINK([-Wl,-z,relro]) |
| 222 |
OSSH_CHECK_LDFLAG_LINK([-Wl,-z,now]) |
| 223 |
OSSH_CHECK_LDFLAG_LINK([-Wl,-z,noexecstack]) |
| 224 |
# NB. -ftrapv expects certain support functions to be present in |
| 225 |
# the compiler library (libgcc or similar) to detect integer operations |
| 226 |
# that can overflow. We must check that the result of enabling it |
| 227 |
# actually links. The test program compiled/linked includes a number |
| 228 |
# of integer operations that should exercise this. |
| 229 |
OSSH_CHECK_CFLAG_LINK([-ftrapv]) |
| 230 |
# clang 15 seems to have a bug in -fzero-call-used-regs=all. See |
| 231 |
# https://bugzilla.mindrot.org/show_bug.cgi?id=3475 and |
| 232 |
# https://github.com/llvm/llvm-project/issues/59242 |
| 233 |
# clang 17 has a different bug that causes an ICE when using this |
| 234 |
# flag at all (https://bugzilla.mindrot.org/show_bug.cgi?id=3629) |
| 235 |
case "$CLANG_VER" in |
| 236 |
apple-15*) OSSH_CHECK_CFLAG_LINK([-fzero-call-used-regs=used]) ;; |
| 237 |
17*) ;; |
| 238 |
*) OSSH_CHECK_CFLAG_LINK([-fzero-call-used-regs=used]) ;; |
| 239 |
esac |
| 240 |
OSSH_CHECK_CFLAG_COMPILE([-ftrivial-auto-var-init=zero]) |
| 241 |
fi |
| 242 |
if test "x$use_retpoline" = "x1"; then |
| 243 |
OSSH_CHECK_CFLAG_COMPILE([-mretpoline]) # clang |
| 244 |
OSSH_CHECK_LDFLAG_LINK([-Wl,-z,retpolineplt]) |
| 245 |
fi |
| 246 |
|
| 247 |
AC_MSG_CHECKING([if $CC accepts -fno-builtin-memset]) |
| 248 |
saved_CFLAGS="$CFLAGS" |
| 249 |
CFLAGS="$CFLAGS -fno-builtin-memset" |
| 250 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <string.h> ]], |
| 251 |
[[ char b[10]; memset(b, 0, sizeof(b)); ]])], |
| 252 |
[ AC_MSG_RESULT([yes]) ], |
| 253 |
[ AC_MSG_RESULT([no]) |
| 254 |
CFLAGS="$saved_CFLAGS" ] |
| 255 |
) |
| 256 |
|
| 257 |
# -fstack-protector-all doesn't always work for some GCC versions |
| 258 |
# and/or platforms, so we test if we can. If it's not supported |
| 259 |
# on a given platform gcc will emit a warning so we use -Werror. |
| 260 |
if test "x$use_stack_protector" = "x1"; then |
| 261 |
for t in -fstack-protector-strong -fstack-protector-all \ |
| 262 |
-fstack-protector; do |
| 263 |
AC_MSG_CHECKING([if $CC supports $t]) |
| 264 |
saved_CFLAGS="$CFLAGS" |
| 265 |
saved_LDFLAGS="$LDFLAGS" |
| 266 |
CFLAGS="$CFLAGS $t -Werror" |
| 267 |
LDFLAGS="$LDFLAGS $t -Werror" |
| 268 |
AC_LINK_IFELSE( |
| 269 |
[AC_LANG_PROGRAM([[ |
| 270 |
#include <stdio.h> |
| 271 |
int func (int t) {char b[100]; snprintf(b,sizeof b,"%d",t); return t;} |
| 272 |
]], |
| 273 |
[[ |
| 274 |
char x[256]; |
| 275 |
snprintf(x, sizeof(x), "XXX%d", func(1)); |
| 276 |
]])], |
| 277 |
[ AC_MSG_RESULT([yes]) |
| 278 |
CFLAGS="$saved_CFLAGS $t" |
| 279 |
LDFLAGS="$saved_LDFLAGS $t" |
| 280 |
AC_MSG_CHECKING([if $t works]) |
| 281 |
AC_RUN_IFELSE( |
| 282 |
[AC_LANG_PROGRAM([[ |
| 283 |
#include <stdio.h> |
| 284 |
int func (int t) {char b[100]; snprintf(b,sizeof b,"%d",t); return t;} |
| 285 |
]], |
| 286 |
[[ |
| 287 |
char x[256]; |
| 288 |
snprintf(x, sizeof(x), "XXX%d", func(1)); |
| 289 |
]])], |
| 290 |
[ AC_MSG_RESULT([yes]) |
| 291 |
break ], |
| 292 |
[ AC_MSG_RESULT([no]) ], |
| 293 |
[ AC_MSG_WARN([cross compiling: cannot test]) |
| 294 |
break ] |
| 295 |
) |
| 296 |
], |
| 297 |
[ AC_MSG_RESULT([no]) ] |
| 298 |
) |
| 299 |
CFLAGS="$saved_CFLAGS" |
| 300 |
LDFLAGS="$saved_LDFLAGS" |
| 301 |
done |
| 302 |
fi |
| 303 |
|
| 304 |
if test -z "$have_llong_max"; then |
| 305 |
# retry LLONG_MAX with -std=gnu99, needed on some Linuxes |
| 306 |
unset ac_cv_have_decl_LLONG_MAX |
| 307 |
saved_CFLAGS="$CFLAGS" |
| 308 |
CFLAGS="$CFLAGS -std=gnu99" |
| 309 |
AC_CHECK_DECL([LLONG_MAX], |
| 310 |
[have_llong_max=1], |
| 311 |
[CFLAGS="$saved_CFLAGS"], |
| 312 |
[#include <limits.h>] |
| 313 |
) |
| 314 |
fi |
| 315 |
fi |
| 316 |
|
| 317 |
AC_MSG_CHECKING([if compiler allows __attribute__ on return types]) |
| 318 |
AC_COMPILE_IFELSE( |
| 319 |
[AC_LANG_PROGRAM([[ |
| 320 |
#include <stdlib.h> |
| 321 |
__attribute__((__unused__)) static void foo(void){return;}]], |
| 322 |
[[ exit(0); ]])], |
| 323 |
[ AC_MSG_RESULT([yes]) ], |
| 324 |
[ AC_MSG_RESULT([no]) |
| 325 |
AC_DEFINE(NO_ATTRIBUTE_ON_RETURN_TYPE, 1, |
| 326 |
[compiler does not accept __attribute__ on return types]) ] |
| 327 |
) |
| 328 |
|
| 329 |
AC_MSG_CHECKING([if compiler allows __attribute__ prototype args]) |
| 330 |
AC_COMPILE_IFELSE( |
| 331 |
[AC_LANG_PROGRAM([[ |
| 332 |
#include <stdlib.h> |
| 333 |
typedef void foo(const char *, ...) __attribute__((format(printf, 1, 2)));]], |
| 334 |
[[ exit(0); ]])], |
| 335 |
[ AC_MSG_RESULT([yes]) ], |
| 336 |
[ AC_MSG_RESULT([no]) |
| 337 |
AC_DEFINE(NO_ATTRIBUTE_ON_PROTOTYPE_ARGS, 1, |
| 338 |
[compiler does not accept __attribute__ on prototype args]) ] |
| 339 |
) |
| 340 |
|
| 341 |
AC_MSG_CHECKING([if compiler supports variable length arrays]) |
| 342 |
AC_COMPILE_IFELSE( |
| 343 |
[AC_LANG_PROGRAM([[#include <stdlib.h>]], |
| 344 |
[[ int i; for (i=0; i<3; i++){int a[i]; a[i-1]=0;} exit(0); ]])], |
| 345 |
[ AC_MSG_RESULT([yes]) |
| 346 |
AC_DEFINE(VARIABLE_LENGTH_ARRAYS, [1], |
| 347 |
[compiler supports variable length arrays]) ], |
| 348 |
[ AC_MSG_RESULT([no]) ] |
| 349 |
) |
| 350 |
|
| 351 |
AC_MSG_CHECKING([if compiler accepts variable declarations after code]) |
| 352 |
AC_COMPILE_IFELSE( |
| 353 |
[AC_LANG_PROGRAM([[#include <stdlib.h>]], |
| 354 |
[[ int a; a = 1; int b = 1; exit(a-b); ]])], |
| 355 |
[ AC_MSG_RESULT([yes]) |
| 356 |
AC_DEFINE(VARIABLE_DECLARATION_AFTER_CODE, [1], |
| 357 |
[compiler variable declarations after code]) ], |
| 358 |
[ AC_MSG_RESULT([no]) ] |
| 359 |
) |
| 360 |
|
| 361 |
saved_CFLAGS="$CFLAGS" |
| 362 |
CFLAGS="$CFLAGS -Werror" |
| 363 |
AC_MSG_CHECKING([if compiler supports __nonstring__ attribute on char arrays]) |
| 364 |
AC_COMPILE_IFELSE( |
| 365 |
[AC_LANG_PROGRAM([[#include <stdlib.h>]], |
| 366 |
[[ char __attribute__ ((__nonstring__)) h[5] = "hello"; return h[0]!='h'; ]])], |
| 367 |
[ AC_MSG_RESULT([yes]) |
| 368 |
AC_DEFINE(HAVE_ATTRIBUTE__NONSTRING__, [1], |
| 369 |
[compiler supports nonstring attribute]) ], |
| 370 |
[ AC_MSG_RESULT([no]) ] |
| 371 |
) |
| 372 |
CFLAGS="$saved_CFLAGS" |
| 373 |
|
| 374 |
if test "x$no_attrib_nonnull" != "x1" ; then |
| 375 |
AC_DEFINE([HAVE_ATTRIBUTE__NONNULL__], [1], [Have attribute nonnull]) |
| 376 |
fi |
| 377 |
|
| 378 |
AC_ARG_WITH([rpath], |
| 379 |
[ --without-rpath Disable auto-added -R linker paths], |
| 380 |
[ |
| 381 |
if test "x$withval" = "xno" ; then |
| 382 |
rpath_opt="" |
| 383 |
elif test "x$withval" = "xyes" ; then |
| 384 |
rpath_opt="-R" |
| 385 |
else |
| 386 |
rpath_opt="$withval" |
| 387 |
fi |
| 388 |
] |
| 389 |
) |
| 390 |
|
| 391 |
# Allow user to specify flags |
| 392 |
AC_ARG_WITH([cflags], |
| 393 |
[ --with-cflags Specify additional flags to pass to compiler], |
| 394 |
[ |
| 395 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 396 |
test "x${withval}" != "xyes"; then |
| 397 |
CFLAGS="$CFLAGS $withval" |
| 398 |
fi |
| 399 |
] |
| 400 |
) |
| 401 |
|
| 402 |
AC_ARG_WITH([cflags-after], |
| 403 |
[ --with-cflags-after Specify additional flags to pass to compiler after configure], |
| 404 |
[ |
| 405 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 406 |
test "x${withval}" != "xyes"; then |
| 407 |
CFLAGS_AFTER="$withval" |
| 408 |
fi |
| 409 |
] |
| 410 |
) |
| 411 |
AC_ARG_WITH([cppflags], |
| 412 |
[ --with-cppflags Specify additional flags to pass to preprocessor] , |
| 413 |
[ |
| 414 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 415 |
test "x${withval}" != "xyes"; then |
| 416 |
CPPFLAGS="$CPPFLAGS $withval" |
| 417 |
fi |
| 418 |
] |
| 419 |
) |
| 420 |
AC_ARG_WITH([ldflags], |
| 421 |
[ --with-ldflags Specify additional flags to pass to linker], |
| 422 |
[ |
| 423 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 424 |
test "x${withval}" != "xyes"; then |
| 425 |
LDFLAGS="$LDFLAGS $withval" |
| 426 |
fi |
| 427 |
] |
| 428 |
) |
| 429 |
AC_ARG_WITH([ldflags-after], |
| 430 |
[ --with-ldflags-after Specify additional flags to pass to linker after configure], |
| 431 |
[ |
| 432 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 433 |
test "x${withval}" != "xyes"; then |
| 434 |
LDFLAGS_AFTER="$withval" |
| 435 |
fi |
| 436 |
] |
| 437 |
) |
| 438 |
AC_ARG_WITH([libs], |
| 439 |
[ --with-libs Specify additional libraries to link with], |
| 440 |
[ |
| 441 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 442 |
test "x${withval}" != "xyes"; then |
| 443 |
LIBS="$LIBS $withval" |
| 444 |
fi |
| 445 |
] |
| 446 |
) |
| 447 |
AC_ARG_WITH([Werror], |
| 448 |
[ --with-Werror Build main code with -Werror], |
| 449 |
[ |
| 450 |
if test -n "$withval" && test "x$withval" != "xno"; then |
| 451 |
werror_flags="-Werror" |
| 452 |
if test "x${withval}" != "xyes"; then |
| 453 |
werror_flags="$withval" |
| 454 |
fi |
| 455 |
fi |
| 456 |
] |
| 457 |
) |
| 458 |
|
| 459 |
dnl On some old platforms, sys/stat.h requires sys/types.h, but autoconf-2.71's |
| 460 |
dnl AC_CHECK_INCLUDES_DEFAULT checks for them in the opposite order. If we |
| 461 |
dnl haven't detected it, recheck. |
| 462 |
if test "x$ac_cv_header_sys_stat_h" != "xyes"; then |
| 463 |
unset ac_cv_header_sys_stat_h |
| 464 |
AC_CHECK_HEADERS([sys/stat.h]) |
| 465 |
fi |
| 466 |
|
| 467 |
AC_CHECK_HEADERS([ \ |
| 468 |
blf.h \ |
| 469 |
bstring.h \ |
| 470 |
crypt.h \ |
| 471 |
crypto/sha2.h \ |
| 472 |
dirent.h \ |
| 473 |
elf.h \ |
| 474 |
err.h \ |
| 475 |
features.h \ |
| 476 |
fcntl.h \ |
| 477 |
floatingpoint.h \ |
| 478 |
fnmatch.h \ |
| 479 |
getopt.h \ |
| 480 |
ia.h \ |
| 481 |
iaf.h \ |
| 482 |
inttypes.h \ |
| 483 |
langinfo.h \ |
| 484 |
limits.h \ |
| 485 |
locale.h \ |
| 486 |
login.h \ |
| 487 |
maillock.h \ |
| 488 |
ndir.h \ |
| 489 |
net/if_tun.h \ |
| 490 |
netdb.h \ |
| 491 |
pam/pam_appl.h \ |
| 492 |
pty.h \ |
| 493 |
readpassphrase.h \ |
| 494 |
rpc/types.h \ |
| 495 |
security/pam_appl.h \ |
| 496 |
sha2.h \ |
| 497 |
shadow.h \ |
| 498 |
stddef.h \ |
| 499 |
string.h \ |
| 500 |
strings.h \ |
| 501 |
sys/bitypes.h \ |
| 502 |
sys/byteorder.h \ |
| 503 |
sys/bsdtty.h \ |
| 504 |
sys/cdefs.h \ |
| 505 |
sys/dir.h \ |
| 506 |
sys/file.h \ |
| 507 |
sys/mman.h \ |
| 508 |
sys/label.h \ |
| 509 |
sys/ndir.h \ |
| 510 |
sys/param.h \ |
| 511 |
sys/poll.h \ |
| 512 |
sys/prctl.h \ |
| 513 |
sys/procctl.h \ |
| 514 |
sys/pstat.h \ |
| 515 |
sys/ptrace.h \ |
| 516 |
sys/random.h \ |
| 517 |
sys/select.h \ |
| 518 |
sys/stream.h \ |
| 519 |
sys/stropts.h \ |
| 520 |
sys/strtio.h \ |
| 521 |
sys/statvfs.h \ |
| 522 |
sys/sysmacros.h \ |
| 523 |
sys/timers.h \ |
| 524 |
sys/vfs.h \ |
| 525 |
tmpdir.h \ |
| 526 |
ttyent.h \ |
| 527 |
ucred.h \ |
| 528 |
unistd.h \ |
| 529 |
usersec.h \ |
| 530 |
utime.h \ |
| 531 |
utmp.h \ |
| 532 |
utmpx.h \ |
| 533 |
vis.h \ |
| 534 |
wchar.h \ |
| 535 |
]) |
| 536 |
|
| 537 |
# Create replacement header files for common headers that are missing on this |
| 538 |
# platform. Usually these are just empty, but in some cases they'll include |
| 539 |
# the equivalent file. This avoids having to wrap those includes in |
| 540 |
# '#ifdef HAVE_FOO_H'. If we create any such headers, add the path to includes. |
| 541 |
COMPATINCLUDESDIR="openbsd-compat/include" |
| 542 |
COMPATINCLUDES="" |
| 543 |
AC_CHECK_HEADERS([ \ |
| 544 |
endian.h \ |
| 545 |
ifaddrs.h \ |
| 546 |
libgen.h \ |
| 547 |
paths.h \ |
| 548 |
netgroup.h \ |
| 549 |
nlist.h \ |
| 550 |
poll.h \ |
| 551 |
stdint.h \ |
| 552 |
sys/mman.h \ |
| 553 |
sys/stat.h \ |
| 554 |
sys/statvfs.h \ |
| 555 |
sys/time.h \ |
| 556 |
sys/un.h \ |
| 557 |
time.h \ |
| 558 |
util.h \ |
| 559 |
], [ |
| 560 |
# Remove any old shims. |
| 561 |
rm -f "$COMPATINCLUDESDIR/$ac_header" |
| 562 |
], [ |
| 563 |
COMPATINCLUDES="$COMPATINCLUDESDIR" |
| 564 |
header="$COMPATINCLUDES/$ac_header" |
| 565 |
dir=`dirname "$header"` |
| 566 |
mkdir -p "$dir" |
| 567 |
case "$ac_header" in |
| 568 |
poll.h) echo '#ifdef HAVE_SYS_POLL_H' |
| 569 |
echo '#include <sys/poll.h>' |
| 570 |
echo '#endif' ;; |
| 571 |
*) ;; |
| 572 |
esac >"$header" |
| 573 |
]) |
| 574 |
|
| 575 |
dnl Now create replacement headers for those that we always want to shim. |
| 576 |
for include in sys/queue.h sys/tree.h; do |
| 577 |
COMPATINCLUDES="$COMPATINCLUDESDIR" |
| 578 |
header="$COMPATINCLUDES/$include" |
| 579 |
dir=`dirname "$header"` |
| 580 |
mkdir -p "$dir" |
| 581 |
case "$include" in |
| 582 |
sys/queue.h) |
| 583 |
echo '#include "openbsd-compat/sys-queue.h"' |
| 584 |
;; |
| 585 |
sys/tree.h) |
| 586 |
echo '#include "openbsd-compat/sys-tree.h"' |
| 587 |
;; |
| 588 |
esac >"$header" |
| 589 |
done |
| 590 |
|
| 591 |
AC_CHECK_DECLS([le32toh, le64toh, htole64], [], [], [ |
| 592 |
#ifdef HAVE_SYS_TYPES_H |
| 593 |
# include <sys/types.h> |
| 594 |
#endif |
| 595 |
#ifdef HAVE_STDINT_H |
| 596 |
# include <stdint.h> |
| 597 |
#endif |
| 598 |
#ifdef HAVE_ENDIAN_H |
| 599 |
# include <endian.h> |
| 600 |
#endif |
| 601 |
]) |
| 602 |
|
| 603 |
# On some platforms (eg SunOS4) sys/audit.h requires sys/[time|types|label.h] |
| 604 |
# to be included first. |
| 605 |
AC_CHECK_HEADERS([sys/audit.h], [], [], [ |
| 606 |
#ifdef HAVE_SYS_TIME_H |
| 607 |
# include <sys/time.h> |
| 608 |
#endif |
| 609 |
#ifdef HAVE_SYS_TYPES_H |
| 610 |
# include <sys/types.h> |
| 611 |
#endif |
| 612 |
#ifdef HAVE_SYS_LABEL_H |
| 613 |
# include <sys/label.h> |
| 614 |
#endif |
| 615 |
]) |
| 616 |
|
| 617 |
# sys/capsicum.h requires sys/types.h |
| 618 |
AC_CHECK_HEADERS([sys/capsicum.h capsicum_helpers.h], [], [], [ |
| 619 |
#ifdef HAVE_SYS_TYPES_H |
| 620 |
# include <sys/types.h> |
| 621 |
#endif |
| 622 |
]) |
| 623 |
|
| 624 |
AC_MSG_CHECKING([for caph_cache_tzdata]) |
| 625 |
AC_LINK_IFELSE( |
| 626 |
[AC_LANG_PROGRAM([[ #include <capsicum_helpers.h> ]], |
| 627 |
[[caph_cache_tzdata();]])], |
| 628 |
[ |
| 629 |
AC_MSG_RESULT([yes]) |
| 630 |
AC_DEFINE([HAVE_CAPH_CACHE_TZDATA], [1], |
| 631 |
[Define if you have caph_cache_tzdata]) |
| 632 |
], |
| 633 |
[ AC_MSG_RESULT([no]) ] |
| 634 |
) |
| 635 |
|
| 636 |
# net/route.h requires sys/socket.h and sys/types.h. |
| 637 |
# sys/sysctl.h also requires sys/param.h |
| 638 |
AC_CHECK_HEADERS([net/route.h sys/sysctl.h], [], [], [ |
| 639 |
#ifdef HAVE_SYS_TYPES_H |
| 640 |
# include <sys/types.h> |
| 641 |
#endif |
| 642 |
#include <sys/param.h> |
| 643 |
#include <sys/socket.h> |
| 644 |
]) |
| 645 |
|
| 646 |
# lastlog.h requires sys/time.h to be included first on Solaris |
| 647 |
AC_CHECK_HEADERS([lastlog.h], [], [], [ |
| 648 |
#ifdef HAVE_SYS_TIME_H |
| 649 |
# include <sys/time.h> |
| 650 |
#endif |
| 651 |
]) |
| 652 |
|
| 653 |
# sys/ptms.h requires sys/stream.h to be included first on Solaris |
| 654 |
AC_CHECK_HEADERS([sys/ptms.h], [], [], [ |
| 655 |
#ifdef HAVE_SYS_STREAM_H |
| 656 |
# include <sys/stream.h> |
| 657 |
#endif |
| 658 |
]) |
| 659 |
|
| 660 |
# login_cap.h requires sys/types.h on NetBSD |
| 661 |
AC_CHECK_HEADERS([login_cap.h], [], [], [ |
| 662 |
#include <sys/types.h> |
| 663 |
]) |
| 664 |
|
| 665 |
# older BSDs need sys/param.h before sys/mount.h |
| 666 |
AC_CHECK_HEADERS([sys/mount.h], [], [], [ |
| 667 |
#include <sys/param.h> |
| 668 |
]) |
| 669 |
|
| 670 |
# Android requires sys/socket.h to be included before sys/un.h |
| 671 |
AC_CHECK_HEADERS([sys/un.h], [], [], [ |
| 672 |
#include <sys/types.h> |
| 673 |
#include <sys/socket.h> |
| 674 |
]) |
| 675 |
|
| 676 |
# Messages for features tested for in target-specific section |
| 677 |
SIA_MSG="no" |
| 678 |
SPC_MSG="no" |
| 679 |
SP_MSG="no" |
| 680 |
SPP_MSG="no" |
| 681 |
|
| 682 |
# Support for Solaris/Illumos privileges (this test is used by both |
| 683 |
# the --with-solaris-privs option and --with-sandbox=solaris). |
| 684 |
SOLARIS_PRIVS="no" |
| 685 |
|
| 686 |
# Default shared library extension |
| 687 |
SHLIBEXT=".so" |
| 688 |
|
| 689 |
# See OpenBSD section in $host case below. |
| 690 |
need_pledge_inet="" |
| 691 |
|
| 692 |
# Check for some target-specific stuff |
| 693 |
case "$host" in |
| 694 |
*-*-aix*) |
| 695 |
# Some versions of VAC won't allow macro redefinitions at |
| 696 |
# -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that |
| 697 |
# particularly with older versions of vac or xlc. |
| 698 |
# It also throws errors about null macro arguments, but these are |
| 699 |
# not fatal. |
| 700 |
AC_MSG_CHECKING([if compiler allows macro redefinitions]) |
| 701 |
AC_COMPILE_IFELSE( |
| 702 |
[AC_LANG_PROGRAM([[ |
| 703 |
#include <stdlib.h> |
| 704 |
#define testmacro foo |
| 705 |
#define testmacro bar]], |
| 706 |
[[ exit(0); ]])], |
| 707 |
[ AC_MSG_RESULT([yes]) ], |
| 708 |
[ AC_MSG_RESULT([no]) |
| 709 |
CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`" |
| 710 |
CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`" |
| 711 |
CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`" |
| 712 |
] |
| 713 |
) |
| 714 |
|
| 715 |
AC_MSG_CHECKING([how to specify blibpath for linker ($LD)]) |
| 716 |
if (test -z "$blibpath"); then |
| 717 |
blibpath="/usr/lib:/lib" |
| 718 |
fi |
| 719 |
saved_LDFLAGS="$LDFLAGS" |
| 720 |
if test "$GCC" = "yes"; then |
| 721 |
flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:" |
| 722 |
else |
| 723 |
flags="-blibpath: -Wl,-blibpath: -Wl,-rpath," |
| 724 |
fi |
| 725 |
for tryflags in $flags ;do |
| 726 |
if (test -z "$blibflags"); then |
| 727 |
LDFLAGS="$saved_LDFLAGS $tryflags$blibpath" |
| 728 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], |
| 729 |
[blibflags=$tryflags], []) |
| 730 |
fi |
| 731 |
done |
| 732 |
if (test -z "$blibflags"); then |
| 733 |
AC_MSG_RESULT([not found]) |
| 734 |
AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log]) |
| 735 |
else |
| 736 |
AC_MSG_RESULT([$blibflags]) |
| 737 |
fi |
| 738 |
LDFLAGS="$saved_LDFLAGS" |
| 739 |
dnl Check for authenticate. Might be in libs.a on older AIXes |
| 740 |
AC_CHECK_FUNC([authenticate], [AC_DEFINE([WITH_AIXAUTHENTICATE], [1], |
| 741 |
[Define if you want to enable AIX4's authenticate function])], |
| 742 |
[AC_CHECK_LIB([s], [authenticate], |
| 743 |
[ AC_DEFINE([WITH_AIXAUTHENTICATE]) |
| 744 |
LIBS="$LIBS -ls" |
| 745 |
]) |
| 746 |
]) |
| 747 |
dnl Check for various auth function declarations in headers. |
| 748 |
AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess, |
| 749 |
passwdexpired, setauthdb], , , [#include <usersec.h>]) |
| 750 |
dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2) |
| 751 |
AC_CHECK_DECLS([loginfailed], |
| 752 |
[AC_MSG_CHECKING([if loginfailed takes 4 arguments]) |
| 753 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <usersec.h> ]], |
| 754 |
[[ (void)loginfailed("user","host","tty",0); ]])], |
| 755 |
[AC_MSG_RESULT([yes]) |
| 756 |
AC_DEFINE([AIX_LOGINFAILED_4ARG], [1], |
| 757 |
[Define if your AIX loginfailed() function |
| 758 |
takes 4 arguments (AIX >= 5.2)])], [AC_MSG_RESULT([no]) |
| 759 |
])], |
| 760 |
[], |
| 761 |
[#include <usersec.h>] |
| 762 |
) |
| 763 |
AC_CHECK_FUNCS([getgrset setauthdb]) |
| 764 |
AC_CHECK_DECL([F_CLOSEM], |
| 765 |
AC_DEFINE([HAVE_FCNTL_CLOSEM], [1], [Use F_CLOSEM fcntl for closefrom]), |
| 766 |
[], |
| 767 |
[ #include <limits.h> |
| 768 |
#include <fcntl.h> ] |
| 769 |
) |
| 770 |
check_for_aix_broken_getaddrinfo=1 |
| 771 |
AC_DEFINE([SETEUID_BREAKS_SETUID], [1], |
| 772 |
[Define if your platform breaks doing a seteuid before a setuid]) |
| 773 |
AC_DEFINE([BROKEN_SETREUID], [1], [Define if your setreuid() is broken]) |
| 774 |
AC_DEFINE([BROKEN_SETREGID], [1], [Define if your setregid() is broken]) |
| 775 |
dnl AIX handles lastlog as part of its login message |
| 776 |
AC_DEFINE([DISABLE_LASTLOG], [1], [Define if you don't want to use lastlog]) |
| 777 |
AC_DEFINE([LOGIN_NEEDS_UTMPX], [1], |
| 778 |
[Some systems need a utmpx entry for /bin/login to work]) |
| 779 |
AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV], |
| 780 |
[Define to a Set Process Title type if your system is |
| 781 |
supported by bsd-setproctitle.c]) |
| 782 |
AC_DEFINE([PTY_ZEROREAD], [1], [read(1) can return 0 for a non-closed fd]) |
| 783 |
AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)]) |
| 784 |
AC_DEFINE([BROKEN_STRNDUP], 1, [strndup broken, see APAR IY61211]) |
| 785 |
AC_DEFINE([BROKEN_STRNLEN], 1, [strnlen broken, see APAR IY62551]) |
| 786 |
;; |
| 787 |
*-*-android*) |
| 788 |
AC_DEFINE([DISABLE_UTMP], [1], [Define if you don't want to use utmp]) |
| 789 |
AC_DEFINE([DISABLE_WTMP], [1], [Define if you don't want to use wtmp]) |
| 790 |
;; |
| 791 |
*-*-cygwin*) |
| 792 |
LIBS="$LIBS /usr/lib/textreadmode.o" |
| 793 |
AC_DEFINE([HAVE_CYGWIN], [1], [Define if you are on Cygwin]) |
| 794 |
AC_DEFINE([USE_PIPES], [1], [Use PIPES instead of a socketpair()]) |
| 795 |
AC_DEFINE([NO_UID_RESTORATION_TEST], [1], |
| 796 |
[Define to disable UID restoration test]) |
| 797 |
AC_DEFINE([DISABLE_SHADOW], [1], |
| 798 |
[Define if you want to disable shadow passwords]) |
| 799 |
AC_DEFINE([NO_X11_UNIX_SOCKETS], [1], |
| 800 |
[Define if X11 doesn't support AF_UNIX sockets on that system]) |
| 801 |
AC_DEFINE([DISABLE_FD_PASSING], [1], |
| 802 |
[Define if your platform needs to skip post auth |
| 803 |
file descriptor passing]) |
| 804 |
AC_DEFINE([SSH_IOBUFSZ], [65535], [Windows is sensitive to read buffer size]) |
| 805 |
AC_DEFINE([FILESYSTEM_NO_BACKSLASH], [1], [File names may not contain backslash characters]) |
| 806 |
# Cygwin defines optargs, optargs as declspec(dllimport) for historical |
| 807 |
# reasons which cause compile warnings, so we disable those warnings. |
| 808 |
OSSH_CHECK_CFLAG_COMPILE([-Wno-attributes]) |
| 809 |
SHLIBEXT=".dll" |
| 810 |
;; |
| 811 |
*-*-dgux*) |
| 812 |
AC_DEFINE([IP_TOS_IS_BROKEN], [1], |
| 813 |
[Define if your system choked on IP TOS setting]) |
| 814 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 815 |
AC_DEFINE([BROKEN_SETREUID]) |
| 816 |
AC_DEFINE([BROKEN_SETREGID]) |
| 817 |
;; |
| 818 |
*-*-darwin*) |
| 819 |
use_pie=auto |
| 820 |
AC_MSG_CHECKING([if we have working getaddrinfo]) |
| 821 |
AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
| 822 |
#include <mach-o/dyld.h> |
| 823 |
#include <stdlib.h> |
| 824 |
int main(void) { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) |
| 825 |
exit(0); |
| 826 |
else |
| 827 |
exit(1); |
| 828 |
} |
| 829 |
]])], |
| 830 |
[AC_MSG_RESULT([working])], |
| 831 |
[AC_MSG_RESULT([buggy]) |
| 832 |
AC_DEFINE([BROKEN_GETADDRINFO], [1], |
| 833 |
[getaddrinfo is broken (if present)]) |
| 834 |
], |
| 835 |
[AC_MSG_RESULT([assume it is working])]) |
| 836 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 837 |
AC_DEFINE([BROKEN_SETREUID]) |
| 838 |
AC_DEFINE([BROKEN_SETREGID]) |
| 839 |
broken_glob=yes # OS X glob does not do what we expect |
| 840 |
AC_DEFINE_UNQUOTED([BIND_8_COMPAT], [1], |
| 841 |
[Define if your resolver libs need this for getrrsetbyname]) |
| 842 |
AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) |
| 843 |
AC_DEFINE([SSH_TUN_COMPAT_AF], [1], |
| 844 |
[Use tunnel device compatibility to OpenBSD]) |
| 845 |
AC_DEFINE([SSH_TUN_PREPEND_AF], [1], |
| 846 |
[Prepend the address family to IP tunnel traffic]) |
| 847 |
m4_pattern_allow([AU_IPv]) |
| 848 |
AC_CHECK_DECL([AU_IPv4], [], |
| 849 |
AC_DEFINE([AU_IPv4], [0], [System only supports IPv4 audit records]) |
| 850 |
[#include <bsm/audit.h>] |
| 851 |
AC_DEFINE([LASTLOG_WRITE_PUTUTXLINE], [1], |
| 852 |
[Define if pututxline updates lastlog too]) |
| 853 |
) |
| 854 |
AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV], |
| 855 |
[Define to a Set Process Title type if your system is |
| 856 |
supported by bsd-setproctitle.c]) |
| 857 |
AC_CHECK_FUNCS([sandbox_init]) |
| 858 |
AC_CHECK_HEADERS([sandbox.h]) |
| 859 |
AC_CHECK_LIB([sandbox], [sandbox_apply], [ |
| 860 |
SSHDLIBS="$SSHDLIBS -lsandbox" |
| 861 |
]) |
| 862 |
# proc_pidinfo()-based closefrom() replacement. |
| 863 |
AC_CHECK_HEADERS([libproc.h]) |
| 864 |
AC_CHECK_FUNCS([proc_pidinfo]) |
| 865 |
# poll(2) is broken for character-special devices (at least). |
| 866 |
# cf. Apple bug 3710161 (not public, but searchable) |
| 867 |
AC_DEFINE([BROKEN_POLL], [1], |
| 868 |
[System poll(2) implementation is broken]) |
| 869 |
SHLIBEXT=".dylib" |
| 870 |
;; |
| 871 |
*-*-dragonfly*) |
| 872 |
SSHDLIBS="$SSHDLIBS" |
| 873 |
TEST_MALLOC_OPTIONS="AFGJPRX" |
| 874 |
;; |
| 875 |
*-*-haiku*) |
| 876 |
LIBS="$LIBS -lbsd " |
| 877 |
CFLAGS="$CFLAGS -D_BSD_SOURCE" |
| 878 |
AC_CHECK_LIB([network], [socket]) |
| 879 |
AC_DEFINE([HAVE_U_INT64_T]) |
| 880 |
AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx]) |
| 881 |
MANTYPE=man |
| 882 |
;; |
| 883 |
*-*-hpux*) |
| 884 |
# first we define all of the options common to all HP-UX releases |
| 885 |
CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" |
| 886 |
IPADDR_IN_DISPLAY=yes |
| 887 |
AC_DEFINE([USE_PIPES]) |
| 888 |
AC_DEFINE([LOGIN_NEEDS_UTMPX]) |
| 889 |
AC_DEFINE([LOCKED_PASSWD_STRING], ["*"], |
| 890 |
[String used in /etc/passwd to denote locked account]) |
| 891 |
AC_DEFINE([SPT_TYPE], [SPT_PSTAT]) |
| 892 |
AC_DEFINE([PLATFORM_SYS_DIR_UID], 2, [System dirs owned by bin (uid 2)]) |
| 893 |
maildir="/var/mail" |
| 894 |
LIBS="$LIBS -lsec" |
| 895 |
AC_CHECK_LIB([xnet], [t_error], , |
| 896 |
[AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***])]) |
| 897 |
|
| 898 |
# next, we define all of the options specific to major releases |
| 899 |
case "$host" in |
| 900 |
*-*-hpux10*) |
| 901 |
if test -z "$GCC"; then |
| 902 |
CFLAGS="$CFLAGS -Ae" |
| 903 |
fi |
| 904 |
AC_DEFINE([BROKEN_GETLINE], [1], [getline is not what we expect]) |
| 905 |
;; |
| 906 |
*-*-hpux11*) |
| 907 |
AC_DEFINE([PAM_SUN_CODEBASE], [1], |
| 908 |
[Define if you are using Solaris-derived PAM which |
| 909 |
passes pam_messages to the conversation function |
| 910 |
with an extra level of indirection]) |
| 911 |
AC_DEFINE([DISABLE_UTMP], [1], |
| 912 |
[Define if you don't want to use utmp]) |
| 913 |
AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins]) |
| 914 |
check_for_hpux_broken_getaddrinfo=1 |
| 915 |
check_for_conflicting_getspnam=1 |
| 916 |
;; |
| 917 |
esac |
| 918 |
|
| 919 |
# lastly, we define options specific to minor releases |
| 920 |
case "$host" in |
| 921 |
*-*-hpux10.26) |
| 922 |
AC_DEFINE([HAVE_SECUREWARE], [1], |
| 923 |
[Define if you have SecureWare-based |
| 924 |
protected password database]) |
| 925 |
disable_ptmx_check=yes |
| 926 |
LIBS="$LIBS -lsecpw" |
| 927 |
;; |
| 928 |
esac |
| 929 |
;; |
| 930 |
*-*-irix5*) |
| 931 |
PATH="$PATH:/usr/etc" |
| 932 |
AC_DEFINE([BROKEN_INET_NTOA], [1], |
| 933 |
[Define if you system's inet_ntoa is busted |
| 934 |
(e.g. Irix gcc issue)]) |
| 935 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 936 |
AC_DEFINE([BROKEN_SETREUID]) |
| 937 |
AC_DEFINE([BROKEN_SETREGID]) |
| 938 |
AC_DEFINE([WITH_ABBREV_NO_TTY], [1], |
| 939 |
[Define if you shouldn't strip 'tty' from your |
| 940 |
ttyname in [uw]tmp]) |
| 941 |
AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
| 942 |
;; |
| 943 |
*-*-irix6*) |
| 944 |
PATH="$PATH:/usr/etc" |
| 945 |
AC_DEFINE([WITH_IRIX_ARRAY], [1], |
| 946 |
[Define if you have/want arrays |
| 947 |
(cluster-wide session management, not C arrays)]) |
| 948 |
AC_DEFINE([WITH_IRIX_PROJECT], [1], |
| 949 |
[Define if you want IRIX project management]) |
| 950 |
AC_DEFINE([WITH_IRIX_AUDIT], [1], |
| 951 |
[Define if you want IRIX audit trails]) |
| 952 |
AC_CHECK_FUNC([jlimit_startjob], [AC_DEFINE([WITH_IRIX_JOBS], [1], |
| 953 |
[Define if you want IRIX kernel jobs])]) |
| 954 |
AC_DEFINE([BROKEN_INET_NTOA]) |
| 955 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 956 |
AC_DEFINE([BROKEN_SETREUID]) |
| 957 |
AC_DEFINE([BROKEN_SETREGID]) |
| 958 |
AC_DEFINE([BROKEN_UPDWTMPX], [1], [updwtmpx is broken (if present)]) |
| 959 |
AC_DEFINE([WITH_ABBREV_NO_TTY]) |
| 960 |
AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
| 961 |
;; |
| 962 |
*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) |
| 963 |
AC_DEFINE([PAM_TTY_KLUDGE]) |
| 964 |
AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"]) |
| 965 |
AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV]) |
| 966 |
AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts]) |
| 967 |
AC_DEFINE([USE_BTMP], [1], [Use btmp to log bad logins]) |
| 968 |
;; |
| 969 |
*-*-linux*) |
| 970 |
no_dev_ptmx=1 |
| 971 |
use_pie=auto |
| 972 |
check_for_openpty_ctty_bug=1 |
| 973 |
dnl Target SUSv3/POSIX.1-2001 plus BSD specifics. |
| 974 |
dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE |
| 975 |
dnl _GNU_SOURCE is needed for setres*id prototypes. |
| 976 |
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE" |
| 977 |
AC_DEFINE([BROKEN_CLOSEFROM], [1], [broken in chroots on older kernels]) |
| 978 |
AC_DEFINE([PAM_TTY_KLUDGE], [1], |
| 979 |
[Work around problematic Linux PAM modules handling of PAM_TTY]) |
| 980 |
AC_DEFINE([LOCKED_PASSWD_PREFIX], ["!"], |
| 981 |
[String used in /etc/passwd to denote locked account]) |
| 982 |
AC_DEFINE([SPT_TYPE], [SPT_REUSEARGV]) |
| 983 |
AC_DEFINE([LINK_OPNOTSUPP_ERRNO], [EPERM], |
| 984 |
[Define to whatever link() returns for "not supported" |
| 985 |
if it doesn't return EOPNOTSUPP.]) |
| 986 |
AC_DEFINE([_PATH_BTMP], ["/var/log/btmp"], [log for bad login attempts]) |
| 987 |
AC_DEFINE([USE_BTMP]) |
| 988 |
AC_DEFINE([LINUX_OOM_ADJUST], [1], [Adjust Linux out-of-memory killer]) |
| 989 |
AC_ARG_WITH([linux-memlock-onfault], |
| 990 |
[ --with-linux-memlock-onfault Enables memory locking on Linux], |
| 991 |
[ |
| 992 |
if test "x$withval" != "xno" ; then |
| 993 |
AC_MSG_CHECKING([for MCL_ONFAULT]) |
| 994 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
| 995 |
[[ #include <sys/mman.h> ]], |
| 996 |
[[ mlockall(MCL_FUTURE | MCL_ONFAULT); ]], |
| 997 |
)], |
| 998 |
[ |
| 999 |
AC_MSG_RESULT([supported]) |
| 1000 |
AC_DEFINE([LINUX_MEMLOCK_ONFAULT], [1], |
| 1001 |
[Lock all memory to protect sshd against Linux kcompactd] )], |
| 1002 |
[ |
| 1003 |
AC_MSG_RESULT([not supported]) |
| 1004 |
AC_MSG_ERROR([MCL_ONFAULT is not available on your system]) |
| 1005 |
]) |
| 1006 |
fi |
| 1007 |
], |
| 1008 |
) |
| 1009 |
|
| 1010 |
AC_DEFINE([SYSTEMD_NOTIFY], [1], [Have sshd notify systemd on start/reload]) |
| 1011 |
inet6_default_4in6=yes |
| 1012 |
case `uname -r` in |
| 1013 |
1.*|2.0.*) |
| 1014 |
AC_DEFINE([BROKEN_CMSG_TYPE], [1], |
| 1015 |
[Define if cmsg_type is not passed correctly]) |
| 1016 |
;; |
| 1017 |
esac |
| 1018 |
# tun(4) forwarding compat code |
| 1019 |
AC_CHECK_HEADERS([linux/if_tun.h]) |
| 1020 |
if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then |
| 1021 |
AC_DEFINE([SSH_TUN_LINUX], [1], |
| 1022 |
[Open tunnel devices the Linux tun/tap way]) |
| 1023 |
AC_DEFINE([SSH_TUN_COMPAT_AF], [1], |
| 1024 |
[Use tunnel device compatibility to OpenBSD]) |
| 1025 |
AC_DEFINE([SSH_TUN_PREPEND_AF], [1], |
| 1026 |
[Prepend the address family to IP tunnel traffic]) |
| 1027 |
fi |
| 1028 |
AC_CHECK_HEADER([linux/if.h], |
| 1029 |
AC_DEFINE([SYS_RDOMAIN_LINUX], [1], |
| 1030 |
[Support routing domains using Linux VRF]), [], [ |
| 1031 |
#ifdef HAVE_SYS_TYPES_H |
| 1032 |
# include <sys/types.h> |
| 1033 |
#endif |
| 1034 |
]) |
| 1035 |
AC_CHECK_HEADERS([linux/seccomp.h linux/filter.h linux/audit.h], [], |
| 1036 |
[], [#include <linux/types.h>]) |
| 1037 |
# Obtain MIPS ABI |
| 1038 |
case "$host" in |
| 1039 |
mips*) |
| 1040 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1041 |
#if _MIPS_SIM != _ABIO32 |
| 1042 |
#error |
| 1043 |
#endif |
| 1044 |
]])],[mips_abi="o32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1045 |
#if _MIPS_SIM != _ABIN32 |
| 1046 |
#error |
| 1047 |
#endif |
| 1048 |
]])],[mips_abi="n32"],[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 1049 |
#if _MIPS_SIM != _ABI64 |
| 1050 |
#error |
| 1051 |
#endif |
| 1052 |
]])],[mips_abi="n64"],[AC_MSG_ERROR([unknown MIPS ABI]) |
| 1053 |
]) |
| 1054 |
]) |
| 1055 |
]) |
| 1056 |
;; |
| 1057 |
esac |
| 1058 |
AC_MSG_CHECKING([for seccomp architecture]) |
| 1059 |
seccomp_audit_arch= |
| 1060 |
case "$host" in |
| 1061 |
x86_64-*) |
| 1062 |
seccomp_audit_arch=AUDIT_ARCH_X86_64 |
| 1063 |
;; |
| 1064 |
i*86-*) |
| 1065 |
seccomp_audit_arch=AUDIT_ARCH_I386 |
| 1066 |
;; |
| 1067 |
arm*-*) |
| 1068 |
seccomp_audit_arch=AUDIT_ARCH_ARM |
| 1069 |
;; |
| 1070 |
aarch64*-*) |
| 1071 |
seccomp_audit_arch=AUDIT_ARCH_AARCH64 |
| 1072 |
;; |
| 1073 |
s390x-*) |
| 1074 |
seccomp_audit_arch=AUDIT_ARCH_S390X |
| 1075 |
;; |
| 1076 |
s390-*) |
| 1077 |
seccomp_audit_arch=AUDIT_ARCH_S390 |
| 1078 |
;; |
| 1079 |
powerpc-*) |
| 1080 |
seccomp_audit_arch=AUDIT_ARCH_PPC |
| 1081 |
;; |
| 1082 |
powerpc64-*) |
| 1083 |
seccomp_audit_arch=AUDIT_ARCH_PPC64 |
| 1084 |
;; |
| 1085 |
powerpc64le-*) |
| 1086 |
seccomp_audit_arch=AUDIT_ARCH_PPC64LE |
| 1087 |
;; |
| 1088 |
mips-*) |
| 1089 |
seccomp_audit_arch=AUDIT_ARCH_MIPS |
| 1090 |
;; |
| 1091 |
mipsel-*) |
| 1092 |
seccomp_audit_arch=AUDIT_ARCH_MIPSEL |
| 1093 |
;; |
| 1094 |
mips64-*) |
| 1095 |
case "$mips_abi" in |
| 1096 |
"n32") |
| 1097 |
seccomp_audit_arch=AUDIT_ARCH_MIPS64N32 |
| 1098 |
;; |
| 1099 |
"n64") |
| 1100 |
seccomp_audit_arch=AUDIT_ARCH_MIPS64 |
| 1101 |
;; |
| 1102 |
esac |
| 1103 |
;; |
| 1104 |
mips64el-*) |
| 1105 |
case "$mips_abi" in |
| 1106 |
"n32") |
| 1107 |
seccomp_audit_arch=AUDIT_ARCH_MIPSEL64N32 |
| 1108 |
;; |
| 1109 |
"n64") |
| 1110 |
seccomp_audit_arch=AUDIT_ARCH_MIPSEL64 |
| 1111 |
;; |
| 1112 |
esac |
| 1113 |
;; |
| 1114 |
riscv64-*) |
| 1115 |
seccomp_audit_arch=AUDIT_ARCH_RISCV64 |
| 1116 |
;; |
| 1117 |
esac |
| 1118 |
if test "x$seccomp_audit_arch" != "x" ; then |
| 1119 |
AC_MSG_RESULT(["$seccomp_audit_arch"]) |
| 1120 |
AC_DEFINE_UNQUOTED([SECCOMP_AUDIT_ARCH], [$seccomp_audit_arch], |
| 1121 |
[Specify the system call convention in use]) |
| 1122 |
else |
| 1123 |
AC_MSG_RESULT([architecture not supported]) |
| 1124 |
fi |
| 1125 |
;; |
| 1126 |
*-*-minix) |
| 1127 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1128 |
# poll(2) seems to choke on /dev/null; "Bad file descriptor" |
| 1129 |
AC_DEFINE([BROKEN_POLL], [1], |
| 1130 |
[System poll(2) implementation is broken]) |
| 1131 |
;; |
| 1132 |
mips-sony-bsd|mips-sony-newsos4) |
| 1133 |
AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to acquire controlling tty]) |
| 1134 |
SONY=1 |
| 1135 |
;; |
| 1136 |
*-*-netbsd*) |
| 1137 |
if test "x$withval" != "xno" ; then |
| 1138 |
rpath_opt="-R" |
| 1139 |
fi |
| 1140 |
CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" |
| 1141 |
AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) |
| 1142 |
AC_CHECK_HEADER([net/if_tap.h], , |
| 1143 |
AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support])) |
| 1144 |
AC_DEFINE([SSH_TUN_PREPEND_AF], [1], |
| 1145 |
[Prepend the address family to IP tunnel traffic]) |
| 1146 |
TEST_MALLOC_OPTIONS="AJRX" |
| 1147 |
AC_DEFINE([BROKEN_READ_COMPARISON], [1], |
| 1148 |
[NetBSD read function is sometimes redirected, breaking atomicio comparisons against it]) |
| 1149 |
;; |
| 1150 |
*-*-freebsd*) |
| 1151 |
AC_DEFINE([LOCKED_PASSWD_PREFIX], ["*LOCKED*"], [Account locked with pw(1)]) |
| 1152 |
AC_DEFINE([SSH_TUN_FREEBSD], [1], [Open tunnel devices the FreeBSD way]) |
| 1153 |
AC_DEFINE([SSH_TUN_COMPAT_AF], [1], |
| 1154 |
[Use tunnel device compatibility to OpenBSD]) |
| 1155 |
AC_CHECK_HEADER([net/if_tap.h], , |
| 1156 |
AC_DEFINE([SSH_TUN_NO_L2], [1], [No layer 2 tunnel support])) |
| 1157 |
broken_glob=yes # FreeBSD glob does not do what we need |
| 1158 |
TEST_MALLOC_OPTIONS="AJRX" |
| 1159 |
# Preauth crypto occasionally uses file descriptors for crypto offload |
| 1160 |
# and will crash if they cannot be opened. |
| 1161 |
AC_DEFINE([SANDBOX_SKIP_RLIMIT_NOFILE], [1], |
| 1162 |
[define if setrlimit RLIMIT_NOFILE breaks things]) |
| 1163 |
case "$host" in |
| 1164 |
*-*-freebsd9.*|*-*-freebsd10.*) |
| 1165 |
# Capsicum on 9 and 10 do not allow ppoll() so don't auto-enable. |
| 1166 |
disable_capsicum=yes |
| 1167 |
esac |
| 1168 |
;; |
| 1169 |
*-*-bsdi*) |
| 1170 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1171 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1172 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1173 |
;; |
| 1174 |
*-next-*) |
| 1175 |
conf_lastlog_location="/usr/adm/lastlog" |
| 1176 |
conf_utmp_location=/etc/utmp |
| 1177 |
conf_wtmp_location=/usr/adm/wtmp |
| 1178 |
maildir=/usr/spool/mail |
| 1179 |
AC_DEFINE([HAVE_NEXT], [1], [Define if you are on NeXT]) |
| 1180 |
AC_DEFINE([USE_PIPES]) |
| 1181 |
AC_DEFINE([BROKEN_SAVED_UIDS], [1], [Needed for NeXT]) |
| 1182 |
;; |
| 1183 |
*-*-openbsd*) |
| 1184 |
use_pie=auto |
| 1185 |
AC_DEFINE([HAVE_ATTRIBUTE__SENTINEL__], [1], [OpenBSD's gcc has sentinel]) |
| 1186 |
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD's gcc has bounded]) |
| 1187 |
AC_DEFINE([SSH_TUN_OPENBSD], [1], [Open tunnel devices the OpenBSD way]) |
| 1188 |
AC_DEFINE([SYSLOG_R_SAFE_IN_SIGHAND], [1], |
| 1189 |
[syslog_r function is safe to use in in a signal handler]) |
| 1190 |
TEST_MALLOC_OPTIONS="SJRU" |
| 1191 |
AC_MSG_CHECKING([whether pledge(2) allows IP_TOS]) |
| 1192 |
AC_RUN_IFELSE( |
| 1193 |
[AC_LANG_PROGRAM([[ |
| 1194 |
#include <sys/socket.h> |
| 1195 |
#include <netinet/in.h> |
| 1196 |
#include <unistd.h> |
| 1197 |
#include <stdlib.h> |
| 1198 |
#include <err.h> |
| 1199 |
]], [[ |
| 1200 |
int s, one = 1; |
| 1201 |
if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) |
| 1202 |
err(1, "socket"); |
| 1203 |
if (pledge("stdio", NULL) == -1) |
| 1204 |
err(1, "pledge"); |
| 1205 |
if (setsockopt(s, IPPROTO_IP, IP_TOS, &one, sizeof(one)) == -1) |
| 1206 |
err(1, "setsockopt"); |
| 1207 |
]])], |
| 1208 |
[ AC_MSG_RESULT([yes]) ], [ |
| 1209 |
AC_MSG_RESULT([no]) |
| 1210 |
need_pledge_inet=1 |
| 1211 |
], |
| 1212 |
[ AC_MSG_WARN([cross compiling: cannot test]) ]) |
| 1213 |
;; |
| 1214 |
*-*-solaris*) |
| 1215 |
if test "x$withval" != "xno" ; then |
| 1216 |
rpath_opt="-R" |
| 1217 |
fi |
| 1218 |
AC_DEFINE([PAM_SUN_CODEBASE]) |
| 1219 |
AC_DEFINE([LOGIN_NEEDS_UTMPX]) |
| 1220 |
AC_DEFINE([PAM_TTY_KLUDGE]) |
| 1221 |
AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
| 1222 |
# Pushing STREAMS modules will cause sshd to acquire a controlling tty. |
| 1223 |
AC_DEFINE([SSHD_ACQUIRES_CTTY], [1], |
| 1224 |
[Define if sshd somehow reacquires a controlling TTY |
| 1225 |
after setsid()]) |
| 1226 |
AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd |
| 1227 |
in case the name is longer than 8 chars]) |
| 1228 |
AC_DEFINE([BROKEN_TCGETATTR_ICANON], [1], [tcgetattr with ICANON may hang]) |
| 1229 |
external_path_file=/etc/default/login |
| 1230 |
# hardwire lastlog location (can't detect it on some versions) |
| 1231 |
conf_lastlog_location="/var/adm/lastlog" |
| 1232 |
AC_MSG_CHECKING([for obsolete utmp and wtmp in solaris2.x]) |
| 1233 |
sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'` |
| 1234 |
if test "$sol2ver" -ge 8; then |
| 1235 |
AC_MSG_RESULT([yes]) |
| 1236 |
AC_DEFINE([DISABLE_UTMP]) |
| 1237 |
AC_DEFINE([DISABLE_WTMP], [1], |
| 1238 |
[Define if you don't want to use wtmp]) |
| 1239 |
else |
| 1240 |
AC_MSG_RESULT([no]) |
| 1241 |
fi |
| 1242 |
AC_CHECK_FUNCS([setpflags]) |
| 1243 |
AC_CHECK_FUNCS([setppriv]) |
| 1244 |
AC_CHECK_FUNCS([priv_basicset]) |
| 1245 |
AC_CHECK_HEADERS([priv.h]) |
| 1246 |
AC_ARG_WITH([solaris-contracts], |
| 1247 |
[ --with-solaris-contracts Enable Solaris process contracts (experimental)], |
| 1248 |
[ |
| 1249 |
AC_CHECK_LIB([contract], [ct_tmpl_activate], |
| 1250 |
[ AC_DEFINE([USE_SOLARIS_PROCESS_CONTRACTS], [1], |
| 1251 |
[Define if you have Solaris process contracts]) |
| 1252 |
LIBS="$LIBS -lcontract" |
| 1253 |
SPC_MSG="yes" ], ) |
| 1254 |
], |
| 1255 |
) |
| 1256 |
AC_ARG_WITH([solaris-projects], |
| 1257 |
[ --with-solaris-projects Enable Solaris projects (experimental)], |
| 1258 |
[ |
| 1259 |
AC_CHECK_LIB([project], [setproject], |
| 1260 |
[ AC_DEFINE([USE_SOLARIS_PROJECTS], [1], |
| 1261 |
[Define if you have Solaris projects]) |
| 1262 |
LIBS="$LIBS -lproject" |
| 1263 |
SP_MSG="yes" ], ) |
| 1264 |
], |
| 1265 |
) |
| 1266 |
AC_ARG_WITH([solaris-privs], |
| 1267 |
[ --with-solaris-privs Enable Solaris/Illumos privileges (experimental)], |
| 1268 |
[ |
| 1269 |
AC_MSG_CHECKING([for Solaris/Illumos privilege support]) |
| 1270 |
if test "x$ac_cv_func_setppriv" = "xyes" -a \ |
| 1271 |
"x$ac_cv_header_priv_h" = "xyes" ; then |
| 1272 |
SOLARIS_PRIVS=yes |
| 1273 |
AC_MSG_RESULT([found]) |
| 1274 |
AC_DEFINE([NO_UID_RESTORATION_TEST], [1], |
| 1275 |
[Define to disable UID restoration test]) |
| 1276 |
AC_DEFINE([USE_SOLARIS_PRIVS], [1], |
| 1277 |
[Define if you have Solaris privileges]) |
| 1278 |
SPP_MSG="yes" |
| 1279 |
else |
| 1280 |
AC_MSG_RESULT([not found]) |
| 1281 |
AC_MSG_ERROR([*** must have support for Solaris privileges to use --with-solaris-privs]) |
| 1282 |
fi |
| 1283 |
], |
| 1284 |
) |
| 1285 |
TEST_SHELL=$SHELL # let configure find us a capable shell |
| 1286 |
;; |
| 1287 |
*-*-sunos4*) |
| 1288 |
CPPFLAGS="$CPPFLAGS -DSUNOS4" |
| 1289 |
AC_CHECK_FUNCS([getpwanam]) |
| 1290 |
AC_DEFINE([PAM_SUN_CODEBASE]) |
| 1291 |
conf_utmp_location=/etc/utmp |
| 1292 |
conf_wtmp_location=/var/adm/wtmp |
| 1293 |
conf_lastlog_location=/var/adm/lastlog |
| 1294 |
AC_DEFINE([USE_PIPES]) |
| 1295 |
AC_DEFINE([DISABLE_UTMPX], [1], [no utmpx]) |
| 1296 |
;; |
| 1297 |
*-ncr-sysv*) |
| 1298 |
LIBS="$LIBS -lc89" |
| 1299 |
AC_DEFINE([USE_PIPES]) |
| 1300 |
AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
| 1301 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1302 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1303 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1304 |
;; |
| 1305 |
*-sni-sysv*) |
| 1306 |
# /usr/ucblib MUST NOT be searched on ReliantUNIX |
| 1307 |
AC_CHECK_LIB([dl], [dlsym], ,) |
| 1308 |
# -lresolv needs to be at the end of LIBS or DNS lookups break |
| 1309 |
AC_CHECK_LIB([resolv], [res_query], [ LIBS="$LIBS -lresolv" ]) |
| 1310 |
IPADDR_IN_DISPLAY=yes |
| 1311 |
AC_DEFINE([USE_PIPES]) |
| 1312 |
AC_DEFINE([IP_TOS_IS_BROKEN]) |
| 1313 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1314 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1315 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1316 |
AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
| 1317 |
external_path_file=/etc/default/login |
| 1318 |
# /usr/ucblib/libucb.a no longer needed on ReliantUNIX |
| 1319 |
# Attention: always take care to bind libsocket and libnsl before libc, |
| 1320 |
# otherwise you will find lots of "SIOCGPGRP errno 22" on syslog |
| 1321 |
;; |
| 1322 |
# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel. |
| 1323 |
*-*-sysv4.2*) |
| 1324 |
AC_DEFINE([USE_PIPES]) |
| 1325 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1326 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1327 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1328 |
AC_DEFINE([PASSWD_NEEDS_USERNAME], [1], [must supply username to passwd]) |
| 1329 |
AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
| 1330 |
TEST_SHELL=$SHELL # let configure find us a capable shell |
| 1331 |
;; |
| 1332 |
# UnixWare 7.x, OpenUNIX 8 |
| 1333 |
*-*-sysv5*) |
| 1334 |
CPPFLAGS="$CPPFLAGS -Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf" |
| 1335 |
AC_DEFINE([UNIXWARE_LONG_PASSWORDS], [1], [Support passwords > 8 chars]) |
| 1336 |
AC_DEFINE([USE_PIPES]) |
| 1337 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1338 |
AC_DEFINE([BROKEN_GETADDRINFO]) |
| 1339 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1340 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1341 |
AC_DEFINE([PASSWD_NEEDS_USERNAME]) |
| 1342 |
AC_DEFINE([BROKEN_TCGETATTR_ICANON]) |
| 1343 |
TEST_SHELL=$SHELL # let configure find us a capable shell |
| 1344 |
case "$host" in |
| 1345 |
*-*-sysv5SCO_SV*) # SCO OpenServer 6.x |
| 1346 |
maildir=/var/spool/mail |
| 1347 |
AC_DEFINE([BROKEN_UPDWTMPX]) |
| 1348 |
AC_CHECK_LIB([prot], [getluid], [ LIBS="$LIBS -lprot" |
| 1349 |
AC_CHECK_FUNCS([getluid setluid], , , [-lprot]) |
| 1350 |
], , ) |
| 1351 |
;; |
| 1352 |
*) AC_DEFINE([LOCKED_PASSWD_STRING], ["*LK*"]) |
| 1353 |
;; |
| 1354 |
esac |
| 1355 |
;; |
| 1356 |
*-*-sysv*) |
| 1357 |
;; |
| 1358 |
# SCO UNIX and OEM versions of SCO UNIX |
| 1359 |
*-*-sco3.2v4*) |
| 1360 |
AC_MSG_ERROR("This Platform is no longer supported.") |
| 1361 |
;; |
| 1362 |
# SCO OpenServer 5.x |
| 1363 |
*-*-sco3.2v5*) |
| 1364 |
if test -z "$GCC"; then |
| 1365 |
CFLAGS="$CFLAGS -belf" |
| 1366 |
fi |
| 1367 |
LIBS="$LIBS -lprot -lx -ltinfo -lm" |
| 1368 |
no_dev_ptmx=1 |
| 1369 |
AC_DEFINE([USE_PIPES]) |
| 1370 |
AC_DEFINE([HAVE_SECUREWARE]) |
| 1371 |
AC_DEFINE([DISABLE_SHADOW]) |
| 1372 |
AC_DEFINE([DISABLE_FD_PASSING]) |
| 1373 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1374 |
AC_DEFINE([BROKEN_GETADDRINFO]) |
| 1375 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1376 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1377 |
AC_DEFINE([WITH_ABBREV_NO_TTY]) |
| 1378 |
AC_DEFINE([BROKEN_UPDWTMPX]) |
| 1379 |
AC_DEFINE([PASSWD_NEEDS_USERNAME]) |
| 1380 |
AC_CHECK_FUNCS([getluid setluid]) |
| 1381 |
MANTYPE=man |
| 1382 |
TEST_SHELL=$SHELL # let configure find us a capable shell |
| 1383 |
SKIP_DISABLE_LASTLOG_DEFINE=yes |
| 1384 |
;; |
| 1385 |
*-dec-osf*) |
| 1386 |
AC_MSG_CHECKING([for Digital Unix SIA]) |
| 1387 |
no_osfsia="" |
| 1388 |
AC_ARG_WITH([osfsia], |
| 1389 |
[ --with-osfsia Enable Digital Unix SIA], |
| 1390 |
[ |
| 1391 |
if test "x$withval" = "xno" ; then |
| 1392 |
AC_MSG_RESULT([disabled]) |
| 1393 |
no_osfsia=1 |
| 1394 |
fi |
| 1395 |
], |
| 1396 |
) |
| 1397 |
if test -z "$no_osfsia" ; then |
| 1398 |
if test -f /etc/sia/matrix.conf; then |
| 1399 |
AC_MSG_RESULT([yes]) |
| 1400 |
AC_DEFINE([HAVE_OSF_SIA], [1], |
| 1401 |
[Define if you have Digital Unix Security |
| 1402 |
Integration Architecture]) |
| 1403 |
AC_DEFINE([DISABLE_LOGIN], [1], |
| 1404 |
[Define if you don't want to use your |
| 1405 |
system's login() call]) |
| 1406 |
AC_DEFINE([DISABLE_FD_PASSING]) |
| 1407 |
LIBS="$LIBS -lsecurity -ldb -lm -laud" |
| 1408 |
SIA_MSG="yes" |
| 1409 |
else |
| 1410 |
AC_MSG_RESULT([no]) |
| 1411 |
AC_DEFINE([LOCKED_PASSWD_SUBSTR], ["Nologin"], |
| 1412 |
[String used in /etc/passwd to denote locked account]) |
| 1413 |
fi |
| 1414 |
fi |
| 1415 |
AC_DEFINE([BROKEN_GETADDRINFO]) |
| 1416 |
AC_DEFINE([SETEUID_BREAKS_SETUID]) |
| 1417 |
AC_DEFINE([BROKEN_SETREUID]) |
| 1418 |
AC_DEFINE([BROKEN_SETREGID]) |
| 1419 |
AC_DEFINE([BROKEN_READV_COMPARISON], [1], [Can't do comparisons on readv]) |
| 1420 |
;; |
| 1421 |
|
| 1422 |
*-*-nto-qnx*) |
| 1423 |
AC_DEFINE([USE_PIPES]) |
| 1424 |
AC_DEFINE([NO_X11_UNIX_SOCKETS]) |
| 1425 |
AC_DEFINE([DISABLE_LASTLOG]) |
| 1426 |
AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
| 1427 |
AC_DEFINE([BROKEN_SHADOW_EXPIRE], [1], [QNX shadow support is broken]) |
| 1428 |
enable_etc_default_login=no # has incompatible /etc/default/login |
| 1429 |
case "$host" in |
| 1430 |
*-*-nto-qnx6*) |
| 1431 |
AC_DEFINE([DISABLE_FD_PASSING]) |
| 1432 |
;; |
| 1433 |
esac |
| 1434 |
;; |
| 1435 |
|
| 1436 |
*-*-ultrix*) |
| 1437 |
AC_DEFINE([BROKEN_GETGROUPS], [1], [getgroups(0,NULL) will return -1]) |
| 1438 |
AC_DEFINE([NEED_SETPGRP], [1], [Need setpgrp to for controlling tty]) |
| 1439 |
AC_DEFINE([HAVE_SYS_SYSLOG_H], [1], [Force use of sys/syslog.h on Ultrix]) |
| 1440 |
AC_DEFINE([DISABLE_UTMPX], [1], [Disable utmpx]) |
| 1441 |
# DISABLE_FD_PASSING so that we call setpgrp as root, otherwise we |
| 1442 |
# don't get a controlling tty. |
| 1443 |
AC_DEFINE([DISABLE_FD_PASSING], [1], [Need to call setpgrp as root]) |
| 1444 |
# On Ultrix some headers are not protected against multiple includes, |
| 1445 |
# so we create wrappers and put it where the compiler will find it. |
| 1446 |
AC_MSG_WARN([creating compat wrappers for headers]) |
| 1447 |
mkdir -p netinet |
| 1448 |
for header in netinet/ip.h netdb.h resolv.h; do |
| 1449 |
name=`echo $header | tr 'a-z/.' 'A-Z__'` |
| 1450 |
cat >$header <<EOD |
| 1451 |
#ifndef _SSH_COMPAT_${name} |
| 1452 |
#define _SSH_COMPAT_${name} |
| 1453 |
#include "/usr/include/${header}" |
| 1454 |
#endif |
| 1455 |
EOD |
| 1456 |
done |
| 1457 |
;; |
| 1458 |
|
| 1459 |
*-*-lynxos) |
| 1460 |
CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__" |
| 1461 |
AC_DEFINE([BROKEN_SETVBUF], [1], |
| 1462 |
[LynxOS has broken setvbuf() implementation]) |
| 1463 |
;; |
| 1464 |
*-*-gnu*) |
| 1465 |
dnl GNU Hurd. Needs to be after the linux and the other *-gnu entries. |
| 1466 |
dnl Target SUSv3/POSIX.1-2001 plus BSD specifics. |
| 1467 |
dnl _DEFAULT_SOURCE is the new name for _BSD_SOURCE |
| 1468 |
dnl _GNU_SOURCE is needed for setres*id prototypes. |
| 1469 |
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_GNU_SOURCE" |
| 1470 |
;; |
| 1471 |
esac |
| 1472 |
|
| 1473 |
AC_MSG_CHECKING([compiler and flags for sanity]) |
| 1474 |
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdlib.h> ]], [[ exit(0); ]])], |
| 1475 |
[ AC_MSG_RESULT([yes]) ], |
| 1476 |
[ |
| 1477 |
AC_MSG_RESULT([no]) |
| 1478 |
AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***]) |
| 1479 |
], |
| 1480 |
[ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ] |
| 1481 |
) |
| 1482 |
|
| 1483 |
dnl Finish up special pledge(2) handling from above. |
| 1484 |
if test -z "$need_pledge_inet" ; then |
| 1485 |
AC_DEFINE_UNQUOTED([PLEDGE_EXTRA_INET], []) |
| 1486 |
else |
| 1487 |
AC_DEFINE_UNQUOTED([PLEDGE_EXTRA_INET], ["inet "], |
| 1488 |
[need inet in pledge for setsockopt IP_TOS]) |
| 1489 |
fi |
| 1490 |
|
| 1491 |
dnl Checks for header files. |
| 1492 |
# Checks for libraries. |
| 1493 |
AC_CHECK_FUNC([setsockopt], , [AC_CHECK_LIB([socket], [setsockopt])]) |
| 1494 |
|
| 1495 |
dnl IRIX and Solaris 2.5.1 have dirname() in libgen |
| 1496 |
AC_CHECK_FUNCS([dirname], [AC_CHECK_HEADERS([libgen.h])] , [ |
| 1497 |
AC_CHECK_LIB([gen], [dirname], [ |
| 1498 |
AC_CACHE_CHECK([for broken dirname], |
| 1499 |
ac_cv_have_broken_dirname, [ |
| 1500 |
save_LIBS="$LIBS" |
| 1501 |
LIBS="$LIBS -lgen" |
| 1502 |
AC_RUN_IFELSE( |
| 1503 |
[AC_LANG_SOURCE([[ |
| 1504 |
#include <libgen.h> |
| 1505 |
#include <string.h> |
| 1506 |
#include <stdlib.h> |
| 1507 |
|
| 1508 |
int main(int argc, char **argv) { |
| 1509 |
char *s, buf[32]; |
| 1510 |
|
| 1511 |
strncpy(buf,"/etc", 32); |
| 1512 |
s = dirname(buf); |
| 1513 |
if (!s || strncmp(s, "/", 32) != 0) { |
| 1514 |
exit(1); |
| 1515 |
} else { |
| 1516 |
exit(0); |
| 1517 |
} |
| 1518 |
} |
| 1519 |
]])], |
| 1520 |
[ ac_cv_have_broken_dirname="no" ], |
| 1521 |
[ ac_cv_have_broken_dirname="yes" ], |
| 1522 |
[ ac_cv_have_broken_dirname="no" ], |
| 1523 |
) |
| 1524 |
LIBS="$save_LIBS" |
| 1525 |
]) |
| 1526 |
if test "x$ac_cv_have_broken_dirname" = "xno" ; then |
| 1527 |
LIBS="$LIBS -lgen" |
| 1528 |
AC_DEFINE([HAVE_DIRNAME]) |
| 1529 |
AC_CHECK_HEADERS([libgen.h]) |
| 1530 |
fi |
| 1531 |
]) |
| 1532 |
]) |
| 1533 |
|
| 1534 |
AC_CHECK_FUNC([getspnam], , |
| 1535 |
[AC_CHECK_LIB([gen], [getspnam], [LIBS="$LIBS -lgen"])]) |
| 1536 |
AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1], |
| 1537 |
[Define if you have the basename function.])]) |
| 1538 |
|
| 1539 |
dnl sqrt() only used in unit tests. |
| 1540 |
AC_CHECK_FUNC([sqrt], , |
| 1541 |
[AC_CHECK_LIB([m], [sqrt], [TESTLIBS="$TESTLIBS -lm"])]) |
| 1542 |
AC_SUBST([TESTLIBS]) |
| 1543 |
|
| 1544 |
dnl zlib defaults to enabled |
| 1545 |
zlib=yes |
| 1546 |
AC_ARG_WITH([zlib], |
| 1547 |
[ --with-zlib=PATH Use zlib in PATH], |
| 1548 |
[ if test "x$withval" = "xno" ; then |
| 1549 |
zlib=no |
| 1550 |
elif test "x$withval" != "xyes"; then |
| 1551 |
if test -d "$withval/lib"; then |
| 1552 |
if test -n "${rpath_opt}"; then |
| 1553 |
LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" |
| 1554 |
else |
| 1555 |
LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
| 1556 |
fi |
| 1557 |
else |
| 1558 |
if test -n "${rpath_opt}"; then |
| 1559 |
LDFLAGS="-L${withval} ${rpath_opt}${withval} ${LDFLAGS}" |
| 1560 |
else |
| 1561 |
LDFLAGS="-L${withval} ${LDFLAGS}" |
| 1562 |
fi |
| 1563 |
fi |
| 1564 |
if test -d "$withval/include"; then |
| 1565 |
CPPFLAGS="-I${withval}/include ${CPPFLAGS}" |
| 1566 |
else |
| 1567 |
CPPFLAGS="-I${withval} ${CPPFLAGS}" |
| 1568 |
fi |
| 1569 |
fi ] |
| 1570 |
) |
| 1571 |
|
| 1572 |
# These libraries are needed for anything that links in the channel code. |
| 1573 |
CHANNELLIBS="" |
| 1574 |
AC_MSG_CHECKING([for zlib]) |
| 1575 |
if test "x${zlib}" = "xno"; then |
| 1576 |
AC_MSG_RESULT([no]) |
| 1577 |
else |
| 1578 |
saved_LIBS="$LIBS" |
| 1579 |
CHANNELLIBS="$CHANNELLIBS -lz" |
| 1580 |
AC_MSG_RESULT([yes]) |
| 1581 |
AC_DEFINE([WITH_ZLIB], [1], [Enable zlib]) |
| 1582 |
AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])]) |
| 1583 |
AC_CHECK_LIB([z], [deflate], [], |
| 1584 |
[ |
| 1585 |
saved_CPPFLAGS="$CPPFLAGS" |
| 1586 |
saved_LDFLAGS="$LDFLAGS" |
| 1587 |
dnl Check default zlib install dir |
| 1588 |
if test -n "${rpath_opt}"; then |
| 1589 |
LDFLAGS="-L/usr/local/lib ${rpath_opt}/usr/local/lib ${saved_LDFLAGS}" |
| 1590 |
else |
| 1591 |
LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}" |
| 1592 |
fi |
| 1593 |
CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}" |
| 1594 |
AC_TRY_LINK_FUNC([deflate], [AC_DEFINE([HAVE_LIBZ])], |
| 1595 |
[ |
| 1596 |
AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]) |
| 1597 |
] |
| 1598 |
) |
| 1599 |
] |
| 1600 |
) |
| 1601 |
|
| 1602 |
AC_ARG_WITH([zlib-version-check], |
| 1603 |
[ --without-zlib-version-check Disable zlib version check], |
| 1604 |
[ if test "x$withval" = "xno" ; then |
| 1605 |
zlib_check_nonfatal=1 |
| 1606 |
fi |
| 1607 |
] |
| 1608 |
) |
| 1609 |
|
| 1610 |
AC_MSG_CHECKING([for possibly buggy zlib]) |
| 1611 |
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
| 1612 |
#include <stdio.h> |
| 1613 |
#include <stdlib.h> |
| 1614 |
#include <zlib.h> |
| 1615 |
]], |
| 1616 |
[[ |
| 1617 |
int a=0, b=0, c=0, d=0, n, v; |
| 1618 |
n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d); |
| 1619 |
if (n < 1) |
| 1620 |
exit(1); |
| 1621 |
v = a*1000000 + b*10000 + c*100 + d; |
| 1622 |
fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v); |
| 1623 |
|
| 1624 |
/* 1.1.4 is OK */ |
| 1625 |
if (a == 1 && b == 1 && c >= 4) |
| 1626 |
exit(0); |
| 1627 |
|
| 1628 |
/* 1.2.3 and up are OK */ |
| 1629 |
if (v >= 1020300) |
| 1630 |
exit(0); |
| 1631 |
|
| 1632 |
exit(2); |
| 1633 |
]])], |
| 1634 |
AC_MSG_RESULT([no]), |
| 1635 |
[ AC_MSG_RESULT([yes]) |
| 1636 |
if test -z "$zlib_check_nonfatal" ; then |
| 1637 |
AC_MSG_ERROR([*** zlib too old - check config.log *** |
| 1638 |
Your reported zlib version has known security problems. It's possible your |
| 1639 |
vendor has fixed these problems without changing the version number. If you |
| 1640 |
are sure this is the case, you can disable the check by running |
| 1641 |
"./configure --without-zlib-version-check". |
| 1642 |
If you are in doubt, upgrade zlib to version 1.2.3 or greater. |
| 1643 |
See http://www.gzip.org/zlib/ for details.]) |
| 1644 |
else |
| 1645 |
AC_MSG_WARN([zlib version may have security problems]) |
| 1646 |
fi |
| 1647 |
], |
| 1648 |
[ AC_MSG_WARN([cross compiling: not checking zlib version]) ] |
| 1649 |
) |
| 1650 |
LIBS="$saved_LIBS" |
| 1651 |
fi |
| 1652 |
|
| 1653 |
dnl UnixWare 2.x |
| 1654 |
AC_CHECK_FUNC([strcasecmp], |
| 1655 |
[], [ AC_CHECK_LIB([resolv], [strcasecmp], [LIBS="$LIBS -lresolv"]) ] |
| 1656 |
) |
| 1657 |
AC_CHECK_FUNCS([utimes], |
| 1658 |
[], [ AC_CHECK_LIB([c89], [utimes], [AC_DEFINE([HAVE_UTIMES]) |
| 1659 |
LIBS="$LIBS -lc89"]) ] |
| 1660 |
) |
| 1661 |
|
| 1662 |
dnl Checks for libutil functions |
| 1663 |
AC_CHECK_HEADERS([bsd/libutil.h libutil.h]) |
| 1664 |
AC_SEARCH_LIBS([fmt_scaled], [util bsd]) |
| 1665 |
AC_SEARCH_LIBS([scan_scaled], [util bsd]) |
| 1666 |
AC_SEARCH_LIBS([login], [util bsd]) |
| 1667 |
AC_SEARCH_LIBS([logout], [util bsd]) |
| 1668 |
AC_SEARCH_LIBS([logwtmp], [util bsd]) |
| 1669 |
AC_SEARCH_LIBS([openpty], [util bsd]) |
| 1670 |
AC_SEARCH_LIBS([updwtmp], [util bsd]) |
| 1671 |
AC_CHECK_FUNCS([fmt_scaled scan_scaled login logout openpty updwtmp logwtmp]) |
| 1672 |
|
| 1673 |
# On some platforms, inet_ntop and gethostbyname may be found in libresolv |
| 1674 |
# or libnsl. |
| 1675 |
AC_SEARCH_LIBS([inet_ntop], [resolv nsl]) |
| 1676 |
AC_SEARCH_LIBS([gethostbyname], [resolv nsl]) |
| 1677 |
|
| 1678 |
# Some Linux distribtions ship the BSD libc hashing functions in |
| 1679 |
# separate libraries. |
| 1680 |
AC_SEARCH_LIBS([SHA256Update], [md bsd]) |
| 1681 |
|
| 1682 |
# "Particular Function Checks" |
| 1683 |
# see https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Functions.html |
| 1684 |
AC_FUNC_STRFTIME |
| 1685 |
AC_FUNC_MALLOC |
| 1686 |
AC_FUNC_REALLOC |
| 1687 |
# autoconf doesn't have AC_FUNC_CALLOC so fake it if malloc returns NULL; |
| 1688 |
AC_MSG_CHECKING([if calloc(0, N) returns non-null]) |
| 1689 |
AC_RUN_IFELSE( |
| 1690 |
[AC_LANG_PROGRAM( |
| 1691 |
[[ #include <stdlib.h> ]], |
| 1692 |
[[ void *p = calloc(0, 1); exit(p == NULL); ]] |
| 1693 |
)], |
| 1694 |
[ func_calloc_0_nonnull=yes ], |
| 1695 |
[ func_calloc_0_nonnull=no ], |
| 1696 |
[ AC_MSG_WARN([cross compiling: assuming same as malloc]) |
| 1697 |
func_calloc_0_nonnull="$ac_cv_func_malloc_0_nonnull"] |
| 1698 |
) |
| 1699 |
AC_MSG_RESULT([$func_calloc_0_nonnull]) |
| 1700 |
|
| 1701 |
if test "x$func_calloc_0_nonnull" = "xyes"; then |
| 1702 |
AC_DEFINE(HAVE_CALLOC, 1, [calloc(0, x) returns non-null]) |
| 1703 |
else |
| 1704 |
AC_DEFINE(HAVE_CALLOC, 0, [calloc(0, x) returns NULL]) |
| 1705 |
AC_DEFINE(calloc, rpl_calloc, |
| 1706 |
[Define to rpl_calloc if the replacement function should be used.]) |
| 1707 |
fi |
| 1708 |
|
| 1709 |
dnl Figure out if we have a system glob, and if so if we can use it. |
| 1710 |
AC_CHECK_FUNCS([glob], |
| 1711 |
[ AC_CHECK_HEADERS([glob.h], |
| 1712 |
[use_system_glob=yes], |
| 1713 |
[use_system_glob=no]) |
| 1714 |
], |
| 1715 |
use_system_glob=no |
| 1716 |
) |
| 1717 |
|
| 1718 |
# Check for ALTDIRFUNC glob() extension |
| 1719 |
AC_MSG_CHECKING([for GLOB_ALTDIRFUNC support]) |
| 1720 |
AC_EGREP_CPP([FOUNDIT], |
| 1721 |
[ |
| 1722 |
#include <glob.h> |
| 1723 |
#ifdef GLOB_ALTDIRFUNC |
| 1724 |
FOUNDIT |
| 1725 |
#endif |
| 1726 |
], |
| 1727 |
[ |
| 1728 |
AC_DEFINE([GLOB_HAS_ALTDIRFUNC], [1], |
| 1729 |
[Define if your system glob() function has |
| 1730 |
the GLOB_ALTDIRFUNC extension]) |
| 1731 |
AC_MSG_RESULT([yes]) |
| 1732 |
], |
| 1733 |
[ |
| 1734 |
AC_MSG_RESULT([no]) |
| 1735 |
use_system_glob=no |
| 1736 |
] |
| 1737 |
) |
| 1738 |
|
| 1739 |
# Check for g.gl_matchc glob() extension |
| 1740 |
AC_MSG_CHECKING([for gl_matchc field in glob_t]) |
| 1741 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], |
| 1742 |
[[ glob_t g; g.gl_matchc = 1; ]])], |
| 1743 |
[ |
| 1744 |
AC_DEFINE([GLOB_HAS_GL_MATCHC], [1], |
| 1745 |
[Define if your system glob() function has |
| 1746 |
gl_matchc options in glob_t]) |
| 1747 |
AC_MSG_RESULT([yes]) |
| 1748 |
], [ |
| 1749 |
AC_MSG_RESULT([no]) |
| 1750 |
use_system_glob=no |
| 1751 |
] |
| 1752 |
) |
| 1753 |
|
| 1754 |
# Check for g.gl_statv glob() extension |
| 1755 |
AC_MSG_CHECKING([for gl_statv and GLOB_KEEPSTAT extensions for glob]) |
| 1756 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <glob.h> ]], [[ |
| 1757 |
#ifndef GLOB_KEEPSTAT |
| 1758 |
#error "glob does not support GLOB_KEEPSTAT extension" |
| 1759 |
#endif |
| 1760 |
glob_t g; |
| 1761 |
g.gl_statv = NULL; |
| 1762 |
]])], |
| 1763 |
[ |
| 1764 |
AC_DEFINE([GLOB_HAS_GL_STATV], [1], |
| 1765 |
[Define if your system glob() function has |
| 1766 |
gl_statv options in glob_t]) |
| 1767 |
AC_MSG_RESULT([yes]) |
| 1768 |
], [ |
| 1769 |
AC_MSG_RESULT([no]) |
| 1770 |
use_system_glob=no |
| 1771 |
] |
| 1772 |
) |
| 1773 |
|
| 1774 |
AC_CHECK_DECLS([GLOB_NOMATCH], , [use_system_glob=no], [#include <glob.h>]) |
| 1775 |
|
| 1776 |
if test "x$broken_glob" = "xyes"; then |
| 1777 |
AC_DEFINE([BROKEN_GLOB], [1], [Do not use system glob]) |
| 1778 |
use_system_glob=no |
| 1779 |
fi |
| 1780 |
|
| 1781 |
dnl If we don't have a system glob, or we do but we're not using it, then |
| 1782 |
dnl create a glob.h shim so we don't have to sprinkle ifdefs everywhere. |
| 1783 |
AC_MSG_CHECKING([if we can use the system glob]) |
| 1784 |
if test "x$use_system_glob" = "xyes" ; then |
| 1785 |
AC_MSG_RESULT([yes]) |
| 1786 |
# Remove any old shims. |
| 1787 |
rm -f "$COMPATINCLUDESDIR/glob.h" |
| 1788 |
else |
| 1789 |
AC_MSG_RESULT([no]) |
| 1790 |
COMPATINCLUDES="$COMPATINCLUDESDIR" |
| 1791 |
mkdir -p "$COMPATINCLUDES" |
| 1792 |
echo '#include "openbsd-compat/glob.h"' >$COMPATINCLUDES/glob.h |
| 1793 |
fi |
| 1794 |
|
| 1795 |
AC_CHECK_DECL([VIS_ALL], , |
| 1796 |
AC_DEFINE(BROKEN_STRNVIS, 1, [missing VIS_ALL]), [#include <vis.h>]) |
| 1797 |
|
| 1798 |
AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) |
| 1799 |
AC_RUN_IFELSE( |
| 1800 |
[AC_LANG_PROGRAM([[ |
| 1801 |
#include <sys/types.h> |
| 1802 |
#include <dirent.h> |
| 1803 |
#include <stdlib.h> |
| 1804 |
]], |
| 1805 |
[[ |
| 1806 |
struct dirent d; |
| 1807 |
exit(sizeof(d.d_name)<=sizeof(char)); |
| 1808 |
]])], |
| 1809 |
[AC_MSG_RESULT([yes])], |
| 1810 |
[ |
| 1811 |
AC_MSG_RESULT([no]) |
| 1812 |
AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME], [1], |
| 1813 |
[Define if your struct dirent expects you to |
| 1814 |
allocate extra space for d_name]) |
| 1815 |
], |
| 1816 |
[ |
| 1817 |
AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME]) |
| 1818 |
AC_DEFINE([BROKEN_ONE_BYTE_DIRENT_D_NAME]) |
| 1819 |
] |
| 1820 |
) |
| 1821 |
|
| 1822 |
AC_CHECK_MEMBERS([struct dirent.d_type], [], [], [[ |
| 1823 |
#ifdef HAVE_DIRENT_H |
| 1824 |
#include <dirent.h> |
| 1825 |
#endif |
| 1826 |
]]) |
| 1827 |
|
| 1828 |
AC_MSG_CHECKING([for /proc/pid/fd directory]) |
| 1829 |
if test -d "/proc/$$/fd" ; then |
| 1830 |
AC_DEFINE([HAVE_PROC_PID], [1], [Define if you have /proc/$pid/fd]) |
| 1831 |
AC_MSG_RESULT([yes]) |
| 1832 |
else |
| 1833 |
AC_MSG_RESULT([no]) |
| 1834 |
fi |
| 1835 |
|
| 1836 |
# Check whether user wants to use ldns |
| 1837 |
LDNS_MSG="no" |
| 1838 |
AC_ARG_WITH(ldns, |
| 1839 |
[ --with-ldns[[=PATH]] Use ldns for DNSSEC support (optionally in PATH)], |
| 1840 |
[ |
| 1841 |
ldns="" |
| 1842 |
if test "x$withval" = "xyes" ; then |
| 1843 |
AC_PATH_TOOL([LDNSCONFIG], [ldns-config], [no]) |
| 1844 |
if test "x$LDNSCONFIG" = "xno"; then |
| 1845 |
LIBS="-lldns $LIBS" |
| 1846 |
ldns=yes |
| 1847 |
else |
| 1848 |
LIBS="$LIBS `$LDNSCONFIG --libs`" |
| 1849 |
CPPFLAGS="$CPPFLAGS `$LDNSCONFIG --cflags`" |
| 1850 |
ldns=yes |
| 1851 |
fi |
| 1852 |
elif test "x$withval" != "xno" ; then |
| 1853 |
CPPFLAGS="$CPPFLAGS -I${withval}/include" |
| 1854 |
LDFLAGS="$LDFLAGS -L${withval}/lib" |
| 1855 |
LIBS="-lldns $LIBS" |
| 1856 |
ldns=yes |
| 1857 |
fi |
| 1858 |
|
| 1859 |
# Verify that it works. |
| 1860 |
if test "x$ldns" = "xyes" ; then |
| 1861 |
AC_DEFINE(HAVE_LDNS, 1, [Define if you want ldns support]) |
| 1862 |
LDNS_MSG="yes" |
| 1863 |
AC_MSG_CHECKING([for ldns support]) |
| 1864 |
AC_LINK_IFELSE( |
| 1865 |
[AC_LANG_SOURCE([[ |
| 1866 |
#include <stdio.h> |
| 1867 |
#include <stdlib.h> |
| 1868 |
#ifdef HAVE_STDINT_H |
| 1869 |
# include <stdint.h> |
| 1870 |
#endif |
| 1871 |
#include <ldns/ldns.h> |
| 1872 |
int main(void) { ldns_status status = ldns_verify_trusted(NULL, NULL, NULL, NULL); status=LDNS_STATUS_OK; exit(0); } |
| 1873 |
]]) |
| 1874 |
], |
| 1875 |
[AC_MSG_RESULT(yes)], |
| 1876 |
[ |
| 1877 |
AC_MSG_RESULT(no) |
| 1878 |
AC_MSG_ERROR([** Incomplete or missing ldns libraries.]) |
| 1879 |
]) |
| 1880 |
fi |
| 1881 |
]) |
| 1882 |
|
| 1883 |
# Check whether user wants libedit support |
| 1884 |
LIBEDIT_MSG="no" |
| 1885 |
AC_ARG_WITH([libedit], |
| 1886 |
[ --with-libedit[[=PATH]] Enable libedit support for sftp], |
| 1887 |
[ if test "x$withval" != "xno" ; then |
| 1888 |
if test "x$withval" = "xyes" ; then |
| 1889 |
if test "x$PKGCONFIG" != "xno"; then |
| 1890 |
AC_MSG_CHECKING([if $PKGCONFIG knows about libedit]) |
| 1891 |
if "$PKGCONFIG" libedit; then |
| 1892 |
AC_MSG_RESULT([yes]) |
| 1893 |
use_pkgconfig_for_libedit=yes |
| 1894 |
else |
| 1895 |
AC_MSG_RESULT([no]) |
| 1896 |
fi |
| 1897 |
fi |
| 1898 |
else |
| 1899 |
CPPFLAGS="$CPPFLAGS -I${withval}/include" |
| 1900 |
if test -n "${rpath_opt}"; then |
| 1901 |
LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" |
| 1902 |
else |
| 1903 |
LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
| 1904 |
fi |
| 1905 |
fi |
| 1906 |
if test "x$use_pkgconfig_for_libedit" = "xyes"; then |
| 1907 |
LIBEDIT=`$PKGCONFIG --libs libedit` |
| 1908 |
CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libedit`" |
| 1909 |
else |
| 1910 |
LIBEDIT="-ledit -lcurses" |
| 1911 |
fi |
| 1912 |
OTHERLIBS=`echo $LIBEDIT | sed 's/-ledit//'` |
| 1913 |
AC_CHECK_LIB([edit], [el_init], |
| 1914 |
[ AC_DEFINE([USE_LIBEDIT], [1], [Use libedit for sftp]) |
| 1915 |
LIBEDIT_MSG="yes" |
| 1916 |
AC_SUBST([LIBEDIT]) |
| 1917 |
], |
| 1918 |
[ AC_MSG_ERROR([libedit not found]) ], |
| 1919 |
[ $OTHERLIBS ] |
| 1920 |
) |
| 1921 |
AC_MSG_CHECKING([if libedit version is compatible]) |
| 1922 |
AC_COMPILE_IFELSE( |
| 1923 |
[AC_LANG_PROGRAM([[ |
| 1924 |
#include <histedit.h> |
| 1925 |
#include <stdlib.h> |
| 1926 |
]], |
| 1927 |
[[ |
| 1928 |
int i = H_SETSIZE; |
| 1929 |
el_init("", NULL, NULL, NULL); |
| 1930 |
exit(0); |
| 1931 |
]])], |
| 1932 |
[ AC_MSG_RESULT([yes]) ], |
| 1933 |
[ AC_MSG_RESULT([no]) |
| 1934 |
AC_MSG_ERROR([libedit version is not compatible]) ] |
| 1935 |
) |
| 1936 |
fi ] |
| 1937 |
) |
| 1938 |
|
| 1939 |
# Check whether user wants wtmpdb support |
| 1940 |
WTMPDB_MSG="no" |
| 1941 |
AC_ARG_WITH([wtmpdb], |
| 1942 |
[ --with-wtmpdb[[=PATH]] Enable wtmpdb support for sshd], |
| 1943 |
[ if test "x$withval" != "xno" ; then |
| 1944 |
if test "x$withval" = "xyes" ; then |
| 1945 |
if test "x$PKGCONFIG" != "xno"; then |
| 1946 |
AC_MSG_CHECKING([if $PKGCONFIG knows about wtmpdb]) |
| 1947 |
if "$PKGCONFIG" libwtmpdb; then |
| 1948 |
AC_MSG_RESULT([yes]) |
| 1949 |
use_pkgconfig_for_libwtmpdb=yes |
| 1950 |
else |
| 1951 |
AC_MSG_RESULT([no]) |
| 1952 |
fi |
| 1953 |
fi |
| 1954 |
else |
| 1955 |
CPPFLAGS="$CPPFLAGS -I${withval}/include" |
| 1956 |
if test -n "${rpath_opt}"; then |
| 1957 |
LDFLAGS="-L${withval}/lib ${rpath_opt}${withval}/lib ${LDFLAGS}" |
| 1958 |
else |
| 1959 |
LDFLAGS="-L${withval}/lib ${LDFLAGS}" |
| 1960 |
fi |
| 1961 |
fi |
| 1962 |
if test "x$use_pkgconfig_for_libwtmpdb" = "xyes"; then |
| 1963 |
LIBWTMPDB=`$PKGCONFIG --libs libwtmpdb` |
| 1964 |
CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libwtmpdb`" |
| 1965 |
else |
| 1966 |
LIBWTMPDB="-lwtmpdb" |
| 1967 |
fi |
| 1968 |
OTHERLIBS=`echo $LIBWTMPDB | sed 's/-lwtmpdb//'` |
| 1969 |
AC_CHECK_LIB([wtmpdb], [wtmpdb_login], |
| 1970 |
[ AC_DEFINE([USE_WTMPDB], [1], [Use libwtmpdb for sshd]) |
| 1971 |
WTMPDB_MSG="yes" |
| 1972 |
AC_SUBST([LIBWTMPDB]) |
| 1973 |
], |
| 1974 |
[ AC_MSG_ERROR([libwtmpdb not found]) ], |
| 1975 |
[ $OTHERLIBS ] |
| 1976 |
) |
| 1977 |
fi ] |
| 1978 |
) |
| 1979 |
|
| 1980 |
|
| 1981 |
AUDIT_MODULE=none |
| 1982 |
AC_ARG_WITH([audit], |
| 1983 |
[ --with-audit=module Enable audit support (modules=debug,bsm,linux)], |
| 1984 |
[ |
| 1985 |
AC_MSG_CHECKING([for supported audit module]) |
| 1986 |
case "$withval" in |
| 1987 |
bsm) |
| 1988 |
AC_MSG_RESULT([bsm]) |
| 1989 |
AUDIT_MODULE=bsm |
| 1990 |
dnl Checks for headers, libs and functions |
| 1991 |
AC_CHECK_HEADERS([bsm/audit.h], [], |
| 1992 |
[AC_MSG_ERROR([BSM enabled and bsm/audit.h not found])], |
| 1993 |
[ |
| 1994 |
#ifdef HAVE_TIME_H |
| 1995 |
# include <time.h> |
| 1996 |
#endif |
| 1997 |
] |
| 1998 |
) |
| 1999 |
AC_CHECK_LIB([bsm], [getaudit], [], |
| 2000 |
[AC_MSG_ERROR([BSM enabled and required library not found])]) |
| 2001 |
AC_CHECK_FUNCS([getaudit], [], |
| 2002 |
[AC_MSG_ERROR([BSM enabled and required function not found])]) |
| 2003 |
# These are optional |
| 2004 |
AC_CHECK_FUNCS([getaudit_addr aug_get_machine]) |
| 2005 |
AC_DEFINE([USE_BSM_AUDIT], [1], [Use BSM audit module]) |
| 2006 |
if test "$sol2ver" -ge 11; then |
| 2007 |
SSHDLIBS="$SSHDLIBS -lscf" |
| 2008 |
AC_DEFINE([BROKEN_BSM_API], [1], |
| 2009 |
[The system has incomplete BSM API]) |
| 2010 |
fi |
| 2011 |
;; |
| 2012 |
linux) |
| 2013 |
AC_MSG_RESULT([linux]) |
| 2014 |
AUDIT_MODULE=linux |
| 2015 |
dnl Checks for headers, libs and functions |
| 2016 |
AC_CHECK_HEADERS([libaudit.h]) |
| 2017 |
SSHDLIBS="$SSHDLIBS -laudit" |
| 2018 |
AC_DEFINE([USE_LINUX_AUDIT], [1], [Use Linux audit module]) |
| 2019 |
;; |
| 2020 |
debug) |
| 2021 |
AUDIT_MODULE=debug |
| 2022 |
AC_MSG_RESULT([debug]) |
| 2023 |
AC_DEFINE([SSH_AUDIT_EVENTS], [1], [Use audit debugging module]) |
| 2024 |
;; |
| 2025 |
no) |
| 2026 |
AC_MSG_RESULT([no]) |
| 2027 |
;; |
| 2028 |
*) |
| 2029 |
AC_MSG_ERROR([Unknown audit module $withval]) |
| 2030 |
;; |
| 2031 |
esac ] |
| 2032 |
) |
| 2033 |
|
| 2034 |
AC_ARG_WITH([pie], |
| 2035 |
[ --with-pie Build Position Independent Executables if possible], [ |
| 2036 |
if test "x$withval" = "xno"; then |
| 2037 |
use_pie=no |
| 2038 |
fi |
| 2039 |
if test "x$withval" = "xyes"; then |
| 2040 |
use_pie=yes |
| 2041 |
fi |
| 2042 |
] |
| 2043 |
) |
| 2044 |
if test "x$use_pie" = "x"; then |
| 2045 |
use_pie=no |
| 2046 |
fi |
| 2047 |
if test "x$use_toolchain_hardening" != "x1" && test "x$use_pie" = "xauto"; then |
| 2048 |
# Turn off automatic PIE when toolchain hardening is off. |
| 2049 |
use_pie=no |
| 2050 |
fi |
| 2051 |
if test "x$use_pie" = "xauto"; then |
| 2052 |
# Automatic PIE requires gcc >= 4.x |
| 2053 |
AC_MSG_CHECKING([for gcc >= 4.x]) |
| 2054 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 2055 |
#if !defined(__GNUC__) || __GNUC__ < 4 |
| 2056 |
#error gcc is too old |
| 2057 |
#endif |
| 2058 |
]])], |
| 2059 |
[ AC_MSG_RESULT([yes]) ], |
| 2060 |
[ AC_MSG_RESULT([no]) |
| 2061 |
use_pie=no ] |
| 2062 |
) |
| 2063 |
fi |
| 2064 |
if test "x$use_pie" != "xno"; then |
| 2065 |
SAVED_CFLAGS="$CFLAGS" |
| 2066 |
SAVED_LDFLAGS="$LDFLAGS" |
| 2067 |
OSSH_CHECK_CFLAG_COMPILE([-fPIE]) |
| 2068 |
OSSH_CHECK_LDFLAG_LINK([-pie]) |
| 2069 |
# We use both -fPIE and -pie or neither. |
| 2070 |
AC_MSG_CHECKING([whether both -fPIE and -pie are supported]) |
| 2071 |
if echo "x $CFLAGS" | grep ' -fPIE' >/dev/null 2>&1 && \ |
| 2072 |
echo "x $LDFLAGS" | grep ' -pie' >/dev/null 2>&1 ; then |
| 2073 |
AC_MSG_RESULT([yes]) |
| 2074 |
else |
| 2075 |
AC_MSG_RESULT([no]) |
| 2076 |
CFLAGS="$SAVED_CFLAGS" |
| 2077 |
LDFLAGS="$SAVED_LDFLAGS" |
| 2078 |
fi |
| 2079 |
fi |
| 2080 |
|
| 2081 |
AC_MSG_CHECKING([whether -fPIC is accepted]) |
| 2082 |
SAVED_CFLAGS="$CFLAGS" |
| 2083 |
CFLAGS="$CFLAGS -fPIC" |
| 2084 |
AC_COMPILE_IFELSE( |
| 2085 |
[AC_LANG_PROGRAM( [[ #include <stdlib.h> ]], [[ exit(0); ]] )], |
| 2086 |
[AC_MSG_RESULT([yes]) |
| 2087 |
PICFLAG="-fPIC"; ], |
| 2088 |
[AC_MSG_RESULT([no]) |
| 2089 |
PICFLAG=""; ]) |
| 2090 |
CFLAGS="$SAVED_CFLAGS" |
| 2091 |
AC_SUBST([PICFLAG]) |
| 2092 |
|
| 2093 |
dnl Checks for library functions. Please keep in alphabetical order |
| 2094 |
AC_CHECK_FUNCS([ \ |
| 2095 |
auth_hostok \ |
| 2096 |
auth_timeok \ |
| 2097 |
Blowfish_initstate \ |
| 2098 |
Blowfish_expandstate \ |
| 2099 |
Blowfish_expand0state \ |
| 2100 |
Blowfish_stream2word \ |
| 2101 |
SHA256Update \ |
| 2102 |
SHA384Update \ |
| 2103 |
SHA512Update \ |
| 2104 |
asprintf \ |
| 2105 |
b64_ntop \ |
| 2106 |
__b64_ntop \ |
| 2107 |
b64_pton \ |
| 2108 |
__b64_pton \ |
| 2109 |
bcopy \ |
| 2110 |
bcrypt_pbkdf \ |
| 2111 |
bindresvport_sa \ |
| 2112 |
blf_enc \ |
| 2113 |
bzero \ |
| 2114 |
cap_rights_limit \ |
| 2115 |
clock \ |
| 2116 |
closefrom \ |
| 2117 |
close_range \ |
| 2118 |
dirfd \ |
| 2119 |
endgrent \ |
| 2120 |
err \ |
| 2121 |
errx \ |
| 2122 |
explicit_bzero \ |
| 2123 |
explicit_memset \ |
| 2124 |
fchmod \ |
| 2125 |
fchmodat \ |
| 2126 |
fchown \ |
| 2127 |
fchownat \ |
| 2128 |
flock \ |
| 2129 |
fnmatch \ |
| 2130 |
freeaddrinfo \ |
| 2131 |
freezero \ |
| 2132 |
fstatat \ |
| 2133 |
fstatfs \ |
| 2134 |
fstatvfs \ |
| 2135 |
futimes \ |
| 2136 |
getaddrinfo \ |
| 2137 |
getcwd \ |
| 2138 |
getentropy \ |
| 2139 |
getgrouplist \ |
| 2140 |
getline \ |
| 2141 |
getnameinfo \ |
| 2142 |
getopt \ |
| 2143 |
getpeereid \ |
| 2144 |
getpeerucred \ |
| 2145 |
getpgid \ |
| 2146 |
_getpty \ |
| 2147 |
getrlimit \ |
| 2148 |
getrandom \ |
| 2149 |
getsid \ |
| 2150 |
getttyent \ |
| 2151 |
group_from_gid \ |
| 2152 |
inet_aton \ |
| 2153 |
inet_ntoa \ |
| 2154 |
inet_ntop \ |
| 2155 |
innetgr \ |
| 2156 |
killpg \ |
| 2157 |
llabs \ |
| 2158 |
localtime_r \ |
| 2159 |
login_getcapbool \ |
| 2160 |
login_getpwclass \ |
| 2161 |
memmem \ |
| 2162 |
memmove \ |
| 2163 |
memset_s \ |
| 2164 |
mkdtemp \ |
| 2165 |
mmap \ |
| 2166 |
ngetaddrinfo \ |
| 2167 |
nlist \ |
| 2168 |
nsleep \ |
| 2169 |
ogetaddrinfo \ |
| 2170 |
openlog_r \ |
| 2171 |
pledge \ |
| 2172 |
poll \ |
| 2173 |
ppoll \ |
| 2174 |
prctl \ |
| 2175 |
procctl \ |
| 2176 |
pselect \ |
| 2177 |
pstat \ |
| 2178 |
raise \ |
| 2179 |
readpassphrase \ |
| 2180 |
reallocarray \ |
| 2181 |
realpath \ |
| 2182 |
recvmsg \ |
| 2183 |
recallocarray \ |
| 2184 |
rresvport_af \ |
| 2185 |
sendmsg \ |
| 2186 |
setdtablesize \ |
| 2187 |
setegid \ |
| 2188 |
setenv \ |
| 2189 |
seteuid \ |
| 2190 |
setgroupent \ |
| 2191 |
setgroups \ |
| 2192 |
setlinebuf \ |
| 2193 |
setlogin \ |
| 2194 |
setpassent\ |
| 2195 |
setpcred \ |
| 2196 |
setproctitle \ |
| 2197 |
setregid \ |
| 2198 |
setreuid \ |
| 2199 |
setrlimit \ |
| 2200 |
setsid \ |
| 2201 |
setvbuf \ |
| 2202 |
sigaction \ |
| 2203 |
sigvec \ |
| 2204 |
snprintf \ |
| 2205 |
socketpair \ |
| 2206 |
statfs \ |
| 2207 |
statvfs \ |
| 2208 |
strcasestr \ |
| 2209 |
strdup \ |
| 2210 |
strerror \ |
| 2211 |
strlcat \ |
| 2212 |
strlcpy \ |
| 2213 |
strmode \ |
| 2214 |
strndup \ |
| 2215 |
strnlen \ |
| 2216 |
strnvis \ |
| 2217 |
strptime \ |
| 2218 |
strsignal \ |
| 2219 |
strtonum \ |
| 2220 |
strtoll \ |
| 2221 |
strtoul \ |
| 2222 |
strtoull \ |
| 2223 |
sysconf \ |
| 2224 |
tcgetpgrp \ |
| 2225 |
timegm \ |
| 2226 |
timingsafe_bcmp \ |
| 2227 |
truncate \ |
| 2228 |
unlinkat \ |
| 2229 |
unsetenv \ |
| 2230 |
unveil \ |
| 2231 |
updwtmpx \ |
| 2232 |
utimensat \ |
| 2233 |
user_from_uid \ |
| 2234 |
usleep \ |
| 2235 |
vasprintf \ |
| 2236 |
vsnprintf \ |
| 2237 |
waitpid \ |
| 2238 |
warn \ |
| 2239 |
]) |
| 2240 |
|
| 2241 |
AC_MSG_CHECKING([whether compiler supports __builtin_popcount]) |
| 2242 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 2243 |
#include <stdlib.h> |
| 2244 |
]], |
| 2245 |
[[ int x = 123, y; |
| 2246 |
y = __builtin_popcount(123); |
| 2247 |
exit(y == 6 ? 0 : -1); ]])], |
| 2248 |
[ AC_MSG_RESULT([yes]) ], [ |
| 2249 |
AC_MSG_RESULT([no]) |
| 2250 |
AC_DEFINE([MISSING_BUILTIN_POPCOUNT], [1], [Define if your compiler lacks __builtin_popcount]) |
| 2251 |
] |
| 2252 |
) |
| 2253 |
|
| 2254 |
AC_CHECK_DECLS([bzero, memmem]) |
| 2255 |
|
| 2256 |
dnl Wide character support. |
| 2257 |
AC_CHECK_FUNCS([mblen mbtowc nl_langinfo wcwidth]) |
| 2258 |
|
| 2259 |
TEST_SSH_UTF8=${TEST_SSH_UTF8:=yes} |
| 2260 |
AC_MSG_CHECKING([for utf8 locale support]) |
| 2261 |
AC_RUN_IFELSE( |
| 2262 |
[AC_LANG_PROGRAM([[ |
| 2263 |
#include <locale.h> |
| 2264 |
#include <stdlib.h> |
| 2265 |
]], [[ |
| 2266 |
char *loc = setlocale(LC_CTYPE, "en_US.UTF-8"); |
| 2267 |
if (loc != NULL) |
| 2268 |
exit(0); |
| 2269 |
exit(1); |
| 2270 |
]])], |
| 2271 |
AC_MSG_RESULT(yes), |
| 2272 |
[AC_MSG_RESULT(no) |
| 2273 |
TEST_SSH_UTF8=no], |
| 2274 |
AC_MSG_WARN([cross compiling: assuming yes]) |
| 2275 |
) |
| 2276 |
|
| 2277 |
AC_LINK_IFELSE( |
| 2278 |
[AC_LANG_PROGRAM( |
| 2279 |
[[ #include <ctype.h> ]], |
| 2280 |
[[ return (isblank('a')); ]])], |
| 2281 |
[AC_DEFINE([HAVE_ISBLANK], [1], [Define if you have isblank(3C).]) |
| 2282 |
]) |
| 2283 |
|
| 2284 |
disable_pkcs11= |
| 2285 |
AC_ARG_ENABLE([pkcs11], |
| 2286 |
[ --disable-pkcs11 disable PKCS#11 support code [no]], |
| 2287 |
[ |
| 2288 |
if test "x$enableval" = "xno" ; then |
| 2289 |
disable_pkcs11=1 |
| 2290 |
fi |
| 2291 |
] |
| 2292 |
) |
| 2293 |
|
| 2294 |
disable_sk= |
| 2295 |
AC_ARG_ENABLE([security-key], |
| 2296 |
[ --disable-security-key disable U2F/FIDO support code [no]], |
| 2297 |
[ |
| 2298 |
if test "x$enableval" = "xno" ; then |
| 2299 |
disable_sk=1 |
| 2300 |
fi |
| 2301 |
] |
| 2302 |
) |
| 2303 |
enable_sk_internal= |
| 2304 |
AC_ARG_WITH([security-key-builtin], |
| 2305 |
[ --with-security-key-builtin include builtin U2F/FIDO support], |
| 2306 |
[ enable_sk_internal=$withval ] |
| 2307 |
) |
| 2308 |
|
| 2309 |
enable_sk_standalone= |
| 2310 |
AC_ARG_WITH([security-key-standalone], |
| 2311 |
[ --with-security-key-standalone build standalone sk-libfido2 SecurityKeyProvider], |
| 2312 |
[ enable_sk_standalone=$withval ] |
| 2313 |
) |
| 2314 |
|
| 2315 |
AC_SEARCH_LIBS([dlopen], [dl]) |
| 2316 |
AC_CHECK_FUNCS([dlopen]) |
| 2317 |
AC_CHECK_DECL([RTLD_NOW], [], [], [#include <dlfcn.h>]) |
| 2318 |
|
| 2319 |
# IRIX has a const char return value for gai_strerror() |
| 2320 |
AC_CHECK_FUNCS([gai_strerror], [ |
| 2321 |
AC_DEFINE([HAVE_GAI_STRERROR]) |
| 2322 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 2323 |
#include <sys/types.h> |
| 2324 |
#include <sys/socket.h> |
| 2325 |
#include <netdb.h> |
| 2326 |
|
| 2327 |
const char *gai_strerror(int); |
| 2328 |
]], [[ |
| 2329 |
char *str; |
| 2330 |
str = gai_strerror(0); |
| 2331 |
]])], [ |
| 2332 |
AC_DEFINE([HAVE_CONST_GAI_STRERROR_PROTO], [1], |
| 2333 |
[Define if gai_strerror() returns const char *])], [])]) |
| 2334 |
|
| 2335 |
AC_SEARCH_LIBS([nanosleep], [rt posix4], [AC_DEFINE([HAVE_NANOSLEEP], [1], |
| 2336 |
[Some systems put nanosleep outside of libc])]) |
| 2337 |
|
| 2338 |
AC_SEARCH_LIBS([clock_gettime], [rt], |
| 2339 |
[AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime])]) |
| 2340 |
|
| 2341 |
dnl check if we need -D_REENTRANT for localtime_r declaration. |
| 2342 |
AC_CHECK_DECL([localtime_r], [], |
| 2343 |
[ saved_CPPFLAGS="$CPPFLAGS" |
| 2344 |
CPPFLAGS="$CPPFLAGS -D_REENTRANT" |
| 2345 |
unset ac_cv_have_decl_localtime_r |
| 2346 |
AC_CHECK_DECL([localtime_r], [], |
| 2347 |
[ CPPFLAGS="$saved_CPPFLAGS" ], |
| 2348 |
[ #include <time.h> ] |
| 2349 |
) |
| 2350 |
], |
| 2351 |
[ #include <time.h> ] |
| 2352 |
) |
| 2353 |
|
| 2354 |
dnl Make sure prototypes are defined for these before using them. |
| 2355 |
AC_CHECK_DECL([strsep], |
| 2356 |
[AC_CHECK_FUNCS([strsep])], |
| 2357 |
[], |
| 2358 |
[ |
| 2359 |
#ifdef HAVE_STRING_H |
| 2360 |
# include <string.h> |
| 2361 |
#endif |
| 2362 |
]) |
| 2363 |
|
| 2364 |
dnl tcsendbreak might be a macro |
| 2365 |
AC_CHECK_DECL([tcsendbreak], |
| 2366 |
[AC_DEFINE([HAVE_TCSENDBREAK])], |
| 2367 |
[AC_CHECK_FUNCS([tcsendbreak])], |
| 2368 |
[#include <termios.h>] |
| 2369 |
) |
| 2370 |
|
| 2371 |
AC_CHECK_DECLS([h_errno], , ,[#include <netdb.h>]) |
| 2372 |
|
| 2373 |
AC_CHECK_DECLS([SHUT_RD, getpeereid], , , |
| 2374 |
[ |
| 2375 |
#include <sys/types.h> |
| 2376 |
#include <sys/socket.h> |
| 2377 |
#include <unistd.h> |
| 2378 |
]) |
| 2379 |
|
| 2380 |
AC_CHECK_DECLS([O_NONBLOCK], , , |
| 2381 |
[ |
| 2382 |
#include <sys/types.h> |
| 2383 |
#ifdef HAVE_SYS_STAT_H |
| 2384 |
# include <sys/stat.h> |
| 2385 |
#endif |
| 2386 |
#ifdef HAVE_FCNTL_H |
| 2387 |
# include <fcntl.h> |
| 2388 |
#endif |
| 2389 |
]) |
| 2390 |
|
| 2391 |
AC_CHECK_DECLS([ftruncate, getentropy], , , |
| 2392 |
[ |
| 2393 |
#include <sys/types.h> |
| 2394 |
#include <unistd.h> |
| 2395 |
]) |
| 2396 |
|
| 2397 |
AC_CHECK_DECLS([readv, writev], , , [ |
| 2398 |
#include <sys/types.h> |
| 2399 |
#include <sys/uio.h> |
| 2400 |
#include <unistd.h> |
| 2401 |
]) |
| 2402 |
|
| 2403 |
AC_CHECK_DECLS([MAXSYMLINKS], , , [ |
| 2404 |
#include <sys/param.h> |
| 2405 |
]) |
| 2406 |
|
| 2407 |
AC_CHECK_DECLS([offsetof], , , [ |
| 2408 |
#include <stddef.h> |
| 2409 |
]) |
| 2410 |
|
| 2411 |
AC_CHECK_DECLS([INFINITY], , |
| 2412 |
AC_CHECK_DECLS(__builtin_inff), |
| 2413 |
[#include <math.h>] |
| 2414 |
) |
| 2415 |
|
| 2416 |
# extra bits for select(2) |
| 2417 |
AC_CHECK_DECLS([howmany, NFDBITS], [], [], [[ |
| 2418 |
#include <sys/param.h> |
| 2419 |
#include <sys/types.h> |
| 2420 |
#ifdef HAVE_SYS_SYSMACROS_H |
| 2421 |
#include <sys/sysmacros.h> |
| 2422 |
#endif |
| 2423 |
#ifdef HAVE_SYS_SELECT_H |
| 2424 |
#include <sys/select.h> |
| 2425 |
#endif |
| 2426 |
#ifdef HAVE_SYS_TIME_H |
| 2427 |
#include <sys/time.h> |
| 2428 |
#endif |
| 2429 |
#ifdef HAVE_UNISTD_H |
| 2430 |
#include <unistd.h> |
| 2431 |
#endif |
| 2432 |
]]) |
| 2433 |
AC_CHECK_TYPES([fd_mask], [], [], [[ |
| 2434 |
#include <sys/param.h> |
| 2435 |
#include <sys/types.h> |
| 2436 |
#ifdef HAVE_SYS_SELECT_H |
| 2437 |
#include <sys/select.h> |
| 2438 |
#endif |
| 2439 |
#ifdef HAVE_SYS_TIME_H |
| 2440 |
#include <sys/time.h> |
| 2441 |
#endif |
| 2442 |
#ifdef HAVE_UNISTD_H |
| 2443 |
#include <unistd.h> |
| 2444 |
#endif |
| 2445 |
]]) |
| 2446 |
|
| 2447 |
AC_CHECK_FUNCS([setresuid], [ |
| 2448 |
dnl Some platorms have setresuid that isn't implemented, test for this |
| 2449 |
AC_MSG_CHECKING([if setresuid seems to work]) |
| 2450 |
AC_RUN_IFELSE( |
| 2451 |
[AC_LANG_PROGRAM([[ |
| 2452 |
#include <errno.h> |
| 2453 |
#include <stdlib.h> |
| 2454 |
#include <unistd.h> |
| 2455 |
]], [[ |
| 2456 |
errno=0; |
| 2457 |
setresuid(0,0,0); |
| 2458 |
if (errno==ENOSYS) |
| 2459 |
exit(1); |
| 2460 |
else |
| 2461 |
exit(0); |
| 2462 |
]])], |
| 2463 |
[AC_MSG_RESULT([yes])], |
| 2464 |
[AC_DEFINE([BROKEN_SETRESUID], [1], |
| 2465 |
[Define if your setresuid() is broken]) |
| 2466 |
AC_MSG_RESULT([not implemented])], |
| 2467 |
[AC_MSG_WARN([cross compiling: not checking setresuid])] |
| 2468 |
) |
| 2469 |
]) |
| 2470 |
|
| 2471 |
AC_CHECK_FUNCS([setresgid], [ |
| 2472 |
dnl Some platorms have setresgid that isn't implemented, test for this |
| 2473 |
AC_MSG_CHECKING([if setresgid seems to work]) |
| 2474 |
AC_RUN_IFELSE( |
| 2475 |
[AC_LANG_PROGRAM([[ |
| 2476 |
#include <errno.h> |
| 2477 |
#include <stdlib.h> |
| 2478 |
#include <unistd.h> |
| 2479 |
]], [[ |
| 2480 |
errno=0; |
| 2481 |
setresgid(0,0,0); |
| 2482 |
if (errno==ENOSYS) |
| 2483 |
exit(1); |
| 2484 |
else |
| 2485 |
exit(0); |
| 2486 |
]])], |
| 2487 |
[AC_MSG_RESULT([yes])], |
| 2488 |
[AC_DEFINE([BROKEN_SETRESGID], [1], |
| 2489 |
[Define if your setresgid() is broken]) |
| 2490 |
AC_MSG_RESULT([not implemented])], |
| 2491 |
[AC_MSG_WARN([cross compiling: not checking setresuid])] |
| 2492 |
) |
| 2493 |
]) |
| 2494 |
|
| 2495 |
AC_MSG_CHECKING([for working fflush(NULL)]) |
| 2496 |
AC_RUN_IFELSE( |
| 2497 |
[AC_LANG_PROGRAM([[ |
| 2498 |
#include <stdio.h> |
| 2499 |
#include <stdlib.h> |
| 2500 |
]], |
| 2501 |
[[fflush(NULL); exit(0);]])], |
| 2502 |
AC_MSG_RESULT([yes]), |
| 2503 |
[AC_MSG_RESULT([no]) |
| 2504 |
AC_DEFINE([FFLUSH_NULL_BUG], [1], |
| 2505 |
[define if fflush(NULL) does not work])], |
| 2506 |
AC_MSG_WARN([cross compiling: assuming working]) |
| 2507 |
) |
| 2508 |
|
| 2509 |
dnl Checks for time functions |
| 2510 |
AC_CHECK_FUNCS([gettimeofday time]) |
| 2511 |
dnl Checks for utmp functions |
| 2512 |
AC_CHECK_FUNCS([endutent getutent getutid getutline pututline setutent]) |
| 2513 |
AC_CHECK_FUNCS([utmpname]) |
| 2514 |
dnl Checks for utmpx functions |
| 2515 |
AC_CHECK_FUNCS([endutxent getutxent getutxid getutxline getutxuser pututxline]) |
| 2516 |
AC_CHECK_FUNCS([setutxdb setutxent utmpxname]) |
| 2517 |
dnl Checks for lastlog functions |
| 2518 |
AC_CHECK_FUNCS([getlastlogxbyname]) |
| 2519 |
|
| 2520 |
AC_CHECK_FUNC([daemon], |
| 2521 |
[AC_DEFINE([HAVE_DAEMON], [1], [Define if your libraries define daemon()])], |
| 2522 |
[AC_CHECK_LIB([bsd], [daemon], |
| 2523 |
[LIBS="$LIBS -lbsd"; AC_DEFINE([HAVE_DAEMON])])] |
| 2524 |
) |
| 2525 |
|
| 2526 |
AC_CHECK_FUNC([getpagesize], |
| 2527 |
[AC_DEFINE([HAVE_GETPAGESIZE], [1], |
| 2528 |
[Define if your libraries define getpagesize()])], |
| 2529 |
[AC_CHECK_LIB([ucb], [getpagesize], |
| 2530 |
[LIBS="$LIBS -lucb"; AC_DEFINE([HAVE_GETPAGESIZE])])] |
| 2531 |
) |
| 2532 |
|
| 2533 |
# Check for broken snprintf |
| 2534 |
if test "x$ac_cv_func_snprintf" = "xyes" ; then |
| 2535 |
AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) |
| 2536 |
AC_RUN_IFELSE( |
| 2537 |
[AC_LANG_PROGRAM([[ |
| 2538 |
#include <stdio.h> |
| 2539 |
#include <stdlib.h> |
| 2540 |
]], |
| 2541 |
[[ |
| 2542 |
char b[5]; |
| 2543 |
snprintf(b,5,"123456789"); |
| 2544 |
exit(b[4]!='\0'); |
| 2545 |
]])], |
| 2546 |
[AC_MSG_RESULT([yes])], |
| 2547 |
[ |
| 2548 |
AC_MSG_RESULT([no]) |
| 2549 |
AC_DEFINE([BROKEN_SNPRINTF], [1], |
| 2550 |
[Define if your snprintf is busted]) |
| 2551 |
AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) |
| 2552 |
], |
| 2553 |
[ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] |
| 2554 |
) |
| 2555 |
fi |
| 2556 |
|
| 2557 |
if test "x$ac_cv_func_snprintf" = "xyes" ; then |
| 2558 |
AC_MSG_CHECKING([whether snprintf understands %zu]) |
| 2559 |
AC_RUN_IFELSE( |
| 2560 |
[AC_LANG_PROGRAM([[ |
| 2561 |
#include <sys/types.h> |
| 2562 |
#include <stdio.h> |
| 2563 |
#include <stdlib.h> |
| 2564 |
#include <string.h> |
| 2565 |
]], |
| 2566 |
[[ |
| 2567 |
size_t a = 1, b = 2; |
| 2568 |
char z[128]; |
| 2569 |
snprintf(z, sizeof z, "%zu%zu", a, b); |
| 2570 |
exit(strcmp(z, "12")); |
| 2571 |
]])], |
| 2572 |
[AC_MSG_RESULT([yes])], |
| 2573 |
[ |
| 2574 |
AC_MSG_RESULT([no]) |
| 2575 |
AC_DEFINE([BROKEN_SNPRINTF], [1], |
| 2576 |
[snprintf does not understand %zu]) |
| 2577 |
], |
| 2578 |
[ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] |
| 2579 |
) |
| 2580 |
fi |
| 2581 |
|
| 2582 |
# We depend on vsnprintf returning the right thing on overflow: the |
| 2583 |
# number of characters it tried to create (as per SUSv3) |
| 2584 |
if test "x$ac_cv_func_vsnprintf" = "xyes" ; then |
| 2585 |
AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow]) |
| 2586 |
AC_RUN_IFELSE( |
| 2587 |
[AC_LANG_PROGRAM([[ |
| 2588 |
#include <sys/types.h> |
| 2589 |
#include <stdio.h> |
| 2590 |
#include <stdarg.h> |
| 2591 |
|
| 2592 |
int x_snprintf(char *str, size_t count, const char *fmt, ...) |
| 2593 |
{ |
| 2594 |
size_t ret; |
| 2595 |
va_list ap; |
| 2596 |
|
| 2597 |
va_start(ap, fmt); |
| 2598 |
ret = vsnprintf(str, count, fmt, ap); |
| 2599 |
va_end(ap); |
| 2600 |
return ret; |
| 2601 |
} |
| 2602 |
]], [[ |
| 2603 |
char x[1]; |
| 2604 |
if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11) |
| 2605 |
return 1; |
| 2606 |
if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11) |
| 2607 |
return 1; |
| 2608 |
return 0; |
| 2609 |
]])], |
| 2610 |
[AC_MSG_RESULT([yes])], |
| 2611 |
[ |
| 2612 |
AC_MSG_RESULT([no]) |
| 2613 |
AC_DEFINE([BROKEN_SNPRINTF], [1], |
| 2614 |
[Define if your snprintf is busted]) |
| 2615 |
AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor]) |
| 2616 |
], |
| 2617 |
[ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ] |
| 2618 |
) |
| 2619 |
fi |
| 2620 |
|
| 2621 |
# On systems where [v]snprintf is broken, but is declared in stdio, |
| 2622 |
# check that the fmt argument is const char * or just char *. |
| 2623 |
# This is only useful for when BROKEN_SNPRINTF |
| 2624 |
AC_MSG_CHECKING([whether snprintf can declare const char *fmt]) |
| 2625 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 2626 |
#ifdef _FORTIFY_SOURCE |
| 2627 |
#undef _FORTIFY_SOURCE |
| 2628 |
#endif |
| 2629 |
#include <stdio.h> |
| 2630 |
int snprintf(char *a, size_t b, const char *c, ...) { return 0; } |
| 2631 |
]], [[ |
| 2632 |
snprintf(0, 0, 0); |
| 2633 |
]])], |
| 2634 |
[AC_MSG_RESULT([yes]) |
| 2635 |
AC_DEFINE([SNPRINTF_CONST], [const], |
| 2636 |
[Define as const if snprintf() can declare const char *fmt])], |
| 2637 |
[AC_MSG_RESULT([no]) |
| 2638 |
AC_DEFINE([SNPRINTF_CONST], [/* not const */])]) |
| 2639 |
|
| 2640 |
# Check for missing getpeereid (or equiv) support |
| 2641 |
NO_PEERCHECK="" |
| 2642 |
if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then |
| 2643 |
AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt]) |
| 2644 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 2645 |
#include <sys/types.h> |
| 2646 |
#include <sys/socket.h>]], [[int i = SO_PEERCRED;]])], |
| 2647 |
[ AC_MSG_RESULT([yes]) |
| 2648 |
AC_DEFINE([HAVE_SO_PEERCRED], [1], [Have PEERCRED socket option]) |
| 2649 |
], [AC_MSG_RESULT([no]) |
| 2650 |
NO_PEERCHECK=1 |
| 2651 |
]) |
| 2652 |
fi |
| 2653 |
|
| 2654 |
dnl make sure that openpty does not reacquire controlling terminal |
| 2655 |
if test ! -z "$check_for_openpty_ctty_bug"; then |
| 2656 |
AC_MSG_CHECKING([if openpty correctly handles controlling tty]) |
| 2657 |
AC_RUN_IFELSE( |
| 2658 |
[AC_LANG_PROGRAM([[ |
| 2659 |
#include <stdio.h> |
| 2660 |
#include <stdlib.h> |
| 2661 |
#include <unistd.h> |
| 2662 |
#ifdef HAVE_PTY_H |
| 2663 |
# include <pty.h> |
| 2664 |
#endif |
| 2665 |
#include <sys/fcntl.h> |
| 2666 |
#include <sys/types.h> |
| 2667 |
#include <sys/wait.h> |
| 2668 |
]], [[ |
| 2669 |
pid_t pid; |
| 2670 |
int fd, ptyfd, ttyfd, status; |
| 2671 |
|
| 2672 |
pid = fork(); |
| 2673 |
if (pid < 0) { /* failed */ |
| 2674 |
exit(1); |
| 2675 |
} else if (pid > 0) { /* parent */ |
| 2676 |
waitpid(pid, &status, 0); |
| 2677 |
if (WIFEXITED(status)) |
| 2678 |
exit(WEXITSTATUS(status)); |
| 2679 |
else |
| 2680 |
exit(2); |
| 2681 |
} else { /* child */ |
| 2682 |
close(0); close(1); close(2); |
| 2683 |
setsid(); |
| 2684 |
openpty(&ptyfd, &ttyfd, NULL, NULL, NULL); |
| 2685 |
fd = open("/dev/tty", O_RDWR | O_NOCTTY); |
| 2686 |
if (fd >= 0) |
| 2687 |
exit(3); /* Acquired ctty: broken */ |
| 2688 |
else |
| 2689 |
exit(0); /* Did not acquire ctty: OK */ |
| 2690 |
} |
| 2691 |
]])], |
| 2692 |
[ |
| 2693 |
AC_MSG_RESULT([yes]) |
| 2694 |
], |
| 2695 |
[ |
| 2696 |
AC_MSG_RESULT([no]) |
| 2697 |
AC_DEFINE([SSHD_ACQUIRES_CTTY]) |
| 2698 |
], |
| 2699 |
[ |
| 2700 |
AC_MSG_RESULT([cross-compiling, assuming yes]) |
| 2701 |
] |
| 2702 |
) |
| 2703 |
fi |
| 2704 |
|
| 2705 |
if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ |
| 2706 |
test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then |
| 2707 |
AC_MSG_CHECKING([if getaddrinfo seems to work]) |
| 2708 |
AC_RUN_IFELSE( |
| 2709 |
[AC_LANG_PROGRAM([[ |
| 2710 |
#include <stdio.h> |
| 2711 |
#include <stdlib.h> |
| 2712 |
#include <sys/socket.h> |
| 2713 |
#include <netdb.h> |
| 2714 |
#include <errno.h> |
| 2715 |
#include <netinet/in.h> |
| 2716 |
|
| 2717 |
#define TEST_PORT "2222" |
| 2718 |
]], [[ |
| 2719 |
int err, sock; |
| 2720 |
struct addrinfo *gai_ai, *ai, hints; |
| 2721 |
char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL; |
| 2722 |
|
| 2723 |
memset(&hints, 0, sizeof(hints)); |
| 2724 |
hints.ai_family = PF_UNSPEC; |
| 2725 |
hints.ai_socktype = SOCK_STREAM; |
| 2726 |
hints.ai_flags = AI_PASSIVE; |
| 2727 |
|
| 2728 |
err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai); |
| 2729 |
if (err != 0) { |
| 2730 |
fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err)); |
| 2731 |
exit(1); |
| 2732 |
} |
| 2733 |
|
| 2734 |
for (ai = gai_ai; ai != NULL; ai = ai->ai_next) { |
| 2735 |
if (ai->ai_family != AF_INET6) |
| 2736 |
continue; |
| 2737 |
|
| 2738 |
err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, |
| 2739 |
sizeof(ntop), strport, sizeof(strport), |
| 2740 |
NI_NUMERICHOST|NI_NUMERICSERV); |
| 2741 |
|
| 2742 |
if (err != 0) { |
| 2743 |
if (err == EAI_SYSTEM) |
| 2744 |
perror("getnameinfo EAI_SYSTEM"); |
| 2745 |
else |
| 2746 |
fprintf(stderr, "getnameinfo failed: %s\n", |
| 2747 |
gai_strerror(err)); |
| 2748 |
exit(2); |
| 2749 |
} |
| 2750 |
|
| 2751 |
sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); |
| 2752 |
if (sock < 0) |
| 2753 |
perror("socket"); |
| 2754 |
if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { |
| 2755 |
if (errno == EBADF) |
| 2756 |
exit(3); |
| 2757 |
} |
| 2758 |
} |
| 2759 |
exit(0); |
| 2760 |
]])], |
| 2761 |
[ |
| 2762 |
AC_MSG_RESULT([yes]) |
| 2763 |
], |
| 2764 |
[ |
| 2765 |
AC_MSG_RESULT([no]) |
| 2766 |
AC_DEFINE([BROKEN_GETADDRINFO]) |
| 2767 |
], |
| 2768 |
[ |
| 2769 |
AC_MSG_RESULT([cross-compiling, assuming yes]) |
| 2770 |
] |
| 2771 |
) |
| 2772 |
fi |
| 2773 |
|
| 2774 |
if test "x$ac_cv_func_getaddrinfo" = "xyes" && \ |
| 2775 |
test "x$check_for_aix_broken_getaddrinfo" = "x1"; then |
| 2776 |
AC_MSG_CHECKING([if getaddrinfo seems to work]) |
| 2777 |
AC_RUN_IFELSE( |
| 2778 |
[AC_LANG_PROGRAM([[ |
| 2779 |
#include <stdio.h> |
| 2780 |
#include <stdlib.h> |
| 2781 |
#include <sys/socket.h> |
| 2782 |
#include <netdb.h> |
| 2783 |
#include <errno.h> |
| 2784 |
#include <netinet/in.h> |
| 2785 |
|
| 2786 |
#define TEST_PORT "2222" |
| 2787 |
]], [[ |
| 2788 |
int err, sock; |
| 2789 |
struct addrinfo *gai_ai, *ai, hints; |
| 2790 |
char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL; |
| 2791 |
|
| 2792 |
memset(&hints, 0, sizeof(hints)); |
| 2793 |
hints.ai_family = PF_UNSPEC; |
| 2794 |
hints.ai_socktype = SOCK_STREAM; |
| 2795 |
hints.ai_flags = AI_PASSIVE; |
| 2796 |
|
| 2797 |
err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai); |
| 2798 |
if (err != 0) { |
| 2799 |
fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err)); |
| 2800 |
exit(1); |
| 2801 |
} |
| 2802 |
|
| 2803 |
for (ai = gai_ai; ai != NULL; ai = ai->ai_next) { |
| 2804 |
if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) |
| 2805 |
continue; |
| 2806 |
|
| 2807 |
err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, |
| 2808 |
sizeof(ntop), strport, sizeof(strport), |
| 2809 |
NI_NUMERICHOST|NI_NUMERICSERV); |
| 2810 |
|
| 2811 |
if (ai->ai_family == AF_INET && err != 0) { |
| 2812 |
perror("getnameinfo"); |
| 2813 |
exit(2); |
| 2814 |
} |
| 2815 |
} |
| 2816 |
exit(0); |
| 2817 |
]])], |
| 2818 |
[ |
| 2819 |
AC_MSG_RESULT([yes]) |
| 2820 |
AC_DEFINE([AIX_GETNAMEINFO_HACK], [1], |
| 2821 |
[Define if you have a getaddrinfo that fails |
| 2822 |
for the all-zeros IPv6 address]) |
| 2823 |
], |
| 2824 |
[ |
| 2825 |
AC_MSG_RESULT([no]) |
| 2826 |
AC_DEFINE([BROKEN_GETADDRINFO]) |
| 2827 |
], |
| 2828 |
[ |
| 2829 |
AC_MSG_RESULT([cross-compiling, assuming no]) |
| 2830 |
] |
| 2831 |
) |
| 2832 |
fi |
| 2833 |
|
| 2834 |
if test "x$ac_cv_func_getaddrinfo" = "xyes"; then |
| 2835 |
AC_CHECK_DECLS(AI_NUMERICSERV, , , |
| 2836 |
[#include <sys/types.h> |
| 2837 |
#include <sys/socket.h> |
| 2838 |
#include <netdb.h>]) |
| 2839 |
fi |
| 2840 |
|
| 2841 |
if test "x$check_for_conflicting_getspnam" = "x1"; then |
| 2842 |
AC_MSG_CHECKING([for conflicting getspnam in shadow.h]) |
| 2843 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 2844 |
#include <shadow.h> |
| 2845 |
#include <stdlib.h> |
| 2846 |
]], |
| 2847 |
[[ exit(0); ]])], |
| 2848 |
[ |
| 2849 |
AC_MSG_RESULT([no]) |
| 2850 |
], |
| 2851 |
[ |
| 2852 |
AC_MSG_RESULT([yes]) |
| 2853 |
AC_DEFINE([GETSPNAM_CONFLICTING_DEFS], [1], |
| 2854 |
[Conflicting defs for getspnam]) |
| 2855 |
] |
| 2856 |
) |
| 2857 |
fi |
| 2858 |
|
| 2859 |
dnl NetBSD added an strnvis and unfortunately made it incompatible with the |
| 2860 |
dnl existing one in OpenBSD and Linux's libbsd (the former having existed |
| 2861 |
dnl for over ten years). Despite this incompatibility being reported during |
| 2862 |
dnl development (see http://gnats.netbsd.org/44977) they still shipped it. |
| 2863 |
dnl Even more unfortunately FreeBSD and later MacOS picked up this incompatible |
| 2864 |
dnl implementation. Try to detect this mess, and assume the only safe option |
| 2865 |
dnl if we're cross compiling. |
| 2866 |
dnl |
| 2867 |
dnl OpenBSD, 2001: strnvis(char *dst, const char *src, size_t dlen, int flag); |
| 2868 |
dnl NetBSD: 2012, strnvis(char *dst, size_t dlen, const char *src, int flag); |
| 2869 |
if test "x$ac_cv_func_strnvis" = "xyes"; then |
| 2870 |
AC_MSG_CHECKING([for working strnvis]) |
| 2871 |
AC_RUN_IFELSE( |
| 2872 |
[AC_LANG_PROGRAM([[ |
| 2873 |
#include <signal.h> |
| 2874 |
#include <stdlib.h> |
| 2875 |
#include <string.h> |
| 2876 |
#include <unistd.h> |
| 2877 |
#include <vis.h> |
| 2878 |
static void sighandler(int sig) { _exit(1); } |
| 2879 |
]], [[ |
| 2880 |
char dst[16]; |
| 2881 |
|
| 2882 |
signal(SIGSEGV, sighandler); |
| 2883 |
if (strnvis(dst, "src", 4, 0) && strcmp(dst, "src") == 0) |
| 2884 |
exit(0); |
| 2885 |
exit(1) |
| 2886 |
]])], |
| 2887 |
[AC_MSG_RESULT([yes])], |
| 2888 |
[AC_MSG_RESULT([no]) |
| 2889 |
AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis detected broken])], |
| 2890 |
[AC_MSG_WARN([cross compiling: assuming broken]) |
| 2891 |
AC_DEFINE([BROKEN_STRNVIS], [1], [strnvis assumed broken])] |
| 2892 |
) |
| 2893 |
fi |
| 2894 |
|
| 2895 |
AC_MSG_CHECKING([if SA_RESTARTed signals interrupt select()]) |
| 2896 |
AC_RUN_IFELSE( |
| 2897 |
[AC_LANG_PROGRAM([[ |
| 2898 |
#ifdef HAVE_SYS_SELECT |
| 2899 |
# include <sys/select.h> |
| 2900 |
#endif |
| 2901 |
#include <sys/types.h> |
| 2902 |
#include <sys/time.h> |
| 2903 |
#include <stdlib.h> |
| 2904 |
#include <signal.h> |
| 2905 |
#include <unistd.h> |
| 2906 |
static void sighandler(int sig) { } |
| 2907 |
]], [[ |
| 2908 |
int r; |
| 2909 |
pid_t pid; |
| 2910 |
struct sigaction sa; |
| 2911 |
|
| 2912 |
sa.sa_handler = sighandler; |
| 2913 |
sa.sa_flags = SA_RESTART; |
| 2914 |
(void)sigaction(SIGTERM, &sa, NULL); |
| 2915 |
if ((pid = fork()) == 0) { /* child */ |
| 2916 |
pid = getppid(); |
| 2917 |
sleep(1); |
| 2918 |
kill(pid, SIGTERM); |
| 2919 |
sleep(1); |
| 2920 |
if (getppid() == pid) /* if parent did not exit, shoot it */ |
| 2921 |
kill(pid, SIGKILL); |
| 2922 |
exit(0); |
| 2923 |
} else { /* parent */ |
| 2924 |
r = select(0, NULL, NULL, NULL, NULL); |
| 2925 |
} |
| 2926 |
exit(r == -1 ? 0 : 1); |
| 2927 |
]])], |
| 2928 |
[AC_MSG_RESULT([yes])], |
| 2929 |
[AC_MSG_RESULT([no]) |
| 2930 |
AC_DEFINE([NO_SA_RESTART], [1], |
| 2931 |
[SA_RESTARTed signals do no interrupt select])], |
| 2932 |
[AC_MSG_WARN([cross compiling: assuming yes])] |
| 2933 |
) |
| 2934 |
|
| 2935 |
AC_CHECK_FUNCS([getpgrp],[ |
| 2936 |
AC_MSG_CHECKING([if getpgrp accepts zero args]) |
| 2937 |
AC_COMPILE_IFELSE( |
| 2938 |
[AC_LANG_PROGRAM([[$ac_includes_default]], [[ getpgrp(); ]])], |
| 2939 |
[ AC_MSG_RESULT([yes]) |
| 2940 |
AC_DEFINE([GETPGRP_VOID], [1], [getpgrp takes zero args])], |
| 2941 |
[ AC_MSG_RESULT([no]) |
| 2942 |
AC_DEFINE([GETPGRP_VOID], [0], [getpgrp takes one arg])] |
| 2943 |
) |
| 2944 |
]) |
| 2945 |
|
| 2946 |
# Search for OpenSSL |
| 2947 |
saved_CPPFLAGS="$CPPFLAGS" |
| 2948 |
saved_LDFLAGS="$LDFLAGS" |
| 2949 |
openssl_bin_PATH="$PATH" |
| 2950 |
AC_ARG_WITH([ssl-dir], |
| 2951 |
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ], |
| 2952 |
[ |
| 2953 |
if test "x$openssl" = "xno" ; then |
| 2954 |
AC_MSG_ERROR([cannot use --with-ssl-dir when OpenSSL disabled]) |
| 2955 |
fi |
| 2956 |
if test "x$withval" != "xno" ; then |
| 2957 |
case "$withval" in |
| 2958 |
# Relative paths |
| 2959 |
./*|../*) withval="`pwd`/$withval" |
| 2960 |
esac |
| 2961 |
if test -d "$withval/lib"; then |
| 2962 |
libcrypto_path="${withval}/lib" |
| 2963 |
elif test -d "$withval/lib64"; then |
| 2964 |
libcrypto_path="$withval/lib64" |
| 2965 |
else |
| 2966 |
# Built but not installed |
| 2967 |
libcrypto_path="${withval}" |
| 2968 |
fi |
| 2969 |
if test -n "${rpath_opt}"; then |
| 2970 |
LDFLAGS="-L${libcrypto_path} ${rpath_opt}${libcrypto_path} ${LDFLAGS}" |
| 2971 |
else |
| 2972 |
LDFLAGS="-L${libcrypto_path} ${LDFLAGS}" |
| 2973 |
fi |
| 2974 |
if test -d "$withval/include"; then |
| 2975 |
CPPFLAGS="-I${withval}/include ${CPPFLAGS}" |
| 2976 |
else |
| 2977 |
CPPFLAGS="-I${withval} ${CPPFLAGS}" |
| 2978 |
fi |
| 2979 |
dnl Ensure specified openssl binary works, eg it can |
| 2980 |
dnl find its runtime libraries, before trying to use. |
| 2981 |
if test -x "${withval}/bin/openssl" && \ |
| 2982 |
"${withval}/bin/openssl" version >/dev/null 2>&1; then |
| 2983 |
openssl_bin_PATH="${withval}/bin${PATH_SEPARATOR}${PATH}" |
| 2984 |
elif test -x "${withval}/apps/openssl" && \ |
| 2985 |
"${withval}/apps/openssl" version >/dev/null 2>&1; then |
| 2986 |
openssl_bin_PATH="${withval}/apps${PATH_SEPARATOR}${PATH}" |
| 2987 |
fi |
| 2988 |
fi |
| 2989 |
] |
| 2990 |
) |
| 2991 |
AC_PATH_PROGS([openssl_bin], openssl, [], [$openssl_bin_PATH]) |
| 2992 |
AC_SUBST(OPENSSL_BIN, [${openssl_bin}]) |
| 2993 |
|
| 2994 |
AC_ARG_WITH([openssl-header-check], |
| 2995 |
[ --without-openssl-header-check Disable OpenSSL version consistency check], |
| 2996 |
[ |
| 2997 |
if test "x$withval" = "xno" ; then |
| 2998 |
openssl_check_nonfatal=1 |
| 2999 |
fi |
| 3000 |
] |
| 3001 |
) |
| 3002 |
|
| 3003 |
openssl_engine=no |
| 3004 |
AC_ARG_WITH([ssl-engine], |
| 3005 |
[ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ], |
| 3006 |
[ |
| 3007 |
if test "x$withval" != "xno" ; then |
| 3008 |
if test "x$openssl" = "xno" ; then |
| 3009 |
AC_MSG_ERROR([cannot use --with-ssl-engine when OpenSSL disabled]) |
| 3010 |
fi |
| 3011 |
openssl_engine=yes |
| 3012 |
fi |
| 3013 |
] |
| 3014 |
) |
| 3015 |
|
| 3016 |
nocrypto_saved_LIBS="$LIBS" |
| 3017 |
if test "x$openssl" = "xyes" ; then |
| 3018 |
LIBS="-lcrypto $LIBS" |
| 3019 |
CHANNELLIBS="-lcrypto $CHANNELLIBS" |
| 3020 |
AC_TRY_LINK_FUNC([RAND_add], , [ |
| 3021 |
# As of early 2026, BoringSSL libcrypto needs -lstdc++ for |
| 3022 |
# destructors so try that before giving up. |
| 3023 |
LIBS="$LIBS -lstdc++" |
| 3024 |
CHANNELLIBS="$CHANNELLIBS -lstdc++" |
| 3025 |
AC_TRY_LINK_FUNC([RAND_add], , [ |
| 3026 |
AC_MSG_ERROR([*** working libcrypto not found, check config.log]) |
| 3027 |
]) |
| 3028 |
]) |
| 3029 |
AC_CHECK_HEADER([openssl/opensslv.h], , |
| 3030 |
[AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***])]) |
| 3031 |
|
| 3032 |
# Determine OpenSSL header version |
| 3033 |
AC_MSG_CHECKING([OpenSSL header version]) |
| 3034 |
AC_RUN_IFELSE( |
| 3035 |
[AC_LANG_PROGRAM([[ |
| 3036 |
#include <stdlib.h> |
| 3037 |
#include <stdio.h> |
| 3038 |
#include <string.h> |
| 3039 |
#include <openssl/opensslv.h> |
| 3040 |
#define DATA "conftest.sslincver" |
| 3041 |
]], [[ |
| 3042 |
FILE *fd; |
| 3043 |
int rc; |
| 3044 |
|
| 3045 |
fd = fopen(DATA,"w"); |
| 3046 |
if(fd == NULL) |
| 3047 |
exit(1); |
| 3048 |
|
| 3049 |
if ((rc = fprintf(fd, "%08lx (%s)\n", |
| 3050 |
(unsigned long)OPENSSL_VERSION_NUMBER, |
| 3051 |
OPENSSL_VERSION_TEXT)) < 0) |
| 3052 |
exit(1); |
| 3053 |
|
| 3054 |
exit(0); |
| 3055 |
]])], |
| 3056 |
[ |
| 3057 |
ssl_header_ver=`cat conftest.sslincver` |
| 3058 |
AC_MSG_RESULT([$ssl_header_ver]) |
| 3059 |
], |
| 3060 |
[ |
| 3061 |
AC_MSG_RESULT([failed]) |
| 3062 |
AC_MSG_ERROR([OpenSSL version test program failed.]) |
| 3063 |
], |
| 3064 |
[ |
| 3065 |
AC_MSG_WARN([cross compiling: not checking]) |
| 3066 |
] |
| 3067 |
) |
| 3068 |
|
| 3069 |
# Determining OpenSSL library version is version dependent. |
| 3070 |
AC_CHECK_FUNCS([OpenSSL_version OpenSSL_version_num]) |
| 3071 |
|
| 3072 |
# Determine OpenSSL library version |
| 3073 |
AC_MSG_CHECKING([OpenSSL library version]) |
| 3074 |
AC_RUN_IFELSE( |
| 3075 |
[AC_LANG_PROGRAM([[ |
| 3076 |
#include <stdio.h> |
| 3077 |
#include <stdlib.h> |
| 3078 |
#include <string.h> |
| 3079 |
#include <openssl/opensslv.h> |
| 3080 |
#include <openssl/crypto.h> |
| 3081 |
#define DATA "conftest.ssllibver" |
| 3082 |
]], [[ |
| 3083 |
FILE *f; |
| 3084 |
/* We need these legacy bits to warn for old libcrypto */ |
| 3085 |
#ifndef OPENSSL_VERSION |
| 3086 |
# define OPENSSL_VERSION SSLEAY_VERSION |
| 3087 |
#endif |
| 3088 |
#ifndef HAVE_OPENSSL_VERSION |
| 3089 |
# define OpenSSL_version SSLeay_version |
| 3090 |
#endif |
| 3091 |
#ifndef HAVE_OPENSSL_VERSION_NUM |
| 3092 |
# define OpenSSL_version_num SSLeay |
| 3093 |
#endif |
| 3094 |
if ((f = fopen(DATA, "w")) == NULL) |
| 3095 |
exit(1); |
| 3096 |
if (fprintf(f, "%08lx (%s)", |
| 3097 |
(unsigned long)OpenSSL_version_num(), |
| 3098 |
OpenSSL_version(OPENSSL_VERSION)) < 0) |
| 3099 |
exit(1); |
| 3100 |
#ifdef LIBRESSL_VERSION_NUMBER |
| 3101 |
if (fprintf(f, " libressl-%08lx", LIBRESSL_VERSION_NUMBER) < 0) |
| 3102 |
exit(1); |
| 3103 |
#endif |
| 3104 |
if (fputc('\n', f) == EOF || fclose(f) == EOF) |
| 3105 |
exit(1); |
| 3106 |
exit(0); |
| 3107 |
]])], |
| 3108 |
[ |
| 3109 |
sslver=`cat conftest.ssllibver` |
| 3110 |
ssl_showver=`echo "$sslver" | sed 's/ libressl-.*//'` |
| 3111 |
# Check version is supported. |
| 3112 |
case "$sslver" in |
| 3113 |
100*|10100*) # 1.0.x, 1.1.0x |
| 3114 |
AC_MSG_ERROR([OpenSSL >= 1.1.1 required (have "$ssl_showver")]) |
| 3115 |
;; |
| 3116 |
101*) ;; # 1.1.x |
| 3117 |
200*) # LibreSSL |
| 3118 |
lver=`echo "$sslver" | sed 's/.*libressl-//'` |
| 3119 |
case "$lver" in |
| 3120 |
2*|300*) # 2.x, 3.0.0 |
| 3121 |
AC_MSG_ERROR([LibreSSL >= 3.1.0 required (have "$ssl_showver")]) |
| 3122 |
;; |
| 3123 |
*) ;; # Assume all other versions are good. |
| 3124 |
esac |
| 3125 |
;; |
| 3126 |
30*|40*) |
| 3127 |
# OpenSSL 3 & 4; we use the 1.1x API |
| 3128 |
# https://openssl.org/policies/general/versioning-policy.html |
| 3129 |
CPPFLAGS="$CPPFLAGS -DOPENSSL_API_COMPAT=0x10100000L" |
| 3130 |
;; |
| 3131 |
*) |
| 3132 |
AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_showver")]) |
| 3133 |
;; |
| 3134 |
esac |
| 3135 |
AC_MSG_RESULT([$ssl_showver]) |
| 3136 |
], |
| 3137 |
[ |
| 3138 |
AC_MSG_RESULT([not found]) |
| 3139 |
AC_MSG_ERROR([OpenSSL library not found.]) |
| 3140 |
], |
| 3141 |
[ |
| 3142 |
AC_MSG_WARN([cross compiling: not checking]) |
| 3143 |
] |
| 3144 |
) |
| 3145 |
|
| 3146 |
case "$host" in |
| 3147 |
x86_64-*) |
| 3148 |
case "$sslver" in |
| 3149 |
3000004*) |
| 3150 |
AC_MSG_ERROR([OpenSSL 3.0.4 has a potential RCE in its RSA implementation (CVE-2022-2274)]) |
| 3151 |
;; |
| 3152 |
esac |
| 3153 |
esac |
| 3154 |
|
| 3155 |
# Sanity check OpenSSL headers |
| 3156 |
AC_MSG_CHECKING([whether OpenSSL's headers match the library]) |
| 3157 |
AC_RUN_IFELSE( |
| 3158 |
[AC_LANG_PROGRAM([[ |
| 3159 |
#include <stdlib.h> |
| 3160 |
#include <string.h> |
| 3161 |
#include <openssl/opensslv.h> |
| 3162 |
#include <openssl/crypto.h> |
| 3163 |
]], [[ |
| 3164 |
exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1); |
| 3165 |
]])], |
| 3166 |
[ |
| 3167 |
AC_MSG_RESULT([yes]) |
| 3168 |
], |
| 3169 |
[ |
| 3170 |
AC_MSG_RESULT([no]) |
| 3171 |
if test "x$openssl_check_nonfatal" = "x"; then |
| 3172 |
AC_MSG_ERROR([Your OpenSSL headers do not match your |
| 3173 |
library. Check config.log for details. |
| 3174 |
If you are sure your installation is consistent, you can disable the check |
| 3175 |
by running "./configure --without-openssl-header-check". |
| 3176 |
Also see contrib/findssl.sh for help identifying header/library mismatches. |
| 3177 |
]) |
| 3178 |
else |
| 3179 |
AC_MSG_WARN([Your OpenSSL headers do not match your |
| 3180 |
library. Check config.log for details. |
| 3181 |
Also see contrib/findssl.sh for help identifying header/library mismatches.]) |
| 3182 |
fi |
| 3183 |
], |
| 3184 |
[ |
| 3185 |
AC_MSG_WARN([cross compiling: not checking]) |
| 3186 |
] |
| 3187 |
) |
| 3188 |
|
| 3189 |
AC_MSG_CHECKING([if programs using OpenSSL functions will link]) |
| 3190 |
AC_LINK_IFELSE( |
| 3191 |
[AC_LANG_PROGRAM([[ #include <openssl/err.h> ]], |
| 3192 |
[[ ERR_load_crypto_strings(); ]])], |
| 3193 |
[ |
| 3194 |
AC_MSG_RESULT([yes]) |
| 3195 |
], |
| 3196 |
[ |
| 3197 |
AC_MSG_RESULT([no]) |
| 3198 |
LIBS="$LIBS -ldl" |
| 3199 |
AC_MSG_CHECKING([if programs using OpenSSL need -ldl]) |
| 3200 |
AC_LINK_IFELSE( |
| 3201 |
[AC_LANG_PROGRAM([[ #include <openssl/err.h> ]], |
| 3202 |
[[ ERR_load_crypto_strings(); ]])], |
| 3203 |
[ |
| 3204 |
AC_MSG_RESULT([yes]) |
| 3205 |
CHANNELLIBS="$CHANNELLIBS -ldl" |
| 3206 |
], |
| 3207 |
[ |
| 3208 |
AC_MSG_RESULT([no]) |
| 3209 |
] |
| 3210 |
) |
| 3211 |
] |
| 3212 |
) |
| 3213 |
|
| 3214 |
AC_CHECK_FUNCS([ \ |
| 3215 |
BN_is_prime_ex \ |
| 3216 |
DES_crypt \ |
| 3217 |
EVP_DigestSign \ |
| 3218 |
EVP_DigestVerify \ |
| 3219 |
EVP_DigestFinal_ex \ |
| 3220 |
EVP_DigestInit_ex \ |
| 3221 |
EVP_MD_CTX_cleanup \ |
| 3222 |
EVP_MD_CTX_copy_ex \ |
| 3223 |
EVP_MD_CTX_init \ |
| 3224 |
HMAC_CTX_init \ |
| 3225 |
RSA_generate_key_ex \ |
| 3226 |
RSA_get_default_method \ |
| 3227 |
]) |
| 3228 |
|
| 3229 |
# LibreSSL/OpenSSL API differences |
| 3230 |
AC_CHECK_FUNCS([ \ |
| 3231 |
EC_POINT_get_affine_coordinates \ |
| 3232 |
EC_POINT_get_affine_coordinates_GFp \ |
| 3233 |
EC_POINT_set_affine_coordinates \ |
| 3234 |
EC_POINT_set_affine_coordinates_GFp \ |
| 3235 |
EVP_CIPHER_CTX_iv \ |
| 3236 |
EVP_CIPHER_CTX_iv_noconst \ |
| 3237 |
EVP_CIPHER_CTX_get_iv \ |
| 3238 |
EVP_CIPHER_CTX_get_updated_iv \ |
| 3239 |
EVP_CIPHER_CTX_set_iv \ |
| 3240 |
]) |
| 3241 |
|
| 3242 |
if test "x$openssl_engine" = "xyes" ; then |
| 3243 |
AC_MSG_CHECKING([for OpenSSL ENGINE support]) |
| 3244 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3245 |
#include <openssl/engine.h> |
| 3246 |
]], [[ |
| 3247 |
ENGINE_load_builtin_engines(); |
| 3248 |
ENGINE_register_all_complete(); |
| 3249 |
]])], |
| 3250 |
[ AC_MSG_RESULT([yes]) |
| 3251 |
AC_DEFINE([USE_OPENSSL_ENGINE], [1], |
| 3252 |
[Enable OpenSSL engine support]) |
| 3253 |
], [ AC_MSG_ERROR([OpenSSL ENGINE support not found]) |
| 3254 |
]) |
| 3255 |
fi |
| 3256 |
|
| 3257 |
# Check for OpenSSL without EVP_aes_{192,256}_cbc |
| 3258 |
AC_MSG_CHECKING([whether OpenSSL lacks support for AES 192/256]) |
| 3259 |
AC_LINK_IFELSE( |
| 3260 |
[AC_LANG_PROGRAM([[ |
| 3261 |
#include <stdlib.h> |
| 3262 |
#include <string.h> |
| 3263 |
#include <openssl/evp.h> |
| 3264 |
]], [[ |
| 3265 |
exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL); |
| 3266 |
]])], |
| 3267 |
[ |
| 3268 |
AC_MSG_RESULT([no]) |
| 3269 |
], |
| 3270 |
[ |
| 3271 |
AC_MSG_RESULT([yes]) |
| 3272 |
AC_DEFINE([OPENSSL_LOBOTOMISED_AES], [1], |
| 3273 |
[libcrypto is missing AES 192 and 256 bit functions]) |
| 3274 |
] |
| 3275 |
) |
| 3276 |
|
| 3277 |
AC_MSG_CHECKING([if EVP_DigestUpdate returns an int]) |
| 3278 |
AC_LINK_IFELSE( |
| 3279 |
[AC_LANG_PROGRAM([[ |
| 3280 |
#include <stdlib.h> |
| 3281 |
#include <string.h> |
| 3282 |
#include <openssl/evp.h> |
| 3283 |
]], [[ |
| 3284 |
if(EVP_DigestUpdate(NULL, NULL,0)) |
| 3285 |
exit(0); |
| 3286 |
]])], |
| 3287 |
[ |
| 3288 |
AC_MSG_RESULT([yes]) |
| 3289 |
], |
| 3290 |
[ |
| 3291 |
AC_MSG_RESULT([no]) |
| 3292 |
AC_DEFINE([OPENSSL_EVP_DIGESTUPDATE_VOID], [1], |
| 3293 |
[Define if EVP_DigestUpdate returns void]) |
| 3294 |
] |
| 3295 |
) |
| 3296 |
|
| 3297 |
# Check for various EVP support in OpenSSL |
| 3298 |
AC_CHECK_FUNCS([EVP_sha256 EVP_sha384 EVP_sha512 EVP_chacha20]) |
| 3299 |
|
| 3300 |
# Check complete ECC support in OpenSSL |
| 3301 |
AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1]) |
| 3302 |
AC_LINK_IFELSE( |
| 3303 |
[AC_LANG_PROGRAM([[ |
| 3304 |
#include <openssl/ec.h> |
| 3305 |
#include <openssl/ecdh.h> |
| 3306 |
#include <openssl/ecdsa.h> |
| 3307 |
#include <openssl/evp.h> |
| 3308 |
#include <openssl/objects.h> |
| 3309 |
#include <openssl/opensslv.h> |
| 3310 |
]], [[ |
| 3311 |
EC_KEY *e = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); |
| 3312 |
const EVP_MD *m = EVP_sha256(); /* We need this too */ |
| 3313 |
]])], |
| 3314 |
[ AC_MSG_RESULT([yes]) |
| 3315 |
enable_nistp256=1 ], |
| 3316 |
[ AC_MSG_RESULT([no]) ] |
| 3317 |
) |
| 3318 |
|
| 3319 |
AC_MSG_CHECKING([whether OpenSSL has NID_secp384r1]) |
| 3320 |
AC_LINK_IFELSE( |
| 3321 |
[AC_LANG_PROGRAM([[ |
| 3322 |
#include <openssl/ec.h> |
| 3323 |
#include <openssl/ecdh.h> |
| 3324 |
#include <openssl/ecdsa.h> |
| 3325 |
#include <openssl/evp.h> |
| 3326 |
#include <openssl/objects.h> |
| 3327 |
#include <openssl/opensslv.h> |
| 3328 |
]], [[ |
| 3329 |
EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp384r1); |
| 3330 |
const EVP_MD *m = EVP_sha384(); /* We need this too */ |
| 3331 |
]])], |
| 3332 |
[ AC_MSG_RESULT([yes]) |
| 3333 |
enable_nistp384=1 ], |
| 3334 |
[ AC_MSG_RESULT([no]) ] |
| 3335 |
) |
| 3336 |
|
| 3337 |
AC_MSG_CHECKING([whether OpenSSL has NID_secp521r1]) |
| 3338 |
AC_LINK_IFELSE( |
| 3339 |
[AC_LANG_PROGRAM([[ |
| 3340 |
#include <openssl/ec.h> |
| 3341 |
#include <openssl/ecdh.h> |
| 3342 |
#include <openssl/ecdsa.h> |
| 3343 |
#include <openssl/evp.h> |
| 3344 |
#include <openssl/objects.h> |
| 3345 |
#include <openssl/opensslv.h> |
| 3346 |
]], [[ |
| 3347 |
EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); |
| 3348 |
const EVP_MD *m = EVP_sha512(); /* We need this too */ |
| 3349 |
]])], |
| 3350 |
[ AC_MSG_RESULT([yes]) |
| 3351 |
AC_MSG_CHECKING([if OpenSSL's NID_secp521r1 is functional]) |
| 3352 |
AC_RUN_IFELSE( |
| 3353 |
[AC_LANG_PROGRAM([[ |
| 3354 |
#include <stdlib.h> |
| 3355 |
#include <openssl/ec.h> |
| 3356 |
#include <openssl/ecdh.h> |
| 3357 |
#include <openssl/ecdsa.h> |
| 3358 |
#include <openssl/evp.h> |
| 3359 |
#include <openssl/objects.h> |
| 3360 |
#include <openssl/opensslv.h> |
| 3361 |
]],[[ |
| 3362 |
EC_KEY *e = EC_KEY_new_by_curve_name(NID_secp521r1); |
| 3363 |
const EVP_MD *m = EVP_sha512(); /* We need this too */ |
| 3364 |
exit(e == NULL || m == NULL); |
| 3365 |
]])], |
| 3366 |
[ AC_MSG_RESULT([yes]) |
| 3367 |
enable_nistp521=1 ], |
| 3368 |
[ AC_MSG_RESULT([no]) ], |
| 3369 |
[ AC_MSG_WARN([cross-compiling: assuming yes]) |
| 3370 |
enable_nistp521=1 ] |
| 3371 |
)], |
| 3372 |
AC_MSG_RESULT([no]) |
| 3373 |
) |
| 3374 |
|
| 3375 |
if test x$enable_nistp256 = x1 || test x$enable_nistp384 = x1 || \ |
| 3376 |
test x$enable_nistp521 = x1; then |
| 3377 |
AC_DEFINE(OPENSSL_HAS_ECC, [1], [OpenSSL has ECC]) |
| 3378 |
AC_CHECK_FUNCS([EC_KEY_METHOD_new]) |
| 3379 |
openssl_ecc=yes |
| 3380 |
else |
| 3381 |
openssl_ecc=no |
| 3382 |
fi |
| 3383 |
if test x$enable_nistp256 = x1; then |
| 3384 |
AC_DEFINE([OPENSSL_HAS_NISTP256], [1], |
| 3385 |
[libcrypto has NID_X9_62_prime256v1]) |
| 3386 |
else |
| 3387 |
unsupported_algorithms="$unsupported_algorithms \ |
| 3388 |
ecdsa-sha2-nistp256 \ |
| 3389 |
ecdh-sha2-nistp256 \ |
| 3390 |
[email protected]" |
| 3391 |
fi |
| 3392 |
if test x$enable_nistp384 = x1; then |
| 3393 |
AC_DEFINE([OPENSSL_HAS_NISTP384], [1], [libcrypto has NID_secp384r1]) |
| 3394 |
else |
| 3395 |
unsupported_algorithms="$unsupported_algorithms \ |
| 3396 |
ecdsa-sha2-nistp384 \ |
| 3397 |
ecdh-sha2-nistp384 \ |
| 3398 |
[email protected]" |
| 3399 |
fi |
| 3400 |
if test x$enable_nistp521 = x1; then |
| 3401 |
AC_DEFINE([OPENSSL_HAS_NISTP521], [1], [libcrypto has NID_secp521r1]) |
| 3402 |
else |
| 3403 |
unsupported_algorithms="$unsupported_algorithms \ |
| 3404 |
ecdh-sha2-nistp521 \ |
| 3405 |
ecdsa-sha2-nistp521 \ |
| 3406 |
[email protected]" |
| 3407 |
fi |
| 3408 |
|
| 3409 |
# Check libcrypto ED25519 support |
| 3410 |
AC_CHECK_FUNCS([EVP_PKEY_get_raw_public_key]) |
| 3411 |
AC_CHECK_FUNCS([EVP_PKEY_get_raw_private_key]) |
| 3412 |
AC_MSG_CHECKING([whether OpenSSL has ED25519 support]) |
| 3413 |
AC_LINK_IFELSE( |
| 3414 |
[AC_LANG_PROGRAM([[ |
| 3415 |
#include <string.h> |
| 3416 |
#include <openssl/evp.h> |
| 3417 |
#include <openssl/opensslconf.h> |
| 3418 |
#ifdef OPENSSL_NO_EC |
| 3419 |
# error "OpenSSL has no EC support." |
| 3420 |
#endif |
| 3421 |
]], [[ |
| 3422 |
unsigned char buf[64]; |
| 3423 |
memset(buf, 0, sizeof(buf)); |
| 3424 |
exit(EVP_PKEY_new_raw_private_key(EVP_PKEY_ED25519, NULL, |
| 3425 |
buf, sizeof(buf)) == NULL); |
| 3426 |
]])], |
| 3427 |
[ |
| 3428 |
AC_MSG_RESULT([yes]) |
| 3429 |
AC_DEFINE([OPENSSL_HAS_ED25519], [1], |
| 3430 |
[libcrypto has ed25519 support]) |
| 3431 |
], |
| 3432 |
[ |
| 3433 |
AC_MSG_RESULT([no]) |
| 3434 |
] |
| 3435 |
) |
| 3436 |
fi |
| 3437 |
|
| 3438 |
# PKCS11/U2F depend on OpenSSL and dlopen(). |
| 3439 |
enable_pkcs11=yes |
| 3440 |
enable_sk=yes |
| 3441 |
|
| 3442 |
AC_CHECK_DECL([OPENSSL_IS_AWSLC], |
| 3443 |
[enable_pkcs11="disabled; PKCS#11 not supported with AWS-LC"], |
| 3444 |
[], |
| 3445 |
[#include <openssl/base.h>] |
| 3446 |
) |
| 3447 |
if test "x$ac_cv_func_dlopen" != "xyes" ; then |
| 3448 |
enable_pkcs11="disabled; missing dlopen(3)" |
| 3449 |
enable_sk="disabled; missing dlopen(3)" |
| 3450 |
fi |
| 3451 |
if test "x$ac_cv_have_decl_RTLD_NOW" != "xyes" ; then |
| 3452 |
enable_pkcs11="disabled; missing RTLD_NOW" |
| 3453 |
enable_sk="disabled; missing RTLD_NOW" |
| 3454 |
fi |
| 3455 |
if test ! -z "$disable_pkcs11" ; then |
| 3456 |
enable_pkcs11="disabled by user" |
| 3457 |
fi |
| 3458 |
if test ! -z "$disable_sk" ; then |
| 3459 |
enable_sk="disabled by user" |
| 3460 |
fi |
| 3461 |
|
| 3462 |
AC_MSG_CHECKING([whether to enable PKCS11]) |
| 3463 |
if test "x$enable_pkcs11" = "xyes" ; then |
| 3464 |
AC_DEFINE([ENABLE_PKCS11], [], [Enable for PKCS#11 support]) |
| 3465 |
fi |
| 3466 |
AC_MSG_RESULT([$enable_pkcs11]) |
| 3467 |
|
| 3468 |
AC_MSG_CHECKING([whether to enable U2F]) |
| 3469 |
if test "x$enable_sk" = "xyes" ; then |
| 3470 |
AC_DEFINE([ENABLE_SK], [], [Enable for U2F/FIDO support]) |
| 3471 |
AC_SUBST(SK_DUMMY_LIBRARY, [regress/misc/sk-dummy/sk-dummy.so]) |
| 3472 |
else |
| 3473 |
# Do not try to build sk-dummy library. |
| 3474 |
AC_SUBST(SK_DUMMY_LIBRARY, [""]) |
| 3475 |
fi |
| 3476 |
AC_MSG_RESULT([$enable_sk]) |
| 3477 |
|
| 3478 |
# Now check for built-in security key support. |
| 3479 |
if test "x$enable_sk" = "xyes" -a "x$enable_sk_internal" != "xno" ; then |
| 3480 |
use_pkgconfig_for_libfido2= |
| 3481 |
if test "x$PKGCONFIG" != "xno"; then |
| 3482 |
AC_MSG_CHECKING([if $PKGCONFIG knows about libfido2]) |
| 3483 |
if "$PKGCONFIG" libfido2; then |
| 3484 |
AC_MSG_RESULT([yes]) |
| 3485 |
use_pkgconfig_for_libfido2=yes |
| 3486 |
else |
| 3487 |
AC_MSG_RESULT([no]) |
| 3488 |
fi |
| 3489 |
fi |
| 3490 |
if test "x$use_pkgconfig_for_libfido2" = "xyes"; then |
| 3491 |
LIBFIDO2=`$PKGCONFIG --libs libfido2` |
| 3492 |
CPPFLAGS="$CPPFLAGS `$PKGCONFIG --cflags libfido2`" |
| 3493 |
else |
| 3494 |
LIBFIDO2="-lfido2 -lcbor" |
| 3495 |
fi |
| 3496 |
OTHERLIBS=`echo $LIBFIDO2 | sed 's/-lfido2//'` |
| 3497 |
fido2_error= |
| 3498 |
AC_CHECK_LIB([fido2], [fido_init], |
| 3499 |
[ ], |
| 3500 |
[ fido2_error="missing/unusable libfido2" ], |
| 3501 |
[ $OTHERLIBS ] |
| 3502 |
) |
| 3503 |
AC_CHECK_HEADER([fido.h], [], |
| 3504 |
[ fido2_error="missing fido.h from libfido2" ]) |
| 3505 |
AC_CHECK_HEADER([fido/credman.h], [], |
| 3506 |
[ fido2_error="missing fido/credman.h from libfido2" ], |
| 3507 |
[ #include <fido.h> ] |
| 3508 |
) |
| 3509 |
AC_MSG_CHECKING([for usable libfido2 installation]) |
| 3510 |
if test ! -z "$fido2_error" ; then |
| 3511 |
AC_MSG_RESULT([$fido2_error]) |
| 3512 |
if test "x$enable_sk_internal" = "xyes" ; then |
| 3513 |
AC_MSG_ERROR([No usable libfido2 library/headers found]) |
| 3514 |
fi |
| 3515 |
LIBFIDO2="" |
| 3516 |
else |
| 3517 |
AC_MSG_RESULT([yes]) |
| 3518 |
AC_SUBST([LIBFIDO2]) |
| 3519 |
AC_DEFINE([ENABLE_SK_INTERNAL], [], |
| 3520 |
[Enable for built-in U2F/FIDO support]) |
| 3521 |
enable_sk="built-in" |
| 3522 |
saved_LIBS="$LIBS" |
| 3523 |
LIBS="$LIBFIDO2 $LIBS" |
| 3524 |
AC_CHECK_FUNCS([ \ |
| 3525 |
fido_assert_set_clientdata \ |
| 3526 |
fido_cred_prot \ |
| 3527 |
fido_cred_set_prot \ |
| 3528 |
fido_cred_set_clientdata \ |
| 3529 |
fido_dev_get_touch_begin \ |
| 3530 |
fido_dev_get_touch_status \ |
| 3531 |
fido_dev_supports_cred_prot \ |
| 3532 |
fido_dev_is_winhello \ |
| 3533 |
]) |
| 3534 |
LIBS="$saved_LIBS" |
| 3535 |
fi |
| 3536 |
fi |
| 3537 |
|
| 3538 |
# Check for standalone SecurityKeyProvider |
| 3539 |
AC_MSG_CHECKING([whether to build standalone sk-libfido2]) |
| 3540 |
if test "x$enable_sk_standalone" = "xyes" ; then |
| 3541 |
AC_MSG_RESULT([yes]) |
| 3542 |
AC_SUBST([SK_STANDALONE], [sk-libfido2$SHLIBEXT]) |
| 3543 |
else |
| 3544 |
AC_MSG_RESULT([no]) |
| 3545 |
AC_SUBST([SK_STANDALONE], [""]) |
| 3546 |
fi |
| 3547 |
|
| 3548 |
AC_CHECK_FUNCS([ \ |
| 3549 |
arc4random \ |
| 3550 |
arc4random_buf \ |
| 3551 |
arc4random_stir \ |
| 3552 |
arc4random_uniform \ |
| 3553 |
]) |
| 3554 |
### Configure cryptographic random number support |
| 3555 |
|
| 3556 |
# Check whether OpenSSL seeds itself |
| 3557 |
if test "x$openssl" = "xyes" ; then |
| 3558 |
AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) |
| 3559 |
AC_RUN_IFELSE( |
| 3560 |
[AC_LANG_PROGRAM([[ |
| 3561 |
#include <stdlib.h> |
| 3562 |
#include <string.h> |
| 3563 |
#include <openssl/rand.h> |
| 3564 |
]], [[ |
| 3565 |
exit(RAND_status() == 1 ? 0 : 1); |
| 3566 |
]])], |
| 3567 |
[ |
| 3568 |
OPENSSL_SEEDS_ITSELF=yes |
| 3569 |
AC_MSG_RESULT([yes]) |
| 3570 |
], |
| 3571 |
[ |
| 3572 |
AC_MSG_RESULT([no]) |
| 3573 |
], |
| 3574 |
[ |
| 3575 |
AC_MSG_WARN([cross compiling: assuming yes]) |
| 3576 |
# This is safe, since we will fatal() at runtime if |
| 3577 |
# OpenSSL is not seeded correctly. |
| 3578 |
OPENSSL_SEEDS_ITSELF=yes |
| 3579 |
] |
| 3580 |
) |
| 3581 |
fi |
| 3582 |
|
| 3583 |
# PRNGD TCP socket |
| 3584 |
AC_ARG_WITH([prngd-port], |
| 3585 |
[ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT], |
| 3586 |
[ |
| 3587 |
case "$withval" in |
| 3588 |
no) |
| 3589 |
withval="" |
| 3590 |
;; |
| 3591 |
[[0-9]]*) |
| 3592 |
;; |
| 3593 |
*) |
| 3594 |
AC_MSG_ERROR([You must specify a numeric port number for --with-prngd-port]) |
| 3595 |
;; |
| 3596 |
esac |
| 3597 |
if test ! -z "$withval" ; then |
| 3598 |
PRNGD_PORT="$withval" |
| 3599 |
AC_DEFINE_UNQUOTED([PRNGD_PORT], [$PRNGD_PORT], |
| 3600 |
[Port number of PRNGD/EGD random number socket]) |
| 3601 |
fi |
| 3602 |
] |
| 3603 |
) |
| 3604 |
|
| 3605 |
# PRNGD Unix domain socket |
| 3606 |
AC_ARG_WITH([prngd-socket], |
| 3607 |
[ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)], |
| 3608 |
[ |
| 3609 |
case "$withval" in |
| 3610 |
yes) |
| 3611 |
withval="/var/run/egd-pool" |
| 3612 |
;; |
| 3613 |
no) |
| 3614 |
withval="" |
| 3615 |
;; |
| 3616 |
/*) |
| 3617 |
;; |
| 3618 |
*) |
| 3619 |
AC_MSG_ERROR([You must specify an absolute path to the entropy socket]) |
| 3620 |
;; |
| 3621 |
esac |
| 3622 |
|
| 3623 |
if test ! -z "$withval" ; then |
| 3624 |
if test ! -z "$PRNGD_PORT" ; then |
| 3625 |
AC_MSG_ERROR([You may not specify both a PRNGD/EGD port and socket]) |
| 3626 |
fi |
| 3627 |
if test ! -r "$withval" ; then |
| 3628 |
AC_MSG_WARN([Entropy socket is not readable]) |
| 3629 |
fi |
| 3630 |
PRNGD_SOCKET="$withval" |
| 3631 |
AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"], |
| 3632 |
[Location of PRNGD/EGD random number socket]) |
| 3633 |
fi |
| 3634 |
], |
| 3635 |
[ |
| 3636 |
# Check for existing socket only if we don't have a random device already |
| 3637 |
if test "x$OPENSSL_SEEDS_ITSELF" != "xyes" ; then |
| 3638 |
AC_MSG_CHECKING([for PRNGD/EGD socket]) |
| 3639 |
# Insert other locations here |
| 3640 |
for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do |
| 3641 |
if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then |
| 3642 |
PRNGD_SOCKET="$sock" |
| 3643 |
AC_DEFINE_UNQUOTED([PRNGD_SOCKET], ["$PRNGD_SOCKET"]) |
| 3644 |
break; |
| 3645 |
fi |
| 3646 |
done |
| 3647 |
if test ! -z "$PRNGD_SOCKET" ; then |
| 3648 |
AC_MSG_RESULT([$PRNGD_SOCKET]) |
| 3649 |
else |
| 3650 |
AC_MSG_RESULT([not found]) |
| 3651 |
fi |
| 3652 |
fi |
| 3653 |
] |
| 3654 |
) |
| 3655 |
|
| 3656 |
# Which randomness source do we use? |
| 3657 |
if test ! -z "$PRNGD_PORT" ; then |
| 3658 |
RAND_MSG="PRNGd port $PRNGD_PORT" |
| 3659 |
elif test ! -z "$PRNGD_SOCKET" ; then |
| 3660 |
RAND_MSG="PRNGd socket $PRNGD_SOCKET" |
| 3661 |
elif test ! -z "$OPENSSL_SEEDS_ITSELF" ; then |
| 3662 |
AC_DEFINE([OPENSSL_PRNG_ONLY], [1], |
| 3663 |
[Define if you want the OpenSSL internally seeded PRNG only]) |
| 3664 |
RAND_MSG="OpenSSL internal ONLY" |
| 3665 |
elif test "x$openssl" = "xno" ; then |
| 3666 |
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]) |
| 3667 |
else |
| 3668 |
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]) |
| 3669 |
fi |
| 3670 |
LIBS="$nocrypto_saved_LIBS" |
| 3671 |
|
| 3672 |
saved_LIBS="$LIBS" |
| 3673 |
AC_CHECK_LIB([iaf], [ia_openinfo], [ |
| 3674 |
LIBS="$LIBS -liaf" |
| 3675 |
AC_CHECK_FUNCS([set_id], [SSHDLIBS="$SSHDLIBS -liaf" |
| 3676 |
AC_DEFINE([HAVE_LIBIAF], [1], |
| 3677 |
[Define if system has libiaf that supports set_id]) |
| 3678 |
]) |
| 3679 |
]) |
| 3680 |
LIBS="$saved_LIBS" |
| 3681 |
|
| 3682 |
# Check for crypt() in libcrypt. If we have it, we only need it for sshd. |
| 3683 |
saved_LIBS="$LIBS" |
| 3684 |
AC_CHECK_LIB([crypt], [crypt], [ |
| 3685 |
LIBS="-lcrypt $LIBS" |
| 3686 |
SSHDLIBS="-lcrypt $SSHDLIBS" |
| 3687 |
]) |
| 3688 |
AC_CHECK_FUNCS([crypt]) |
| 3689 |
LIBS="$saved_LIBS" |
| 3690 |
|
| 3691 |
# Check for PAM libs |
| 3692 |
PAM_MSG="no" |
| 3693 |
AC_ARG_WITH([pam], |
| 3694 |
[ --with-pam Enable PAM support ], |
| 3695 |
[ |
| 3696 |
if test "x$withval" != "xno" ; then |
| 3697 |
if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \ |
| 3698 |
test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then |
| 3699 |
AC_MSG_ERROR([PAM headers not found]) |
| 3700 |
fi |
| 3701 |
|
| 3702 |
saved_LIBS="$LIBS" |
| 3703 |
AC_CHECK_LIB([dl], [dlopen], , ) |
| 3704 |
AC_CHECK_LIB([pam], [pam_set_item], , [AC_MSG_ERROR([*** libpam missing])]) |
| 3705 |
AC_CHECK_FUNCS([pam_getenvlist]) |
| 3706 |
AC_CHECK_FUNCS([pam_putenv]) |
| 3707 |
LIBS="$saved_LIBS" |
| 3708 |
|
| 3709 |
PAM_MSG="yes" |
| 3710 |
|
| 3711 |
SSHDLIBS="$SSHDLIBS -lpam" |
| 3712 |
AC_DEFINE([USE_PAM], [1], |
| 3713 |
[Define if you want to enable PAM support]) |
| 3714 |
|
| 3715 |
if test $ac_cv_lib_dl_dlopen = yes; then |
| 3716 |
case "$LIBS" in |
| 3717 |
*-ldl*) |
| 3718 |
# libdl already in LIBS |
| 3719 |
;; |
| 3720 |
*) |
| 3721 |
SSHDLIBS="$SSHDLIBS -ldl" |
| 3722 |
;; |
| 3723 |
esac |
| 3724 |
fi |
| 3725 |
fi |
| 3726 |
] |
| 3727 |
) |
| 3728 |
|
| 3729 |
AC_ARG_WITH([pam-service], |
| 3730 |
[ --with-pam-service=name Specify PAM service name ], |
| 3731 |
[ |
| 3732 |
if test "x$withval" != "xno" && \ |
| 3733 |
test "x$withval" != "xyes" ; then |
| 3734 |
AC_DEFINE_UNQUOTED([SSHD_PAM_SERVICE], |
| 3735 |
["$withval"], [sshd PAM service name]) |
| 3736 |
fi |
| 3737 |
] |
| 3738 |
) |
| 3739 |
|
| 3740 |
# Check for older PAM |
| 3741 |
if test "x$PAM_MSG" = "xyes" ; then |
| 3742 |
# Check PAM strerror arguments (old PAM) |
| 3743 |
AC_MSG_CHECKING([whether pam_strerror takes only one argument]) |
| 3744 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3745 |
#include <stdlib.h> |
| 3746 |
#if defined(HAVE_SECURITY_PAM_APPL_H) |
| 3747 |
#include <security/pam_appl.h> |
| 3748 |
#elif defined (HAVE_PAM_PAM_APPL_H) |
| 3749 |
#include <pam/pam_appl.h> |
| 3750 |
#endif |
| 3751 |
]], [[ |
| 3752 |
(void)pam_strerror((pam_handle_t *)NULL, -1); |
| 3753 |
]])], [AC_MSG_RESULT([no])], [ |
| 3754 |
AC_DEFINE([HAVE_OLD_PAM], [1], |
| 3755 |
[Define if you have an old version of PAM |
| 3756 |
which takes only one argument to pam_strerror]) |
| 3757 |
AC_MSG_RESULT([yes]) |
| 3758 |
PAM_MSG="yes (old library)" |
| 3759 |
|
| 3760 |
]) |
| 3761 |
fi |
| 3762 |
|
| 3763 |
case "$host" in |
| 3764 |
*-*-cygwin*) |
| 3765 |
SSH_PRIVSEP_USER=CYGWIN_SSH_PRIVSEP_USER |
| 3766 |
;; |
| 3767 |
*) |
| 3768 |
SSH_PRIVSEP_USER=sshd |
| 3769 |
;; |
| 3770 |
esac |
| 3771 |
AC_ARG_WITH([privsep-user], |
| 3772 |
[ --with-privsep-user=user Specify non-privileged user for privilege separation], |
| 3773 |
[ |
| 3774 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 3775 |
test "x${withval}" != "xyes"; then |
| 3776 |
SSH_PRIVSEP_USER=$withval |
| 3777 |
fi |
| 3778 |
] |
| 3779 |
) |
| 3780 |
if test "x$SSH_PRIVSEP_USER" = "xCYGWIN_SSH_PRIVSEP_USER" ; then |
| 3781 |
AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], [CYGWIN_SSH_PRIVSEP_USER], |
| 3782 |
[Cygwin function to fetch non-privileged user for privilege separation]) |
| 3783 |
else |
| 3784 |
AC_DEFINE_UNQUOTED([SSH_PRIVSEP_USER], ["$SSH_PRIVSEP_USER"], |
| 3785 |
[non-privileged user for privilege separation]) |
| 3786 |
fi |
| 3787 |
AC_SUBST([SSH_PRIVSEP_USER]) |
| 3788 |
|
| 3789 |
if test "x$have_linux_no_new_privs" = "x1" ; then |
| 3790 |
AC_CHECK_DECL([SECCOMP_MODE_FILTER], [have_seccomp_filter=1], , [ |
| 3791 |
#include <sys/types.h> |
| 3792 |
#include <linux/seccomp.h> |
| 3793 |
]) |
| 3794 |
fi |
| 3795 |
if test "x$have_seccomp_filter" = "x1" ; then |
| 3796 |
AC_MSG_CHECKING([kernel for seccomp_filter support]) |
| 3797 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 3798 |
#include <errno.h> |
| 3799 |
#include <elf.h> |
| 3800 |
#include <linux/audit.h> |
| 3801 |
#include <linux/seccomp.h> |
| 3802 |
#include <stdlib.h> |
| 3803 |
#include <sys/prctl.h> |
| 3804 |
]], |
| 3805 |
[[ int i = $seccomp_audit_arch; |
| 3806 |
errno = 0; |
| 3807 |
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, NULL, 0, 0); |
| 3808 |
exit(errno == EFAULT ? 0 : 1); ]])], |
| 3809 |
[ AC_MSG_RESULT([yes]) ], [ |
| 3810 |
AC_MSG_RESULT([no]) |
| 3811 |
# Disable seccomp filter as a target |
| 3812 |
have_seccomp_filter=0 |
| 3813 |
] |
| 3814 |
) |
| 3815 |
fi |
| 3816 |
|
| 3817 |
AC_CHECK_MEMBERS([struct pollfd.fd], [], [], [[ |
| 3818 |
#include <sys/types.h> |
| 3819 |
#ifdef HAVE_POLL_H |
| 3820 |
#include <poll.h> |
| 3821 |
#endif |
| 3822 |
#ifdef HAVE_SYS_POLL_H |
| 3823 |
#include <sys/poll.h> |
| 3824 |
#endif |
| 3825 |
]]) |
| 3826 |
|
| 3827 |
AC_CHECK_TYPES([nfds_t], , , [ |
| 3828 |
#include <sys/types.h> |
| 3829 |
#ifdef HAVE_POLL_H |
| 3830 |
#include <poll.h> |
| 3831 |
#endif |
| 3832 |
#ifdef HAVE_SYS_POLL_H |
| 3833 |
#include <sys/poll.h> |
| 3834 |
#endif |
| 3835 |
]) |
| 3836 |
|
| 3837 |
if test "x$ac_cv_type_nfds_t" != "xyes"; then |
| 3838 |
AC_MSG_CHECKING([if poll nfds_t is unsigned long]) |
| 3839 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 3840 |
#include <sys/types.h> |
| 3841 |
#ifdef HAVE_POLL_H |
| 3842 |
#include <poll.h> |
| 3843 |
#endif |
| 3844 |
#ifdef HAVE_SYS_POLL_H |
| 3845 |
#include <sys/poll.h> |
| 3846 |
#endif |
| 3847 |
int poll(struct pollfd *, unsigned long, int timeout); |
| 3848 |
]], [[return poll(0, 0, 0);]])], |
| 3849 |
[AC_MSG_RESULT([yes]) |
| 3850 |
AC_DEFINE(POLL_NFDS_T_ULONG, 1, [Define if poll 2nd arg is ulong])], |
| 3851 |
[AC_MSG_RESULT([no])] |
| 3852 |
) |
| 3853 |
fi |
| 3854 |
|
| 3855 |
# Decide which sandbox style to use |
| 3856 |
sandbox_arg="" |
| 3857 |
AC_ARG_WITH([sandbox], |
| 3858 |
[ --with-sandbox=style Specify privilege separation sandbox (no, capsicum, darwin, rlimit, seccomp_filter)], |
| 3859 |
[ |
| 3860 |
if test "x$withval" = "xyes" ; then |
| 3861 |
sandbox_arg="" |
| 3862 |
else |
| 3863 |
sandbox_arg="$withval" |
| 3864 |
fi |
| 3865 |
] |
| 3866 |
) |
| 3867 |
|
| 3868 |
if test "x$sandbox_arg" != "xno"; then |
| 3869 |
# POSIX specifies that poll() "shall fail with EINVAL if the nfds argument |
| 3870 |
# is greater than OPEN_MAX". On some platforms that includes implementions |
| 3871 |
# of select in userspace on top of poll() so check both work with rlimit |
| 3872 |
# NOFILES so check that both work before enabling the rlimit sandbox. |
| 3873 |
AC_MSG_CHECKING([if select and/or poll works with descriptor rlimit]) |
| 3874 |
AC_RUN_IFELSE( |
| 3875 |
[AC_LANG_PROGRAM([[ |
| 3876 |
#include <sys/types.h> |
| 3877 |
#ifdef HAVE_SYS_TIME_H |
| 3878 |
# include <sys/time.h> |
| 3879 |
#endif |
| 3880 |
#include <sys/resource.h> |
| 3881 |
#ifdef HAVE_SYS_SELECT_H |
| 3882 |
# include <sys/select.h> |
| 3883 |
#endif |
| 3884 |
#ifdef HAVE_POLL_H |
| 3885 |
# include <poll.h> |
| 3886 |
#elif HAVE_SYS_POLL_H |
| 3887 |
# include <sys/poll.h> |
| 3888 |
#endif |
| 3889 |
#include <errno.h> |
| 3890 |
#include <fcntl.h> |
| 3891 |
#include <stdlib.h> |
| 3892 |
]],[[ |
| 3893 |
struct rlimit rl_zero; |
| 3894 |
int fd, r; |
| 3895 |
fd_set fds; |
| 3896 |
struct timeval tv; |
| 3897 |
#ifdef HAVE_POLL |
| 3898 |
struct pollfd pfd; |
| 3899 |
#endif |
| 3900 |
|
| 3901 |
fd = open("/dev/null", O_RDONLY); |
| 3902 |
FD_ZERO(&fds); |
| 3903 |
FD_SET(fd, &fds); |
| 3904 |
rl_zero.rlim_cur = rl_zero.rlim_max = 0; |
| 3905 |
setrlimit(RLIMIT_FSIZE, &rl_zero); |
| 3906 |
setrlimit(RLIMIT_NOFILE, &rl_zero); |
| 3907 |
tv.tv_sec = 1; |
| 3908 |
tv.tv_usec = 0; |
| 3909 |
r = select(fd+1, &fds, NULL, NULL, &tv); |
| 3910 |
if (r == -1) |
| 3911 |
exit(1); |
| 3912 |
#ifdef HAVE_POLL |
| 3913 |
pfd.fd = fd; |
| 3914 |
pfd.events = POLLIN; |
| 3915 |
r = poll(&pfd, 1, 1); |
| 3916 |
if (r == -1) |
| 3917 |
exit(2); |
| 3918 |
#endif |
| 3919 |
exit(0); |
| 3920 |
]])], |
| 3921 |
[AC_MSG_RESULT([yes]) |
| 3922 |
select_works_with_rlimit=yes], |
| 3923 |
[AC_MSG_RESULT([no]) |
| 3924 |
select_works_with_rlimit=no], |
| 3925 |
[AC_MSG_WARN([cross compiling: assuming no]) |
| 3926 |
select_works_with_rlimit=no] |
| 3927 |
) |
| 3928 |
|
| 3929 |
AC_MSG_CHECKING([if setrlimit(RLIMIT_NOFILE,{0,0}) works]) |
| 3930 |
AC_RUN_IFELSE( |
| 3931 |
[AC_LANG_PROGRAM([[ |
| 3932 |
#include <sys/types.h> |
| 3933 |
#ifdef HAVE_SYS_TIME_H |
| 3934 |
# include <sys/time.h> |
| 3935 |
#endif |
| 3936 |
#include <sys/resource.h> |
| 3937 |
#include <errno.h> |
| 3938 |
#include <stdlib.h> |
| 3939 |
]],[[ |
| 3940 |
struct rlimit rl_zero; |
| 3941 |
int r; |
| 3942 |
|
| 3943 |
rl_zero.rlim_cur = rl_zero.rlim_max = 0; |
| 3944 |
r = setrlimit(RLIMIT_NOFILE, &rl_zero); |
| 3945 |
exit (r == -1 ? 1 : 0); |
| 3946 |
]])], |
| 3947 |
[AC_MSG_RESULT([yes]) |
| 3948 |
rlimit_nofile_zero_works=yes], |
| 3949 |
[AC_MSG_RESULT([no]) |
| 3950 |
rlimit_nofile_zero_works=no], |
| 3951 |
[AC_MSG_WARN([cross compiling: assuming yes]) |
| 3952 |
rlimit_nofile_zero_works=yes] |
| 3953 |
) |
| 3954 |
|
| 3955 |
AC_MSG_CHECKING([if setrlimit RLIMIT_FSIZE works]) |
| 3956 |
AC_RUN_IFELSE( |
| 3957 |
[AC_LANG_PROGRAM([[ |
| 3958 |
#include <sys/types.h> |
| 3959 |
#include <sys/resource.h> |
| 3960 |
#include <stdlib.h> |
| 3961 |
]],[[ |
| 3962 |
struct rlimit rl_zero; |
| 3963 |
|
| 3964 |
rl_zero.rlim_cur = rl_zero.rlim_max = 0; |
| 3965 |
exit(setrlimit(RLIMIT_FSIZE, &rl_zero) != 0); |
| 3966 |
]])], |
| 3967 |
[AC_MSG_RESULT([yes])], |
| 3968 |
[AC_MSG_RESULT([no]) |
| 3969 |
AC_DEFINE(SANDBOX_SKIP_RLIMIT_FSIZE, 1, |
| 3970 |
[setrlimit RLIMIT_FSIZE works])], |
| 3971 |
[AC_MSG_WARN([cross compiling: assuming yes])] |
| 3972 |
) |
| 3973 |
fi |
| 3974 |
|
| 3975 |
if test "x$sandbox_arg" = "xdarwin" || \ |
| 3976 |
( test -z "$sandbox_arg" && test "x$ac_cv_func_sandbox_init" = "xyes" && \ |
| 3977 |
test "x$ac_cv_header_sandbox_h" = "xyes") ; then |
| 3978 |
test "x$ac_cv_func_sandbox_init" != "xyes" -o \ |
| 3979 |
"x$ac_cv_header_sandbox_h" != "xyes" && \ |
| 3980 |
AC_MSG_ERROR([Darwin seatbelt sandbox requires sandbox.h and sandbox_init function]) |
| 3981 |
SANDBOX_STYLE="darwin" |
| 3982 |
AC_DEFINE([SANDBOX_DARWIN], [1], [Sandbox using Darwin sandbox_init(3)]) |
| 3983 |
elif test "x$sandbox_arg" = "xseccomp_filter" || \ |
| 3984 |
( test -z "$sandbox_arg" && \ |
| 3985 |
test "x$have_seccomp_filter" = "x1" && \ |
| 3986 |
test "x$ac_cv_header_elf_h" = "xyes" && \ |
| 3987 |
test "x$ac_cv_header_linux_audit_h" = "xyes" && \ |
| 3988 |
test "x$ac_cv_header_linux_filter_h" = "xyes" && \ |
| 3989 |
test "x$seccomp_audit_arch" != "x" && \ |
| 3990 |
test "x$have_linux_no_new_privs" = "x1" && \ |
| 3991 |
test "x$ac_cv_func_prctl" = "xyes" ) ; then |
| 3992 |
test "x$seccomp_audit_arch" = "x" && \ |
| 3993 |
AC_MSG_ERROR([seccomp_filter sandbox not supported on $host]) |
| 3994 |
test "x$have_linux_no_new_privs" != "x1" && \ |
| 3995 |
AC_MSG_ERROR([seccomp_filter sandbox requires PR_SET_NO_NEW_PRIVS]) |
| 3996 |
test "x$have_seccomp_filter" != "x1" && \ |
| 3997 |
AC_MSG_ERROR([seccomp_filter sandbox requires seccomp headers]) |
| 3998 |
test "x$ac_cv_func_prctl" != "xyes" && \ |
| 3999 |
AC_MSG_ERROR([seccomp_filter sandbox requires prctl function]) |
| 4000 |
SANDBOX_STYLE="seccomp_filter" |
| 4001 |
AC_DEFINE([SANDBOX_SECCOMP_FILTER], [1], [Sandbox using seccomp filter]) |
| 4002 |
elif test "x$sandbox_arg" = "xcapsicum" || \ |
| 4003 |
( test -z "$sandbox_arg" && \ |
| 4004 |
test "x$disable_capsicum" != "xyes" && \ |
| 4005 |
test "x$ac_cv_header_sys_capsicum_h" = "xyes" && \ |
| 4006 |
test "x$ac_cv_func_cap_rights_limit" = "xyes") ; then |
| 4007 |
test "x$ac_cv_header_sys_capsicum_h" != "xyes" && \ |
| 4008 |
AC_MSG_ERROR([capsicum sandbox requires sys/capsicum.h header]) |
| 4009 |
test "x$ac_cv_func_cap_rights_limit" != "xyes" && \ |
| 4010 |
AC_MSG_ERROR([capsicum sandbox requires cap_rights_limit function]) |
| 4011 |
SANDBOX_STYLE="capsicum" |
| 4012 |
AC_DEFINE([SANDBOX_CAPSICUM], [1], [Sandbox using capsicum]) |
| 4013 |
elif test "x$sandbox_arg" = "xrlimit" || \ |
| 4014 |
( test -z "$sandbox_arg" && test "x$ac_cv_func_setrlimit" = "xyes" && \ |
| 4015 |
test "x$select_works_with_rlimit" = "xyes" && \ |
| 4016 |
test "x$rlimit_nofile_zero_works" = "xyes" ) ; then |
| 4017 |
test "x$ac_cv_func_setrlimit" != "xyes" && \ |
| 4018 |
AC_MSG_ERROR([rlimit sandbox requires setrlimit function]) |
| 4019 |
test "x$select_works_with_rlimit" != "xyes" && \ |
| 4020 |
AC_MSG_ERROR([rlimit sandbox requires select to work with rlimit]) |
| 4021 |
SANDBOX_STYLE="rlimit" |
| 4022 |
AC_DEFINE([SANDBOX_RLIMIT], [1], [Sandbox using setrlimit(2)]) |
| 4023 |
elif test "x$sandbox_arg" = "xsolaris" || \ |
| 4024 |
( test -z "$sandbox_arg" && test "x$SOLARIS_PRIVS" = "xyes" ) ; then |
| 4025 |
SANDBOX_STYLE="solaris" |
| 4026 |
AC_DEFINE([SANDBOX_SOLARIS], [1], [Sandbox using Solaris/Illumos privileges]) |
| 4027 |
elif test -z "$sandbox_arg" || test "x$sandbox_arg" = "xno" || \ |
| 4028 |
test "x$sandbox_arg" = "xnone" || test "x$sandbox_arg" = "xnull" ; then |
| 4029 |
SANDBOX_STYLE="none" |
| 4030 |
AC_DEFINE([SANDBOX_NULL], [1], [no privsep sandboxing]) |
| 4031 |
else |
| 4032 |
AC_MSG_ERROR([unsupported --with-sandbox]) |
| 4033 |
fi |
| 4034 |
|
| 4035 |
# Cheap hack to ensure NEWS-OS libraries are arranged right. |
| 4036 |
if test ! -z "$SONY" ; then |
| 4037 |
LIBS="$LIBS -liberty"; |
| 4038 |
fi |
| 4039 |
|
| 4040 |
# Check for long long datatypes |
| 4041 |
AC_CHECK_TYPES([long long, unsigned long long, long double]) |
| 4042 |
|
| 4043 |
# Check datatype sizes |
| 4044 |
AC_CHECK_SIZEOF([short int]) |
| 4045 |
AC_CHECK_SIZEOF([int]) |
| 4046 |
AC_CHECK_SIZEOF([long int]) |
| 4047 |
AC_CHECK_SIZEOF([long long int]) |
| 4048 |
AC_CHECK_SIZEOF([time_t], [], [[ |
| 4049 |
#include <sys/types.h> |
| 4050 |
#ifdef HAVE_SYS_TIME_H |
| 4051 |
# include <sys/time.h> |
| 4052 |
#endif |
| 4053 |
#ifdef HAVE_TIME_H |
| 4054 |
# include <time.h> |
| 4055 |
#endif |
| 4056 |
]] |
| 4057 |
) |
| 4058 |
|
| 4059 |
# Sanity check long long for some platforms (AIX) |
| 4060 |
if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then |
| 4061 |
ac_cv_sizeof_long_long_int=0 |
| 4062 |
fi |
| 4063 |
|
| 4064 |
# compute LLONG_MIN and LLONG_MAX if we don't know them. |
| 4065 |
if test -z "$have_llong_max" && test -z "$have_long_long_max"; then |
| 4066 |
AC_MSG_CHECKING([for max value of long long]) |
| 4067 |
AC_RUN_IFELSE( |
| 4068 |
[AC_LANG_PROGRAM([[ |
| 4069 |
#include <stdio.h> |
| 4070 |
#include <stdlib.h> |
| 4071 |
/* Why is this so damn hard? */ |
| 4072 |
#ifdef __GNUC__ |
| 4073 |
# undef __GNUC__ |
| 4074 |
#endif |
| 4075 |
#define __USE_ISOC99 |
| 4076 |
#include <limits.h> |
| 4077 |
#define DATA "conftest.llminmax" |
| 4078 |
#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a)) |
| 4079 |
|
| 4080 |
/* |
| 4081 |
* printf in libc on some platforms (eg old Tru64) does not understand %lld so |
| 4082 |
* we do this the hard way. |
| 4083 |
*/ |
| 4084 |
static int |
| 4085 |
fprint_ll(FILE *f, long long n) |
| 4086 |
{ |
| 4087 |
unsigned int i; |
| 4088 |
int l[sizeof(long long) * 8]; |
| 4089 |
|
| 4090 |
if (n < 0) |
| 4091 |
if (fprintf(f, "-") < 0) |
| 4092 |
return -1; |
| 4093 |
for (i = 0; n != 0; i++) { |
| 4094 |
l[i] = my_abs(n % 10); |
| 4095 |
n /= 10; |
| 4096 |
} |
| 4097 |
do { |
| 4098 |
if (fprintf(f, "%d", l[--i]) < 0) |
| 4099 |
return -1; |
| 4100 |
} while (i != 0); |
| 4101 |
if (fprintf(f, " ") < 0) |
| 4102 |
return -1; |
| 4103 |
return 0; |
| 4104 |
} |
| 4105 |
]], [[ |
| 4106 |
FILE *f; |
| 4107 |
long long i, llmin, llmax = 0; |
| 4108 |
|
| 4109 |
if((f = fopen(DATA,"w")) == NULL) |
| 4110 |
exit(1); |
| 4111 |
|
| 4112 |
#if defined(LLONG_MIN) && defined(LLONG_MAX) |
| 4113 |
fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n"); |
| 4114 |
llmin = LLONG_MIN; |
| 4115 |
llmax = LLONG_MAX; |
| 4116 |
#else |
| 4117 |
fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n"); |
| 4118 |
/* This will work on one's complement and two's complement */ |
| 4119 |
for (i = 1; i > llmax; i <<= 1, i++) |
| 4120 |
llmax = i; |
| 4121 |
llmin = llmax + 1LL; /* wrap */ |
| 4122 |
#endif |
| 4123 |
|
| 4124 |
/* Sanity check */ |
| 4125 |
if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax |
| 4126 |
|| llmax - 1 > llmax || llmin == llmax || llmin == 0 |
| 4127 |
|| llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) { |
| 4128 |
fprintf(f, "unknown unknown\n"); |
| 4129 |
exit(2); |
| 4130 |
} |
| 4131 |
|
| 4132 |
if (fprint_ll(f, llmin) < 0) |
| 4133 |
exit(3); |
| 4134 |
if (fprint_ll(f, llmax) < 0) |
| 4135 |
exit(4); |
| 4136 |
if (fclose(f) < 0) |
| 4137 |
exit(5); |
| 4138 |
exit(0); |
| 4139 |
]])], |
| 4140 |
[ |
| 4141 |
llong_min=`$AWK '{print $1}' conftest.llminmax` |
| 4142 |
llong_max=`$AWK '{print $2}' conftest.llminmax` |
| 4143 |
|
| 4144 |
AC_MSG_RESULT([$llong_max]) |
| 4145 |
AC_DEFINE_UNQUOTED([LLONG_MAX], [${llong_max}LL], |
| 4146 |
[max value of long long calculated by configure]) |
| 4147 |
AC_MSG_CHECKING([for min value of long long]) |
| 4148 |
AC_MSG_RESULT([$llong_min]) |
| 4149 |
AC_DEFINE_UNQUOTED([LLONG_MIN], [${llong_min}LL], |
| 4150 |
[min value of long long calculated by configure]) |
| 4151 |
], |
| 4152 |
[ |
| 4153 |
AC_MSG_RESULT([not found]) |
| 4154 |
], |
| 4155 |
[ |
| 4156 |
AC_MSG_WARN([cross compiling: not checking]) |
| 4157 |
] |
| 4158 |
) |
| 4159 |
fi |
| 4160 |
|
| 4161 |
AC_CHECK_DECLS([UINT32_MAX], , , [[ |
| 4162 |
#ifdef HAVE_SYS_LIMITS_H |
| 4163 |
# include <sys/limits.h> |
| 4164 |
#endif |
| 4165 |
#ifdef HAVE_LIMITS_H |
| 4166 |
# include <limits.h> |
| 4167 |
#endif |
| 4168 |
#ifdef HAVE_STDINT_H |
| 4169 |
# include <stdint.h> |
| 4170 |
#endif |
| 4171 |
]]) |
| 4172 |
|
| 4173 |
# More checks for data types |
| 4174 |
AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ |
| 4175 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4176 |
[[ u_int a; a = 1;]])], |
| 4177 |
[ ac_cv_have_u_int="yes" ], [ ac_cv_have_u_int="no" |
| 4178 |
]) |
| 4179 |
]) |
| 4180 |
if test "x$ac_cv_have_u_int" = "xyes" ; then |
| 4181 |
AC_DEFINE([HAVE_U_INT], [1], [define if you have u_int data type]) |
| 4182 |
have_u_int=1 |
| 4183 |
fi |
| 4184 |
|
| 4185 |
AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [ |
| 4186 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4187 |
[[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])], |
| 4188 |
[ ac_cv_have_intxx_t="yes" ], [ ac_cv_have_intxx_t="no" |
| 4189 |
]) |
| 4190 |
]) |
| 4191 |
if test "x$ac_cv_have_intxx_t" = "xyes" ; then |
| 4192 |
AC_DEFINE([HAVE_INTXX_T], [1], [define if you have intxx_t data type]) |
| 4193 |
have_intxx_t=1 |
| 4194 |
fi |
| 4195 |
|
| 4196 |
if (test -z "$have_intxx_t" && \ |
| 4197 |
test "x$ac_cv_header_stdint_h" = "xyes") |
| 4198 |
then |
| 4199 |
AC_MSG_CHECKING([for intXX_t types in stdint.h]) |
| 4200 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]], |
| 4201 |
[[ int8_t a; int16_t b; int32_t c; a = b = c = 1;]])], |
| 4202 |
[ |
| 4203 |
AC_DEFINE([HAVE_INTXX_T]) |
| 4204 |
AC_MSG_RESULT([yes]) |
| 4205 |
], [ AC_MSG_RESULT([no]) |
| 4206 |
]) |
| 4207 |
fi |
| 4208 |
|
| 4209 |
AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [ |
| 4210 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4211 |
#include <sys/types.h> |
| 4212 |
#ifdef HAVE_STDINT_H |
| 4213 |
# include <stdint.h> |
| 4214 |
#endif |
| 4215 |
#include <sys/socket.h> |
| 4216 |
#ifdef HAVE_SYS_BITYPES_H |
| 4217 |
# include <sys/bitypes.h> |
| 4218 |
#endif |
| 4219 |
]], [[ |
| 4220 |
int64_t a; a = 1; |
| 4221 |
]])], |
| 4222 |
[ ac_cv_have_int64_t="yes" ], [ ac_cv_have_int64_t="no" |
| 4223 |
]) |
| 4224 |
]) |
| 4225 |
if test "x$ac_cv_have_int64_t" = "xyes" ; then |
| 4226 |
AC_DEFINE([HAVE_INT64_T], [1], [define if you have int64_t data type]) |
| 4227 |
fi |
| 4228 |
|
| 4229 |
AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [ |
| 4230 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4231 |
[[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])], |
| 4232 |
[ ac_cv_have_u_intxx_t="yes" ], [ ac_cv_have_u_intxx_t="no" |
| 4233 |
]) |
| 4234 |
]) |
| 4235 |
if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then |
| 4236 |
AC_DEFINE([HAVE_U_INTXX_T], [1], [define if you have u_intxx_t data type]) |
| 4237 |
have_u_intxx_t=1 |
| 4238 |
fi |
| 4239 |
|
| 4240 |
if test -z "$have_u_intxx_t" ; then |
| 4241 |
AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h]) |
| 4242 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/socket.h> ]], |
| 4243 |
[[ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;]])], |
| 4244 |
[ |
| 4245 |
AC_DEFINE([HAVE_U_INTXX_T]) |
| 4246 |
AC_MSG_RESULT([yes]) |
| 4247 |
], [ AC_MSG_RESULT([no]) |
| 4248 |
]) |
| 4249 |
fi |
| 4250 |
|
| 4251 |
AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [ |
| 4252 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4253 |
[[ u_int64_t a; a = 1;]])], |
| 4254 |
[ ac_cv_have_u_int64_t="yes" ], [ ac_cv_have_u_int64_t="no" |
| 4255 |
]) |
| 4256 |
]) |
| 4257 |
if test "x$ac_cv_have_u_int64_t" = "xyes" ; then |
| 4258 |
AC_DEFINE([HAVE_U_INT64_T], [1], [define if you have u_int64_t data type]) |
| 4259 |
have_u_int64_t=1 |
| 4260 |
fi |
| 4261 |
|
| 4262 |
if (test -z "$have_u_int64_t" && \ |
| 4263 |
test "x$ac_cv_header_sys_bitypes_h" = "xyes") |
| 4264 |
then |
| 4265 |
AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h]) |
| 4266 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/bitypes.h> ]], |
| 4267 |
[[ u_int64_t a; a = 1]])], |
| 4268 |
[ |
| 4269 |
AC_DEFINE([HAVE_U_INT64_T]) |
| 4270 |
AC_MSG_RESULT([yes]) |
| 4271 |
], [ AC_MSG_RESULT([no]) |
| 4272 |
]) |
| 4273 |
fi |
| 4274 |
|
| 4275 |
if test -z "$have_u_intxx_t" ; then |
| 4276 |
AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [ |
| 4277 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4278 |
#include <sys/types.h> |
| 4279 |
]], [[ |
| 4280 |
uint8_t a; |
| 4281 |
uint16_t b; |
| 4282 |
uint32_t c; |
| 4283 |
a = b = c = 1; |
| 4284 |
]])], |
| 4285 |
[ ac_cv_have_uintxx_t="yes" ], [ ac_cv_have_uintxx_t="no" |
| 4286 |
]) |
| 4287 |
]) |
| 4288 |
if test "x$ac_cv_have_uintxx_t" = "xyes" ; then |
| 4289 |
AC_DEFINE([HAVE_UINTXX_T], [1], |
| 4290 |
[define if you have uintxx_t data type]) |
| 4291 |
fi |
| 4292 |
fi |
| 4293 |
|
| 4294 |
if (test -z "$have_uintxx_t" && \ |
| 4295 |
test "x$ac_cv_header_stdint_h" = "xyes") |
| 4296 |
then |
| 4297 |
AC_MSG_CHECKING([for uintXX_t types in stdint.h]) |
| 4298 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <stdint.h> ]], |
| 4299 |
[[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])], |
| 4300 |
[ |
| 4301 |
AC_DEFINE([HAVE_UINTXX_T]) |
| 4302 |
AC_MSG_RESULT([yes]) |
| 4303 |
], [ AC_MSG_RESULT([no]) |
| 4304 |
]) |
| 4305 |
fi |
| 4306 |
|
| 4307 |
if (test -z "$have_uintxx_t" && \ |
| 4308 |
test "x$ac_cv_header_inttypes_h" = "xyes") |
| 4309 |
then |
| 4310 |
AC_MSG_CHECKING([for uintXX_t types in inttypes.h]) |
| 4311 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <inttypes.h> ]], |
| 4312 |
[[ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;]])], |
| 4313 |
[ |
| 4314 |
AC_DEFINE([HAVE_UINTXX_T]) |
| 4315 |
AC_MSG_RESULT([yes]) |
| 4316 |
], [ AC_MSG_RESULT([no]) |
| 4317 |
]) |
| 4318 |
fi |
| 4319 |
|
| 4320 |
if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ |
| 4321 |
test "x$ac_cv_header_sys_bitypes_h" = "xyes") |
| 4322 |
then |
| 4323 |
AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h]) |
| 4324 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4325 |
#include <sys/bitypes.h> |
| 4326 |
]], [[ |
| 4327 |
int8_t a; int16_t b; int32_t c; |
| 4328 |
u_int8_t e; u_int16_t f; u_int32_t g; |
| 4329 |
a = b = c = e = f = g = 1; |
| 4330 |
]])], |
| 4331 |
[ |
| 4332 |
AC_DEFINE([HAVE_U_INTXX_T]) |
| 4333 |
AC_DEFINE([HAVE_INTXX_T]) |
| 4334 |
AC_MSG_RESULT([yes]) |
| 4335 |
], [AC_MSG_RESULT([no]) |
| 4336 |
]) |
| 4337 |
fi |
| 4338 |
|
| 4339 |
|
| 4340 |
AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [ |
| 4341 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4342 |
[[ u_char foo; foo = 125; ]])], |
| 4343 |
[ ac_cv_have_u_char="yes" ], [ ac_cv_have_u_char="no" |
| 4344 |
]) |
| 4345 |
]) |
| 4346 |
if test "x$ac_cv_have_u_char" = "xyes" ; then |
| 4347 |
AC_DEFINE([HAVE_U_CHAR], [1], [define if you have u_char data type]) |
| 4348 |
fi |
| 4349 |
|
| 4350 |
AC_CHECK_TYPES([intmax_t, uintmax_t], , , [ |
| 4351 |
#include <sys/types.h> |
| 4352 |
#ifdef HAVE_STDINT_H |
| 4353 |
# include <stdint.h> |
| 4354 |
#endif |
| 4355 |
]) |
| 4356 |
|
| 4357 |
TYPE_SOCKLEN_T |
| 4358 |
|
| 4359 |
AC_CHECK_TYPES([sig_atomic_t, sighandler_t], , , [#include <signal.h>]) |
| 4360 |
AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [ |
| 4361 |
#include <sys/types.h> |
| 4362 |
#ifdef HAVE_SYS_BITYPES_H |
| 4363 |
#include <sys/bitypes.h> |
| 4364 |
#endif |
| 4365 |
#ifdef HAVE_SYS_STATFS_H |
| 4366 |
#include <sys/statfs.h> |
| 4367 |
#endif |
| 4368 |
#ifdef HAVE_SYS_STATVFS_H |
| 4369 |
#include <sys/statvfs.h> |
| 4370 |
#endif |
| 4371 |
]) |
| 4372 |
|
| 4373 |
AC_CHECK_MEMBERS([struct statfs.f_files, struct statfs.f_flags], [], [], [[ |
| 4374 |
#include <sys/param.h> |
| 4375 |
#include <sys/types.h> |
| 4376 |
#ifdef HAVE_SYS_BITYPES_H |
| 4377 |
#include <sys/bitypes.h> |
| 4378 |
#endif |
| 4379 |
#ifdef HAVE_SYS_STATFS_H |
| 4380 |
#include <sys/statfs.h> |
| 4381 |
#endif |
| 4382 |
#ifdef HAVE_SYS_STATVFS_H |
| 4383 |
#include <sys/statvfs.h> |
| 4384 |
#endif |
| 4385 |
#ifdef HAVE_SYS_VFS_H |
| 4386 |
#include <sys/vfs.h> |
| 4387 |
#endif |
| 4388 |
#ifdef HAVE_SYS_MOUNT_H |
| 4389 |
#include <sys/mount.h> |
| 4390 |
#endif |
| 4391 |
]]) |
| 4392 |
|
| 4393 |
|
| 4394 |
AC_CHECK_TYPES([in_addr_t, in_port_t], , , |
| 4395 |
[#include <sys/types.h> |
| 4396 |
#include <netinet/in.h>]) |
| 4397 |
|
| 4398 |
AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [ |
| 4399 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4400 |
[[ size_t foo; foo = 1235; ]])], |
| 4401 |
[ ac_cv_have_size_t="yes" ], [ ac_cv_have_size_t="no" |
| 4402 |
]) |
| 4403 |
]) |
| 4404 |
if test "x$ac_cv_have_size_t" = "xyes" ; then |
| 4405 |
AC_DEFINE([HAVE_SIZE_T], [1], [define if you have size_t data type]) |
| 4406 |
fi |
| 4407 |
|
| 4408 |
AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [ |
| 4409 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4410 |
[[ ssize_t foo; foo = 1235; ]])], |
| 4411 |
[ ac_cv_have_ssize_t="yes" ], [ ac_cv_have_ssize_t="no" |
| 4412 |
]) |
| 4413 |
]) |
| 4414 |
if test "x$ac_cv_have_ssize_t" = "xyes" ; then |
| 4415 |
AC_DEFINE([HAVE_SSIZE_T], [1], [define if you have ssize_t data type]) |
| 4416 |
fi |
| 4417 |
|
| 4418 |
AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [ |
| 4419 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <time.h> ]], |
| 4420 |
[[ clock_t foo; foo = 1235; ]])], |
| 4421 |
[ ac_cv_have_clock_t="yes" ], [ ac_cv_have_clock_t="no" |
| 4422 |
]) |
| 4423 |
]) |
| 4424 |
if test "x$ac_cv_have_clock_t" = "xyes" ; then |
| 4425 |
AC_DEFINE([HAVE_CLOCK_T], [1], [define if you have clock_t data type]) |
| 4426 |
fi |
| 4427 |
|
| 4428 |
AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [ |
| 4429 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4430 |
#include <sys/types.h> |
| 4431 |
#include <sys/socket.h> |
| 4432 |
]], [[ sa_family_t foo; foo = 1235; ]])], |
| 4433 |
[ ac_cv_have_sa_family_t="yes" ], |
| 4434 |
[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4435 |
#include <sys/types.h> |
| 4436 |
#include <sys/socket.h> |
| 4437 |
#include <netinet/in.h> |
| 4438 |
]], [[ sa_family_t foo; foo = 1235; ]])], |
| 4439 |
[ ac_cv_have_sa_family_t="yes" ], |
| 4440 |
[ ac_cv_have_sa_family_t="no" ] |
| 4441 |
) |
| 4442 |
]) |
| 4443 |
]) |
| 4444 |
if test "x$ac_cv_have_sa_family_t" = "xyes" ; then |
| 4445 |
AC_DEFINE([HAVE_SA_FAMILY_T], [1], |
| 4446 |
[define if you have sa_family_t data type]) |
| 4447 |
fi |
| 4448 |
|
| 4449 |
AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [ |
| 4450 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4451 |
[[ pid_t foo; foo = 1235; ]])], |
| 4452 |
[ ac_cv_have_pid_t="yes" ], [ ac_cv_have_pid_t="no" |
| 4453 |
]) |
| 4454 |
]) |
| 4455 |
if test "x$ac_cv_have_pid_t" = "xyes" ; then |
| 4456 |
AC_DEFINE([HAVE_PID_T], [1], [define if you have pid_t data type]) |
| 4457 |
fi |
| 4458 |
|
| 4459 |
AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [ |
| 4460 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/types.h> ]], |
| 4461 |
[[ mode_t foo; foo = 1235; ]])], |
| 4462 |
[ ac_cv_have_mode_t="yes" ], [ ac_cv_have_mode_t="no" |
| 4463 |
]) |
| 4464 |
]) |
| 4465 |
if test "x$ac_cv_have_mode_t" = "xyes" ; then |
| 4466 |
AC_DEFINE([HAVE_MODE_T], [1], [define if you have mode_t data type]) |
| 4467 |
fi |
| 4468 |
|
| 4469 |
|
| 4470 |
AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ |
| 4471 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4472 |
#include <sys/types.h> |
| 4473 |
#include <sys/socket.h> |
| 4474 |
]], [[ struct sockaddr_storage s; ]])], |
| 4475 |
[ ac_cv_have_struct_sockaddr_storage="yes" ], |
| 4476 |
[ ac_cv_have_struct_sockaddr_storage="no" |
| 4477 |
]) |
| 4478 |
]) |
| 4479 |
if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then |
| 4480 |
AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1], |
| 4481 |
[define if you have struct sockaddr_storage data type]) |
| 4482 |
fi |
| 4483 |
|
| 4484 |
AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [ |
| 4485 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4486 |
#include <sys/types.h> |
| 4487 |
#include <netinet/in.h> |
| 4488 |
]], [[ struct sockaddr_in6 s; s.sin6_family = 0; ]])], |
| 4489 |
[ ac_cv_have_struct_sockaddr_in6="yes" ], |
| 4490 |
[ ac_cv_have_struct_sockaddr_in6="no" |
| 4491 |
]) |
| 4492 |
]) |
| 4493 |
if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then |
| 4494 |
AC_DEFINE([HAVE_STRUCT_SOCKADDR_IN6], [1], |
| 4495 |
[define if you have struct sockaddr_in6 data type]) |
| 4496 |
fi |
| 4497 |
|
| 4498 |
AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [ |
| 4499 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4500 |
#include <sys/types.h> |
| 4501 |
#include <netinet/in.h> |
| 4502 |
]], [[ struct in6_addr s; s.s6_addr[0] = 0; ]])], |
| 4503 |
[ ac_cv_have_struct_in6_addr="yes" ], |
| 4504 |
[ ac_cv_have_struct_in6_addr="no" |
| 4505 |
]) |
| 4506 |
]) |
| 4507 |
if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then |
| 4508 |
AC_DEFINE([HAVE_STRUCT_IN6_ADDR], [1], |
| 4509 |
[define if you have struct in6_addr data type]) |
| 4510 |
|
| 4511 |
dnl Now check for sin6_scope_id |
| 4512 |
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], , , |
| 4513 |
[ |
| 4514 |
#ifdef HAVE_SYS_TYPES_H |
| 4515 |
#include <sys/types.h> |
| 4516 |
#endif |
| 4517 |
#include <netinet/in.h> |
| 4518 |
]) |
| 4519 |
fi |
| 4520 |
|
| 4521 |
AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [ |
| 4522 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4523 |
#include <sys/types.h> |
| 4524 |
#include <sys/socket.h> |
| 4525 |
#include <netdb.h> |
| 4526 |
]], [[ struct addrinfo s; s.ai_flags = AI_PASSIVE; ]])], |
| 4527 |
[ ac_cv_have_struct_addrinfo="yes" ], |
| 4528 |
[ ac_cv_have_struct_addrinfo="no" |
| 4529 |
]) |
| 4530 |
]) |
| 4531 |
if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then |
| 4532 |
AC_DEFINE([HAVE_STRUCT_ADDRINFO], [1], |
| 4533 |
[define if you have struct addrinfo data type]) |
| 4534 |
fi |
| 4535 |
|
| 4536 |
AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [ |
| 4537 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]], |
| 4538 |
[[ struct timeval tv; tv.tv_sec = 1;]])], |
| 4539 |
[ ac_cv_have_struct_timeval="yes" ], |
| 4540 |
[ ac_cv_have_struct_timeval="no" |
| 4541 |
]) |
| 4542 |
]) |
| 4543 |
if test "x$ac_cv_have_struct_timeval" = "xyes" ; then |
| 4544 |
AC_DEFINE([HAVE_STRUCT_TIMEVAL], [1], [define if you have struct timeval]) |
| 4545 |
have_struct_timeval=1 |
| 4546 |
fi |
| 4547 |
|
| 4548 |
AC_CACHE_CHECK([for struct timespec], ac_cv_have_struct_timespec, [ |
| 4549 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4550 |
#ifdef HAVE_SYS_TIME_H |
| 4551 |
# include <sys/time.h> |
| 4552 |
#endif |
| 4553 |
#ifdef HAVE_TIME_H |
| 4554 |
# include <time.h> |
| 4555 |
#endif |
| 4556 |
]], |
| 4557 |
[[ struct timespec ts; ts.tv_sec = 1;]])], |
| 4558 |
[ ac_cv_have_struct_timespec="yes" ], |
| 4559 |
[ ac_cv_have_struct_timespec="no" |
| 4560 |
]) |
| 4561 |
]) |
| 4562 |
if test "x$ac_cv_have_struct_timespec" = "xyes" ; then |
| 4563 |
AC_DEFINE([HAVE_STRUCT_TIMESPEC], [1], [define if you have struct timespec]) |
| 4564 |
have_struct_timespec=1 |
| 4565 |
fi |
| 4566 |
|
| 4567 |
# We need int64_t or else certain parts of the compile will fail. |
| 4568 |
if test "x$ac_cv_have_int64_t" = "xno" && \ |
| 4569 |
test "x$ac_cv_sizeof_long_int" != "x8" && \ |
| 4570 |
test "x$ac_cv_sizeof_long_long_int" = "x0" ; then |
| 4571 |
echo "OpenSSH requires int64_t support. Contact your vendor or install" |
| 4572 |
echo "an alternative compiler (I.E., GCC) before continuing." |
| 4573 |
echo "" |
| 4574 |
exit 1; |
| 4575 |
else |
| 4576 |
dnl test snprintf (broken on SCO w/gcc) |
| 4577 |
AC_RUN_IFELSE( |
| 4578 |
[AC_LANG_SOURCE([[ |
| 4579 |
#include <stdio.h> |
| 4580 |
#include <stdlib.h> |
| 4581 |
#include <string.h> |
| 4582 |
#ifdef HAVE_SNPRINTF |
| 4583 |
int main(void) |
| 4584 |
{ |
| 4585 |
char buf[50]; |
| 4586 |
char expected_out[50]; |
| 4587 |
int mazsize = 50 ; |
| 4588 |
#if (SIZEOF_LONG_INT == 8) |
| 4589 |
long int num = 0x7fffffffffffffff; |
| 4590 |
#else |
| 4591 |
long long num = 0x7fffffffffffffffll; |
| 4592 |
#endif |
| 4593 |
strcpy(expected_out, "9223372036854775807"); |
| 4594 |
#if (SIZEOF_LONG_INT == 8) |
| 4595 |
snprintf(buf, mazsize, "%ld", num); |
| 4596 |
#else |
| 4597 |
snprintf(buf, mazsize, "%lld", num); |
| 4598 |
#endif |
| 4599 |
if(strcmp(buf, expected_out) != 0) |
| 4600 |
exit(1); |
| 4601 |
exit(0); |
| 4602 |
} |
| 4603 |
#else |
| 4604 |
int main(void) { exit(0); } |
| 4605 |
#endif |
| 4606 |
]])], [ true ], [ AC_DEFINE([BROKEN_SNPRINTF]) ], |
| 4607 |
AC_MSG_WARN([cross compiling: Assuming working snprintf()]) |
| 4608 |
) |
| 4609 |
fi |
| 4610 |
|
| 4611 |
dnl Checks for structure members |
| 4612 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmp.h], [HAVE_HOST_IN_UTMP]) |
| 4613 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_host], [utmpx.h], [HAVE_HOST_IN_UTMPX]) |
| 4614 |
OSSH_CHECK_HEADER_FOR_FIELD([syslen], [utmpx.h], [HAVE_SYSLEN_IN_UTMPX]) |
| 4615 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_pid], [utmp.h], [HAVE_PID_IN_UTMP]) |
| 4616 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmp.h], [HAVE_TYPE_IN_UTMP]) |
| 4617 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_type], [utmpx.h], [HAVE_TYPE_IN_UTMPX]) |
| 4618 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmp.h], [HAVE_TV_IN_UTMP]) |
| 4619 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmp.h], [HAVE_ID_IN_UTMP]) |
| 4620 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_id], [utmpx.h], [HAVE_ID_IN_UTMPX]) |
| 4621 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmp.h], [HAVE_ADDR_IN_UTMP]) |
| 4622 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_addr], [utmpx.h], [HAVE_ADDR_IN_UTMPX]) |
| 4623 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmp.h], [HAVE_ADDR_V6_IN_UTMP]) |
| 4624 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_addr_v6], [utmpx.h], [HAVE_ADDR_V6_IN_UTMPX]) |
| 4625 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_exit], [utmp.h], [HAVE_EXIT_IN_UTMP]) |
| 4626 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmp.h], [HAVE_TIME_IN_UTMP]) |
| 4627 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_time], [utmpx.h], [HAVE_TIME_IN_UTMPX]) |
| 4628 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_tv], [utmpx.h], [HAVE_TV_IN_UTMPX]) |
| 4629 |
OSSH_CHECK_HEADER_FOR_FIELD([ut_ss], [utmpx.h], [HAVE_SS_IN_UTMPX]) |
| 4630 |
|
| 4631 |
AC_CHECK_MEMBERS([struct stat.st_blksize]) |
| 4632 |
AC_CHECK_MEMBERS([struct stat.st_mtim]) |
| 4633 |
AC_CHECK_MEMBERS([struct stat.st_mtime]) |
| 4634 |
AC_CHECK_MEMBERS([struct passwd.pw_gecos, struct passwd.pw_class, |
| 4635 |
struct passwd.pw_change, struct passwd.pw_expire], |
| 4636 |
[], [], [[ |
| 4637 |
#include <sys/types.h> |
| 4638 |
#include <pwd.h> |
| 4639 |
]]) |
| 4640 |
|
| 4641 |
AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE([__res_state], [state], |
| 4642 |
[Define if we don't have struct __res_state in resolv.h])], |
| 4643 |
[[ |
| 4644 |
#include <stdio.h> |
| 4645 |
#if HAVE_SYS_TYPES_H |
| 4646 |
# include <sys/types.h> |
| 4647 |
#endif |
| 4648 |
#include <netinet/in.h> |
| 4649 |
#include <arpa/nameser.h> |
| 4650 |
#include <resolv.h> |
| 4651 |
]]) |
| 4652 |
|
| 4653 |
AC_CHECK_MEMBER([struct sockaddr_in.sin_len], |
| 4654 |
[AC_DEFINE([SOCK_HAS_LEN], [1], [sockaddr_in has sin_len])], |
| 4655 |
[], |
| 4656 |
[AC_LANG_SOURCE([[ |
| 4657 |
#include <sys/types.h> |
| 4658 |
#include <sys/socket.h> |
| 4659 |
#include <netinet/in.h> |
| 4660 |
]])] |
| 4661 |
) |
| 4662 |
|
| 4663 |
AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], |
| 4664 |
ac_cv_have_ss_family_in_struct_ss, [ |
| 4665 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4666 |
#include <sys/types.h> |
| 4667 |
#include <sys/socket.h> |
| 4668 |
]], [[ struct sockaddr_storage s; s.ss_family = 1; ]])], |
| 4669 |
[ ac_cv_have_ss_family_in_struct_ss="yes" ], |
| 4670 |
[ ac_cv_have_ss_family_in_struct_ss="no" ]) |
| 4671 |
]) |
| 4672 |
if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then |
| 4673 |
AC_DEFINE([HAVE_SS_FAMILY_IN_SS], [1], [Fields in struct sockaddr_storage]) |
| 4674 |
fi |
| 4675 |
|
| 4676 |
AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], |
| 4677 |
ac_cv_have___ss_family_in_struct_ss, [ |
| 4678 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4679 |
#include <sys/types.h> |
| 4680 |
#include <sys/socket.h> |
| 4681 |
]], [[ struct sockaddr_storage s; s.__ss_family = 1; ]])], |
| 4682 |
[ ac_cv_have___ss_family_in_struct_ss="yes" ], |
| 4683 |
[ ac_cv_have___ss_family_in_struct_ss="no" |
| 4684 |
]) |
| 4685 |
]) |
| 4686 |
if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then |
| 4687 |
AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1], |
| 4688 |
[Fields in struct sockaddr_storage]) |
| 4689 |
fi |
| 4690 |
|
| 4691 |
dnl make sure we're using the real structure members and not defines |
| 4692 |
AC_CACHE_CHECK([for msg_accrights field in struct msghdr], |
| 4693 |
ac_cv_have_accrights_in_msghdr, [ |
| 4694 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4695 |
#include <sys/types.h> |
| 4696 |
#include <sys/socket.h> |
| 4697 |
#include <sys/uio.h> |
| 4698 |
#include <stdlib.h> |
| 4699 |
]], [[ |
| 4700 |
#ifdef msg_accrights |
| 4701 |
#error "msg_accrights is a macro" |
| 4702 |
exit(1); |
| 4703 |
#endif |
| 4704 |
struct msghdr m; |
| 4705 |
m.msg_accrights = 0; |
| 4706 |
exit(0); |
| 4707 |
]])], |
| 4708 |
[ ac_cv_have_accrights_in_msghdr="yes" ], |
| 4709 |
[ ac_cv_have_accrights_in_msghdr="no" ] |
| 4710 |
) |
| 4711 |
]) |
| 4712 |
if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then |
| 4713 |
AC_DEFINE([HAVE_ACCRIGHTS_IN_MSGHDR], [1], |
| 4714 |
[Define if your system uses access rights style |
| 4715 |
file descriptor passing]) |
| 4716 |
fi |
| 4717 |
|
| 4718 |
AC_MSG_CHECKING([if struct statvfs.f_fsid is integral type]) |
| 4719 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4720 |
#include <sys/param.h> |
| 4721 |
#include <sys/stat.h> |
| 4722 |
#ifdef HAVE_SYS_TIME_H |
| 4723 |
# include <sys/time.h> |
| 4724 |
#endif |
| 4725 |
#ifdef HAVE_SYS_MOUNT_H |
| 4726 |
#include <sys/mount.h> |
| 4727 |
#endif |
| 4728 |
#ifdef HAVE_SYS_STATVFS_H |
| 4729 |
#include <sys/statvfs.h> |
| 4730 |
#endif |
| 4731 |
]], [[ struct statvfs s; s.f_fsid = 0; ]])], |
| 4732 |
[ AC_MSG_RESULT([yes]) ], |
| 4733 |
[ AC_MSG_RESULT([no]) |
| 4734 |
|
| 4735 |
AC_MSG_CHECKING([if fsid_t has member val]) |
| 4736 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4737 |
#include <sys/types.h> |
| 4738 |
#include <sys/statvfs.h> |
| 4739 |
]], [[ fsid_t t; t.val[0] = 0; ]])], |
| 4740 |
[ AC_MSG_RESULT([yes]) |
| 4741 |
AC_DEFINE([FSID_HAS_VAL], [1], [fsid_t has member val]) ], |
| 4742 |
[ AC_MSG_RESULT([no]) ]) |
| 4743 |
|
| 4744 |
AC_MSG_CHECKING([if f_fsid has member __val]) |
| 4745 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4746 |
#include <sys/types.h> |
| 4747 |
#include <sys/statvfs.h> |
| 4748 |
]], [[ fsid_t t; t.__val[0] = 0; ]])], |
| 4749 |
[ AC_MSG_RESULT([yes]) |
| 4750 |
AC_DEFINE([FSID_HAS___VAL], [1], [fsid_t has member __val]) ], |
| 4751 |
[ AC_MSG_RESULT([no]) ]) |
| 4752 |
]) |
| 4753 |
|
| 4754 |
AC_CACHE_CHECK([for msg_control field in struct msghdr], |
| 4755 |
ac_cv_have_control_in_msghdr, [ |
| 4756 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 4757 |
#include <sys/types.h> |
| 4758 |
#include <sys/socket.h> |
| 4759 |
#include <sys/uio.h> |
| 4760 |
#include <stdlib.h> |
| 4761 |
]], [[ |
| 4762 |
#ifdef msg_control |
| 4763 |
#error "msg_control is a macro" |
| 4764 |
exit(1); |
| 4765 |
#endif |
| 4766 |
struct msghdr m; |
| 4767 |
m.msg_control = 0; |
| 4768 |
exit(0); |
| 4769 |
]])], |
| 4770 |
[ ac_cv_have_control_in_msghdr="yes" ], |
| 4771 |
[ ac_cv_have_control_in_msghdr="no" ] |
| 4772 |
) |
| 4773 |
]) |
| 4774 |
if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then |
| 4775 |
AC_DEFINE([HAVE_CONTROL_IN_MSGHDR], [1], |
| 4776 |
[Define if your system uses ancillary data style |
| 4777 |
file descriptor passing]) |
| 4778 |
fi |
| 4779 |
|
| 4780 |
AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [ |
| 4781 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4782 |
[[ extern char *__progname; printf("%s", __progname); ]])], |
| 4783 |
[ ac_cv_libc_defines___progname="yes" ], |
| 4784 |
[ ac_cv_libc_defines___progname="no" |
| 4785 |
]) |
| 4786 |
]) |
| 4787 |
if test "x$ac_cv_libc_defines___progname" = "xyes" ; then |
| 4788 |
AC_DEFINE([HAVE___PROGNAME], [1], [Define if libc defines __progname]) |
| 4789 |
fi |
| 4790 |
|
| 4791 |
AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [ |
| 4792 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4793 |
[[ printf("%s", __FUNCTION__); ]])], |
| 4794 |
[ ac_cv_cc_implements___FUNCTION__="yes" ], |
| 4795 |
[ ac_cv_cc_implements___FUNCTION__="no" |
| 4796 |
]) |
| 4797 |
]) |
| 4798 |
if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then |
| 4799 |
AC_DEFINE([HAVE___FUNCTION__], [1], |
| 4800 |
[Define if compiler implements __FUNCTION__]) |
| 4801 |
fi |
| 4802 |
|
| 4803 |
AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [ |
| 4804 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4805 |
[[ printf("%s", __func__); ]])], |
| 4806 |
[ ac_cv_cc_implements___func__="yes" ], |
| 4807 |
[ ac_cv_cc_implements___func__="no" |
| 4808 |
]) |
| 4809 |
]) |
| 4810 |
if test "x$ac_cv_cc_implements___func__" = "xyes" ; then |
| 4811 |
AC_DEFINE([HAVE___func__], [1], [Define if compiler implements __func__]) |
| 4812 |
fi |
| 4813 |
|
| 4814 |
AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [ |
| 4815 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4816 |
#include <stdarg.h> |
| 4817 |
va_list x,y; |
| 4818 |
]], [[ va_copy(x,y); ]])], |
| 4819 |
[ ac_cv_have_va_copy="yes" ], |
| 4820 |
[ ac_cv_have_va_copy="no" |
| 4821 |
]) |
| 4822 |
]) |
| 4823 |
if test "x$ac_cv_have_va_copy" = "xyes" ; then |
| 4824 |
AC_DEFINE([HAVE_VA_COPY], [1], [Define if va_copy exists]) |
| 4825 |
fi |
| 4826 |
|
| 4827 |
AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [ |
| 4828 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4829 |
#include <stdarg.h> |
| 4830 |
va_list x,y; |
| 4831 |
]], [[ __va_copy(x,y); ]])], |
| 4832 |
[ ac_cv_have___va_copy="yes" ], [ ac_cv_have___va_copy="no" |
| 4833 |
]) |
| 4834 |
]) |
| 4835 |
if test "x$ac_cv_have___va_copy" = "xyes" ; then |
| 4836 |
AC_DEFINE([HAVE___VA_COPY], [1], [Define if __va_copy exists]) |
| 4837 |
fi |
| 4838 |
|
| 4839 |
AC_CACHE_CHECK([whether getopt has optreset support], |
| 4840 |
ac_cv_have_getopt_optreset, [ |
| 4841 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <getopt.h> ]], |
| 4842 |
[[ extern int optreset; optreset = 0; ]])], |
| 4843 |
[ ac_cv_have_getopt_optreset="yes" ], |
| 4844 |
[ ac_cv_have_getopt_optreset="no" |
| 4845 |
]) |
| 4846 |
]) |
| 4847 |
if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then |
| 4848 |
AC_DEFINE([HAVE_GETOPT_OPTRESET], [1], |
| 4849 |
[Define if your getopt(3) defines and uses optreset]) |
| 4850 |
fi |
| 4851 |
|
| 4852 |
AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [ |
| 4853 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4854 |
[[ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);]])], |
| 4855 |
[ ac_cv_libc_defines_sys_errlist="yes" ], |
| 4856 |
[ ac_cv_libc_defines_sys_errlist="no" |
| 4857 |
]) |
| 4858 |
]) |
| 4859 |
if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then |
| 4860 |
AC_DEFINE([HAVE_SYS_ERRLIST], [1], |
| 4861 |
[Define if your system defines sys_errlist[]]) |
| 4862 |
fi |
| 4863 |
|
| 4864 |
|
| 4865 |
AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [ |
| 4866 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> ]], |
| 4867 |
[[ extern int sys_nerr; printf("%i", sys_nerr);]])], |
| 4868 |
[ ac_cv_libc_defines_sys_nerr="yes" ], |
| 4869 |
[ ac_cv_libc_defines_sys_nerr="no" |
| 4870 |
]) |
| 4871 |
]) |
| 4872 |
if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then |
| 4873 |
AC_DEFINE([HAVE_SYS_NERR], [1], [Define if your system defines sys_nerr]) |
| 4874 |
fi |
| 4875 |
|
| 4876 |
# Check libraries needed by DNS fingerprint support |
| 4877 |
AC_SEARCH_LIBS([getrrsetbyname], [resolv], |
| 4878 |
[AC_DEFINE([HAVE_GETRRSETBYNAME], [1], |
| 4879 |
[Define if getrrsetbyname() exists])], |
| 4880 |
[ |
| 4881 |
# Needed by our getrrsetbyname() |
| 4882 |
AC_SEARCH_LIBS([res_query], [resolv]) |
| 4883 |
AC_SEARCH_LIBS([dn_expand], [resolv]) |
| 4884 |
AC_MSG_CHECKING([if res_query will link]) |
| 4885 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4886 |
#include <sys/types.h> |
| 4887 |
#include <netinet/in.h> |
| 4888 |
#include <arpa/nameser.h> |
| 4889 |
#include <netdb.h> |
| 4890 |
#include <resolv.h> |
| 4891 |
]], [[ |
| 4892 |
res_query (0, 0, 0, 0, 0); |
| 4893 |
]])], |
| 4894 |
AC_MSG_RESULT([yes]), |
| 4895 |
[AC_MSG_RESULT([no]) |
| 4896 |
saved_LIBS="$LIBS" |
| 4897 |
LIBS="$LIBS -lresolv" |
| 4898 |
AC_MSG_CHECKING([for res_query in -lresolv]) |
| 4899 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4900 |
#include <sys/types.h> |
| 4901 |
#include <netinet/in.h> |
| 4902 |
#include <arpa/nameser.h> |
| 4903 |
#include <netdb.h> |
| 4904 |
#include <resolv.h> |
| 4905 |
]], [[ |
| 4906 |
res_query (0, 0, 0, 0, 0); |
| 4907 |
]])], |
| 4908 |
[AC_MSG_RESULT([yes])], |
| 4909 |
[LIBS="$saved_LIBS" |
| 4910 |
AC_MSG_RESULT([no])]) |
| 4911 |
]) |
| 4912 |
AC_CHECK_FUNCS([_getshort _getlong]) |
| 4913 |
AC_CHECK_DECLS([_getshort, _getlong], , , |
| 4914 |
[#include <sys/types.h> |
| 4915 |
#include <arpa/nameser.h>]) |
| 4916 |
AC_CHECK_MEMBER([HEADER.ad], |
| 4917 |
[AC_DEFINE([HAVE_HEADER_AD], [1], |
| 4918 |
[Define if HEADER.ad exists in arpa/nameser.h])], , |
| 4919 |
[#include <arpa/nameser.h>]) |
| 4920 |
]) |
| 4921 |
|
| 4922 |
AC_MSG_CHECKING([if struct __res_state _res is an extern]) |
| 4923 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 4924 |
#include <stdio.h> |
| 4925 |
#if HAVE_SYS_TYPES_H |
| 4926 |
# include <sys/types.h> |
| 4927 |
#endif |
| 4928 |
#include <netinet/in.h> |
| 4929 |
#include <arpa/nameser.h> |
| 4930 |
#include <resolv.h> |
| 4931 |
extern struct __res_state _res; |
| 4932 |
]], [[ |
| 4933 |
struct __res_state *volatile p = &_res; /* force resolution of _res */ |
| 4934 |
return 0; |
| 4935 |
]],)], |
| 4936 |
[AC_MSG_RESULT([yes]) |
| 4937 |
AC_DEFINE([HAVE__RES_EXTERN], [1], |
| 4938 |
[Define if you have struct __res_state _res as an extern]) |
| 4939 |
], |
| 4940 |
[ AC_MSG_RESULT([no]) ] |
| 4941 |
) |
| 4942 |
|
| 4943 |
# Check whether user wants SELinux support |
| 4944 |
SELINUX_MSG="no" |
| 4945 |
LIBSELINUX="" |
| 4946 |
AC_ARG_WITH([selinux], |
| 4947 |
[ --with-selinux Enable SELinux support], |
| 4948 |
[ if test "x$withval" != "xno" ; then |
| 4949 |
save_LIBS="$LIBS" |
| 4950 |
AC_DEFINE([WITH_SELINUX], [1], |
| 4951 |
[Define if you want SELinux support.]) |
| 4952 |
SELINUX_MSG="yes" |
| 4953 |
AC_CHECK_HEADER([selinux/selinux.h], , |
| 4954 |
AC_MSG_ERROR([SELinux support requires selinux.h header])) |
| 4955 |
AC_CHECK_LIB([selinux], [setexeccon], |
| 4956 |
[ LIBSELINUX="-lselinux" |
| 4957 |
LIBS="$LIBS -lselinux" |
| 4958 |
], |
| 4959 |
AC_MSG_ERROR([SELinux support requires libselinux library])) |
| 4960 |
AC_CHECK_FUNCS([getseuserbyname get_default_context_with_level]) |
| 4961 |
LIBS="$save_LIBS $LIBSELINUX" |
| 4962 |
fi ] |
| 4963 |
) |
| 4964 |
AC_SUBST([SSHDLIBS]) |
| 4965 |
|
| 4966 |
# Check whether user wants Kerberos 5 support |
| 4967 |
KRB5_MSG="no" |
| 4968 |
AC_ARG_WITH([kerberos5], |
| 4969 |
[ --with-kerberos5=PATH Enable Kerberos 5 support], |
| 4970 |
[ if test "x$withval" != "xno" ; then |
| 4971 |
if test "x$withval" = "xyes" ; then |
| 4972 |
KRB5ROOT="/usr/local" |
| 4973 |
else |
| 4974 |
KRB5ROOT=${withval} |
| 4975 |
fi |
| 4976 |
|
| 4977 |
AC_DEFINE([KRB5], [1], [Define if you want Kerberos 5 support]) |
| 4978 |
KRB5_MSG="yes" |
| 4979 |
|
| 4980 |
use_pkgconfig_for_krb5= |
| 4981 |
if test "x$PKGCONFIG" != "xno"; then |
| 4982 |
AC_MSG_CHECKING([if $PKGCONFIG knows about kerberos5]) |
| 4983 |
if "$PKGCONFIG" krb5; then |
| 4984 |
AC_MSG_RESULT([yes]) |
| 4985 |
use_pkgconfig_for_krb5=yes |
| 4986 |
else |
| 4987 |
AC_MSG_RESULT([no]) |
| 4988 |
fi |
| 4989 |
fi |
| 4990 |
if test "x$use_pkgconfig_for_krb5" = "xyes"; then |
| 4991 |
K5CFLAGS=`$PKGCONFIG --cflags krb5` |
| 4992 |
K5LIBS=`$PKGCONFIG --libs krb5` |
| 4993 |
CPPFLAGS="$CPPFLAGS $K5CFLAGS" |
| 4994 |
|
| 4995 |
AC_MSG_CHECKING([for gssapi support]) |
| 4996 |
if "$PKGCONFIG" krb5-gssapi; then |
| 4997 |
AC_MSG_RESULT([yes]) |
| 4998 |
AC_DEFINE([GSSAPI], [1], |
| 4999 |
[Define this if you want GSSAPI |
| 5000 |
support in the version 2 protocol]) |
| 5001 |
GSSCFLAGS="`$PKGCONFIG --cflags krb5-gssapi`" |
| 5002 |
GSSLIBS="`$PKGCONFIG --libs krb5-gssapi`" |
| 5003 |
CPPFLAGS="$CPPFLAGS $GSSCFLAGS" |
| 5004 |
else |
| 5005 |
AC_MSG_RESULT([no]) |
| 5006 |
fi |
| 5007 |
AC_MSG_CHECKING([whether we are using Heimdal]) |
| 5008 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h> |
| 5009 |
]], [[ char *tmp = heimdal_version; ]])], |
| 5010 |
[ AC_MSG_RESULT([yes]) |
| 5011 |
AC_DEFINE([HEIMDAL], [1], |
| 5012 |
[Define this if you are using the Heimdal |
| 5013 |
version of Kerberos V5]) ], |
| 5014 |
[AC_MSG_RESULT([no]) |
| 5015 |
]) |
| 5016 |
else |
| 5017 |
AC_PATH_TOOL([KRB5CONF], [krb5-config], |
| 5018 |
[$KRB5ROOT/bin/krb5-config], |
| 5019 |
[$KRB5ROOT/bin:$PATH]) |
| 5020 |
if test -x $KRB5CONF ; then |
| 5021 |
K5CFLAGS="`$KRB5CONF --cflags`" |
| 5022 |
K5LIBS="`$KRB5CONF --libs`" |
| 5023 |
CPPFLAGS="$CPPFLAGS $K5CFLAGS" |
| 5024 |
|
| 5025 |
AC_MSG_CHECKING([for gssapi support]) |
| 5026 |
if $KRB5CONF | grep gssapi >/dev/null ; then |
| 5027 |
AC_MSG_RESULT([yes]) |
| 5028 |
AC_DEFINE([GSSAPI], [1], |
| 5029 |
[Define this if you want GSSAPI |
| 5030 |
support in the version 2 protocol]) |
| 5031 |
GSSCFLAGS="`$KRB5CONF --cflags gssapi`" |
| 5032 |
GSSLIBS="`$KRB5CONF --libs gssapi`" |
| 5033 |
CPPFLAGS="$CPPFLAGS $GSSCFLAGS" |
| 5034 |
else |
| 5035 |
AC_MSG_RESULT([no]) |
| 5036 |
fi |
| 5037 |
AC_MSG_CHECKING([whether we are using Heimdal]) |
| 5038 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h> |
| 5039 |
]], [[ char *tmp = heimdal_version; ]])], |
| 5040 |
[ AC_MSG_RESULT([yes]) |
| 5041 |
AC_DEFINE([HEIMDAL], [1], |
| 5042 |
[Define this if you are using the Heimdal |
| 5043 |
version of Kerberos V5]) ], |
| 5044 |
[AC_MSG_RESULT([no]) |
| 5045 |
]) |
| 5046 |
else |
| 5047 |
CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include" |
| 5048 |
LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib" |
| 5049 |
AC_MSG_CHECKING([whether we are using Heimdal]) |
| 5050 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <krb5.h> |
| 5051 |
]], [[ char *tmp = heimdal_version; ]])], |
| 5052 |
[ AC_MSG_RESULT([yes]) |
| 5053 |
AC_DEFINE([HEIMDAL]) |
| 5054 |
K5LIBS="-lkrb5" |
| 5055 |
K5LIBS="$K5LIBS -lcom_err -lasn1" |
| 5056 |
AC_CHECK_LIB([roken], [net_write], |
| 5057 |
[K5LIBS="$K5LIBS -lroken"]) |
| 5058 |
AC_CHECK_LIB([des], [des_cbc_encrypt], |
| 5059 |
[K5LIBS="$K5LIBS -ldes"]) |
| 5060 |
], [ AC_MSG_RESULT([no]) |
| 5061 |
K5LIBS="-lkrb5 -lk5crypto -lcom_err" |
| 5062 |
]) |
| 5063 |
AC_SEARCH_LIBS([dn_expand], [resolv]) |
| 5064 |
|
| 5065 |
AC_CHECK_LIB([gssapi_krb5], [gss_init_sec_context], |
| 5066 |
[ AC_DEFINE([GSSAPI]) |
| 5067 |
GSSLIBS="-lgssapi_krb5" ], |
| 5068 |
[ AC_CHECK_LIB([gssapi], [gss_init_sec_context], |
| 5069 |
[ AC_DEFINE([GSSAPI]) |
| 5070 |
GSSLIBS="-lgssapi" ], |
| 5071 |
[ AC_CHECK_LIB([gss], [gss_init_sec_context], |
| 5072 |
[ AC_DEFINE([GSSAPI]) |
| 5073 |
GSSLIBS="-lgss" ], |
| 5074 |
AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail])) |
| 5075 |
]) |
| 5076 |
]) |
| 5077 |
|
| 5078 |
AC_CHECK_HEADER([gssapi.h], , |
| 5079 |
[ unset ac_cv_header_gssapi_h |
| 5080 |
CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" |
| 5081 |
AC_CHECK_HEADERS([gssapi.h], , |
| 5082 |
AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail]) |
| 5083 |
) |
| 5084 |
] |
| 5085 |
) |
| 5086 |
|
| 5087 |
oldCPP="$CPPFLAGS" |
| 5088 |
CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi" |
| 5089 |
AC_CHECK_HEADER([gssapi_krb5.h], , |
| 5090 |
[ CPPFLAGS="$oldCPP" ]) |
| 5091 |
|
| 5092 |
fi |
| 5093 |
fi |
| 5094 |
if test -n "${rpath_opt}" ; then |
| 5095 |
LDFLAGS="$LDFLAGS ${rpath_opt}${KRB5ROOT}/lib" |
| 5096 |
fi |
| 5097 |
if test ! -z "$blibpath" ; then |
| 5098 |
blibpath="$blibpath:${KRB5ROOT}/lib" |
| 5099 |
fi |
| 5100 |
|
| 5101 |
AC_CHECK_HEADERS([gssapi.h gssapi/gssapi.h]) |
| 5102 |
AC_CHECK_HEADERS([gssapi_krb5.h gssapi/gssapi_krb5.h]) |
| 5103 |
AC_CHECK_HEADERS([gssapi_generic.h gssapi/gssapi_generic.h]) |
| 5104 |
|
| 5105 |
AC_SEARCH_LIBS([k_hasafs], [kafs], [AC_DEFINE([USE_AFS], [1], |
| 5106 |
[Define this if you want to use libkafs' AFS support])]) |
| 5107 |
|
| 5108 |
AC_CHECK_DECLS([GSS_C_NT_HOSTBASED_SERVICE], [], [], [[ |
| 5109 |
#ifdef HAVE_GSSAPI_H |
| 5110 |
# include <gssapi.h> |
| 5111 |
#elif defined(HAVE_GSSAPI_GSSAPI_H) |
| 5112 |
# include <gssapi/gssapi.h> |
| 5113 |
#endif |
| 5114 |
|
| 5115 |
#ifdef HAVE_GSSAPI_GENERIC_H |
| 5116 |
# include <gssapi_generic.h> |
| 5117 |
#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H) |
| 5118 |
# include <gssapi/gssapi_generic.h> |
| 5119 |
#endif |
| 5120 |
]]) |
| 5121 |
saved_LIBS="$LIBS" |
| 5122 |
LIBS="$LIBS $K5LIBS" |
| 5123 |
AC_CHECK_FUNCS([krb5_cc_new_unique krb5_get_error_message krb5_free_error_message]) |
| 5124 |
LIBS="$saved_LIBS" |
| 5125 |
|
| 5126 |
fi |
| 5127 |
] |
| 5128 |
) |
| 5129 |
AC_SUBST([GSSLIBS]) |
| 5130 |
AC_SUBST([K5LIBS]) |
| 5131 |
AC_SUBST([CHANNELLIBS]) |
| 5132 |
|
| 5133 |
# Looking for programs, paths and files |
| 5134 |
|
| 5135 |
PRIVSEP_PATH=/var/empty |
| 5136 |
AC_ARG_WITH([privsep-path], |
| 5137 |
[ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)], |
| 5138 |
[ |
| 5139 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 5140 |
test "x${withval}" != "xyes"; then |
| 5141 |
PRIVSEP_PATH=$withval |
| 5142 |
fi |
| 5143 |
] |
| 5144 |
) |
| 5145 |
AC_SUBST([PRIVSEP_PATH]) |
| 5146 |
|
| 5147 |
AC_ARG_WITH([xauth], |
| 5148 |
[ --with-xauth=PATH Specify path to xauth program ], |
| 5149 |
[ |
| 5150 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 5151 |
test "x${withval}" != "xyes"; then |
| 5152 |
xauth_path=$withval |
| 5153 |
fi |
| 5154 |
], |
| 5155 |
[ |
| 5156 |
TestPath="$PATH" |
| 5157 |
TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin" |
| 5158 |
TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11" |
| 5159 |
TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin" |
| 5160 |
TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin" |
| 5161 |
AC_PATH_PROG([xauth_path], [xauth], , [$TestPath]) |
| 5162 |
if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then |
| 5163 |
xauth_path="/usr/openwin/bin/xauth" |
| 5164 |
fi |
| 5165 |
] |
| 5166 |
) |
| 5167 |
|
| 5168 |
STRIP_OPT=-s |
| 5169 |
AC_ARG_ENABLE([strip], |
| 5170 |
[ --disable-strip Disable calling strip(1) on install], |
| 5171 |
[ |
| 5172 |
if test "x$enableval" = "xno" ; then |
| 5173 |
STRIP_OPT= |
| 5174 |
fi |
| 5175 |
] |
| 5176 |
) |
| 5177 |
AC_SUBST([STRIP_OPT]) |
| 5178 |
|
| 5179 |
if test -z "$xauth_path" ; then |
| 5180 |
XAUTH_PATH="undefined" |
| 5181 |
AC_SUBST([XAUTH_PATH]) |
| 5182 |
else |
| 5183 |
AC_DEFINE_UNQUOTED([XAUTH_PATH], ["$xauth_path"], |
| 5184 |
[Define if xauth is found in your path]) |
| 5185 |
XAUTH_PATH=$xauth_path |
| 5186 |
AC_SUBST([XAUTH_PATH]) |
| 5187 |
fi |
| 5188 |
|
| 5189 |
dnl # --with-maildir=/path/to/mail gets top priority. |
| 5190 |
dnl # if maildir is set in the platform case statement above we use that. |
| 5191 |
dnl # Otherwise we run a program to get the dir from system headers. |
| 5192 |
dnl # We first look for _PATH_MAILDIR then MAILDIR then _PATH_MAIL |
| 5193 |
dnl # If we find _PATH_MAILDIR we do nothing because that is what |
| 5194 |
dnl # session.c expects anyway. Otherwise we set to the value found |
| 5195 |
dnl # stripping any trailing slash. If for some strage reason our program |
| 5196 |
dnl # does not find what it needs, we default to /var/spool/mail. |
| 5197 |
# Check for mail directory |
| 5198 |
AC_ARG_WITH([maildir], |
| 5199 |
[ --with-maildir=/path/to/mail Specify your system mail directory], |
| 5200 |
[ |
| 5201 |
if test "X$withval" != X && test "x$withval" != xno && \ |
| 5202 |
test "x${withval}" != xyes; then |
| 5203 |
AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$withval"], |
| 5204 |
[Set this to your mail directory if you do not have _PATH_MAILDIR]) |
| 5205 |
fi |
| 5206 |
],[ |
| 5207 |
if test "X$maildir" != "X"; then |
| 5208 |
AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"]) |
| 5209 |
else |
| 5210 |
AC_MSG_CHECKING([Discovering system mail directory]) |
| 5211 |
AC_RUN_IFELSE( |
| 5212 |
[AC_LANG_PROGRAM([[ |
| 5213 |
#include <stdio.h> |
| 5214 |
#include <stdlib.h> |
| 5215 |
#include <string.h> |
| 5216 |
#ifdef HAVE_PATHS_H |
| 5217 |
#include <paths.h> |
| 5218 |
#endif |
| 5219 |
#ifdef HAVE_MAILLOCK_H |
| 5220 |
#include <maillock.h> |
| 5221 |
#endif |
| 5222 |
#define DATA "conftest.maildir" |
| 5223 |
]], [[ |
| 5224 |
FILE *fd; |
| 5225 |
int rc; |
| 5226 |
|
| 5227 |
fd = fopen(DATA,"w"); |
| 5228 |
if(fd == NULL) |
| 5229 |
exit(1); |
| 5230 |
|
| 5231 |
#if defined (_PATH_MAILDIR) |
| 5232 |
if ((rc = fprintf(fd ,"_PATH_MAILDIR:%s\n", _PATH_MAILDIR)) <0) |
| 5233 |
exit(1); |
| 5234 |
#elif defined (MAILDIR) |
| 5235 |
if ((rc = fprintf(fd ,"MAILDIR:%s\n", MAILDIR)) <0) |
| 5236 |
exit(1); |
| 5237 |
#elif defined (_PATH_MAIL) |
| 5238 |
if ((rc = fprintf(fd ,"_PATH_MAIL:%s\n", _PATH_MAIL)) <0) |
| 5239 |
exit(1); |
| 5240 |
#else |
| 5241 |
exit (2); |
| 5242 |
#endif |
| 5243 |
|
| 5244 |
exit(0); |
| 5245 |
]])], |
| 5246 |
[ |
| 5247 |
maildir_what=`awk -F: '{print $1}' conftest.maildir` |
| 5248 |
maildir=`awk -F: '{print $2}' conftest.maildir \ |
| 5249 |
| sed 's|/$||'` |
| 5250 |
AC_MSG_RESULT([Using: $maildir from $maildir_what]) |
| 5251 |
if test "x$maildir_what" != "x_PATH_MAILDIR"; then |
| 5252 |
AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["$maildir"]) |
| 5253 |
fi |
| 5254 |
], |
| 5255 |
[ |
| 5256 |
if test "X$ac_status" = "X2";then |
| 5257 |
# our test program didn't find it. Default to /var/spool/mail |
| 5258 |
AC_MSG_RESULT([Using: default value of /var/spool/mail]) |
| 5259 |
AC_DEFINE_UNQUOTED([MAIL_DIRECTORY], ["/var/spool/mail"]) |
| 5260 |
else |
| 5261 |
AC_MSG_RESULT([*** not found ***]) |
| 5262 |
fi |
| 5263 |
], |
| 5264 |
[ |
| 5265 |
AC_MSG_WARN([cross compiling: use --with-maildir=/path/to/mail]) |
| 5266 |
] |
| 5267 |
) |
| 5268 |
fi |
| 5269 |
] |
| 5270 |
) # maildir |
| 5271 |
|
| 5272 |
if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then |
| 5273 |
AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test]) |
| 5274 |
disable_ptmx_check=yes |
| 5275 |
fi |
| 5276 |
if test -z "$no_dev_ptmx" ; then |
| 5277 |
if test "x$disable_ptmx_check" != "xyes" ; then |
| 5278 |
AC_CHECK_FILE(["/dev/ptmx"], |
| 5279 |
[ |
| 5280 |
AC_DEFINE_UNQUOTED([HAVE_DEV_PTMX], [1], |
| 5281 |
[Define if you have /dev/ptmx]) |
| 5282 |
have_dev_ptmx=1 |
| 5283 |
] |
| 5284 |
) |
| 5285 |
fi |
| 5286 |
fi |
| 5287 |
|
| 5288 |
if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then |
| 5289 |
AC_CHECK_FILE(["/dev/ptc"], |
| 5290 |
[ |
| 5291 |
AC_DEFINE_UNQUOTED([HAVE_DEV_PTS_AND_PTC], [1], |
| 5292 |
[Define if you have /dev/ptc]) |
| 5293 |
have_dev_ptc=1 |
| 5294 |
] |
| 5295 |
) |
| 5296 |
else |
| 5297 |
AC_MSG_WARN([cross compiling: Disabling /dev/ptc test]) |
| 5298 |
fi |
| 5299 |
|
| 5300 |
# Options from here on. Some of these are preset by platform above |
| 5301 |
AC_ARG_WITH([mantype], |
| 5302 |
[ --with-mantype=man|cat|doc Set man page type], |
| 5303 |
[ |
| 5304 |
case "$withval" in |
| 5305 |
man|cat|doc) |
| 5306 |
MANTYPE=$withval |
| 5307 |
;; |
| 5308 |
*) |
| 5309 |
AC_MSG_ERROR([invalid man type: $withval]) |
| 5310 |
;; |
| 5311 |
esac |
| 5312 |
] |
| 5313 |
) |
| 5314 |
if test -z "$MANTYPE"; then |
| 5315 |
if ${MANDOC} ${srcdir}/ssh.1 >/dev/null 2>&1; then |
| 5316 |
MANTYPE=doc |
| 5317 |
elif ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then |
| 5318 |
MANTYPE=doc |
| 5319 |
elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then |
| 5320 |
MANTYPE=man |
| 5321 |
else |
| 5322 |
MANTYPE=cat |
| 5323 |
fi |
| 5324 |
fi |
| 5325 |
AC_SUBST([MANTYPE]) |
| 5326 |
if test "$MANTYPE" = "doc"; then |
| 5327 |
mansubdir=man; |
| 5328 |
else |
| 5329 |
mansubdir=$MANTYPE; |
| 5330 |
fi |
| 5331 |
AC_SUBST([mansubdir]) |
| 5332 |
|
| 5333 |
# Whether to disable shadow password support |
| 5334 |
AC_ARG_WITH([shadow], |
| 5335 |
[ --without-shadow Disable shadow password support], |
| 5336 |
[ |
| 5337 |
if test "x$withval" = "xno" ; then |
| 5338 |
AC_DEFINE([DISABLE_SHADOW]) |
| 5339 |
disable_shadow=yes |
| 5340 |
fi |
| 5341 |
] |
| 5342 |
) |
| 5343 |
|
| 5344 |
if test -z "$disable_shadow" ; then |
| 5345 |
AC_MSG_CHECKING([if the systems has expire shadow information]) |
| 5346 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 5347 |
#include <sys/types.h> |
| 5348 |
#include <shadow.h> |
| 5349 |
struct spwd sp; |
| 5350 |
]], [[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ]])], |
| 5351 |
[ sp_expire_available=yes ], [ |
| 5352 |
]) |
| 5353 |
|
| 5354 |
if test "x$sp_expire_available" = "xyes" ; then |
| 5355 |
AC_MSG_RESULT([yes]) |
| 5356 |
AC_DEFINE([HAS_SHADOW_EXPIRE], [1], |
| 5357 |
[Define if you want to use shadow password expire field]) |
| 5358 |
else |
| 5359 |
AC_MSG_RESULT([no]) |
| 5360 |
fi |
| 5361 |
fi |
| 5362 |
|
| 5363 |
# Use ip address instead of hostname in $DISPLAY |
| 5364 |
if test ! -z "$IPADDR_IN_DISPLAY" ; then |
| 5365 |
DISPLAY_HACK_MSG="yes" |
| 5366 |
AC_DEFINE([IPADDR_IN_DISPLAY], [1], |
| 5367 |
[Define if you need to use IP address |
| 5368 |
instead of hostname in $DISPLAY]) |
| 5369 |
else |
| 5370 |
DISPLAY_HACK_MSG="no" |
| 5371 |
AC_ARG_WITH([ipaddr-display], |
| 5372 |
[ --with-ipaddr-display Use ip address instead of hostname in $DISPLAY], |
| 5373 |
[ |
| 5374 |
if test "x$withval" != "xno" ; then |
| 5375 |
AC_DEFINE([IPADDR_IN_DISPLAY]) |
| 5376 |
DISPLAY_HACK_MSG="yes" |
| 5377 |
fi |
| 5378 |
] |
| 5379 |
) |
| 5380 |
fi |
| 5381 |
|
| 5382 |
# check for /etc/default/login and use it if present. |
| 5383 |
AC_ARG_ENABLE([etc-default-login], |
| 5384 |
[ --disable-etc-default-login Disable using PATH from /etc/default/login [no]], |
| 5385 |
[ if test "x$enableval" = "xno"; then |
| 5386 |
AC_MSG_NOTICE([/etc/default/login handling disabled]) |
| 5387 |
etc_default_login=no |
| 5388 |
else |
| 5389 |
etc_default_login=yes |
| 5390 |
fi ], |
| 5391 |
[ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; |
| 5392 |
then |
| 5393 |
AC_MSG_WARN([cross compiling: not checking /etc/default/login]) |
| 5394 |
etc_default_login=no |
| 5395 |
else |
| 5396 |
etc_default_login=yes |
| 5397 |
fi ] |
| 5398 |
) |
| 5399 |
|
| 5400 |
if test "x$etc_default_login" != "xno"; then |
| 5401 |
AC_CHECK_FILE(["/etc/default/login"], |
| 5402 |
[ external_path_file=/etc/default/login ]) |
| 5403 |
if test "x$external_path_file" = "x/etc/default/login"; then |
| 5404 |
AC_DEFINE([HAVE_ETC_DEFAULT_LOGIN], [1], |
| 5405 |
[Define if your system has /etc/default/login]) |
| 5406 |
fi |
| 5407 |
fi |
| 5408 |
|
| 5409 |
dnl BSD systems use /etc/login.conf so --with-default-path= has no effect |
| 5410 |
if test $ac_cv_func_login_getcapbool = "yes" && \ |
| 5411 |
test $ac_cv_header_login_cap_h = "yes" ; then |
| 5412 |
external_path_file=/etc/login.conf |
| 5413 |
fi |
| 5414 |
|
| 5415 |
# Whether to mess with the default path |
| 5416 |
SERVER_PATH_MSG="(default)" |
| 5417 |
AC_ARG_WITH([default-path], |
| 5418 |
[ --with-default-path= Specify default $PATH environment for server], |
| 5419 |
[ |
| 5420 |
if test "x$external_path_file" = "x/etc/login.conf" ; then |
| 5421 |
AC_MSG_WARN([ |
| 5422 |
--with-default-path=PATH has no effect on this system. |
| 5423 |
Edit /etc/login.conf instead.]) |
| 5424 |
elif test "x$withval" != "xno" ; then |
| 5425 |
if test ! -z "$external_path_file" ; then |
| 5426 |
AC_MSG_WARN([ |
| 5427 |
--with-default-path=PATH will only be used if PATH is not defined in |
| 5428 |
$external_path_file .]) |
| 5429 |
fi |
| 5430 |
user_path="$withval" |
| 5431 |
SERVER_PATH_MSG="$withval" |
| 5432 |
fi |
| 5433 |
], |
| 5434 |
[ if test "x$external_path_file" = "x/etc/login.conf" ; then |
| 5435 |
AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf]) |
| 5436 |
else |
| 5437 |
if test ! -z "$external_path_file" ; then |
| 5438 |
AC_MSG_WARN([ |
| 5439 |
If PATH is defined in $external_path_file, ensure the path to scp is included, |
| 5440 |
otherwise scp will not work.]) |
| 5441 |
fi |
| 5442 |
AC_RUN_IFELSE( |
| 5443 |
[AC_LANG_PROGRAM([[ |
| 5444 |
/* find out what STDPATH is */ |
| 5445 |
#include <stdio.h> |
| 5446 |
#include <stdlib.h> |
| 5447 |
#ifdef HAVE_PATHS_H |
| 5448 |
# include <paths.h> |
| 5449 |
#endif |
| 5450 |
#ifndef _PATH_STDPATH |
| 5451 |
# ifdef _PATH_USERPATH /* Irix */ |
| 5452 |
# define _PATH_STDPATH _PATH_USERPATH |
| 5453 |
# else |
| 5454 |
# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" |
| 5455 |
# endif |
| 5456 |
#endif |
| 5457 |
#include <sys/types.h> |
| 5458 |
#include <sys/stat.h> |
| 5459 |
#include <fcntl.h> |
| 5460 |
#define DATA "conftest.stdpath" |
| 5461 |
]], [[ |
| 5462 |
FILE *fd; |
| 5463 |
int rc; |
| 5464 |
|
| 5465 |
fd = fopen(DATA,"w"); |
| 5466 |
if(fd == NULL) |
| 5467 |
exit(1); |
| 5468 |
|
| 5469 |
if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0) |
| 5470 |
exit(1); |
| 5471 |
|
| 5472 |
exit(0); |
| 5473 |
]])], |
| 5474 |
[ user_path=`cat conftest.stdpath` ], |
| 5475 |
[ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ], |
| 5476 |
[ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ] |
| 5477 |
) |
| 5478 |
# make sure $bindir is in USER_PATH so scp will work |
| 5479 |
t_bindir="${bindir}" |
| 5480 |
while echo "${t_bindir}" | egrep '\$\{|NONE/' >/dev/null 2>&1; do |
| 5481 |
t_bindir=`eval echo ${t_bindir}` |
| 5482 |
case $t_bindir in |
| 5483 |
NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;; |
| 5484 |
esac |
| 5485 |
case $t_bindir in |
| 5486 |
NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;; |
| 5487 |
esac |
| 5488 |
done |
| 5489 |
echo $user_path | grep ":$t_bindir" > /dev/null 2>&1 |
| 5490 |
if test $? -ne 0 ; then |
| 5491 |
echo $user_path | grep "^$t_bindir" > /dev/null 2>&1 |
| 5492 |
if test $? -ne 0 ; then |
| 5493 |
user_path=$user_path:$t_bindir |
| 5494 |
AC_MSG_RESULT([Adding $t_bindir to USER_PATH so scp will work]) |
| 5495 |
fi |
| 5496 |
fi |
| 5497 |
fi ] |
| 5498 |
) |
| 5499 |
if test "x$external_path_file" != "x/etc/login.conf" ; then |
| 5500 |
AC_DEFINE_UNQUOTED([USER_PATH], ["$user_path"], [Specify default $PATH]) |
| 5501 |
AC_SUBST([user_path]) |
| 5502 |
fi |
| 5503 |
|
| 5504 |
# Set superuser path separately to user path |
| 5505 |
AC_ARG_WITH([superuser-path], |
| 5506 |
[ --with-superuser-path= Specify different path for super-user], |
| 5507 |
[ |
| 5508 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 5509 |
test "x${withval}" != "xyes"; then |
| 5510 |
AC_DEFINE_UNQUOTED([SUPERUSER_PATH], ["$withval"], |
| 5511 |
[Define if you want a different $PATH |
| 5512 |
for the superuser]) |
| 5513 |
superuser_path=$withval |
| 5514 |
fi |
| 5515 |
] |
| 5516 |
) |
| 5517 |
|
| 5518 |
|
| 5519 |
AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses]) |
| 5520 |
IPV4_IN6_HACK_MSG="no" |
| 5521 |
AC_ARG_WITH(4in6, |
| 5522 |
[ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses], |
| 5523 |
[ |
| 5524 |
if test "x$withval" != "xno" ; then |
| 5525 |
AC_MSG_RESULT([yes]) |
| 5526 |
AC_DEFINE([IPV4_IN_IPV6], [1], |
| 5527 |
[Detect IPv4 in IPv6 mapped addresses |
| 5528 |
and treat as IPv4]) |
| 5529 |
IPV4_IN6_HACK_MSG="yes" |
| 5530 |
else |
| 5531 |
AC_MSG_RESULT([no]) |
| 5532 |
fi |
| 5533 |
], [ |
| 5534 |
if test "x$inet6_default_4in6" = "xyes"; then |
| 5535 |
AC_MSG_RESULT([yes (default)]) |
| 5536 |
AC_DEFINE([IPV4_IN_IPV6]) |
| 5537 |
IPV4_IN6_HACK_MSG="yes" |
| 5538 |
else |
| 5539 |
AC_MSG_RESULT([no (default)]) |
| 5540 |
fi |
| 5541 |
] |
| 5542 |
) |
| 5543 |
|
| 5544 |
# Whether to enable BSD auth support |
| 5545 |
BSD_AUTH_MSG=no |
| 5546 |
AC_ARG_WITH([bsd-auth], |
| 5547 |
[ --with-bsd-auth Enable BSD auth support], |
| 5548 |
[ |
| 5549 |
if test "x$withval" != "xno" ; then |
| 5550 |
AC_DEFINE([BSD_AUTH], [1], |
| 5551 |
[Define if you have BSD auth support]) |
| 5552 |
BSD_AUTH_MSG=yes |
| 5553 |
fi |
| 5554 |
] |
| 5555 |
) |
| 5556 |
|
| 5557 |
# Where to place sshd.pid |
| 5558 |
piddir=/var/run |
| 5559 |
# make sure the directory exists |
| 5560 |
if test ! -d $piddir ; then |
| 5561 |
piddir=`eval echo ${sysconfdir}` |
| 5562 |
case $piddir in |
| 5563 |
NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;; |
| 5564 |
esac |
| 5565 |
fi |
| 5566 |
|
| 5567 |
AC_ARG_WITH([pid-dir], |
| 5568 |
[ --with-pid-dir=PATH Specify location of sshd.pid file], |
| 5569 |
[ |
| 5570 |
if test -n "$withval" && test "x$withval" != "xno" && \ |
| 5571 |
test "x${withval}" != "xyes"; then |
| 5572 |
piddir=$withval |
| 5573 |
if test ! -d $piddir ; then |
| 5574 |
AC_MSG_WARN([** no $piddir directory on this system **]) |
| 5575 |
fi |
| 5576 |
fi |
| 5577 |
] |
| 5578 |
) |
| 5579 |
|
| 5580 |
AC_DEFINE_UNQUOTED([_PATH_SSH_PIDDIR], ["$piddir"], |
| 5581 |
[Specify location of ssh.pid]) |
| 5582 |
AC_SUBST([piddir]) |
| 5583 |
|
| 5584 |
|
| 5585 |
AC_ARG_ENABLE([fd-passing], |
| 5586 |
[ --disable-fd-passing disable file descriptor passsing [no]], |
| 5587 |
[ |
| 5588 |
if test "x$enableval" = "xno" ; then |
| 5589 |
AC_DEFINE([DISABLE_FD_PASSING]) |
| 5590 |
fi |
| 5591 |
] |
| 5592 |
) |
| 5593 |
|
| 5594 |
dnl allow user to disable some login recording features |
| 5595 |
AC_ARG_ENABLE([lastlog], |
| 5596 |
[ --disable-lastlog disable use of lastlog even if detected [no]], |
| 5597 |
[ |
| 5598 |
if test "x$enableval" = "xno" ; then |
| 5599 |
AC_DEFINE([DISABLE_LASTLOG]) |
| 5600 |
fi |
| 5601 |
] |
| 5602 |
) |
| 5603 |
AC_ARG_ENABLE([utmp], |
| 5604 |
[ --disable-utmp disable use of utmp even if detected [no]], |
| 5605 |
[ |
| 5606 |
if test "x$enableval" = "xno" ; then |
| 5607 |
AC_DEFINE([DISABLE_UTMP]) |
| 5608 |
fi |
| 5609 |
] |
| 5610 |
) |
| 5611 |
AC_ARG_ENABLE([utmpx], |
| 5612 |
[ --disable-utmpx disable use of utmpx even if detected [no]], |
| 5613 |
[ |
| 5614 |
if test "x$enableval" = "xno" ; then |
| 5615 |
AC_DEFINE([DISABLE_UTMPX], [1], |
| 5616 |
[Define if you don't want to use utmpx]) |
| 5617 |
fi |
| 5618 |
] |
| 5619 |
) |
| 5620 |
AC_ARG_ENABLE([wtmp], |
| 5621 |
[ --disable-wtmp disable use of wtmp even if detected [no]], |
| 5622 |
[ |
| 5623 |
if test "x$enableval" = "xno" ; then |
| 5624 |
AC_DEFINE([DISABLE_WTMP]) |
| 5625 |
fi |
| 5626 |
] |
| 5627 |
) |
| 5628 |
AC_ARG_ENABLE([wtmpx], |
| 5629 |
[ --disable-wtmpx disable use of wtmpx even if detected [no]], |
| 5630 |
[ |
| 5631 |
if test "x$enableval" = "xno" ; then |
| 5632 |
AC_DEFINE([DISABLE_WTMPX], [1], |
| 5633 |
[Define if you don't want to use wtmpx]) |
| 5634 |
fi |
| 5635 |
] |
| 5636 |
) |
| 5637 |
AC_ARG_ENABLE([libutil], |
| 5638 |
[ --disable-libutil disable use of libutil (login() etc.) [no]], |
| 5639 |
[ |
| 5640 |
if test "x$enableval" = "xno" ; then |
| 5641 |
AC_DEFINE([DISABLE_LOGIN]) |
| 5642 |
fi |
| 5643 |
] |
| 5644 |
) |
| 5645 |
AC_ARG_ENABLE([pututline], |
| 5646 |
[ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]], |
| 5647 |
[ |
| 5648 |
if test "x$enableval" = "xno" ; then |
| 5649 |
AC_DEFINE([DISABLE_PUTUTLINE], [1], |
| 5650 |
[Define if you don't want to use pututline() |
| 5651 |
etc. to write [uw]tmp]) |
| 5652 |
fi |
| 5653 |
] |
| 5654 |
) |
| 5655 |
AC_ARG_ENABLE([pututxline], |
| 5656 |
[ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]], |
| 5657 |
[ |
| 5658 |
if test "x$enableval" = "xno" ; then |
| 5659 |
AC_DEFINE([DISABLE_PUTUTXLINE], [1], |
| 5660 |
[Define if you don't want to use pututxline() |
| 5661 |
etc. to write [uw]tmpx]) |
| 5662 |
fi |
| 5663 |
] |
| 5664 |
) |
| 5665 |
AC_ARG_WITH([lastlog], |
| 5666 |
[ --with-lastlog=FILE|DIR specify lastlog location [common locations]], |
| 5667 |
[ |
| 5668 |
if test "x$withval" = "xno" ; then |
| 5669 |
AC_DEFINE([DISABLE_LASTLOG]) |
| 5670 |
elif test -n "$withval" && test "x${withval}" != "xyes"; then |
| 5671 |
conf_lastlog_location=$withval |
| 5672 |
fi |
| 5673 |
] |
| 5674 |
) |
| 5675 |
|
| 5676 |
dnl lastlog, [uw]tmpx? detection |
| 5677 |
dnl NOTE: set the paths in the platform section to avoid the |
| 5678 |
dnl need for command-line parameters |
| 5679 |
dnl lastlog and [uw]tmp are subject to a file search if all else fails |
| 5680 |
|
| 5681 |
dnl lastlog detection |
| 5682 |
dnl NOTE: the code itself will detect if lastlog is a directory |
| 5683 |
AC_MSG_CHECKING([if your system defines LASTLOG_FILE]) |
| 5684 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 5685 |
#include <sys/types.h> |
| 5686 |
#include <utmp.h> |
| 5687 |
#ifdef HAVE_LASTLOG_H |
| 5688 |
# include <lastlog.h> |
| 5689 |
#endif |
| 5690 |
#ifdef HAVE_PATHS_H |
| 5691 |
# include <paths.h> |
| 5692 |
#endif |
| 5693 |
#ifdef HAVE_LOGIN_H |
| 5694 |
# include <login.h> |
| 5695 |
#endif |
| 5696 |
]], [[ char *lastlog = LASTLOG_FILE; ]])], |
| 5697 |
[ AC_MSG_RESULT([yes]) ], |
| 5698 |
[ |
| 5699 |
AC_MSG_RESULT([no]) |
| 5700 |
AC_MSG_CHECKING([if your system defines _PATH_LASTLOG]) |
| 5701 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 5702 |
#include <sys/types.h> |
| 5703 |
#include <utmp.h> |
| 5704 |
#ifdef HAVE_LASTLOG_H |
| 5705 |
# include <lastlog.h> |
| 5706 |
#endif |
| 5707 |
#ifdef HAVE_PATHS_H |
| 5708 |
# include <paths.h> |
| 5709 |
#endif |
| 5710 |
]], [[ char *lastlog = _PATH_LASTLOG; ]])], |
| 5711 |
[ AC_MSG_RESULT([yes]) ], |
| 5712 |
[ |
| 5713 |
AC_MSG_RESULT([no]) |
| 5714 |
system_lastlog_path=no |
| 5715 |
]) |
| 5716 |
]) |
| 5717 |
|
| 5718 |
if test -z "$conf_lastlog_location"; then |
| 5719 |
if test x"$system_lastlog_path" = x"no" ; then |
| 5720 |
for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do |
| 5721 |
if (test -d "$f" || test -f "$f") ; then |
| 5722 |
conf_lastlog_location=$f |
| 5723 |
fi |
| 5724 |
done |
| 5725 |
if test -z "$conf_lastlog_location"; then |
| 5726 |
AC_MSG_WARN([** Cannot find lastlog **]) |
| 5727 |
dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx |
| 5728 |
fi |
| 5729 |
fi |
| 5730 |
fi |
| 5731 |
|
| 5732 |
if test -n "$conf_lastlog_location"; then |
| 5733 |
AC_DEFINE_UNQUOTED([CONF_LASTLOG_FILE], ["$conf_lastlog_location"], |
| 5734 |
[Define if you want to specify the path to your lastlog file]) |
| 5735 |
fi |
| 5736 |
|
| 5737 |
dnl utmp detection |
| 5738 |
AC_MSG_CHECKING([if your system defines UTMP_FILE]) |
| 5739 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 5740 |
#include <sys/types.h> |
| 5741 |
#include <utmp.h> |
| 5742 |
#ifdef HAVE_PATHS_H |
| 5743 |
# include <paths.h> |
| 5744 |
#endif |
| 5745 |
]], [[ char *utmp = UTMP_FILE; ]])], |
| 5746 |
[ AC_MSG_RESULT([yes]) ], |
| 5747 |
[ AC_MSG_RESULT([no]) |
| 5748 |
system_utmp_path=no |
| 5749 |
]) |
| 5750 |
if test -z "$conf_utmp_location"; then |
| 5751 |
if test x"$system_utmp_path" = x"no" ; then |
| 5752 |
for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do |
| 5753 |
if test -f $f ; then |
| 5754 |
conf_utmp_location=$f |
| 5755 |
fi |
| 5756 |
done |
| 5757 |
if test -z "$conf_utmp_location"; then |
| 5758 |
AC_DEFINE([DISABLE_UTMP]) |
| 5759 |
fi |
| 5760 |
fi |
| 5761 |
fi |
| 5762 |
if test -n "$conf_utmp_location"; then |
| 5763 |
AC_DEFINE_UNQUOTED([CONF_UTMP_FILE], ["$conf_utmp_location"], |
| 5764 |
[Define if you want to specify the path to your utmp file]) |
| 5765 |
fi |
| 5766 |
|
| 5767 |
dnl wtmp detection |
| 5768 |
AC_MSG_CHECKING([if your system defines WTMP_FILE]) |
| 5769 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 5770 |
#include <sys/types.h> |
| 5771 |
#include <utmp.h> |
| 5772 |
#ifdef HAVE_PATHS_H |
| 5773 |
# include <paths.h> |
| 5774 |
#endif |
| 5775 |
]], [[ char *wtmp = WTMP_FILE; ]])], |
| 5776 |
[ AC_MSG_RESULT([yes]) ], |
| 5777 |
[ AC_MSG_RESULT([no]) |
| 5778 |
system_wtmp_path=no |
| 5779 |
]) |
| 5780 |
if test -z "$conf_wtmp_location"; then |
| 5781 |
if test x"$system_wtmp_path" = x"no" ; then |
| 5782 |
for f in /usr/adm/wtmp /var/log/wtmp; do |
| 5783 |
if test -f $f ; then |
| 5784 |
conf_wtmp_location=$f |
| 5785 |
fi |
| 5786 |
done |
| 5787 |
if test -z "$conf_wtmp_location"; then |
| 5788 |
AC_DEFINE([DISABLE_WTMP]) |
| 5789 |
fi |
| 5790 |
fi |
| 5791 |
fi |
| 5792 |
if test -n "$conf_wtmp_location"; then |
| 5793 |
AC_DEFINE_UNQUOTED([CONF_WTMP_FILE], ["$conf_wtmp_location"], |
| 5794 |
[Define if you want to specify the path to your wtmp file]) |
| 5795 |
fi |
| 5796 |
|
| 5797 |
dnl wtmpx detection |
| 5798 |
AC_MSG_CHECKING([if your system defines WTMPX_FILE]) |
| 5799 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
| 5800 |
#include <sys/types.h> |
| 5801 |
#include <utmp.h> |
| 5802 |
#ifdef HAVE_UTMPX_H |
| 5803 |
#include <utmpx.h> |
| 5804 |
#endif |
| 5805 |
#ifdef HAVE_PATHS_H |
| 5806 |
# include <paths.h> |
| 5807 |
#endif |
| 5808 |
]], [[ char *wtmpx = WTMPX_FILE; ]])], |
| 5809 |
[ AC_MSG_RESULT([yes]) ], |
| 5810 |
[ AC_MSG_RESULT([no]) |
| 5811 |
system_wtmpx_path=no |
| 5812 |
]) |
| 5813 |
if test -z "$conf_wtmpx_location"; then |
| 5814 |
if test x"$system_wtmpx_path" = x"no" ; then |
| 5815 |
AC_DEFINE([DISABLE_WTMPX]) |
| 5816 |
fi |
| 5817 |
else |
| 5818 |
AC_DEFINE_UNQUOTED([CONF_WTMPX_FILE], ["$conf_wtmpx_location"], |
| 5819 |
[Define if you want to specify the path to your wtmpx file]) |
| 5820 |
fi |
| 5821 |
|
| 5822 |
|
| 5823 |
if test ! -z "$blibpath" ; then |
| 5824 |
LDFLAGS="$LDFLAGS $blibflags$blibpath" |
| 5825 |
AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile]) |
| 5826 |
fi |
| 5827 |
|
| 5828 |
AC_CHECK_MEMBER([struct lastlog.ll_line], [], [ |
| 5829 |
if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then |
| 5830 |
AC_DEFINE([DISABLE_LASTLOG]) |
| 5831 |
fi |
| 5832 |
], [ |
| 5833 |
#ifdef HAVE_SYS_TYPES_H |
| 5834 |
#include <sys/types.h> |
| 5835 |
#endif |
| 5836 |
#ifdef HAVE_UTMP_H |
| 5837 |
#include <utmp.h> |
| 5838 |
#endif |
| 5839 |
#ifdef HAVE_UTMPX_H |
| 5840 |
#include <utmpx.h> |
| 5841 |
#endif |
| 5842 |
#ifdef HAVE_LASTLOG_H |
| 5843 |
#include <lastlog.h> |
| 5844 |
#endif |
| 5845 |
]) |
| 5846 |
|
| 5847 |
AC_CHECK_MEMBER([struct utmp.ut_line], [], [ |
| 5848 |
AC_DEFINE([DISABLE_UTMP]) |
| 5849 |
AC_DEFINE([DISABLE_WTMP]) |
| 5850 |
], [ |
| 5851 |
#ifdef HAVE_SYS_TYPES_H |
| 5852 |
#include <sys/types.h> |
| 5853 |
#endif |
| 5854 |
#ifdef HAVE_UTMP_H |
| 5855 |
#include <utmp.h> |
| 5856 |
#endif |
| 5857 |
#ifdef HAVE_UTMPX_H |
| 5858 |
#include <utmpx.h> |
| 5859 |
#endif |
| 5860 |
#ifdef HAVE_LASTLOG_H |
| 5861 |
#include <lastlog.h> |
| 5862 |
#endif |
| 5863 |
]) |
| 5864 |
|
| 5865 |
dnl Adding -Werror to CFLAGS early prevents configure tests from running. |
| 5866 |
dnl Add now. |
| 5867 |
CFLAGS="$CFLAGS $werror_flags" |
| 5868 |
|
| 5869 |
if test "x$ac_cv_func_getaddrinfo" != "xyes" ; then |
| 5870 |
TEST_SSH_IPV6=no |
| 5871 |
else |
| 5872 |
TEST_SSH_IPV6=yes |
| 5873 |
fi |
| 5874 |
AC_CHECK_DECL([BROKEN_GETADDRINFO], [TEST_SSH_IPV6=no]) |
| 5875 |
AC_SUBST([TEST_SSH_IPV6], [$TEST_SSH_IPV6]) |
| 5876 |
AC_SUBST([TEST_SSH_UTF8], [$TEST_SSH_UTF8]) |
| 5877 |
AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS]) |
| 5878 |
AC_SUBST([UNSUPPORTED_ALGORITHMS], [$unsupported_algorithms]) |
| 5879 |
AC_SUBST([DEPEND], [$(cat $srcdir/.depend)]) |
| 5880 |
|
| 5881 |
# Binaries for interop tests. |
| 5882 |
AC_PATH_PROG([PLINK], [plink]) |
| 5883 |
AC_PATH_PROG([PUTTYGEN], [puttygen]) |
| 5884 |
AC_PATH_PROG([CONCH], [conch]) |
| 5885 |
AC_PATH_PROG([DROPBEAR], [dropbear]) |
| 5886 |
AC_PATH_PROG([DBCLIENT], [dbclient]) |
| 5887 |
AC_PATH_PROG([DROPBEARKEY], [dropbearkey]) |
| 5888 |
AC_PATH_PROG([DROPBEARCONVERT], [dropbearconvert]) |
| 5889 |
AC_PATH_PROG([TMUX], [tmux]) |
| 5890 |
|
| 5891 |
CFLAGS="${CFLAGS} ${CFLAGS_AFTER}" |
| 5892 |
LDFLAGS="${LDFLAGS} ${LDFLAGS_AFTER}" |
| 5893 |
|
| 5894 |
# Make a copy of CFLAGS/LDFLAGS without PIE options. |
| 5895 |
LDFLAGS_NOPIE=`echo "$LDFLAGS" | sed 's/^-pie //;s/ -pie//g'` |
| 5896 |
CFLAGS_NOPIE=`echo "$CFLAGS" | sed 's/^-fPIE //;s/ -fPIE//g'` |
| 5897 |
AC_SUBST([LDFLAGS_NOPIE]) |
| 5898 |
AC_SUBST([CFLAGS_NOPIE]) |
| 5899 |
AC_SUBST([COMPATINCLUDES]) |
| 5900 |
|
| 5901 |
AC_EXEEXT |
| 5902 |
AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \ |
| 5903 |
openbsd-compat/Makefile openbsd-compat/regress/Makefile \ |
| 5904 |
survey.sh]) |
| 5905 |
AC_OUTPUT |
| 5906 |
|
| 5907 |
# Print summary of options |
| 5908 |
|
| 5909 |
# Someone please show me a better way :) |
| 5910 |
A=`eval echo ${prefix}` ; A=`eval echo ${A}` |
| 5911 |
B=`eval echo ${bindir}` ; B=`eval echo ${B}` |
| 5912 |
C=`eval echo ${sbindir}` ; C=`eval echo ${C}` |
| 5913 |
D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}` |
| 5914 |
E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}` |
| 5915 |
F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}` |
| 5916 |
G=`eval echo ${piddir}` ; G=`eval echo ${G}` |
| 5917 |
H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}` |
| 5918 |
I=`eval echo ${user_path}` ; I=`eval echo ${I}` |
| 5919 |
J=`eval echo ${superuser_path}` ; J=`eval echo ${J}` |
| 5920 |
|
| 5921 |
echo "" |
| 5922 |
echo "OpenSSH has been configured with the following options:" |
| 5923 |
echo " User binaries: $B" |
| 5924 |
echo " System binaries: $C" |
| 5925 |
echo " Configuration files: $D" |
| 5926 |
echo " Askpass program: $E" |
| 5927 |
echo " Manual pages: $F" |
| 5928 |
echo " PID file: $G" |
| 5929 |
echo " Privilege separation chroot path: $H" |
| 5930 |
if test "x$external_path_file" = "x/etc/login.conf" ; then |
| 5931 |
echo " At runtime, sshd will use the path defined in $external_path_file" |
| 5932 |
echo " Make sure the path to scp is present, otherwise scp will not work" |
| 5933 |
else |
| 5934 |
echo " sshd default user PATH: $I" |
| 5935 |
if test ! -z "$external_path_file"; then |
| 5936 |
echo " (If PATH is set in $external_path_file it will be used instead. If" |
| 5937 |
echo " used, ensure the path to scp is present, otherwise scp will not work.)" |
| 5938 |
fi |
| 5939 |
fi |
| 5940 |
if test ! -z "$superuser_path" ; then |
| 5941 |
echo " sshd superuser user PATH: $J" |
| 5942 |
fi |
| 5943 |
echo " Manpage format: $MANTYPE" |
| 5944 |
echo " PAM support: $PAM_MSG" |
| 5945 |
echo " OSF SIA support: $SIA_MSG" |
| 5946 |
echo " KerberosV support: $KRB5_MSG" |
| 5947 |
echo " SELinux support: $SELINUX_MSG" |
| 5948 |
echo " libedit support: $LIBEDIT_MSG" |
| 5949 |
echo " libldns support: $LDNS_MSG" |
| 5950 |
echo " Solaris process contract support: $SPC_MSG" |
| 5951 |
echo " Solaris project support: $SP_MSG" |
| 5952 |
echo " Solaris privilege support: $SPP_MSG" |
| 5953 |
echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" |
| 5954 |
echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" |
| 5955 |
echo " BSD Auth support: $BSD_AUTH_MSG" |
| 5956 |
echo " Random number source: $RAND_MSG" |
| 5957 |
echo " Privsep sandbox style: $SANDBOX_STYLE" |
| 5958 |
echo " PKCS#11 support: $enable_pkcs11" |
| 5959 |
echo " U2F/FIDO support: $enable_sk" |
| 5960 |
|
| 5961 |
echo "" |
| 5962 |
|
| 5963 |
echo " Host: ${host}" |
| 5964 |
echo " Compiler: ${CC}" |
| 5965 |
echo " Compiler flags: ${CFLAGS}" |
| 5966 |
echo "Preprocessor flags: ${CPPFLAGS}" |
| 5967 |
echo " Linker flags: ${LDFLAGS}" |
| 5968 |
echo " Libraries: ${LIBS}" |
| 5969 |
if test ! -z "${CHANNELLIBS}"; then |
| 5970 |
echo " +for channels: ${CHANNELLIBS}" |
| 5971 |
fi |
| 5972 |
if test ! -z "${LIBFIDO2}"; then |
| 5973 |
echo " +for FIDO2: ${LIBFIDO2}" |
| 5974 |
fi |
| 5975 |
if test ! -z "${SSHDLIBS}"; then |
| 5976 |
echo " +for sshd: ${SSHDLIBS}" |
| 5977 |
fi |
| 5978 |
|
| 5979 |
echo "" |
| 5980 |
|
| 5981 |
if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then |
| 5982 |
echo "SVR4 style packages are supported with \"make package\"" |
| 5983 |
echo "" |
| 5984 |
fi |
| 5985 |
|
| 5986 |
if test "x$PAM_MSG" = "xyes" ; then |
| 5987 |
echo "PAM is enabled. You may need to install a PAM control file " |
| 5988 |
echo "for sshd, otherwise password authentication may fail. " |
| 5989 |
echo "Example PAM control files can be found in the contrib/ " |
| 5990 |
echo "subdirectory" |
| 5991 |
echo "" |
| 5992 |
fi |
| 5993 |
|
| 5994 |
if test ! -z "$NO_PEERCHECK" ; then |
| 5995 |
echo "WARNING: the operating system that you are using does not" |
| 5996 |
echo "appear to support getpeereid(), getpeerucred() or the" |
| 5997 |
echo "SO_PEERCRED getsockopt() option. These facilities are used to" |
| 5998 |
echo "enforce security checks to prevent unauthorised connections to" |
| 5999 |
echo "ssh-agent. Their absence increases the risk that a malicious" |
| 6000 |
echo "user can connect to your agent." |
| 6001 |
echo "" |
| 6002 |
fi |
| 6003 |
|
| 6004 |
if test "$AUDIT_MODULE" = "bsm" ; then |
| 6005 |
echo "WARNING: BSM audit support is currently considered EXPERIMENTAL." |
| 6006 |
echo "See the Solaris section in README.platform for details." |
| 6007 |
fi |