diff options
author | Roland McGrath <roland@hack.frob.com> | 2015-03-04 13:52:45 -0800 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2015-03-04 13:52:45 -0800 |
commit | e4693aa7c1777e6849b7bbb5fc9061e883bd58fd (patch) | |
tree | f89dc38ae728741604ae089adc528f8e361dd33e /configure.ac | |
parent | 8e2e833ac4d6509b152d6b8d74d388725717c56f (diff) | |
download | glibc-e4693aa7c1777e6849b7bbb5fc9061e883bd58fd.tar.gz |
Avoid C++ tests when the C++ cannot be linked.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 11 |
1 files changed, 10 insertions, 1 deletions
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]) |