From f6afae2f49ed65a6a482257c7e55520857d751b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Yasskin Date: Thu, 18 Feb 2010 02:36:02 +0000 Subject: Add a shared library for LLVM, named libLLVM2.7svn.(so|dylib), and add an --enable-shared configure flag to have the tools linked shared. (2.7svn is just $(LLVMVersion) so it'll change to "2.7" in the release.) Always link the example programs shared to test that the shared library keeps working. On my mac laptop, Debug libLLVM2.7svn.dylib is 39MB, and opt (for example) is 16M static vs 440K shared. Two things are less than ideal here: 1) The library doesn't include any version information. Since we expect to break the ABI with every release, this shouldn't be much of a problem. If we do release a compatible 2.7.1, we may be able to hack its library to work with binaries compiled against 2.7.0, or we can just ask them to recompile. I'm hoping to get a real packaging expert to look at this for the 2.8 release. 2) llvm-config doesn't yet have an option to print link options for the shared library. I'll add this as a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96559 91177308-0d34-0410-b5e6-96231b3b80d8 --- configure | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 88050f3..719c1b7 100755 --- a/configure +++ b/configure @@ -689,6 +689,7 @@ TARGET_HAS_JIT ENABLE_DOXYGEN ENABLE_THREADS ENABLE_PIC +ENABLE_SHARED TARGETS_TO_BUILD LLVM_ENUM_TARGETS LLVM_ENUM_ASM_PRINTERS @@ -769,6 +770,7 @@ LLVMGCC_VERSION LLVMGCC_MAJVERS LLVMGCC_LANGS SHLIBEXT +SHLIBPATH_VAR LLVM_PREFIX LLVM_BINDIR LLVM_LIBDIR @@ -1401,6 +1403,7 @@ Optional Features: --enable-threads Use threads if available (default is YES) --enable-pic Build LLVM with Position Independent Code (default is YES) + --enable-shared Link LLVM tools shared (default is NO) --enable-targets Build specific host targets: all or target1,target2,... Valid targets are: host, x86, x86_64, sparc, powerpc, alpha, arm, mips, spu, @@ -4857,6 +4860,25 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then + enableval=$enable_shared; +else + enableval=default +fi + +case "$enableval" in + yes) ENABLE_SHARED=1 + ;; + no) ENABLE_SHARED=0 + ;; + default) ENABLE_SHARED=0 + ;; + *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&5 +echo "$as_me: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&2;} + { (exit 1); exit 1; }; } ;; +esac + TARGETS_TO_BUILD="" # Check whether --enable-targets was given. if test "${enable_targets+set}" = set; then @@ -11035,7 +11057,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <conf$$subs.sed <<_ACEOF +ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim ENABLE_LLVMC_DYNAMIC_PLUGINS!$ENABLE_LLVMC_DYNAMIC_PLUGINS$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim @@ -20773,6 +20799,7 @@ LLVMGCC_VERSION!$LLVMGCC_VERSION$ac_delim LLVMGCC_MAJVERS!$LLVMGCC_MAJVERS$ac_delim LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim SHLIBEXT!$SHLIBEXT$ac_delim +SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim LLVM_PREFIX!$LLVM_PREFIX$ac_delim LLVM_BINDIR!$LLVM_BINDIR$ac_delim LLVM_LIBDIR!$LLVM_LIBDIR$ac_delim @@ -20793,7 +20820,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -- cgit v1.1