提交 470d0b97 编写于 作者: T Tom Lane

Check LIBXML_VERSION instead of testing in configure script.

We had put a test for libxml2's xmlStructuredErrorContext variable in
configure, but of course that doesn't work on Windows builds.  The next
best alternative seems to be to test the LIBXML_VERSION symbol provided
by xmlversion.h.

Per report from Talha Bin Rizwan, though this fixes it in a different way
than his proposed patch.
上级 30555798
......@@ -23843,75 +23843,6 @@ fi
# Older versions of libxml2 lack the xmlStructuredErrorContext variable
# (which could be a macro referring to a function, if threading is enabled)
if test "$with_libxml" = yes ; then
{ $as_echo "$as_me:$LINENO: checking for xmlStructuredErrorContext" >&5
$as_echo_n "checking for xmlStructuredErrorContext... " >&6; }
if test "${pgac_cv_libxml_structerrctx+set}" = set; then
$as_echo_n "(cached) " >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <libxml/globals.h>
void *globptr;
int
main ()
{
globptr = xmlStructuredErrorContext
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
$as_echo "$ac_try_echo") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
$as_test_x conftest$ac_exeext
}; then
pgac_cv_libxml_structerrctx=yes
else
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
pgac_cv_libxml_structerrctx=no
fi
rm -rf conftest.dSYM
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_libxml_structerrctx" >&5
$as_echo "$pgac_cv_libxml_structerrctx" >&6; }
if test x"$pgac_cv_libxml_structerrctx" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
_ACEOF
fi
fi
# This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it.
# This check should come after all modifications of compiler or linker
......
......@@ -1539,23 +1539,6 @@ AC_SUBST(LDAP_LIBS_FE)
AC_SUBST(LDAP_LIBS_BE)
# Older versions of libxml2 lack the xmlStructuredErrorContext variable
# (which could be a macro referring to a function, if threading is enabled)
if test "$with_libxml" = yes ; then
AC_CACHE_CHECK([for xmlStructuredErrorContext], pgac_cv_libxml_structerrctx,
[AC_TRY_LINK([#include <libxml/globals.h>
void *globptr;],
[globptr = xmlStructuredErrorContext],
[pgac_cv_libxml_structerrctx=yes],
[pgac_cv_libxml_structerrctx=no])])
if test x"$pgac_cv_libxml_structerrctx" = x"yes"; then
AC_DEFINE(HAVE_XMLSTRUCTUREDERRORCONTEXT,
1,
[Define to 1 if your libxml has xmlStructuredErrorContext.])
fi
fi
# This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it.
# This check should come after all modifications of compiler or linker
......
......@@ -52,9 +52,19 @@
#include <libxml/tree.h>
#include <libxml/uri.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlwriter.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
/*
* We used to check for xmlStructuredErrorContext via a configure test; but
* that doesn't work on Windows, so instead use this grottier method of
* testing the library version number.
*/
#if LIBXML_VERSION >= 20704
#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
#endif
#endif /* USE_LIBXML */
#include "catalog/namespace.h"
......@@ -970,7 +980,7 @@ pg_xml_init(PgXmlStrictness strictness)
*
* The only known situation in which this test fails is if we compile with
* headers from a libxml2 that doesn't track the structured error context
* separately (<= 2.7.3), but at runtime use a version that does, or vice
* separately (< 2.7.4), but at runtime use a version that does, or vice
* versa. The libxml2 authors did not treat that change as constituting
* an ABI break, so the LIBXML_TEST_VERSION test in pg_xml_init_library
* fails to protect us from this.
......
......@@ -632,9 +632,6 @@
/* Define to 1 if you have the <winldap.h> header file. */
#undef HAVE_WINLDAP_H
/* Define to 1 if your libxml has xmlStructuredErrorContext. */
#undef HAVE_XMLSTRUCTUREDERRORCONTEXT
/* Define to the appropriate snprintf format for 64-bit ints. */
#undef INT64_FORMAT
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册