I tried to build xmlrpc as a shared extension (phpize, ./configure, 
make), but when it builds it didn't have dependences for libexpat and 
libiconv, but the expat, libiconv and XMLRPC_ functions are undefined.

While trying to fix this I rewrote the config.m4 to handle all the 
following build cases:

1)  built-in to PHP with libxmlrpc included from extension directory
     --with-xmlrpc

2)  built-in to PHP with shared libxmlrpc
     --with-xmlrpc --with-libxmlrpc=/usr/local

3)  built shared with libxmlrpc included from extension directory
     --with-xmlrpc=shared

4)  built shared with shared libxmlrpc
     --with-xmlrpc=shared --with-libxmlrpc=/usr/local


There is one part I don't like and that is the new option of 
--with-libxmlrpc is only used in a state where it is not equal to 
'yes' or 'no'.  It would have a directory value, but I don't like how 
it I did it.

Is this the best way to handle it?  Comments? Should I open a bug and 
submit this?

For the new config.m4 to work, xmlrpc-epi-php.c needs this changed:

#ifndef PHP_WIN32
#include "php_config.h"
#endif

to:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

Also what does PHP_FAST_OUTPUT do?

Thanks,

Brian

------

sinclude(ext/xmlrpc/libxmlrpc/acinclude.m4)
sinclude(ext/xmlrpc/libxmlrpc/xmlrpc.m4)
sinclude(libxmlrpc/acinclude.m4)
sinclude(libxmlrpc/xmlrpc.m4)

PHP_ARG_WITH(xmlrpc, for XMLRPC-EPI support,
[  --with-xmlrpc     Include XMLRPC-EPI support.])

PHP_ARG_WITH(libxmlrpc, Use shared libxmlrpc for XMLRPC-EPI,
[  --with-libxmlrpc[=DIR]   Will build and include the local copy of 
XMLRPC-EPI,
                             unless the DIR is set. ])

PHP_ARG_WITH(expat-dir, libexpat dir for XMLRPC-EPI,
[  --with-expat-dir=DIR      XMLRPC-EPI: libexpat dir for XMLRPC-EPI.])


if test "$PHP_XMLRPC" != "no"; then

     PHP_EXTENSION(xmlrpc, $ext_shared)
     PHP_SUBST(XMLRPC_SHARED_LIBADD)

     if test "$PHP_LIBXMLRPC" = "no" || test "$PHP_LIBXMLRPC" = "yes"; then
         XMLRPC_CHECKS
         XMLRPC_SHARED_LIBADD=libxmlrpc/libxmlrpc.la
         XMLRPC_LIBADD=libxmlrpc/libxmlrpc.la
         XMLRPC_SUBDIRS=libxmlrpc
         PHP_SUBST(XMLRPC_LIBADD)
         PHP_SUBST(XMLRPC_SUBDIRS)
         AC_DEFINE(HAVE_BUNDLED_XMLRPC, 1, [ ])
         dnl  PHP_FAST_OUTPUT($ext_builddir/libxmlrpc/Makefile)
         LIB_BUILD($ext_builddir/libxmlrpc,$ext_shared,yes)

         PHP_ADD_INCLUDE($ext_srcdir/libxmlrpc)
     else
         if test -r $PHP_XMLRPC/include/xmlrpc.h; then
           XMLRPC_DIR=$PHP_XMLRPC
         else
           AC_MSG_CHECKING([for XMLRPC-EPI in default path])
           for i in /usr/local /usr; do
             if test -r $i/include/xmlrpc.h; then
               XMLRPC_DIR=$i
               AC_MSG_RESULT(found in $i)
             fi
           done
         fi

         if test -z "$XMLRPC_DIR"; then
           AC_MSG_ERROR([XMLRPC-EPI not found, please reinstall the 
XMLRPC-EPI distribution])
         fi

         PHP_ADD_INCLUDE($XMLRPC_DIR/include)
         PHP_ADD_LIBRARY_WITH_PATH(xmlrpc, $XMLRPC_DIR/lib, 
XMLRPC_SHARED_LIBADD)
     fi

     PHP_SUBST(EXPAT_SHARED_LIBADD)
     AC_DEFINE(HAVE_LIBEXPAT,  1, [ ])

     for i in $PHP_XML $PHP_EXPAT_DIR; do
       if test -f $i/lib/libexpat.a -o -f 
$i/lib/libexpat.$SHLIB_SUFFIX_NAME ; then
         EXPAT_DIR=$i
       fi
     done

     if test -z "$EXPAT_DIR"; then
       AC_MSG_ERROR(not found. Please reinstall the expat distribution.)
     fi

     PHP_ADD_INCLUDE($EXPAT_DIR/include)
     PHP_ADD_LIBRARY_WITH_PATH(expat, $EXPAT_DIR/lib, XMLRPC_SHARED_LIBADD)

     if test "$PHP_ICONV" = "no"; then
       PHP_ICONV=yes
     fi

     PHP_SETUP_ICONV(XMLRPC_SHARED_LIBADD, [], [
       AC_MSG_ERROR([iconv not found, in order to build xmlrpc you 
need the iconv library])
     ])

     AC_DEFINE(HAVE_XMLRPC, 1, [ ])
fi

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to