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 | |
---|
193 | |
---|
194 | # Check headers file |
---|
195 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
196 | CPPFLAGS="$XML2_CPPFLAGS" |
---|
197 | AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h], |
---|
198 | [], [AC_MSG_ERROR([could not find headers include related to libxml2])]) |
---|
199 | |
---|
200 | # Ensure we can link against libxml2 |
---|
201 | LIBS_SAVE="$LIBS" |
---|
202 | LIBS="$XML2_LDFLAGS" |
---|
203 | AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], []) |
---|
204 | |
---|
205 | AC_SUBST([XML2_CPPFLAGS]) |
---|
206 | AC_SUBST([XML2_LDFLAGS]) |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | GLIB_LDFLAGS=`pkg-config --libs glib-2.0` |
---|
211 | GLIB_CPPFLAGS=`pkg-config --cflags glib-2.0` |
---|
212 | |
---|
213 | AC_SUBST([GLIB_CPPFLAGS]) |
---|
214 | AC_SUBST([GLIB_LDFLAGS]) |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | #============================================================================ |
---|
219 | # Detect if mapserver is installed |
---|
220 | #============================================================================ |
---|
221 | |
---|
222 | AC_ARG_WITH([mapserver], |
---|
223 | [AS_HELP_STRING([--with-mapserver=PATH], [specify the path for MapServer compiled source tree])], |
---|
224 | [MS_SRC_PATH="$withval"], [MS_SRC_PATH=""]) |
---|
225 | |
---|
226 | if test -z $MS_SRC_PATH; |
---|
227 | then |
---|
228 | MS_CPPFLAGS="" |
---|
229 | MS_LDFLAGS="" |
---|
230 | else |
---|
231 | if test "x$MS_SRC_PATH" = "xmacos"; |
---|
232 | then |
---|
233 | MS_LDFLAGS="/Library/Frameworks/MapServer.framework//Versions/6.0/MapServer -lintl" |
---|
234 | MS_CPPFLAGS="-DUSE_MS `/Library/Frameworks/MapServer.framework/Programs/mapserver-config --includes` -I/Library/Frameworks/MapServer.framework/Versions/Current/Headers/ -I../mapserver " |
---|
235 | AC_MSG_WARN([Please make sure that ../mapserver exists and contains MapServer source tree]) |
---|
236 | AC_MSG_RESULT([Using MacOS X Framework for MapServer]) |
---|
237 | else |
---|
238 | if test -d $MS_SRC_PATH; then |
---|
239 | MS_LDFLAGS="-L$MS_SRC_PATH -lmapserver `$MS_SRC_PATH/mapserver-config --libs`" |
---|
240 | MS_CPPFLAGS="-DUSE_MS `$MS_SRC_PATH/mapserver-config --includes` `$MS_SRC_PATH/mapserver-config --cflags` -I$MS_SRC_PATH " |
---|
241 | |
---|
242 | AC_MSG_RESULT([Using user-specified MapServer src path: $MS_SRC_PATH]) |
---|
243 | else |
---|
244 | AC_MSG_ERROR([the user-specified mapserver-config file $MS_SRC_PATH does not exist]) |
---|
245 | fi |
---|
246 | fi |
---|
247 | MS_FILE="service_internal_ms.o" |
---|
248 | fi |
---|
249 | |
---|
250 | MS_CFLAGS="$MS_CPPFLAGS" |
---|
251 | MS_LIBS="$MS_LDFLAGS" |
---|
252 | |
---|
253 | AC_SUBST([MS_CFLAGS]) |
---|
254 | AC_SUBST([MS_LIBS]) |
---|
255 | AC_SUBST([MS_FILE]) |
---|
256 | |
---|
257 | # =========================================================================== |
---|
258 | # Detect if ruby is installed |
---|
259 | # =========================================================================== |
---|
260 | AC_ARG_WITH([ruby], |
---|
261 | [AS_HELP_STRING([--with-ruby=PATH], [To enable ruby support or specify an alternative directory for ruby installation, disabled by default])], |
---|
262 | [RUBY_PATH="$withval"; RUBY_ENABLED="-DUSE_RUBY"], [RUBY_ENABLED=""]) |
---|
263 | |
---|
264 | AC_ARG_WITH([rvers], |
---|
265 | [AS_HELP_STRING([--with-rvers=NUM], [To use a specific ruby version])], |
---|
266 | [RUBY_VERS="$withval"], [RUBY_VERS=""]) |
---|
267 | |
---|
268 | |
---|
269 | if test -z "$RUBY_ENABLED" |
---|
270 | then |
---|
271 | RUBY_FILE="" |
---|
272 | else |
---|
273 | RUBY_FILE="service_internal_ruby.o" |
---|
274 | |
---|
275 | # Extract the linker and include flags |
---|
276 | RUBY_LDFLAGS="-lruby" |
---|
277 | RUBY_CPPFLAGS="-I$RUBY_PATH -I$RUBY_PATH/x86_64-darwin13.0/ -DZRUBY_VERSION=$RUBY_VERS" |
---|
278 | |
---|
279 | # Check headers file |
---|
280 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
281 | CPPFLAGS="$RUBY_CPPFLAGS" |
---|
282 | AC_CHECK_HEADERS([ruby.h], |
---|
283 | [], [AC_MSG_ERROR([could not find headers include related to libruby])]) |
---|
284 | |
---|
285 | # Ensure we can link against libphp |
---|
286 | LIBS_SAVE="$LIBS" |
---|
287 | LIBS="$RUBY_LDFLAGS" |
---|
288 | # AC_CHECK_LIB([lruby], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
289 | AC_SUBST([RUBY_CPPFLAGS]) |
---|
290 | AC_SUBST([RUBY_LDFLAGS]) |
---|
291 | fi |
---|
292 | |
---|
293 | AC_SUBST([RUBY_ENABLED]) |
---|
294 | AC_SUBST([RUBY_FILE]) |
---|
295 | |
---|
296 | # =========================================================================== |
---|
297 | # Detect if python is installed |
---|
298 | # =========================================================================== |
---|
299 | |
---|
300 | AC_ARG_WITH([python], |
---|
301 | [AS_HELP_STRING([--with-python=PATH], [To enable python support or specify an alternative directory for python installation, disabled by default])], |
---|
302 | [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""]) |
---|
303 | |
---|
304 | AC_ARG_WITH([pyvers], |
---|
305 | [AS_HELP_STRING([--with-pyvers=NUM], [To use a specific python version])], |
---|
306 | [PYTHON_VERS="$withval"], [PYTHON_VERS=""]) |
---|
307 | |
---|
308 | |
---|
309 | if test -z "$PYTHON_ENABLED" |
---|
310 | then |
---|
311 | PYTHON_FILE="" |
---|
312 | else |
---|
313 | PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config" |
---|
314 | PYTHON_FILE="service_internal_python.o" |
---|
315 | if test "$PYTHON_PATH" = "yes" |
---|
316 | then |
---|
317 | # PHP was not specified, so search within the current path |
---|
318 | PYTHONCFG_PATH=`which python${PYTHON_VERS}-config` |
---|
319 | if test -z "${PYTHONCFG_PATH}" ; then |
---|
320 | AC_PATH_PROG([PYTHONCONFIG], [python-config-${PYTHON_VERS}]) |
---|
321 | else |
---|
322 | AC_PATH_PROG([PYTHONCONFIG], [python${PYTHON_VERS}-config]) |
---|
323 | fi |
---|
324 | else |
---|
325 | PYTHONCONFIG="$PYTHON_PATH/bin/python${PYTHON_VERS}-config" |
---|
326 | fi |
---|
327 | |
---|
328 | # Extract the linker and include flags |
---|
329 | PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags` |
---|
330 | PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes` |
---|
331 | |
---|
332 | # Check headers file |
---|
333 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
334 | CPPFLAGS="$PYTHON_CPPFLAGS" |
---|
335 | AC_CHECK_HEADERS([Python.h], |
---|
336 | [], [AC_MSG_ERROR([could not find headers include related to libpython])]) |
---|
337 | |
---|
338 | # Ensure we can link against libphp |
---|
339 | LIBS_SAVE="$LIBS" |
---|
340 | LIBS="$PYTHON_LDFLAGS" |
---|
341 | PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'` |
---|
342 | AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
343 | AC_SUBST([PYTHON_CPPFLAGS]) |
---|
344 | AC_SUBST([PYTHON_LDFLAGS]) |
---|
345 | fi |
---|
346 | |
---|
347 | AC_SUBST([PYTHON_ENABLED]) |
---|
348 | AC_SUBST([PYTHON_FILE]) |
---|
349 | |
---|
350 | # =========================================================================== |
---|
351 | # Detect if php is installed |
---|
352 | # =========================================================================== |
---|
353 | |
---|
354 | AC_ARG_WITH([php], |
---|
355 | [AS_HELP_STRING([--with-php=PATH], [To enable php support or specify an alternative directory for php installation, disabled by default])], |
---|
356 | [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""]) |
---|
357 | |
---|
358 | |
---|
359 | if test -z "$PHP_ENABLED" |
---|
360 | then |
---|
361 | PHP_FILE="" |
---|
362 | else |
---|
363 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
364 | PHP_FILE="service_internal_php.o" |
---|
365 | if test "$PHP_PATH" = "yes" |
---|
366 | then |
---|
367 | # PHP was not specified, so search within the current path |
---|
368 | AC_PATH_PROG([PHPCONFIG], [php-config]) |
---|
369 | else |
---|
370 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
371 | fi |
---|
372 | |
---|
373 | # Extract the linker and include flags |
---|
374 | PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5" |
---|
375 | PHP_CPPFLAGS=`$PHPCONFIG --includes` |
---|
376 | |
---|
377 | # Check headers file |
---|
378 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
379 | CPPFLAGS="$PHP_CPPFLAGS" |
---|
380 | AC_CHECK_HEADERS([sapi/embed/php_embed.h], |
---|
381 | [], [AC_MSG_ERROR([could not find headers include related to libphp])]) |
---|
382 | |
---|
383 | # Ensure we can link against libphp |
---|
384 | LIBS_SAVE="$LIBS" |
---|
385 | LIBS="$PHP_LDFLAGS" |
---|
386 | # Shouldn't we get php here rather than php5 :) ?? |
---|
387 | AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], []) |
---|
388 | AC_SUBST([PHP_CPPFLAGS]) |
---|
389 | AC_SUBST([PHP_LDFLAGS]) |
---|
390 | fi |
---|
391 | |
---|
392 | AC_SUBST([PHP_ENABLED]) |
---|
393 | AC_SUBST([PHP_FILE]) |
---|
394 | |
---|
395 | # =========================================================================== |
---|
396 | # Detect if perl is installed |
---|
397 | # =========================================================================== |
---|
398 | |
---|
399 | AC_ARG_WITH([perl], |
---|
400 | [AS_HELP_STRING([--with-perl=PATH], [To enable perl support or specify an alternative directory for perl installation, disabled by default])], |
---|
401 | [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""]) |
---|
402 | |
---|
403 | |
---|
404 | if test -z "$PERL_ENABLED" |
---|
405 | then |
---|
406 | PERL_FILE="" |
---|
407 | else |
---|
408 | PERL_FILE="service_internal_perl.o" |
---|
409 | if test "$PERL_PATH" = "yes" |
---|
410 | then |
---|
411 | # Perl was not specified, so search within the current path |
---|
412 | AC_PATH_PROG([PERLCONFIG], [perl]) |
---|
413 | else |
---|
414 | PERLCONFIG="$PERL_PATH/bin/perl" |
---|
415 | fi |
---|
416 | |
---|
417 | # Extract the linker and include flags |
---|
418 | PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts` |
---|
419 | PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts` |
---|
420 | |
---|
421 | # Check headers file |
---|
422 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
423 | CPPFLAGS="$PERL_CPPFLAGS" |
---|
424 | AC_CHECK_HEADERS([EXTERN.h], |
---|
425 | [], [AC_MSG_ERROR([could not find headers include related to libperl])]) |
---|
426 | |
---|
427 | AC_SUBST([PERL_CPPFLAGS]) |
---|
428 | AC_SUBST([PERL_LDFLAGS]) |
---|
429 | fi |
---|
430 | |
---|
431 | AC_SUBST([PERL_ENABLED]) |
---|
432 | AC_SUBST([PERL_FILE]) |
---|
433 | |
---|
434 | # =========================================================================== |
---|
435 | # Detect if java is installed |
---|
436 | # =========================================================================== |
---|
437 | |
---|
438 | AC_ARG_WITH([java], |
---|
439 | [AS_HELP_STRING([--with-java=PATH], [To enable java support, specify a JDK_HOME, disabled by default])], |
---|
440 | [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""]) |
---|
441 | |
---|
442 | if test -z "$JAVA_ENABLED" |
---|
443 | then |
---|
444 | JAVA_FILE="" |
---|
445 | else |
---|
446 | JAVA_FILE="service_internal_java.o" |
---|
447 | if test "x$JDKHOME" = "x"; |
---|
448 | then |
---|
449 | 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.]) |
---|
450 | fi # JAVA was specified; display a message to the user |
---|
451 | if test "x$JDKHOME" = "xyes"; |
---|
452 | then |
---|
453 | AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java]) |
---|
454 | fi |
---|
455 | |
---|
456 | # Extract the linker and include flags |
---|
457 | if test "x$JDKHOME" = "xmacos"; |
---|
458 | then |
---|
459 | JAVA_LDFLAGS="-framework JavaVM" |
---|
460 | JAVA_CPPFLAGS="-I/Applications/Xcode.app/Contents/Developer//Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers/" |
---|
461 | else |
---|
462 | if test -d "$JDKHOME/jre/lib/i386"; |
---|
463 | then |
---|
464 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/client/ -ljvm -lpthread" |
---|
465 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
466 | else |
---|
467 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/client/ -ljvm -lpthread" |
---|
468 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
469 | fi |
---|
470 | fi |
---|
471 | |
---|
472 | # Check headers file (second time we check that in fact) |
---|
473 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
474 | CPPFLAGS="$JAVA_CPPFLAGS" |
---|
475 | AC_CHECK_HEADERS([jni.h], |
---|
476 | [], [AC_MSG_ERROR([could not find headers include related to libjava])]) |
---|
477 | |
---|
478 | # Ensure we can link against libjava |
---|
479 | LIBS_SAVE="$LIBS" |
---|
480 | LIBS="$JAVA_LDFLAGS" |
---|
481 | if test "x$JDKHOME" != "xmacos"; |
---|
482 | then |
---|
483 | AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
484 | fi |
---|
485 | |
---|
486 | AC_SUBST([JAVA_CPPFLAGS]) |
---|
487 | AC_SUBST([JAVA_LDFLAGS]) |
---|
488 | fi |
---|
489 | |
---|
490 | AC_SUBST([JAVA_ENABLED]) |
---|
491 | AC_SUBST([JAVA_FILE]) |
---|
492 | |
---|
493 | # =========================================================================== |
---|
494 | # Detect if spidermonkey is installed |
---|
495 | # =========================================================================== |
---|
496 | |
---|
497 | AC_ARG_WITH([js], |
---|
498 | [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 ])], |
---|
499 | [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""]) |
---|
500 | |
---|
501 | if test -z "$JS_ENABLED" |
---|
502 | then |
---|
503 | JS_FILE="" |
---|
504 | else |
---|
505 | JS_FILE="service_internal_js.o" |
---|
506 | if test "$JSHOME" = "yes" |
---|
507 | then |
---|
508 | |
---|
509 | #on teste si on est sous debian like |
---|
510 | if test -f "/usr/bin/dpkg" |
---|
511 | then |
---|
512 | if test -n "`dpkg -l | grep libmozjs185-dev`" |
---|
513 | then |
---|
514 | JS_CPPFLAGS="-I/usr/include/js/" |
---|
515 | JS_LDFLAGS="-L/usr/lib -lmozjs185 -lm" |
---|
516 | JS_LIB="mozjs185" |
---|
517 | else |
---|
518 | XUL_VERSION="`dpkg -l | grep xulrunner | grep dev | head -1| awk '{print $3;}' | cut -d'+' -f1`" |
---|
519 | if test -n "$XUL_VERSION" |
---|
520 | then |
---|
521 | JS_CPPFLAGS="-I/usr/include/xulrunner-$XUL_VERSION" |
---|
522 | JS_LDFLAGS="-L/usr/lib/xulrunner-$XUL_VERSION -lmozjs -lm" |
---|
523 | JS_LIB="mozjs" |
---|
524 | else |
---|
525 | AC_MSG_ERROR([You must install libmozjs185-dev or xulrunner-dev ]) |
---|
526 | fi |
---|
527 | fi |
---|
528 | else |
---|
529 | AC_MSG_ERROR([You must specify your custom install of libmozjs185]) |
---|
530 | fi |
---|
531 | else |
---|
532 | JS_CPPFLAGS="-I$JSHOME/include/js/" |
---|
533 | JS_LDFLAGS="-L$JSHOME/lib -lmozjs185 -lm" |
---|
534 | JS_LIB="mozjs185" |
---|
535 | |
---|
536 | fi |
---|
537 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
538 | CPPFLAGS="$JS_CPPFLAGS" |
---|
539 | |
---|
540 | #AC_CHECK_HEADERS([jsapi.h], |
---|
541 | # [], [AC_MSG_ERROR([could not find headers include related to libjs])]) |
---|
542 | |
---|
543 | |
---|
544 | LIBS_SAVE="$LIBS" |
---|
545 | LIBS="$JS_LDFLAGS" |
---|
546 | |
---|
547 | AC_CHECK_LIB([$JS_LIB], [JS_CompileFile,JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) |
---|
548 | |
---|
549 | AC_SUBST([JS_CPPFLAGS]) |
---|
550 | AC_SUBST([JS_LDFLAGS]) |
---|
551 | fi |
---|
552 | |
---|
553 | AC_SUBST([JS_ENABLED]) |
---|
554 | AC_SUBST([JS_FILE]) |
---|
555 | |
---|
556 | AC_CONFIG_FILES([Makefile]) |
---|
557 | AC_CONFIG_FILES([ZOOMakefile.opts]) |
---|
558 | AC_OUTPUT |
---|