xref: /PHP-7.2/ext/xmlrpc/config.m4 (revision 502b187a)
1dnl
2dnl $Id$
3dnl
4
5sinclude(ext/xmlrpc/libxmlrpc/acinclude.m4)
6sinclude(ext/xmlrpc/libxmlrpc/xmlrpc.m4)
7sinclude(libxmlrpc/acinclude.m4)
8sinclude(libxmlrpc/xmlrpc.m4)
9
10PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support,
11[  --with-xmlrpc[=DIR]       Include XMLRPC-EPI support])
12
13if test -z "$PHP_LIBXML_DIR"; then
14  PHP_ARG_WITH(libxml-dir, libxml2 install dir,
15  [  --with-libxml-dir=DIR   XMLRPC-EPI: libxml2 install prefix], no, no)
16fi
17
18PHP_ARG_WITH(libexpat-dir, libexpat dir for XMLRPC-EPI,
19[  --with-libexpat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI (deprecated)],no,no)
20
21PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI,
22[  --with-iconv-dir=DIR    XMLRPC-EPI: iconv dir for XMLRPC-EPI],no,no)
23
24if test "$PHP_XMLRPC" != "no"; then
25
26  PHP_ADD_EXTENSION_DEP(xmlrpc, libxml)
27  PHP_SUBST(XMLRPC_SHARED_LIBADD)
28  AC_DEFINE(HAVE_XMLRPC,1,[ ])
29
30  dnl
31  dnl Default to libxml2 if --with-libexpat-dir is not used
32  dnl
33  if test "$PHP_LIBEXPAT_DIR" = "no"; then
34
35    if test "$PHP_LIBXML" = "no"; then
36      AC_MSG_ERROR([XML-RPC extension requires LIBXML extension, add --enable-libxml])
37    fi
38
39    PHP_SETUP_LIBXML(XMLRPC_SHARED_LIBADD, [
40      if test "$PHP_XML" = "no"; then
41        PHP_ADD_SOURCES(ext/xml, compat.c)
42        PHP_ADD_BUILD_DIR(ext/xml)
43      fi
44    ], [
45      AC_MSG_ERROR([libxml2 not found. Use --with-libxml-dir=<DIR>])
46    ])
47  else
48    testval=no
49    for i in $PHP_LIBEXPAT_DIR $XMLRPC_DIR /usr/local /usr; do
50      if test -f $i/$PHP_LIBDIR/libexpat.a || test -f $i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME; then
51        AC_DEFINE(HAVE_LIBEXPAT,1,[ ])
52        PHP_ADD_LIBRARY_WITH_PATH(expat, $i/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
53        PHP_ADD_INCLUDE($i/include)
54        testval=yes
55        break
56      fi
57    done
58
59    if test "$testval" = "no"; then
60      AC_MSG_ERROR([XML-RPC support requires libexpat. Use --with-libexpat-dir=<DIR> (deprecated!)])
61    fi
62  fi
63
64  dnl if iconv is shared or missing then we should build iconv ourselves
65  if test "$PHP_ICONV_SHARED" = "yes" || test "$PHP_ICONV" = "no"; then
66
67    if test "$PHP_ICONV_DIR" != "no"; then
68      PHP_ICONV=$PHP_ICONV_DIR
69    fi
70
71    if test -z "$PHP_ICONV" || test "$PHP_ICONV" = "no"; then
72      PHP_ICONV=yes
73    fi
74
75    PHP_SETUP_ICONV(XMLRPC_SHARED_LIBADD, [], [
76      AC_MSG_ERROR([iconv not found, in order to build xmlrpc you need the iconv library])
77    ])
78  fi
79fi
80
81if test "$PHP_XMLRPC" = "yes"; then
82  XMLRPC_CHECKS
83  PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c libxmlrpc/base64.c \
84          libxmlrpc/simplestring.c libxmlrpc/xml_to_dandarpc.c \
85          libxmlrpc/xmlrpc_introspection.c libxmlrpc/encodings.c \
86          libxmlrpc/system_methods.c libxmlrpc/xml_to_xmlrpc.c \
87          libxmlrpc/queue.c libxmlrpc/xml_element.c libxmlrpc/xmlrpc.c \
88          libxmlrpc/xml_to_soap.c,$ext_shared,,
89          -I@ext_srcdir@/libxmlrpc -DVERSION="0.50")
90  PHP_ADD_BUILD_DIR($ext_builddir/libxmlrpc)
91  XMLRPC_MODULE_TYPE=builtin
92  AC_DEFINE(HAVE_XMLRPC_BUNDLED, 1, [ ])
93
94elif test "$PHP_XMLRPC" != "no"; then
95
96  if test -r $PHP_XMLRPC/include/xmlrpc.h; then
97    XMLRPC_DIR=$PHP_XMLRPC/include
98  elif test -r $PHP_XMLRPC/include/xmlrpc-epi/xmlrpc.h; then
99dnl some xmlrpc-epi header files have generic file names like
100dnl queue.h or base64.h. Distributions have to create dir
101dnl for xmlrpc-epi because of this.
102    XMLRPC_DIR=$PHP_XMLRPC/include/xmlrpc-epi
103  else
104    AC_MSG_CHECKING(for XMLRPC-EPI in default path)
105    for i in /usr/local /usr; do
106      if test -r $i/include/xmlrpc.h; then
107        XMLRPC_DIR=$i/include
108        AC_MSG_RESULT(found in $i)
109        break
110      fi
111    done
112  fi
113
114  if test -z "$XMLRPC_DIR"; then
115    AC_MSG_RESULT(not found)
116    AC_MSG_ERROR(Please reinstall the XMLRPC-EPI distribution)
117  fi
118
119  PHP_ADD_INCLUDE($XMLRPC_DIR)
120  PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
121  PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c, $ext_shared)
122  XMLRPC_MODULE_TYPE=external
123fi
124