From 1a0f8974bd3092e1f313e301d1ccc352b6b60118 Mon Sep 17 00:00:00 2001 From: Andres Mejia Date: Sat, 2 Feb 2013 22:56:39 -0500 Subject: [PATCH] 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. --- configure.ac | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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], -- 2.47.2