add new option '--enable-static-fuse' so that we could import erofsfuse as a static library directly into other projects
Signed-off-by: ComixHe <heyum...@deepin.org> --- configure.ac | 7 +++++++ fuse/Makefile.am | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index 1989bca..f756139 100644 --- a/configure.ac +++ b/configure.ac @@ -147,6 +147,12 @@ AC_ARG_ENABLE(fuse, [AS_HELP_STRING([--enable-fuse], [enable erofsfuse @<:@default=no@:>@])], [enable_fuse="$enableval"], [enable_fuse="no"]) +AC_ARG_ENABLE([static-fuse], + [AS_HELP_STRING([--enable-static-fuse], + [build erofsfuse as a static library @<:@default=no@:>@])], + [enable_static_fuse="$enableval"], + [enable_static_fuse="no"]) + AC_ARG_WITH(uuid, [AS_HELP_STRING([--without-uuid], [Ignore presence of libuuid and disable uuid support @<:@default=enabled@:>@])]) @@ -525,6 +531,7 @@ AM_CONDITIONAL([ENABLE_FUSE], [test "x${have_fuse}" = "xyes"]) AM_CONDITIONAL([ENABLE_LIBLZMA], [test "x${have_liblzma}" = "xyes"]) AM_CONDITIONAL([ENABLE_LIBDEFLATE], [test "x${have_libdeflate}" = "xyes"]) AM_CONDITIONAL([ENABLE_LIBZSTD], [test "x${have_libzstd}" = "xyes"]) +AM_CONDITIONAL([ENABLE_STATIC_FUSE], [test "x${enable_static_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 7eae5f6..c5c5696 100644 --- a/fuse/Makefile.am +++ b/fuse/Makefile.am @@ -8,3 +8,12 @@ erofsfuse_CFLAGS = -Wall -I$(top_srcdir)/include erofsfuse_CFLAGS += ${libfuse2_CFLAGS} ${libfuse3_CFLAGS} ${libselinux_CFLAGS} erofsfuse_LDADD = $(top_builddir)/lib/liberofs.la ${libfuse2_LIBS} ${libfuse3_LIBS} ${liblz4_LIBS} \ ${libselinux_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libdeflate_LIBS} ${libzstd_LIBS} + +if ENABLE_STATIC_FUSE +lib_LIBRARIES = liberofsfuse.a +liberofsfuse_a_SOURCES = main.c +liberofsfuse_a_CFLAGS = -Wall -I$(top_srcdir)/include +liberofsfuse_a_CFLAGS += -Dmain=erofsfuse_main ${libfuse2_CFLAGS} ${libfuse3_CFLAGS} ${libselinux_CFLAGS} +liberofsfuse_la_LIBADD = $(top_builddir)/lib/liberofs.la ${libfuse2_LIBS} ${libfuse3_LIBS} ${liblz4_LIBS} \ + ${libselinux_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libdeflate_LIBS} ${libzstd_LIBS} +endif -- 2.45.2