summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2017-01-06 21:33:54 +0000
committerMichal Gorny <mgorny@gentoo.org>2017-01-06 21:33:54 +0000
commit4d3523945dee825652d127c9b81dcc37980cbf29 (patch)
tree037cd0438b73489fcb17aca96b6324080aaf9e3b /test
parent1159e421994d6bab805683f41a069e9189ed2ac4 (diff)
[llvm-config] Print --system-libs only when static linking
Modify the --system-libs option in llvm-config to print system libs only when using static linking. The system libraries are irrelevant when linking to a shared library since the library has appropriate library dependencies embedded. Modify the --system-libs test appropriately to force static linking, and disable it if static libs are not available (i.e. BUILD_SHARED_LIBS is enabled). Differential Revision: https://reviews.llvm.org/D27805 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt3
-rw-r--r--test/lit.cfg4
-rw-r--r--test/lit.site.cfg.in1
-rw-r--r--test/tools/llvm-config/system-libs.test3
-rw-r--r--test/tools/llvm-config/system-libs.windows.test3
5 files changed, 11 insertions, 3 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 3bef0209620..c1667049f80 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -7,7 +7,8 @@ llvm_canonicalize_cmake_booleans(
HAVE_LIBZ
HAVE_LIBXAR
LLVM_ENABLE_DIA_SDK
- LLVM_ENABLE_FFI)
+ LLVM_ENABLE_FFI
+ BUILD_SHARED_LIBS)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
diff --git a/test/lit.cfg b/test/lit.cfg
index f3b1d1c1ed2..e9916b2a60e 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -377,6 +377,10 @@ else:
if loadable_module:
config.available_features.add('loadable_module')
+# Static libraries are not built if BUILD_SHARED_LIBS is ON.
+if not config.build_shared_libs:
+ config.available_features.add("static-libs")
+
# Sanitizers.
if 'Address' in config.llvm_use_sanitizer:
config.available_features.add("asan")
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 4bf1211eeff..b6a8b8b17bc 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -38,6 +38,7 @@ config.have_zlib = @HAVE_LIBZ@
config.have_libxar = @HAVE_LIBXAR@
config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
config.enable_ffi = @LLVM_ENABLE_FFI@
+config.build_shared_libs = @BUILD_SHARED_LIBS@
# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
diff --git a/test/tools/llvm-config/system-libs.test b/test/tools/llvm-config/system-libs.test
index 6a1f3e39fa1..9105d242e04 100644
--- a/test/tools/llvm-config/system-libs.test
+++ b/test/tools/llvm-config/system-libs.test
@@ -1,4 +1,5 @@
-RUN: llvm-config --system-libs 2>&1 | FileCheck %s
+RUN: llvm-config --link-static --system-libs 2>&1 | FileCheck %s
+REQUIRES: static-libs
UNSUPPORTED: system-windows
CHECK: -l
CHECK-NOT: error
diff --git a/test/tools/llvm-config/system-libs.windows.test b/test/tools/llvm-config/system-libs.windows.test
index cc976ea3406..2c6e03afa2d 100644
--- a/test/tools/llvm-config/system-libs.windows.test
+++ b/test/tools/llvm-config/system-libs.windows.test
@@ -1,4 +1,5 @@
-RUN: llvm-config --system-libs 2>&1 | FileCheck %s
+RUN: llvm-config --link-static --system-libs 2>&1 | FileCheck %s
+REQUIRES: static-libs
REQUIRES: system-windows
CHECK-NOT: -l
CHECK: psapi.lib shell32.lib ole32.lib uuid.lib