llvm.org GIT mirror llvm / c20f894
Revert "Fix `llvm-config` to emit the linker flag for the combined shared object built by autoconfig/make instead of the individual components." This reverts commit 01446706b4c0a86bb64768f307079cab5c514aa3. Causes breakage, seems to be related to 'svn' in the file's name: CC=gcc CXX=g++ \ ../llvm/configure \ --prefix=/usr \ --sysconfdir=/etc \ --enable-shared \ --enable-libffi \ --enable-targets=all \ --disable-assertions \ --with-python=/usr/bin/python2 \ --enable-optimized make REQUIRES_RTTI=1 ENABLE_PIC=1 results: llvm[2]: Linking Release unit test Support (without symbols) llvm[2]: ======= Finished Linking Release Unit test Support (without symbols) make[3]: Entering directory '/build/llvm-svn/src/build/bindings/ocaml/llvm' make[3]: *** No rule to make target '/build/llvm- svn/src/build/Release/lib/ocaml/libLLVM-3.7.0svn.so', needed by 'build- deplibs'. Stop. make[3]: *** Waiting for unfinished jobs.... llvm[3]: Compiling llvm_ocaml.c for Release build make[3]: Leaving directory '/build/llvm-svn/src/build/bindings/ocaml/llvm' /build/llvm-svn/src/llvm/Makefile.rules:880: recipe for target 'all' failed /build/llvm-svn/src/llvm/Makefile.rules:965: recipe for target 'all' failed Differential Revision: http://reviews.llvm.org/D10716 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242152 91177308-0d34-0410-b5e6-96231b3b80d8 JF Bastien 5 years ago
4 changed file(s) with 2 addition(s) and 50 deletion(s). Raw diff Collapse all Expand all
2525 #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
2626 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
2727 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
28 #define BUILD_SHARED_LIBS "@BUILD_SHARED_LIBS@"
29 #define WAS_BUILT_WITH_CMAKE "@WAS_BUILT_WITH_CMAKE@"
1919 set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}")
2020 set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
2121 set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
22 set(WAS_BUILT_WITH_CMAKE "ON")
2322 string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}")
2423 configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
2524
6464 >> temp.sed
6565 $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
6666 >> temp.sed
67 $(if $(filter-out $(ENABLE_SHARED),0),\
68 $(Verb) $(ECHO) 's/@BUILD_SHARED_LIBS@/ON/',\
69 $(Verb) $(ECHO) 's/@BUILD_SHARED_LIBS@/OFF/') \
70 >> temp.sed
71 $(Verb) $(ECHO) 's/@WAS_BUILT_WITH_CMAKE@/OFF/' \
72 >> temp.sed
7367 $(Verb) $(SED) -f temp.sed < $< > $@
7468 $(Verb) $(RM) temp.sed
7569
348348 /*IncludeNonInstalled=*/IsInDevelopmentTree);
349349
350350 if (PrintLibs || PrintLibNames || PrintLibFiles) {
351 // If LLVM was built as a shared library, there will be only one thing
352 // that users should link against.
353 const bool IsSharedLib = (std::strcmp(BUILD_SHARED_LIBS, "ON") == 0);
354 const bool WasBuiltWithCMake = (std::strcmp(WAS_BUILT_WITH_CMAKE, "ON") == 0);
355 // CMake correctly builds components as separate shared libraries, however
356 // autoconfig/make builds components a static libraries and then links
357 // them all together to form a single shared library. Thus, only when
358 // `WAS_BUILT_WITH_CMAKE` is `OFF` and `BUILD_SHARED_LIBS` is `ON` do we
359 // override `RequiredLibs` with the single library name.
360 if (IsSharedLib && !WasBuiltWithCMake) {
361 RequiredLibs.clear();
362 std::string Name = "libLLVM-" PACKAGE_VERSION;
363 const Triple HostTriple(LLVM_DEFAULT_TARGET_TRIPLE);
364 if (HostTriple.isOSWindows()) {
365 Name += ".dll";
366 } else if (HostTriple.isOSDarwin()) {
367 Name += ".dylib";
368 } else {
369 // default to linux' ext:
370 Name += ".so";
371 }
372 RequiredLibs.push_back(Name);
373 }
374
375351 for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
376352 StringRef Lib = RequiredLibs[i];
377353 if (i)
383359 OS << ActiveLibDir << '/' << Lib;
384360 } else if (PrintLibs) {
385361 // If this is a typical library name, include it using -l.
386 if (Lib.startswith("lib")) {
387 size_t FromEnd = 0;
388 if (Lib.endswith(".a")) {
389 FromEnd = 2;
390 } else if (Lib.endswith(".so")) {
391 FromEnd = 3;
392 } else if (Lib.endswith(".dylib")) {
393 FromEnd = 6;
394 } else {
395 FromEnd = 0;
396 }
397
398 if (FromEnd != 0) {
399 OS << "-l" << Lib.slice(3, Lib.size() - FromEnd);
400 } else {
401 OS << "-l:" << Lib;
402 }
362 if (Lib.startswith("lib") && Lib.endswith(".a")) {
363 OS << "-l" << Lib.slice(3, Lib.size()-2);
403364 continue;
404365 }
405366