Problem: address sanitizer support in CI is hacky

Solution: import better solution from zproject and add a new autoconf
option
This commit is contained in:
Luca Boccassi 2017-05-01 18:06:45 +01:00
parent 6d76106cde
commit 11e2e5f6b5
2 changed files with 17 additions and 2 deletions

View File

@ -16,8 +16,7 @@ if [ $BUILD_TYPE == "default" ]; then
CONFIG_OPTS+=("--prefix=${BUILD_PREFIX}")
if [ -n "$ADDRESS_SANITIZER" ] && [ "$ADDRESS_SANITIZER" == "enabled" ]; then
CONFIG_OPTS+=("CFLAGS=-fsanitize=address")
CONFIG_OPTS+=("CXXFLAGS=-fsanitize=address")
CONFIG_OPTS+=("--enable-address-sanitizer=yes")
fi
if [ -z $CURVE ]; then

View File

@ -127,6 +127,22 @@ if test "x$zmq_militant" = "xyes"; then
AC_DEFINE(ZMQ_ACT_MILITANT, 1, [Enable militant API assertions])
fi
# Memory mis-use detection
AC_MSG_CHECKING([whether to enable ASan])
AC_ARG_ENABLE(address-sanitizer, [AS_HELP_STRING([--enable-address-sanitizer=yes/no],
[Build with GCC Address Sanitizer instrumentation])],
[ZMQ_ASAN="$enableval"])
if test "x${ZMQ_ASAN}" == "xyes"; then
CFLAGS="${CFLAGS} -fsanitize=address"
CXXFLAGS="${CXXFLAGS} -fsanitize=address"
AM_CONDITIONAL(ENABLE_ASAN, true)
AC_MSG_RESULT([yes])
else
AM_CONDITIONAL(ENABLE_ASAN, false)
AC_MSG_RESULT([no])
fi
# By default compiling with -Werror except OSX.
libzmq_werror="yes"