From dd099f0c9901b05901411d456d82b2361438a563 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 23 Oct 2011 18:08:16 +0200 Subject: [PATCH] Fix linking of static libmagic with mingw --- ac/gnurx.m4 | 11 +++++++++++ ac/magic.m4 | 13 ++++++++----- configure.in | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 ac/gnurx.m4 diff --git a/ac/gnurx.m4 b/ac/gnurx.m4 new file mode 100644 index 000000000..93a6980a5 --- /dev/null +++ b/ac/gnurx.m4 @@ -0,0 +1,11 @@ +dnl +dnl Check for libgnurx on mingw +dnl +if test "x$ac_cv_mingw32" = "xyes"; then + AC_CHECK_LIB(gnurx, regexec, [ gnurx_found=yes ], [ gnurx_found=no ]) +fi + +if test "x$gnurx_found" = xyes ; then + GNURX_LIBS=-lgnurx +fi +AC_SUBST(GNURX_LIBS) diff --git a/ac/magic.m4 b/ac/magic.m4 index 927f826d6..93bada4e1 100644 --- a/ac/magic.m4 +++ b/ac/magic.m4 @@ -1,15 +1,18 @@ dnl dnl Check for libmagic dnl -AC_CHECK_LIB(magic, magic_open, - [ MAGIC_LIBS="-lmagic -lz" - magic_found=yes ], - [ magic_found=no ], - -lz) + +magic_mingw_libs="" +if test "x$ac_cv_mingw32" = "xyes"; then + magic_mingw_libs="-lshlwapi" +fi + +AC_CHECK_LIB(magic, magic_open, [ magic_found=yes ], [ magic_found=no ], [-lz $GNURX_LIBS $magic_mingw_libs]) 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" diff --git a/configure.in b/configure.in index 7caa02acb..5ce32b5bf 100644 --- a/configure.in +++ b/configure.in @@ -40,6 +40,7 @@ m4_include(ac/lzo.m4) m4_include(ac/bz.m4) m4_include(ac/wxwidgets.m4) m4_include(ac/qt4.m4) +m4_include(ac/gnurx.m4) m4_include(ac/magic.m4) m4_include(ac/curl.m4) m4_include(ac/ax_boost_base.m4)