Skip to content

Commit aa3eee1

Browse files
author
Jani Taskinen
committed
MFH:- Moved the old regex functions to own extension: ereg
1 parent 3a5817e commit aa3eee1

64 files changed

Lines changed: 228 additions & 222 deletions

Some content is hidden

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

configure.in

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ dnl ## Diversion 2 is the initial checking of OS features, programs,
1111
dnl ## libraries and so on.
1212

1313
dnl ## In diversion 3 we check for compile-time options to the PHP
14-
dnl ## core and how to deal with different system dependencies. This
15-
dnl ## includes what regex library is used and whether debugging or short
16-
dnl ## tags are enabled, and the default behaviour of php.ini options.
14+
dnl ## core and how to deal with different system dependencies.
15+
dnl ## This includes whether debugging or short tags are enabled
16+
dnl ## and the default behaviour of php.ini options.
1717
dnl ## This is also where an SAPI interface is selected (choosing between
1818
dnl ## Apache module, CGI etc.)
1919

@@ -270,10 +270,9 @@ fi
270270
divert(3)
271271

272272
dnl ## In diversion 3 we check for compile-time options to the PHP
273-
dnl ## core and how to deal with different system dependencies. This
274-
dnl ## includes what regex library is used and whether debugging or short
275-
dnl ## tags are enabled, and the default behaviour of php.ini options.
276-
273+
dnl ## core and how to deal with different system dependencies.
274+
dnl ## This includes whether debugging or short tags are enabled
275+
dnl ## and the default behaviour of php.ini options.
277276

278277
dnl Starting system checks.
279278
dnl -------------------------------------------------------------------------
@@ -518,7 +517,6 @@ putenv \
518517
realpath \
519518
random \
520519
rand_r \
521-
regcomp \
522520
res_search \
523521
scandir \
524522
setitimer \
@@ -1292,7 +1290,7 @@ esac
12921290
PHP_SUBST(all_targets)
12931291
PHP_SUBST(install_targets)
12941292

1295-
PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/ regex/])
1293+
PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/])
12961294

12971295
PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c)
12981296

@@ -1345,7 +1343,6 @@ fi
13451343
PHP_ADD_SOURCES_X(Zend, zend_execute.c,,PHP_GLOBAL_OBJS,,$flag)
13461344

13471345
PHP_ADD_BUILD_DIR(main main/streams)
1348-
PHP_ADD_BUILD_DIR(regex)
13491346
PHP_ADD_BUILD_DIR(sapi/$PHP_SAPI sapi/cli)
13501347
PHP_ADD_BUILD_DIR(TSRM)
13511348
PHP_ADD_BUILD_DIR(Zend)

ext/ereg/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

ext/ereg/config.w32

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// $Id$
2+
// vim:ft=javascript
3+
4+
EXTENSION("ereg", "ereg.c", false /* never shared */, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex");
5+
ADD_SOURCES("ext/ereg/regex", "regcomp.c regexec.c regerror.c regfree.c", "ereg");
6+
AC_DEFINE('REGEX', 1, 'Bundled regex');
7+
AC_DEFINE('HSREGEX', 1, 'Bundled regex');

ext/ereg/config0.m4

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
37+
PHP_NEW_EXTENSION(ereg, ereg.c $ereg_regex_sources, no,,$PHP_EREG_CFLAGS)
38+
PHP_INSTALL_HEADERS([ext/ereg], [php_ereg.h php_regex.h $ereg_regex_headers])
39+
40+
if test "$REGEX_TYPE" = "php"; then
41+
AC_DEFINE(HAVE_REGEX_T_RE_MAGIC, 1, [ ])
42+
AC_DEFINE(HSREGEX,1,[ ])
43+
AC_DEFINE(REGEX,1,[ ])
44+
PHP_ADD_BUILD_DIR([$ext_builddir/regex], 1)
45+
PHP_ADD_INCLUDE([$ext_srcdir/regex])
46+
elif test "$REGEX_TYPE" = "system"; then
47+
AC_DEFINE(REGEX,0,[ ])
48+
dnl Check if field re_magic exists in struct regex_t
49+
AC_CACHE_CHECK([whether field re_magic exists in struct regex_t], ac_cv_regex_t_re_magic, [
50+
AC_TRY_COMPILE([#include <sys/types.h>
51+
#include <regex.h>], [regex_t rt; rt.re_magic;],
52+
[ac_cv_regex_t_re_magic=yes], [ac_cv_regex_t_re_magic=no])])
53+
if test "$ac_cv_regex_t_re_magic" = "yes"; then
54+
AC_DEFINE([HAVE_REGEX_T_RE_MAGIC], [ ], 1)
55+
fi
56+
fi

0 commit comments

Comments
 (0)