aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac357
1 files changed, 164 insertions, 193 deletions
diff --git a/configure.ac b/configure.ac
index c57cf46..cf3a959 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,28 +1,24 @@
AC_PREREQ([2.60])
-m4_define([RELEASE], 2.1.2)
+m4_define([RELEASE], 2.2.0)
AC_INIT([mtd-utils], [RELEASE], [linux-mtd@lists.infradead.org], mtd-utils)
AC_ARG_ENABLE([unit-tests],
[AS_HELP_STRING([--enable-unit-tests], [Compile unit test programs])],
- [case "${enableval}" in
- yes) AM_CONDITIONAL([UNIT_TESTS], [true]) ;;
- no) AM_CONDITIONAL([UNIT_TESTS], [false]) ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --enable-unit-tests]) ;;
- esac],
- [AM_CONDITIONAL([UNIT_TESTS], [false])])
+ [], [enable_unit_tests="no"])
-AM_COND_IF([UNIT_TESTS], [: ${CFLAGS=""}], [])
+AS_IF([test "x$enable_unit_tests" = "xyes"], [: ${CFLAGS=""}], [])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects dist-bzip2])
AM_SILENT_RULES([yes])
-AC_PROG_LIBTOOL
-AC_DISABLE_STATIC
AC_PROG_CC
AC_PROG_INSTALL
+# autoconf <= 2.63 doesn't have AC_PROG_AR
+AC_CHECK_TOOL(AR, ar, :)
+AC_PROG_RANLIB
AC_SYS_LARGEFILE
m4_ifndef([PKG_PROG_PKG_CONFIG],
@@ -61,150 +57,92 @@ AC_SUBST([WARN_CFLAGS])
###### handle configure switches, select dependencies ######
-need_clock_gettime="no"
-need_pthread="no"
-need_uuid="no"
-need_zlib="no"
-need_lzo="no"
-need_zstd="no"
-need_xattr="no"
-need_cmocka="no"
-need_selinux="no"
-need_openssl="no"
-
-AM_COND_IF([UNIT_TESTS], [
- need_cmocka="yes"
-])
-
-
-AC_ARG_ENABLE([tests],
- [AS_HELP_STRING([--disable-tests], [Compile test programs])],
- [case "${enableval}" in
- yes) AM_CONDITIONAL([BUILD_TESTS], [true]) ;;
- no) AM_CONDITIONAL([BUILD_TESTS], [false]) ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-tests]) ;;
- esac],
- [AM_CONDITIONAL([BUILD_TESTS], [true])])
-
-AM_COND_IF([BUILD_TESTS], [
- need_clock_gettime="yes"
- need_pthread="yes"
-])
+AC_ARG_WITH([tests],
+ [AS_HELP_STRING([--without-tests], [Compile test programs])],
+ [], [with_tests="yes"])
AC_DEFINE_DIR(TESTBINDIR, libexecdir/mtd-utils,
[Path where test and debug programs will be installed])
AC_ARG_ENABLE([ubihealthd],
[AS_HELP_STRING([--enable-ubihealthd], [Build the ubihealthd program])],
- [need_getrandom="${enableval}"],[need_getrandom="auto"])
+ [], [enable_ubihealthd="yes"])
-AC_ARG_ENABLE([lsmtd],
- [AS_HELP_STRING([--disable-lsmtd], [Do not build the lsmtd program])],
- [case "${enableval}" in
- yes) AM_CONDITIONAL([BUILD_LSMTD], [true]) ;;
- no) AM_CONDITIONAL([BUILD_LSMTD], [false]) ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-lsmtd]) ;;
- esac],
- [AM_CONDITIONAL([BUILD_LSMTD], [true])])
+AC_ARG_WITH([lsmtd],
+ [AS_HELP_STRING([--without-lsmtd], [Do not build the lsmtd program])],
+ [], [with_lsmtd="yes"])
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])])
+ [], [with_jffs="yes"])
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_xattr="yes"
- need_zlib="yes"
- need_lzo="yes"
- need_zstd="yes"
- need_openssl="yes"
- AS_VAR_IF([need_getrandom], [auto], [need_getrandom="yes"])
-])
+ [], [with_ubifs="yes"])
-AM_COND_IF([BUILD_JFFSX], [
- need_xattr="yes"
- need_zlib="yes"
- need_lzo="yes"
-])
+AC_ARG_WITH([zlib],
+ [AS_HELP_STRING([--with-zlib], [Support zlib deflate compression])],
+ [], [with_zlib="check"])
AC_ARG_WITH([xattr],
- [AS_HELP_STRING([--without-xattr],
- [Disable support forextended file attributes])],
- [case "${withval}" in
- yes) ;;
- no) need_xattr="no" ;;
- *) AC_MSG_ERROR([bad value ${withval} for --without-xattr]) ;;
- esac])
+ [AS_HELP_STRING([--with-xattr], [Support extended file attributes])],
+ [], [with_xattr="check"])
AC_ARG_WITH([lzo],
- [AS_HELP_STRING([--without-lzo], [Disable support for LZO compression])],
- [case "${withval}" in
- yes) ;;
- no) need_lzo="no" ;;
- *) AC_MSG_ERROR([bad value ${withval} for --without-lzo]) ;;
- esac])
+ [AS_HELP_STRING([--with-lzo], [Support LZO compression])],
+ [], [with_lzo="check"])
AC_ARG_WITH([zstd],
- [AS_HELP_STRING([--without-zstd], [Disable support for ZSTD compression])],
- [case "${withval}" in
- yes) ;;
- no) need_zstd="no" ;;
- *) AC_MSG_ERROR([bad value ${withval} for --without-zstd]) ;;
- esac])
+ [AS_HELP_STRING([--with-zstd], [Support for ZSTD compression])],
+ [], [with_zstd="check"])
AC_ARG_WITH([selinux],
[AS_HELP_STRING([--with-selinux],
- [Enable support for selinux extended attributes])],
- [case "${withval}" in
- yes) need_selinux="yes";;
- no) ;;
- *) AC_MSG_ERROR([bad value ${withval} for --with-selinux]) ;;
- esac])
+ [Support for selinux extended attributes])],
+ [], [with_selinux="check"])
AC_ARG_WITH([crypto],
- [AS_HELP_STRING([--without-crypto],
- [Disable support for UBIFS crypto features])],
- [case "${withval}" in
- yes) ;;
- no) need_openssl="no";;
- *) AC_MSG_ERROR([bad value ${withval} for --without-crypto]) ;;
- esac])
+ [AS_HELP_STRING([--with-crypto], [Support for UBIFS crypto features])],
+ [], [with_crypto="check"])
##### search for dependencies #####
+need_clock_gettime="no"
+need_pthread="no"
+need_uuid="no"
+need_cmocka="no"
+need_getrandom="no"
+
clock_gettime_missing="no"
pthread_missing="no"
uuid_missing="no"
-zlib_missing="no"
-lzo_missing="no"
-zstd_missing="no"
-xattr_missing="no"
cmocka_missing="no"
-selinux_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$enable_unit_tests" = "xyes"], [
+ need_cmocka="yes"
+])
-if test "x$need_selinux" = "xyes"; then
- PKG_CHECK_MODULES(LIBSELINUX, [libselinux], [], [selinux_missing="yes"])
-fi
+AS_IF([test "x$with_tests" = "xyes"], [
+ need_clock_gettime="yes"
+ need_pthread="yes"
+])
+
+AS_IF([test "x$enable_ubihealthd" = "xyes"], [
+ need_getrandom="yes"
+])
+
+AS_IF([test "x$with_ubifs" = "xyes"], [
+ need_uuid="yes"
+ need_getrandom="yes"
+])
+
+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"])
@@ -219,34 +157,63 @@ if test "x$need_pthread" = "xyes"; then
AX_PTHREAD([], [pthread_missing="yes"])
fi
-if test "x$need_lzo" = "xyes"; then
- AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
- AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
- AC_CHECK_LIB([lzo2], [lzo1x_1_15_compress], [LZO_LIBS="-llzo2"],
- [AC_CHECK_LIB([lzo],[lzo1x_1_15_compress],[LZO_LIBS="-llzo"],
- [lzo_missing="yes"]
- )]
- )
-fi
+AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
+AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
-if test "x$need_zstd" = "xyes"; then
- PKG_CHECK_MODULES([ZSTD], [libzstd],, zstd_missing="yes")
-fi
-
-if test "x$need_xattr" = "xyes"; then
- AC_CHECK_HEADERS([sys/xattr.h], [], [xattr_missing="yes"])
- AC_CHECK_HEADERS([sys/acl.h], [], [xattr_missing="yes"])
-fi
-
-if test "x$need_selinux" = "xyes"; then
- AC_CHECK_HEADERS([selinux/selinux.h], [], [selinux_missing="yes"])
- AC_CHECK_HEADERS([selinux/label.h], [], [selinux_missing="yes"])
-fi
-
-if test "x$need_openssl" = "xyes"; then
- AC_CHECK_HEADER(openssl/rand.h)
- PKG_CHECK_MODULES(OPENSSL, [openssl], [], [openssl_missing="yes"])
-fi
+AS_IF([test -z "$LZO_LIBS" -a "x$with_lzo" != "xno"], [
+ AC_CHECK_LIB([lzo2], [lzo1x_1_15_compress], [LZO_LIBS="-llzo2"],
+ [AC_CHECK_LIB([lzo],[lzo1x_1_15_compress],
+ [LZO_LIBS="-llzo"],
+ []
+ )]
+ )
+], [])
+
+AS_IF([test -z "$LZO_LIBS"], [AS_IF([test "x$with_lzo" = "xyes"],
+ [AC_MSG_ERROR([cannot find liblzo])],
+ [with_lzo="no"])],
+ [with_lzo="yes"])
+
+AS_IF([test "x$with_zstd" != "xno"], [
+ PKG_CHECK_MODULES(ZSTD, [libzstd], [with_zstd="yes"],
+ [AS_IF([test "x$with_zstd" != "xcheck"],
+ [AC_MSG_ERROR([cannot find zstd])],
+ [with_zstd="no"])])
+], [])
+
+AS_IF([test "x$with_xattr" != "xno"], [
+ have_xattr="yes"
+
+ AC_CHECK_HEADERS([sys/xattr.h], [], [have_xattr="no"])
+ AC_CHECK_HEADERS([sys/acl.h], [], [have_xattr="no"])
+
+ AS_IF([test "x$with_xattr" != "xcheck" -a "x$have_xattr" = "xno"],
+ [AC_MSG_ERROR([cannot find xattr/acl headers])],
+ [with_xattr="$have_xattr"])
+], [])
+
+AS_IF([test "x$with_selinux" != "xno"], [
+ have_selinux="yes"
+
+ PKG_CHECK_MODULES(LIBSELINUX, [libselinux], [], [have_selinux="no"])
+ AC_CHECK_HEADERS([selinux/selinux.h], [], [have_selinux="no"])
+ AC_CHECK_HEADERS([selinux/label.h], [], [have_selinux="no"])
+
+ AS_IF([test "x$with_selinux" != "xcheck" -a "x$have_selinux" = "xno"],
+ [AC_MSG_ERROR([cannot find SELinux libraries])],
+ [with_selinux="$have_selinux"])
+], [])
+
+AS_IF([test "x$with_crypto" != "xno"], [
+ have_openssl="yes"
+
+ AC_CHECK_HEADERS([openssl/rand.h], [], [have_openssl="no"])
+ PKG_CHECK_MODULES(OPENSSL, [openssl], [], [have_openssl="no"])
+
+ AS_IF([test "x$with_crypto" != "xcheck" -a "x$have_openssl" = "xno"],
+ [AC_MSG_ERROR([cannot find OpenSSL libraries])],
+ [with_crypto="$have_openssl"])
+], [])
if test "x$need_getrandom" = "xyes"; then
AC_CHECK_HEADERS([sys/random.h], [], [getrandom_missing="yes"])
@@ -280,49 +247,9 @@ 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$lzo_missing" = "xyes"; then
- AC_MSG_WARN([cannot find LZO 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])
- AC_MSG_NOTICE([mtd-utils can optionally be built without LZO support])
- dep_missing="yes"
-fi
-
-if test "x$zstd_missing" = "xyes"; then
- AC_MSG_WARN([cannot find ZSTD library required for mkfs program])
- AC_MSG_NOTICE([mtd-utils can optionally be built without mkfs.ubifs])
- AC_MSG_NOTICE([mtd-utils can optionally be built without ZSTD support])
- dep_missing="yes"
-fi
-
-if test "x$xattr_missing" = "xyes"; then
- AC_MSG_WARN([cannot find headers for extended attributes])
- AC_MSG_WARN([disabling XATTR support])
- need_xattr="no"
-fi
-
-if test "x$selinux_missing" = "xyes"; then
- AC_MSG_WARN([cannot find headers for selinux library])
- AC_MSG_WARN([disabling SELINUX support])
- need_selinux="no"
-fi
-
-if test "x$openssl_missing" = "xyes"; then
- AC_MSG_WARN([cannot find headers for OpenSSL library])
- AC_MSG_WARN([disabling OpenSSL support])
- need_openssl="no"
-fi
-
if test "x$getrandom_missing" = "xyes"; then
AC_MSG_WARN([cannot find headers for getrandom() function])
- AC_MSG_WARN([disabling UBIFS ubihealthd support])
+ AC_MSG_NOTICE([mkfs.ubifs, ubihealthd can optionally be disabled])
need_getrandom="no"
fi
@@ -338,12 +265,19 @@ fi
##### generate output #####
-AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"])
-AM_CONDITIONAL([WITHOUT_ZSTD], [test "x$need_zstd" != "xyes"])
-AM_CONDITIONAL([WITHOUT_XATTR], [test "x$need_xattr" != "xyes"])
-AM_CONDITIONAL([WITH_SELINUX], [test "x$need_selinux" == "xyes"])
-AM_CONDITIONAL([WITH_CRYPTO], [test "x$need_openssl" == "xyes"])
-AM_CONDITIONAL([WITH_GETRANDOM], [test "x$need_getrandom" == "xyes"])
+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"])
+AM_CONDITIONAL([WITH_CRYPTO], [test "x$with_crypto" = "xyes"])
+AM_CONDITIONAL([WITH_UBIHEALTHD], [test "x$enable_ubihealthd" = "xyes"])
+
+AM_CONDITIONAL([BUILD_UBIFS], [test "x$with_ubifs" = "xyes"])
+AM_CONDITIONAL([BUILD_JFFSX], [test "x$with_jffs" = "xyes"])
+AM_CONDITIONAL([BUILD_LSMTD], [test "x$with_lsmtd" = "xyes"])
+AM_CONDITIONAL([BUILD_TESTS], [test "x$with_tests" = "xyes"])
+AM_CONDITIONAL([UNIT_TESTS], [test "x$enable_unit_tests" = "xyes"])
AC_CHECK_SIZEOF([off_t])
AC_CHECK_SIZEOF([loff_t])
@@ -358,3 +292,40 @@ AC_CONFIG_FILES([tests/fs-tests/fs_help_all.sh
tests/ubi-tests/ubi-stress-test.sh])
AC_OUTPUT([Makefile])
+
+AC_MSG_RESULT([
+ ${PACKAGE} ${VERSION}
+
+ prefix: ${prefix}
+ exec prefix: ${exec_prefix}
+
+ runstatedir: ${runstatedir}
+ bindir: ${bindir}
+ sbindir: ${sbindir}
+ libdir: ${libdir}
+ includedir: ${includedir}
+
+ compiler: ${CC}
+ cflags: ${CFLAGS}
+ ldflags: ${LDFLAGS}
+
+ lzo support: ${with_lzo}
+ zlib support: ${with_zlib}
+ zstd support: ${with_zstd}
+ xattr/acl support: ${with_xattr}
+ SELinux support: ${with_selinux}
+ fscrypt support: ${with_crypto}
+
+ Test programs: ${with_tests}
+ Unit tests: ${enable_unit_tests}
+ ubihealthd: ${enable_ubihealthd}
+ lsmtd: ${with_lsmtd}
+ jffs2 utils: ${with_jffs}
+ ubifs utils: ${with_ubifs}
+
+ warnings:
+
+${WARN_CFLAGS}
+
+ Type 'make' or 'make <utilname>' to compile.
+])