[mapserver-commits] r9153 - in trunk/mapserver: . mapscript/php3

svn at osgeo.org svn at osgeo.org
Wed Jul 8 10:37:28 EDT 2009


Author: aboudreault
Date: 2009-07-08 10:37:28 -0400 (Wed, 08 Jul 2009)
New Revision: 9153

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/configure
   trunk/mapserver/configure.in
   trunk/mapserver/mapregex.h
   trunk/mapserver/mapscript/php3/Makefile.in
   trunk/mapserver/mapscript/php3/php_mapscript_util.h
   trunk/mapserver/mapscript/php3/php_regex.c
Log:
Fixed PHP/Mapscript to support PHP 5.3 (#3065, #3066)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/HISTORY.TXT	2009-07-08 14:37:28 UTC (rev 9153)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- Fixed PHP/Mapscript to support PHP 5.3 (#3065, #3066)
+
 - remove -O optimization flags to configure script if configured
   with --enable-debug
 

Modified: trunk/mapserver/configure
===================================================================
--- trunk/mapserver/configure	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/configure	2009-07-08 14:37:28 UTC (rev 9153)
@@ -13308,17 +13308,27 @@
             test -f "$PHP_SRC_DIR/regex/regex_extra.h" && PHP_NO_SOURCE="1"
         if test -n "$PHP_NO_SOURCE" ; then
                     USE_PHP_REGEX="-DUSE_PHP_REGEX"
+          PHP_REGEX_INC="$PHP_SRC_DIR/"
           PHP_REGEX_OBJ=php_regex.o
           { echo "$as_me:$LINENO: result:         found regex_extra.h - building PHP MapScript with PHP's bundled regex " >&5
 echo "${ECHO_T}        found regex_extra.h - building PHP MapScript with PHP's bundled regex " >&6; }
         else
-          { { echo "$as_me:$LINENO: error:
-!!! PHP uses its bundled regex library but regex/regex_extra.h cannot be !!!
-!!! found.                                                               !!!" >&5
+                    test -f "$PHP_SRC_DIR/ext/ereg/regex/regex.h" && PHP_NO_SOURCE="1"
+          if test -n "$PHP_NO_SOURCE" ; then
+                    USE_PHP_REGEX="-DUSE_PHP_REGEX"
+          PHP_REGEX_INC="$PHP_SRC_DIR/ext/ereg/"
+          PHP_REGEX_OBJ=php_regex.o
+          { echo "$as_me:$LINENO: result:         found regex.h - building PHP MapScript with PHP's bundled regex " >&5
+echo "${ECHO_T}        found regex.h - building PHP MapScript with PHP's bundled regex " >&6; }
+          else
+            { { echo "$as_me:$LINENO: error:
+!!! PHP uses its bundled regex library but regex/regex_extra.h (PHP <=5.2) or !!!
+!!! ext/ereg/regex/regex.h (PHP >=5.3) cannot be found.                                  !!!" >&5
 echo "$as_me: error:
-!!! PHP uses its bundled regex library but regex/regex_extra.h cannot be !!!
-!!! found.                                                               !!!" >&2;}
+!!! PHP uses its bundled regex library but regex/regex_extra.h (PHP <=5.2) or !!!
+!!! ext/ereg/regex/regex.h (PHP >=5.3) cannot be found.                                  !!!" >&2;}
    { (exit 1); exit 1; }; }
+          fi
 	fi
 
   else

Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/configure.in	2009-07-08 14:37:28 UTC (rev 9153)
@@ -2487,12 +2487,23 @@
         if test -n "$PHP_NO_SOURCE" ; then
           dnl Found regex_extra.h
           USE_PHP_REGEX="-DUSE_PHP_REGEX"
+          PHP_REGEX_INC="$PHP_SRC_DIR/"
           PHP_REGEX_OBJ=php_regex.o
           AC_MSG_RESULT([        found regex_extra.h - building PHP MapScript with PHP's bundled regex ])
         else
-          AC_MSG_ERROR([
-!!! PHP uses its bundled regex library but regex/regex_extra.h cannot be !!!
-!!! found.                                                               !!!])
+          dnl PHP 5.3 changed the layout of regex-related files.
+          test -f "$PHP_SRC_DIR/ext/ereg/regex/regex.h" && PHP_NO_SOURCE="1"
+          if test -n "$PHP_NO_SOURCE" ; then
+          dnl Found regex.h
+          USE_PHP_REGEX="-DUSE_PHP_REGEX"
+          PHP_REGEX_INC="$PHP_SRC_DIR/ext/ereg/"
+          PHP_REGEX_OBJ=php_regex.o
+          AC_MSG_RESULT([        found regex.h - building PHP MapScript with PHP's bundled regex ])
+          else
+            AC_MSG_ERROR([
+!!! PHP uses its bundled regex library but regex/regex_extra.h (PHP <=5.2) or !!!
+!!! ext/ereg/regex/regex.h (PHP >=5.3) cannot be found.                                  !!!])
+          fi
 	fi
 
   else

Modified: trunk/mapserver/mapregex.h
===================================================================
--- trunk/mapserver/mapregex.h	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/mapregex.h	2009-07-08 14:37:28 UTC (rev 9153)
@@ -38,6 +38,8 @@
   /* === regex2.h === */
 #ifdef WIN32
 #define API_EXPORT(type)    __declspec(dllexport) type __stdcall
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#define API_EXPORT(type)    __attribute__ ((visibility("default"))) type
 #else
 #define API_EXPORT(type)    type
 #endif

Modified: trunk/mapserver/mapscript/php3/Makefile.in
===================================================================
--- trunk/mapserver/mapscript/php3/Makefile.in	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/mapscript/php3/Makefile.in	2009-07-08 14:37:28 UTC (rev 9153)
@@ -54,7 +54,7 @@
 # uses the same version of the REGEX library that PHP was compiled with:
 #
 PHP_REGEX_OBJ=@PHP_REGEX_OBJ@
-PHP_REGEX_INC=@PHP_REGEX_INC@
+PHP_REGEX_INC=-I at PHP_REGEX_INC@
 
 
 #

Modified: trunk/mapserver/mapscript/php3/php_mapscript_util.h
===================================================================
--- trunk/mapserver/mapscript/php3/php_mapscript_util.h	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/mapscript/php3/php_mapscript_util.h	2009-07-08 14:37:28 UTC (rev 9153)
@@ -44,6 +44,11 @@
 #define TSRMLS_CC
 #endif
 
+/* PHP >=5.3 replaced ZVAL_DELREF by Z_DELREF */
+#if ZEND_MODULE_API_NO >= 20090626
+#define ZVAL_DELREF Z_DELREF
+#define ZVAL_ADDREF Z_ADDREF
+#endif
 
 /**********************************************************************
  *                  macros for setting object properties

Modified: trunk/mapserver/mapscript/php3/php_regex.c
===================================================================
--- trunk/mapserver/mapscript/php3/php_regex.c	2009-07-08 14:35:23 UTC (rev 9152)
+++ trunk/mapserver/mapscript/php3/php_regex.c	2009-07-08 14:37:28 UTC (rev 9153)
@@ -54,8 +54,15 @@
 
 #include "mapregex.h"
 
+/* regex_extra.h doesn't exist in PHP >=5.3 */
+#include "php.h"
+
+#if ZEND_MODULE_API_NO < 20090626
 #include "regex/regex_extra.h"
 #include "regex/regex.h"
+#else
+#include "php_regex.h"
+#endif
 
 
 
@@ -77,8 +84,8 @@
   /*This next line only works because we know that regmatch_t
     and ms_regmatch_t are exactly alike (POSIX STANDARD)*/
   return regexec((const regex_t*)(regex->sys_regex), 
-	       string, nmatch, 
-	       (regmatch_t*) pmatch, eflags);
+                 string, nmatch, 
+                 (regmatch_t*) pmatch, eflags);
 }
 
 API_EXPORT(void) ms_regfree(ms_regex_t *regex)



More information about the mapserver-commits mailing list