+# ------------------------------------------------------------------------------
+have_zlib=no
+AC_ARG_ENABLE(zlib, AS_HELP_STRING([--disable-zlib], [Disable optional ZLIB support]))
+if test "x$enable_zlib" != "xno"; then
+ PKG_CHECK_MODULES(ZLIB, [ zlib ],
+ [AC_DEFINE(HAVE_ZLIB, 1, [Define if ZLIB is available]) have_zlib=yes])
+ if test "x$have_zlib" = xno -a "x$enable_zlib" = xyes; then
+ AC_MSG_ERROR([*** ZLIB support requested but libraries not found])
+ fi
+fi
+AM_CONDITIONAL(HAVE_ZLIB, [test "$have_zlib" = "yes"])
+
+# ------------------------------------------------------------------------------
+have_bzip2=no
+AC_ARG_ENABLE(bzip2, AS_HELP_STRING([--enable-bzip2], [Enable optional BZIP2 support]))
+AS_IF([test "x$enable_bzip2" != "xno"], [
+ AC_CHECK_HEADERS(bzlib.h,
+ [AC_DEFINE(HAVE_BZIP2, 1, [Define in BZIP2 is available]) have_bzip2=yes],
+ [AC_MSG_ERROR([*** BZIP2 support requested but headers not found])])
+])
+AM_CONDITIONAL(HAVE_BZIP2, [test "$have_bzip2" = "yes"])
+