php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19124 config.m4 problems with ext/xmlrpc
Submitted: 2002-08-27 11:26 UTC Modified: 2002-08-29 23:06 UTC
From: list at firehawksystems dot com Assigned: sniper (profile)
Status: Closed Package: XMLRPC-EPI related
PHP Version: 4.2.2 OS: FreeBSD 4.3, but any Unix
Private report: No CVE-ID: None
 [2002-08-27 11:26 UTC] list at firehawksystems dot com
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?

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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-28 12:23 UTC] kalowsky@php.net
Can you please make your patch a unified diff (diff -u) which makes it easier for us to test against.

Your HAVE_CONFIG change seems to disregard the initial intention which was to provide functionality for Win32 users.  You might want to make that happen as well. 
 [2002-08-28 12:28 UTC] sniper@php.net
I'm looking into this..the provided patch is not the way to do it.

 [2002-08-28 12:57 UTC] list at firehawksystems dot com
Let me know if I can help test.  

The thing for me is build option 3.  I did test 1 and 3, but I couldn't completely test 2 and 4 as I couldn't get xmlrpc to compile with the freebsd ports package of xmlrpc-c.  It did configure it correctly, just code problems with the freebsd ports verion.

The reason for the HAVE_CONFIG change was when building shared it would not pull in the COMPILE_DL_XMLRPC from the local copy of the config.h.  This made it a invalid extension because ZEND_GET_MODULE(xmlrpc) was not compiled in.  Sorry, I didn't think about how the WIN32 would do it and may need changed to handle that platform.

Thanks for you help!

Brian
 [2002-08-29 23:06 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.



 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC