1 | AC_PREREQ([2.63]) |
---|
2 | AC_INIT([ZOO Kernel], [0.0.1], [bugs@zoo-project.org]) |
---|
3 | #AM_INIT_AUTOMAKE |
---|
4 | #AC_CONFIG_HEADERS([config.h]) |
---|
5 | |
---|
6 | # Checks for programs. |
---|
7 | AC_PROG_YACC |
---|
8 | AC_PROG_CC |
---|
9 | AC_PROG_LEX |
---|
10 | AC_PROG_CXX |
---|
11 | AC_PROG_SED |
---|
12 | |
---|
13 | # Checks for libraries. |
---|
14 | AC_CHECK_LIB([cgic], [cgiMain]) |
---|
15 | AC_CHECK_LIB([curl], [curl_easy_init curl_easy_setopt curl_easy_cleanup curl_easy_perform]) |
---|
16 | AC_CHECK_LIB([dl], [dlopen dlsym dlerror dlclose]) |
---|
17 | AC_CHECK_LIB([fl], [main]) |
---|
18 | AC_CHECK_LIB([pthread], [main]) |
---|
19 | AC_CHECK_LIB([fcgi], [main]) |
---|
20 | AC_CHECK_LIB([ssl], [main]) |
---|
21 | |
---|
22 | # Checks for header files. |
---|
23 | AC_FUNC_ALLOCA |
---|
24 | AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h malloc.h stddef.h stdlib.h string.h unistd.h]) |
---|
25 | |
---|
26 | # Checks for typedefs, structures, and compiler characteristics. |
---|
27 | AC_HEADER_STDBOOL |
---|
28 | AC_TYPE_INT16_T |
---|
29 | AC_TYPE_INT32_T |
---|
30 | AC_TYPE_INT8_T |
---|
31 | AC_TYPE_PID_T |
---|
32 | AC_TYPE_SIZE_T |
---|
33 | AC_TYPE_UINT16_T |
---|
34 | AC_TYPE_UINT32_T |
---|
35 | AC_TYPE_UINT8_T |
---|
36 | |
---|
37 | # Checks for library functions. |
---|
38 | AC_FUNC_FORK |
---|
39 | AC_FUNC_MALLOC |
---|
40 | AC_FUNC_REALLOC |
---|
41 | AC_CHECK_FUNCS([dup2 getcwd memset setenv strdup strstr]) |
---|
42 | |
---|
43 | #============================================================================ |
---|
44 | # Detect if gdal is installed |
---|
45 | #============================================================================ |
---|
46 | |
---|
47 | AC_ARG_WITH([gdal-config], |
---|
48 | [AS_HELP_STRING([--with-gdal-config=FILE], [specify an alternative gdal-config file])], |
---|
49 | [GDAL_CONFIG="$withval"], [GDAL_CONFIG=""]) |
---|
50 | if test -z $GDAL_CONFIG; |
---|
51 | then |
---|
52 | AC_PATH_PROG([GDAL_CONFIG], [gdal-config]) |
---|
53 | if test -z $GDAL_CONFIG; |
---|
54 | then |
---|
55 | 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.]) |
---|
56 | fi |
---|
57 | |
---|
58 | else |
---|
59 | if test -f $GDAL_CONFIG; then |
---|
60 | AC_MSG_RESULT([Using user-specified gdal-config file: $GDAL_CONFIG]) |
---|
61 | else |
---|
62 | AC_MSG_ERROR([the user-specified gdal-config file $GDAL_CONFIG does not exist]) |
---|
63 | fi |
---|
64 | fi |
---|
65 | |
---|
66 | GDAL_CFLAGS="`$GDAL_CONFIG --cflags`" |
---|
67 | GDAL_LIBS="`$GDAL_CONFIG --libs`" |
---|
68 | |
---|
69 | AC_SUBST([GDAL_CFLAGS]) |
---|
70 | AC_SUBST([GDAL_LIBS]) |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | # =========================================================================== |
---|
76 | # Detect if libxml2 is installed |
---|
77 | # =========================================================================== |
---|
78 | |
---|
79 | AC_ARG_WITH([xml2config], |
---|
80 | [AS_HELP_STRING([--with-xml2config=FILE], [specify an alternative xml2-config file])], |
---|
81 | [XML2CONFIG="$withval"], [XML2CONFIG=""]) |
---|
82 | |
---|
83 | if test "x$XML2CONFIG" = "x"; then |
---|
84 | # XML2CONFIG was not specified, so search within the current path |
---|
85 | AC_PATH_PROG([XML2CONFIG], [xml2-config]) |
---|
86 | |
---|
87 | # If we couldn't find xml2-config, display a warning |
---|
88 | if test "x$XML2CONFIG" = "x"; then |
---|
89 | 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.]) |
---|
90 | fi |
---|
91 | else |
---|
92 | # XML2CONFIG was specified; display a message to the user |
---|
93 | if test "x$XML2CONFIG" = "xyes"; then |
---|
94 | AC_MSG_ERROR([you must specify a parameter to --with-xml2config, e.g. --with-xml2config=/path/to/xml2-config]) |
---|
95 | else |
---|
96 | if test -f $XML2CONFIG; then |
---|
97 | AC_MSG_RESULT([Using user-specified xml2-config file: $XML2CONFIG]) |
---|
98 | else |
---|
99 | AC_MSG_ERROR([the user-specified xml2-config file $XML2CONFIG does not exist]) |
---|
100 | fi |
---|
101 | fi |
---|
102 | fi |
---|
103 | |
---|
104 | |
---|
105 | # Extract the linker and include flags |
---|
106 | XML2_LDFLAGS=`$XML2CONFIG --libs` |
---|
107 | XML2_CPPFLAGS=`$XML2CONFIG --cflags` |
---|
108 | |
---|
109 | # Check headers file |
---|
110 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
111 | CPPFLAGS="$XML2_CPPFLAGS" |
---|
112 | AC_CHECK_HEADERS([libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h], |
---|
113 | [], [AC_MSG_ERROR([could not find headers include related to libxml2])]) |
---|
114 | |
---|
115 | # Ensure we can link against libxml2 |
---|
116 | LIBS_SAVE="$LIBS" |
---|
117 | LIBS="$XML2_LDFLAGS" |
---|
118 | AC_CHECK_LIB([xml2], [xmlInitParser], [], [AC_MSG_ERROR([could not find libxml2])], []) |
---|
119 | |
---|
120 | AC_SUBST([XML2_CPPFLAGS]) |
---|
121 | AC_SUBST([XML2_LDFLAGS]) |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | # =========================================================================== |
---|
127 | # Detect if python is installed |
---|
128 | # =========================================================================== |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | |
---|
133 | AC_ARG_WITH([python], |
---|
134 | [AS_HELP_STRING([--with-python=PATH], [To enabled python support or specify an alternative directory for python installation, disabled by default])], |
---|
135 | [PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""]) |
---|
136 | |
---|
137 | |
---|
138 | if test -z "$PYTHON_ENABLED" |
---|
139 | then |
---|
140 | PYTHON_FILE="" |
---|
141 | else |
---|
142 | PYTHONCONFIG="$PYTHON_PATH/bin/python-config" |
---|
143 | PYTHON_FILE="service_internal_python.o" |
---|
144 | if test "$PYTHON_PATH" = "yes" |
---|
145 | then |
---|
146 | # PHP was not specified, so search within the current path |
---|
147 | AC_PATH_PROG([PYTHONCONFIG], [python-config]) |
---|
148 | else |
---|
149 | PYTHONCONFIG="$PYTHON_PATH/bin/python-config" |
---|
150 | fi |
---|
151 | |
---|
152 | # Extract the linker and include flags |
---|
153 | PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags` |
---|
154 | PYTHON_CPPFLAGS=`$PYTHONCONFIG --cflags` |
---|
155 | |
---|
156 | # Check headers file |
---|
157 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
158 | CPPFLAGS="$PYTHON_CPPFLAGS" |
---|
159 | AC_CHECK_HEADERS([Python.h], |
---|
160 | [], [AC_MSG_ERROR([could not find headers include related to libpython])]) |
---|
161 | |
---|
162 | # Ensure we can link against libphp |
---|
163 | LIBS_SAVE="$LIBS" |
---|
164 | LIBS="$PYTHON_LDFLAGS" |
---|
165 | PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'` |
---|
166 | AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
167 | AC_SUBST([PYTHON_CPPFLAGS]) |
---|
168 | AC_SUBST([PYTHON_LDFLAGS]) |
---|
169 | fi |
---|
170 | |
---|
171 | AC_SUBST([PYTHON_ENABLED]) |
---|
172 | AC_SUBST([PYTHON_FILE]) |
---|
173 | |
---|
174 | # =========================================================================== |
---|
175 | # Detect if php is installed |
---|
176 | # =========================================================================== |
---|
177 | |
---|
178 | |
---|
179 | |
---|
180 | |
---|
181 | AC_ARG_WITH([php], |
---|
182 | [AS_HELP_STRING([--with-php=PATH], [To enabled php support or specify an alternative directory for php installation, disabled by default])], |
---|
183 | [PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""]) |
---|
184 | |
---|
185 | |
---|
186 | if test -z "$PHP_ENABLED" |
---|
187 | then |
---|
188 | PHP_FILE="" |
---|
189 | else |
---|
190 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
191 | PHP_FILE="service_internal_php.o" |
---|
192 | if test "$PHP_PATH" = "yes" |
---|
193 | then |
---|
194 | # PHP was not specified, so search within the current path |
---|
195 | AC_PATH_PROG([PHPCONFIG], [php-config]) |
---|
196 | else |
---|
197 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
198 | fi |
---|
199 | |
---|
200 | # Extract the linker and include flags |
---|
201 | PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5" |
---|
202 | PHP_CPPFLAGS=`$PHPCONFIG --includes` |
---|
203 | |
---|
204 | # Check headers file |
---|
205 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
206 | CPPFLAGS="$PHP_CPPFLAGS" |
---|
207 | AC_CHECK_HEADERS([sapi/embed/php_embed.h], |
---|
208 | [], [AC_MSG_ERROR([could not find headers include related to libphp])]) |
---|
209 | |
---|
210 | # Ensure we can link against libphp |
---|
211 | LIBS_SAVE="$LIBS" |
---|
212 | LIBS="$PHP_LDFLAGS" |
---|
213 | # Shouldn't we get php here rather than php5 :) ?? |
---|
214 | AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], []) |
---|
215 | AC_SUBST([PHP_CPPFLAGS]) |
---|
216 | AC_SUBST([PHP_LDFLAGS]) |
---|
217 | fi |
---|
218 | |
---|
219 | AC_SUBST([PHP_ENABLED]) |
---|
220 | AC_SUBST([PHP_FILE]) |
---|
221 | |
---|
222 | |
---|
223 | # =========================================================================== |
---|
224 | # Detect if perl is installed |
---|
225 | # =========================================================================== |
---|
226 | |
---|
227 | |
---|
228 | AC_ARG_WITH([perl], |
---|
229 | [AS_HELP_STRING([--with-perl=PATH], [To enabled perl support or specify an alternative directory for perl installation, disabled by default])], |
---|
230 | [PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""]) |
---|
231 | |
---|
232 | |
---|
233 | if test -z "$PERL_ENABLED" |
---|
234 | then |
---|
235 | PERL_FILE="" |
---|
236 | else |
---|
237 | PERLCONFIG="$PERL_PATH/bin/perl" |
---|
238 | PHP_FILE="service_internal_perl.o" |
---|
239 | if test "$PERL_PATH" = "yes" |
---|
240 | then |
---|
241 | # PHP was not specified, so search within the current path |
---|
242 | AC_PATH_PROG([PERLCONFIG], [perl]) |
---|
243 | else |
---|
244 | PERLCONFIG="$PERL_PATH/bin/perl" |
---|
245 | fi |
---|
246 | |
---|
247 | # Extract the linker and include flags |
---|
248 | PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts` |
---|
249 | PERL_CPPFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ccopts` |
---|
250 | |
---|
251 | # Check headers file |
---|
252 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
253 | CPPFLAGS="$PERL_CPPFLAGS" |
---|
254 | AC_CHECK_HEADERS([EXTERN.h], |
---|
255 | [], [AC_MSG_ERROR([could not find headers include related to libperl])]) |
---|
256 | |
---|
257 | AC_SUBST([PERL_CPPFLAGS]) |
---|
258 | AC_SUBST([PERL_LDFLAGS]) |
---|
259 | fi |
---|
260 | |
---|
261 | AC_SUBST([PERL_ENABLED]) |
---|
262 | AC_SUBST([PERL_FILE]) |
---|
263 | |
---|
264 | # =========================================================================== |
---|
265 | # Detect if java is installed |
---|
266 | # =========================================================================== |
---|
267 | |
---|
268 | |
---|
269 | |
---|
270 | AC_ARG_WITH([java], |
---|
271 | [AS_HELP_STRING([--with-java=PATH], [To enabled java support, specify a JDK_HOME, disabled by default])], |
---|
272 | [JDKHOME="$withval"; JAVA_ENABLED="-DUSE_JAVA"], [JAVA_ENABLED=""]) |
---|
273 | |
---|
274 | if test -z "$JAVA_ENABLED" |
---|
275 | then |
---|
276 | JAVA_FILE="" |
---|
277 | else |
---|
278 | JAVA_FILE="service_internal_java.o" |
---|
279 | if test "x$JDKHOME" = "x"; |
---|
280 | then |
---|
281 | 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.]) |
---|
282 | fi # JAVA was specified; display a message to the user |
---|
283 | if test "x$JDKHOME" = "xyes"; |
---|
284 | then |
---|
285 | AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java]) |
---|
286 | fi |
---|
287 | # Extract the linker and include flags |
---|
288 | if test -d "$JDKHOME/jre/lib/i386"; |
---|
289 | then |
---|
290 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/client/ -ljvm -lpthread" |
---|
291 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
292 | else |
---|
293 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/client/ -ljvm -lpthread" |
---|
294 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
295 | fi |
---|
296 | |
---|
297 | # Check headers file (second time we check that in fact) |
---|
298 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
299 | CPPFLAGS="$JAVA_CPPFLAGS" |
---|
300 | AC_CHECK_HEADERS([jni.h], |
---|
301 | [], [AC_MSG_ERROR([could not find headers include related to libjava])]) |
---|
302 | |
---|
303 | # Ensure we can link against libjava |
---|
304 | LIBS_SAVE="$LIBS" |
---|
305 | LIBS="$JAVA_LDFLAGS" |
---|
306 | # Shouldn't we get java here rather than java5 :) ?? |
---|
307 | AC_CHECK_LIB([jvm], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
308 | #AC_CHECK_LIB([jvm], [main], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
309 | |
---|
310 | AC_SUBST([JAVA_CPPFLAGS]) |
---|
311 | AC_SUBST([JAVA_LDFLAGS]) |
---|
312 | fi |
---|
313 | |
---|
314 | AC_SUBST([JAVA_ENABLED]) |
---|
315 | AC_SUBST([JAVA_FILE]) |
---|
316 | |
---|
317 | |
---|
318 | |
---|
319 | |
---|
320 | |
---|
321 | # =========================================================================== |
---|
322 | # Detect if spidermonkey is installed |
---|
323 | # =========================================================================== |
---|
324 | |
---|
325 | AC_ARG_WITH([js], |
---|
326 | [AS_HELP_STRING([--with-js=PATH], [specify --with-js=path-to-js to enabled js support, specify --with-js on linux debian like, js support is disabled by default ])], |
---|
327 | [JSHOME="$withval";JS_ENABLED="-DUSE_JS"], [JS_ENABLED=""]) |
---|
328 | |
---|
329 | if test -z "$JS_ENABLED" |
---|
330 | then |
---|
331 | JS_FILE="" |
---|
332 | else |
---|
333 | if test "$JSHOME" = "yes" |
---|
334 | then |
---|
335 | JS_FILE="service_internal_js.o" |
---|
336 | |
---|
337 | #on teste si on est sous debian like |
---|
338 | if test -f "/usr/bin/dpkg" |
---|
339 | then |
---|
340 | if test -n "`dpkg -l | grep libmozjs-dev`" |
---|
341 | then |
---|
342 | JS_CPPFLAGS="-I/usr/include/mozjs/" |
---|
343 | JS_LDFLAGS="-L/usr/lib -lmozjs -lm" |
---|
344 | JS_LIB="mozjs" |
---|
345 | else |
---|
346 | AC_MSG_ERROR([You must install libmozjs-dev or specify your custom install of libjs]) |
---|
347 | fi |
---|
348 | else |
---|
349 | AC_MSG_ERROR([You must specify your custom install of libjs]) |
---|
350 | fi |
---|
351 | else |
---|
352 | JS_CPPFLAGS="-I$JSHOME/include/js" |
---|
353 | JS_LDFLAGS="-L$JSHOME/lib -ljs -lm" |
---|
354 | JS_LIB="js" |
---|
355 | |
---|
356 | fi |
---|
357 | |
---|
358 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
359 | CPPFLAGS="$JS_CPPFLAGS" |
---|
360 | |
---|
361 | |
---|
362 | #AC_CHECK_HEADERS([jsapi.h], |
---|
363 | # [], [AC_MSG_ERROR([could not find headers include related to libjs])]) |
---|
364 | |
---|
365 | |
---|
366 | LIBS_SAVE="$LIBS" |
---|
367 | LIBS="$JS_LDFLAGS" |
---|
368 | |
---|
369 | AC_CHECK_LIB([$JS_LIB], [JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) |
---|
370 | |
---|
371 | AC_SUBST([JS_CPPFLAGS]) |
---|
372 | AC_SUBST([JS_LDFLAGS]) |
---|
373 | fi |
---|
374 | |
---|
375 | AC_SUBST([JS_ENABLED]) |
---|
376 | AC_SUBST([JS_FILE]) |
---|
377 | |
---|
378 | |
---|
379 | |
---|
380 | |
---|
381 | |
---|
382 | |
---|
383 | AC_CONFIG_FILES([Makefile]) |
---|
384 | AC_OUTPUT |
---|