https://sourceforge.net/p/xmlrpc-c/code/3151 https://bugs.gentoo.org/870253 --- a/common.mk +++ b/common.mk @@ -281,7 +281,7 @@ -L$(BLDDIR)/lib/expat/xmlparse -lxmlrpc_xmlparse \ -L$(BLDDIR)/lib/expat/xmltok -lxmlrpc_xmltok else - LDLIBS_XML = $(shell xml2-config --libs) + LDLIBS_XML = $(shell ${PKG_CONFIG} libxml-2.0 --libs) endif # LIBXMLRPC_UTIL_LIBDEP is the string of linker options you need on the link --- a/configure.in +++ b/configure.in @@ -742,6 +742,36 @@ dnl ======================================================================= +dnl Finding Libxml2 +dnl ======================================================================= + +AC_MSG_CHECKING(for Libxml2 library) + +if ${PKG_CONFIG} libxml-2.0; then + HAVE_LIBXML2=yes +else + HAVE_LIBXML2=no +fi + +AC_MSG_RESULT($HAVE_LIBXML2) + +AC_ARG_ENABLE(libxml2-backend, + [ --enable-libxml2-backend Use libxml2 instead of built-in expat], , +enable_libxml2_backend=no) +AC_MSG_CHECKING(whether to build the libxml2 backend) +AC_MSG_RESULT($enable_libxml2_backend) + +if test $enable_libxml2_backend = yes; then + if test $HAVE_LIBXML2 = no; then + AC_MSG_ERROR([You specified --enable-libxml2_backend, but don't appear to have libxml2 installed (no pkg-config file for it in your pkg-config search path), so we cannot not build for libxml2]) + fi +fi + +ENABLE_LIBXML2_BACKEND=$enable_libxml2_backend +AC_SUBST(ENABLE_LIBXML2_BACKEND) + + +dnl ======================================================================= dnl Checks for build options. dnl ======================================================================= @@ -763,22 +793,6 @@ fi AC_SUBST(HAVE_LIBWWW_SSL_DEFINE) -dnl Check to see if we should build the libxml2 backend. -AC_ARG_ENABLE(libxml2-backend, - [ --enable-libxml2-backend Use libxml2 instead of built-in expat], , -enable_libxml2_backend=no) -AC_MSG_CHECKING(whether to build the libxml2 backend) -AC_MSG_RESULT($enable_libxml2_backend) - -if test $enable_libxml2_backend = yes; then - AC_CHECK_PROG(have_xml2_config, xml2-config, yes, no) - if test $have_xml2_config = no; then - AC_MSG_ERROR([You specified --enable-libxml2_backend, but don't appear to have libxml2 installed (no working xml2-config in your command search path), so we cannot not build for libxml2]) - fi -fi -ENABLE_LIBXML2_BACKEND=$enable_libxml2_backend -AC_SUBST(ENABLE_LIBXML2_BACKEND) - dnl ======================================================================= dnl Compiler information dnl ======================================================================= --- a/src/Makefile +++ b/src/Makefile @@ -68,7 +68,7 @@ ifeq ($(ENABLE_LIBXML2_BACKEND),yes) XMLRPC_XML_PARSER = xmlrpc_libxml2 - XML_PARSER_LIBDEP = $(shell xml2-config --libs) + XML_PARSER_LIBDEP = $(shell ${PKG_CONFIG} libxml-2.0 --libs) XML_PARSER_LIBDEP_DEP = XML_PKGCONFIG_REQ = libxml-2.0 else @@ -276,7 +276,7 @@ -Isrcdir/lib/util/include \ ifeq ($(ENABLE_LIBXML2_BACKEND),yes) - LIBXML_INCLUDES = $(shell xml2-config --cflags) + LIBXML_INCLUDES = $(shell ${PKG_CONFIG} libxml-2.0 --cflags) else LIBXML_INCLUDES = -Isrcdir/lib/expat/xmlparse endif --- a/src/cpp/Makefile +++ b/src/cpp/Makefile @@ -46,7 +46,7 @@ endif ifeq ($(ENABLE_LIBXML2_BACKEND),yes) - XML_PARSER_LIBDEP = $(shell xml2-config --libs) + XML_PARSER_LIBDEP = $(shell ${PKG_CONFIG} libxml-2.0 --libs) else XML_PARSER_LIBDEP = \ -L$(BLDDIR)/lib/expat/xmlparse -lxmlrpc_xmlparse \