aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2015-03-04 13:52:45 -0800
committerRoland McGrath <roland@hack.frob.com>2015-03-04 13:52:45 -0800
commite4693aa7c1777e6849b7bbb5fc9061e883bd58fd (patch)
treef89dc38ae728741604ae089adc528f8e361dd33e /configure.ac
parent8e2e833ac4d6509b152d6b8d74d388725717c56f (diff)
downloadglibc-e4693aa7c1777e6849b7bbb5fc9061e883bd58fd.zip
glibc-e4693aa7c1777e6849b7bbb5fc9061e883bd58fd.tar.gz
glibc-e4693aa7c1777e6849b7bbb5fc9061e883bd58fd.tar.bz2
Avoid C++ tests when the C++ cannot be linked.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac11
1 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 8043a27..678c739 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,9 +50,18 @@ if test $host != $build; then
fi
AC_SUBST(cross_compiling)
AC_PROG_CPP
+AC_CHECK_TOOL(READELF, readelf, false)
+
# We need the C++ compiler only for testing.
AC_PROG_CXX
-AC_CHECK_TOOL(READELF, readelf, false)
+# 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++])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [libc_cv_cxx_link_ok=yes],
+ [libc_cv_cxx_link_ok=no])
+AC_LANG_POP([C++])])
+AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
AC_MSG_ERROR([you must configure in a separate build directory])