diff options
author | ALONSO Laurent <laurent.alonso@inria.fr> | 2021-08-25 11:16:30 +0200 |
---|---|---|
committer | ALONSO Laurent <laurent.alonso@inria.fr> | 2021-08-25 11:16:30 +0200 |
commit | 8ecbf0e820eeeaa779f90409fc1385720df8a1b4 (patch) | |
tree | 163f504d7c947dbdeb1a75cebbdbff8d3d6c6250 | |
parent | 85ff48cee274398a7479e479ef22083e182e551c (diff) |
configure.ac: add an enable-asan option...
Change-Id: I5974d8e2aba6ec7d98a37108e0b539e8aec9e64a
-rw-r--r-- | configure.ac | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index ca009e6..6f28bf4 100644 --- a/configure.ac +++ b/configure.ac @@ -320,6 +320,30 @@ AS_IF([test "x$enable_debug" = "xyes"], [ ]) AC_SUBST(DEBUG_CXXFLAGS) +# ==================== +# asan +# ==================== +AS_IF([test "x$native_win32" = "xyes"], [ enable_asan=no ], + [ + AC_ARG_ENABLE([asan], + AC_HELP_STRING([--enable-asan], + [Enable Address Sanitizer support])) + + if test "x$enable_asan" = "xyes"; then + enable_asan=yes + AC_CHECK_LIB([asan], [__asan_init], [asan_lib=asan], # linux + [ AC_CHECK_LIB([clang_rt.asan_osx_dynamic], [__asan_init], [asan_lib=clang_rt.asan_osx_dynamic], # osx and clang + [AC_MSG_ERROR([libasan not found, this is required for --enable-asan]) + ]) + ]) + CXXFLAGS="${CXXFLAGS} -fsanitize=address -fno-omit-frame-pointer" + LDFLAGS="-l${asan_lib} ${LDFLAGS}" + else + enable_asan=no + fi + ] +) + # ========== # Unit tests # ========== @@ -425,6 +449,7 @@ AC_OUTPUT AC_MSG_NOTICE([ ============================================================================== Build configuration: + asan: ${enable_asan} debug: ${enable_debug} docs: ${build_docs} fuzzers: ${enable_fuzzers} |