From a5b07cdf9c491fb7a4a16598c482c68b718f59b9 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 29 Nov 2022 10:59:30 +0100 Subject: support ZSTD compression algorithm config/ChangeLog: * libelf.pc.in: Add LIBLZSTD to Requires.private. ChangeLog: * configure.ac: Detect ZSTD streaming API. libelf/ChangeLog: * Makefile.am: Use zstd_LIBS. * elf_compress.c: (__libelf_compress): Split into ... (__libelf_compress_zlib): ... this. (do_zstd_cleanup): New. (zstd_cleanup): New. (__libelf_compress_zstd): New. (__libelf_decompress): Switch in between zlib and zstd. (__libelf_decompress_zlib): Renamed from __libelf_decompress. (__libelf_decompress_zstd): New. (__libelf_decompress_elf): Dispatch in between compression algorithms. (elf_compress): Likewise. * elf_compress_gnu.c (elf_compress_gnu): Call with ELFCOMPRESS_ZLIB. * libelfP.h (__libelf_compress): Add new argument. (__libelf_decompress): Add chtype argument. src/ChangeLog: * elfcompress.c (enum ch_type): Add ZSTD. (parse_opt): Parse "zstd". (get_section_chtype): New. (process_file): Support zstd compression. (main): Add zstd to help. * readelf.c (elf_ch_type_name): Rewrite with switch. tests/ChangeLog: * Makefile.am: Add ELFUTILS_ZSTD if zstd is enabled. * run-compress-test.sh: Test zstd compression algorithm for debug sections. --- configure.ac | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 59be27ac..b2597f8b 100644 --- a/configure.ac +++ b/configure.ac @@ -420,10 +420,22 @@ AC_SUBST([LIBLZMA]) eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)]) AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""]) AC_SUBST([LIBZSTD]) +zstd_LIBS="$LIBS" +AC_SUBST([zstd_LIBS]) zip_LIBS="$LIBS" LIBS="$save_LIBS" AC_SUBST([zip_LIBS]) +dnl zstd compression support requires libzstd 1.4.0+ +AS_IF([test "x$with_zstd" = xyes], [ + PKG_PROG_PKG_CONFIG + PKG_CHECK_MODULES([ZSTD_COMPRESS],[libzstd >= 1.4.0], + [with_zstd_compress="yes"],[with_zstd_compress="no"])], + [with_zstd_compress="no"]) +AM_CONDITIONAL(USE_ZSTD_COMPRESS, test "x$with_zstd_compress" = "xyes") +AS_IF([test "x$with_zstd_compress" = "xyes"], + [AC_DEFINE([USE_ZSTD_COMPRESS], [1], [zstd compression support])]) + AC_CHECK_DECLS([memrchr, rawmemchr],[],[], [#define _GNU_SOURCE #include ]) @@ -829,6 +841,7 @@ AC_MSG_NOTICE([ bzip2 support : ${with_bzlib} lzma/xz support : ${with_lzma} zstd support : ${with_zstd} + zstd compression support : ${with_zstd_compress} libstdc++ demangle support : ${enable_demangler} File textrel check : ${enable_textrelcheck} Symbol versioning : ${enable_symbol_versioning} -- cgit v1.2.1