什么宏可用于php config.m4文件?

时间:2015-07-13 18:08:06

标签: php php-extension

编写PHP扩展时,this documentation page表示应提供config.m4文件供autoconf使用。它提供了几个这样的文件示例,但文档不完整。例如,示例文件使用宏PHP_EVAL_INCLINE,但后面的文档中没有提到它。

那么,config.m4文件中可以使用哪些特定于PHP的宏,它们做了什么?是否有任何关于编写这些文件的综合文档?

2 个答案:

答案 0 :(得分:8)

我无法在互联网上找到任何此类列表 但是,我们可以解析acinclude.m4,其中定义了所有这些宏 acinclude.m4可以在任何PHP源代码tarball的根目录中找到,也可以在任何PHP安装的lib/php/build中找到。

使用AC_DEFUN([name], [replacement])宏声明宏 它通常以一个或多个注释行开头,以dnl开头,作为基本文档。

我编写了以下脚本来将每个函数声明解析为名称,用法和描述:

$funcs = [];
$matches = [];
// Scan for "AC_DEFUN([FUNCTION_NAME_HERE]..." because those are function declarations,
// and all preceding lines starting with "dbl" because those are comments, probably including documentation
preg_match_all('#((?:dnl(?: .*)?\\n)*)AC_DEFUN\\(\\[(\\w+)\\]#', file_get_contents('acinclude.m4'), $matches);
// $matches[1][$i] contains all lines starting with "dbl"
// $matches[2][$i] contains the function name
for($i = 0; $i < count($matches[1]); $i++)
{
    $name = $matches[2][$i];
    $func =
    [
        'usage' => '',
        'description' => ''
    ];
    $beginning = TRUE;
    // Process each comment line
    // Since comments can, but don't have to include usage information, we try to filter it out.
    foreach(explode("\n", $matches[1][$i]) as $line)
    {
        // Discard empty lines
        if($line == 'dnl')
        {
            // Except if they're inside the description part - blocks shall stay separated.
            if(!$beginning)
            {
                $func['description'] .= "\n\n";
            }
            continue;
        }
        $m = [];
        // If no line had content yet, and the current line starts with the function name, that's the usage information!
        if($beginning && preg_match('#dnl ('.$name.'(?:.*)?)#', $line, $m) === 1)
        {
            $func['usage'] = $m[1];
        }
        // Everything else is just description.
        else
        {
            $func['description'] .= substr($line, 3);
        }
        $beginning = FALSE;
    }
    // Remove unnecessary whitespace, and make sure there's no sneaky HTML in the description.
    $func['description'] = htmlspecialchars(trim($func['description']));
    $funcs[$name] = $func;
}
// Sort by function name
ksort($funcs);

acinclude.m4所在的文件夹中运行此代码将使用已排序的数组填充$funcs,其中函数名称为键,其用法和描述为值。

可以使用几行代码将其解析为HTML表格,例如

$html = '';
foreach($funcs as $name => $func)
{
    $html .= '<tr><td>'.$name.'</td><td>'.$func['usage'].'</td><td>'.$func['description'].'</td></tr>';
}
file_put_contents('acinclude.html', '<table>'.$html.'</table>');

为它应用一些不错的CSS并添加一个标题行,并且您有一个可读宏的可读列表。

虽然有些宏记录得很好,但有些不完整,或完全缺乏文档,但我仍然认为它比没有好。

应用于PHP 5.6.11的acinclude.m4,这会产生(最佳浏览全屏):

&#13;
&#13;
table
{
    border-collapse: collapse;
}
tr
{
    background: #F8F8F8;
}
tr:nth-child(even)
{
    background: #F0F0F0;
}
th
{
  background: #E0E0E0;
}
td, th
{
    padding: 10px;
    border: solid 1px #BBB;
}
td:last-child
{
    white-space: pre-line;
}
&#13;
<table><tr><th>Name</th><th>Usage</th><th>Description</th></tr>
<tr><td>PHP_AC_BROKEN_SNPRINTF</td><td>PHP_AC_BROKEN_SNPRINTF</td><td>Check for broken snprintf(), C99 conformance</td></tr><tr><td>PHP_AC_BROKEN_SPRINTF</td><td>PHP_AC_BROKEN_SPRINTF</td><td>Check for broken sprintf(), C99 conformance</td></tr><tr><td>PHP_ADD_BUILD_DIR</td><td></td><td></td></tr><tr><td>PHP_ADD_EXTENSION_DEP</td><td>PHP_ADD_EXTENSION_DEP(extname, depends [, depconf])</td><td>This macro is scanned by genif.sh when it builds the internal functions list, so that modules can be init'd in the correct order $1 = name of extension, $2 = extension upon which it depends $3 = optional: if true, it's ok for $2 to have not been configured default is false and should halt the build. To be effective, this macro must be invoked *after* PHP_NEW_EXTENSION. The extension on which it depends must also have been configured. See ADD_EXTENSION_DEP in win32 build</td></tr><tr><td>PHP_ADD_FRAMEWORK</td><td>PHP_ADD_FRAMEWORK(framework [,before])</td><td>add a (Darwin / Mac OS X) framework to the link line. if before is 1, the framework is added to the beginning of the line.</td></tr><tr><td>PHP_ADD_FRAMEWORKPATH</td><td>PHP_ADD_FRAMEWORKPATH(path [,before])</td><td>add a (Darwin / Mac OS X) framework path to the link and include lines. default paths include (but are not limited to) /Local/Library/Frameworks and /System/Library/Frameworks, so these don't need to be specifically added. if before is 1, the framework path is added to the beginning of the relevant lines.</td></tr><tr><td>PHP_ADD_FRAMEWORK_WITH_PATH</td><td>PHP_ADD_FRAMEWORK_WITH_PATH(framework, path)</td><td>Adds a (Darwin / Mac OS X) framework path and the framework itself to the link and include lines.</td></tr><tr><td>PHP_ADD_INCLUDE</td><td>PHP_ADD_INCLUDE(path [,before])</td><td>add an include path.  if before is 1, add in the beginning of INCLUDES.</td></tr><tr><td>PHP_ADD_LIBPATH</td><td>PHP_ADD_LIBPATH(path [, SHARED-LIBADD])</td><td>Adds a path to linkpath/runpath (LDFLAGS)</td></tr><tr><td>PHP_ADD_LIBRARY</td><td>PHP_ADD_LIBRARY(library[, append[, shared-libadd]])</td><td>add a library to the link line</td></tr><tr><td>PHP_ADD_LIBRARY_DEFER</td><td>PHP_ADD_LIBRARY_DEFER(library[, append[, shared-libadd]])</td><td>add a library to the link line (deferred, not used during configure)</td></tr><tr><td>PHP_ADD_LIBRARY_DEFER_WITH_PATH</td><td>PHP_ADD_LIBRARY_DEFER_WITH_PATH(library, path[, shared-libadd])</td><td>add a library to the link line (deferred) and path to linkpath/runpath (not deferred) if shared-libadd is not empty and $ext_shared is yes, shared-libadd will be assigned the library information</td></tr><tr><td>PHP_ADD_LIBRARY_WITH_PATH</td><td>PHP_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])</td><td>add a library to the link line and path to linkpath/runpath. if shared-libadd is not empty and $ext_shared is yes, shared-libadd will be assigned the library information</td></tr><tr><td>PHP_ADD_MAKEFILE_FRAGMENT</td><td>PHP_ADD_MAKEFILE_FRAGMENT([srcfile [, ext_srcdir [, ext_builddir]]])</td><td>Processes a file called Makefile.frag in the source directory of the most recently added extension. $(srcdir) and $(builddir) are substituted with the proper paths. Can be used to supply custom rules and/or additional targets.</td></tr><tr><td>PHP_ADD_SOURCES</td><td>PHP_ADD_SOURCES(source-path, sources [, special-flags [, type]])</td><td>Adds sources which are located relative to source-path to the  array of type type.  Sources are processed with optional  special-flags which are passed to the compiler.  Sources can be either written in C or C++ (filenames shall end in .c  or .cpp, respectively).

 Note: If source-path begins with a &quot;/&quot;, the &quot;/&quot; is removed and the path is interpreted relative to the top build-directory.

 which array to append to?</td></tr><tr><td>PHP_ADD_SOURCES_X</td><td>PHP_ADD_SOURCES_X(source-path, sources[, special-flags[, target-var[, shared[, special-post-flags]]]])</td><td>Additional to PHP_ADD_SOURCES (see above), this lets you set the name of the array target-var directly, as well as whether shared objects will be built from the sources.

 Should not be used directly.</td></tr><tr><td>PHP_AP_EXTRACT_VERSION</td><td>PHP_AP_EXTRACT_VERSION(/path/httpd)</td><td>This macro is used to get a comparable version for apache1/2.</td></tr><tr><td>PHP_ARG_ANALYZE</td><td>PHP_ARG_ANALYZE</td><td>internal</td></tr><tr><td>PHP_ARG_ANALYZE_EX</td><td>PHP_ARG_ANALYZE_EX</td><td>internal</td></tr><tr><td>PHP_ARG_ENABLE</td><td>PHP_ARG_ENABLE(arg-name, check message, help text[, default-val[, extension-or-not]])</td><td>Sets PHP_ARG_NAME either to the user value or to the default value. default-val defaults to no.  This will also set the variable ext_shared, and will overwrite any previous variable of that name. If extension-or-not is yes (default), then do the ENABLE_ALL check and run the PHP_ARG_ANALYZE_EX.</td></tr><tr><td>PHP_ARG_WITH</td><td>PHP_ARG_WITH(arg-name, check message, help text[, default-val[, extension-or-not]])</td><td>Sets PHP_ARG_NAME either to the user value or to the default value. default-val defaults to no.  This will also set the variable ext_shared, and will overwrite any previous variable of that name. If extension-or-not is yes (default), then do the ENABLE_ALL check and run the PHP_ARG_ANALYZE_EX.</td></tr><tr><td>PHP_BROKEN_GETCWD</td><td>PHP_BROKEN_GETCWD</td><td>Some systems, notably Solaris, cause getcwd() or realpath to fail if a component of the path has execute but not read permissions</td></tr><tr><td>PHP_BROKEN_GLIBC_FOPEN_APPEND</td><td>PHP_BROKEN_GLIBC_FOPEN_APPEND</td><td></td></tr><tr><td>PHP_BUILD_BUNDLE</td><td>PHP_BUILD_BUNDLE</td><td></td></tr><tr><td>PHP_BUILD_PROGRAM</td><td>PHP_BUILD_PROGRAM</td><td></td></tr><tr><td>PHP_BUILD_SHARED</td><td>PHP_BUILD_SHARED</td><td></td></tr><tr><td>PHP_BUILD_STATIC</td><td>PHP_BUILD_STATIC</td><td></td></tr><tr><td>PHP_BUILD_THREAD_SAFE</td><td>PHP_BUILD_THREAD_SAFE</td><td></td></tr><tr><td>PHP_CANONICAL_HOST_TARGET</td><td>PHP_CANONICAL_HOST_TARGET</td><td></td></tr><tr><td>PHP_CHECK_64BIT</td><td>PHP_CHECK_64BIT([do if 32], [do if 64])</td><td>This macro is used to detect if we're at 64-bit platform or not. It could be useful for those external libs, that have different precompiled  versions in different directories.</td></tr><tr><td>PHP_CHECK_CONFIGURE_OPTIONS</td><td>PHP_CHECK_CONFIGURE_OPTIONS</td><td></td></tr><tr><td>PHP_CHECK_FRAMEWORK</td><td>PHP_CHECK_FRAMEWORK(framework, function [, action-found [, action-not-found ]])</td><td>El cheapo wrapper for AC_CHECK_LIB</td></tr><tr><td>PHP_CHECK_FUNC</td><td>PHP_CHECK_FUNC(func, ...)</td><td>This macro checks whether 'func' or '__func' exists in the default libraries and as a fall back in the specified library. Defines HAVE_func and HAVE_library if found and adds the library to LIBS.</td></tr><tr><td>PHP_CHECK_FUNC_LIB</td><td></td><td></td></tr><tr><td>PHP_CHECK_GCC_ARG</td><td>PHP_CHECK_GCC_ARG(arg, action-if-found, action-if-not-found)</td><td></td></tr><tr><td>PHP_CHECK_IN_ADDR_T</td><td>PHP_CHECK_IN_ADDR_T</td><td></td></tr><tr><td>PHP_CHECK_LIBRARY</td><td>PHP_CHECK_LIBRARY(library, function [, action-found [, action-not-found [, extra-libs]]])</td><td>Wrapper for AC_CHECK_LIB</td></tr><tr><td>PHP_CHECK_PDO_INCLUDES</td><td>PHP_CHECK_PDO_INCLUDES([found [, not-found]])</td><td></td></tr><tr><td>PHP_CHECK_SIZEOF</td><td>PHP_CHECK_SIZEOF(type, cross-value, extra-headers)</td><td></td></tr><tr><td>PHP_CHECK_STDINT_TYPES</td><td>PHP_CHECK_STDINT_TYPES</td><td></td></tr><tr><td>PHP_CHECK_TYPES</td><td>PHP_CHECK_TYPES(type-list, include-file [, extra-headers])</td><td></td></tr><tr><td>PHP_CONFIGURE_PART</td><td>PHP_CONFIGURE_PART(title)</td><td>Adds separator title configure output (idea borrowed from mm)</td></tr><tr><td>PHP_CONFIG_NICE</td><td>PHP_CONFIG_NICE(filename)</td><td>Generates the config.nice file</td></tr><tr><td>PHP_CRYPT_R_STYLE</td><td>PHP_CRYPT_R_STYLE</td><td>detect the style of crypt_r() is any is available see APR_CHECK_CRYPT_R_STYLE() for original version</td></tr><tr><td>PHP_C_BIGENDIAN</td><td>PHP_C_BIGENDIAN</td><td>Replacement macro for AC_C_BIGENDIAN</td></tr><tr><td>PHP_DEBUG_MACRO</td><td>PHP_DEBUG_MACRO(filename)</td><td></td></tr><tr><td>PHP_DECLARED_TIMEZONE</td><td>PHP_DECLARED_TIMEZONE</td><td></td></tr><tr><td>PHP_DEFINE</td><td>PHP_DEFINE(WHAT [, value[, directory]])</td><td>Creates builddir/include/what.h and in there #define WHAT value</td></tr><tr><td>PHP_DEF_HAVE</td><td>PHP_DEF_HAVE(what)</td><td>Generates 'AC_DEFINE(HAVE_WHAT, 1, [ ])'</td></tr><tr><td>PHP_DETECT_ICC</td><td>PHP_DETECT_ICC</td><td>Detect Intel C++ Compiler and unset $GCC if ICC found</td></tr><tr><td>PHP_DETECT_SUNCC</td><td>PHP_DETECT_SUNCC</td><td>Detect if the systems default compiler is suncc. We also set some useful CFLAGS if the user didn't set any</td></tr><tr><td>PHP_DOES_PREAD_WORK</td><td>PHP_DOES_PREAD_WORK</td><td>internal</td></tr><tr><td>PHP_DOES_PWRITE_WORK</td><td>PHP_DOES_PWRITE_WORK</td><td>internal</td></tr><tr><td>PHP_EBCDIC</td><td>PHP_EBCDIC</td><td></td></tr><tr><td>PHP_EVAL_INCLINE</td><td>PHP_EVAL_INCLINE(headerline)</td><td>Use this macro, if you need to add header search paths to the PHP build system which are only given in compiler notation.</td></tr><tr><td>PHP_EVAL_LIBLINE</td><td>PHP_EVAL_LIBLINE(libline, SHARED-LIBADD)</td><td>Use this macro, if you need to add libraries and or library search paths to the PHP build system which are only given in compiler notation.</td></tr><tr><td>PHP_EXPAND_PATH</td><td>PHP_EXPAND_PATH(path, variable)</td><td>expands path to an absolute path and assigns it to variable</td></tr><tr><td>PHP_EXTENSION</td><td></td><td>deprecated</td></tr><tr><td>PHP_FOPENCOOKIE</td><td>PHP_FOPENCOOKIE</td><td></td></tr><tr><td>PHP_GEN_BUILD_DIRS</td><td></td><td></td></tr><tr><td>PHP_GEN_GLOBAL_MAKEFILE</td><td>PHP_GEN_GLOBAL_MAKEFILE</td><td>Generates the global makefile.</td></tr><tr><td>PHP_HELP_SEPARATOR</td><td>PHP_HELP_SEPARATOR(title)</td><td>Adds separator title into the configure --help display.</td></tr><tr><td>PHP_INIT_BUILD_SYSTEM</td><td>PHP_INIT_BUILD_SYSTEM</td><td></td></tr><tr><td>PHP_INIT_DTRACE</td><td>PHP_INIT_DTRACE(providerdesc, header-file, sources [, module])</td><td></td></tr><tr><td>PHP_INSTALL_HEADERS</td><td></td><td>PHP_INSTALL_HEADERS(path [, file ...])

 PHP header files to be installed</td></tr><tr><td>PHP_LIBGCC_LIBPATH</td><td>PHP_LIBGCC_LIBPATH(gcc)</td><td>Stores the location of libgcc in libgcc_libpath</td></tr><tr><td>PHP_MISSING_FCLOSE_DECL</td><td>PHP_MISSING_FCLOSE_DECL</td><td>See if we have broken header files like SunOS has.</td></tr><tr><td>PHP_MISSING_TIME_R_DECL</td><td>PHP_MISSING_TIME_R_DECL</td><td></td></tr><tr><td>PHP_NEW_EXTENSION</td><td>PHP_NEW_EXTENSION(extname, sources [, shared [, sapi_class [, extra-cflags [, cxx [, zend_ext]]]]])</td><td>Includes an extension in the build.

 &quot;extname&quot; is the name of the ext/ subdir where the extension resides. &quot;sources&quot; is a list of files relative to the subdir which are used to build the extension. &quot;shared&quot; can be set to &quot;shared&quot; or &quot;yes&quot; to build the extension as a dynamically loadable library. Optional parameter &quot;sapi_class&quot; can be set to &quot;cli&quot; to mark extension build only with CLI or CGI sapi's. &quot;extra-cflags&quot; are passed to the compiler, with  @ext_srcdir@ and @ext_builddir@ being substituted. &quot;cxx&quot; can be used to indicate that a C++ shared module is desired. &quot;zend_ext&quot; indicates a zend extension.</td></tr><tr><td>PHP_OUTPUT</td><td>PHP_OUTPUT(file)</td><td>Adds &quot;file&quot; to the list of files generated by AC_OUTPUT This macro can be used several times.</td></tr><tr><td>PHP_PREAD_TEST</td><td>PHP_PREAD_TEST</td><td></td></tr><tr><td>PHP_PROG_AWK</td><td>PHP_PROG_AWK</td><td>Some vendors force mawk before gawk; mawk is broken so we don't like that</td></tr><tr><td>PHP_PROG_BISON</td><td>PHP_PROG_BISON</td><td>Search for bison and check it's version</td></tr><tr><td>PHP_PROG_LEX</td><td>PHP_PROG_LEX</td><td>Search for (f)lex and check it's version</td></tr><tr><td>PHP_PROG_RE2C</td><td>PHP_PROG_RE2C</td><td>Search for the re2c binary and check the version</td></tr><tr><td>PHP_PROG_SENDMAIL</td><td>PHP_PROG_SENDMAIL</td><td>Search for the sendmail binary</td></tr><tr><td>PHP_PWRITE_TEST</td><td>PHP_PWRITE_TEST</td><td></td></tr><tr><td>PHP_READDIR_R_TYPE</td><td>PHP_READDIR_R_TYPE</td><td></td></tr><tr><td>PHP_REAL_ARG_ENABLE</td><td>PHP_REAL_ARG_ENABLE</td><td>internal</td></tr><tr><td>PHP_REAL_ARG_WITH</td><td>PHP_REAL_ARG_WITH</td><td>internal</td></tr><tr><td>PHP_REMOVE_USR_LIB</td><td>PHP_REMOVE_USR_LIB(NAME)</td><td>Removes all -L/usr/$PHP_LIBDIR entries from variable NAME</td></tr><tr><td>PHP_REQUIRE_CXX</td><td>PHP_REQUIRE_CXX</td><td></td></tr><tr><td>PHP_RUNPATH_SWITCH</td><td>PHP_RUNPATH_SWITCH</td><td>Checks for -R, etc. switch</td></tr><tr><td>PHP_RUN_ONCE</td><td>PHP_RUN_ONCE(namespace, variable, code)</td><td>execute code, if variable is not set in namespace</td></tr><tr><td>PHP_SELECT_SAPI</td><td>PHP_SELECT_SAPI(name, type[, sources [, extra-cflags [, build-target]]])</td><td>Selects the SAPI name and type (static, shared, bundle, program) and optionally also the source-files for the SAPI-specific objects.</td></tr><tr><td>PHP_SETUP_ICONV</td><td></td><td>PHP_SETUP_ICONV(shared-add [, action-found [, action-not-found]])

 Common setup macro for iconv</td></tr><tr><td>PHP_SETUP_ICU</td><td>PHP_SETUP_ICU([shared-add])</td><td>Common setup macro for ICU</td></tr><tr><td>PHP_SETUP_KERBEROS</td><td>PHP_SETUP_KERBEROS(shared-add [, action-found [, action-not-found]])</td><td>Common setup macro for kerberos</td></tr><tr><td>PHP_SETUP_LIBXML</td><td></td><td>PHP_SETUP_LIBXML(shared-add [, action-found [, action-not-found]])

 Common setup macro for libxml</td></tr><tr><td>PHP_SETUP_OPENSSL</td><td></td><td>PHP_SETUP_OPENSSL(shared-add [, action-found [, action-not-found]])

 Common setup macro for openssl</td></tr><tr><td>PHP_SET_LIBTOOL_VARIABLE</td><td>PHP_SET_LIBTOOL_VARIABLE(var)</td><td>Set libtool variable</td></tr><tr><td>PHP_SHARED_MODULE</td><td>PHP_SHARED_MODULE(module-name, object-var, build-dir, cxx, zend_ext)</td><td>Basically sets up the link-stage for building module-name from object_var in build-dir.</td></tr><tr><td>PHP_SHLIB_SUFFIX_NAMES</td><td>PHP_SHLIB_SUFFIX_NAMES</td><td>Determines link library suffix SHLIB_SUFFIX_NAME which can be: .so, .sl or .dylib

 Determines shared library suffix SHLIB_DL_SUFFIX_NAME suffix can be: .so or .sl</td></tr><tr><td>PHP_SOCKADDR_CHECKS</td><td>PHP_SOCKADDR_CHECKS</td><td></td></tr><tr><td>PHP_SOCKLEN_T</td><td>PHP_SOCKLEN_T</td><td></td></tr><tr><td>PHP_SOLARIS_PIC_WEIRDNESS</td><td>PHP_SOLARIS_PIC_WEIRDNESS</td><td>Solaris requires main code to be position independent in order to let shared objects find symbols.  Weird.  Ugly.

 Must be run after all --with-NN options that let the user choose dynamic extensions, and after the gcc test.</td></tr><tr><td>PHP_STRUCT_FLOCK</td><td>PHP_STRUCT_FLOCK</td><td></td></tr><tr><td>PHP_SUBST</td><td>PHP_SUBST(varname)</td><td>Adds variable with it's value into Makefile, e.g.: CC = gcc</td></tr><tr><td>PHP_SUBST_OLD</td><td>PHP_SUBST_OLD(varname)</td><td>Same as PHP_SUBST() but also substitutes all @VARNAME@ instances in every file passed to AC_OUTPUT()</td></tr><tr><td>PHP_SYS_LFS</td><td>PHP_SYS_LFS</td><td>The problem is that the default compilation flags in Solaris 2.6 won't let programs access large files;  you need to tell the compiler that you actually want your programs to work on large files.  For more details about this brain damage please see: http://www.sas.com/standards/large.file/x_open.20Mar96.html

 Written by Paul Eggert &lt;eggert@twinsun.com&gt;.</td></tr><tr><td>PHP_TARGET_RDYNAMIC</td><td>PHP_TARGET_RDYNAMIC</td><td>Checks whether -rdynamic is supported by the compiler.  This is necessary for some targets to populate the global symbol table.  Otherwise, dynamic modules would not be able to resolve PHP-related symbols.

 If successful, adds -rdynamic to PHP_LDFLAGS.</td></tr><tr><td>PHP_TEST_BUILD</td><td>PHP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs [, extra-source]])</td><td>This macro checks whether build works and given function exists.</td></tr><tr><td>PHP_TEST_WRITE_STDOUT</td><td>PHP_TEST_WRITE_STDOUT</td><td></td></tr><tr><td>PHP_TIME_R_TYPE</td><td>PHP_TIME_R_TYPE</td><td>Check type of reentrant time-related functions Type can be: irix, hpux or POSIX</td></tr><tr><td>PHP_TM_GMTOFF</td><td>PHP_TM_GMTOFF</td><td></td></tr><tr><td>PHP_UTILIZE_RPATHS</td><td>PHP_UTILIZE_RPATHS()</td><td>builds RPATHS/LDFLAGS from PHP_RPATHS</td></tr><tr><td>PHP_WITH_SHARED</td><td>PHP_WITH_SHARED</td><td>Checks whether $withval is &quot;shared&quot; or starts with &quot;shared,XXX&quot; and sets $shared to &quot;yes&quot; or &quot;no&quot;, and removes &quot;shared,?&quot; stuff from $withval.</td></tr><tr><td>_PHP_ADD_LIBPATH_GLOBAL</td><td></td><td>internal, don't use</td></tr><tr><td>_PHP_ADD_LIBRARY_SKELETON</td><td></td><td>internal, don't use</td></tr><tr><td>_PHP_ASSIGN_BUILD_VARS</td><td>_PHP_ASSIGN_BUILD_VARS(type)</td><td>internal, don't use</td></tr><tr><td>_PHP_CHECK_SIZEOF</td><td>_PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-found-action]])</td><td></td></tr><tr><td>_PHP_DEF_HAVE_FILE</td><td></td><td>Internal helper macros

 _PHP_DEF_HAVE_FILE(what, filename)</td></tr><tr><td>_PHP_X_ADD_LIBRARY</td><td></td><td>internal, don't use</td></tr></table>
&#13;
&#13;
&#13;

答案 1 :(得分:4)

以下是我在开发php扩展时经常使用的“config.m4”的示例:

PHP_ARG_ENABLE(extname, whether to enable extname support,
[  --enable-extname           Enable extname support])

if test "$PHP_EXTNAME" != "no"; then
    PHP_REQUIRE_CXX() dnl If you need c++.please add this.
    PHP_ADD_INCLUDE(./include) dnl Extra include file 
    PHP_ADD_LIBRARY_WITH_PATH(staticlib,"./lib", EXTRA_LDFLAGS)  dnl static library needed in the extension
    PHP_ADD_LIBRARY_WITH_PATH(dynamiclib, ./lib, EXTNAME_SHARED_LIBADD)  dnl dynamic libarary needed in the extension
    PHP_NEW_EXTENSION(extname, extname.cpp, $ext_shared)
fi

实际上'ext_skel'脚本生成的示例扩展也显示了config.m4文件的用法。您可能也想阅读它。