summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2005-03-26 03:13:58 (GMT)
committerfoobar <sniper@php.net>2005-03-26 03:13:58 (GMT)
commita8b29a2e8f7bfb69b02af777cfcddbc98b24196c (patch)
tree5ae5cc73d621db1e79cec524a7594d9af96a8335 /ext
parent24eb2bfabc0b2ffa6a47a32250d869a6c62271c4 (diff)
downloadphp-a8b29a2e8f7bfb69b02af777cfcddbc98b24196c.tar.gz
- Made it possible to build ext/xmlrpc with libxml2
Diffstat (limited to 'ext')
-rw-r--r--ext/xml/compat.c2
-rw-r--r--ext/xml/expat_compat.h9
-rw-r--r--ext/xmlrpc/config.m450
-rw-r--r--ext/xmlrpc/libxmlrpc/xml_element.c17
-rw-r--r--ext/xmlrpc/libxmlrpc/xmlrpc.c5
5 files changed, 61 insertions, 22 deletions
diff --git a/ext/xml/compat.c b/ext/xml/compat.c
index cac1650..610363a 100644
--- a/ext/xml/compat.c
+++ b/ext/xml/compat.c
@@ -17,7 +17,7 @@
*/
#include "php.h"
-#if defined(HAVE_LIBXML) && defined(HAVE_XML) && !defined(HAVE_LIBEXPAT)
+#if defined(HAVE_LIBXML) && (defined(HAVE_XML) || defined(HAVE_XMLRPC)) && !defined(HAVE_LIBEXPAT)
#include "expat_compat.h"
typedef struct _php_xml_ns {
diff --git a/ext/xml/expat_compat.h b/ext/xml/expat_compat.h
index a13c900..5c979c7 100644
--- a/ext/xml/expat_compat.h
+++ b/ext/xml/expat_compat.h
@@ -21,9 +21,18 @@
#ifndef PHP_EXPAT_COMPAT_H
#define PHP_EXPAT_COMPAT_H
+#ifdef PHP_WIN32
+#include "config.w32.h"
+#elif defined(NETWARE)
+#include "config.nw.h"
+#else
+#include <php_config.h>
+#endif
+
#if !defined(HAVE_LIBEXPAT) && defined(HAVE_LIBXML)
#define LIBXML_EXPAT_COMPAT 1
+#include "php.h"
#include "php_compat.h"
#include <libxml/parser.h>
diff --git a/ext/xmlrpc/config.m4 b/ext/xmlrpc/config.m4
index 54335df..4da58ff 100644
--- a/ext/xmlrpc/config.m4
+++ b/ext/xmlrpc/config.m4
@@ -10,30 +10,52 @@ sinclude(libxmlrpc/xmlrpc.m4)
PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support,
[ --with-xmlrpc[=DIR] Include XMLRPC-EPI support.])
+if test -z "$PHP_LIBXML_DIR"; then
+ PHP_ARG_WITH(libxml-dir, libxml2 install dir,
+ [ --with-libxml-dir=DIR XMLRPC-EPI: libxml2 install prefix], no, no)
+fi
+
PHP_ARG_WITH(expat-dir, libexpat dir for XMLRPC-EPI,
-[ --with-expat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI.],no,no)
+[ --with-expat-dir=DIR XMLRPC-EPI: libexpat dir for XMLRPC-EPI. (deprecated)],no,no)
PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI,
[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI.],no,no)
if test "$PHP_XMLRPC" != "no"; then
+ PHP_ADD_EXTENSION_DEP(xmlrpc, libxml)
PHP_SUBST(XMLRPC_SHARED_LIBADD)
AC_DEFINE(HAVE_XMLRPC,1,[ ])
- testval=no
- for i in $PHP_EXPAT_DIR $XMLRPC_DIR /usr/local /usr; do
- if test -f $i/$PHP_LIBDIR/libexpat.a -o -f $i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME; then
- AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
- PHP_ADD_LIBRARY_WITH_PATH(expat, $i/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
- PHP_ADD_INCLUDE($i/include)
- testval=yes
- break
+ dnl
+ dnl Default to libxml2.
+ dnl
+ PHP_SETUP_LIBXML(XMLRPC_SHARED_LIBADD, [
+ if test "$PHP_XML" = "no"; then
+ PHP_ADD_SOURCES(ext/xml, compat.c)
+ PHP_ADD_BUILD_DIR(ext/xml)
+ fi
+ ], [
+ if test "$PHP_EXPAT_DIR" = "no"; then
+ AC_MSG_ERROR([xml2-config not found. Use --with-libxml-dir=<DIR>])
fi
- done
+ ])
- if test "$testval" = "no"; then
- AC_MSG_ERROR(XML-RPC support requires libexpat. Use --with-expat-dir=<DIR>)
+ if test "$PHP_EXPAT_DIR" != "no"; then
+ testval=no
+ for i in $PHP_EXPAT_DIR $XMLRPC_DIR /usr/local /usr; do
+ if test -f $i/$PHP_LIBDIR/libexpat.a -o -f $i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME; then
+ AC_DEFINE(HAVE_LIBEXPAT,1,[ ])
+ PHP_ADD_LIBRARY_WITH_PATH(expat, $i/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
+ PHP_ADD_INCLUDE($i/include)
+ testval=yes
+ break
+ fi
+ done
+
+ if test "$testval" = "no"; then
+ AC_MSG_ERROR(XML-RPC support requires libexpat. Use --with-expat-dir=<DIR>)
+ fi
fi
if test "$PHP_ICONV_DIR" != "no"; then
@@ -49,7 +71,6 @@ if test "$PHP_XMLRPC" != "no"; then
])
fi
-
if test "$PHP_XMLRPC" = "yes"; then
XMLRPC_CHECKS
PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c libxmlrpc/base64.c \
@@ -89,5 +110,6 @@ dnl for xmlrpc-epi because of this.
PHP_ADD_INCLUDE($XMLRPC_DIR)
PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD)
+ PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c, $ext_shared)
+ XMLRPC_MODULE_TYPE=external
fi
-
diff --git a/ext/xmlrpc/libxmlrpc/xml_element.c b/ext/xmlrpc/libxmlrpc/xml_element.c
index 5fee239..e9f6a4b 100644
--- a/ext/xmlrpc/libxmlrpc/xml_element.c
+++ b/ext/xmlrpc/libxmlrpc/xml_element.c
@@ -44,6 +44,11 @@ static const char rcsid[] = "#(@) $Id$";
* 06/2000
* HISTORY
* $Log$
+ * Revision 1.6 2004/06/01 20:16:06 iliaa
+ * Fixed bug #28597 (xmlrpc_encode_request() incorrectly encodes chars in
+ * 200-210 range).
+ * Patch by: fernando dot nemec at folha dot com dot br
+ *
* Revision 1.5 2003/12/16 21:00:21 sniper
* Fix some compile warnings (patch by Joe Orton)
*
@@ -105,7 +110,7 @@ static const char rcsid[] = "#(@) $Id$";
#include "xml_element.h"
#include "queue.h"
-#include "expat.h"
+#include "ext/xml/expat_compat.h"
#include "encodings.h"
#define my_free(thing) if(thing) {free(thing); thing = 0;}
@@ -567,7 +572,7 @@ typedef struct _xml_elem_data {
/* expat start of element handler */
-static void startElement(void *userData, const char *name, const char **attrs)
+static void _xmlrpc_startElement(void *userData, const char *name, const char **attrs)
{
xml_element *c;
xml_elem_data* mydata = (xml_elem_data*)userData;
@@ -595,7 +600,7 @@ static void startElement(void *userData, const char *name, const char **attrs)
}
/* expat end of element handler */
-static void endElement(void *userData, const char *name)
+static void _xmlrpc_endElement(void *userData, const char *name)
{
xml_elem_data* mydata = (xml_elem_data*)userData;
@@ -607,7 +612,7 @@ static void endElement(void *userData, const char *name)
}
/* expat char data handler */
-static void charHandler(void *userData,
+static void _xmlrpc_charHandler(void *userData,
const char *s,
int len)
{
@@ -680,8 +685,8 @@ xml_element* xml_elem_parse_buf(const char* in_buf, int len, XML_ELEM_INPUT_OPTI
mydata.input_options = options;
mydata.needs_enc_conversion = options->encoding && strcmp(options->encoding, encoding_utf_8);
- XML_SetElementHandler(parser, startElement, endElement);
- XML_SetCharacterDataHandler(parser, charHandler);
+ XML_SetElementHandler(parser, _xmlrpc_startElement, _xmlrpc_endElement);
+ XML_SetCharacterDataHandler(parser, _xmlrpc_charHandler);
/* pass the xml_elem_data struct along */
XML_SetUserData(parser, (void*)&mydata);
diff --git a/ext/xmlrpc/libxmlrpc/xmlrpc.c b/ext/xmlrpc/libxmlrpc/xmlrpc.c
index 1fbb4a7..90a8b92 100644
--- a/ext/xmlrpc/libxmlrpc/xmlrpc.c
+++ b/ext/xmlrpc/libxmlrpc/xmlrpc.c
@@ -43,6 +43,9 @@ static const char rcsid[] = "#(@) $Id$";
* 9/1999 - 10/2000
* HISTORY
* $Log$
+ * Revision 1.6 2004/04/27 17:33:59 iliaa
+ * Removed C++ style comments.
+ *
* Revision 1.5 2003/12/16 21:00:21 sniper
* Fix some compile warnings (patch by Joe Orton)
*
@@ -129,7 +132,7 @@ static const char rcsid[] = "#(@) $Id$";
#include "queue.h"
#include "xmlrpc.h"
-#include "expat.h"
+#include "ext/xml/expat_compat.h"
#include "base64.h"
#include "xml_to_xmlrpc.h"