diff options
| -rw-r--r-- | configure.ac | 64 | ||||
| -rw-r--r-- | glusterfs.spec.in | 2 |
2 files changed, 65 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 4c2bb32fe23..b045333e825 100644 --- a/configure.ac +++ b/configure.ac @@ -363,6 +363,10 @@ AC_ARG_WITH([ocf], ) AC_SUBST(OCF_SUBDIR) +AC_ARG_WITH(asan,--with-asan,,with_asan="no") +AC_ARG_WITH(tsan,--with-tsan,,with_tsan="no") +AC_ARG_WITH(jemalloc,--with-jemalloc,,with_jemalloc="no") + # LEX needs a check AC_PROG_LEX if test "x${LEX}" != "xflex" -a "x${FLEX}" != "xlex"; then @@ -922,8 +926,63 @@ AC_SUBST(GF_DISTRIBUTION) GF_HOST_OS="" GF_LDFLAGS="-rdynamic" -TESTER_CFLAGS="" +BUILD_ASAN=no +if test "x$with_asan" = "xyes"; then + echo -n "checking for address sanitizer (ASAN) support... " + AC_LANG_CONFTEST(AC_LANG_PROGRAM()) + $CC conftest.c $CFLAGS -fsanitize=address -o conftest + ret=$? + rm -f conftest.o conftest + if test $ret -eq 0 ; then + echo "yes" + BUILD_ASAN=yes + GF_CFLAGS="$GF_CFLAGS -DASAN -fsanitize=address -O0 -ggdb" + GF_LDFLAGS="-gdb -static-libasan $GF_LDFLAGS" + else + echo "no" + echo "ERROR: ASAN not supported by compiler ($CC)" + exit 1 + fi +fi +BUILD_TSAN=no +if test "x$with_tsan" = "xyes"; then + echo -n "checking for thread sanitizer (TSAN) support... " + AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) + $CC conftest.c $CFLAGS -fsanitize=address -o conftest > /dev/null 2> /dev/null + ret=$? + rm -f conftest.o conftest + if test $ret -eq 0 ; then + echo "yes" + BUILD_TSAN=yes + GF_CFLAGS="$GF_CFLAGS -fsanitize=thread -O0 -ggdb -fPIC -pie" + GF_LDFLAGS="-gdb -static-libtsan $GF_LDFLAGS" + else + echo "no" + echo "ERROR: TSAN not supported by compiler ($CC)" + exit 1 + fi +fi + +BUILD_JEMALLOC=no +if test "x$with_jemalloc" = "xyes"; then + echo -n "checking for jemalloc support... " + AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) + $CC conftest.c $CFLAGS -ljemalloc -o conftest > /dev/null 2> /dev/null + ret=$? + rm -f conftest.o conftest + if test $ret -eq 0 ; then + echo "yes" + BUILD_JEMALLOC=yes + GF_LDFLAGS="-ljemalloc $GF_LDFLAGS" + else + echo "no" + echo "ERROR: jemalloc linking error" + exit 1 + fi +fi + +TESTER_CFLAGS="" dnl include tirpc for FB builds if test "x$BUILD_FBEXTRAS" = "xyes"; then TIRPC_CFLAGS="-I/usr/include/tirpc" @@ -1393,4 +1452,7 @@ echo "POSIX ACLs : $BUILD_POSIX_ACLS" echo "Data Classification : $BUILD_GFDB" echo "firewalld-config : $BUILD_FIREWALLD" echo "Experimental xlators : $BUILD_EXPERIMENTAL" +echo "ASAN enabled : $BUILD_ASAN" +echo "TSAN enabled : $BUILD_TSAN" +echo "jemalloc enabled : $BUILD_JEMALLOC" echo diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 27903e4d5aa..6c30a955977 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -202,6 +202,7 @@ BuildRequires: python-devel BuildRequires: python-ctypes %if ( 0%{?_with_fbextras:1} ) BuildRequires: fb-libtirpc fb-libtirpc-devel +BuildRequires: jemalloc jemalloc-devel %endif BuildRequires: userspace-rcu-devel >= 0.7 %if ( 0%{?rhel} && 0%{?rhel} <= 6 ) @@ -522,6 +523,7 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-fuse%{?_isa} = %{version}-%{release} %if ( 0%{?_with_fbextras:1} ) Requires: fb-libtirpc >= 0.2.5-1 +Requires: jemalloc >= 3.6.0-1 %endif # self-heal daemon, rebalance, nfs-server etc. are actually clients Requires: %{name}-api%{?_isa} = %{version}-%{release} |
