diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32 index 9cd11ce3e1f..b52aa712362 100644 --- a/ext/pcre/config.w32 +++ b/ext/pcre/config.w32 @@ -5,7 +5,7 @@ ARG_WITH("pcre-regex", "Perl Compatible Regular Expressions", "yes"); if (PHP_PCRE_REGEX == "yes") { EXTENSION("pcre", "php_pcre.c", PHP_PCRE_REGEX_SHARED, - "-DNO_RECURSE -DHAVE_CONFIG_H -Iext/pcre/pcrelib"); + "-DNO_RECURSE -Iext/pcre/pcrelib"); ADD_SOURCES("ext/pcre/pcrelib", "pcre_chartables.c pcre_ucp_searchfuncs.c pcre_compile.c pcre_config.c pcre_exec.c pcre_fullinfo.c pcre_get.c pcre_globals.c pcre_info.c pcre_maketables.c pcre_newline.c pcre_ord2utf8.c pcre_refcount.c pcre_study.c pcre_tables.c pcre_try_flipped.c pcre_valid_utf8.c pcre_version.c pcre_xclass.c", "pcre"); ADD_DEF_FILE("ext\\pcre\\php_pcre.def"); diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4 index 6998153a862..373af4e9bd0 100644 --- a/ext/pcre/config0.m4 +++ b/ext/pcre/config0.m4 @@ -11,7 +11,7 @@ PHP_ARG_WITH(pcre-regex,for PCRE support, if test "$PHP_PCRE_REGEX" != "no"; then if test "$PHP_PCRE_REGEX" = "yes"; then - PHP_NEW_EXTENSION(pcre, pcrelib/pcre_chartables.c pcrelib/pcre_ucp_searchfuncs.c pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_exec.c pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c pcrelib/pcre_info.c pcrelib/pcre_maketables.c pcrelib/pcre_newline.c pcrelib/pcre_ord2utf8.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c pcrelib/pcre_tables.c pcrelib/pcre_try_flipped.c pcrelib/pcre_valid_utf8.c pcrelib/pcre_version.c pcrelib/pcre_xclass.c php_pcre.c, $ext_shared,,-DHAVE_CONFIG_H -I@ext_srcdir@/pcrelib) + PHP_NEW_EXTENSION(pcre, pcrelib/pcre_chartables.c pcrelib/pcre_ucp_searchfuncs.c pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_exec.c pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c pcrelib/pcre_info.c pcrelib/pcre_maketables.c pcrelib/pcre_newline.c pcrelib/pcre_ord2utf8.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c pcrelib/pcre_tables.c pcrelib/pcre_try_flipped.c pcrelib/pcre_valid_utf8.c pcrelib/pcre_version.c pcrelib/pcre_xclass.c php_pcre.c, $ext_shared,,-I@ext_srcdir@/pcrelib) PHP_ADD_BUILD_DIR($ext_builddir/pcrelib) PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/]) AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ]) diff --git a/ext/pcre/pcrelib/dftables.c b/ext/pcre/pcrelib/dftables.c index eb9a1a4b7d9..cf3b21052fb 100644 --- a/ext/pcre/pcrelib/dftables.c +++ b/ext/pcre/pcrelib/dftables.c @@ -43,9 +43,7 @@ character tables for PCRE. The tables are built according to the current locale. Now that pcre_maketables is a function visible to the outside world, we make use of its code from here in order to be consistent. */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include diff --git a/ext/pcre/pcrelib/pcre_chartables.c b/ext/pcre/pcrelib/pcre_chartables.c index 3d6a4fff9c9..bec2d0c046e 100644 --- a/ext/pcre/pcrelib/pcre_chartables.c +++ b/ext/pcre/pcrelib/pcre_chartables.c @@ -20,9 +20,7 @@ and dead code stripping is activated. This leads to link errors. Pulling in the header ensures that the array gets flagged as "someone outside this compilation unit might reference this" and so it will always be supplied to the linker. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_compile.c b/ext/pcre/pcrelib/pcre_compile.c index 8361e148bb4..77ec51cacea 100644 --- a/ext/pcre/pcrelib/pcre_compile.c +++ b/ext/pcre/pcrelib/pcre_compile.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. supporting internal functions that are not used by other modules. */ -#ifdef HAVE_CONFIG_H #include -#endif #define NLBLOCK cd /* Block containing newline information */ #define PSSTART start_pattern /* Field containing processed string start */ diff --git a/ext/pcre/pcrelib/pcre_config.c b/ext/pcre/pcrelib/pcre_config.c index ea0e317db8f..700a5d2918b 100644 --- a/ext/pcre/pcrelib/pcre_config.c +++ b/ext/pcre/pcrelib/pcre_config.c @@ -41,9 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. /* This module contains the external function pcre_config(). */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c index bd650e9b184..1c570a03bd2 100644 --- a/ext/pcre/pcrelib/pcre_exec.c +++ b/ext/pcre/pcrelib/pcre_exec.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. pattern matching using an NFA algorithm, trying to mimic Perl as closely as possible. There are also some static supporting functions. */ -#ifdef HAVE_CONFIG_H #include -#endif #define NLBLOCK md /* Block containing newline information */ #define PSSTART start_subject /* Field containing processed string start */ diff --git a/ext/pcre/pcrelib/pcre_fullinfo.c b/ext/pcre/pcrelib/pcre_fullinfo.c index b082473351c..1554292e660 100644 --- a/ext/pcre/pcrelib/pcre_fullinfo.c +++ b/ext/pcre/pcrelib/pcre_fullinfo.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. information about a compiled pattern. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_get.c b/ext/pcre/pcrelib/pcre_get.c index 64a195e9406..898f051e892 100644 --- a/ext/pcre/pcrelib/pcre_get.c +++ b/ext/pcre/pcrelib/pcre_get.c @@ -43,9 +43,7 @@ from the subject string after a regex match has succeeded. The original idea for these functions came from Scott Wimer. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_globals.c b/ext/pcre/pcrelib/pcre_globals.c index 41b89dd75c9..a56f13aa2f4 100644 --- a/ext/pcre/pcrelib/pcre_globals.c +++ b/ext/pcre/pcrelib/pcre_globals.c @@ -46,9 +46,7 @@ indirection. These values can be changed by the caller, but are shared between all threads. However, when compiling for Virtual Pascal, things are done differently, and global variables are not used (see pcre.in). */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_info.c b/ext/pcre/pcrelib/pcre_info.c index c40eb7c3755..6970e7953f1 100644 --- a/ext/pcre/pcrelib/pcre_info.c +++ b/ext/pcre/pcrelib/pcre_info.c @@ -43,9 +43,7 @@ information about a compiled pattern. However, use of this function is now deprecated, as it has been superseded by pcre_fullinfo(). */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_maketables.c b/ext/pcre/pcrelib/pcre_maketables.c index 1e6381aa347..cba42260ce6 100644 --- a/ext/pcre/pcrelib/pcre_maketables.c +++ b/ext/pcre/pcrelib/pcre_maketables.c @@ -45,9 +45,7 @@ compilation of dftables.c, in which case the macro DFTABLES is defined. */ #ifndef DFTABLES -# ifdef HAVE_CONFIG_H # include -# endif # include "pcre_internal.h" #endif diff --git a/ext/pcre/pcrelib/pcre_newline.c b/ext/pcre/pcrelib/pcre_newline.c index db02a8cf205..9725c723da1 100644 --- a/ext/pcre/pcrelib/pcre_newline.c +++ b/ext/pcre/pcrelib/pcre_newline.c @@ -47,9 +47,7 @@ and NLTYPE_ANY. The full list of Unicode newline characters is taken from http://unicode.org/unicode/reports/tr18/. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_ord2utf8.c b/ext/pcre/pcrelib/pcre_ord2utf8.c index 7552034e443..ebb8a9d483d 100644 --- a/ext/pcre/pcrelib/pcre_ord2utf8.c +++ b/ext/pcre/pcrelib/pcre_ord2utf8.c @@ -41,9 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. /* This file contains a private PCRE function that converts an ordinal character value into a UTF8 string. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_refcount.c b/ext/pcre/pcrelib/pcre_refcount.c index b6a464ce81c..7d3b7981c44 100644 --- a/ext/pcre/pcrelib/pcre_refcount.c +++ b/ext/pcre/pcrelib/pcre_refcount.c @@ -44,9 +44,7 @@ pattern data block. This might be helpful in applications where the block is shared by different users. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_study.c b/ext/pcre/pcrelib/pcre_study.c index 6a6c314b02a..8c82d1ce61a 100644 --- a/ext/pcre/pcrelib/pcre_study.c +++ b/ext/pcre/pcrelib/pcre_study.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. supporting functions. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_tables.c b/ext/pcre/pcrelib/pcre_tables.c index 7d79eff205a..95d166975f8 100644 --- a/ext/pcre/pcrelib/pcre_tables.c +++ b/ext/pcre/pcrelib/pcre_tables.c @@ -44,9 +44,7 @@ uses macros to change their names from _pcre_xxx to xxxx, thereby avoiding name clashes with the library. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_try_flipped.c b/ext/pcre/pcrelib/pcre_try_flipped.c index 4f989185384..cd7d21eccc5 100644 --- a/ext/pcre/pcrelib/pcre_try_flipped.c +++ b/ext/pcre/pcrelib/pcre_try_flipped.c @@ -43,9 +43,7 @@ see if it was compiled with the opposite endianness. If so, it uses an auxiliary local function to flip the appropriate bytes. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c b/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c index d3edc2d71be..95d42cf7cda 100644 --- a/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c +++ b/ext/pcre/pcrelib/pcre_ucp_searchfuncs.c @@ -41,9 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. /* This module contains code for searching the table of Unicode character properties. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_valid_utf8.c b/ext/pcre/pcrelib/pcre_valid_utf8.c index 0486ea381f4..223e7408573 100644 --- a/ext/pcre/pcrelib/pcre_valid_utf8.c +++ b/ext/pcre/pcrelib/pcre_valid_utf8.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. strings. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_version.c b/ext/pcre/pcrelib/pcre_version.c index e1ab4d4107c..865453d9bc9 100644 --- a/ext/pcre/pcrelib/pcre_version.c +++ b/ext/pcre/pcrelib/pcre_version.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. string that identifies the PCRE version that is in use. */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcre_xclass.c b/ext/pcre/pcrelib/pcre_xclass.c index 502e718bf45..db5331b638d 100644 --- a/ext/pcre/pcrelib/pcre_xclass.c +++ b/ext/pcre/pcrelib/pcre_xclass.c @@ -43,9 +43,7 @@ class (one that contains characters whose values are > 255). It is used by both pcre_exec() and pcre_def_exec(). */ -#ifdef HAVE_CONFIG_H #include -#endif #include "pcre_internal.h" diff --git a/ext/pcre/pcrelib/pcregrep.c b/ext/pcre/pcrelib/pcregrep.c index 36b618a8c4f..29338d15995 100644 --- a/ext/pcre/pcrelib/pcregrep.c +++ b/ext/pcre/pcrelib/pcregrep.c @@ -37,9 +37,7 @@ POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------- */ -#ifdef HAVE_CONFIG_H #include -#endif #include #include diff --git a/ext/pcre/pcrelib/pcreposix.c b/ext/pcre/pcrelib/pcreposix.c index 83263deaab8..9c0adebb962 100644 --- a/ext/pcre/pcrelib/pcreposix.c +++ b/ext/pcre/pcrelib/pcreposix.c @@ -42,9 +42,7 @@ POSSIBILITY OF SUCH DAMAGE. functions. */ -#ifdef HAVE_CONFIG_H #include -#endif /* Ensure that the PCREPOSIX_EXP_xxx macros are set appropriately for diff --git a/ext/pcre/upgrade-pcre.php b/ext/pcre/upgrade-pcre.php index 2f7202e0fb6..dd0a8a783a1 100644 --- a/ext/pcre/upgrade-pcre.php +++ b/ext/pcre/upgrade-pcre.php @@ -33,10 +33,13 @@ function recurse($path) { global $newpcre, $dirlen; - foreach(scandir($path) as $file) { + foreach (scandir($path) as $file) { - if ($file[0] === '.' || $file === 'CVS') continue; - if (substr_compare($file, '.lo', -3, 3) == 0 || substr_compare($file, '.o', -2, 2) == 0) continue; + if ($file[0] === '.' || + $file === 'CVS' || + substr_compare($file, '.lo', -3, 3) == 0 || + substr_compare($file, '.loT', -4, 4) == 0 || + substr_compare($file, '.o', -2, 2) == 0) continue; $file = "$path/$file"; @@ -58,7 +61,19 @@ function recurse($path) die("$newfile is not available any more\n"); } - copy($newfile, $file); + // maintain file mtimes so that cvs doesnt get crazy + if (file_get_contents($newfile) !== file_get_contents($file)) { + copy($newfile, $file); + } + + // always include the config.h file + $content = file_get_contents($newfile); + $newcontent = preg_replace('/#\s*ifdef HAVE_CONFIG_H\s*(.+)\s*#\s*endif/', '$1', $content); + + if ($content !== $newcontent) { + file_put_contents($file, $newcontent); + } + echo "OK\n"; }