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