summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Mejia <amejia004@gmail.com>2013-02-02 22:56:39 -0500
committerAndres Mejia <amejia004@gmail.com>2013-02-02 22:56:39 -0500
commit1a0f8974bd3092e1f313e301d1ccc352b6b60118 (patch)
treebe7948b03cd8ebb2951a3d8b9f76235cb4d3b6a9
parent66648f8c3fa01d39fe3a24551c19d6fa20250c9a (diff)
downloadlibarchive-1a0f8974bd3092e1f313e301d1ccc352b6b60118.tar.gz
Use different check for libbz2 on Windows.
Windows port of libbz2 cannot use AC_CHECK_LIB. See https://mail.gnome.org/archives/gnumeric-list/2008-November/msg00038.html for an explanation.
-rw-r--r--configure.ac24
1 files changed, 23 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index e309e439..c44d3001 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,7 +247,29 @@ AC_ARG_WITH([bz2lib],
if test "x$with_bz2lib" != "xno"; then
AC_CHECK_HEADERS([bzlib.h])
- AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
+ case "$host_os" in
+ *mingw* | *cygwin*)
+ dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore
+ dnl use AC_LINK_IFELSE.
+ AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2])
+ old_LIBS="$LIBS"
+ LIBS="-lbz2 $LIBS"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(#include <bzlib.h>
+ int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })],
+ [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes],
+ [ac_cv_lib_bz2_BZ2_bzDecompressInit=no])
+ LIBS="$old_LIBS"
+ AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit)
+ if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then
+ AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).])
+ LIBS="-lbz2 $LIBS"
+ fi
+ ;;
+ *)
+ AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
+ ;;
+ esac
fi
AC_ARG_WITH([lzmadec],