- Made it possible to build ext/xmlrpc with libxml2

This commit is contained in:
foobar 2005-03-26 03:13:58 +00:00
parent 24eb2bfabc
commit a8b29a2e8f
6 changed files with 62 additions and 23 deletions

View file

@ -17,7 +17,7 @@
*/ */
#include "php.h" #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" #include "expat_compat.h"
typedef struct _php_xml_ns { typedef struct _php_xml_ns {

View file

@ -21,9 +21,18 @@
#ifndef PHP_EXPAT_COMPAT_H #ifndef PHP_EXPAT_COMPAT_H
#define 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) #if !defined(HAVE_LIBEXPAT) && defined(HAVE_LIBXML)
#define LIBXML_EXPAT_COMPAT 1 #define LIBXML_EXPAT_COMPAT 1
#include "php.h"
#include "php_compat.h" #include "php_compat.h"
#include <libxml/parser.h> #include <libxml/parser.h>

View file

@ -10,30 +10,52 @@ sinclude(libxmlrpc/xmlrpc.m4)
PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support, PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support,
[ --with-xmlrpc[=DIR] Include 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, 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, PHP_ARG_WITH(iconv-dir, iconv dir for XMLRPC-EPI,
[ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI.],no,no) [ --with-iconv-dir=DIR XMLRPC-EPI: iconv dir for XMLRPC-EPI.],no,no)
if test "$PHP_XMLRPC" != "no"; then if test "$PHP_XMLRPC" != "no"; then
PHP_ADD_EXTENSION_DEP(xmlrpc, libxml)
PHP_SUBST(XMLRPC_SHARED_LIBADD) PHP_SUBST(XMLRPC_SHARED_LIBADD)
AC_DEFINE(HAVE_XMLRPC,1,[ ]) AC_DEFINE(HAVE_XMLRPC,1,[ ])
testval=no dnl
for i in $PHP_EXPAT_DIR $XMLRPC_DIR /usr/local /usr; do dnl Default to libxml2.
if test -f $i/$PHP_LIBDIR/libexpat.a -o -f $i/$PHP_LIBDIR/libexpat.$SHLIB_SUFFIX_NAME; then dnl
AC_DEFINE(HAVE_LIBEXPAT2,1,[ ]) PHP_SETUP_LIBXML(XMLRPC_SHARED_LIBADD, [
PHP_ADD_LIBRARY_WITH_PATH(expat, $i/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD) if test "$PHP_XML" = "no"; then
PHP_ADD_INCLUDE($i/include) PHP_ADD_SOURCES(ext/xml, compat.c)
testval=yes PHP_ADD_BUILD_DIR(ext/xml)
break
fi fi
done ], [
if test "$PHP_EXPAT_DIR" = "no"; then
AC_MSG_ERROR([xml2-config not found. Use --with-libxml-dir=<DIR>])
fi
])
if test "$testval" = "no"; then if test "$PHP_EXPAT_DIR" != "no"; then
AC_MSG_ERROR(XML-RPC support requires libexpat. Use --with-expat-dir=<DIR>) 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 fi
if test "$PHP_ICONV_DIR" != "no"; then if test "$PHP_ICONV_DIR" != "no"; then
@ -49,7 +71,6 @@ if test "$PHP_XMLRPC" != "no"; then
]) ])
fi fi
if test "$PHP_XMLRPC" = "yes"; then if test "$PHP_XMLRPC" = "yes"; then
XMLRPC_CHECKS XMLRPC_CHECKS
PHP_NEW_EXTENSION(xmlrpc,xmlrpc-epi-php.c libxmlrpc/base64.c \ 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_INCLUDE($XMLRPC_DIR)
PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/$PHP_LIBDIR, XMLRPC_SHARED_LIBADD) 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 fi

View file

@ -44,6 +44,11 @@ static const char rcsid[] = "#(@) $Id$";
* 06/2000 * 06/2000
* HISTORY * HISTORY
* $Log$ * $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 * Revision 1.5 2003/12/16 21:00:21 sniper
* Fix some compile warnings (patch by Joe Orton) * Fix some compile warnings (patch by Joe Orton)
* *
@ -105,7 +110,7 @@ static const char rcsid[] = "#(@) $Id$";
#include "xml_element.h" #include "xml_element.h"
#include "queue.h" #include "queue.h"
#include "expat.h" #include "ext/xml/expat_compat.h"
#include "encodings.h" #include "encodings.h"
#define my_free(thing) if(thing) {free(thing); thing = 0;} #define my_free(thing) if(thing) {free(thing); thing = 0;}
@ -567,7 +572,7 @@ typedef struct _xml_elem_data {
/* expat start of element handler */ /* 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_element *c;
xml_elem_data* mydata = (xml_elem_data*)userData; 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 */ /* 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; xml_elem_data* mydata = (xml_elem_data*)userData;
@ -607,7 +612,7 @@ static void endElement(void *userData, const char *name)
} }
/* expat char data handler */ /* expat char data handler */
static void charHandler(void *userData, static void _xmlrpc_charHandler(void *userData,
const char *s, const char *s,
int len) 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.input_options = options;
mydata.needs_enc_conversion = options->encoding && strcmp(options->encoding, encoding_utf_8); mydata.needs_enc_conversion = options->encoding && strcmp(options->encoding, encoding_utf_8);
XML_SetElementHandler(parser, startElement, endElement); XML_SetElementHandler(parser, _xmlrpc_startElement, _xmlrpc_endElement);
XML_SetCharacterDataHandler(parser, charHandler); XML_SetCharacterDataHandler(parser, _xmlrpc_charHandler);
/* pass the xml_elem_data struct along */ /* pass the xml_elem_data struct along */
XML_SetUserData(parser, (void*)&mydata); XML_SetUserData(parser, (void*)&mydata);

View file

@ -43,6 +43,9 @@ static const char rcsid[] = "#(@) $Id$";
* 9/1999 - 10/2000 * 9/1999 - 10/2000
* HISTORY * HISTORY
* $Log$ * $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 * Revision 1.5 2003/12/16 21:00:21 sniper
* Fix some compile warnings (patch by Joe Orton) * Fix some compile warnings (patch by Joe Orton)
* *
@ -129,7 +132,7 @@ static const char rcsid[] = "#(@) $Id$";
#include "queue.h" #include "queue.h"
#include "xmlrpc.h" #include "xmlrpc.h"
#include "expat.h" #include "ext/xml/expat_compat.h"
#include "base64.h" #include "base64.h"
#include "xml_to_xmlrpc.h" #include "xml_to_xmlrpc.h"

View file

@ -46,7 +46,7 @@
#define hashTableIterInit php_hashTableIterInit #define hashTableIterInit php_hashTableIterInit
#define hashTableIterNext php_hashTableIterNext #define hashTableIterNext php_hashTableIterNext
#if defined(HAVE_LIBXML) && defined(HAVE_XML) && !defined(HAVE_LIBEXPAT) #if defined(HAVE_LIBXML) && (defined(HAVE_XML) || defined(HAVE_XMLRPC)) && !defined(HAVE_LIBEXPAT)
#define XML_DefaultCurrent php_XML_DefaultCurrent #define XML_DefaultCurrent php_XML_DefaultCurrent
#define XML_ErrorString php_XML_ErrorString #define XML_ErrorString php_XML_ErrorString
#define XML_ExpatVersion php_XML_ExpatVersion #define XML_ExpatVersion php_XML_ExpatVersion