[llvm] r197380 - llvm-config: Print SYSTEM_LIBS with --libs, instead of --ldflags.

NAKAMURA Takumi geek4civic at gmail.com
Mon Dec 16 03:22:22 PST 2013


Author: chapuni
Date: Mon Dec 16 05:22:22 2013
New Revision: 197380

URL: http://llvm.org/viewvc/llvm-project?rev=197380&view=rev
Log:
llvm-config: Print SYSTEM_LIBS with --libs, instead of --ldflags.

LLVM libs are printed in the first line, and system libs are printed in the next line.

  $ bin/llvm-config --libs object
  -lLLVMObject -lLLVMSupport
  -lrt -ldl -ltinfo -lpthread -lz

It is workaround for PR3347 and PR8449.

Modified:
    llvm/trunk/tools/llvm-config/llvm-config.cpp

Modified: llvm/trunk/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.cpp?rev=197380&r1=197379&r2=197380&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Mon Dec 16 05:22:22 2013
@@ -278,8 +278,7 @@ int main(int argc, char **argv) {
       } else if (Arg == "--cxxflags") {
         OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n';
       } else if (Arg == "--ldflags") {
-        OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS
-           << ' ' << LLVM_SYSTEM_LIBS << '\n';
+        OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS << '\n';
       } else if (Arg == "--libs") {
         PrintLibs = true;
       } else if (Arg == "--libnames") {
@@ -358,6 +357,13 @@ int main(int argc, char **argv) {
         OS << ActiveLibDir << '/' << Lib;
       }
     }
+
+    // Print system libs in the next line.
+    // Assume LLVMSupport depends on system_libs.
+    // FIXME: LLVMBuild may take care of dependencies to system_libs.
+    if (PrintLibs)
+      OS << '\n' << LLVM_SYSTEM_LIBS;
+
     OS << '\n';
   } else if (!Components.empty()) {
     errs() << "llvm-config: error: components given, but unused\n\n";





More information about the llvm-commits mailing list