aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2024-12-14 08:43:01 +0800
committerH.J. Lu <hjl.tools@gmail.com>2024-12-14 19:18:33 +0800
commitad36038c32eb3601f90f38cab90fda1f6031f4e4 (patch)
tree768265d2d18497f262f8afed6751614e186ecbb2
parentca7d48a80f73129ac8492832d0bdbaa365c21ab7 (diff)
downloadglibc-ad36038c32eb3601f90f38cab90fda1f6031f4e4.tar.xz
glibc-ad36038c32eb3601f90f38cab90fda1f6031f4e4.zip
Don't use TEST_CXX as CXX for build
Since the C++ compiler is also used to compile links-dso-program.cc in libsupport, use TEST_CXX to get C++ headers for testing, but don't use TEST_CXX as CXX for build. 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-xconfigure9
-rw-r--r--configure.ac9
2 files changed, 14 insertions, 4 deletions
diff --git a/configure b/configure
index 37877d5b97..2c2b19f9a6 100755
--- a/configure
+++ b/configure
@@ -3910,7 +3910,7 @@ esac
fi
-# We need the C++ compiler only for testing.
+# We need the C++ compiler for testing and libsupport.
@@ -4300,6 +4300,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+saved_CXX="$CXX"
if test -z "$TEST_CXX"; then
TEST_CXX="$CXX"
else
@@ -4378,6 +4379,7 @@ esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cxx_link_ok" >&5
printf "%s\n" "$libc_cv_cxx_link_ok" >&6; }
+CXX="$saved_CXX"
if test $libc_cv_cxx_link_ok != yes
then :
CXX=; TEST_CXX=
@@ -6535,7 +6537,9 @@ fi
# Obtain some C++ header file paths. This is used to make a local
# copy of those headers in Makerules.
-if test -n "$CXX"; then
+if test -n "$TEST_CXX"; then
+ saved_CXX="$CXX"
+ CXX="$TEST_CXX"
find_cxx_header () {
echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
| $AWK '$1 == "."{print $2}'
@@ -6543,6 +6547,7 @@ if test -n "$CXX"; then
CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
CXX_CMATH_HEADER="$(find_cxx_header cmath)"
CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
+ CXX="$saved_CXX"
fi
diff --git a/configure.ac b/configure.ac
index dca8991fbf..1de79bd729 100644
--- a/configure.ac
+++ b/configure.ac
@@ -73,10 +73,11 @@ AC_ARG_ENABLE([static-c++-link-check],
[static_cxx_link_check=$enableval],
[static_cxx_link_check=yes])
-# We need the C++ compiler only for testing.
+# We need the C++ compiler for testing and libsupport.
AC_PROG_CXX
AC_ARG_VAR([TEST_CXX],
[C++ compiler for testing])
+saved_CXX="$CXX"
if test -z "$TEST_CXX"; then
TEST_CXX="$CXX"
else
@@ -108,6 +109,7 @@ main()
LDFLAGS="$old_LDFLAGS"
fi
AC_LANG_POP([C++])])
+CXX="$saved_CXX"
AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=; TEST_CXX=])
if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
@@ -1077,7 +1079,9 @@ AC_SUBST(CXX_SYSINCLUDES)
# Obtain some C++ header file paths. This is used to make a local
# copy of those headers in Makerules.
-if test -n "$CXX"; then
+if test -n "$TEST_CXX"; then
+ saved_CXX="$CXX"
+ CXX="$TEST_CXX"
find_cxx_header () {
echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
| $AWK '$1 == "."{print $2}'
@@ -1085,6 +1089,7 @@ if test -n "$CXX"; then
CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
CXX_CMATH_HEADER="$(find_cxx_header cmath)"
CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
+ CXX="$saved_CXX"
fi
AC_SUBST(CXX_CSTDLIB_HEADER)
AC_SUBST(CXX_CMATH_HEADER)