summaryrefslogtreecommitdiff
blob: fdc851fade4d2d02d753e2449fb88f8ef01273f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
diff -ru ./mapserver-4.10.0/Makefile.in ../mapserver-4.10.0/Makefile.in
--- ./mapserver-4.10.0/Makefile.in	2006-08-27 18:33:56.000000000 +0200
+++ ../mapserver-4.10.0/Makefile.in	2006-10-07 14:29:07.000000000 +0200
@@ -169,6 +169,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.
@@ -247,11 +249,14 @@
 .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@
 
 php3_mapscript:: $(LIBMAP_STATIC)
 	cd mapscript/php3; $(MAKE); cd ../..
 
+php5_mapscript:: $(LIBMAP_STATIC)
+	cd mapscript/php5; $(MAKE); cd ../..
+
 maplexer.o: maplexer.c map.h mapfile.h
 
 maplexer.c: maplexer.l
@@ -334,6 +339,9 @@
 php3_mapscript_clean::
 	cd mapscript/php3; $(MAKE) clean; cd ../..
 
+php5_mapscript_clean::
+	cd mapscript/php3; $(MAKE) clean; cd ../..
+
 install:
 	@echo ""
 	@echo "***** MapServer Installation *****"
@@ -354,7 +362,7 @@
 	(cd $(INST_BIN) && rm $(EXE_LIST) )
 	(cd $(INST_LIB) && rm $(LIBMAP_SH_VER) $(LIBMAP_SHARED) )
 
-clean: @MAKE_PHPMS_CLEAN@
+clean: @MAKE_PHPMS_CLEAN@ @MAKE_PHP5MS_CLEAN@
 	rm -f $(LIBMAP_STATIC) $(LIBMAP_SHARED) $(LIBMAP_SH_VER) *.o $(EXE_LIST)
 
 exe-clean:
Only in ../mapserver-4.10.0/: Makefile.in.orig
diff -ru ./mapserver-4.10.0/configure.in ../mapserver-4.10.0/configure.in
--- ./mapserver-4.10.0/configure.in	2006-08-28 16:09:23.000000000 +0200
+++ ../mapserver-4.10.0/configure.in	2006-10-07 14:34:44.000000000 +0200
@@ -1866,21 +1866,10 @@
 dnl PHP/MapScript module options
 dnl ---------------------------------------------------------------------
 
-AC_CHECKING(for PHP/MapScript module options)
-AC_ARG_WITH(php,
-[  --with-php=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_ENABLE(internal-ld-detect,
-[  --enable-perlv-ld-detect (applies to --with-php only) 
-                          Use perl -V output to figure the command to use to 
-                          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_php4" -o -n "$with_php5" ; then
   dnl
   dnl Checks for shared library linking.
   dnl
@@ -1889,7 +1878,6 @@
   dnl (The perl-V macro was the default in 3.6 and before but this was
   dnl  changed in 3.7 to use the internal AC_LD_SHARED macro by default)
   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)
 
@@ -1912,6 +1900,17 @@
     PHP_CC="$CC $C_PIC"
     PHP_LD="$PHP_LD_SHARED"
   fi
+fi
+
+AC_CHECKING(for PHP4/MapScript module options)
+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.],,)
+
+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.
@@ -2001,6 +2000,109 @@
 AC_SUBST(MAKE_PHPMS, $MAKE_PHPMS)
 AC_SUBST(MAKE_PHPMS_CLEAN, $MAKE_PHPMS_CLEAN)
 
+AC_CHECKING(for PHP5/MapScript module options)
+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.],,)
+
+if test -n "$with_php5" -a -d "$with_php5" ; then
+  AC_EXPAND_PATH($with_php5, PHP5_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
+  dnl
+  AC_MSG_CHECKING([for location of config.h or php_config.h])
+  dnl In PHP3, it was called config.h
+  test -f "$PHP5_SRC_DIR/config.h" && PHP5_CONFIG_H="$PHP5_SRC_DIR/config.h"
+
+  dnl In PHP 4.0.1 to 4.0.3, it was php-4.0.x/php_config.h
+  test -f "$PHP5_SRC_DIR/php_config.h" && PHP5_CONFIG_H="$PHP5_SRC_DIR/php_config.h"
+
+  dnl Starting with PHP 4.0.4, it's php-4.0.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([$PHP5_CONFIG_H])
+  else
+    AC_MSG_ERROR([
+!!! Could not find config.h or php_config.h in $PHP5_SRC_DIR.          !!!
+!!! Has PHP5 been configured yet?                                      !!!])
+  fi
+
+  dnl
+  dnl Check which PHP5 version we're using.
+  dnl
+  AC_MSG_CHECKING([whether we have PHP5])
+  if test -n "`grep 'ZEND_API' $PHP5_CONFIG_H`"  ; then
+    PHP5_VERSION_FLAG="-DPHP4"
+  else
+    AC_MSG_ERROR([
+!!! PHP MapScript now requires PHP 5.0.0 or more recent.              !!!
+!!! Support for PHP3 has been dropped after MapServer version 3.5.    !!!])
+  fi
+  AC_MSG_RESULT([$PHP5_VERSION_FLAG])
+
+  dnl
+  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 PHP5's regex])
+  if test -n "`grep 'define REGEX 1' $PHP5_CONFIG_H`"  ; then
+    AC_MSG_RESULT(yes)
+
+    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_PHP_REGEX"
+          PHP5_REGEX_OBJ=php_regex.o
+          AC_MSG_RESULT([        found regex_extra.h - building PHP MapScript with PHP5's bundled regex ])
+        else
+          AC_MSG_ERROR([
+!!! PHP5 uses its bundled regex library but regex/regex_extra.h cannot be !!!
+!!! found.                                                               !!!])
+	fi
+
+  else
+    AC_MSG_RESULT(no)
+  fi
+
+  PHP5MS_MAKEFILE=mapscript/php5/Makefile
+  MAKE_PHP5MS=php5_mapscript
+  MAKE_PHP5MS_CLEAN=php_mapscript_clean
+
+  AC_SUBST(PHP5_VERSION_FLAG, $PHP5_VERSION_FLAG)
+  AC_SUBST(PHP5_SRC_DIR, $PHP5_SRC_DIR)
+  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.])
+  AC_MSG_RESULT([        $PHP5_VERSION_FLAG, $PHP5_SRC_DIR])
+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)
+AC_ARG_ENABLE(internal-ld-detect,
+
+[  --enable-perlv-ld-detect (applies to --with-php only) 
+                          Use perl -V output to figure the command to use to 
+                          link php_mapscript.so.  Try this only if the default
+                          internal macro didn't work.],,)
+
+
+
 dnl ---------------------------------------------------------------------
 dnl Shared library building.
 dnl
@@ -2039,6 +2141,7 @@
 !!! See: http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI !!!])
 
 
+
   AC_MSG_CHECKING([for location of Apache headers using apxs])
   if test -z "$MAKE_PHPMS" ; then
     AC_MSG_ERROR([--with-apxs applies only if --with-php is used.])
@@ -2159,5 +2262,5 @@
 AC_SUBST(ALL_STATIC_LIB, $ALL_STATIC_LIB)
 AC_SUBST(RPATHS, [$RPATHS])
 
-AC_OUTPUT(Makefile $PHPMS_MAKEFILE mapscript/java/Makefile mapscript/csharp/Makefile)
+AC_OUTPUT(Makefile $PHPMS_MAKEFILE $PHP5MS_MAKEFILE mapscript/java/Makefile mapscript/csharp/Makefile)
 
Only in ../mapserver-4.10.0/: configure.in.orig
diff -ru ./mapserver-4.10.0/mapscript/php3/Makefile.in ../mapserver-4.10.0/mapscript/php3/Makefile.in
--- ./mapserver-4.10.0/mapscript/php3/Makefile.in	2006-08-26 18:29:54.000000000 +0200
+++ ../mapserver-4.10.0/mapscript/php3/Makefile.in	2006-10-07 14:35:06.000000000 +0200
@@ -77,7 +77,7 @@
 
 CFLAGS112 = $(CFLAGS) $(MS_DEFINE) $(MS_INC) $(PHP_INC) $(PHP_REGEX_INC)
 
-all: php_mapscript.so
+all: php_mapscript.so php_proj.so
 
 PHPMS_OBJS =  php_mapscript_util.o php_mapscript.o mapscript_i.o $(PHP_REGEX_OBJ)
 
diff -ru ./mapserver-4.10.0/mapscript/php5/Makefile.in ../mapserver-4.10.0/mapscript/php5/Makefile.in
--- ./mapserver-4.10.0/mapscript/php5/Makefile.in	2006-10-07 14:57:56.000000000 +0200
+++ ../mapserver-4.10.0/mapscript/php5/Makefile.in	2006-10-07 14:35:20.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
 #
-PHP_SRC_DIR = @PHP_SRC_DIR@
+PHP_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@
 
 #
-# 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) $(PHP_INC) $(PHP5_REGEX_INC)
 
-all: php_mapscript.so
+all: php_mapscript.so php_proj.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 $@ $<