]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-utils: Add configure switches to disable jffsX or ubifs tools
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Wed, 21 Dec 2016 14:42:12 +0000 (15:42 +0100)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Thu, 22 Dec 2016 00:28:20 +0000 (01:28 +0100)
For some applications, like building a root filesystem for an embedded
device, it may be desireable to only build and install a subset of the
mtd-utils. This can be done throught the targets of the generated
Makefile and hand picking executables, however the jffsX and ubifs
utilities have external build dependencies that may not be needed.

This patch adds configure switches to disable building the jffsX and
ubifs utilities. Their respective build dependencies (zlib, lzo, uuid)
are only requested if the tools are being built.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Reviewed-by: Richard Weinberger <richard@nod.at>
Makefile.am
configure.ac

index 23c19400680e92f3d870e496c0be1d4a9d2ff653..31b21bc6f93b5c977b3afde9992274d2f5e72706 100644 (file)
@@ -36,11 +36,17 @@ EXTRA_DIST += $(GLOBAL_HEADER) $(GLOBAL_EXTRA)
 
 include lib/Makemodule.am
 include ubi-utils/Makemodule.am
-include ubifs-utils/Makemodule.am
 include misc-utils/Makemodule.am
 include nand-utils/Makemodule.am
 include nor-utils/Makemodule.am
+
+if BUILD_UBIFS
+include ubifs-utils/Makemodule.am
+endif
+
+if BUILD_JFFSX
 include jffsX-utils/Makemodule.am
+endif
 
 if BUILD_TESTS
 include tests/ubi-tests/Makemodule.am
index 519647842893d25314bbfc1fbb26568a85712ac2..be0d17e350cecb745cf7387cde138cd7c25027ca 100644 (file)
@@ -66,6 +66,48 @@ AC_CONFIG_FILES([tests/fs-tests/fs_help_all.sh
        tests/ubi-tests/ubi-stress-test.sh])
 
 
+need_uuid="no"
+need_zlib="no"
+need_lzo="no"
+
+AC_ARG_WITH([jffs],
+       [AS_HELP_STRING([--without-jffs], [Disable jffsX utilities])],
+       [case "${withval}" in
+       yes) AM_CONDITIONAL([BUILD_JFFSX], [true]) ;;
+       no)  AM_CONDITIONAL([BUILD_JFFSX], [false]) ;;
+       *) AC_MSG_ERROR([bad value ${withval} for --without-jffs]) ;;
+       esac],
+       [AM_CONDITIONAL([BUILD_JFFSX], [true])])
+
+AC_ARG_WITH([ubifs],
+       [AS_HELP_STRING([--without-ubifs], [Disable ubifs utilities])],
+       [case "${withval}" in
+       yes) AM_CONDITIONAL([BUILD_UBIFS], [true]) ;;
+       no)  AM_CONDITIONAL([BUILD_UBIFS], [false]) ;;
+       *) AC_MSG_ERROR([bad value ${withval} for --without-ubifs]) ;;
+       esac],
+       [AM_CONDITIONAL([BUILD_UBIFS], [true])])
+
+AM_COND_IF([BUILD_UBIFS], [
+       need_uuid="yes"
+       need_zlib="yes"
+       need_lzo="yes"
+])
+
+AM_COND_IF([BUILD_JFFSX], [
+       need_zlib="yes"
+       need_lzo="yes"
+])
+
+if test "x$need_zlib" = "xyes"; then
+       PKG_CHECK_MODULES(ZLIB, [zlib])
+fi
+
+if test "x$need_uuid" = "xyes"; then
+       PKG_CHECK_MODULES(UUID, [uuid])
+fi
+
+
 AC_ARG_WITH([xattr],
        [AS_HELP_STRING([--without-xattr],
                [Disable support forextended file attributes])],
@@ -83,19 +125,16 @@ AC_CHECK_HEADER(sys/acl.h, [], [AM_CONDITIONAL([WITHOUT_XATTR], [true])])
 AC_ARG_WITH([lzo],
        [AS_HELP_STRING([--without-lzo], [Disable support for LZO compression])],
        [case "${withval}" in
-       yes) AM_CONDITIONAL([WITHOUT_LZO], [false]) ;;
+       yes) AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"]) ;;
        no)  AM_CONDITIONAL([WITHOUT_LZO], [true]) ;;
        *) AC_MSG_ERROR([bad value ${withval} for --without-lzo]) ;;
        esac],
-       [AM_CONDITIONAL([WITHOUT_LZO], [false])])
+       [AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"])])
 
 
 AC_CHECK_HEADERS([execinfo.h], [execinfo_found=yes])
 AM_CONDITIONAL([HAVE_EXECINFO], [test "x$execinfo_found" == "xyes"])
 
-PKG_CHECK_MODULES(ZLIB, [ zlib ])
-PKG_CHECK_MODULES(UUID, [ uuid ])
-
 AM_COND_IF([UNIT_TESTS], [PKG_CHECK_MODULES(CMOCKA, [ cmocka ])], [])
 
 AM_COND_IF([WITHOUT_LZO], [], [