]> granicus.if.org Git - php/commitdiff
Use PKG_CHECK_MODULES to detect libxml2
authorHugh McMaster <hugh.mcmaster@outlook.com>
Wed, 17 Apr 2019 11:07:15 +0000 (21:07 +1000)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 18 Apr 2019 11:04:54 +0000 (13:04 +0200)
acinclude.m4
ext/dom/config.m4
ext/libxml/config0.m4
ext/simplexml/config.m4
ext/soap/config.m4
ext/xml/config.m4
ext/xmlreader/config.m4
ext/xmlrpc/config.m4
ext/xmlwriter/config.m4

index 6a60908cba6354d165a91d8f00fc2dd02708849b..3c372439c0face997a9edc31c85afe4baf079e4f 100644 (file)
@@ -2091,76 +2091,14 @@ dnl
 dnl Common setup macro for libxml
 dnl
 AC_DEFUN([PHP_SETUP_LIBXML], [
-  found_libxml=no
-
-  dnl First try to find xml2-config
-  AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
-  [
-    for i in $PHP_LIBXML_DIR /usr/local /usr; do
-      if test -x "$i/bin/xml2-config"; then
-        ac_cv_php_xml2_config_path="$i/bin/xml2-config"
-        break
-      fi
-    done
-  ])
+  PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.7.6])
 
-  if test -x "$ac_cv_php_xml2_config_path"; then
-    XML2_CONFIG="$ac_cv_php_xml2_config_path"
-    libxml_full_version=`$XML2_CONFIG --version`
-    ac_IFS=$IFS
-    IFS="."
-    set $libxml_full_version
-    IFS=$ac_IFS
-    LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
-    if test "$LIBXML_VERSION" -ge "2007006"; then
-      found_libxml=yes
-      LIBXML_LIBS=`$XML2_CONFIG --libs`
-      LIBXML_INCS=`$XML2_CONFIG --cflags`
-    else
-      AC_MSG_ERROR([libxml2 version 2.7.6 or greater required.])
-    fi
-  fi
+  PHP_EVAL_INCLINE($LIBXML_CFLAGS)
+  PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
 
-  dnl If xml2-config fails, try pkg-config
-  if test "$found_libxml" = "no"; then
-    if test -z "$PKG_CONFIG"; then
-      AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-    fi
+  AC_DEFINE(HAVE_LIBXML, 1, [ ])
 
-    dnl If pkg-config is found try using it
-    if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libxml-2.0; then
-      if $PKG_CONFIG --atleast-version=2.6.11 libxml-2.0; then
-        found_libxml=yes
-        LIBXML_LIBS=`$PKG_CONFIG --libs libxml-2.0`
-        LIBXML_INCS=`$PKG_CONFIG --cflags-only-I libxml-2.0`
-      else
-        AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.])
-      fi
-    fi
-  fi
-
-  if test "$found_libxml" = "yes"; then
-    PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
-    PHP_EVAL_INCLINE($LIBXML_INCS)
-
-    dnl Check that build works with given libs
-    AC_CACHE_CHECK(whether libxml build works, php_cv_libxml_build_works, [
-      PHP_TEST_BUILD(xmlInitParser,
-      [
-        php_cv_libxml_build_works=yes
-      ], [
-        AC_MSG_RESULT(no)
-        AC_MSG_ERROR([build test failed.  Please check the config.log for details.])
-      ], [
-        [$]$1
-      ])
-    ])
-    if test "$php_cv_libxml_build_works" = "yes"; then
-      AC_DEFINE(HAVE_LIBXML, 1, [ ])
-    fi
-    $2
-ifelse([$3],[],,[else $3])
-  fi
+  $2
 ])
 
 dnl -------------------------------------------------------------------------
index a2406f54adddfb5ccd484e044fbfdf6b12ed572b..a14f27254a88072642373d17e0c7029815eeacf8 100644 (file)
@@ -28,7 +28,5 @@ if test "$PHP_DOM" != "no"; then
     PHP_SUBST(DOM_SHARED_LIBADD)
     PHP_INSTALL_HEADERS([ext/dom/xml_common.h])
     PHP_ADD_EXTENSION_DEP(dom, libxml)
-  ], [
-    AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
   ])
 fi
index c16324266eb8f2d24e1e068aac03693ff496dd57..27120103239bbd3a0074ba3ea000e06c31654eae 100644 (file)
@@ -15,7 +15,5 @@ if test "$PHP_LIBXML" != "no"; then
     AC_DEFINE(HAVE_LIBXML,1,[ ])
     PHP_NEW_EXTENSION(libxml, [libxml.c], $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
     PHP_INSTALL_HEADERS([ext/libxml/php_libxml.h])
-  ], [
-    AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
   ])
 fi
index 1db02c4da2d6905d4d12a1c1c256d4e24d5b4810..d9fe11f8bf4900675c3c2ce99fef5099cdf871b0 100644 (file)
@@ -17,8 +17,6 @@ if test "$PHP_SIMPLEXML" != "no"; then
     PHP_NEW_EXTENSION(simplexml, simplexml.c sxe.c, $ext_shared)
     PHP_INSTALL_HEADERS([ext/simplexml/php_simplexml.h ext/simplexml/php_simplexml_exports.h])
     PHP_SUBST(SIMPLEXML_SHARED_LIBADD)
-  ], [
-    AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
   ])
   PHP_ADD_EXTENSION_DEP(simplexml, libxml)
   PHP_ADD_EXTENSION_DEP(simplexml, spl, true)
index 8a3d79174184bae3e68f5f4bb10ea94bfc6dc8fc..0664fb886c613174431d7ed4e27a4fb36772b2d6 100644 (file)
@@ -15,7 +15,5 @@ if test "$PHP_SOAP" != "no"; then
     AC_DEFINE(HAVE_SOAP,1,[ ])
     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)
     PHP_SUBST(SOAP_SHARED_LIBADD)
-  ], [
-    AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
   ])
 fi
index 40110fd9ad17caef3e45d2709e7fd7e385133474..7c039efd81d2b59d43fe63e83bbb7eaefae7ea55 100644 (file)
@@ -27,8 +27,6 @@ if test "$PHP_XML" != "no"; then
     PHP_SETUP_LIBXML(XML_SHARED_LIBADD, [
       xml_extra_sources="compat.c"
       PHP_ADD_EXTENSION_DEP(xml, libxml)
-    ], [
-      AC_MSG_ERROR([libxml2 not found.])
     ])
   fi
 
index 07be219d42ae39877c090fec6d7d0a78ee2e98a8..d960839966e16b75e3de0e24425bdb887027c576 100644 (file)
@@ -17,7 +17,5 @@ if test "$PHP_XMLREADER" != "no"; then
     PHP_NEW_EXTENSION(xmlreader, php_xmlreader.c, $ext_shared)
     PHP_ADD_EXTENSION_DEP(xmlreader, dom, true)
     PHP_SUBST(XMLREADER_SHARED_LIBADD)
-  ], [
-    AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
   ])
 fi
index caf8c8286ab6f354eb1068561ae19060c47ced11..c7ab37c8977aa3eb4506591152af895ce7524144 100644 (file)
@@ -44,8 +44,6 @@ if test "$PHP_XMLRPC" != "no"; then
         PHP_ADD_SOURCES(ext/xml, compat.c)
         PHP_ADD_BUILD_DIR(ext/xml)
       fi
-    ], [
-      AC_MSG_ERROR([libxml2 not found.])
     ])
   else
     testval=no
index 73e0bc04385101ce53963d52717382875847cb73..142420b20e3d686ccbba62640199b3a6d290804d 100644 (file)
@@ -16,7 +16,5 @@ if test "$PHP_XMLWRITER" != "no"; then
     AC_DEFINE(HAVE_XMLWRITER,1,[ ])
     PHP_NEW_EXTENSION(xmlwriter, php_xmlwriter.c, $ext_shared)
     PHP_SUBST(XMLWRITER_SHARED_LIBADD)
-  ], [
-    AC_MSG_ERROR([libxml2 not found. Please check your libxml2 installation.])
   ])
 fi