Re: [PATCH v2 3/3] f2fs-tools:sload.f2fs compress: Fixed automake

From: Jaegeuk Kim
Date: Mon Dec 07 2020 - 11:24:37 EST


On 12/07, Robin Hsu wrote:
> From: Robin Hsu <robinhsu@xxxxxxxxxx>
>
> Fixed automake for sload.f2fs compression support
>
> ./configure now will by default depends on liblzo2 and liblz4.
>
> To compile without liblzo2 (and thus not support liblzo2 compression),
> run ./configure with '--without-lzo2' option.
>
> To compile without liblz4 (and thus not support liblz4 compression),
> run ./configure with '--without-lz4' option.
>
> Test: Build with automake OK on glinux
> Bug: 170918502
> Signed-off-by: Robin Hsu <robinhsu@xxxxxxxxxx>
> Change-Id: I25d339e4cab4ca196781da89fc3df3e13f869234
> ---
> configure.ac | 32 ++++++++++++++++++++++++++++++++
> fsck/Makefile.am | 9 ++++++---
> 2 files changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 1e5619d..3a357b2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -44,6 +44,14 @@ AC_ARG_WITH([blkid],
> AS_HELP_STRING([--without-blkid],
> [Ignore presence of libblkid and disable blkid support]))
>
> +AC_ARG_WITH([lzo2],
> + AS_HELP_STRING([--without-lzo2],
> + [Ignore liblzo ver.2 for sload (not supporting lzo compression)]))
> +
> +AC_ARG_WITH([lz4],
> + AS_HELP_STRING([--without-lz4],
> + [Ignore liblz4 for sload (not supporting lz4 compression)]))
> +
> # Checks for programs.
> AC_PROG_CC
> AC_PROG_LIBTOOL
> @@ -52,6 +60,30 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
> [$PATH:/sbin])
>
> # Checks for libraries.
> +AS_IF([test "x$with_lzo2" != xno],
> + [AC_CHECK_LIB([lzo2], [main],
> + [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
> + AC_DEFINE([HAVE_LIBLZO2], [1],
> + [Define if you have liblzo2])
> + ],
> + [if test "x$with_lzo2" != xcheck; then
> + AC_MSG_FAILURE(
> + [--with-lzo2 was given (or by default), but test for liblzo2 failed])
> + fi
> + ], [])])
> +
> +AS_IF([test "x$with_lz4" != xno],
> + [AC_CHECK_LIB([lz4], [main],
> + [AC_SUBST([liblz4_LIBS], ["-llz4"])
> + AC_DEFINE([HAVE_LIBLZ4], [1],
> + [Define if you have liblz4])
> + ],
> + [if test "x$with_lz4" != xcheck; then
> + AC_MSG_FAILURE(
> + [--with-lz4 was given (or by default), but test for liblz4 failed])
> + fi
> + ], [])])
> +

Please don't bother users to be aware of libraries only for sload.f2fs using
compression.

> PKG_CHECK_MODULES([libuuid], [uuid])
>
> AS_IF([test "x$with_selinux" != "xno"],
> diff --git a/fsck/Makefile.am b/fsck/Makefile.am
> index 1fc7310..74bc4b8 100644
> --- a/fsck/Makefile.am
> +++ b/fsck/Makefile.am
> @@ -3,12 +3,15 @@
> AM_CPPFLAGS = ${libuuid_CFLAGS} -I$(top_srcdir)/include
> AM_CFLAGS = -Wall
> sbin_PROGRAMS = fsck.f2fs
> -noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h quotaio_tree.h quotaio_v2.h xattr.h
> +noinst_HEADERS = common.h dict.h dqblk_v2.h f2fs.h fsck.h node.h quotaio.h \
> + quotaio_tree.h quotaio_v2.h xattr.h compress_wrapper.h
> include_HEADERS = $(top_srcdir)/include/quota.h
> fsck_f2fs_SOURCES = main.c fsck.c dump.c mount.c defrag.c resize.c \
> - node.c segment.c dir.c sload.c xattr.c \
> + node.c segment.c dir.c sload.c xattr.c compress_wrapper.c \
> dict.c mkquota.c quotaio.c quotaio_tree.c quotaio_v2.c
> -fsck_f2fs_LDADD = ${libselinux_LIBS} ${libuuid_LIBS} $(top_builddir)/lib/libf2fs.la
> +fsck_f2fs_LDADD = ${libselinux_LIBS} ${libuuid_LIBS} \
> + ${liblzo2_LIBS} ${liblz4_LIBS} \
> + $(top_builddir)/lib/libf2fs.la
>
> install-data-hook:
> ln -sf fsck.f2fs $(DESTDIR)/$(sbindir)/dump.f2fs
> --
> 2.29.2.576.ga3fc446d84-goog