]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
build: Save/restore CXXFLAGS for zstd tests
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 25 Nov 2025 21:25:48 +0000 (22:25 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 25 Nov 2025 21:25:48 +0000 (22:25 +0100)
I recently encountered a bootstrap failure on trunk caused by the fact
that an older out-of-tree version of ansidecl.h was found before the
in-tree one in $top_srcdir/include, so some macros from that header
that are used in gcc weren't defined.

The out-of-tree version was located in $ZSTD_INC (-I/vol/gcc/include)
which caused that directory to be included in gcc's CXXFLAGS like

CXXFLAGS='-g -O2 -fchecking=1 -I/vol/gcc/include'

causing it to be searched before $srcdir/../include.

I could trace this to the zstd.h test in gcc/configure.ac which sets
CXXFLAGS and LDFLAGS before the actual test, but doesn't reset them
afterwards.

So this patch does just that.

Bootstrapped without regressions on i386-pc-solaris2.11 and
x86_64-pc-linux-gnu.

2025-10-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* configure.ac (gcc_cv_header_zstd_h): Save, restore CXXFLAGS,
LDFLAGS.
* configure: Regenerate.

gcc/configure
gcc/configure.ac

index eba199a8526207528a5d174fdba05baaf3481dc3..d7074355e42b5dc860d8a2690b97a9942b852d58 100755 (executable)
@@ -10492,6 +10492,8 @@ if test "x$ZSTD_LIB" != x \
   ZSTD_LDFLAGS=-L$ZSTD_LIB
 fi
 
+saved_CXXFLAGS="$CXXFLAGS"
+saved_LDFLAGS="$LDFLAGS"
 CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
 LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
 
@@ -10600,6 +10602,9 @@ elif test "x$with_zstd" != x; then
 fi
 fi
 
+CXXFLAGS="$saved_CXXFLAGS"
+LDFLAGS="$saved_LDFLAGS"
+
 
 
 for ac_func in times clock kill getrlimit setrlimit atoq \
@@ -21872,7 +21877,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21875 "configure"
+#line 21880 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21978,7 +21983,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21981 "configure"
+#line 21986 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index 598c09761cbc0abfe45d4ee6a381e01c7f942826..b6d9608d5994f559fe7b1ccd1deb86a530195615 100644 (file)
@@ -1502,6 +1502,8 @@ if test "x$ZSTD_LIB" != x \
   ZSTD_LDFLAGS=-L$ZSTD_LIB
 fi
 
+saved_CXXFLAGS="$CXXFLAGS"
+saved_LDFLAGS="$LDFLAGS"
 CXXFLAGS="$CXXFLAGS $ZSTD_CPPFLAGS"
 LDFLAGS="$LDFLAGS $ZSTD_LDFLAGS"
 
@@ -1533,6 +1535,9 @@ elif test "x$with_zstd" != x; then
 fi
 fi
 
+CXXFLAGS="$saved_CXXFLAGS"
+LDFLAGS="$saved_LDFLAGS"
+
 dnl Disabled until we have a complete test for buggy enum bitfields.
 dnl gcc_AC_C_ENUM_BF_UNSIGNED