Skip to content

Commit a8f4e8f

Browse files
hughmcmasternikic
authored andcommitted
ext/xml: Use PKG_CHECK_MODULES to detect the Expat library
1 parent 62ded6e commit a8f4e8f

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,8 @@ The following extensions and SAPIs are affected:
545545
- Libxml:
546546
. --with-libxml-dir has been removed.
547547
. --enable-libxml becomes --with-libxml.
548+
. --with-libexpat-dir has been renamed to --with-expat and no longer
549+
accepts a directory.
548550

549551
- LiteSpeed:
550552
. --with-litespeed becomes --enable-litespeed.

ext/xml/config.m4

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ PHP_ARG_ENABLE([xml],
44
[Disable XML support])],
55
[yes])
66

7-
PHP_ARG_WITH([libexpat-dir],
8-
[libexpat install dir],
9-
[AS_HELP_STRING([--with-libexpat-dir=DIR],
10-
[XML: libexpat install prefix (deprecated)])],
7+
PHP_ARG_WITH([expat],
8+
[whether to build with expat support],
9+
[AS_HELP_STRING([--with-expat],
10+
[XML: use expat instead of libxml2])],
1111
[no],
1212
[no])
1313

1414
if test "$PHP_XML" != "no"; then
1515

1616
dnl
17-
dnl Default to libxml2 if --with-libexpat-dir is not used.
17+
dnl Default to libxml2 if --with-expat is not specified.
1818
dnl
19-
if test "$PHP_LIBEXPAT_DIR" = "no"; then
19+
if test "$PHP_EXPAT" = "no"; then
2020

2121
if test "$PHP_LIBXML" = "no"; then
2222
AC_MSG_ERROR([XML extension requires LIBXML extension, add --with-libxml])
@@ -26,25 +26,12 @@ if test "$PHP_XML" != "no"; then
2626
xml_extra_sources="compat.c"
2727
PHP_ADD_EXTENSION_DEP(xml, libxml)
2828
])
29-
fi
29+
else
30+
PKG_CHECK_MODULES([EXPAT], [expat])
3031

31-
dnl
32-
dnl Check for expat only if --with-libexpat-dir is used.
33-
dnl
34-
if test "$PHP_LIBEXPAT_DIR" != "no"; then
35-
for i in $PHP_XML $PHP_LIBEXPAT_DIR /usr /usr/local; do
36-
if test -f "$i/$PHP_LIBDIR/libexpat.a" || test -f "$i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME"; then
37-
EXPAT_DIR=$i
38-
break
39-
fi
40-
done
41-
42-
if test -z "$EXPAT_DIR"; then
43-
AC_MSG_ERROR([not found. Please reinstall the expat distribution.])
44-
fi
32+
PHP_EVAL_INCLINE($EXPAT_CFLAGS)
33+
PHP_EVAL_LIBLINE($EXPAT_LIBS, XML_SHARED_LIBADD)
4534

46-
PHP_ADD_INCLUDE($EXPAT_DIR/include)
47-
PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/$PHP_LIBDIR, XML_SHARED_LIBADD)
4835
AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
4936
fi
5037

0 commit comments

Comments
 (0)