From 995fe51e9f8fba1d5f5fd00b975c0e5516384a5c Mon Sep 17 00:00:00 2001 From: Eric Zuck Date: Tue, 25 May 2021 16:11:17 -0400 Subject: [PATCH] T1248:orkaudio:ThreadSanitizer support -- invoke in projects as: autoreconf -i ../configure --enable-tsan --- orkaudio/configure.in | 19 ++++++++++++++++++- orkbasecxx/configure.in | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/orkaudio/configure.in b/orkaudio/configure.in index c3adc992..ecef33eb 100644 --- a/orkaudio/configure.in +++ b/orkaudio/configure.in @@ -2,10 +2,27 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(orkaudio, 1.0) - + +AC_ARG_ENABLE( [tsan], + AS_HELP_STRING([--enable-tsan], [enable thread sanitizer]) +) +AC_ARG_ENABLE( [tsan], + AS_HELP_STRING([--enable-asan], [enable address sanitizer]) +) + AC_LANG_CPLUSPLUS AC_PROG_CXX +AS_IF([test "x$enable_tsan" = "xyes"], [ + CXXFLAGS+=" -fsanitize=thread " + LDFLAGS+=" -fsanitize=thread " +]) + +AS_IF([test "x$enable_asan" = "xyes"], [ + CXXFLAGS+=" -fsanitize=address " + LDFLAGS+=" -fsanitize=address " +]) + speex_lib=speex diff --git a/orkbasecxx/configure.in b/orkbasecxx/configure.in index 88798bb8..2fb42681 100644 --- a/orkbasecxx/configure.in +++ b/orkbasecxx/configure.in @@ -3,6 +3,13 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) AM_INIT_AUTOMAKE(orkbase, 1.0) +AC_ARG_ENABLE( [tsan], + AS_HELP_STRING([--enable-tsan], [enable thread sanitizer]) +) +AC_ARG_ENABLE( [tsan], + AS_HELP_STRING([--enable-asan], [enable address sanitizer]) +) + boost_lib=-lboost_system AC_PREFIX_DEFAULT(/usr) @@ -10,6 +17,16 @@ AC_PREFIX_DEFAULT(/usr) AC_LANG_CPLUSPLUS AC_PROG_CXX +AS_IF([test "x$enable_tsan" = "xyes"], [ + CXXFLAGS+=" -fsanitize=thread " + LDFLAGS+=" -fsanitize=thread " +]) + +AS_IF([test "x$enable_asan" = "xyes"], [ + CXXFLAGS+=" -fsanitize=address " + LDFLAGS+=" -fsanitize=address " +]) + # look for XERCES_3 AC_CHECK_HEADERS([/usr/include/xercesc/dom/DOMLSSerializer.hpp],[CXXFLAGS+=" -DXERCES_3 "])