Imported Upstream version 0.18.3.2
[platform/upstream/gettext.git] / gnulib-local / m4 / libxml.m4
index 7f76fd0..7fa96bb 100644 (file)
@@ -1,4 +1,4 @@
-# libxml.m4 serial 5 (gettext-0.18)
+# libxml.m4 serial 6 (gettext-0.18.2)
 dnl Copyright (C) 2006, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,10 +36,16 @@ AC_DEFUN([gl_LIBXML],
       dnl Don't use xml2-config nor pkg-config, since it doesn't work when
       dnl cross-compiling or when the C compiler in use is different from the
       dnl one that built the library.
+      dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x,
+      dnl libxml2 is built in such a way that uses of xmlFree work fine with
+      dnl -Wl,--enable-auto-import but lead to a link error with
+      dnl -Wl,--disable-auto-import.
       AC_LIB_LINKFLAGS_BODY([xml2])
       LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV"
-      AC_TRY_LINK([#include <libxml/xmlversion.h>],
-        [xmlCheckVersion (0);],
+      AC_TRY_LINK([#include <libxml/xmlversion.h>
+                   #include <libxml/xmlmemory.h>
+                  ],
+        [xmlCheckVersion (0); xmlFree ((void *) 0);],
         [gl_cv_libxml=yes
          gl_cv_LIBXML="$LIBXML2 $LIBICONV"
          gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
@@ -47,8 +53,10 @@ AC_DEFUN([gl_LIBXML],
       if test "$gl_cv_libxml" != yes; then
         gl_save_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS $INCXML2"
-        AC_TRY_LINK([#include <libxml/xmlversion.h>],
-          [xmlCheckVersion (0);],
+        AC_TRY_LINK([#include <libxml/xmlversion.h>
+                     #include <libxml/xmlmemory.h>
+                    ],
+          [xmlCheckVersion (0); xmlFree ((void *) 0);],
           [gl_cv_libxml=yes
            gl_cv_LIBXML="$LIBXML2 $LIBICONV"
            gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
@@ -72,8 +80,10 @@ AC_DEFUN([gl_LIBXML],
           fi
           if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then
             CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir"
-            AC_TRY_LINK([#include <libxml/xmlversion.h>],
-              [xmlCheckVersion (0);],
+            AC_TRY_LINK([#include <libxml/xmlversion.h>
+                         #include <libxml/xmlmemory.h>
+                        ],
+              [xmlCheckVersion (0); xmlFree ((void *) 0);],
               [gl_cv_libxml=yes
                gl_cv_LIBXML="$LIBXML2 $LIBICONV"
                gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"