[PATCH] Define and use TARGET_CC and TARGET_CXX
H.J. Lu
hjl.tools@gmail.com
Mon Dec 16 22:19:53 GMT 2024
CC and CXX will be overridden by TEST_CC and TEST_CXX in testing. Define
and use TARGET_CC and TARGET_CXX for check-installed-headers.sh since it
uses -finput-charset=ascii which isn't supported by Clang.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
Makefile | 8 ++++----
Rules | 8 ++++----
configure | 5 +++++
configure.ac | 6 ++++++
4 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index c84f266ce7..f55bd38e99 100644
--- a/Makefile
+++ b/Makefile
@@ -546,20 +546,20 @@ libof-check-installed-headers-c := testsuite
$(objpfx)check-installed-headers-c.out: \
scripts/check-installed-headers.sh $(headers)
$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
- "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+ "$(TARGET_CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
$(headers) > $@; \
$(evaluate-test)
-ifneq "$(CXX)" ""
+ifneq "$(TARGET_CXX)" ""
tests-special += $(objpfx)check-installed-headers-cxx.out
libof-check-installed-headers-cxx := testsuite
$(objpfx)check-installed-headers-cxx.out: \
scripts/check-installed-headers.sh $(headers)
$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
- "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+ "$(TARGET_CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
$(headers) > $@; \
$(evaluate-test)
-endif # $(CXX)
+endif # $(TARGET_CXX)
tests-special += $(objpfx)check-wrapper-headers.out
$(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers)
diff --git a/Rules b/Rules
index 713c225d2e..895d0cab8e 100644
--- a/Rules
+++ b/Rules
@@ -86,11 +86,11 @@ libof-check-installed-headers-c := testsuite
$(objpfx)check-installed-headers-c.out: \
$(..)scripts/check-installed-headers.sh $(headers)
$(SHELL) $(..)scripts/check-installed-headers.sh c $(supported-fortify) \
- "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
+ "$(TARGET_CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
$(headers) > $@; \
$(evaluate-test)
-ifneq "$(CXX)" ""
+ifneq "$(TARGET_CXX)" ""
# If a C++ compiler is available, also test that they can be compiled
# in isolation as C++.
tests-special += $(objpfx)check-installed-headers-cxx.out
@@ -98,10 +98,10 @@ libof-check-installed-headers-cxx := testsuite
$(objpfx)check-installed-headers-cxx.out: \
$(..)scripts/check-installed-headers.sh $(headers)
$(SHELL) $(..)scripts/check-installed-headers.sh c++ $(supported-fortify) \
- "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
+ "$(TARGET_CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
$(headers) > $@; \
$(evaluate-test)
-endif # $(CXX)
+endif # $(TARGET_CXX)
# Test that a wrapper header exists in include/ for each non-sysdeps header.
# This script does not need $(py-env).
diff --git a/configure b/configure
index 4366b1f6c2..e6b43cd836 100755
--- a/configure
+++ b/configure
@@ -4385,6 +4385,11 @@ then :
CXX=; TEST_CXX=
fi
+config_vars="$config_vars
+TARGET_CC = $CC"
+config_vars="$config_vars
+TARGET_CXX = $CXX"
+
if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
as_fn_error $? "you must configure in a separate build directory" "$LINENO" 5
fi
diff --git a/configure.ac b/configure.ac
index 62de722e61..26eee64e21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,12 @@ AC_LANG_POP([C++])])
CXX="$saved_CXX"
AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=; TEST_CXX=])
+dnl NB: CC and CXX will be overridden by TEST_CC and TEST_CXX in testing.
+dnl Define and use TARGET_CC and TARGET_CXX for check-installed-headers.sh
+dnl since it uses -finput-charset=ascii which isn't supported by Clang.
+LIBC_CONFIG_VAR([TARGET_CC], [$CC])
+LIBC_CONFIG_VAR([TARGET_CXX], [$CXX])
+
if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
AC_MSG_ERROR([you must configure in a separate build directory])
fi
--
2.47.1
More information about the Libc-alpha
mailing list