summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-20 14:27:41 +0100
committerinfirit <[email protected]>2014-11-20 19:44:58 +0100
commit2e085a0a0542f9e5d6b2daf001143f8b9503490a (patch)
tree351d2c1a437deb67fb3284e4762f3c926bdf2060 /configure.ac
parent0ecd00c6f86b4558e978c07221baebe64039525b (diff)
downloadengrampa-2e085a0a0542f9e5d6b2daf001143f8b9503490a.tar.bz2
engrampa-2e085a0a0542f9e5d6b2daf001143f8b9503490a.tar.xz
add support for magic based identification of files
Based on FR commits: 7b23961d200e3545af3815a8eb40d6d31757024f f08945a652ae1365ad6bbc5e3dcc8709031b5faf b6104a74e66ceca98884a6f974485a96a83526a2 From: Saleem Abdulrasool <[email protected]>
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}
"