[mapserver-commits] r9937 - in trunk/mapserver: . mapscript/php

svn at osgeo.org svn at osgeo.org
Thu Mar 11 10:17:39 EST 2010


Author: aboudreault
Date: 2010-03-11 10:17:39 -0500 (Thu, 11 Mar 2010)
New Revision: 9937

Modified:
   trunk/mapserver/configure
   trunk/mapserver/configure.in
   trunk/mapserver/mapscript/php/php_proj.c
Log:
Modified configure to support php 5.2.0 or more recent

Modified: trunk/mapserver/configure
===================================================================
--- trunk/mapserver/configure	2010-03-11 14:02:17 UTC (rev 9936)
+++ trunk/mapserver/configure	2010-03-11 15:17:39 UTC (rev 9937)
@@ -932,7 +932,7 @@
   --with-fastcgi=path     Enable FastCGI, point to installed tree.
   --with-httpd            Specify path to 'httpd' executable.
   --with-warnings[=flags] Enable strict warnings (or user defined warnings)
-  --with-php=DIR          Specify directory where PHP4's include files are
+  --with-php=DIR          Specify directory where PHP5's include files are
                           installed (or a pointer to the full source tree)
                           Required in order to compile the PHP/MapScript
                           module.
@@ -12996,16 +12996,11 @@
     PHP_LD="$PHP_LD_SHARED $PHP_LD_XTRAFLAGS"
   fi
 
-          echo "$as_me:$LINENO: checking for location of config.h or php_config.h" >&5
-echo $ECHO_N "checking for location of config.h or php_config.h... $ECHO_C" >&6
-    test -f "$PHP_SRC_DIR/config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/config.h"
+          echo "$as_me:$LINENO: checking for location of php_config.h" >&5
+echo $ECHO_N "checking for location of php_config.h... $ECHO_C" >&6
+    test -f "$PHP_SRC_DIR/main/php_config.h" && test -f "$PHP_SRC_DIR/main/php_version.h"  && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
 
-    test -f "$PHP_SRC_DIR/php_config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/php_config.h"
-
-    test -f "$PHP_SRC_DIR/main/php_config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
-
     test -f "$PHP_SRC_DIR/include/php/main/php_config.h" && PHP_SRC_DIR="$PHP_SRC_DIR/include/php/" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
-
     test -f "$PHP_SRC_DIR/include/php5/main/php_config.h" && PHP_SRC_DIR="$PHP_SRC_DIR/include/php5/" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
 
   if test -n "$PHP_CONFIG_H" ; then
@@ -13013,27 +13008,31 @@
 echo "${ECHO_T}$PHP_CONFIG_H" >&6
   else
     { { echo "$as_me:$LINENO: error:
-!!! Could not find config.h or php_config.h in $PHP_SRC_DIR.          !!!
+!!! Could not find php_config.h and php_version.h in $PHP_SRC_DIR.          !!!
 !!! Has PHP been configured yet?                                      !!!" >&5
 echo "$as_me: error:
-!!! Could not find config.h or php_config.h in $PHP_SRC_DIR.          !!!
+!!! Could not find php_config.h and php_version.h in $PHP_SRC_DIR.          !!!
 !!! Has PHP been configured yet?                                      !!!" >&2;}
    { (exit 1); exit 1; }; }
   fi
 
-          echo "$as_me:$LINENO: checking whether we have PHP3 or PHP4" >&5
-echo $ECHO_N "checking whether we have PHP3 or PHP4... $ECHO_C" >&6
-  if test -n "`grep 'ZEND_API' $PHP_CONFIG_H`"  ; then
-    PHP_VERSION_FLAG="-DPHP4"
-  else
-    PHP_VERSION_FLAG="-DPHP3"
+
+        echo "$as_me:$LINENO: checking if we have PHP 5.2.0+" >&5
+echo $ECHO_N "checking if we have PHP 5.2.0+... $ECHO_C" >&6
+  PHP_VERSION=`grep 'PHP_VERSION_ID' $PHP_SRC_DIR/main/php_version.h | cut -d' ' -f3`
+  if test -z "$PHP_VERSION" || test $PHP_VERSION -lt 50200; then
     { { echo "$as_me:$LINENO: error:
-!!! PHP MapScript now requires PHP 4.1.2 or more recent.              !!!
-!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!" >&5
+!!! PHP MapScript now requires PHP 5.2.0 or more recent.              !!!
+!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!
+!!! Support for PHP4 has been dropped after MapServer version 5.6.    !!!" >&5
 echo "$as_me: error:
-!!! PHP MapScript now requires PHP 4.1.2 or more recent.              !!!
-!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!" >&2;}
+!!! PHP MapScript now requires PHP 5.2.0 or more recent.              !!!
+!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!
+!!! Support for PHP4 has been dropped after MapServer version 5.6.    !!!" >&2;}
    { (exit 1); exit 1; }; }
+  else
+     echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
   fi
   echo "$as_me:$LINENO: result: $PHP_VERSION_FLAG" >&5
 echo "${ECHO_T}$PHP_VERSION_FLAG" >&6

Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in	2010-03-11 14:02:17 UTC (rev 9936)
+++ trunk/mapserver/configure.in	2010-03-11 15:17:39 UTC (rev 9937)
@@ -2438,7 +2438,7 @@
 
 AC_CHECKING(for PHP/MapScript module options)
 AC_ARG_WITH(php,
-[  --with-php=DIR          Specify directory where PHP4's include files are
+[  --with-php=DIR          Specify directory where PHP5's include files are
                           installed (or a pointer to the full source tree)
                           Required in order to compile the PHP/MapScript 
                           module.],,)
@@ -2485,22 +2485,15 @@
   fi
 
   dnl
-  dnl Look for PHP3's config.h or PHP4's php_config.h.
+  dnl Look for PHP5's php_config.h.
   dnl We'll need the config file to find info about the PHP configuration
   dnl
-  AC_MSG_CHECKING([for location of config.h or php_config.h])
-  dnl In PHP3, it was called config.h
-  test -f "$PHP_SRC_DIR/config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/config.h"
+  AC_MSG_CHECKING([for location of php_config.h])
+  dnl Look for the main/php_config.h
+  test -f "$PHP_SRC_DIR/main/php_config.h" && test -f "$PHP_SRC_DIR/main/php_version.h"  && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
 
-  dnl In PHP 4.0.1 to 4.0.3, it was php-4.0.x/php_config.h
-  test -f "$PHP_SRC_DIR/php_config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/php_config.h"
-
-  dnl Starting with PHP 4.0.4, it's php-4.0.x/main/php_config.h
-  test -f "$PHP_SRC_DIR/main/php_config.h" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
-
   dnl If php was installed, then the headers are under $prefix/include/php/*
   test -f "$PHP_SRC_DIR/include/php/main/php_config.h" && PHP_SRC_DIR="$PHP_SRC_DIR/include/php/" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
-
   dnl In PHP 5, few distributions use "/usr/include/php5" directory
   test -f "$PHP_SRC_DIR/include/php5/main/php_config.h" && PHP_SRC_DIR="$PHP_SRC_DIR/include/php5/" && PHP_CONFIG_H="$PHP_SRC_DIR/main/php_config.h"
 
@@ -2508,22 +2501,23 @@
     AC_MSG_RESULT([$PHP_CONFIG_H])
   else
     AC_MSG_ERROR([
-!!! Could not find config.h or php_config.h in $PHP_SRC_DIR.          !!!
+!!! Could not find php_config.h and php_version.h in $PHP_SRC_DIR.          !!!
 !!! Has PHP been configured yet?                                      !!!])
   fi
 
-  dnl
+
   dnl Check which PHP version we're using.
   dnl Default is PHP3, and if ZEND_API is set then we assume that we have PHP4.
   dnl
-  AC_MSG_CHECKING([whether we have PHP3 or PHP4])
-  if test -n "`grep 'ZEND_API' $PHP_CONFIG_H`"  ; then
-    PHP_VERSION_FLAG="-DPHP4"
-  else
-    PHP_VERSION_FLAG="-DPHP3"
+  AC_MSG_CHECKING([if we have PHP 5.2.0+])
+  PHP_VERSION=`grep 'PHP_VERSION_ID' $PHP_SRC_DIR/main/php_version.h | cut -d' ' -f3`
+  if test -z "$PHP_VERSION" || test $PHP_VERSION -lt 50200; then
     AC_MSG_ERROR([
-!!! PHP MapScript now requires PHP 4.1.2 or more recent.              !!!
-!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!])
+!!! PHP MapScript now requires PHP 5.2.0 or more recent.              !!!
+!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!
+!!! Support for PHP4 has been dropped after MapServer version 5.6.    !!!])
+  else
+     AC_MSG_RESULT([yes])
   fi
   AC_MSG_RESULT([$PHP_VERSION_FLAG])
 

Modified: trunk/mapserver/mapscript/php/php_proj.c
===================================================================
--- trunk/mapserver/mapscript/php/php_proj.c	2010-03-11 14:02:17 UTC (rev 9936)
+++ trunk/mapserver/mapscript/php/php_proj.c	2010-03-11 15:17:39 UTC (rev 9937)
@@ -138,14 +138,8 @@
 #include <projects.h>
 #include "php_mapscript_util.h"
 
-#if defined (PHP4) || defined (PHP5)
 #include "php.h"
 #include "php_globals.h"
-#else
-#include "phpdl.h"
-#include "php3_list.h"
-#include "functions/head.h"   /* php3_header() */
-#endif
 
 #include "maperror.h"
 
@@ -157,9 +151,7 @@
 #include <errno.h>
 #endif
 
-#if defined (PHP4) || defined (PHP5)
 #define ZEND_DEBUG 0
-#endif
 
 #ifndef DLEXPORT
 #define DLEXPORT ZEND_DLEXPORT
@@ -190,9 +182,7 @@
 DLEXPORT void php_info_proj(void);
 #endif
 
-#if defined (PHP4) || defined (PHP5)
 static zend_class_entry *proj_class_entry_ptr;
-#endif
 
 #define PHPMS_GLOBAL(a) a
 static int le_projobj;
@@ -256,18 +246,14 @@
 
 DLEXPORT int php_init_proj(INIT_FUNC_ARGS)
 {
-#if defined (PHP4) || defined (PHP5)
     zend_class_entry tmp_class_entry;
-#endif
 
     PHPMS_GLOBAL(le_projobj)  =
         register_list_destructors(php_proj_pj_free,
                                   NULL);
 
-#if defined (PHP4) || defined (PHP5)
     INIT_CLASS_ENTRY(tmp_class_entry, "proj", php_proj_class_functions);
     proj_class_entry_ptr = zend_register_internal_class(&tmp_class_entry TSRMLS_CC);
-#endif
 
     return SUCCESS;
 }
@@ -332,12 +318,8 @@
 {
     pval        *pArrayOfParams = NULL;
 
-#if defined (PHP4) || defined (PHP5)
     pval        **pParam = NULL;
     HashTable   *list=NULL;
-#else
-    pval        *pParam = NULL;
-#endif
 
     int         nParamCount = 0;
     int         i = 0;
@@ -372,15 +354,9 @@
         if (_php3_hash_index_find(pArrayOfParams->value.ht, i,
                                   (void **)&pParam) != FAILURE)
         {
-#if defined (PHP4) || defined (PHP5)
             convert_to_string((*pParam));
             if ((*pParam)->value.str.val != NULL)
               papszBuf[i] = strdup((*pParam)->value.str.val);
-#else
-            convert_to_string(pParam);
-            if (pParam->value.str.val != NULL)
-              papszBuf[i] = strdup(pParam->value.str.val);
-#endif
         }
     }
      papszBuf[i] = NULL;
@@ -413,9 +389,7 @@
 /************************************************************************/
 DLEXPORT void php_proj_pj_fwd(INTERNAL_FUNCTION_PARAMETERS)
 {
-#if defined (PHP4) || defined (PHP5)
     HashTable   *list=NULL;
-#endif
     pval        *p1, *p2;
     pval        *pj = NULL;
     PJ          *popj = NULL;
@@ -483,9 +457,7 @@
 /************************************************************************/
 DLEXPORT void php_proj_pj_inv(INTERNAL_FUNCTION_PARAMETERS)
 {
-#if defined (PHP4) || defined (PHP5)
     HashTable   *list=NULL;
-#endif
     pval        *p1, *p2;
     pval        *pj = NULL;
     PJ          *popj = NULL;
@@ -543,9 +515,7 @@
 /************************************************************************/
 DLEXPORT void php_proj_pj_transform(INTERNAL_FUNCTION_PARAMETERS)
 {
-#if defined (PHP4) || defined (PHP5)
     HashTable   *list=NULL;
-#endif
     pval        *p1, *p2;
     pval        *pjin, *pjout = NULL;
     PJ          *in = NULL;
@@ -631,9 +601,7 @@
 /************************************************************************/
 DLEXPORT void php_proj_pj_datum_transform(INTERNAL_FUNCTION_PARAMETERS)
 {
-#if defined (PHP4) || defined (PHP5)
     HashTable   *list=NULL;
-#endif
     pval        *p1, *p2;
     pval        *pjin, *pjout = NULL;
     PJ          *in = NULL;
@@ -712,12 +680,9 @@
 /* ==================================================================== */
 /*      TODO : freeing does not work properly on PHP4.                  */
 /* ==================================================================== */
-#ifndef PHP4
+#ifdef PHP4_BAD_FREEING
 
-#if defined (PHP4) || defined (PHP5)
     HashTable   *list=NULL;
-#endif
-
     pval        *pj = NULL;
     PJ          *popj = NULL;
 /* -------------------------------------------------------------------- */



More information about the mapserver-commits mailing list