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