aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac40
1 files changed, 34 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 18a4a81..51c61a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,16 +39,44 @@ UL_WARN_ADD([-pedantic])
AC_SUBST([WARN_CFLAGS])
+##### config options #####
+
+AC_ARG_WITH([zlib],
+ [AS_HELP_STRING([--without-zlib],
+ [Build without zlib compression support])],
+ [case "${withval}" in
+ yes) AM_CONDITIONAL([WITH_ZLIB], [true]) ;;
+ no) AM_CONDITIONAL([WITH_ZLIB], [false]) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --without-zlib]) ;;
+ esac],
+ [AM_CONDITIONAL([WITH_ZLIB], [true])])
+
+AC_ARG_WITH([lzma],
+ [AS_HELP_STRING([--without-lzma],
+ [Build without lzma compression support])],
+ [case "${withval}" in
+ yes) AM_CONDITIONAL([WITH_LZMA], [true]) ;;
+ no) AM_CONDITIONAL([WITH_LZMA], [false]) ;;
+ *) AC_MSG_ERROR([bad value ${withval} for --without-lzma]) ;;
+ esac],
+ [AM_CONDITIONAL([WITH_LZMA], [true])])
+
##### search for dependencies #####
-have_zlib="no"
-have_lzma="no"
+need_zlib="no"
+need_lzma="no"
+
+AM_COND_IF([WITH_ZLIB], [need_zlib="yes"])
+AM_COND_IF([WITH_LZMA], [need_lzma="yes"])
-PKG_CHECK_MODULES(ZLIB, [zlib], [have_zlib="yes"], [])
-PKG_CHECK_MODULES(XZ, [liblzma >= 5.0.0], [have_lzma="yes"], [])
+if test "x$need_zlib" = "xyes"; then
+ PKG_CHECK_MODULES(ZLIB, [zlib], [], [AC_MSG_ERROR([cannot find zlib])])
+fi
-AM_CONDITIONAL([WITH_ZLIB], [test "x$have_zlib" == "xyes"])
-AM_CONDITIONAL([WITH_LZMA], [test "x$have_lzma" == "xyes"])
+if test "x$need_lzma" = "xyes"; then
+ PKG_CHECK_MODULES(XZ, [liblzma >= 5.0.0], [],
+ [AC_MSG_ERROR([cannot find lzma])])
+fi
##### generate output #####