https://gcc.gnu.org/g:9c87af29325acc2b7c41c88c3d24a30930743111
commit r17-5610-g9c87af29325acc2b7c41c88c3d24a30930743111 Author: Torbjörn SVENSSON <[email protected]> Date: Fri Oct 23 13:19:28 2026 +0200 libbacktrace: Make unavailable zstd nonfatal for cross-target builds GCC's zstd options select a library for host tools, but are also forwarded to target libraries, where the host installation may be unusable. This can cause configuration of libbacktrace for the target to fail even though external libzstd is not required. Add an optional argument to AC_ZSTD to allow configuration to continue without a usable zstd installation, and use it for cross-target libbacktrace. Preserve existing requirements for host and native builds. config/ChangeLog: * zstd.m4 (AC_ZSTD): Add optional FAILURE_IS_FATAL argument. Report when continuing without external libzstd. gcc/ChangeLog: * configure: Regenerate. libbacktrace/ChangeLog: * configure.ac: Make zstd detection failures nonfatal when configuring a GCC target library for a different host. * configure: Regenerate. Signed-off-by: Torbjörn SVENSSON <[email protected]> Diff: --- config/zstd.m4 | 10 ++++++++-- gcc/configure | 10 ++++++---- libbacktrace/configure | 16 ++++++++++++++-- libbacktrace/configure.ac | 12 +++++++++++- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/config/zstd.m4 b/config/zstd.m4 index 28788782d3b0..113c3feb55a8 100644 --- a/config/zstd.m4 +++ b/config/zstd.m4 @@ -6,7 +6,11 @@ dnl that contains a configuration script generated by Autoconf, under dnl the same distribution terms as the rest of that program. dnl Set up and check zstd support. +dnl AC_ZSTD([FAILURE_IS_FATAL]): if FAILURE_IS_FATAL is 'no', an unusable +dnl zstd installation is nonfatal even when explicitly requested. +dnl The default is 'yes'; auto mode is always nonfatal. AC_DEFUN([AC_ZSTD], [ +m4_pushdef([zstd_FailureIsFatal], [m4_default([$1], [yes])])dnl AC_SUBST(ZSTD_CFLAGS) AC_SUBST(ZSTD_LIBS) AC_ARG_WITH(zstd, @@ -116,11 +120,12 @@ if test "$zstd_enabled" = yes; then AC_LANG_POP([C]) if test "$zstd_lib_usable" = yes && test "$ac_cv_zstd_h" = yes; then AC_DEFINE(HAVE_ZSTD, 1, [Define if zstd is available.]) - elif test "$with_zstd" != auto; then + elif test "$with_zstd" != auto \ + && test "x[]zstd_FailureIsFatal" != xno; then AC_MSG_ERROR([Unable to find a usable zstd library and zstd.h. See config.log for details.]) else - # In auto mode, an unusable installation simply disables zstd. + AC_MSG_NOTICE([no usable external libzstd; continuing without it]) zstd_enabled=no fi @@ -130,4 +135,5 @@ if test "$zstd_enabled" != yes; then ZSTD_CFLAGS= ZSTD_LIBS= fi +m4_popdef([zstd_FailureIsFatal])dnl ]) diff --git a/gcc/configure b/gcc/configure index 93a1a63d5aa8..66b2f8c153bb 100755 --- a/gcc/configure +++ b/gcc/configure @@ -10779,11 +10779,13 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu $as_echo "#define HAVE_ZSTD 1" >>confdefs.h - elif test "$with_zstd" != auto; then + elif test "$with_zstd" != auto \ + && test "xyes" != xno; then as_fn_error $? "Unable to find a usable zstd library and zstd.h. See config.log for details." "$LINENO" 5 else - # In auto mode, an unusable installation simply disables zstd. + { $as_echo "$as_me:${as_lineno-$LINENO}: no usable external libzstd; continuing without it" >&5 +$as_echo "$as_me: no usable external libzstd; continuing without it" >&6;} zstd_enabled=no fi @@ -22095,7 +22097,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 22098 "configure" +#line 22100 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -22201,7 +22203,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 22204 "configure" +#line 22206 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libbacktrace/configure b/libbacktrace/configure index c527c7d0017d..fa2cf3ec848e 100755 --- a/libbacktrace/configure +++ b/libbacktrace/configure @@ -14452,6 +14452,16 @@ else fi +# External libzstd is optional; do not require it for cross-target builds. +zstd_failure_is_fatal=yes +if test -n "$with_target_subdir" \ + && test -n "$with_cross_host" && test "$with_cross_host" != no; then + zstd_cross_host=`$SHELL "$ac_aux_dir/config.sub" "$with_cross_host"` \ + || as_fn_error $? "invalid cross host: $with_cross_host" "$LINENO" 5 + if test "$zstd_cross_host" != "$host"; then + zstd_failure_is_fatal=no + fi +fi @@ -14871,11 +14881,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu $as_echo "#define HAVE_ZSTD 1" >>confdefs.h - elif test "$with_zstd" != auto; then + elif test "$with_zstd" != auto \ + && test "x$zstd_failure_is_fatal" != xno; then as_fn_error $? "Unable to find a usable zstd library and zstd.h. See config.log for details." "$LINENO" 5 else - # In auto mode, an unusable installation simply disables zstd. + { $as_echo "$as_me:${as_lineno-$LINENO}: no usable external libzstd; continuing without it" >&5 +$as_echo "$as_me: no usable external libzstd; continuing without it" >&6;} zstd_enabled=no fi diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac index ec9fd349f8a5..90401e95768d 100644 --- a/libbacktrace/configure.ac +++ b/libbacktrace/configure.ac @@ -545,7 +545,17 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)], LDFLAGS=$LDFLAGS_hold]) AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZLIB_GABI, test "$libgo_cv_ld_compress_zlib_gabi" = yes) -AC_ZSTD +# External libzstd is optional; do not require it for cross-target builds. +zstd_failure_is_fatal=yes +if test -n "$with_target_subdir" \ + && test -n "$with_cross_host" && test "$with_cross_host" != no; then + zstd_cross_host=`$SHELL "$ac_aux_dir/config.sub" "$with_cross_host"` \ + || AC_MSG_ERROR([invalid cross host: $with_cross_host]) + if test "$zstd_cross_host" != "$host"; then + zstd_failure_is_fatal=no + fi +fi +AC_ZSTD([$zstd_failure_is_fatal]) AM_CONDITIONAL(HAVE_ZSTD, test "$zstd_enabled" = yes) dnl Test whether the linker supports --compress-debug-sections=zstd option.
