+
+# BZIP2
+AC_ARG_ENABLE(bz2, AC_HELP_STRING([--enable-bzip2],
+ [enable bzip2 Support (default is enable).]),
+ [ac_cv_enable_bzip2=$enableval],
+ [ac_cv_enable_bzip2=yes])
+AC_CACHE_CHECK([whether to enable bzip2 Support],
+ [ac_cv_enable_bzip2], [ac_cv_enable_bzip2=yes])
+case $ac_cv_enable_bzip2 in
+ yes)
+ AC_CHECK_HEADERS([bzlib.h],[],[AC_MSG_ERROR([bzlib.h is needed but not found - you will need to install package 'libbz2-dev' or similar. The feature can be disabled with --disable-bzip2])])
+ AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffDecompress, [], [AC_MSG_ERROR([libbz2 is needed but not found.])])
+ ;;
+esac
+AM_CONDITIONAL([BZIP2], [test x$ac_cv_enable_bzip2 = xyes])
+
+# FILE MAGIC
+AC_ARG_ENABLE(magic, AC_HELP_STRING([--enable-magic],
+ [enable File Magic support via libmagic (default is enable).]),
+ [ac_cv_enable_magic=$enableval],
+ [ac_cv_enable_magic=yes])
+AC_CACHE_CHECK([whether to enable Magic Support],
+ [ac_cv_enable_magic], [ac_cv_enable_magic=yes])
+case $ac_cv_enable_magic in
+ yes)
+ AC_CHECK_HEADERS([magic.h],[],[AC_MSG_ERROR([magic.h is needed but not found - you will need to install package 'libmagic-dev' or similar. The feature can be disabled with --disable-magic])])
+ AC_CHECK_LIB(magic, magic_open, [], [AC_MSG_ERROR([libmagic is needed but not found.])])
+ ;;
+esac
+AM_CONDITIONAL([MAGIC], [test x$ac_cv_enable_magic = xyes])
+
+# SQL for MBTiles
+AC_ARG_ENABLE(mbtiles, AC_HELP_STRING([--enable-mbtiles],
+ [enable MBTiles support via libsqlite3 (default is enable).]),
+ [ac_cv_enable_mbtiles=$enableval],
+ [ac_cv_enable_mbtiles=yes])
+AC_CACHE_CHECK([whether to enable MBTiles Support],
+ [ac_cv_enable_mbtiles], [ac_cv_enable_mbtiles=yes])
+case $ac_cv_enable_mbtiles in
+ yes)
+ AC_CHECK_HEADERS([sqlite3.h],[],[AC_MSG_ERROR([sqlite3.h is needed but not found - you will need to install package 'libsqlite3-dev' or similar. The feature can be disabled with --disable-mbtiles])])
+ AC_CHECK_LIB(sqlite3, sqlite3_open, [], [AC_MSG_ERROR([libsqlite3 is needed but not found.])])
+ ;;
+esac
+AM_CONDITIONAL([SQLITE], [test x$ac_cv_enable_mbtiles = xyes])
+
+###