summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2021-07-20 11:58:32 -0400
committerZack Weinberg <zackw@panix.com>2021-07-22 08:11:12 -0400
commit3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78 (patch)
tree666c0b59a7b15cbf00a25bde94628af5966dba09 /configure.ac
parent41886a8f1f07a5bfeb1eb4e9c05d0525d16d2b15 (diff)
downloadlibxcrypt-3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78.tar.gz
libxcrypt-3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78.tar.bz2
libxcrypt-3aa82ccd3a3fecea7e6a9d0f9c85c56e2e04bb78.zip
Detect ASan in configure and disable incompatible tests.
ASan’s “interceptors” for crypt and crypt_r have a semantic conflict with libxcrypt, requiring a few tests to be disabled for builds with -fsanitize-address. See commentary in test/crypt-badargs.c for an explanation of the conflict, and commentary in build-aux/zw_detect_asan.m4 for why a configure test is required. This does not work around https://github.com/google/sanitizers/issues/1365 which is an unrelated problem affecting test/special-char-salt.c and which doesn’t currently break CI.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 0a933f7..f05b95f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,6 +79,18 @@ AC_CACHE_CHECK([whether the preprocessor ($CPP) supports -dD],
])
AC_SUBST([HAVE_CPP_dD], [$ac_cv_prog_cpp_dD])
+# Some of the tests need to be conditionally compiled depending on
+# whether ASan is active.
+AC_CACHE_CHECK([whether we are compiling with ASan],
+ [ac_cv_c_address_sanitizer],
+ [zw_ASAN_IFELSE(
+ [ac_cv_c_address_sanitizer=yes],
+ [ac_cv_c_address_sanitizer=no])])
+if test x$ac_cv_c_address_sanitizer = xyes; then
+ AC_DEFINE([XCRYPT_USE_ASAN], [1],
+ [Define when compiling with ASan. Only affects tests.])
+fi
+
# Checks for libraries: currently none needed.
# Checks for header files.