xref: /PHP-7.3/ext/xml/config.m4 (revision 902d39a3)
1dnl config.m4 for extension xml
2
3PHP_ARG_ENABLE(xml,whether to enable XML support,
4[  --disable-xml           Disable XML support], yes)
5
6if test -z "$PHP_LIBXML_DIR"; then
7  PHP_ARG_WITH(libxml-dir, libxml2 install dir,
8  [  --with-libxml-dir=DIR   XML: libxml2 install prefix], no, no)
9fi
10
11PHP_ARG_WITH(libexpat-dir, libexpat install dir,
12[  --with-libexpat-dir=DIR XML: libexpat install prefix (deprecated)], no, no)
13
14if test "$PHP_XML" != "no"; then
15
16  dnl
17  dnl Default to libxml2 if --with-libexpat-dir is not used.
18  dnl
19  if test "$PHP_LIBEXPAT_DIR" = "no"; then
20
21    if test "$PHP_LIBXML" = "no"; then
22      AC_MSG_ERROR([XML extension requires LIBXML extension, add --enable-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      AC_MSG_ERROR([libxml2 not found. Use --with-libxml-dir=<DIR>])
30    ])
31  fi
32
33  dnl
34  dnl Check for expat only if --with-libexpat-dir is used.
35  dnl
36  if test "$PHP_LIBEXPAT_DIR" != "no"; then
37    for i in $PHP_XML $PHP_LIBEXPAT_DIR /usr /usr/local; do
38      if test -f "$i/$PHP_LIBDIR/libexpat.a" || test -f "$i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME"; then
39        EXPAT_DIR=$i
40        break
41      fi
42    done
43
44    if test -z "$EXPAT_DIR"; then
45      AC_MSG_ERROR([not found. Please reinstall the expat distribution.])
46    fi
47
48    PHP_ADD_INCLUDE($EXPAT_DIR/include)
49    PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/$PHP_LIBDIR, XML_SHARED_LIBADD)
50    AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
51  fi
52
53  PHP_NEW_EXTENSION(xml, xml.c $xml_extra_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
54  PHP_SUBST(XML_SHARED_LIBADD)
55  PHP_INSTALL_HEADERS([ext/xml/])
56  AC_DEFINE(HAVE_XML, 1, [ ])
57fi
58