提交 e4c05240 编写于 作者: D Daniel P. Berrangé

build: bump min libxml2 to 2.9.1

The various distros have the following libxml2 vesions:

        CentOS 7: 2.9.1
  Debian Stretch: 2.9.4
   FreeBSD Ports: 2.9.9
Ubuntu 16.04 LTS: 2.9.3

Based on this sampling, we can reasonably bump libxml2 min
version to 2.9.1

The 'query_raw' struct field was added in version 2.6.28,
so can be assumed to exist.
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 38d2e033
......@@ -18,31 +18,17 @@ dnl <http://www.gnu.org/licenses/>.
dnl
AC_DEFUN([LIBVIRT_ARG_LIBXML], [
LIBVIRT_ARG_WITH([LIBXML], [libxml-2.0 (>= 2.6.0) location], [check])
LIBVIRT_ARG_WITH([LIBXML], [libxml-2.0 (>= 2.9.1) location], [check])
])
AC_DEFUN([LIBVIRT_CHECK_LIBXML], [
LIBXML_REQUIRED="2.6.0"
LIBXML_REQUIRED="2.9.1"
LIBVIRT_CHECK_PKG([LIBXML], [libxml-2.0], [$LIBXML_REQUIRED])
if test "$with_libxml" = "no" ; then
AC_MSG_ERROR([libxml2 >= $LIBXML_REQUIRED is required for libvirt])
fi
dnl xmlURI structure has query_raw?
old_CFLAGS="$CFLAGS"
old_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBXML_CFLAGS"
LIBS="$LIBS $LIBXML_LIBS"
AC_CHECK_MEMBER([struct _xmlURI.query_raw],
[AC_DEFINE([HAVE_XMLURI_QUERY_RAW], [1],
[Have query_raw field in libxml2 xmlURI structure])],
[], [#include <libxml/uri.h>])
CFLAGS="$old_CFLAGS"
LIBS="$old_LIBS"
])
AC_DEFUN([LIBVIRT_RESULT_LIBXML], [
......
......@@ -183,13 +183,8 @@ virURIParse(const char *uri)
ret->port = xmluri->port;
if (VIR_STRDUP(ret->path, xmluri->path) < 0)
goto error;
#ifdef HAVE_XMLURI_QUERY_RAW
if (VIR_STRDUP(ret->query, xmluri->query_raw) < 0)
goto error;
#else
if (VIR_STRDUP(ret->query, xmluri->query) < 0)
goto error;
#endif
if (VIR_STRDUP(ret->fragment, xmluri->fragment) < 0)
goto error;
if (VIR_STRDUP(ret->user, xmluri->user) < 0)
......@@ -237,11 +232,7 @@ virURIFormat(virURIPtr uri)
xmluri.server = uri->server;
xmluri.port = uri->port;
xmluri.path = uri->path;
#ifdef HAVE_XMLURI_QUERY_RAW
xmluri.query_raw = uri->query;
#else
xmluri.query = uri->query;
#endif
xmluri.fragment = uri->fragment;
xmluri.user = uri->user;
......
......@@ -196,23 +196,19 @@ mymain(void)
{ (char*)"foo", (char*)"two", false },
{ NULL, NULL, false },
};
#ifdef HAVE_XMLURI_QUERY_RAW
virURIParam params3[] = {
{ (char*)"foo", (char*)"&one", false },
{ (char*)"bar", (char*)"&two", false },
{ NULL, NULL, false },
};
#endif
virURIParam params4[] = {
{ (char*)"foo", (char*)"", false },
{ NULL, NULL, false },
};
#ifdef HAVE_XMLURI_QUERY_RAW
virURIParam params5[] = {
{ (char*)"foo", (char*)"one two", false },
{ NULL, NULL, false },
};
#endif
virURIParam params6[] = {
{ (char*)"foo", (char*)"one", false },
{ NULL, NULL, false },
......@@ -222,16 +218,12 @@ mymain(void)
TEST_PARAMS("foo=one&foo=two", "", params2);
TEST_PARAMS("foo=one&&foo=two", "foo=one&foo=two", params2);
TEST_PARAMS("foo=one;foo=two", "foo=one&foo=two", params2);
#ifdef HAVE_XMLURI_QUERY_RAW
TEST_PARAMS("foo=%26one&bar=%26two", "", params3);
#endif
TEST_PARAMS("foo", "foo=", params4);
TEST_PARAMS("foo=", "", params4);
TEST_PARAMS("foo=&", "foo=", params4);
TEST_PARAMS("foo=&&", "foo=", params4);
#ifdef HAVE_XMLURI_QUERY_RAW
TEST_PARAMS("foo=one%20two", "", params5);
#endif
TEST_PARAMS("=bogus&foo=one", "foo=one", params6);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册