Skip to content

Commit 470d0b9

Browse files
committed
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.
1 parent 3055579 commit 470d0b9

File tree

4 files changed

+11
-90
lines changed

4 files changed

+11
-90
lines changed

configure

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -23843,75 +23843,6 @@ fi
2384323843

2384423844

2384523845

23846-
# Older versions of libxml2 lack the xmlStructuredErrorContext variable
23847-
# (which could be a macro referring to a function, if threading is enabled)
23848-
if test "$with_libxml" = yes ; then
23849-
{ $as_echo "$as_me:$LINENO: checking for xmlStructuredErrorContext" >&5
23850-
$as_echo_n "checking for xmlStructuredErrorContext... " >&6; }
23851-
if test "${pgac_cv_libxml_structerrctx+set}" = set; then
23852-
$as_echo_n "(cached) " >&6
23853-
else
23854-
cat >conftest.$ac_ext <<_ACEOF
23855-
/* confdefs.h. */
23856-
_ACEOF
23857-
cat confdefs.h >>conftest.$ac_ext
23858-
cat >>conftest.$ac_ext <<_ACEOF
23859-
/* end confdefs.h. */
23860-
#include <libxml/globals.h>
23861-
void *globptr;
23862-
int
23863-
main ()
23864-
{
23865-
globptr = xmlStructuredErrorContext
23866-
;
23867-
return 0;
23868-
}
23869-
_ACEOF
23870-
rm -f conftest.$ac_objext conftest$ac_exeext
23871-
if { (ac_try="$ac_link"
23872-
case "(($ac_try" in
23873-
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
23874-
*) ac_try_echo=$ac_try;;
23875-
esac
23876-
eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
23877-
$as_echo "$ac_try_echo") >&5
23878-
(eval "$ac_link") 2>conftest.er1
23879-
ac_status=$?
23880-
grep -v '^ *+' conftest.er1 >conftest.err
23881-
rm -f conftest.er1
23882-
cat conftest.err >&5
23883-
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
23884-
(exit $ac_status); } && {
23885-
test -z "$ac_c_werror_flag" ||
23886-
test ! -s conftest.err
23887-
} && test -s conftest$ac_exeext && {
23888-
test "$cross_compiling" = yes ||
23889-
$as_test_x conftest$ac_exeext
23890-
}; then
23891-
pgac_cv_libxml_structerrctx=yes
23892-
else
23893-
$as_echo "$as_me: failed program was:" >&5
23894-
sed 's/^/| /' conftest.$ac_ext >&5
23895-
23896-
pgac_cv_libxml_structerrctx=no
23897-
fi
23898-
23899-
rm -rf conftest.dSYM
23900-
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
23901-
conftest$ac_exeext conftest.$ac_ext
23902-
fi
23903-
{ $as_echo "$as_me:$LINENO: result: $pgac_cv_libxml_structerrctx" >&5
23904-
$as_echo "$pgac_cv_libxml_structerrctx" >&6; }
23905-
if test x"$pgac_cv_libxml_structerrctx" = x"yes"; then
23906-
23907-
cat >>confdefs.h <<\_ACEOF
23908-
#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
23909-
_ACEOF
23910-
23911-
fi
23912-
fi
23913-
23914-
2391523846
# This test makes sure that run tests work at all. Sometimes a shared
2391623847
# library is found by the linker, but the runtime linker can't find it.
2391723848
# This check should come after all modifications of compiler or linker

configure.in

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,23 +1539,6 @@ AC_SUBST(LDAP_LIBS_FE)
15391539
AC_SUBST(LDAP_LIBS_BE)
15401540

15411541

1542-
# Older versions of libxml2 lack the xmlStructuredErrorContext variable
1543-
# (which could be a macro referring to a function, if threading is enabled)
1544-
if test "$with_libxml" = yes ; then
1545-
AC_CACHE_CHECK([for xmlStructuredErrorContext], pgac_cv_libxml_structerrctx,
1546-
[AC_TRY_LINK([#include <libxml/globals.h>
1547-
void *globptr;],
1548-
[globptr = xmlStructuredErrorContext],
1549-
[pgac_cv_libxml_structerrctx=yes],
1550-
[pgac_cv_libxml_structerrctx=no])])
1551-
if test x"$pgac_cv_libxml_structerrctx" = x"yes"; then
1552-
AC_DEFINE(HAVE_XMLSTRUCTUREDERRORCONTEXT,
1553-
1,
1554-
[Define to 1 if your libxml has xmlStructuredErrorContext.])
1555-
fi
1556-
fi
1557-
1558-
15591542
# This test makes sure that run tests work at all. Sometimes a shared
15601543
# library is found by the linker, but the runtime linker can't find it.
15611544
# This check should come after all modifications of compiler or linker

src/backend/utils/adt/xml.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,19 @@
5252
#include <libxml/tree.h>
5353
#include <libxml/uri.h>
5454
#include <libxml/xmlerror.h>
55+
#include <libxml/xmlversion.h>
5556
#include <libxml/xmlwriter.h>
5657
#include <libxml/xpath.h>
5758
#include <libxml/xpathInternals.h>
59+
60+
/*
61+
* We used to check for xmlStructuredErrorContext via a configure test; but
62+
* that doesn't work on Windows, so instead use this grottier method of
63+
* testing the library version number.
64+
*/
65+
#if LIBXML_VERSION >= 20704
66+
#define HAVE_XMLSTRUCTUREDERRORCONTEXT 1
67+
#endif
5868
#endif /* USE_LIBXML */
5969

6070
#include "catalog/namespace.h"
@@ -970,7 +980,7 @@ pg_xml_init(PgXmlStrictness strictness)
970980
*
971981
* The only known situation in which this test fails is if we compile with
972982
* headers from a libxml2 that doesn't track the structured error context
973-
* separately (<= 2.7.3), but at runtime use a version that does, or vice
983+
* separately (< 2.7.4), but at runtime use a version that does, or vice
974984
* versa. The libxml2 authors did not treat that change as constituting
975985
* an ABI break, so the LIBXML_TEST_VERSION test in pg_xml_init_library
976986
* fails to protect us from this.

src/include/pg_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,6 @@
632632
/* Define to 1 if you have the <winldap.h> header file. */
633633
#undef HAVE_WINLDAP_H
634634

635-
/* Define to 1 if your libxml has xmlStructuredErrorContext. */
636-
#undef HAVE_XMLSTRUCTUREDERRORCONTEXT
637-
638635
/* Define to the appropriate snprintf format for 64-bit ints. */
639636
#undef INT64_FORMAT
640637

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy