xfs
[Top] [All Lists]

[PATCH 3/3] xfsprogs: allow linking against libtcmalloc

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/3] xfsprogs: allow linking against libtcmalloc
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 14 Nov 2011 10:57:45 -0500
Cc: arekm@xxxxxxxx
References: <20111114155742.285135418@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
Allow linking against the libtcmalloc library from Google's performance
tools, which at least for repair reduces the memory usage dramatically.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfsprogs-dev/configure.in
===================================================================
--- xfsprogs-dev.orig/configure.in      2011-08-14 17:00:02.000000000 +0000
+++ xfsprogs-dev/configure.in   2011-11-14 12:47:05.000000000 +0000
@@ -31,6 +31,21 @@ AC_ARG_ENABLE(editline,
 AC_SUBST(libeditline)
 AC_SUBST(enable_editline)
 
+AC_ARG_ENABLE(tcmalloc,
+[ --enable-tcmalloc=[yes/no] Enable tcmalloc [default=no]],,
+       enable_tcmalloc=no)
+AC_SUBST(enable_tcmalloc)
+
+if test "$enable_tcmalloc" = "yes"; then
+    AC_CHECK_LIB(tcmalloc, malloc,, [
+       echo 'FATAL ERROR: could not find a valid tcmalloc library.'
+       echo 'Install libtcmalloc or configure with --enable-tcmalloc=no.'
+       exit 1])
+
+    libtcmalloc="-ltcmalloc"
+    AC_SUBST(libtcmalloc)
+fi
+
 AC_ARG_ENABLE(termcap,
 [ --enable-termcap=[yes/no] Enable terminal capabilities library [default=no]],
        test $enable_termcap = yes && libtermcap="-ltermcap",)
Index: xfsprogs-dev/include/builddefs.in
===================================================================
--- xfsprogs-dev.orig/include/builddefs.in      2011-08-14 17:00:02.000000000 
+0000
+++ xfsprogs-dev/include/builddefs.in   2011-11-14 12:09:52.000000000 +0000
@@ -22,7 +22,7 @@ _BUILDDEFS_INCLUDED_ = 1
 
 DEBUG = @debug_build@
 OPTIMIZER = @opt_build@
-MALLOCLIB = @malloc_lib@
+MALLOCLIB = @malloc_lib@ @libtcmalloc@
 LOADERFLAGS = @LDFLAGS@
 LTLDFLAGS = @LDFLAGS@
 CFLAGS = @CFLAGS@

<Prev in Thread] Current Thread [Next in Thread>