php extension - What macros are available for php config.m4 files? -


when writing php extension, this documentation page indicates config.m4 file should provided autoconf use. gives couple of examples of such files, documentation incomplete. example, example file uses macro php_eval_incline, isn't mentioned in documentation follows it.

so, php-specific macros available use in config.m4 file, , do? there comprehensive documentation writing files?

i wasn't able find such list on internet.
however, can parse acinclude.m4, macros defined.
acinclude.m4 can found in root directory of php source tarball, in lib/php/build of php installation.

macros declared using ac_defun([name], [replacement]) macro.
preceded 1 or more comment line(s), starting dnl, act rudimentary documentation.

i wrote following script parse each function declaration name, usage , description:

$funcs = []; $matches = []; // scan "ac_defun([function_name_here]..." because function declarations, // , preceding lines starting "dbl" because comments, including documentation preg_match_all('#((?:dnl(?: .*)?\\n)*)ac_defun\\(\\[(\\w+)\\]#', file_get_contents('acinclude.m4'), $matches); // $matches[1][$i] contains lines starting "dbl" // $matches[2][$i] contains 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, don't have include usage information, try filter out.     foreach(explode("\n", $matches[1][$i]) $line)     {         // discard empty lines         if($line == 'dnl')         {             // except if they're inside description part - blocks shall stay separated.             if(!$beginning)             {                 $func['description'] .= "\n\n";             }             continue;         }         $m = [];         // if no line had content yet, , current line starts function name, that's usage information!         if($beginning && preg_match('#dnl ('.$name.'(?:.*)?)#', $line, $m) === 1)         {             $func['usage'] = $m[1];         }         // else description.         else         {             $func['description'] .= substr($line, 3);         }         $beginning = false;     }     // remove unnecessary whitespace, , make sure there's no sneaky html in description.     $func['description'] = htmlspecialchars(trim($func['description']));     $funcs[$name] = $func; } // sort function name ksort($funcs); 

running in folder acinclude.m4 located populate $funcs sorted array function names keys , usage , description values.

this can parsed html table few lines of code, like

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

apply nice css , add header row, , you've got readable list of available macros.

while macros quite documented, not, or lacking documentation entirely, still think it's better nothing.

applied acinclude.m4 of php 5.6.11, yields (best viewed fullscreen):

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;  }
<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 broken snprintf(), c99 conformance</td></tr><tr><td>php_ac_broken_sprintf</td><td>php_ac_broken_sprintf</td><td>check 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 scanned genif.sh when builds internal functions list, modules can init'd in correct order $1 = name of extension, $2 = extension upon depends $3 = optional: if true, it's ok $2 have not been configured default false , should halt build. effective, macro must invoked *after* php_new_extension. extension on depends must 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 (darwin / mac os x) framework link line. if before 1, framework added beginning of line.</td></tr><tr><td>php_add_frameworkpath</td><td>php_add_frameworkpath(path [,before])</td><td>add (darwin / mac os x) framework path link , include lines. default paths include (but not limited to) /local/library/frameworks , /system/library/frameworks, these don't need added. if before 1, framework path added beginning of relevant lines.</td></tr><tr><td>php_add_framework_with_path</td><td>php_add_framework_with_path(framework, path)</td><td>adds (darwin / mac os x) framework path , framework link , include lines.</td></tr><tr><td>php_add_include</td><td>php_add_include(path [,before])</td><td>add include path.  if before 1, add in beginning of includes.</td></tr><tr><td>php_add_libpath</td><td>php_add_libpath(path [, shared-libadd])</td><td>adds path linkpath/runpath (ldflags)</td></tr><tr><td>php_add_library</td><td>php_add_library(library[, append[, shared-libadd]])</td><td>add library link line</td></tr><tr><td>php_add_library_defer</td><td>php_add_library_defer(library[, append[, shared-libadd]])</td><td>add library 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 library link line (deferred) , path linkpath/runpath (not deferred) if shared-libadd not empty , $ext_shared yes, shared-libadd assigned 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 library link line , path linkpath/runpath. if shared-libadd not empty , $ext_shared yes, shared-libadd assigned library information</td></tr><tr><td>php_add_makefile_fragment</td><td>php_add_makefile_fragment([srcfile [, ext_srcdir [, ext_builddir]]])</td><td>processes file called makefile.frag in source directory of added extension. $(srcdir) , $(builddir) substituted proper paths. can used 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 located relative source-path  array of type type.  sources processed optional  special-flags passed compiler.  sources can either written in c or c++ (filenames shall end in .c  or .cpp, respectively).     note: if source-path begins &quot;/&quot;, &quot;/&quot; removed , path interpreted relative top build-directory.     array 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 php_add_sources (see above), lets set name of array target-var directly, whether shared objects built sources.     should not used directly.</td></tr><tr><td>php_ap_extract_version</td><td>php_ap_extract_version(/path/httpd)</td><td>this macro used comparable version 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, text[, default-val[, extension-or-not]])</td><td>sets php_arg_name either user value or default value. default-val defaults no.  set variable ext_shared, , overwrite previous variable of name. if extension-or-not yes (default), enable_all check , run php_arg_analyze_ex.</td></tr><tr><td>php_arg_with</td><td>php_arg_with(arg-name, check message, text[, default-val[, extension-or-not]])</td><td>sets php_arg_name either user value or default value. default-val defaults no.  set variable ext_shared, , overwrite previous variable of name. if extension-or-not yes (default), enable_all check , run 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 fail if component of path has execute 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 used detect if we're @ 64-bit platform or not. useful external libs, 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 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 default libraries , fall in specified library. defines have_func , have_library if found , adds library 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 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 mm)</td></tr><tr><td>php_config_nice</td><td>php_config_nice(filename)</td><td>generates config.nice file</td></tr><tr><td>php_crypt_r_style</td><td>php_crypt_r_style</td><td>detect style of crypt_r() available see apr_check_crypt_r_style() original version</td></tr><tr><td>php_c_bigendian</td><td>php_c_bigendian</td><td>replacement macro 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 , in there #define 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 , unset $gcc if icc found</td></tr><tr><td>php_detect_suncc</td><td>php_detect_suncc</td><td>detect if systems default compiler suncc. set useful cflags if 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 macro, if need add header search paths php build system given in compiler notation.</td></tr><tr><td>php_eval_libline</td><td>php_eval_libline(libline, shared-libadd)</td><td>use macro, if need add libraries , or library search paths php build system given in compiler notation.</td></tr><tr><td>php_expand_path</td><td>php_expand_path(path, variable)</td><td>expands path absolute path , assigns 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 global makefile.</td></tr><tr><td>php_help_separator</td><td>php_help_separator(title)</td><td>adds separator title 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 installed</td></tr><tr><td>php_libgcc_libpath</td><td>php_libgcc_libpath(gcc)</td><td>stores location of libgcc in libgcc_libpath</td></tr><tr><td>php_missing_fclose_decl</td><td>php_missing_fclose_decl</td><td>see if have broken header files 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 extension in build.     &quot;extname&quot; name of ext/ subdir extension resides. &quot;sources&quot; list of files relative subdir used build extension. &quot;shared&quot; can set &quot;shared&quot; or &quot;yes&quot; build extension dynamically loadable library. optional parameter &quot;sapi_class&quot; can set &quot;cli&quot; mark extension build cli or cgi sapi's. &quot;extra-cflags&quot; passed compiler,  @ext_srcdir@ , @ext_builddir@ being substituted. &quot;cxx&quot; can used indicate c++ shared module desired. &quot;zend_ext&quot; indicates zend extension.</td></tr><tr><td>php_output</td><td>php_output(file)</td><td>adds &quot;file&quot; list of files generated ac_output macro can 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 broken don't that</td></tr><tr><td>php_prog_bison</td><td>php_prog_bison</td><td>search bison , check it's version</td></tr><tr><td>php_prog_lex</td><td>php_prog_lex</td><td>search (f)lex , check it's version</td></tr><tr><td>php_prog_re2c</td><td>php_prog_re2c</td><td>search re2c binary , check version</td></tr><tr><td>php_prog_sendmail</td><td>php_prog_sendmail</td><td>search 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 -l/usr/$php_libdir entries 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 -r, etc. switch</td></tr><tr><td>php_run_once</td><td>php_run_once(namespace, variable, code)</td><td>execute code, if variable 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 sapi name , type (static, shared, bundle, program) , optionally source-files 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 iconv</td></tr><tr><td>php_setup_icu</td><td>php_setup_icu([shared-add])</td><td>common setup macro 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 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 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 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 link-stage building module-name 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 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 position independent in order let shared objects find symbols.  weird.  ugly.     must run after --with-nn options let user choose dynamic extensions, , after 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 it's value makefile, e.g.: cc = gcc</td></tr><tr><td>php_subst_old</td><td>php_subst_old(varname)</td><td>same php_subst() substitutes @varname@ instances in every file passed ac_output()</td></tr><tr><td>php_sys_lfs</td><td>php_sys_lfs</td><td>the problem default compilation flags in solaris 2.6 won't let programs access large files;  need tell compiler want programs work on large files.  more details brain damage please see: http://www.sas.com/standards/large.file/x_open.20mar96.html     written paul eggert &lt;eggert@twinsun.com&gt;.</td></tr><tr><td>php_target_rdynamic</td><td>php_target_rdynamic</td><td>checks whether -rdynamic supported compiler.  necessary targets populate global symbol table.  otherwise, dynamic modules not able resolve php-related symbols.     if successful, adds -rdynamic 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 , 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 php_rpaths</td></tr><tr><td>php_with_shared</td><td>php_with_shared</td><td>checks whether $withval &quot;shared&quot; or starts &quot;shared,xxx&quot; , sets $shared &quot;yes&quot; or &quot;no&quot;, , removes &quot;shared,?&quot; stuff $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>


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -