summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac33
1 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 68e1d47..8285bcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,6 +164,38 @@ fi
dnl ******************************
+dnl ******************************
+
+AC_ARG_ENABLE([magic],
+ AS_HELP_STRING([--enable-magic], [use libmagic to detect file type]),,
+ [enable_magic=no])
+
+if test x"$enable_magic" = x"yes" ; then
+ save_LIBS="$LIBS"
+ LIBS="$LIBS -lmagic"
+ AC_MSG_CHECKING([whether libmagic works])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
+#include <magic.h>
+int main () { magic_t m = magic_open(MAGIC_NONE); }
+])],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([libmagic is needed for magic])])
+ LIBS="$save_LIBS"
+
+ MAGIC_CFLAGS=
+ MAGIC_LIBS=-lmagic
+
+ AC_SUBST(MAGIC_CFLAGS)
+ AC_SUBST(MAGIC_LIBS)
+
+ AC_DEFINE(ENABLE_MAGIC, 1, [define to enable magic])
+fi
+
+AM_CONDITIONAL(ENABLE_MAGIC, test x"$enable_magic" != x"no")
+
+dnl ******************************
+
YELP_HELP_INIT
dnl ******************************
@@ -211,5 +243,6 @@ Configuration:
Caja support: ${enable_caja_actions}
PackageKit support: ${enable_packagekit}
Run in place ${enable_run_in_place}
+ Use libmagic: ${enable_magic}
JSON support: ${enable_json_glib}
"