summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-08-01 15:44:15 +0530
committerAmar Tumballi <amar@kadalu.io>2020-02-06 05:26:31 +0000
commitf121b156cca43148595229e07a9c5a5a4561627c (patch)
tree0cdf87342a427a0022d1b7c7aafd0ed078373689
parent4e9fc11b0659957e76565f6557ad1079c51d6832 (diff)
configure: add an option to build with tcmalloc library
With this patch, one can now use '--enable-tcmalloc' while running configure, and they can see that their glusterfs is linked with libtcmalloc. [atumball@local build]$ ldd /usr/local/sbin/glusterfs | grep tcmalloc libtcmalloc.so.4 => /lib64/libtcmalloc.so.4 (0x00007feec0b87000) Once we establish a standard performance number with and without this option, we will see how to make it default. Updates: #237 Change-Id: I3377f57bfe4e17f101a212e1914a6d3c1687d528 Signed-off-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--configure.ac14
1 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index d9af961edf1..0d236f6c359 100644
--- a/configure.ac
+++ b/configure.ac
@@ -305,6 +305,19 @@ else
BUILD_TSAN=no
fi
+# Initialize CFLAGS before usage
+BUILD_TCMALLOC=no
+AC_ARG_ENABLE([tcmalloc],
+ AC_HELP_STRING([--enable-tcmalloc],
+ [Enable linking with tcmalloc library.]))
+if test "x$enable_tcmalloc" = "xyes"; then
+ BUILD_TCMALLOC=yes
+ GF_CFLAGS="${GF_CFLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
+ AC_CHECK_LIB([tcmalloc], [malloc], [],
+ [AC_MSG_ERROR([when --enable-tcmalloc is used, tcmalloc library needs to be present])])
+ GF_LDFLAGS="-ltcmalloc ${GF_LDFLAGS}"
+fi
+
dnl When possible, prefer libtirpc over glibc rpc.
dnl
@@ -1585,6 +1598,7 @@ echo "IPV6 default : $with_ipv6_default"
echo "Use TIRPC : $with_libtirpc"
echo "With Python : ${PYTHON_VERSION}"
echo "Cloudsync : $BUILD_CLOUDSYNC"
+echo "Link with TCMALLOC : $BUILD_TCMALLOC"
echo
if test "x$BUILD_ASAN" = "xyes"; then