2015-10-23 Florian Weimer <fweimer@redhat.com>
* configure.ac (libc_cv_cxx_static): New test for checking the C++
compiler supports static linking.
* configure: Regenerated.
* config.make.in (have-cxx-static): New variable.
* nptl/Makefile [!CXX] (tests-unsupported): Remove
tst-cancel24-static.
[!have-cxx-static] (tests-unsupported): Add tst-cancel24-static.
@@ -66,6 +66,7 @@ bind-now = @bindnow@
have-hash-style = @libc_cv_hashstyle@
use-default-link = @use_default_link@
output-format = @libc_cv_output_format@
+have-cxx-static = @libc_cv_cxx_static@
have-cxx-thread_local = @libc_cv_cxx_thread_local@
multi-arch = @multi_arch@
@@ -1815,6 +1815,27 @@ fi
dnl C++ feature tests.
AC_LANG_PUSH([C++])
+AC_CACHE_CHECK([whether the C++ can create static programs],
+ libc_cv_cxx_static, [
+
+old_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS -static"
+AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <iostream>
+
+int
+main()
+{
+ std::cout << "Hello, world!";
+ return 0;
+}
+])],
+ [libc_cv_cxx_static=yes],
+ [libc_cv_cxx_static=no])
+])
+AC_SUBST(libc_cv_cxx_static)
+LDFLAGS="$old_LDFLAGS"
+
AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
libc_cv_cxx_thread_local, [
old_CXXFLAGS="$CXXFLAGS"
@@ -405,8 +405,14 @@ endif
ifeq (,$(CXX))
# These tests require a C++ compiler and runtime.
-tests-unsupported += tst-cancel24 tst-cancel24-static tst-once5
+tests-unsupported += tst-cancel24 tst-once5
endif
+
+ifneq ($(have-cxx-static),yes)
+# These tests require C++ support with static liking.
+tests-unsupported += tst-cancel24-static
+endif
+
# These tests require a C++ compiler and runtime with thread_local support.
ifneq ($(have-cxx-thread_local),yes)
tests-unsupported += tst-thread_local1
--
2.4.3