Skip to content

Commit cc930cd

Browse files
hughmcmasternikic
authored andcommitted
Use PKG_CHECK_MODULES to detect libxml2
1 parent 29d1b7f commit cc930cd

File tree

9 files changed

+5
-83
lines changed

9 files changed

+5
-83
lines changed

acinclude.m4

Lines changed: 5 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,76 +2091,14 @@ dnl
20912091
dnl Common setup macro for libxml
20922092
dnl
20932093
AC_DEFUN([PHP_SETUP_LIBXML], [
2094-
found_libxml=no
2095-
2096-
dnl First try to find xml2-config
2097-
AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
2098-
[
2099-
for i in $PHP_LIBXML_DIR /usr/local /usr; do
2100-
if test -x "$i/bin/xml2-config"; then
2101-
ac_cv_php_xml2_config_path="$i/bin/xml2-config"
2102-
break
2103-
fi
2104-
done
2105-
])
2094+
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.7.6])
21062095
2107-
if test -x "$ac_cv_php_xml2_config_path"; then
2108-
XML2_CONFIG="$ac_cv_php_xml2_config_path"
2109-
libxml_full_version=`$XML2_CONFIG --version`
2110-
ac_IFS=$IFS
2111-
IFS="."
2112-
set $libxml_full_version
2113-
IFS=$ac_IFS
2114-
LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
2115-
if test "$LIBXML_VERSION" -ge "2007006"; then
2116-
found_libxml=yes
2117-
LIBXML_LIBS=`$XML2_CONFIG --libs`
2118-
LIBXML_INCS=`$XML2_CONFIG --cflags`
2119-
else
2120-
AC_MSG_ERROR([libxml2 version 2.7.6 or greater required.])
2121-
fi
2122-
fi
2096+
PHP_EVAL_INCLINE($LIBXML_CFLAGS)
2097+
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
21232098
2124-
dnl If xml2-config fails, try pkg-config
2125-
if test "$found_libxml" = "no"; then
2126-
if test -z "$PKG_CONFIG"; then
2127-
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
2128-
fi
2099+
AC_DEFINE(HAVE_LIBXML, 1, [ ])
21292100
2130-
dnl If pkg-config is found try using it
2131-
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libxml-2.0; then
2132-
if $PKG_CONFIG --atleast-version=2.6.11 libxml-2.0; then
2133-
found_libxml=yes
2134-
LIBXML_LIBS=`$PKG_CONFIG --libs libxml-2.0`
2135-
LIBXML_INCS=`$PKG_CONFIG --cflags-only-I libxml-2.0`
2136-
else
2137-
AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.])
2138-
fi
2139-
fi
2140-
fi
2141-
2142-
if test "$found_libxml" = "yes"; then
2143-
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
2144-
PHP_EVAL_INCLINE($LIBXML_INCS)
2145-
2146-
dnl Check that build works with given libs
2147-
AC_CACHE_CHECK(whether libxml build works, php_cv_libxml_build_works, [
2148-
PHP_TEST_BUILD(xmlInitParser,
2149-
[
2150-
php_cv_libxml_build_works=yes
2151-
], [
2152-
AC_MSG_RESULT(no)
2153-
AC_MSG_ERROR([build test failed. Please check the config.log for details.])
2154-
], [
2155-
[$]$1
2156-
])
2157-
])
2158-
if test "$php_cv_libxml_build_works" = "yes"; then
2159-
AC_DEFINE(HAVE_LIBXML, 1, [ ])
2160-
fi
2161-
$2
2162-
ifelse([$3],[],,[else $3])
2163-
fi
2101+
$2
21642102
])
21652103

21662104
dnl -------------------------------------------------------------------------

ext/dom/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,5 @@ if test "$PHP_DOM" != "no"; then
2828
PHP_SUBST(DOM_SHARED_LIBADD)
2929
PHP_INSTALL_HEADERS([ext/dom/xml_common.h])
3030
PHP_ADD_EXTENSION_DEP(dom, libxml)
31-
], [
32-
AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
3331
])
3432
fi

ext/libxml/config0.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ if test "$PHP_LIBXML" != "no"; then
1515
AC_DEFINE(HAVE_LIBXML,1,[ ])
1616
PHP_NEW_EXTENSION(libxml, [libxml.c], $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1717
PHP_INSTALL_HEADERS([ext/libxml/php_libxml.h])
18-
], [
19-
AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
2018
])
2119
fi

ext/simplexml/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ if test "$PHP_SIMPLEXML" != "no"; then
1717
PHP_NEW_EXTENSION(simplexml, simplexml.c sxe.c, $ext_shared)
1818
PHP_INSTALL_HEADERS([ext/simplexml/php_simplexml.h ext/simplexml/php_simplexml_exports.h])
1919
PHP_SUBST(SIMPLEXML_SHARED_LIBADD)
20-
], [
21-
AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
2220
])
2321
PHP_ADD_EXTENSION_DEP(simplexml, libxml)
2422
PHP_ADD_EXTENSION_DEP(simplexml, spl, true)

ext/soap/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ if test "$PHP_SOAP" != "no"; then
1515
AC_DEFINE(HAVE_SOAP,1,[ ])
1616
PHP_NEW_EXTENSION(soap, soap.c php_encoding.c php_http.c php_packet_soap.c php_schema.c php_sdl.c php_xml.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
1717
PHP_SUBST(SOAP_SHARED_LIBADD)
18-
], [
19-
AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
2018
])
2119
fi

ext/xml/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ if test "$PHP_XML" != "no"; then
2727
PHP_SETUP_LIBXML(XML_SHARED_LIBADD, [
2828
xml_extra_sources="compat.c"
2929
PHP_ADD_EXTENSION_DEP(xml, libxml)
30-
], [
31-
AC_MSG_ERROR([libxml2 not found.])
3230
])
3331
fi
3432

ext/xmlreader/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ if test "$PHP_XMLREADER" != "no"; then
1717
PHP_NEW_EXTENSION(xmlreader, php_xmlreader.c, $ext_shared)
1818
PHP_ADD_EXTENSION_DEP(xmlreader, dom, true)
1919
PHP_SUBST(XMLREADER_SHARED_LIBADD)
20-
], [
21-
AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
2220
])
2321
fi

ext/xmlrpc/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ if test "$PHP_XMLRPC" != "no"; then
4444
PHP_ADD_SOURCES(ext/xml, compat.c)
4545
PHP_ADD_BUILD_DIR(ext/xml)
4646
fi
47-
], [
48-
AC_MSG_ERROR([libxml2 not found.])
4947
])
5048
else
5149
testval=no

ext/xmlwriter/config.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@ if test "$PHP_XMLWRITER" != "no"; then
1616
AC_DEFINE(HAVE_XMLWRITER,1,[ ])
1717
PHP_NEW_EXTENSION(xmlwriter, php_xmlwriter.c, $ext_shared)
1818
PHP_SUBST(XMLWRITER_SHARED_LIBADD)
19-
], [
20-
AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
2119
])
2220
fi

0 commit comments

Comments
 (0)