Signed-off-by: Gao Xiang <hsiang...@aol.com> --- Makefile.am | 6 +++++- configure.ac | 19 +++++++++++++++++++ fuse/Makefile.am | 10 +++------- 3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 24f4a7b3d5ad..b804aa90efa9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,4 +3,8 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = man lib mkfs fuse +SUBDIRS = man lib mkfs +if ENABLE_FUSE +SUBDIRS += fuse +endif + diff --git a/configure.ac b/configure.ac index e6d2e5fd3702..80d38d0ef952 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,10 @@ AC_ARG_ENABLE(lz4, [AS_HELP_STRING([--disable-lz4], [disable LZ4 compression support @<:@default=enabled@:>@])], [enable_lz4="$enableval"], [enable_lz4="yes"]) +AC_ARG_ENABLE(fuse, + [AS_HELP_STRING([--disable-fuse], [disable erofsfuse @<:@default=enabled@:>@])], + [enable_fuse="$enableval"], [enable_fuse="yes"]) + AC_ARG_WITH(uuid, [AS_HELP_STRING([--without-uuid], [Ignore presence of libuuid and disable uuid support @<:@default=enabled@:>@])]) @@ -183,6 +187,20 @@ AS_IF([test "x$with_selinux" != "xno"], [ LIBS="${saved_LIBS}" CPPFLAGS="${saved_CPPFLAGS}"], [have_selinux="no"]) +# Configure fuse +AS_IF([test "x$enable_fuse" != "xno"], [ + PKG_CHECK_MODULES([libfuse], [fuse >= 2.6.0]) + # Paranoia: don't trust the result reported by pkgconfig before trying out + saved_LIBS="$LIBS" + saved_CPPFLAGS=${CPPFLAGS} + CPPFLAGS="${libfuse_CFLAGS} ${CPPFLAGS}" + LIBS="${libfuse_LIBS} $LIBS" + AC_CHECK_LIB(fuse, fuse_main, [ + have_fuse="yes" ], [ + AC_MSG_ERROR([libfuse >= 2.6.0 doesn't work properly])]) + LIBS="${saved_LIBS}" + CPPFLAGS="${saved_CPPFLAGS}"], [have_fuse="no"]) + # Configure lz4 test -z $LZ4_LIBS && LZ4_LIBS='-llz4' @@ -218,6 +236,7 @@ fi # Set up needed symbols, conditionals and compiler/linker flags AM_CONDITIONAL([ENABLE_LZ4], [test "x${have_lz4}" = "xyes"]) AM_CONDITIONAL([ENABLE_LZ4HC], [test "x${have_lz4hc}" = "xyes"]) +AM_CONDITIONAL([ENABLE_FUSE], [test "x${have_fuse}" = "xyes"]) if test "x$have_uuid" = "xyes"; then AC_DEFINE([HAVE_LIBUUID], 1, [Define to 1 if libuuid is found]) diff --git a/fuse/Makefile.am b/fuse/Makefile.am index 4ed4215b9936..6636ee1aec69 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -4,11 +4,7 @@ AUTOMAKE_OPTIONS = foreign bin_PROGRAMS = erofsfuse erofsfuse_SOURCES = dir.c main.c -erofsfuse_CFLAGS = -Wall -Werror \ - -I$(top_srcdir)/include \ - $(shell pkg-config fuse --cflags) \ - -DFUSE_USE_VERSION=26 \ - -std=gnu99 -LDFLAGS += $(shell pkg-config fuse --libs) -erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la -ldl ${LZ4_LIBS} +erofsfuse_CFLAGS = -Wall -Werror -I$(top_srcdir)/include +erofsfuse_CFLAGS += -DFUSE_USE_VERSION=26 ${libfuse_CFLAGS} +erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse_LIBS} ${LZ4_LIBS} -- 2.24.0