libgsf r1023 - trunk



Author: jody
Date: Sun Nov 23 17:36:15 2008
New Revision: 1023
URL: http://svn.gnome.org/viewvc/libgsf?rev=1023&view=rev

Log:
2008-11-23  Jody Goldberg <jody gnome org>

	From : Richard W.M. Jones <rjones redhat com>
	* configure.in : AC_CHECK_LIB doesn't work with the Windows port of libbz2 because
	  dnl it uses the __stdcall calling convention.


Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/configure.in

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sun Nov 23 17:36:15 2008
@@ -3,6 +3,9 @@
 Morten:
 	* Solaris compilation issue.  [#558253]
 
+Richard W.M. Jones
+	* MinGW configure fix for libbz2 detection.
+
 --------------------------------------------------------------------------
 libgsf 1.14.10
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Sun Nov 23 17:36:15 2008
@@ -331,30 +331,36 @@
 
 with_bz2=false
 if test "x$test_bz2" = xtrue ; then
-   AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, 
-		bz2_ok=yes,
-		bz2_ok=no
-		AC_MSG_WARN(*** BZ2 support disabled (BZ2 library not found) ***))
-
-   if test "$bz2_ok" = yes; then
-      AC_MSG_CHECKING([for bzlib.h])
-      AC_PREPROC_IFELSE(
-	[AC_LANG_SOURCE(
+   dnl AC_CHECK_LIB doesn't work with the Windows port of libbz2 because
+   dnl it uses the __stdcall calling convention where the callee cleans
+   dnl up the stack.  You have to include <bzlib.h> in order to get the
+   dnl right calling convention, and the link fails if not.  Since we
+   dnl require both -lbz2 and <bzlib.h>, just test if a program which
+   dnl uses both can be compiled.
+
+   old_LIBS="$LIBS"
+   LIBS="-lbz2 $LIBS"
+   AC_LINK_IFELSE(
+     [AC_LANG_SOURCE(
 	[[#include <stdio.h>
-	#undef PACKAGE
-	#undef VERSION
-	#undef HAVE_STDLIB_H
-	#include <bzlib.h>]])],
-        bz2_ok=yes,
-        bz2_ok=no)
-      AC_MSG_RESULT($bz2_ok)
-   fi
+	  #undef PACKAGE
+	  #undef VERSION
+	  #undef HAVE_STDLIB_H
+	  #include <bzlib.h>
+          main ()
+          {
+            return BZ2_bzDecompressInit (NULL, 0, 0);
+          }
+        ]])],
+     bz2_ok=yes,
+     bz2_ok=no)
+   LIBS="$old_LIBS"
 
    if test "$bz2_ok" = yes; then
 	AC_DEFINE(HAVE_BZ2, 1, [Is bzip2 available and enabled])
 	BZ2_LIBS="-lbz2"
    else
-	AC_MSG_WARN(*** BZ2 support disabled (BZ2 header not found) ***)
+	AC_MSG_WARN(*** BZ2 support disabled (BZ2 header or library not found) ***)
    fi
 else
    AC_MSG_WARN([BZ2 support disabled, as requested (Use --with-bz2 to enable)])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]