]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
tools: gnulib: do not cache C standard option test results 19627/head
authorMichael Pratt <mcpratt@pm.me>
Sat, 2 Aug 2025 08:12:17 +0000 (04:12 -0400)
committerNick Hainke <vincent@systemli.org>
Sat, 2 Aug 2025 22:41:05 +0000 (00:41 +0200)
After eliminating the possibility of automake having a bug
by testing a revert to the recent updates to automake,
the problems regarding autoreconf with some packages
was bisected to the gnulib update instead, through aclocal macros.

With the new module, std-gnu23, some packages are failing build
due to both the host compiler and cross compiler being tested for
availability of C23 standard features with the configure script.
The results of one is being cached and used for the other,
while the two compilers are different versions and may or may not
both support C23 options and would otherwise have conflicting results.

A similar patch may have to be done
for the next release of Autoconf
if upstream GNU does not accept this solution.

Reported-by: Georgi Valkov <gvalkov@gmail.com>
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/19627
Signed-off-by: Nick Hainke <vincent@systemli.org>
tools/gnulib/patches/190-stdc-m4-no-cache.patch [new file with mode: 0644]

diff --git a/tools/gnulib/patches/190-stdc-m4-no-cache.patch b/tools/gnulib/patches/190-stdc-m4-no-cache.patch
new file mode 100644 (file)
index 0000000..1505da8
--- /dev/null
@@ -0,0 +1,59 @@
+--- a/m4/std-gnu11.m4
++++ b/m4/std-gnu11.m4
+@@ -185,8 +185,7 @@ AC_LANG_POP(C++)dnl
+ # else ACTION-IF-UNAVAILABLE.
+ AC_DEFUN([_AC_C_STD_TRY],
+ [AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features])
+-AC_CACHE_VAL(ac_cv_prog_cc_$1,
+-[ac_cv_prog_cc_$1=no
++ac_cv_prog_cc_$1=no
+ ac_save_CC=$CC
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
+ for ac_arg in '' $4
+@@ -197,7 +196,6 @@ do
+ done
+ rm -f conftest.$ac_ext
+ CC=$ac_save_CC
+-])# AC_CACHE_VAL
+ ac_prog_cc_stdc_options=
+ case "x$ac_cv_prog_cc_$1" in
+   x)
+@@ -523,8 +521,7 @@ fi
+ AC_DEFUN([_AC_CXX_STD_TRY],
+ [AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features])
+ AC_LANG_PUSH(C++)dnl
+-AC_CACHE_VAL(ac_cv_prog_cxx_$1,
+-[ac_cv_prog_cxx_$1=no
++ac_cv_prog_cxx_$1=no
+ ac_save_CXX=$CXX
+ AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
+ for ac_arg in '' $4
+@@ -535,7 +532,6 @@ do
+ done
+ rm -f conftest.$ac_ext
+ CXX=$ac_save_CXX
+-])# AC_CACHE_VAL
+ ac_prog_cxx_stdcxx_options=
+ case "x$ac_cv_prog_cxx_$1" in
+   x)
+--- a/m4/std-gnu23.m4
++++ b/m4/std-gnu23.m4
+@@ -696,8 +696,7 @@ AC_DEFUN([_AC_PROG_CC_STDC_EDITION_TRY],
+ [AC_REQUIRE([_AC_C_C$1_TEST_PROGRAM])]dnl
+ [AS_IF([test x$ac_prog_cc_stdc = xno],
+ [AC_MSG_CHECKING([for $CC option to enable C$1 features])
+-AC_CACHE_VAL([ac_cv_prog_cc_c$1],
+-[ac_cv_prog_cc_c$1=no
++ac_cv_prog_cc_c$1=no
+ ac_save_CC=$CC
+ AC_LANG_CONFTEST([AC_LANG_DEFINES_PROVIDED][$][ac_c_conftest_c$1_program])
+ for ac_arg in '' m4_normalize(m4_defn([_AC_C_C$1_OPTIONS]))
+@@ -707,7 +706,7 @@ do
+   test "x$ac_cv_prog_cc_c$1" != "xno" && break
+ done
+ rm -f conftest.$ac_ext
+-CC=$ac_save_CC])
++CC=$ac_save_CC
+ AS_IF([test "x$ac_cv_prog_cc_c$1" = xno],
+   [AC_MSG_RESULT([unsupported])],
+   [AS_IF([test "x$ac_cv_prog_cc_c$1" = x],