1 | AC_INIT([ZOO Kernel], [1.4.0], [bugs@zoo-project.org]) |
---|
2 | |
---|
3 | # Checks for programs. |
---|
4 | AC_PROG_YACC |
---|
5 | AC_PROG_CC |
---|
6 | AC_PROG_LEX |
---|
7 | AC_PROG_CXX |
---|
8 | AC_PROG_SED |
---|
9 | |
---|
10 | # Checks for libraries. |
---|
11 | AC_CHECK_LIB([cgic], [cgiMain]) |
---|
12 | AC_CHECK_LIB([curl], [curl_easy_init curl_easy_setopt curl_easy_cleanup curl_easy_perform]) |
---|
13 | AC_CHECK_LIB([dl], [dlopen dlsym dlerror dlclose]) |
---|
14 | AC_CHECK_LIB([fl], [main]) |
---|
15 | AC_CHECK_LIB([pthread], [main]) |
---|
16 | AC_CHECK_LIB([ssl], [main]) |
---|
17 | |
---|
18 | # Checks for header files. |
---|
19 | AC_FUNC_ALLOCA |
---|
20 | AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
21 | |
---|
22 | # Checks for typedefs, structures, and compiler characteristics. |
---|
23 | AC_HEADER_STDBOOL |
---|
24 | AC_TYPE_INT16_T |
---|
25 | AC_TYPE_INT32_T |
---|
26 | AC_TYPE_INT8_T |
---|
27 | AC_TYPE_PID_T |
---|
28 | AC_TYPE_SIZE_T |
---|
29 | AC_TYPE_UINT16_T |
---|
30 | AC_TYPE_UINT32_T |
---|
31 | AC_TYPE_UINT8_T |
---|
32 | |
---|
33 | # Checks for library functions. |
---|
34 | AC_FUNC_FORK |
---|
35 | AC_FUNC_MALLOC |
---|
36 | AC_FUNC_REALLOC |
---|
37 | AC_CHECK_FUNCS([dup2 getcwd memset setenv strdup strstr]) |
---|
38 | |
---|
39 | #============================================================================ |
---|
40 | # Detect if run on debian / ubuntu |
---|
41 | #============================================================================ |
---|
42 | if test -f "/usr/bin/dpkg" |
---|
43 | then |
---|
44 | DEB_DEF=-DDEB |
---|
45 | fi |
---|
46 | AC_SUBST([DEB_DEF]) |
---|
47 | |
---|
48 | #============================================================================ |
---|
49 | # Detect if gdal is installed |
---|
50 | #============================================================================ |
---|
51 | |
---|
52 | AC_ARG_WITH([gdal-config], |
---|
53 | [AS_HELP_STRING([--with-gdal-config=FILE], [specify an alternative gdal-config file])], |
---|
54 | [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""]) |
---|
55 | if test -z $GDAL_CONFIG; |
---|
56 | then |
---|
57 | AC_PATH_PROG([GDAL_CONFIG], [gdal-config]) |
---|
58 | if test -z $GDAL_CONFIG; |
---|
59 | then |
---|
60 | AC_MSG_ERROR([could not find gdal-config from libgdal within the current path. You may need to try re-running configure with a --with-gdal-config parameter.]) |
---|
61 | fi |
---|
62 | |
---|
63 | else |
---|
64 | if test -f $GDAL_CONFIG; then |
---|
65 | AC_MSG_RESULT([Using user-specified gdal-config file: $GDAL_CONFIG]) |
---|
66 | else |
---|
67 | AC_MSG_ERROR([the user-specified gdal-config file $GDAL_CONFIG does not exist]) |
---|
68 | fi |
---|
69 | fi |
---|
70 | |
---|
71 | GDAL_CFLAGS="`$GDAL_CONFIG --cflags`" |
---|
72 | GDAL_LIBS="`$GDAL_CONFIG --libs`" |
---|
73 | |
---|
74 | AC_SUBST([GDAL_CFLAGS]) |
---|
75 | AC_SUBST([GDAL_LIBS]) |
---|
76 | |
---|
77 | # =========================================================================== |
---|
78 | # Detect if libyaml is available |
---|
79 | # =========================================================================== |
---|
80 | |
---|
81 | AC_ARG_WITH([yaml], |
---|
82 | [AS_HELP_STRING([--with-yaml=PATH], [specify an alternative location for the fastcgi library])], |
---|
83 | [YAMLPATH="$withval"], [YAMLPATH=""]) |
---|
84 | |
---|
85 | if test -z "$YAMLPATH" |
---|
86 | then |
---|
87 | YAML_LDFLAGS="" |
---|
88 | YAML_CPPFLAGS="" |
---|
89 | YAML_FILE="" |
---|
90 | YAML_FILE1="" |
---|
91 | else |
---|
92 | |
---|
93 | # Extract the linker and include flags |
---|
94 | YAML_LDFLAGS="-L$YAMLPATH/lib -lyaml" |
---|
95 | YAML_CPPFLAGS="-I$YAMLPATH/include -DYAML" |
---|
96 | YAML_FILE="service_yaml.o" |
---|
97 | YAML_FILE1="zcfg2yaml" |
---|
98 | |
---|
99 | # Check headers file |
---|
100 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
101 | CPPFLAGS="$YAML_CPPFLAGS" |
---|
102 | LDFLAGS_SAVE="$LDFLAGS" |
---|
103 | LDFLAGS="YAML_LDFLAGS" |
---|
104 | AC_CHECK_LIB([yaml], [yaml_parser_initialize,yaml_parser_set_input_file,yaml_parser_scan]) |
---|
105 | AC_CHECK_HEADERS([yaml.h], |
---|
106 | [], [AC_MSG_ERROR([could not find headers include related to YAML])]) |
---|
107 | |
---|
108 | fi |
---|
109 | AC_SUBST([YAML_CPPFLAGS]) |
---|
110 | AC_SUBST([YAML_LDFLAGS]) |
---|
111 | AC_SUBST([YAML_FILE]) |
---|
112 | AC_SUBST([YAML_FILE1]) |
---|
113 | |
---|
114 | # =========================================================================== |
---|
115 | # Detect if fastcgi is available |
---|
116 | # =========================================================================== |
---|
117 | |
---|
118 | AC_ARG_WITH([fastcgi], |
---|
119 | [AS_HELP_STRING([--with-fastcgi=PATH], [specify an alternative location for the fastcgi library])], |
---|
120 | [FCGIPATH="$withval"], [FCGIPATH="/usr"]) |
---|
121 | |
---|
122 | # Extract the linker and include flags |
---|
123 | FCGI_LDFLAGS="-L$FCGIPATH/lib" |
---|
124 | FCGI_CPPFLAGS="-I$FCGIPATH/include" |
---|
125 | |
---|
126 | # Check headers file |
---|
127 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
128 | CPPFLAGS="$FCGI_CPPFLAGS" |
---|
129 | LDFLAGS_SAVE="LDFLAGS" |
---|
130 | LDFLAGS="$FCGI_LDFLAGS" |
---|
131 | AC_CHECK_LIB([fcgi], [main]) |
---|
132 | AC_CHECK_HEADERS([fcgi_stdio.h], |
---|
133 | [], [AC_MSG_ERROR([could not find headers include related to fastcgi])]) |
---|
134 | |
---|
135 | AC_SUBST([FCGI_CPPFLAGS]) |
---|
136 | AC_SUBST([FCGI_LDFLAGS]) |
---|
137 | |
---|
138 | # =========================================================================== |
---|
139 | # Detect if proj is installed |
---|
140 | # =========================================================================== |
---|
141 | |
---|
142 | AC_ARG_WITH([proj], |
---|
143 | [AS_HELP_STRING([--with-proj=PATH], [specify an alternative location for PROJ4 setup])], |
---|
144 | [PROJPATH="$withval"], [PROJPATH=""]) |
---|
145 | |
---|
146 | # Extract the linker and include flags |
---|
147 | PROJ_LDFLAGS="-L$PROJPATH/lib" |
---|
148 | PROJ_CPPFLAGS="-I$PROJPATH/include" |
---|
149 | |
---|
150 | # Check headers file |
---|
151 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
152 | CPPFLAGS="$PROJ_CPPFLAGS" |
---|
153 | AC_CHECK_HEADERS([proj_api.h], |
---|
154 | [], [AC_MSG_ERROR([could not find headers include related to PROJ4])]) |
---|
155 | |
---|
156 | AC_SUBST([PROJ_CPPFLAGS]) |
---|
157 | AC_SUBST([PROJ_LDFLAGS]) |
---|
158 | |
---|
159 | # =========================================================================== |
---|
160 | # Detect if libxml2 is installed |
---|
161 | # =========================================================================== |
---|
162 | |
---|
163 | AC_ARG_WITH([xml2config], |
---|
164 | [AS_HELP_STRING([--with-xml2config=FILE], [specify an alternative xml2-config file])], |
---|
165 | [XML2CONFIG="$withval"], [XML2CONFIG=""]) |
---|
166 | |
---|
167 | if test "x$XML2CONFIG" = "x"; then |
---|
168 | # XML2CONFIG was not specified, so search within the current path |
---|
169 | AC_PATH_PROG([XML2CONFIG], [xml2-config]) |
---|
170 | |
---|
171 | # If we couldn't find xml2-config, display a warning |
---|
172 | if test "x$XML2CONFIG" = "x"; then |
---|
173 | AC_MSG_ERROR([could not find xml2-config from libxml2 within the current path. You may need to try re-running configure with a --with-xml2config parameter.]) |
---|
174 | fi |
---|
175 | else |
---|
176 | # XML2CONFIG was specified; display a message to the user |
---|
177 | if test "x$XML2CONFIG" = "xyes"; then |
---|
178 | AC_MSG_ERROR([you must specify a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config]) |
---|
179 | else |
---|
180 | if test -f $XML2CONFIG; then |
---|
181 | AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG]) |
---|
182 | else |
---|
183 | AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist]) |
---|
184 | fi |
---|
185 | fi |
---|
186 | fi |
---|
187 | |
---|
188 | # Extract the linker and include flags |
---|
189 | XML2_LDFLAGS=`$XML2CONFIG --libs` |
---|
190 | XML2_CPPFLAGS=`$XML2CONFIG --cflags` |
---|
191 | |
---|
192 | # Check headers file |
---|
193 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
194 | CPPFLAGS="$XML2_CPPFLAGS" |
---|
195 | AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h], |
---|
196 | [], [AC_MSG_ERROR([could not find headers include related to libxml2])]) |
---|
197 | |
---|
198 | # Ensure we can link against libxml2 |
---|
199 | LIBS_SAVE="$LIBS" |
---|
200 | LIBS="$XML2_LDFLAGS" |
---|
201 | AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], []) |
---|
202 | |
---|
203 | AC_SUBST([XML2_CPPFLAGS]) |
---|
204 | AC_SUBST([XML2_LDFLAGS]) |
---|
205 | |
---|
206 | #============================================================================ |
---|
207 | # Detect if mapserver is installed |
---|
208 | #============================================================================ |
---|
209 | |
---|
210 | AC_ARG_WITH([mapserver], |
---|
211 | [AS_HELP_STRING([--with-mapserver=PATH], [specify the path for MapServer compiled source tree])], |
---|
212 | [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""]) |
---|
213 | |
---|
214 | if test -z $MS_SRC_PATH; |
---|
215 | then |
---|
216 | MS_CPPFLAGS="" |
---|
217 | MS_LDFLAGS="" |
---|
218 | else |
---|
219 | if test "x$MS_SRC_PATH" = "xmacos"; |
---|
220 | then |
---|
221 | MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl" |
---|
222 | MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver " |
---|
223 | AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree]) |
---|
224 | AC_MSG_RESULT([Using MacOS X Framework for MapServer]) |
---|
225 | else |
---|
226 | if test -d $MS_SRC_PATH; then |
---|
227 | MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`" |
---|
228 | MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH " |
---|
229 | |
---|
230 | AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH]) |
---|
231 | else |
---|
232 | AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist]) |
---|
233 | fi |
---|
234 | fi |
---|
235 | MS_FILE="service_internal_ms.o" |
---|
236 | fi |
---|
237 | |
---|
238 | MS_CFLAGS="$MS_CPPFLAGS" |
---|
239 | MS_LIBS="$MS_LDFLAGS" |
---|
240 | |
---|
241 | AC_SUBST([MS_CFLAGS]) |
---|
242 | AC_SUBST([MS_LIBS]) |
---|
243 | AC_SUBST([MS_FILE]) |
---|
244 | |
---|
245 | # =========================================================================== |
---|
246 | # Detect if ruby is installed |
---|
247 | # =========================================================================== |
---|
248 | AC_ARG_WITH([ruby], |
---|
249 | [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation, disabled by default])], |
---|
250 | [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""]) |
---|
251 | |
---|
252 | AC_ARG_WITH([rvers], |
---|
253 | [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])], |
---|
254 | [RUBY_VERS="$withval"], [RUBY_VERS=""]) |
---|
255 | |
---|
256 | |
---|
257 | if test -z "$RUBY_ENABLED" |
---|
258 | then |
---|
259 | RUBY_FILE="" |
---|
260 | else |
---|
261 | RUBY_FILE="service_internal_ruby.o" |
---|
262 | |
---|
263 | # Extract the linker and include flags |
---|
264 | RUBY_LDFLAGS="-lruby" |
---|
265 | RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS" |
---|
266 | |
---|
267 | # Check headers file |
---|
268 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
269 | CPPFLAGS="$RUBY_CPPFLAGS" |
---|
270 | AC_CHECK_HEADERS([ruby.h], |
---|
271 | [], [AC_MSG_ERROR([could not find headers include related to libruby])]) |
---|
272 | |
---|
273 | # Ensure we can link against libphp |
---|
274 | LIBS_SAVE="$LIBS" |
---|
275 | LIBS="$RUBY_LDFLAGS" |
---|
276 | # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
277 | AC_SUBST([RUBY_CPPFLAGS]) |
---|
278 | AC_SUBST([RUBY_LDFLAGS]) |
---|
279 | fi |
---|
280 | |
---|
281 | AC_SUBST([RUBY_ENABLED]) |
---|
282 | AC_SUBST([RUBY_FILE]) |
---|
283 | |
---|
284 | # =========================================================================== |
---|
285 | # Detect if python is installed |
---|
286 | # =========================================================================== |
---|
287 | |
---|
288 | AC_ARG_WITH([python], |
---|
289 | [AS_HELP_STRING([--with-python=PATH], [To enable python support or specify an alternative directory for python installation, disabled by default])], |
---|
290 | [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""]) |
---|
291 | |
---|
292 | AC_ARG_WITH([pyvers], |
---|
293 | [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])], |
---|
294 | [PYTHON_VERS="$withval"], [PYTHON_VERS=""]) |
---|
295 | |
---|
296 | |
---|
297 | if test -z "$PYTHON_ENABLED" |
---|
298 | then |
---|
299 | PYTHON_FILE="" |
---|
300 | else |
---|
301 | PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config" |
---|
302 | PYTHON_FILE="service_internal_python.o" |
---|
303 | if test "$PYTHON_PATH" = "yes" |
---|
304 | then |
---|
305 | # PHP was not specified, so search within the current path |
---|
306 | PYTHONCFG_PATH=`which python${PYTHON_VERS}-config` |
---|
307 | if test -z "${PYTHONCFG_PATH}" ; then |
---|
308 | AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}]) |
---|
309 | else |
---|
310 | AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config]) |
---|
311 | fi |
---|
312 | else |
---|
313 | PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config" |
---|
314 | fi |
---|
315 | |
---|
316 | # Extract the linker and include flags |
---|
317 | PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags` |
---|
318 | PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes` |
---|
319 | |
---|
320 | # Check headers file |
---|
321 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
322 | CPPFLAGS="$PYTHON_CPPFLAGS" |
---|
323 | AC_CHECK_HEADERS([Python.h], |
---|
324 | [], [AC_MSG_ERROR([could not find headers include related to libpython])]) |
---|
325 | |
---|
326 | # Ensure we can link against libphp |
---|
327 | LIBS_SAVE="$LIBS" |
---|
328 | LIBS="$PYTHON_LDFLAGS" |
---|
329 | PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'` |
---|
330 | AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
331 | AC_SUBST([PYTHON_CPPFLAGS]) |
---|
332 | AC_SUBST([PYTHON_LDFLAGS]) |
---|
333 | fi |
---|
334 | |
---|
335 | AC_SUBST([PYTHON_ENABLED]) |
---|
336 | AC_SUBST([PYTHON_FILE]) |
---|
337 | |
---|
338 | # =========================================================================== |
---|
339 | # Detect if php is installed |
---|
340 | # =========================================================================== |
---|
341 | |
---|
342 | AC_ARG_WITH([php], |
---|
343 | [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation, disabled by default])], |
---|
344 | [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""]) |
---|
345 | |
---|
346 | |
---|
347 | if test -z "$PHP_ENABLED" |
---|
348 | then |
---|
349 | PHP_FILE="" |
---|
350 | else |
---|
351 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
352 | PHP_FILE="service_internal_php.o" |
---|
353 | if test "$PHP_PATH" = "yes" |
---|
354 | then |
---|
355 | # PHP was not specified, so search within the current path |
---|
356 | AC_PATH_PROG([PHPCONFIG], [php-config]) |
---|
357 | else |
---|
358 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
359 | fi |
---|
360 | |
---|
361 | # Extract the linker and include flags |
---|
362 | PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5" |
---|
363 | PHP_CPPFLAGS=`$PHPCONFIG --includes` |
---|
364 | |
---|
365 | # Check headers file |
---|
366 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
367 | CPPFLAGS="$PHP_CPPFLAGS" |
---|
368 | AC_CHECK_HEADERS([sapi/embed/php_embed.h], |
---|
369 | [], [AC_MSG_ERROR([could not find headers include related to libphp])]) |
---|
370 | |
---|
371 | # Ensure we can link against libphp |
---|
372 | LIBS_SAVE="$LIBS" |
---|
373 | LIBS="$PHP_LDFLAGS" |
---|
374 | # Shouldn't we get php here rather than php5 :) ?? |
---|
375 | AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], []) |
---|
376 | AC_SUBST([PHP_CPPFLAGS]) |
---|
377 | AC_SUBST([PHP_LDFLAGS]) |
---|
378 | fi |
---|
379 | |
---|
380 | AC_SUBST([PHP_ENABLED]) |
---|
381 | AC_SUBST([PHP_FILE]) |
---|
382 | |
---|
383 | # =========================================================================== |
---|
384 | # Detect if perl is installed |
---|
385 | # =========================================================================== |
---|
386 | |
---|
387 | AC_ARG_WITH([perl], |
---|
388 | [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation, disabled by default])], |
---|
389 | [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""]) |
---|
390 | |
---|
391 | |
---|
392 | if test -z "$PERL_ENABLED" |
---|
393 | then |
---|
394 | PERL_FILE="" |
---|
395 | else |
---|
396 | PERL_FILE="service_internal_perl.o" |
---|
397 | if test "$PERL_PATH" = "yes" |
---|
398 | then |
---|
399 | # Perl was not specified, so search within the current path |
---|
400 | AC_PATH_PROG([PERLCONFIG], [perl]) |
---|
401 | else |
---|
402 | PERLCONFIG="$PERL_PATH/bin/perl" |
---|
403 | fi |
---|
404 | |
---|
405 | # Extract the linker and include flags |
---|
406 | PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts` |
---|
407 | PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts` |
---|
408 | |
---|
409 | # Check headers file |
---|
410 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
411 | CPPFLAGS="$PERL_CPPFLAGS" |
---|
412 | AC_CHECK_HEADERS([EXTERN.h], |
---|
413 | [], [AC_MSG_ERROR([could not find headers include related to libperl])]) |
---|
414 | |
---|
415 | AC_SUBST([PERL_CPPFLAGS]) |
---|
416 | AC_SUBST([PERL_LDFLAGS]) |
---|
417 | fi |
---|
418 | |
---|
419 | AC_SUBST([PERL_ENABLED]) |
---|
420 | AC_SUBST([PERL_FILE]) |
---|
421 | |
---|
422 | # =========================================================================== |
---|
423 | # Detect if java is installed |
---|
424 | # =========================================================================== |
---|
425 | |
---|
426 | AC_ARG_WITH([java], |
---|
427 | [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME, disabled by default])], |
---|
428 | [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""]) |
---|
429 | |
---|
430 | if test -z "$JAVA_ENABLED" |
---|
431 | then |
---|
432 | JAVA_FILE="" |
---|
433 | else |
---|
434 | JAVA_FILE="service_internal_java.o" |
---|
435 | if test "x$JDKHOME" = "x"; |
---|
436 | then |
---|
437 | AC_MSG_ERROR([could not find java installation path within the current path. You may need to try re-running configure with a --with-java parameter.]) |
---|
438 | fi # JAVA was specified; display a message to the user |
---|
439 | if test "x$JDKHOME" = "xyes"; |
---|
440 | then |
---|
441 | AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java]) |
---|
442 | fi |
---|
443 | |
---|
444 | # Extract the linker and include flags |
---|
445 | if test "x$JDKHOME" = "xmacos"; |
---|
446 | then |
---|
447 | JAVA_LDFLAGS="-framework JavaVM" |
---|
448 | JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/" |
---|
449 | else |
---|
450 | if test -d "$JDKHOME/jre/lib/i386"; |
---|
451 | then |
---|
452 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/client/ -ljvm -lpthread" |
---|
453 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
454 | else |
---|
455 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/client/ -ljvm -lpthread" |
---|
456 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
457 | fi |
---|
458 | fi |
---|
459 | |
---|
460 | # Check headers file (second time we check that in fact) |
---|
461 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
462 | CPPFLAGS="$JAVA_CPPFLAGS" |
---|
463 | AC_CHECK_HEADERS([jni.h], |
---|
464 | [], [AC_MSG_ERROR([could not find headers include related to libjava])]) |
---|
465 | |
---|
466 | # Ensure we can link against libjava |
---|
467 | LIBS_SAVE="$LIBS" |
---|
468 | LIBS="$JAVA_LDFLAGS" |
---|
469 | if test "x$JDKHOME" != "xmacos"; |
---|
470 | then |
---|
471 | AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
472 | fi |
---|
473 | |
---|
474 | AC_SUBST([JAVA_CPPFLAGS]) |
---|
475 | AC_SUBST([JAVA_LDFLAGS]) |
---|
476 | fi |
---|
477 | |
---|
478 | AC_SUBST([JAVA_ENABLED]) |
---|
479 | AC_SUBST([JAVA_FILE]) |
---|
480 | |
---|
481 | # =========================================================================== |
---|
482 | # Detect if spidermonkey is installed |
---|
483 | # =========================================================================== |
---|
484 | |
---|
485 | AC_ARG_WITH([js], |
---|
486 | [AS_HELP_STRING([--with-js=PATH], [specify --with-js=path-to-js to enable js support, specify --with-js on linux debian like, js support is disabled by default ])], |
---|
487 | [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""]) |
---|
488 | |
---|
489 | if test -z "$JS_ENABLED" |
---|
490 | then |
---|
491 | JS_FILE="" |
---|
492 | else |
---|
493 | JS_FILE="service_internal_js.o" |
---|
494 | if test "$JSHOME" = "yes" |
---|
495 | then |
---|
496 | |
---|
497 | #on teste si on est sous debian like |
---|
498 | if test -f "/usr/bin/dpkg" |
---|
499 | then |
---|
500 | if test -n "`dpkg -l | grep libmozjs185-dev`" |
---|
501 | then |
---|
502 | JS_CPPFLAGS="-I/usr/include/js/" |
---|
503 | JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm" |
---|
504 | JS_LIB="mozjs185" |
---|
505 | else |
---|
506 | XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`" |
---|
507 | if test -n "$XUL_VERSION" |
---|
508 | then |
---|
509 | JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION" |
---|
510 | JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm" |
---|
511 | JS_LIB="mozjs" |
---|
512 | else |
---|
513 | AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ]) |
---|
514 | fi |
---|
515 | fi |
---|
516 | else |
---|
517 | AC_MSG_ERROR([You must specify your custom install of libmozjs185]) |
---|
518 | fi |
---|
519 | else |
---|
520 | JS_CPPFLAGS="-I$JSHOME/include/js/" |
---|
521 | JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm" |
---|
522 | JS_LIB="mozjs185" |
---|
523 | |
---|
524 | fi |
---|
525 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
526 | CPPFLAGS="$JS_CPPFLAGS" |
---|
527 | |
---|
528 | #AC_CHECK_HEADERS([jsapi.h], |
---|
529 | # [], [AC_MSG_ERROR([could not find headers include related to libjs])]) |
---|
530 | |
---|
531 | |
---|
532 | LIBS_SAVE="$LIBS" |
---|
533 | LIBS="$JS_LDFLAGS" |
---|
534 | |
---|
535 | AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) |
---|
536 | |
---|
537 | AC_SUBST([JS_CPPFLAGS]) |
---|
538 | AC_SUBST([JS_LDFLAGS]) |
---|
539 | fi |
---|
540 | |
---|
541 | AC_SUBST([JS_ENABLED]) |
---|
542 | AC_SUBST([JS_FILE]) |
---|
543 | |
---|
544 | AC_CONFIG_FILES([Makefile]) |
---|
545 | AC_CONFIG_FILES([ZOOMakefile.opts]) |
---|
546 | AC_OUTPUT |
---|