| 1 |
# Process this file with autoconf to produce a configure script. |
| 2 |
m4_include([build-aux/m4/zw_automodern.m4]) |
| 3 |
AC_INIT([xcrypt], |
| 4 |
[4.5.3], |
| 5 |
[https://github.com/besser82/libxcrypt/issues], |
| 6 |
[libxcrypt], |
| 7 |
[https://github.com/besser82/libxcrypt]) |
| 8 |
AC_CONFIG_MACRO_DIR([build-aux/m4]) |
| 9 |
AC_CONFIG_AUX_DIR([build-aux/m4-autogen]) |
| 10 |
AC_CONFIG_SRCDIR([lib/crypt.c]) |
| 11 |
AC_CONFIG_HEADERS([config.h]) |
| 12 |
AC_CONFIG_FILES([ |
| 13 |
Makefile |
| 14 |
libxcrypt.pc:lib/libxcrypt.pc.in |
| 15 |
]) |
| 16 |
AM_INIT_AUTOMAKE([tar-v7]) |
| 17 |
|
| 18 |
AH_TOP( |
| 19 |
[#ifndef _CRYPT_CONFIG_H |
| 20 |
#define _CRYPT_CONFIG_H 1]) |
| 21 |
AH_BOTTOM( |
| 22 |
[#endif /* config.h */]) |
| 23 |
|
| 24 |
# PKG_INSTALLDIR may not be defined, but we have a |
| 25 |
# compatibility replacement. |
| 26 |
m4_pattern_allow([PKG_INSTALLDIR]) |
| 27 |
PKG_PROG_PKG_CONFIG_COMPAT([0.27], [PKG_CONFIG=false]) |
| 28 |
AS_IF([test x"$PKG_CONFIG" != xfalse], |
| 29 |
[PKG_INSTALLDIR], |
| 30 |
[PKG_INSTALLDIR_COMPAT]) |
| 31 |
|
| 32 |
# Checks for programs. |
| 33 |
AC_CANONICAL_HOST |
| 34 |
AC_PROG_CC |
| 35 |
|
| 36 |
# C99 language and library features are used unconditionally. |
| 37 |
# Don't even try to build with an older compiler. |
| 38 |
case "$ac_prog_cc_stdc" in |
| 39 |
c89 | no) AC_MSG_ERROR([a C99- or C11-compliant compiler is required]) ;; |
| 40 |
esac |
| 41 |
|
| 42 |
AC_PROG_CPP |
| 43 |
AC_PROG_MAKE_SET |
| 44 |
AC_PROG_LN_S |
| 45 |
zw_PROG_PERL([5.14.0]) |
| 46 |
AC_PATH_PROG([GPG2], [gpg2], [false]) |
| 47 |
AC_PATH_PROG([SHA256SUM], [sha256sum], [false]) |
| 48 |
|
| 49 |
AC_USE_SYSTEM_EXTENSIONS |
| 50 |
AC_SYS_LARGEFILE |
| 51 |
zw_SIMPLE_ENABLE_WARNINGS |
| 52 |
LT_INIT |
| 53 |
|
| 54 |
# The test scripts need to know whether C global symbols have a |
| 55 |
# leading underscore. |
| 56 |
LT_SYS_SYMBOL_USCORE |
| 57 |
if test x$sys_symbol_underscore = xno; then |
| 58 |
SYMBOL_PREFIX= |
| 59 |
else |
| 60 |
SYMBOL_PREFIX=_ |
| 61 |
fi |
| 62 |
AC_SUBST([SYMBOL_PREFIX]) |
| 63 |
|
| 64 |
# One of the test scripts needs to use -dD. |
| 65 |
AC_CACHE_CHECK([whether the preprocessor ($CPP) supports -dD], |
| 66 |
[ac_cv_prog_cpp_dD], |
| 67 |
[printf '#include <errno.h>' | |
| 68 |
$CPP -dD -xc - > conftest.i 2>&AS_MESSAGE_LOG_FD |
| 69 |
if test $? -ne 0; then |
| 70 |
ac_cv_prog_cpp_dD=no |
| 71 |
elif grep '#define EDOM' conftest.i > /dev/null 2>&1; then |
| 72 |
ac_cv_prog_cpp_dD=yes |
| 73 |
else |
| 74 |
ac_cv_prog_cpp_dD=no |
| 75 |
fi |
| 76 |
rm -f conftest.i |
| 77 |
]) |
| 78 |
AC_SUBST([HAVE_CPP_dD], [$ac_cv_prog_cpp_dD]) |
| 79 |
|
| 80 |
# Some of the tests need to be conditionally compiled depending on |
| 81 |
# whether ASan is active. |
| 82 |
AC_CACHE_CHECK([whether we are compiling with ASan], |
| 83 |
[ac_cv_c_address_sanitizer], |
| 84 |
[zw_ASAN_IFELSE( |
| 85 |
[ac_cv_c_address_sanitizer=yes], |
| 86 |
[ac_cv_c_address_sanitizer=no])]) |
| 87 |
if test x$ac_cv_c_address_sanitizer = xyes; then |
| 88 |
AC_DEFINE([XCRYPT_USE_ASAN], [1], |
| 89 |
[Define when compiling with ASan. Only affects tests.]) |
| 90 |
fi |
| 91 |
|
| 92 |
# Checks for libraries: currently none needed. |
| 93 |
|
| 94 |
# Checks for header files. |
| 95 |
AC_CHECK_HEADERS_ONCE([ |
| 96 |
fcntl.h |
| 97 |
stdbool.h |
| 98 |
ucontext.h |
| 99 |
sys/cdefs.h |
| 100 |
sys/random.h |
| 101 |
sys/syscall.h |
| 102 |
valgrind/valgrind.h |
| 103 |
]) |
| 104 |
|
| 105 |
# stdint.h and inttypes.h were checked for by AC_INCLUDES_DEFAULT, |
| 106 |
# invoked implicitly by the above. |
| 107 |
if test $ac_cv_header_stdbool_h != yes || |
| 108 |
test $ac_cv_header_stdint_h != yes || |
| 109 |
test $ac_cv_header_inttypes_h != yes; then |
| 110 |
AC_MSG_ERROR([a C99- or C11-compliant runtime library is required]) |
| 111 |
fi |
| 112 |
|
| 113 |
# Checks for the specific things that we need from sys/cdefs.h, which |
| 114 |
# might or might not be there (there's no standard for this header). |
| 115 |
AS_IF([test $ac_cv_header_sys_cdefs_h = yes], |
| 116 |
[AC_CACHE_CHECK([whether sys/cdefs.h defines __BEGIN_DECLS and __END_DECLS], |
| 117 |
[ac_cv_header_sys_cdefs_begin_end_decls], [ |
| 118 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 119 |
#include <sys/cdefs.h> |
| 120 |
__BEGIN_DECLS |
| 121 |
extern int foo(void); |
| 122 |
__END_DECLS |
| 123 |
]])], |
| 124 |
[ac_cv_header_sys_cdefs_begin_end_decls=yes], |
| 125 |
[ac_cv_header_sys_cdefs_begin_end_decls=no]) |
| 126 |
]) |
| 127 |
AC_CACHE_CHECK([whether sys/cdefs.h defines __THROW], |
| 128 |
[ac_cv_header_sys_cdefs_THROW], [ |
| 129 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
| 130 |
#include <sys/cdefs.h> |
| 131 |
extern void foo(void) __THROW; |
| 132 |
]])], |
| 133 |
[ac_cv_header_sys_cdefs_THROW=yes], |
| 134 |
[ac_cv_header_sys_cdefs_THROW=no]) |
| 135 |
])], |
| 136 |
dnl AS_IF else |
| 137 |
[ac_cv_header_sys_cdefs_begin_end_decls=no |
| 138 |
ac_cv_header_sys_cdefs_THROW=no]) |
| 139 |
|
| 140 |
if test $ac_cv_header_sys_cdefs_begin_end_decls = yes; then |
| 141 |
AC_DEFINE([HAVE_SYS_CDEFS_BEGIN_END_DECLS], 1, |
| 142 |
[Define if <sys/cdefs.h> defines __BEGIN_DECLS and __END_DECLS.]) |
| 143 |
fi |
| 144 |
if test $ac_cv_header_sys_cdefs_THROW = yes; then |
| 145 |
AC_DEFINE([HAVE_SYS_CDEFS_THROW], 1, |
| 146 |
[Define if <sys/cdefs.h> defines __THROW.]) |
| 147 |
fi |
| 148 |
|
| 149 |
# Checks for typedefs, structures, and compiler characteristics. |
| 150 |
zw_C_ALIGNAS |
| 151 |
zw_C_ALIGNOF |
| 152 |
zw_C_MAX_ALIGN_T |
| 153 |
zw_C_ENDIANNESS |
| 154 |
zw_C_STATIC_ASSERT |
| 155 |
zw_PROG_LD_WRAP |
| 156 |
AX_CHECK_VSCRIPT |
| 157 |
AX_GCC_FUNC_ATTRIBUTE(symver) |
| 158 |
|
| 159 |
# FIXME: This only checks whether the linker accepts either |
| 160 |
# -Wl,-z,defs or -Wl,--no-undefined. It doesn't check that the switch |
| 161 |
# actually does what we want it to do. |
| 162 |
AC_CACHE_CHECK([how to make linking fail when undefined symbols remain], |
| 163 |
[ac_cv_ld_no_undefined], [ |
| 164 |
ac_cv_ld_no_undefined=unknown |
| 165 |
SAVED_LDFLAGS="$LDFLAGS" |
| 166 |
LDFLAGS="$SAVED_LDFLAGS -Wl,-z,defs" |
| 167 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])], |
| 168 |
[ac_cv_ld_no_undefined=-Wl,-z,defs]) |
| 169 |
if test "x$ac_cv_ld_no_undefined" = xunknown; then |
| 170 |
LDFLAGS="$SAVED_LDFLAGS -Wl,--no-undefined" |
| 171 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])], |
| 172 |
[ac_cv_ld_no_undefined=-Wl,--no-undefined]) |
| 173 |
fi |
| 174 |
LDFLAGS="$SAVED_LDFLAGS"]) |
| 175 |
|
| 176 |
UNDEF_FLAG= |
| 177 |
if test "x$ac_cv_ld_no_undefined" != xunknown; then |
| 178 |
UNDEF_FLAG="$ac_cv_ld_no_undefined" |
| 179 |
fi |
| 180 |
AC_SUBST([UNDEF_FLAG]) |
| 181 |
|
| 182 |
# FIXME: This only checks whether the linker accepts -Wl,-z,text. |
| 183 |
# It doesn't check that the switch actually does what we want it to do. |
| 184 |
AC_CACHE_CHECK([how to make linking fail when there are text relocations], |
| 185 |
[ac_cv_ld_no_textrel], [ |
| 186 |
ac_cv_ld_no_textrel=unknown |
| 187 |
SAVED_LDFLAGS="$LDFLAGS" |
| 188 |
LDFLAGS="$SAVED_LDFLAGS -Wl,-z,text" |
| 189 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])], |
| 190 |
[ac_cv_ld_no_textrel=-Wl,-z,text]) |
| 191 |
LDFLAGS="$SAVED_LDFLAGS"]) |
| 192 |
|
| 193 |
TEXT_RELOC_FLAG= |
| 194 |
if test "x$ac_cv_ld_no_textrel" != xunknown; then |
| 195 |
TEXT_RELOC_FLAG="$ac_cv_ld_no_textrel" |
| 196 |
fi |
| 197 |
AC_SUBST([TEXT_RELOC_FLAG]) |
| 198 |
|
| 199 |
# FIXME: This only checks whether the linker accepts -Wl,-z,relro. |
| 200 |
# It doesn't check that the switch actually does what we want it to do. |
| 201 |
AC_CACHE_CHECK([how to link with read-only relocations], |
| 202 |
[ac_cv_ld_relro], [ |
| 203 |
ac_cv_ld_relro=unknown |
| 204 |
SAVED_LDFLAGS="$LDFLAGS" |
| 205 |
LDFLAGS="$SAVED_LDFLAGS -Wl,-z,relro" |
| 206 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])], |
| 207 |
[ac_cv_ld_relro=-Wl,-z,relro]) |
| 208 |
LDFLAGS="$SAVED_LDFLAGS"]) |
| 209 |
|
| 210 |
RELRO_FLAG= |
| 211 |
if test "x$ac_cv_ld_relro" != xunknown; then |
| 212 |
RELRO_FLAG="$ac_cv_ld_relro" |
| 213 |
fi |
| 214 |
AC_SUBST([RELRO_FLAG]) |
| 215 |
|
| 216 |
# FIXME: This only checks whether the linker accepts -Wl,-z,now. |
| 217 |
# It doesn't check that the switch actually does what we want it to do. |
| 218 |
AC_CACHE_CHECK([how to link with immediate binding], |
| 219 |
[ac_cv_ld_now], [ |
| 220 |
ac_cv_ld_now=unknown |
| 221 |
SAVED_LDFLAGS="$LDFLAGS" |
| 222 |
LDFLAGS="$SAVED_LDFLAGS -Wl,-z,now" |
| 223 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [int i = 1;])], |
| 224 |
[ac_cv_ld_now=-Wl,-z,now]) |
| 225 |
LDFLAGS="$SAVED_LDFLAGS"]) |
| 226 |
|
| 227 |
BINDNOW_FLAG= |
| 228 |
if test "x$ac_cv_ld_now" != xunknown; then |
| 229 |
BINDNOW_FLAG="$ac_cv_ld_now" |
| 230 |
fi |
| 231 |
AC_SUBST([BINDNOW_FLAG]) |
| 232 |
|
| 233 |
# FIXME: This only checks whether the compiler accepts -fno-plt. |
| 234 |
# It doesn't check that the switch actually does what we want it to do. |
| 235 |
AX_APPEND_COMPILE_FLAGS([-fno-plt], [OPTI_FLAGS], [$WARN_CFLAGS]) |
| 236 |
|
| 237 |
# Export compiler flags for optimization. |
| 238 |
AC_SUBST([OPTI_FLAGS]) |
| 239 |
|
| 240 |
# Checks for library functions. |
| 241 |
AC_CHECK_FUNCS_ONCE([ |
| 242 |
arc4random_buf |
| 243 |
explicit_bzero |
| 244 |
explicit_memset |
| 245 |
getentropy |
| 246 |
getrandom |
| 247 |
memset_explicit |
| 248 |
memset_s |
| 249 |
open64 |
| 250 |
syscall |
| 251 |
]) |
| 252 |
|
| 253 |
# Disable valgrind tools for checking multithreaded |
| 254 |
# programs, as we don't use them in checks. |
| 255 |
AX_VALGRIND_DFLT([drd], [off]) |
| 256 |
AX_VALGRIND_DFLT([helgrind], [off]) |
| 257 |
|
| 258 |
# Valgrind's sgcheck is b0rk3n upstream. |
| 259 |
AX_VALGRIND_DFLT([sgcheck], [off]) |
| 260 |
|
| 261 |
# Add a target to run testsuite with valgrind. |
| 262 |
AX_VALGRIND_CHECK() |
| 263 |
|
| 264 |
# Requirements for running test/ka-table-gen.py. |
| 265 |
AC_CACHE_CHECK([for Python 3.>=6 with Passlib], |
| 266 |
[ac_cv_path_python3_passlib], |
| 267 |
[AC_PATH_PROGS_FEATURE_CHECK([python3_passlib], |
| 268 |
[python3 m4_for([minor], 11, 6, -1, [[python3.]minor ]) python], |
| 269 |
[_AS_ECHO_LOG([trying $ac_path_python3_passlib...]) |
| 270 |
AS_IF([$ac_path_python3_passlib -c ' |
| 271 |
import sys |
| 272 |
if sys.version_info < (3,6,0): |
| 273 |
sys.stderr.write("too old: " + sys.version + "\n") |
| 274 |
sys.exit(1) |
| 275 |
import passlib |
| 276 |
' >&AS_MESSAGE_LOG_FD 2>&1], |
| 277 |
[ac_cv_path_python3_passlib=$ac_path_python3_passlib |
| 278 |
ac_path_python3_passlib_found=:])], |
| 279 |
[ac_cv_path_python3_passlib="not found"])]) |
| 280 |
if test x"$ac_cv_path_python3_passlib" = x"not found"; then |
| 281 |
PYTHON=false |
| 282 |
AC_MSG_NOTICE( |
| 283 |
[Disabling the "regen-ka-table" target, missing Python requirements.]) |
| 284 |
else |
| 285 |
PYTHON="$ac_cv_path_python3_passlib" |
| 286 |
fi |
| 287 |
AC_SUBST([PYTHON]) |
| 288 |
AM_CONDITIONAL([ENABLE_KA_TABLE_GEN], [test x"$PYTHON" != "xfalse"]) |
| 289 |
|
| 290 |
# The ucontext.h functions that we use were withdrawn from |
| 291 |
# POSIX.1-2008, so the existence of the header does not prove |
| 292 |
# we can use the functions. |
| 293 |
AS_IF([test $ac_cv_header_ucontext_h = yes], |
| 294 |
[AC_CACHE_CHECK([whether all ucontext.h functions are available], |
| 295 |
[ac_cv_header_ucontext_h_fns_available], |
| 296 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
| 297 |
// This code isn't intended to make sense; it just validates the |
| 298 |
// type signature of all four context functions, and avoids tripping |
| 299 |
// any of the many warnings we may have active. |
| 300 |
#include <ucontext.h> |
| 301 |
static int x; |
| 302 |
static void fn1(void) {} |
| 303 |
]], [[ |
| 304 |
ucontext_t uc1, uc2; |
| 305 |
if (getcontext(&uc1)) return 1; |
| 306 |
if (setcontext(&uc1)) return 1; |
| 307 |
makecontext(&uc1, fn1, 0); |
| 308 |
if (swapcontext(&uc1, &uc2)) return 1; |
| 309 |
return x; |
| 310 |
]])], |
| 311 |
[ac_cv_header_ucontext_h_fns_available=yes], |
| 312 |
[ac_cv_header_ucontext_h_fns_available=no])])], |
| 313 |
[ac_cv_header_ucontext_h_fns_available=no]) |
| 314 |
|
| 315 |
if test $ac_cv_header_ucontext_h_fns_available = yes; then |
| 316 |
AC_DEFINE([USE_SWAPCONTEXT], 1, |
| 317 |
[Define to 1 if getcontext, setcontext, makecontext, and swapcontext are |
| 318 |
available from ucontext.h without deprecation warnings.]) |
| 319 |
fi |
| 320 |
|
| 321 |
# Configure options. |
| 322 |
AC_ARG_ENABLE([failure-tokens], |
| 323 |
AS_HELP_STRING( |
| 324 |
[--disable-failure-tokens], |
| 325 |
[Make crypt and crypt_r return NULL on failure, instead of a |
| 326 |
special "failure token" string that isn't the hash of any |
| 327 |
passphrase. This matches the behavior of several other |
| 328 |
crypt implementations, but will break programs that assume these |
| 329 |
functions never return NULL. crypt_rn and crypt_ra are not affected |
| 330 |
by this option, and will always return NULL on failure.] |
| 331 |
), |
| 332 |
[case "$enableval" in |
| 333 |
yes) enable_failure_tokens=1;; |
| 334 |
no) enable_failure_tokens=0;; |
| 335 |
*) AC_MSG_ERROR([bad value ${enableval} for --enable-failure-tokens]);; |
| 336 |
esac], |
| 337 |
[enable_failure_tokens=1]) |
| 338 |
AC_DEFINE_UNQUOTED([ENABLE_FAILURE_TOKENS], [$enable_failure_tokens], |
| 339 |
[Define to 1 if crypt and crypt_r should return a "failure token" on |
| 340 |
failure, or 0 if they should return NULL.]) |
| 341 |
|
| 342 |
AC_ARG_ENABLE([xcrypt-compat-files], |
| 343 |
AS_HELP_STRING( |
| 344 |
[--disable-xcrypt-compat-files], |
| 345 |
[Disable the installation of the <xcrypt.h> header file and the |
| 346 |
libxcrypt.{a,so} compatibility symlinks.] |
| 347 |
), |
| 348 |
[case "$enableval" in |
| 349 |
yes) enable_xcrypt_compat_files=1;; |
| 350 |
no) enable_xcrypt_compat_files=0;; |
| 351 |
*) AC_MSG_ERROR([bad value ${enableval} for --enable-xcrypt-compat-files]);; |
| 352 |
esac], |
| 353 |
[enable_xcrypt_compat_files=1]) |
| 354 |
|
| 355 |
AC_ARG_ENABLE([obsolete-api], |
| 356 |
AS_HELP_STRING( |
| 357 |
[--enable-obsolete-api[=ARG]], |
| 358 |
[When set to "yes", include all compatibility interfaces. |
| 359 |
When set to "alt", include interfaces for compatibility with ALT. |
| 360 |
When set to "glibc", include interfaces for compatibility with glibc. |
| 361 |
When set to "owl", include interfaces for compatibility with Owl. |
| 362 |
When set to "suse", include interfaces for compatibility with SUSE. |
| 363 |
When set to "no", do not include any compatibility definitions at all, |
| 364 |
and change the soname of the installed library to libcrypt.so.2. |
| 365 |
This setting only affects existing binaries; new programs cannot |
| 366 |
be linked against the obsolete APIs (bigcrypt, fcrypt, encrypt, setkey) |
| 367 |
in any case. [default=yes]] |
| 368 |
), |
| 369 |
[enableval="`AS_ECHO("$enableval") | |
| 370 |
$SED -e 'y!ABCDEFGHIJKLMNOPQRSTUVWXYZ-!abcdefghijklmnopqrstuvwxyz_!'`" |
| 371 |
case "${enableval}" in |
| 372 |
alt|glibc|owl) |
| 373 |
enable_obsolete_api=1 |
| 374 |
enable_compat_suse=0 |
| 375 |
COMPAT_ABI=${enableval} ;; |
| 376 |
yes|suse) |
| 377 |
enable_obsolete_api=1 |
| 378 |
enable_compat_suse=1 |
| 379 |
COMPAT_ABI=${enableval} ;; |
| 380 |
no) |
| 381 |
enable_obsolete_api=0 |
| 382 |
enable_compat_suse=0 |
| 383 |
COMPAT_ABI=${enableval} ;; |
| 384 |
*) AC_MSG_ERROR([bad value ${enableval} for --enable-obsolete-api]) ;; |
| 385 |
esac], |
| 386 |
[enable_obsolete_api=1 |
| 387 |
enable_compat_suse=1 |
| 388 |
COMPAT_ABI=yes] |
| 389 |
) |
| 390 |
AC_SUBST(COMPAT_ABI) |
| 391 |
|
| 392 |
AC_ARG_ENABLE([obsolete-api-enosys], |
| 393 |
AS_HELP_STRING( |
| 394 |
[--enable-obsolete-api-enosys[=ARG]], |
| 395 |
[If set to "yes", this option replaces the obsolete APIs |
| 396 |
(fcrypt, encrypt{,_r}, and setkey{,_r}) with stubs that |
| 397 |
set errno to ENOSYS and return without performing any real |
| 398 |
operations. This allows one to disable descrypt support |
| 399 |
while preserving POSIX compliance. For security reasons, |
| 400 |
the encrypt{,r} functions will also overwrite their data-block |
| 401 |
argument with random bits. The fcrypt function will always |
| 402 |
produce a failure token (*0 or *1), unless the library was |
| 403 |
also configured with --disable-failure-tokens, in which case |
| 404 |
it will always return NULL. [default=no]] |
| 405 |
), |
| 406 |
[case "$enableval" in |
| 407 |
yes) enable_obsolete_api_enosys=1;; |
| 408 |
no) enable_obsolete_api_enosys=0;; |
| 409 |
*) AC_MSG_ERROR([bad value ${enableval} for --enable-obsolete-api-enosys]);; |
| 410 |
esac], |
| 411 |
[enable_obsolete_api_enosys=0]) |
| 412 |
|
| 413 |
AC_ARG_ENABLE([hashes], |
| 414 |
AS_HELP_STRING( |
| 415 |
[--enable-hashes=HASHES], |
| 416 |
[Select hash methods to support. Acceptable values are |
| 417 |
'all' or a comma-separated list of names from the file |
| 418 |
'hashes.conf' and/or the keywords 'strong', 'alt', |
| 419 |
'fedora', 'freebsd', 'glibc', 'netbsd', 'openbsd', |
| 420 |
'osx', 'owl', 'solaris', and 'suse' which select groups |
| 421 |
of methods as described in that file. |
| 422 |
The default is 'all'. |
| 423 |
Note: if binary compatibility with any historic libcrypt is |
| 424 |
desired (i.e. any --enable-obsolete-api setting other than |
| 425 |
'no'), the 'descrypt' hash must be enabled.]), |
| 426 |
[hashes_selected="`AS_ECHO("$enableval") | |
| 427 |
$SED -e 'y!ABCDEFGHIJKLMNOPQRSTUVWXYZ-!abcdefghijklmnopqrstuvwxyz_!'`"], |
| 428 |
[hashes_selected=all] |
| 429 |
) |
| 430 |
# This code must run after $PERL is set. |
| 431 |
hashes_enabled=$( |
| 432 |
$PERL "$srcdir"/build-aux/scripts/expand-selected-hashes \ |
| 433 |
"$srcdir"/lib/hashes.conf \ |
| 434 |
"$hashes_selected" |
| 435 |
) |
| 436 |
if test x"$hashes_enabled" = x || test x"$hashes_enabled" = x,; then |
| 437 |
AC_MSG_ERROR([bad value '${hashes_selected}' for --enable-hashes]) |
| 438 |
fi |
| 439 |
AC_SUBST([hashes_enabled]) |
| 440 |
|
| 441 |
|
| 442 |
# If the traditional DES hash is disabled, then the obsolete APIs are |
| 443 |
# implicitly disabled, except when stubs are requested. |
| 444 |
case "$hashes_enabled" in |
| 445 |
*,descrypt,*) ;; |
| 446 |
*) |
| 447 |
if test x"$COMPAT_ABI" != xno && \ |
| 448 |
test x"$enable_obsolete_api_enosys" != x1; then |
| 449 |
AC_MSG_WARN( |
| 450 |
[--enable-hashes=${hashes_selected} forces --enable-obsolete-api=no]) |
| 451 |
enable_obsolete_api=0 |
| 452 |
enable_compat_suse=0 |
| 453 |
COMPAT_ABI=no |
| 454 |
fi |
| 455 |
;; |
| 456 |
esac |
| 457 |
|
| 458 |
# If the obsolete APIs are disabled, the stubs implicitly disabled as well. |
| 459 |
if test x"$COMPAT_ABI" = xno && test x"$enable_obsolete_api_enosys" = x1; then |
| 460 |
AC_MSG_WARN( |
| 461 |
[--enable-obsolete-api=no implies --enable-obsolete-api-enosys=no.]) |
| 462 |
enable_obsolete_api_enosys=0 |
| 463 |
fi |
| 464 |
|
| 465 |
# Export the value for ENABLE_OBSOLETE_API_ENOSYS. |
| 466 |
AC_DEFINE_UNQUOTED([ENABLE_OBSOLETE_API_ENOSYS], [$enable_obsolete_api_enosys], |
| 467 |
[Define to 1 if fcrypt, encrypt{,_r}, setkey{,_r} should set errno to ENOSYS, |
| 468 |
or 0 if they should perform real operations.]) |
| 469 |
|
| 470 |
# The obsolete APIs are unconditionally excluded from the static library, |
| 471 |
# so if we are not building the shared library, we are effectively not |
| 472 |
# building obsolete APIs, and we shouldn't try to test them. |
| 473 |
if test x$enable_shared != xyes; then enable_obsolete_api=0; fi |
| 474 |
|
| 475 |
# Determine whether there's even a GNU libc on this system that we |
| 476 |
# need to be binary backward compatible with. |
| 477 |
if test $enable_obsolete_api = 1; then |
| 478 |
AC_MSG_CHECKING([minimum symbol version to use for compatibility symbols]) |
| 479 |
SYMVER_FLOOR=$( |
| 480 |
export CC |
| 481 |
$PERL "$srcdir"/build-aux/scripts/compute-symver-floor \ |
| 482 |
"$srcdir"/lib/libcrypt.minver $host_os $host_cpu \ |
| 483 |
2>&AS_MESSAGE_LOG_FD |
| 484 |
) |
| 485 |
AC_MSG_RESULT([$SYMVER_FLOOR]) |
| 486 |
case "$SYMVER_FLOOR" in |
| 487 |
'') |
| 488 |
AC_MSG_ERROR([compute-symver-floor failed, see config.log for details]) |
| 489 |
;; |
| 490 |
ERROR) |
| 491 |
AC_MSG_ERROR([libxcrypt port to $host is incomplete]) |
| 492 |
;; |
| 493 |
XCRYPT_2.0) |
| 494 |
SYMVER_MIN=XCRYPT_2.0 |
| 495 |
enable_obsolete_api=0 |
| 496 |
enable_obsolete_api_enosys=0 |
| 497 |
enable_compat_suse=0 |
| 498 |
COMPAT_API=no |
| 499 |
;; |
| 500 |
*) |
| 501 |
SYMVER_MIN=GLIBC_2.0 |
| 502 |
;; |
| 503 |
esac |
| 504 |
else |
| 505 |
SYMVER_FLOOR=XCRYPT_2.0 |
| 506 |
SYMVER_MIN=XCRYPT_2.0 |
| 507 |
fi |
| 508 |
AC_SUBST([SYMVER_FLOOR]) |
| 509 |
AC_SUBST([SYMVER_MIN]) |
| 510 |
|
| 511 |
# If symbol versioning is disabled for any reason, we should not rely on |
| 512 |
# versioned symbols in the testsuite. |
| 513 |
have_symver=0 |
| 514 |
if test x$ax_check_vscript_flag != x; then have_symver=1; fi |
| 515 |
|
| 516 |
AC_DEFINE_UNQUOTED([HAVE_SYMVER], [$have_symver], |
| 517 |
[Define as 1 if symbol versioning is enabled and applied.]) |
| 518 |
|
| 519 |
# If we are not building the obsolete APIs then we shouldn't install |
| 520 |
# xcrypt.h or the compatibility symlinks either. |
| 521 |
if test $enable_obsolete_api = 0; then enable_xcrypt_compat_files=0; fi |
| 522 |
|
| 523 |
AC_DEFINE_UNQUOTED([SYMVER_FLOOR], [$SYMVER_FLOOR], |
| 524 |
[Define as the lowest compatibility symbol version that is actually |
| 525 |
included in libcrypt.so.]) |
| 526 |
|
| 527 |
AC_DEFINE_UNQUOTED([ENABLE_OBSOLETE_API], [$enable_obsolete_api], |
| 528 |
[Define as 1 if the obsolete APIs (fcrypt, encrypt, setkey) |
| 529 |
should be included, 0 otherwise.]) |
| 530 |
|
| 531 |
AM_CONDITIONAL([ENABLE_OBSOLETE_API], [test $enable_obsolete_api = 1]) |
| 532 |
AM_CONDITIONAL([ENABLE_COMPAT_SUSE], [test $enable_compat_suse = 1]) |
| 533 |
AM_CONDITIONAL([ENABLE_XCRYPT_COMPAT_FILES], |
| 534 |
[test $enable_xcrypt_compat_files = 1]) |
| 535 |
|
| 536 |
# The Makefile needs to know which versions of the library we are building. |
| 537 |
AM_CONDITIONAL([ENABLE_STATIC], [test $enable_static = yes]) |
| 538 |
AM_CONDITIONAL([ENABLE_SHARED], [test $enable_shared = yes]) |
| 539 |
|
| 540 |
# The Makefile needs to know if we are cross-compiling. |
| 541 |
AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes]) |
| 542 |
|
| 543 |
XCRYPT_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d. -f1` |
| 544 |
AC_SUBST([XCRYPT_VERSION_MAJOR]) |
| 545 |
|
| 546 |
XCRYPT_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d. -f2` |
| 547 |
AC_SUBST([XCRYPT_VERSION_MINOR]) |
| 548 |
|
| 549 |
AC_OUTPUT |