summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-config/llvm-config.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2013-12-19 08:46:36 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2013-12-19 08:46:36 +0000
commitf8c58c8dc84986381765ab9fc08fa113c7e8c375 (patch)
tree3ec5ea3474aa27be2fdd72e029fc26b3d1dba223 /llvm/tools/llvm-config/llvm-config.cpp
parent6e3c4235be473b39b3c56cec1c998df03e79ec99 (diff)
downloadbcm5719-llvm-f8c58c8dc84986381765ab9fc08fa113c7e8c375.tar.gz
bcm5719-llvm-f8c58c8dc84986381765ab9fc08fa113c7e8c375.zip
llvm-config: Introduce --system-libs to print SYSTEM_LIBS, and deprecate SYSTEM_LIBS in --ldflags.
Although --system-libs is expected to use after --libs, it can be used alone. $ bin/llvm-config --ldflags -L/path/to/llvm/objroot/lib $ bin/llvm-config --libs object -lLLVMObject -lLLVMSupport $ bin/llvm-config --system-libs (Blank line. "all" is assumed but nothing is printed.) -lrt -ldl -ltinfo -lpthread -lz $ bin/llvm-config --ldflags --libs --system-libs object -L/path/to/llvm/objroot/lib -lLLVMObject -lLLVMSupport -lrt -ldl -ltinfo -lpthread -lz It is reimplementation of r197380, and workaround for PR3347 and PR8449. FIXME: Each LLVM component may have its dependent system libs. llvm-svn: 197664
Diffstat (limited to 'llvm/tools/llvm-config/llvm-config.cpp')
-rw-r--r--llvm/tools/llvm-config/llvm-config.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
index 040d1110333..546963d833f 100644
--- a/llvm/tools/llvm-config/llvm-config.cpp
+++ b/llvm/tools/llvm-config/llvm-config.cpp
@@ -147,6 +147,7 @@ Options:\n\
--cflags C compiler flags for files that include LLVM headers.\n\
--cxxflags C++ compiler flags for files that include LLVM headers.\n\
--ldflags Print Linker flags.\n\
+ --system-libs Sytem Libraries needed to link against LLVM components.\n\
--libs Libraries needed to link against LLVM components.\n\
--libnames Bare library names for in-tree builds.\n\
--libfiles Fully qualified library filenames for makefile depends.\n\
@@ -172,6 +173,7 @@ std::string GetExecutablePath(const char *Argv0) {
int main(int argc, char **argv) {
std::vector<StringRef> Components;
bool PrintLibs = false, PrintLibNames = false, PrintLibFiles = false;
+ bool PrintSystemLibs = false;
bool HasAnyOption = false;
// llvm-config is designed to support being run both from a development tree
@@ -285,8 +287,9 @@ 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 == "--system-libs") {
+ PrintSystemLibs = true;
} else if (Arg == "--libs") {
PrintLibs = true;
} else if (Arg == "--libnames") {
@@ -330,7 +333,7 @@ int main(int argc, char **argv) {
if (!HasAnyOption)
usage();
- if (PrintLibs || PrintLibNames || PrintLibFiles) {
+ if (PrintLibs || PrintLibNames || PrintLibFiles || PrintSystemLibs) {
// If no components were specified, default to "all".
if (Components.empty())
Components.push_back("all");
@@ -361,6 +364,11 @@ int main(int argc, char **argv) {
}
}
OS << '\n';
+
+ // Print SYSTEM_LIBS after --libs.
+ // FIXME: Each LLVM component may have its dependent system libs.
+ if (PrintSystemLibs)
+ OS << LLVM_SYSTEM_LIBS << '\n';
} else if (!Components.empty()) {
errs() << "llvm-config: error: components given, but unused\n\n";
usage();
OpenPOWER on IntegriCloud