--- configure.in 2005-08-24 17:55:08.000000000 +0200 +++ configure.in 2005-10-17 12:21:46.000000000 +0200 @@ -1826,18 +1826,30 @@ dnl --------------------------------------------------------------------- AC_CHECKING(for PHP/MapScript module options) -AC_ARG_WITH(php, -[ --with-php=DIR Specify directory where PHP4's include files are +AC_ARG_WITH(php4, +[ --with-php4=DIR Specify directory where PHP4's include files are installed (or a pointer to the full source tree) Required in order to compile the PHP/MapScript module.],,) -AC_ARG_WITH(php-regex-dir, -[ --with-php-regex-dir=DIR (deprecated in version 4.6+) +AC_ARG_WITH(php4-regex-dir, +[ --with-php4-regex-dir=DIR (deprecated in version 4.6+) Specify directory where the PHP4 bundled REGEX object files (regex/*.o) are available. Required in order to compile the PHP/MapScript module with PHP configured as a DSO.],,) +AC_ARG_WITH(php5, +[ --with-php5=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.],,) + +AC_ARG_WITH(php5-regex-dir, +[ --with-php5-regex-dir=DIR (deprecated in version 4.6+) + Specify directory where the PHP5 bundled REGEX + object files (regex/*.o) are available. Required in + order to compile the PHP/MapScript module with PHP + configured as a DSO.],,) AC_ARG_ENABLE(internal-ld-detect, [ --enable-perlv-ld-detect (applies to --with-php only) @@ -1845,8 +1857,11 @@ link php_mapscript.so. Try this only if the default internal macro didn't work.],,) -if test -n "$with_php" -a -d "$with_php" ; then - AC_EXPAND_PATH($with_php, PHP_SRC_DIR) + +dnl --------------------------------------------------------------------- +dnl No php version specific +dnl --------------------------------------------------------------------- +if test -n "$with_php5" -o -n "$with_php4" ; then dnl dnl Checks for shared library linking. dnl @@ -1857,7 +1872,7 @@ dnl if test "$enable_perlv_ld_detect" = "yes" ; then - AC_MSG_RESULT(Using perl -V macro to figure ld command to link php_mapscript.so) + AC_MSG_RESULT(Using perl -V macro to figure ld command to link php5_mapscript.so) AC_MSG_CHECKING([whether 'perl -V' works]) if (perl -V > /dev/null 2>&1) ; then @@ -1878,6 +1893,140 @@ PHP_LD="$LD_SHARED" fi +fi + + +dnl --------------------------------------------------------------------- +dnl php version specific +dnl --------------------------------------------------------------------- +if test -n "$with_php5" -a -d "$with_php5" ; then + AC_EXPAND_PATH($with_php5, PHP5_SRC_DIR) + + dnl + dnl Look for php_config.h. + dnl We'll need the config file to find info about the PHP configuration + dnl + AC_MSG_CHECKING([for location of PHP5's config.h or php_config.h]) + dnl Starting with PHP 5, it's php-5.x.x/main/php_config.h + test -f "$PHP5_SRC_DIR/main/php_config.h" && PHP5_CONFIG_H="$PHP5_SRC_DIR/main/php_config.h" + + dnl If php was installed, then the headers are under $prefix/include/php/* + test -f "$PHP5_SRC_DIR/include/php/main/php_config.h" && PHP5_SRC_DIR="$PHP5_SRC_DIR/include/php/" && PHP5_CONFIG_H="$PHP5_SRC_DIR/main/php_config.h" + + if test -n "$PHP5_CONFIG_H" ; then + AC_MSG_RESULT([found]) + else + AC_MSG_ERROR([ +!!! Could not find php_config.h in $PHP5_SRC_DIR. !!! +!!! Has PHP5 been configured yet? !!!]) + fi + + AC_MSG_CHECKING([whether we have PHP4 or PHP5]) + if test -n "`grep 'ZEND_API' $PHP5_CONFIG_H`" ; then + PHP5_VERSION_FLAG="-DPHP4" + else + PHP5_VERSION_FLAG="-DPHP3" + AC_MSG_ERROR([ +!!! PHP MapScript now requires PHP 4.1.2 or more recent. !!!]) + fi + AC_MSG_RESULT([$PHP5_VERSION_FLAG]) + + dnl + dnl Check if PHP5 was compiled with the bundled regex, and if so then + dnl use the same version to compile MapServer. + dnl + AC_MSG_CHECKING([whether we should use PHP5's regex]) + if test -n "`grep 'define REGEX 1' $PHP5_CONFIG_H`" ; then + AC_MSG_RESULT(yes) + + if test -n "$with_php5_regex_dir" -a -d "$with_php5_regex_dir" ; then + dnl + dnl try to locate regex source under the --with-regex-dir=value + dnl + AC_EXPAND_PATH($with_php5_regex_dir, WITH_PHP5_REGEX_DIR) + + test -f $WITH_PHP5_REGEX_DIR/regcomp.o && PHP5_REGEX_DIR="$WITH_PHP5_REGEX_DIR" + test -z "$PHP5_REGEX_DIR" -a -f $WITH_PHP5_REGEX_DIR/regex/regcomp.c && PHP5_REGEX_DIR="$WITH_PHP5_REGEX_DIR/regex" + else + dnl + dnl try to locate regex source under the PHP4 directory + dnl + test -f $PHP5_SRC_DIR/regex/regcomp.o && PHP5_REGEX_DIR="$PHP5_SRC_DIR/regex" + fi + + if test -n "$PHP5_REGEX_DIR" ; then + dnl + dnl found it! + dnl + USE_PHP5_REGEX="-DUSE_PHP_REGEX" + PHP5_REGEX_INC="-I$PHP5_REGEX_DIR/.." + PHP5_REGEX_OBJ="$PHP5_REGEX_DIR/regcomp.o $PHP5_REGEX_DIR/regerror.o \ + $PHP5_REGEX_DIR/regexec.o $PHP5_REGEX_DIR/regfree.o" + ALL_INC="$PHP5_REGEX_INC $ALL_INC" + + AC_MSG_RESULT([ * using PHP5 regex source from $PHP5_REGEX_DIR]) + else + dnl We'll check for regex_extra.h - that might let use build + dnl without the source using libphp_common.so + test -f "$PHP5_SRC_DIR/regex/regex_extra.h" && PHP5_NO_SOURCE="1" + if test -n "$PHP5_NO_SOURCE" ; then + dnl Found regex_extra.h + USE_PHP5_REGEX="-DUSE_PHP5_REGEX" + PHP5_REGEX_OBJ=php_regex.o + AC_SUBST(PHP5_REGEX_INC,$PHP5_REGEX_INC) + AC_SUBST(PHP5_REGEX_OBJ,$PHP5_REGEX_OBJ) + AC_MSG_RESULT([ found regex_extra.h - trying to build without PHP5 source]) + else + AC_MSG_ERROR([ +!!! You PHP5 was compiled with PHP5's bundled regex library. !!! +!!! In this case MapServer and PHP MapScript must also be compiled !!! +!!! using the same copy of regex. !!! +!!! There are two possible ways to get rid of this error: !!! +!!! 1- Download/extract and build the PHP5 source on your system (no need !!! +!!! to 'make install') and use the --with-php5-regex-dir=DIR configure !!! +!!! option to specifiy the location of the PHP5 source tree where the !!! +!!! regex/*.o files are located. This is the only way to build !!! +!!! PHP MapScript in an environment where PHP5 is configured as an !!! +!!! Apache DSO. !!! +!!! 2- Try to re-configure and re-compile PHP4 using --with-regex=system !!! +!!! and then re-configure and re-compile MapServer. !!! +!!! Note that PHP5's --with-regex=system works only when PHP5 is !!! +!!! is configured as a CGI (that is without the --with-apxs and !!! +!!! --with-httpd options). So if you configured your PHP4 using !!! +!!! --with-regex=system and still get this error then make sure you !!! +!!! configured PHP5 as a CGI. !!!]) + fi + fi + + else + AC_MSG_RESULT(no) + fi + + PHP5MS_MAKEFILE=mapscript/php5/Makefile + MAKE_PHP5MS=php5_mapscript + MAKE_PHP5MS_CLEAN=php5_mapscript_clean + + AC_SUBST(PHP5_VERSION_FLAG, $PHP5_VERSION_FLAG) + AC_SUBST(PHP5_SRC_DIR, $PHP5_SRC_DIR) + AC_SUBST(PHP_CC, $PHP_CC) + AC_SUBST(PHP_LD, $PHP_LD) + AC_SUBST(PHP5_REGEX_INC, $PHP5_REGEX_INC) + AC_SUBST(PHP5_REGEX_OBJ, $PHP5_REGEX_OBJ) + AC_SUBST(USE_PHP5_REGEX, $USE_PHP5_REGEX) + + AC_MSG_RESULT([ * PHP5/MapScript module configured.]) +elif test -n "$with_php5" -a "$with_php5" != "no" ; then + AC_MSG_ERROR([Missing or invalid PHP5 source directory in --with-php5=DIR.]) +else + AC_MSG_RESULT([ * PHP5/MapScript module not configured.]) +fi +AC_SUBST(MAKE_PHP5MS, $MAKE_PHP5MS) +AC_SUBST(MAKE_PHP5MS_CLEAN, $MAKE_PHP5MS_CLEAN) + + +if test -n "$with_php4" -a -d "$with_php4" ; then + AC_EXPAND_PATH($with_php4, PHP_SRC_DIR) + dnl dnl Look for PHP3's config.h or PHP4's php_config.h. dnl We'll need the config file to find info about the PHP configuration @@ -1905,16 +2054,15 @@ 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 Default is PHP3, and if ZEND_API is set then we assume that we have PHP. dnl - AC_MSG_CHECKING([whether we have PHP3 or PHP4]) + AC_MSG_CHECKING([whether we have PHP3 or PHP]) if test -n "`grep 'ZEND_API' $PHP_CONFIG_H`" ; then PHP_VERSION_FLAG="-DPHP4" else PHP_VERSION_FLAG="-DPHP3" 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 4.1.2 or more recent. !!!]) fi AC_MSG_RESULT([$PHP_VERSION_FLAG]) @@ -1922,21 +2070,21 @@ dnl Check if PHP was compiled with the bundled regex, and if so then dnl use the same version to compile MapServer. dnl - AC_MSG_CHECKING([whether we should use PHP's regex]) + AC_MSG_CHECKING([whether we should use PHP4's regex]) if test -n "`grep 'define REGEX 1' $PHP_CONFIG_H`" ; then AC_MSG_RESULT(yes) - if test -n "$with_php_regex_dir" -a -d "$with_php_regex_dir" ; then + if test -n "$with_php4_regex_dir" -a -d "$with_php4_regex_dir" ; then dnl dnl try to locate regex source under the --with-regex-dir=value dnl - AC_EXPAND_PATH($with_php_regex_dir, WITH_PHP_REGEX_DIR) + AC_EXPAND_PATH($with_php4_regex_dir, WITH_PHP_REGEX_DIR) test -f $WITH_PHP_REGEX_DIR/regcomp.o && PHP_REGEX_DIR="$WITH_PHP_REGEX_DIR" test -z "$PHP_REGEX_DIR" -a -f $WITH_PHP_REGEX_DIR/regex/regcomp.c && PHP_REGEX_DIR="$WITH_PHP_REGEX_DIR/regex" else dnl - dnl try to locate regex source under the PHP directory + dnl try to locate regex source under the PHP4 directory dnl test -f $PHP_SRC_DIR/regex/regcomp.o && PHP_REGEX_DIR="$PHP_SRC_DIR/regex" fi @@ -1975,7 +2123,7 @@ !!! regex/*.o files are located. This is the only way to build !!! !!! PHP MapScript in an environment where PHP is configured as an !!! !!! Apache DSO. !!! -!!! 2- Try to re-configure and re-compile PHP4 using --with-regex=system !!! +!!! 2- Try to re-configure and re-compile PHP using --with-regex=system !!! !!! and then re-configure and re-compile MapServer. !!! !!! Note that PHP's --with-regex=system works only when PHP is !!! !!! is configured as a CGI (that is without the --with-apxs and !!! @@ -2001,17 +2149,17 @@ AC_SUBST(PHP_REGEX_OBJ, $PHP_REGEX_OBJ) AC_SUBST(USE_PHP_REGEX, $USE_PHP_REGEX) - AC_MSG_RESULT([ PHP/MapScript module configured.]) + AC_MSG_RESULT([ * PHP/MapScript module configured.]) elif test -n "$with_php" -a "$with_php" != "no" ; then AC_MSG_ERROR([Missing or invalid PHP source directory in --with-php=DIR.]) else - AC_MSG_RESULT([ PHP/MapScript module not configured.]) + AC_MSG_RESULT([ * PHP/MapScript module not configured.]) fi + AC_SUBST(MAKE_PHPMS, $MAKE_PHPMS) AC_SUBST(MAKE_PHPMS_CLEAN, $MAKE_PHPMS_CLEAN) - dnl --------------------------------------------------------------------- dnl 'apxs' option for PHP built as an Apache module (libphp3.so) dnl --with-apxs[=FILE] should be the exact same value that was passed @@ -2033,8 +2181,8 @@ if test -n "$with_apxs" -a "$with_apxs" != "no" ; then AC_MSG_ERROR([ -!!! The current version of PHP MapScript requires PHP4 configured as !!! -!!! a CGI and cannot be used with PHP4 configured as an Apache module,!!! +!!! The current version of PHP MapScript requires PHP configured as !!! +!!! a CGI and cannot be used with PHP configured as an Apache module,!!! !!! so you cannot use the --with-apxs option. !!! !!! See: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI !!!]) @@ -2073,8 +2221,8 @@ if test -n "$with_apache" -a "$with_apache" != "no" ; then AC_MSG_ERROR([ -!!! The current version of PHP MapScript requires PHP4 configured as !!! -!!! a CGI and cannot be used with PHP4 configured as an Apache module,!!! +!!! The current version of PHP MapScript requires PHP configured as !!! +!!! a CGI and cannot be used with PHP configured as an Apache module,!!! !!! so you cannot use the --with-apache option. !!! !!! See: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI !!!]) @@ -2127,5 +2275,5 @@ AC_SUBST(ALL_STATIC_LIB, $ALL_STATIC_LIB) AC_SUBST(RPATHS, [$RPATHS]) -AC_OUTPUT(Makefile $PHPMS_MAKEFILE mapscript/java/Makefile) +AC_OUTPUT(Makefile $PHP5MS_MAKEFILE $PHPMS_MAKEFILE mapscript/java/Makefile) --- Makefile.in 2005-08-24 17:55:08.000000000 +0200 +++ Makefile.in 2005-10-15 12:20:55.000000000 +0200 @@ -164,6 +164,8 @@ # PHP_REGEX_OBJ=@PHP_REGEX_OBJ@ PHP_REGEX_INC=@PHP_REGEX_INC@ +PHP5_REGEX_OBJ=@PHP5_REGEX_OBJ@ +PHP5_REGEX_INC=@PHP5_REGEX_INC@ # # Multithreading support. @@ -202,7 +204,7 @@ $(IGNORE_MISSING_DATA) $(USE_POINT_Z_M) $(STRINGS) $(EPPL) $(PROJ) \ $(OWS) $(MING) $(ORACLESPATIAL) $(TIFF) $(JPEG) $(GD) $(PDF) $(SDE) \ $(SDERASTER) $(OGR) $(GDAL) $(GEOS) $(ICONV) $(FASTCGI) $(PHP_REGEX) \ - $(REGEX_INC) $(POSTGIS) $(MYGIS) $(MPATROL) $(THREAD) $(ZLIB) \ + $(PHP5_REGEX) $(REGEX_INC) $(POSTGIS) $(MYGIS) $(MPATROL) $(THREAD) $(ZLIB) \ $(GD_INC) $(PDF_INC) $(PROJ_INC) $(TIFF_INC) $(JPEG_INC) $(EGIS_INC) \ $(SDE_INC) $(MPATROL_INC) $(GDAL_INC) $(POSTGIS_INC) $(MYGIS_INC) \ $(CURL_INC) $(MING_INC) $(ORACLESPATIAL_INC) $(GEOS_INC) $(ICONV_INC) \ @@ -239,7 +241,10 @@ .cpp.o: $(CXX) -c $(CXXFLAGS) $< -o $@ -all: $(MAKE_GD) libmap.a $(EXTRA_DEFAULT) $(EXE_LIST) @MAKE_PHPMS@ +all: $(MAKE_GD) libmap.a $(EXTRA_DEFAULT) $(EXE_LIST) @MAKE_PHPMS@ @MAKE_PHP5MS@ + +php5_mapscript:: $(LIBMAP_STATIC) + cd mapscript/php5; $(MAKE); cd ../.. php3_mapscript:: $(LIBMAP_STATIC) cd mapscript/php3; $(MAKE); cd ../.. --- mapscript/php5/Makefile.in 2005-05-25 23:02:06.000000000 +0200 +++ mapscript/php5/Makefile.in 2005-10-17 12:27:30.000000000 +0200 @@ -35,26 +35,26 @@ CC = @PHP_CC@ LD = @PHP_LD@ -CFLAGS = @CFLAGS@ @USE_PHP_REGEX@ -DCOMPILE_DL=1 @PHP_VERSION_FLAG@ +CFLAGS = @CFLAGS@ @USE_PHP5_REGEX@ -DCOMPILE_DL=1 @PHP5_VERSION_FLAG@ RUNPATHS= @RPATHS@ # -# Set PHP_SRC_DIR to point to the root of the PHP source tree +# Set PHP5_SRC_DIR to point to the root of the PHP5 source tree # -PHP_SRC_DIR = @PHP_SRC_DIR@ +PHP5_SRC_DIR = @PHP5_SRC_DIR@ -PHP_INC = -I$(PHP_SRC_DIR) -I$(PHP_SRC_DIR)/dl -I$(PHP_SRC_DIR)/main \ - -I$(PHP_SRC_DIR)/Zend -I$(PHP_SRC_DIR)/include \ - -I$(PHP_SRC_DIR)/TSRM @APACHE_INC@ +PHP5_INC = -I$(PHP5_SRC_DIR) -I$(PHP5_SRC_DIR)/dl -I$(PHP5_SRC_DIR)/main \ + -I$(PHP5_SRC_DIR)/Zend -I$(PHP5_SRC_DIR)/include \ + -I$(PHP5_SRC_DIR)/TSRM @APACHE_INC@ # -# IMPORTANT NOTE ABOUT REGEX FOR PHP_MAPSCRIPT USERS: +# IMPORTANT NOTE ABOUT REGEX FOR PHP5_MAPSCRIPT USERS: # -# In order to compile the PHP_MAPSCRIPT module, we have to make MapServer -# uses the same version of the REGEX library that PHP was compiled with: +# In order to compile the PHP5_MAPSCRIPT module, we have to make MapServer +# uses the same version of the REGEX library that PHP5 was compiled with: # -PHP_REGEX_OBJ=@PHP_REGEX_OBJ@ -PHP_REGEX_INC=@PHP_REGEX_INC@ +PHP5_REGEX_OBJ=@PHP5_REGEX_OBJ@ +PHP5_REGEX_INC=@PHP5_REGEX_INC@ # @@ -75,20 +75,20 @@ # The rest of the file should not have to be edited... # -CFLAGS112 = $(CFLAGS) $(MS_DEFINE) $(MS_INC) $(PHP_INC) $(PHP_REGEX_INC) +CFLAGS112 = $(CFLAGS) $(MS_DEFINE) $(MS_INC) $(PHP5_INC) $(PHP5_REGEX_INC) all: php_mapscript.so -PHPMS_OBJS = php_mapscript_util.o php_mapscript.o mapscript_i.o $(PHP_REGEX_OBJ) +PHP5MS_OBJS = php_mapscript_util.o php_mapscript.o mapscript_i.o $(PHP5_REGEX_OBJ) -PHPPROJ_OBJS = php_mapscript_util.o php_proj.o $(PHP_REGEX_OBJ) +PHP5PROJ_OBJS = php_mapscript_util.o php_proj.o $(PHP5_REGEX_OBJ) -php_mapscript.so: $(PHPMS_OBJS) ../../libmap.a - $(LD) -o $@ $(PHPMS_OBJS) $(MS_LIBS) +php_mapscript.so: $(PHP5MS_OBJS) ../../libmap.a + $(LD) -o $@ $(PHP5MS_OBJS) $(MS_LIBS) -php_proj.so: $(PHPPROJ_OBJS) - $(LD) -o $@ $(PHPPROJ_OBJS) $(MS_LIBS) +php_proj.so: $(PHP5PROJ_OBJS) + $(LD) -o $@ $(PHP5PROJ_OBJS) $(MS_LIBS) %.o: %.c php_mapscript_util.h php_mapscript.h $(CC) $(CFLAGS112) -c -o $@ $< --- mapscript/php3/php_mapscript.c 2005-06-14 18:03:35.000000000 +0200 +++ mapscript/php3/php_mapscript.c 2005-10-17 12:11:31.000000000 +0200 @@ -6003,7 +6003,7 @@ retVal = 0; -#ifdef PHP4 +#ifdef PHP3 php_header(TSRMLS_C); #else php_header();