diff options
| author | Mark Wielaard <[email protected]> | 2015-05-21 23:36:51 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-05-27 15:09:36 +0200 |
| commit | 2b250b759799eaa43bce1643b7072be8c5c19c01 (patch) | |
| tree | 9adec3f0c274efbf2c759fd8caa9d9a48a1c4de4 /configure.ac | |
| parent | c2297eab17b7dbb98021b51f063f71d1cdc7893a (diff) | |
configure: Add --enable-sanitize-undefined.
Now that we are -fsanitize=undefined clean make sure we keep it that way.
We do have to disable alignment checking. Because we might explicitly
use unaligned accesses (see ALLOW_UNALIGNED).
Rename DISTCHECK_CONFIGURE_FLAGS to AM_DISTCHECK_CONFIGURE_FLAGS, so the
user can override. And add --enable-sanitize-undefined.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'configure.ac')
| -rw-r--r-- | configure.ac | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 68b7f5b5..e0adad7d 100644 --- a/configure.ac +++ b/configure.ac @@ -193,6 +193,23 @@ if test "$use_gcov" = yes; then fi AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) +AC_ARG_ENABLE([sanitize-undefined], + AS_HELP_STRING([--enable-sanitize-undefined], + [Use gcc undefined behaviour sanitizer]), + [use_undefined=$enableval], [use_undefined=no]) +if test "$use_undefined" = yes; then + old_CFLAGS="$CFLAGS" + old_CXXFLAGS="$CXXFLAGS" + # We explicitly use unaligned access when possible (see ALLOW_UNALIGNED) + # We want to fail immediately on first error, don't try to recover. + CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=alignment -fno-sanitize-recover" + CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-sanitize=alignment -fno-sanitize-recover" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], use_undefined=yes, use_undefined=no) + AS_IF([test "x$use_undefined" != xyes], + AC_MSG_WARN([gcc undefined behaviour sanitizer not available]) + CFLAGS="$old_CFLAGS" CXXFLAGS="$old_CXXFLAGS") +fi + AC_ARG_ENABLE([valgrind], AS_HELP_STRING([--enable-valgrind],[run all tests under valgrind]), [use_valgrind=$enableval], [use_valgrind=no]) @@ -421,6 +438,7 @@ AC_MSG_NOTICE([ gprof support : ${use_gprof} gcov support : ${use_gcov} run all tests under valgrind : ${use_valgrind} + gcc undefined behaviour sanitizer : ${use_undefined} use rpath in tests : ${tests_use_rpath} test biarch : ${utrace_cv_cc_biarch} ]) |
