2008-08-27 20:38:55 +00:00
|
|
|
dnl
|
|
|
|
dnl Check for libmagic
|
|
|
|
dnl
|
2011-10-23 16:08:16 +00:00
|
|
|
|
2015-07-21 14:41:30 +00:00
|
|
|
AC_ARG_ENABLE([magic],
|
|
|
|
AC_HELP_STRING([--enable-magic],[file type detection via libmagic (yes)]),
|
|
|
|
[],[enable_magic=yes])
|
|
|
|
|
|
|
|
if test x"$enable_magic" = xyes; then
|
|
|
|
magic_mingw_libs=""
|
|
|
|
if test "x$ac_cv_mingw32" = "xyes"; then
|
|
|
|
magic_mingw_libs="-lshlwapi"
|
|
|
|
fi
|
2011-10-23 16:08:16 +00:00
|
|
|
|
2021-04-24 22:23:05 +00:00
|
|
|
PKG_CHECK_EXISTS([libmagic],[libmagic_pkgfound=yes],[libmagic_pkgfound=no])
|
|
|
|
if test x"$libmagic_pkgfound" = xyes; then
|
2021-05-01 22:35:11 +00:00
|
|
|
PKG_CHECK_MODULES([MAGIC],[libmagic],[libmagic_pkgfound=yes],[libmagic_pkgfound=no])
|
2021-04-24 22:23:05 +00:00
|
|
|
MAGIC_LIBS="`$PKG_CONFIG --libs libmagic`"
|
|
|
|
else
|
|
|
|
AC_CHECK_LIB(magic, magic_open, [ magic_found=yes ], [ magic_found=no ], [-lz $GNURX_LIBS $magic_mingw_libs])
|
2021-05-01 22:35:11 +00:00
|
|
|
fi
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-01 22:35:11 +00:00
|
|
|
if test "x$magic_found" = "xyes" ; then
|
|
|
|
AC_CHECK_HEADERS([magic.h])
|
|
|
|
if test "x$ac_cv_header_magic_h" = "xyes" ; then
|
|
|
|
MAGIC_LIBS="-lmagic -lz $GNURX_LIBS $magic_mingw_libs"
|
|
|
|
opt_features_yes="$opt_features_yes\n * libMagic file type detection"
|
|
|
|
else
|
|
|
|
opt_features_no="$opt_features_no\n * libMagic file type detection"
|
|
|
|
fi
|
|
|
|
elif test x"$libmagic_pkgfound" = xyes; then
|
2008-08-27 20:38:55 +00:00
|
|
|
opt_features_yes="$opt_features_yes\n * libMagic file type detection"
|
|
|
|
else
|
|
|
|
opt_features_no="$opt_features_no\n * libMagic file type detection"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(MAGIC_LIBS)
|