aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2015-10-26 09:41:10 +0100
committerFlorian Weimer <fweimer@redhat.com>2015-10-26 09:41:10 +0100
commitd337ceb76d898935560dc264cf2ad36b17017db7 (patch)
tree84cb919ecbbd180c08340109d723ecf84ec198b3 /configure.ac
parent6d834d2216bcc733fa04c5a59b5ac6f6f1134f2b (diff)
downloadglibc-d337ceb76d898935560dc264cf2ad36b17017db7.tar
glibc-d337ceb76d898935560dc264cf2ad36b17017db7.tar.gz
glibc-d337ceb76d898935560dc264cf2ad36b17017db7.tar.bz2
glibc-d337ceb76d898935560dc264cf2ad36b17017db7.zip
Use the CXX compiler only if it can create dynamic and static programs
* configure.ac (CXX): Clear the variable if the C++ toolchain does not support static linking. * configure: Regenerate.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 17 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index e502aa5db2..3c7f6c0096 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,9 +57,26 @@ AC_PROG_CXX
# It's useless to us if it can't link programs (e.g. missing -lstdc++).
AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
AC_LANG_PUSH([C++])
+# Default, dynamic case.
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[libc_cv_cxx_link_ok=yes],
[libc_cv_cxx_link_ok=no])
+# Static case.
+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_link_ok=no])
+LDFLAGS="$old_LDFLAGS"
AC_LANG_POP([C++])])
AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])