Skip to content

Commit 8356dad

Browse files
authored
Autotools: Fix xml extension dependency (#15162)
The PHP_ADD_EXTENSION_DEP Autoconf macro needs to be called after PHP_NEW_EXTENSION to be fully effective. This simplifies the code and checks. Also, due to the current order_by_dep.awk script implementation it needs to be on its own line with arguments unquoted so that awk can parse the config.m4 file. Until order_by_dep.awk script is fixed.
1 parent 0970fd4 commit 8356dad

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

ext/xml/config.m4

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,27 @@ PHP_ARG_ENABLE([xml],
55
[yes])
66

77
PHP_ARG_WITH([expat],
8-
[whether to build with expat support],
8+
[whether to build with Expat support],
99
[AS_HELP_STRING([--with-expat],
10-
[XML: use expat instead of libxml2])],
10+
[XML: use Expat library instead of libxml2 in the xml extension])],
1111
[no],
1212
[no])
1313

1414
if test "$PHP_XML" != "no"; then
15-
16-
dnl
1715
dnl Default to libxml2 if --with-expat is not specified.
18-
dnl
19-
if test "$PHP_EXPAT" = "no"; then
20-
21-
if test "$PHP_LIBXML" = "no"; then
22-
AC_MSG_ERROR([XML extension requires LIBXML extension, add --with-libxml])
23-
fi
24-
25-
PHP_SETUP_LIBXML([XML_SHARED_LIBADD], [
26-
xml_extra_sources="compat.c"
27-
PHP_ADD_EXTENSION_DEP(xml, libxml)
28-
])
29-
else
30-
PHP_SETUP_EXPAT([XML_SHARED_LIBADD])
31-
fi
16+
AS_VAR_IF([PHP_EXPAT], [no],
17+
[PHP_SETUP_LIBXML([XML_SHARED_LIBADD], [xml_extra_sources="compat.c"])],
18+
[PHP_SETUP_EXPAT([XML_SHARED_LIBADD])])
3219

3320
PHP_NEW_EXTENSION([xml],
3421
[xml.c $xml_extra_sources],
3522
[$ext_shared],,
3623
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
24+
25+
AS_VAR_IF([PHP_EXPAT], [no], [
26+
PHP_ADD_EXTENSION_DEP(xml, libxml)
27+
])
28+
3729
PHP_SUBST([XML_SHARED_LIBADD])
3830
PHP_INSTALL_HEADERS([ext/xml], [expat_compat.h php_xml.h])
3931
AC_DEFINE([HAVE_XML], [1], [Define to 1 if xml extension is available.])

0 commit comments

Comments
 (0)