From 504209ce714c2fff97b700c064a9f32ba38435f2 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sat, 15 Jul 2017 16:59:58 +0200 Subject: [PATCH] configure: options for enabling address/undefined behavior sanitizers The `Rakefile` has supported both for a while now, but the values had to be set manually in `build-config`. --- ac/debugging_profiling.m4 | 22 ++++++++++++++++++++++ build-config.in | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/ac/debugging_profiling.m4 b/ac/debugging_profiling.m4 index ab1ca4bca..7d56b329e 100644 --- a/ac/debugging_profiling.m4 +++ b/ac/debugging_profiling.m4 @@ -59,7 +59,29 @@ else opt_features_no="$opt_features_no\n * profiling support" fi +AC_ARG_ENABLE([addrsan], + AC_HELP_STRING([--enable-addrsan],[compile with address sanitization turned on (no)]), + [ADDRSAN=yes],[ADDRSAN=no]) + +if test x"$ADDRSAN" = xyes ; then + opt_features_yes="$opt_features_yes\n * development technique 'address sanitizer'" +else + opt_features_no="$opt_features_no\n * development technique 'address sanitizer'" +fi + +AC_ARG_ENABLE([ubsan], + AC_HELP_STRING([--enable-ubsan],[compile with sanitization for undefined behavior turned on (no)]), + [UBSAN=yes],[UBSAN=no]) + +if test x"$UBSAN" = xyes ; then + opt_features_yes="$opt_features_yes\n * development technique 'undefined behavior sanitizer'" +else + opt_features_no="$opt_features_no\n * development technique 'undefined behavior sanitizer'" +fi + AC_SUBST(DEBUG_CFLAGS) AC_SUBST(PROFILING_CFLAGS) AC_SUBST(PROFILING_LIBS) AC_SUBST(OPTIMIZATION_CFLAGS) +AC_SUBST(ADDRSAN) +AC_SUBST(UBSAN) diff --git a/build-config.in b/build-config.in index 801968b1a..d52318d66 100644 --- a/build-config.in +++ b/build-config.in @@ -138,3 +138,7 @@ BUILD_TOOLS = @BUILD_TOOLS@ TRANSLATIONS = @TRANSLATIONS@ MANPAGES_TRANSLATIONS = @MANPAGES_TRANSLATIONS@ + +# Debugging aids: compiler sanitization features +ADDRSAN = @ADDRSAN@ +UBSAN = @UBSAN@