diff --git a/CMakeLists.txt b/CMakeLists.txt index f5edf896c0..2a723ad8c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,12 @@ if(${ENABLE_DEBUG}) set(VERSION_C_IDENT "${VERSION_C_IDENT}_debug") endif() +if (SANITIZERS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=${SANITIZERS} -fno-omit-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=${SANITIZERS} -fno-omit-frame-pointer") + set(CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -fsanitize=${SANITIZERS} -fno-omit-frame-pointer") +endif() + ######################################################################## ## Dependency Configuration diff --git a/configure b/configure index b1ea7bdff5..a7113e2dc0 100755 --- a/configure +++ b/configure @@ -58,6 +58,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]... --disable-perftools don't try to build with Google Perftools --disable-python don't try to build python bindings for Broker --disable-broker-tests don't try to build Broker unit tests + --sanitizers=SANITIZERS comma-separated list of Clang sanitizers to enable Required Packages in Non-Standard Locations: --with-openssl=PATH path to OpenSSL install root @@ -144,6 +145,7 @@ append_cache_entry INSTALL_ZEEKCTL BOOL true append_cache_entry CPACK_SOURCE_IGNORE_FILES STRING append_cache_entry ENABLE_MOBILE_IPV6 BOOL false append_cache_entry DISABLE_PERFTOOLS BOOL false +append_cache_entry SANITIZERS STRING "" # parse arguments while [ $# -ne 0 ]; do @@ -216,6 +218,9 @@ while [ $# -ne 0 ]; do append_cache_entry ENABLE_PERFTOOLS BOOL true append_cache_entry ENABLE_PERFTOOLS_DEBUG BOOL true ;; + --sanitizers=*) + append_cache_entry SANITIZERS STRING $optarg + ;; --enable-jemalloc) append_cache_entry ENABLE_JEMALLOC BOOL true ;;