aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-12 19:13:52 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-12 19:51:24 +0800
commit3ac826b0200e6972de81fe0469c1f8868c0e52ce (patch)
treec52598be293a1cfb830453cf5621e7158bdde59c
parent6bc301672bfbde618d4ec02e51e6e2cbadd4ac1e (diff)
downloadglibc-3ac826b0200e6972de81fe0469c1f8868c0e52ce.zip
glibc-3ac826b0200e6972de81fe0469c1f8868c0e52ce.tar.gz
glibc-3ac826b0200e6972de81fe0469c1f8868c0e52ce.tar.bz2
Clear CXX and TEST_CXX if C++ link test fails
Since the C++ compiler is used only for testing, use TEST_CXX as the C++ compiler if available. If C++ link test fails, clear both CXX and TEST_CXX so that the C++ compiler isn't used for glibc build nor test. Tested for m68k-linux-gnu-coldfire build and native build on x86-64. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
-rwxr-xr-xconfigure7
-rw-r--r--configure.ac7
2 files changed, 2 insertions, 12 deletions
diff --git a/configure b/configure
index fbfe849..37877d5 100755
--- a/configure
+++ b/configure
@@ -4301,10 +4301,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -z "$TEST_CXX"; then
- saved_CXX=
TEST_CXX="$CXX"
else
- saved_CXX="$CXX"
CXX="$TEST_CXX"
fi
# It's useless to us if it can't link programs (e.g. missing -lstdc++).
@@ -4382,10 +4380,7 @@ fi
printf "%s\n" "$libc_cv_cxx_link_ok" >&6; }
if test $libc_cv_cxx_link_ok != yes
then :
- CXX=
-fi
-if test -n "$saved_CXX"; then
- CXX="$saved_CXX"
+ CXX=; TEST_CXX=
fi
if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
diff --git a/configure.ac b/configure.ac
index 1b0e07d..dca8991 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,10 +78,8 @@ AC_PROG_CXX
AC_ARG_VAR([TEST_CXX],
[C++ compiler for testing])
if test -z "$TEST_CXX"; then
- saved_CXX=
TEST_CXX="$CXX"
else
- saved_CXX="$CXX"
CXX="$TEST_CXX"
fi
# It's useless to us if it can't link programs (e.g. missing -lstdc++).
@@ -110,10 +108,7 @@ main()
LDFLAGS="$old_LDFLAGS"
fi
AC_LANG_POP([C++])])
-AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
-if test -n "$saved_CXX"; then
- CXX="$saved_CXX"
-fi
+AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=; TEST_CXX=])
if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
AC_MSG_ERROR([you must configure in a separate build directory])