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