From 924c0ff17fca4f4527e8076f8d6b88dd39176dc8 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Tue, 5 May 2026 12:42:00 +0100 Subject: [PATCH] tools/configure: Detect the presence of liblz4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As with other compression libraries, group liblz4 into ZLIB_{CFLAGS,LIBS}. Add the packages to the Debian Trixie build containers for coverage. Signed-off-by: Andrew Cooper Reviewed-by: Roger Pau Monné Release-Acked-by: Oleksii Kurochko --- automation/build/debian/13-arm64v8.dockerfile | 1 + automation/build/debian/13-x86_64.dockerfile | 1 + tools/configure | 79 +++++++++++++++++++ tools/configure.ac | 4 + 4 files changed, 85 insertions(+) diff --git a/automation/build/debian/13-arm64v8.dockerfile b/automation/build/debian/13-arm64v8.dockerfile index b9062ee8b4..ee9bb841eb 100644 --- a/automation/build/debian/13-arm64v8.dockerfile +++ b/automation/build/debian/13-arm64v8.dockerfile @@ -28,6 +28,7 @@ RUN <&6; } ZLIB_LIBS="$ZLIB_LIBS $libzstd_LIBS" fi +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for liblz4" >&5 +printf %s "checking for liblz4... " >&6; } + +if test -n "$liblz4_CFLAGS"; then + pkg_cv_liblz4_CFLAGS="$liblz4_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblz4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "liblz4") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_liblz4_CFLAGS=`$PKG_CONFIG --cflags "liblz4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$liblz4_LIBS"; then + pkg_cv_liblz4_LIBS="$liblz4_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblz4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "liblz4") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_liblz4_LIBS=`$PKG_CONFIG --libs "liblz4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + liblz4_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "liblz4" 2>&1` + else + liblz4_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "liblz4" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$liblz4_PKG_ERRORS" >&5 + + true +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + true +else + liblz4_CFLAGS=$pkg_cv_liblz4_CFLAGS + liblz4_LIBS=$pkg_cv_liblz4_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZ4 $liblz4_CFLAGS" + ZLIB_LIBS="$ZLIB_LIBS $liblz4_LIBS" +fi + ac_fn_c_check_header_compile "$LINENO" "ext2fs/ext2fs.h" "ac_cv_header_ext2fs_ext2fs_h" "$ac_includes_default" diff --git a/tools/configure.ac b/tools/configure.ac index ecd45e782e..74b9f56025 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -403,6 +403,10 @@ PKG_CHECK_MODULES([libzstd], [libzstd], [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_ZSTD $libzstd_CFLAGS" ZLIB_LIBS="$ZLIB_LIBS $libzstd_LIBS"], [true]) +PKG_CHECK_MODULES([liblz4], [liblz4], + [ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_LZ4 $liblz4_CFLAGS" + ZLIB_LIBS="$ZLIB_LIBS $liblz4_LIBS"], + [true]) AC_SUBST([ZLIB_CFLAGS]) AC_SUBST([ZLIB_LIBS]) AX_CHECK_EXTFS