llvm.org GIT mirror llvm / cbce286
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197664 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 5 years ago
1 changed file(s) with 11 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
146146 --cflags C compiler flags for files that include LLVM headers.\n\
147147 --cxxflags C++ compiler flags for files that include LLVM headers.\n\
148148 --ldflags Print Linker flags.\n\
149 --system-libs Sytem Libraries needed to link against LLVM components.\n\
149150 --libs Libraries needed to link against LLVM components.\n\
150151 --libnames Bare library names for in-tree builds.\n\
151152 --libfiles Fully qualified library filenames for makefile depends.\n\
171172 int main(int argc, char **argv) {
172173 std::vector Components;
173174 bool PrintLibs = false, PrintLibNames = false, PrintLibFiles = false;
175 bool PrintSystemLibs = false;
174176 bool HasAnyOption = false;
175177
176178 // llvm-config is designed to support being run both from a development tree
284286 } else if (Arg == "--cxxflags") {
285287 OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n';
286288 } else if (Arg == "--ldflags") {
287 OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS
288 << ' ' << LLVM_SYSTEM_LIBS << '\n';
289 OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS << '\n';
290 } else if (Arg == "--system-libs") {
291 PrintSystemLibs = true;
289292 } else if (Arg == "--libs") {
290293 PrintLibs = true;
291294 } else if (Arg == "--libnames") {
329332 if (!HasAnyOption)
330333 usage();
331334
332 if (PrintLibs || PrintLibNames || PrintLibFiles) {
335 if (PrintLibs || PrintLibNames || PrintLibFiles || PrintSystemLibs) {
333336 // If no components were specified, default to "all".
334337 if (Components.empty())
335338 Components.push_back("all");
360363 }
361364 }
362365 OS << '\n';
366
367 // Print SYSTEM_LIBS after --libs.
368 // FIXME: Each LLVM component may have its dependent system libs.
369 if (PrintSystemLibs)
370 OS << LLVM_SYSTEM_LIBS << '\n';
363371 } else if (!Components.empty()) {
364372 errs() << "llvm-config: error: components given, but unused\n\n";
365373 usage();