[PATCH] Add build options to disable either static or shared library by default
Mike Hommey
mh+jemalloc at glandium.org
Thu Feb 23 08:05:13 PST 2012
From: Mike Hommey <mh at glandium.org>
---
We (Mozilla)'re most probably going to include jemalloc's build system
to avoid any trouble, and it would be easier for us if calling make
would only create the static library.
Makefile.in | 7 ++++++-
configure.ac | 18 ++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index ca4365e..536fd3a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -76,7 +76,12 @@ CTESTS := @srcroot at test/allocated.c @srcroot at test/allocm.c \
.SECONDARY : $(CTESTS:@srcroot@%.c=@objroot@%.o)
# Default target.
-all: $(DSOS) $(STATIC_LIBS)
+ifeq (1, @enable_shared@)
+all: $(DSOS)
+endif
+ifeq (1, @enable_static@)
+all: $(STATIC_LIBS)
+endif
dist: doc
diff --git a/configure.ac b/configure.ac
index 4cc7d6f..c82f079 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,6 +272,24 @@ if test "x${mremap_fixed}" = "xyes" ; then
AC_DEFINE([JEMALLOC_MREMAP_FIXED])
fi
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--disable-static], [Do not build a static library by default])])
+if test "x$enable_static" = "xno" ; then
+ enable_static="0"
+else
+ enable_static="1"
+fi
+AC_SUBST([enable_static])
+
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--disable-shared], [Do not build a shared library by default])])
+if test "x$enable_shared" = "xno" ; then
+ enable_shared="0"
+else
+ enable_shared="1"
+fi
+AC_SUBST([enable_shared])
+
dnl Support optional additions to rpath.
AC_ARG_WITH([rpath],
[AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
--
1.7.9.1
More information about the jemalloc-discuss
mailing list