From e4693aa7c1777e6849b7bbb5fc9061e883bd58fd Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 4 Mar 2015 13:52:45 -0800 Subject: Avoid C++ tests when the C++ cannot be linked. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 8043a27c3f..678c7399ad 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]) -- cgit v1.2.3