diff options
| author | Sascha Schumann <sas@php.net> | 1999-11-13 16:51:33 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 1999-11-13 16:51:33 +0000 |
| commit | bcb2214e9951b271d073314870bf09a6a87435f5 (patch) | |
| tree | b3a1540deb25e4480d62c57854ba092479191e28 /ext | |
| parent | c166a6fb835c5b43a782da141c1543e8a1878229 (diff) | |
| download | php-git-bcb2214e9951b271d073314870bf09a6a87435f5.tar.gz | |
Improve regex library selection. It lets user specify whether they want
system, apache, or php's regex library by using the --with-regex option.
"php" is the default; if you use --with-apache in combination with
Apache 1.3.x, the default is "apache".
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/ereg/ereg.c | 2 | ||||
| -rw-r--r-- | ext/ereg/php_regex.h | 4 | ||||
| -rw-r--r-- | ext/ereg/regex/regex_extra.h | 14 | ||||
| -rw-r--r-- | ext/ereg/regex/utils.h | 3 | ||||
| -rw-r--r-- | ext/standard/config.m4 | 22 | ||||
| -rw-r--r-- | ext/standard/reg.c | 2 |
6 files changed, 37 insertions, 10 deletions
diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 7f50ce3170..bd40cb2191 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -92,7 +92,9 @@ static int _free_reg_cache(reg_cache *rc) return 1; } +#undef regfree #define regfree(a); +#undef regcomp #define regcomp(a,b,c) _php_regcomp(a,b,c) static void php_reg_init_globals(php_reg_globals *reg_globals) diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h index 46618379af..91cbd994c4 100644 --- a/ext/ereg/php_regex.h +++ b/ext/ereg/php_regex.h @@ -1,7 +1,7 @@ #ifndef _PHP_REGEX_H #define _PHP_REGEX_H -#if REGEX +#if REGEX == 1 #include "regex/regex.h" #ifndef _REGEX_H #define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */ @@ -18,7 +18,7 @@ #ifndef _H_REGEX #define _H_REGEX 1 /* This one is for AIX */ #endif -#else +#elif REGEX == 0 #include <regex.h> #endif diff --git a/ext/ereg/regex/regex_extra.h b/ext/ereg/regex/regex_extra.h new file mode 100644 index 0000000000..b839ddc2ad --- /dev/null +++ b/ext/ereg/regex/regex_extra.h @@ -0,0 +1,14 @@ + +#undef regexec +#undef regerror +#undef regfree +#undef regcomp + +#if (defined(REGEX) && REGEX == 1) || (!defined(REGEX)) + +#define regexec php_regexec +#define regerror php_regerror +#define regfree php_regfree +#define regcomp php_regcomp + +#endif diff --git a/ext/ereg/regex/utils.h b/ext/ereg/regex/utils.h index 1a997ac8fc..cd4a96025f 100644 --- a/ext/ereg/regex/utils.h +++ b/ext/ereg/regex/utils.h @@ -1,4 +1,7 @@ /* utility definitions */ + +#include "regex_extra.h" + #ifdef _POSIX2_RE_DUP_MAX #define DUPMAX _POSIX2_RE_DUP_MAX #else diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index ce9a4682ef..c6e9c578ae 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -123,18 +123,24 @@ AC_CHECK_FUNCS(getwd) divert(3) -AC_ARG_WITH(system-regex, -[ --with-system-regex Do not use the bundled regex library], +AC_ARG_WITH(regex, +[ --with-regex=TYPE regex library type: system, apache, php], [ - if test "$withval" = "no"; then - WANT_HSREGEX=yes - else - WANT_HSREGEX=no - fi + REGEX_TYPE=$withval ],[ - WANT_HSREGEX=yes + REGEX_TYPE=php ]) +AC_ARG_WITH(system-regex, +[ --with-system-regex (deprecated) Use system regex library], +[ + if test "$withval" = "yes"; then + REGEX_TYPE=system + else + REGEX_TYPE=php + fi +]) + AC_CRYPT_CAP PHP_EXTENSION(standard) diff --git a/ext/standard/reg.c b/ext/standard/reg.c index 7f50ce3170..bd40cb2191 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -92,7 +92,9 @@ static int _free_reg_cache(reg_cache *rc) return 1; } +#undef regfree #define regfree(a); +#undef regcomp #define regcomp(a,b,c) _php_regcomp(a,b,c) static void php_reg_init_globals(php_reg_globals *reg_globals) |
