@@ -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
1414if 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