[PATCH] llvm-config: Print system-libs on the same line as libs

Aaron Watry awatry at gmail.com
Fri Jan 10 14:58:59 PST 2014


Before r197664, system libraries were produced on the same line as the
libraries.  This goes back to that behavior.

If the user requests only system-libs, then print it on a single line.

If the user requests libnames/libfiles, then split it into separate
lines because the two have different semantic meanings.

Signed-off-by: Aaron Watry <awatry at gmail.com>
---
 tools/llvm-config/llvm-config.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 53368ff..c654faf 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -365,12 +365,21 @@ int main(int argc, char **argv) {
         OS << ActiveLibDir << '/' << Lib;
       }
     }
-    OS << '\n';
 
     // Print SYSTEM_LIBS after --libs.
     // FIXME: Each LLVM component may have its dependent system libs.
+
+    //If we are printing libraries for linking and not lib names/paths, then
+    //join system libs with a space, otherwise newline
+    if (PrintLibs && !PrintLibNames && !PrintLibFiles)
+      OS << ' ';
+    else
+      if (PrintLibs || PrintLibNames || PrintLibFiles)
+        OS << '\n';
+
     if (PrintSystemLibs)
-      OS << LLVM_SYSTEM_LIBS << '\n';
+      OS << LLVM_SYSTEM_LIBS;
+    OS << '\n';
   } else if (!Components.empty()) {
     errs() << "llvm-config: error: components given, but unused\n\n";
     usage();
-- 
1.8.3.2




More information about the llvm-commits mailing list