From: Quentin Young Date: Thu, 22 Mar 2018 18:25:28 +0000 (-0400) Subject: configure.ac: --enable-[thread,memory]-sanitizer X-Git-Tag: frr-5.0-dev~116^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=cec722f6dff77c65d7711524256c485445f31e57;p=matthieu%2Ffrr.git configure.ac: --enable-[thread,memory]-sanitizer Add configure options to enable the other sanitizers. Signed-off-by: Quentin Young --- diff --git a/configure.ac b/configure.ac index b2a997afdd..0b94115dba 100755 --- a/configure.ac +++ b/configure.ac @@ -196,6 +196,26 @@ AC_ARG_ENABLE([address-sanitizer], AS_HELP_STRING([--enable-address-sanitizer], [AC_MSG_ERROR([Address Sanitizer not available])]) ]) +dnl ThreadSanitizer support +AC_ARG_ENABLE([thread-sanitizer], AS_HELP_STRING([--enable-thread-sanitizer], \ + [enabled ThreadSanitizer support for detecting data races]), \ + [AC_DEFINE(HAVE_THREAD_SANITIZER, 1, [enable ThreadSanitizer]) + CFLAGS="$CFLAGS -fsanitize=thread" + CXXFLAGS="$CXXFLAGS -fsanitize=thread" + AC_TRY_COMPILE([],[const int i=0;],[AC_MSG_NOTICE([Thread Sanitizer Enabled])], + [AC_MSG_ERROR([Thread Sanitizer not available])]) + ]) + +dnl MemorySanitizer support +AC_ARG_ENABLE([memory-sanitizer], AS_HELP_STRING([--enable-memory-sanitizer], \ + [enabled MemorySanitizer support for detecting uninitialized memory reads]), \ + [AC_DEFINE(HAVE_THREAD_SANITIZER, 1, [enable MemorySanitizer]) + CFLAGS="$CFLAGS -fsanitize=memory -fPIE -pie" + CXXFLAGS="$CXXFLAGS -fsanitize=memory -fPIE -pie" + AC_TRY_COMPILE([],[const int i=0;],[AC_MSG_NOTICE([Memory Sanitizer Enabled])], + [AC_MSG_ERROR([Memory Sanitizer not available])]) + ]) + dnl if the user has specified any CFLAGS, override our settings if test "x${enable_dev_build}" = "xyes"; then AC_DEFINE(DEV_BUILD,,Build for development)