Skip to content

Commit fcff3e5

Browse files
committed
Initial copy of ext/ereg from php-src.
Further history before this can be found in the php-src repository: the PRE_PHP7_EREG_MYSQL_REMOVALS tag indicates the last commit before this extension was removed.
1 parent 84e6344 commit fcff3e5

File tree

108 files changed

+14851
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+14851
-0
lines changed

CREDITS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ereg
2+
Rasmus Lerdorf, Jim Winstead, Jaakko Hyvätti

config.w32

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// $Id$
2+
// vim:ft=javascript
3+
4+
ARG_WITH("ereg", "POSIX extended regular expressions", "yes");
5+
if (PHP_EREG != "no") {
6+
7+
EXTENSION("ereg", "ereg.c", PHP_EREG_SHARED, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
8+
ADD_SOURCES("ext/ereg/regex", "regcomp.c regexec.c regerror.c regfree.c", "ereg");
9+
AC_DEFINE('REGEX', 1, 'Bundled regex');
10+
AC_DEFINE('HSREGEX', 1, 'Bundled regex');
11+
PHP_INSTALL_HEADERS("ext/ereg", "php_ereg.h php_regex.h regex/");
12+
}

config0.m4

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
dnl $Id$
2+
dnl config.m4 for extension ereg
3+
4+
dnl
5+
dnl Check for regex library type
6+
dnl
7+
PHP_ARG_WITH(regex,,
8+
[ --with-regex=TYPE Regex library type: system, php. [TYPE=php]
9+
WARNING: Do NOT use unless you know what you are doing!], php, no)
10+
11+
case $PHP_REGEX in
12+
system)
13+
if test "$PHP_SAPI" = "apache" || test "$PHP_SAPI" = "apache2filter" || test "$PHP_SAPI" = "apache2handler"; then
14+
REGEX_TYPE=php
15+
else
16+
REGEX_TYPE=system
17+
fi
18+
;;
19+
yes | php)
20+
REGEX_TYPE=php
21+
;;
22+
*)
23+
REGEX_TYPE=php
24+
AC_MSG_WARN([Invalid regex library type selected. Using default value: php])
25+
;;
26+
esac
27+
28+
AC_MSG_CHECKING([which regex library to use])
29+
AC_MSG_RESULT([$REGEX_TYPE])
30+
31+
if test "$REGEX_TYPE" = "php"; then
32+
ereg_regex_sources="regex/regcomp.c regex/regexec.c regex/regerror.c regex/regfree.c"
33+
ereg_regex_headers="regex/"
34+
PHP_EREG_CFLAGS="-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp"
35+
fi
36+
PHP_EREG_CFLAGS="$PHP_EREG_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
37+
38+
PHP_NEW_EXTENSION(ereg, ereg.c $ereg_regex_sources, no,,$PHP_EREG_CFLAGS)
39+
PHP_INSTALL_HEADERS([ext/ereg], [php_ereg.h php_regex.h $ereg_regex_headers])
40+
41+
if test "$REGEX_TYPE" = "php"; then
42+
AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ])
43+
AC_DEFINE(HSREGEX,1,[ ])
44+
AC_DEFINE(REGEX,1,[ ])
45+
PHP_ADD_BUILD_DIR([$ext_builddir/regex], 1)
46+
PHP_ADD_INCLUDE([$ext_srcdir/regex])
47+
elif test "$REGEX_TYPE" = "system"; then
48+
AC_DEFINE(REGEX,0,[ ])
49+
dnl Check if field re_magic exists in struct regex_t
50+
AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [
51+
AC_TRY_COMPILE([#include <sys/types.h>
52+
#include <regex.h>], [regex_t rt; rt.re_magic;],
53+
[ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])])
54+
if test "$ac_cv_regex_t_re_magic" = "yes"; then
55+
AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1)
56+
fi
57+
fi

0 commit comments

Comments
 (0)