From: Andres Mejia Date: Sun, 3 Feb 2013 03:56:39 +0000 (-0500) Subject: Use different check for libbz2 on Windows. X-Git-Tag: v3.1.2~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a0f8974bd3092e1f313e301d1ccc352b6b60118;p=thirdparty%2Flibarchive.git 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. --- diff --git a/configure.ac b/configure.ac index e309e439d..c44d3001f 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 + 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],