llvm.org GIT mirror llvm / 407fbdd
Roll back r96959 again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96981 91177308-0d34-0410-b5e6-96231b3b80d8 Jeffrey Yasskin 9 years ago
13 changed file(s) with 12 addition(s) and 169 deletion(s). Raw diff Collapse all Expand all
2929 DIRS := lib/System lib/Support utils
3030 OPTIONAL_DIRS :=
3131 else
32 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-shlib \
33 tools/llvm-config tools runtime docs unittests
32 DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
33 tools runtime docs unittests
3434 OPTIONAL_DIRS := projects bindings
3535 endif
3636
261261 # Do we want to build with position independent code?
262262 ENABLE_PIC := @ENABLE_PIC@
263263
264 # Do we want to link the tools shared?
265 ifndef ENABLE_SHARED
266 ENABLE_SHARED := @ENABLE_SHARED@
267 endif
268
269264 # Use -fvisibility-inlines-hidden?
270265 ENABLE_VISIBILITY_INLINES_HIDDEN := @ENABLE_VISIBILITY_INLINES_HIDDEN@
271266
275270
276271 # Enable JIT for this platform
277272 TARGET_HAS_JIT = @TARGET_HAS_JIT@
278
279 # Environment variable to set to change the runtime shared library search path.
280 SHLIBPATH_VAR = @SHLIBPATH_VAR@
281273
282274 # Shared library extension for host platform.
283275 SHLIBEXT = @SHLIBEXT@
622622 ifneq ($(HOST_OS),Darwin)
623623 ifneq ($(DARWIN_MAJVERS),4)
624624 ifdef TOOLNAME
625 LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
626 ifdef EXAMPLE_TOOL
627 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
628 else
629 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
630 endif
625 ifdef EXAMPLE_TOOL
626 LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(RDYNAMIC)
627 else
628 LD.Flags += $(RPATH) -Wl,$(ToolDir) $(RDYNAMIC)
629 endif
631630 endif
632631 endif
633632 endif
960959
961960 $(ToolDir)/$(strip $(TOOLNAME))$(EXEEXT): $(LLVM_CONFIG)
962961
963 ifeq ($(ENABLE_SHARED), 1)
964 LLVMLibsOptions += -lLLVM-$(LLVMVersion)
965 LLVMLibsPaths += $(LibDir)/libLLVM-$(LLVMVersion)$(SHLIBEXT)
966 else
967962 LLVMLibsOptions += $(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS))
968963 LLVMLibsPaths += $(LLVM_CONFIG) \
969964 $(shell $(LLVM_CONFIG) --libfiles $(LINK_COMPONENTS))
970 endif
971965 endif
972966 endif
973967
11741168 # If neither BUILD_ARCHIVE or LOADABLE_MODULE are specified, default to
11751169 # building an archive.
11761170 #---------------------------------------------------------
1177 ifndef NO_BUILD_ARCHIVE
11781171 ifndef BUILD_ARCHIVE
11791172 ifndef LOADABLE_MODULE
11801173 BUILD_ARCHIVE = 1
1181 endif
11821174 endif
11831175 endif
11841176
471471 AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC,
472472 [Define if position independent code is enabled])
473473
474 dnl Allow linking tools against the shared library.
475 AC_ARG_ENABLE(shared,
476 AS_HELP_STRING([--enable-shared],
477 [Link LLVM tools shared (default is NO)]),,
478 enableval=default)
479 case "$enableval" in
480 yes) AC_SUBST(ENABLE_SHARED,[1]) ;;
481 no) AC_SUBST(ENABLE_SHARED,[0]) ;;
482 default) AC_SUBST(ENABLE_SHARED,[0]) ;;
483 *) AC_MSG_ERROR([Invalid setting for --enable-shared. Use "yes" or "no"]) ;;
484 esac
485
486474 dnl Allow specific targets to be specified for building (or not)
487475 TARGETS_TO_BUILD=""
488476 AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
13471335 dnl the Makefiles so we can use it there too
13481336 AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
13491337
1350 dnl Propagate the run-time library path variable that the libltdl
1351 dnl checks found to the Makefiles so we can use it there too
1352 AC_SUBST(SHLIBPATH_VAR,$libltdl_cv_shlibpath_var)
1353
13541338 # Translate the various configuration directories and other basic
13551339 # information into substitutions that will end up in Makefile.config.in
13561340 # that these configured values can be used by the makefiles
688688 ENABLE_DOXYGEN
689689 ENABLE_THREADS
690690 ENABLE_PIC
691 ENABLE_SHARED
692691 TARGETS_TO_BUILD
693692 LLVM_ENUM_TARGETS
694693 LLVM_ENUM_ASM_PRINTERS
770769 LLVMGCCDIR
771770 LLVMGCC_LANGS
772771 SHLIBEXT
773 SHLIBPATH_VAR
774772 LLVM_PREFIX
775773 LLVM_BINDIR
776774 LLVM_LIBDIR
14031401 --enable-threads Use threads if available (default is YES)
14041402 --enable-pic Build LLVM with Position Independent Code (default
14051403 is YES)
1406 --enable-shared Link LLVM tools shared (default is NO)
14071404 --enable-targets Build specific host targets: all or
14081405 target1,target2,... Valid targets are: host, x86,
14091406 x86_64, sparc, powerpc, alpha, arm, mips, spu,
48694866 _ACEOF
48704867
48714868
4872 # Check whether --enable-shared was given.
4873 if test "${enable_shared+set}" = set; then
4874 enableval=$enable_shared;
4875 else
4876 enableval=default
4877 fi
4878
4879 case "$enableval" in
4880 yes) ENABLE_SHARED=1
4881 ;;
4882 no) ENABLE_SHARED=0
4883 ;;
4884 default) ENABLE_SHARED=0
4885 ;;
4886 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&5
4887 echo "$as_me: error: Invalid setting for --enable-shared. Use \"yes\" or \"no\"" >&2;}
4888 { (exit 1); exit 1; }; } ;;
4889 esac
4890
48914869 TARGETS_TO_BUILD=""
48924870 # Check whether --enable-targets was given.
48934871 if test "${enable_targets+set}" = set; then
1113111109 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1113211110 lt_status=$lt_dlunknown
1113311111 cat > conftest.$ac_ext <
11134 #line 11130 "configure"
11112 #line 11108 "configure"
1113511113 #include "confdefs.h"
1113611114
1113711115 #if HAVE_DLFCN_H
1971019688 fi
1971119689
1971219690 SHLIBEXT=$libltdl_cv_shlibext
19713
19714
19715 SHLIBPATH_VAR=$libltdl_cv_shlibpath_var
1971619691
1971719692
1971819693 # Translate the various configuration directories and other basic
2077220747 ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim
2077320748 ENABLE_THREADS!$ENABLE_THREADS$ac_delim
2077420749 ENABLE_PIC!$ENABLE_PIC$ac_delim
20775 ENABLE_SHARED!$ENABLE_SHARED$ac_delim
2077620750 TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
2077720751 LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
2077820752 LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
2078220756 CLANGPATH!$CLANGPATH$ac_delim
2078320757 CLANGXXPATH!$CLANGXXPATH$ac_delim
2078420758 ENABLE_BUILT_CLANG!$ENABLE_BUILT_CLANG$ac_delim
20759 OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
2078520760 _ACEOF
2078620761
2078720762 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2082320798 ac_delim='%!_!# '
2082420799 for ac_last_try in false false false false false :; do
2082520800 cat >conf$$subs.sed <<_ACEOF
20826 OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim
2082720801 EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim
2082820802 BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim
2082920803 ENABLE_LLVMC_DYNAMIC!$ENABLE_LLVMC_DYNAMIC$ac_delim
2089520869 LLVMGCCDIR!$LLVMGCCDIR$ac_delim
2089620870 LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim
2089720871 SHLIBEXT!$SHLIBEXT$ac_delim
20898 SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim
2089920872 LLVM_PREFIX!$LLVM_PREFIX$ac_delim
2090020873 LLVM_BINDIR!$LLVM_BINDIR$ac_delim
2090120874 LLVM_LIBDIR!$LLVM_LIBDIR$ac_delim
2091620889 LTLIBOBJS!$LTLIBOBJS$ac_delim
2091720890 _ACEOF
2091820891
20919 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 91; then
20892 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then
2092020893 break
2092120894 elif $ac_last_try; then
2092220895 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
88 LEVEL = ../..
99 TOOLNAME = BrainF
1010 EXAMPLE_TOOL = 1
11 # To keep the shared library working, we link a few of the examples
12 # against it unconditionally.
13 ENABLE_SHARED = 1
1411
1512 LINK_COMPONENTS := jit bitwriter nativecodegen interpreter
1613
99 LEVEL = ../..
1010 TOOLNAME = Fibonacci
1111 EXAMPLE_TOOL = 1
12 # To keep the shared library working, we link a few of the examples
13 # against it unconditionally.
14 ENABLE_SHARED = 1
1512
1613 # Link in JIT support
1714 LINK_COMPONENTS := jit interpreter nativecodegen
88 LEVEL = ../..
99 TOOLNAME = HowToUseJIT
1010 EXAMPLE_TOOL = 1
11 # To keep the shared library working, we link a few of the examples
12 # against it unconditionally.
13 ENABLE_SHARED = 1
1411
1512 LINK_COMPONENTS := jit interpreter nativecodegen
1613
197197 -e "s#@LLVM_TOOLS_DIR@#$(ToolDir)#g" \
198198 -e "s#@LLVMGCCDIR@#$(LLVMGCCDIR)#g" \
199199 -e "s#@LLVM_BUILD_MODE@#$(BuildMode)#g" \
200 -e "s#@ENABLE_SHARED@#$(ENABLE_SHARED)#g" \
201 -e "s#@SHLIBPATH_VAR@#$(SHLIBPATH_VAR)#g" \
202200 $(PROJ_SRC_DIR)/Unit/lit.site.cfg.in > $@
2222
2323 ###
2424
25 # If necessary, point the dynamic loader at libLLVM.so.
26 if config.enable_shared:
27 libdir = os.path.join(config.llvm_obj_root, config.llvm_build_mode, 'lib')
28 shlibpath = config.environment.get(config.shlibpath_var,'')
29 if shlibpath:
30 shlibpath = ':' + shlibpath
31 shlibpath = libdir + shlibpath
32 config.environment[config.shlibpath_var] = shlibpath
25 import os
3326
3427 # Check that the object root is known.
3528 if config.test_exec_root is None:
44 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
55 config.llvmgcc_dir = "@LLVMGCCDIR@"
66 config.llvm_build_mode = "@LLVM_BUILD_MODE@"
7 config.enable_shared = @ENABLE_SHARED@
8 config.shlibpath_var = "@SHLIBPATH_VAR@"
97
108 # Let the main config do the real work.
119 lit.load_config(config, "@LLVM_SOURCE_DIR@/test/Unit/lit.cfg")
+0
-67
tools/llvm-shlib/Makefile less more
None ##===- tools/shlib/Makefile --------------------------------*- Makefile -*-===##
1 #
2 # The LLVM Compiler Infrastructure
3 #
4 # This file is distributed under the University of Illinois Open Source
5 # License. See LICENSE.TXT for details.
6 #
7 ##===----------------------------------------------------------------------===##
8
9 LEVEL = ../..
10 LIBRARYNAME = LLVM-$(LLVMVersion)
11
12 NO_BUILD_ARCHIVE = 1
13 LINK_LIBS_IN_SHARED = 1
14 SHARED_LIBRARY = 1
15
16 include $(LEVEL)/Makefile.common
17
18 # Include all archives in libLLVM.(so|dylib) except the ones that have
19 # their own dynamic libraries.
20 Archives := $(wildcard $(LibDir)/libLLVM*.a)
21 SharedLibraries := $(wildcard $(LibDir)/libLLVM*$(SHLIBEXT))
22 IncludeInLibLlvm := $(filter-out $(basename $(SharedLibraries)).a, $(Archives))
23 LLVMLibsOptions := $(IncludeInLibLlvm:$(LibDir)/lib%.a=-l%)
24 LLVMLibsPaths := $(IncludeInLibLlvm)
25
26 $(LibName.SO): $(LLVMLibsPaths)
27
28 ifeq ($(HOST_OS),Darwin)
29 # set dylib internal version number to llvmCore submission number
30 ifdef LLVM_SUBMIT_VERSION
31 LLVMLibsOptions := $(LLVMLibsOptions) -Wl,-current_version \
32 -Wl,$(LLVM_SUBMIT_VERSION).$(LLVM_SUBMIT_SUBVERSION) \
33 -Wl,-compatibility_version -Wl,1
34 endif
35 # Include everything from the .a's into the shared library.
36 LLVMLibsOptions := $(LLVMLibsOptions) -all_load
37 # extra options to override libtool defaults
38 LLVMLibsOptions := $(LLVMLibsOptions) \
39 -avoid-version \
40 -Wl,-dead_strip \
41 -Wl,-seg1addr -Wl,0xE0000000
42
43 # Mac OS X 10.4 and earlier tools do not allow a second -install_name on command line
44 DARWIN_VERS := $(shell echo $(TARGET_TRIPLE) | sed 's/.*darwin\([0-9]*\).*/\1/')
45 ifneq ($(DARWIN_VERS),8)
46 LLVMLibsOptions := $(LLVMLibsOptions) \
47 -Wl,-install_name \
48 -Wl,"@executable_path/../lib/lib$(LIBRARYNAME)$(SHLIBEXT)"
49 endif
50 endif
51
52 ifeq ($(HOST_OS), Linux)
53 # Include everything from the .a's into the shared library.
54 LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
55 -Wl,--no-whole-archive
56 # Warn if we'll need to modify the text segment when loading libLLVM.so.
57 LLVMLibsOptions += -Wl,--warn-shared-textrel
58 # Don't allow unresolved symbols.
59 LLVMLibsOptions += -Wl,--no-undefined
60 ifeq ($(ARCH), ARM)
61 # ARM's shared libgcc omits several of the __sync functions that are
62 # present in the static libgcc, so we also link in the static gcc. This
63 # is described at http://gcc.gnu.org/PR40133.
64 LLVMLibsOptions += -lgcc
65 endif
66 endif
2727 CPP.Flags += $(NO_VARIADIC_MACROS)
2828 TESTLIBS = -lGoogleTest -lUnitTestMain
2929
30 ifeq ($(ENABLE_SHARED), 1)
31 # Add the absolute path to the dynamic library. This is ok because
32 # we'll never install unittests.
33 LD.Flags += $(RPATH) -Wl,$(LibDir)
34 endif
35 ifeq ($(ENABLE_SHARED), 1)
36 # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most
37 # of the time.
38 Run.Shared := $(SHLIBPATH_VAR)="$(LibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)"
39 endif
40
4130 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
4231 $(Echo) Linking $(BuildMode) unit test $(TESTNAME) $(StripWarnMsg)
4332 $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \
4837 all:: $(LLVMUnitTestExe)
4938
5039 unitcheck:: $(LLVMUnitTestExe)
51 $(Run.Shared) $(LLVMUnitTestExe)
40 $(LLVMUnitTestExe)
5241
5342 endif