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".
AUTOMAKE_OPTIONS = foreign
ZEND_DIR = $(srcdir)/libzend
-SUBDIRS = libzend ext sapi $(TSRM_DIR) regex
+SUBDIRS = libzend ext sapi $(TSRM_DIR) $(REGEX_DIR)
BUILDLDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS)
fi
])
-AC_DEFUN(PHP_HSREGEX,[
+AC_DEFUN(PHP_REGEX,[
-test -z "$HSREGEX" && HSREGEX="$WANT_HSREGEX"
-AC_MSG_CHECKING(whether to use bundled regex library)
-AC_MSG_RESULT($HSREGEX)
-
-if test "$HSREGEX" = "yes"; then
+if test "$REGEX_TYPE" = "php"; then
REGEX_LIB=regex/libregex.la
+ REGEX_DIR=regex
AC_DEFINE(HSREGEX)
AC_DEFINE(REGEX,1)
-else
- REGEX_LIB=
+elif test "$REGEX_TYPE" = "system"; then
AC_DEFINE(REGEX,0)
+elif test "$REGEX_TYPE" = "apache"; then
+ AC_DEFINE(REGEX,2)
fi
+AC_MSG_CHECKING(which regex library to use)
+AC_MSG_RESULT($REGEX_TYPE)
+
+AC_SUBST(REGEX_DIR)
AC_SUBST(REGEX_LIB)
AC_SUBST(HSREGEX)
])
AM_SET_LIBTOOL_VARIABLE([--silent])
fi
-PHP_HSREGEX
+PHP_REGEX
dnl If we are using gcc and the user has not specified CFLAGS, add -O2.
test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O2"
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)
#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 */
#ifndef _H_REGEX
#define _H_REGEX 1 /* This one is for AIX */
#endif
-#else
+#elif REGEX == 0
#include <regex.h>
#endif
--- /dev/null
+
+#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
/* utility definitions */
+
+#include "regex_extra.h"
+
#ifdef _POSIX2_RE_DUP_MAX
#define DUPMAX _POSIX2_RE_DUP_MAX
#else
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)
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)
#define UNBLOCK_INTERRUPTIONS unblock_alarms
#endif
+#if REGEX == 1 || REGEX == 0
+#include "regex/regex_extra.h"
+#endif
+
#if HAVE_PWD_H
# if WIN32||WINNT
#include "win32/pwd.h"
#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 */
#ifndef _H_REGEX
#define _H_REGEX 1 /* This one is for AIX */
#endif
-#else
+#elif REGEX == 0
#include <regex.h>
#endif
--- /dev/null
+
+#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
/* utility definitions */
+
+#include "regex_extra.h"
+
#ifdef _POSIX2_RE_DUP_MAX
#define DUPMAX _POSIX2_RE_DUP_MAX
#else
XML_INCLUDE="$APXS_INCLUDEDIR/xml"
fi
AC_ADD_INCLUDE($APXS_INCLUDEDIR)
- if test -n "`$APXS -q CFLAGS | grep USE_HSREGEX`"; then
- HSREGEX=yes
- else
- HSREGEX=no
- fi
PHP_EXTENSION(apache)
PHP_SAPI=apache
APACHE_INSTALL="$APXS -i -a -n php4 $SAPI_SHARED"
fi
# For Apache 1.3.x
elif test -f $withval/src/main/httpd.h; then
+ APACHE_HAS_REGEX=1
APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
APACHE_TARGET=$withval/src/modules/php4
if test ! -d $APACHE_TARGET; then
fi
# Also for Apache 1.3.x
elif test -f $withval/src/include/httpd.h; then
+ APACHE_HAS_REGEX=1
APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
APACHE_TARGET=$withval/src/modules/php4
if test -d $withval/src/lib/expat-lite ; then
AC_MSG_RESULT(no)
])
+if test "$with_regex" = "apache" && test -z "$APACHE_HAS_REGEX"; then
+ with_regex=php
+fi
+
+if test -z "$with_regex" && test -n "$APACHE_HAS_REGEX"; then
+ with_regex=apache
+fi
+
if test -n "$APACHE_MODULE"; then
- HSREGEX=no
+ if test "$with_regex" = "apache"; then
+ APACHE_WANT_HSREGEX=yes
+ else
+ APACHE_WANT_HSREGEX=no
+ fi
+ AC_SUBST(APACHE_WANT_HSREGEX)
PHP_EXTENSION(apache)
PHP_OUTPUT(sapi/apache/libphp4.module)
PHP_BUILD_STATIC
Name: php4_module
ConfigStart
- RULE_WANTHSREGEX=@HSREGEX@
+ RULE_WANTHSREGEX=@APACHE_WANT_HSREGEX@
LIBS="@NATIVE_RPATHS@ @PHP_LIBS@ @EXTRA_LIBS@ @LIBS@ $LIBS"
RULE_HIDE=yes
CFLAGS="$CFLAGS -I@abs_srcdir@ -I@abs_srcdir@/libzend -I@abs_builddir@/libzend -I@abs_builddir@"