summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2018-08-09 15:52:19 +0200
committerAmar Tumballi <amarts@redhat.com>2018-08-30 05:41:26 +0000
commit44e40404ed1223ba9ccb879373da38efd5ba403c (patch)
treedcf7abb412ee5ad2280ede11872ce96ea36f1ac9 /configure.ac
parentd27e8870c1882b1abfffefaf7b40bc7f2a1ec05f (diff)
build: add --enable-asan configure options
Introduce a `./configure --enable-asan` to build with `-fsanitize=address -fno-omit-frame-pointer` options. This uses the libasan.so shared library, so that needs to be available. While running builds with the ASAN options, several linker issues surfaced and these have been addressed with this change as well. Building with --enable-asan has been tested on Fedora 28. Change-Id: I428a9da70dd8f7d0056cfbe5c398619a571469b2 Updates: #492 Signed-off-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac29
1 files changed, 23 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 54b52a35f8c..4db28ef1c11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,6 +318,20 @@ else
CFLAGS="${CFLAGS} -g -rdynamic"
fi
+AC_ARG_ENABLE([asan],
+ AC_HELP_STRING([--enable-asan],
+ [Enable Address Sanitizer support]))
+if test "x$enable_asan" = "xyes"; then
+ BUILD_ASAN=yes
+ AC_CHECK_LIB([asan], [__asan_init], ,
+ [AC_MSG_ERROR([libasan.so not found, this is required for --enable-asan])])
+ GF_CFLAGS="${GF_CFLAGS} -O1 -g -fsanitize=address -fno-omit-frame-pointer"
+ dnl -lasan always need to be the first library, otherwise libxml complains
+ GF_LDFLAGS="-lasan ${GF_LDFLAGS}"
+else
+ BUILD_ASAN=no
+fi
+
dnl When possible, prefer libtirpc over glibc rpc.
dnl
@@ -345,13 +359,15 @@ AC_ARG_WITH([ipv6-default],
AC_CHECK_FILE([/etc/centos-release])
if test "x$ac_cv_file__etc_centos_release" = "xyes"; then
- dnl On CentOS '-ldl' isn't automatically added to LIBS
- AC_CHECK_LIB([dl], [dlopen])
if grep "release 6" /etc/centos-release; then
with_ipv6_default="no"
fi
fi
+dnl On some distributions '-ldl' isn't automatically added to LIBS
+AC_CHECK_LIB([dl], [dlopen], [LIB_DL=-ldl])
+AC_SUBST(LIB_DL)
+
AC_ARG_ENABLE([privport_tracking],
AC_HELP_STRING([--disable-privport_tracking],
[Disable internal tracking of privileged ports.]))
@@ -1144,7 +1160,7 @@ fi
AC_SUBST(GF_DISTRIBUTION)
GF_HOST_OS=""
-GF_LDFLAGS="-rdynamic"
+GF_LDFLAGS="${GF_LDFLAGS} -rdynamic"
dnl see --with-libtirpc option check above, libtirpc(-devel) is required for
dnl ipv6-default
@@ -1285,7 +1301,7 @@ case $host_os in
GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(sbindir)\\\""
GF_LDADD="${ARGP_LDADD}"
if test "x$ac_cv_header_execinfo_h" = "xyes"; then
- GF_LDFLAGS="-lexecinfo"
+ GF_LDFLAGS="${GF_LDFLAGS} -lexecinfo"
fi
GF_FUSE_LDADD="-lperfuse"
BUILD_FUSE_CLIENT=yes
@@ -1306,7 +1322,7 @@ case $host_os in
GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(sbindir)\\\""
GF_LDADD="${ARGP_LDADD}"
if test "x$ac_cv_header_execinfo_h" = "xyes"; then
- GF_LDFLAGS="-lexecinfo"
+ GF_LDFLAGS="${GF_LDFLAGS} -lexecinfo"
fi
BUILD_FUSE_CLIENT=yes
BUILD_FUSERMOUNT=no
@@ -1321,7 +1337,7 @@ case $host_os in
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME"
GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME"
GF_LDADD="${ARGP_LDADD}"
- GF_LDFLAGS=""
+ GF_LDFLAGS="${GF_LDFLAGS}"
GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse"
BUILD_FUSERMOUNT="no"
FUSERMOUNT_SUBDIR=""
@@ -1723,6 +1739,7 @@ echo "readline : $BUILD_READLINE"
echo "georeplication : $BUILD_SYNCDAEMON"
echo "Linux-AIO : $BUILD_LIBAIO"
echo "Enable Debug : $BUILD_DEBUG"
+echo "Enable ASAN : $BUILD_ASAN"
echo "Block Device xlator : $BUILD_BD_XLATOR"
echo "glupy : $BUILD_GLUPY"
echo "Use syslog : $USE_SYSLOG"