libbacktrace: test --compress-debug-sections=ARG for each ARG

This should fix a testsuite problem with Solaris ld that supports zlib
but not zlib-gabi.

	* configure.ac: Test --compress-debug-sections=zlib-gnu and
	--compress-debug-sections=zlib-gabi separately, setting new
	automake conditionals.
	* Makefile.am (ctestg, ctestg_alloc): Only build if
	HAVE_COMPRESSED_DEBUG_ZLIB_GNU.
	(ctesta, ctesta_alloc): Only build if
	HAVE_COMPRESSED_DEBUG_ZLIB_GABI.
	(ctestzstd_alloc): New test if HAVE_COMPRESSED_DEBUG_ZSTD.
	* configure, Makefile.in: Regenerate.
This commit is contained in:
Ian Lance Taylor
2024-04-23 10:17:03 -07:00
parent 7ead8c1ea2
commit ae1e707dba
4 changed files with 215 additions and 117 deletions

View File

@@ -497,16 +497,27 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
LDFLAGS=$LDFLAGS_hold])
AM_CONDITIONAL(HAVE_BUILDID, test "$libbacktrace_cv_ld_buildid" = yes)
dnl Test whether the linker supports the --compress-debug-sections option.
AC_CACHE_CHECK([whether --compress-debug-sections is supported],
[libgo_cv_ld_compress],
dnl Test whether the linker supports the --compress-debug-sections=zlib-gnu
dnl option.
AC_CACHE_CHECK([whether --compress-debug-sections=zlib-gnu is supported],
[libgo_cv_ld_compress_zlib_gnu],
[LDFLAGS_hold=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
[libgo_cv_ld_compress=yes],
[libgo_cv_ld_compress=no])
[libgo_cv_ld_compress_zlib_gnu=yes],
[libgo_cv_ld_compress_zlib_gnu=no])
LDFLAGS=$LDFLAGS_hold])
AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZLIB_GNU, test "$libgo_cv_ld_compress_zlib_gnu" = yes)
AC_CACHE_CHECK([whether --compress-debug-sections=zlib-gabi is supported],
[libgo_cv_ld_compress_zlib_gabi],
[LDFLAGS_hold=$LDFLAGS
LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gabi"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
[libgo_cv_ld_compress_zlib_gabi=yes],
[libgo_cv_ld_compress_zlib_gabi=no])
LDFLAGS=$LDFLAGS_hold])
AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZLIB_GABI, test "$libgo_cv_ld_compress_zlib_gabi" = yes)
AC_CHECK_LIB([zstd], [ZSTD_compress],
[AC_DEFINE(HAVE_ZSTD, 1, [Define if -lzstd is available.])])