summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2018-11-13 12:53:17 +0100
committerAmar Tumballi <amarts@redhat.com>2018-11-27 05:21:06 +0000
commitb2a50989822c135c2e4cb84ad7ad400957a49d10 (patch)
tree6b247db491e1ac1dc6398100f130b2445fd6755d /configure.ac
parentfc9889d0373c323aab0d93f8ca31d2d8151bd041 (diff)
build: add option to compile with ThreadSanitizer
ThreadSanitizer is a debugging tool that can detect threads that race for data modifications. These races can result in data corruption and are difficult to track and fix. Change-Id: Ibbdaf17c811e30e79cd5bdcf9cd9ff2d0cdb2abb URL: https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual Reported-by: Yaniv Kaul <ykaul@redhat.com> Fixes: #543 Signed-off-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac14
1 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 01250825b7b..43e8da3c2b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -299,6 +299,19 @@ else
BUILD_ASAN=no
fi
+AC_ARG_ENABLE([atan],
+ AC_HELP_STRING([--enable-tsan],
+ [Enable ThreadSanitizer support]))
+if test "x$enable_tsan" = "xyes"; then
+ BUILD_TSAN=yes
+ AC_CHECK_LIB([tsan], [__tsan_init], ,
+ [AC_MSG_ERROR([libtsan.so not found, this is required for --enable-tsan])])
+ GF_CFLAGS="${GF_CFLAGS} -O2 -g -fsanitize=thread"
+ GF_LDFLAGS="${GF_LDFLAGS} -ltsan"
+else
+ BUILD_TSAN=no
+fi
+
dnl When possible, prefer libtirpc over glibc rpc.
dnl
@@ -1597,6 +1610,7 @@ echo "georeplication : $BUILD_SYNCDAEMON"
echo "Linux-AIO : $BUILD_LIBAIO"
echo "Enable Debug : $BUILD_DEBUG"
echo "Enable ASAN : $BUILD_ASAN"
+echo "Enable TSAN : $BUILD_TSAN"
echo "Use syslog : $USE_SYSLOG"
echo "XML output : $BUILD_XML_OUTPUT"
echo "Encryption xlator : $BUILD_CRYPT_XLATOR"