aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-17 16:37:56 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-02-18 14:27:31 +0100
commit2465754716634422620b4577e0b7ba79c4ce1a39 (patch)
tree06c5f642f610e821c21f242247f1dbf18c109319
parent2bca2a9dea4c3debc2565b58b3a7f095be2f7b75 (diff)
Make zlib an optional dependency
Now that we have plumbing in place for both jffsX-utils and mkfs.ubifs, add the missing autoconf and automake changes to allow mtd-utils to be built without a hard dependency on zlib. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac26
-rw-r--r--jffsX-utils/Makemodule.am5
3 files changed, 16 insertions, 17 deletions
diff --git a/Makefile.am b/Makefile.am
index 06d154a..11647ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,9 @@ ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = $(WARN_CFLAGS) -D_GNU_SOURCE -std=gnu99 -I$(top_srcdir)/include \
-include $(top_builddir)/include/config.h
+if WITH_ZLIB
AM_CPPFLAGS += -DWITH_ZLIB
+endif
if WITH_XATTR
AM_CPPFLAGS += -DWITH_XATTR
diff --git a/configure.ac b/configure.ac
index 0751b3b..3535722 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,6 @@ AC_SUBST([WARN_CFLAGS])
need_clock_gettime="no"
need_pthread="no"
need_uuid="no"
-need_zlib="no"
need_cmocka="no"
need_openssl="no"
@@ -124,14 +123,13 @@ AC_ARG_WITH([ubifs],
AM_COND_IF([BUILD_UBIFS], [
need_uuid="yes"
- need_zlib="yes"
need_openssl="yes"
AS_VAR_IF([need_getrandom], [auto], [need_getrandom="yes"])
])
-AM_COND_IF([BUILD_JFFSX], [
- need_zlib="yes"
-])
+AC_ARG_WITH([zlib],
+ [AS_HELP_STRING([--with-zlib], [Support zlib deflate compression])],
+ [], [with_zlib="check"])
AC_ARG_WITH([xattr],
[AS_HELP_STRING([--with-xattr], [Support extended file attributes])],
@@ -164,14 +162,16 @@ AC_ARG_WITH([crypto],
clock_gettime_missing="no"
pthread_missing="no"
uuid_missing="no"
-zlib_missing="no"
cmocka_missing="no"
openssl_missing="no"
getrandom_missing="no"
-if test "x$need_zlib" = "xyes"; then
- PKG_CHECK_MODULES(ZLIB, [zlib], [], [zlib_missing="yes"])
-fi
+AS_IF([test "x$with_zlib" != "xno"], [
+ PKG_CHECK_MODULES(ZLIB, [zlib], [with_zlib="yes"],
+ [AS_IF([test "x$with_zlib" != "xcheck"],
+ [AC_MSG_ERROR([cannot find zlib])],
+ [with_zlib="no"])])
+], [])
if test "x$need_uuid" = "xyes"; then
PKG_CHECK_MODULES(UUID, [uuid], [], [uuid_missing="yes"])
@@ -270,13 +270,6 @@ if test "x$uuid_missing" = "xyes"; then
dep_missing="yes"
fi
-if test "x$zlib_missing" = "xyes"; then
- AC_MSG_WARN([cannot find ZLIB library required for mkfs programs])
- AC_MSG_NOTICE([mtd-utils can optionally be built without mkfs.ubifs])
- AC_MSG_NOTICE([mtd-utils can optionally be built without mkfs.jffs2])
- dep_missing="yes"
-fi
-
if test "x$openssl_missing" = "xyes"; then
AC_MSG_WARN([cannot find headers for OpenSSL library])
AC_MSG_WARN([disabling OpenSSL support])
@@ -302,6 +295,7 @@ fi
##### generate output #####
AM_CONDITIONAL([WITH_LZO], [test "x$with_lzo" = "xyes"])
+AM_CONDITIONAL([WITH_ZLIB], [test "x$with_zlib" = "xyes"])
AM_CONDITIONAL([WITH_ZSTD], [test "x$with_zstd" = "xyes"])
AM_CONDITIONAL([WITH_XATTR], [test "x$with_xattr" = "xyes"])
AM_CONDITIONAL([WITH_SELINUX], [test "x$with_selinux" = "xyes"])
diff --git a/jffsX-utils/Makemodule.am b/jffsX-utils/Makemodule.am
index ee8d040..266c12e 100644
--- a/jffsX-utils/Makemodule.am
+++ b/jffsX-utils/Makemodule.am
@@ -1,7 +1,6 @@
mkfs_jffs2_SOURCES = \
jffsX-utils/mkfs.jffs2.c \
jffsX-utils/rbtree.h \
- jffsX-utils/compr_zlib.c \
jffsX-utils/compr.h \
jffsX-utils/rbtree.c \
jffsX-utils/compr.c \
@@ -30,6 +29,10 @@ if WITH_LZO
mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c
endif
+if WITH_ZLIB
+mkfs_jffs2_SOURCES += jffsX-utils/compr_zlib.c
+endif
+
EXTRA_DIST += jffsX-utils/device_table.txt jffsX-utils/mkfs.jffs2.1
dist_man1_MANS += jffsX-utils/mkfs.jffs2.1