PHP_NEW_EXTENSION()什么都不做

I'd like to ask if my guess is correct:

I'm writing an extension (using C++ as the programming language) and when it comes to actually makeeing the configured sources and macros my Makefile contains following settings.

PHP_PECL_EXTENSION = extensionname
EXTENSIONNAME_SHARED_LIBADD =
PHP_MODULES =
PHP_ZEND_EX =

How does it come if I do manually add my

 PHP_NEW_EXTENSION(extensionname, <listofsourcecodefilenames>...)

Maybe I have to provide some additional information? I did try to build some stock extensions that come with PHP source, and everything went fine.


Here's my config.m4

PHP_ARG_WITH(extensionname, enable extensionname,
    [  --with-extensionname        enable extensionname)], no, no)

if test "$PHP_EXTENSIONNAME" != "no"; then
PHP_REQUIRE_CXX()
PHP_EXTENSIONNAME_CFLAGS=""

if test $PHP_EXTENSIONNAME != "yes"; then
    AC_MSG_CHECKING([for required lib in default path])
    for i in $PHP_EXTENSIONNAME /usr/local/ /usr /opt/vendor/liblocation; do
        if test -r $i/include/sqlncli.h; then
            $REQUIREDLIB_DIR=$i
            AC_MSG_RESULT(found in $i)
            break
        fi
    done

    if test -z "$REQUIREDLIB_DIR"; then
        AC_MSG_RESULT([not found])
        AC_MSG_ERROR([please obtain the original required lib for Linux])
    fi

    PHP_CHECK_LIBRARY(requiredlib, RQLCriticalFunction, [
        AC_MSG_RESULT(found)
        PHP_ADD_LIBRARY_WITH_PATH(requiredlib, $REQUIREDLIB_DIR/../lib64, EXTENSIONNAME_SHARED_LIBADD)
        PHP_ADD_INCLUDE($REQUiREDLIB_DIR/include)
    ], [
        AC_MSG_RESULT([not found])
        AC_MSG_ERROR([please install blah-blah])
    ], [
        -L$REQUIREDLIB_DIR/../lib64 -lm
    ])
fi

AC_DEFINE(HAVE_EXTENSIONNAME, 1, [Whether you have extensionname])

PHP_ADD_LIBRARY(stdc++, 1, EXTENSIONNAME_SHARED_LIBADD)

PHP_ADD_INCLUDE('sql.h')
PHP_ADD_INCLUDE('sqlext.h')

PHP_NEW_EXTENSION(extensionname, source1.cpp source2.cpp source3.cpp, $ext_shared)
PHP_SUBST(EXTENSIONNAME_SHARED_LIBADD)
fi

I'd been looking at http://www.opensource.apple.com/source/apache_mod_php/apache_mod_php-18.9/php/README.UNIX-BUILD-SYSTEM just a minute ago for a similar issue and noticed that you seem to be missing the $ext_shared at the end:

PHP_NEW_EXTENSION(foo, foo.c bar.c baz.cpp, $ext_shared)