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 | AC_ARG_WITH([python], |
---|
131 | [AS_HELP_STRING([--with-python=PATH], [specify an alternative directory for python installation])], |
---|
132 | [PYTHONCONFIG="$withval/bin/python-config"], [PYTHONCONFIG=""]) |
---|
133 | |
---|
134 | if test "x$PYTHONCONFIG" = "x"; then |
---|
135 | # PYTHON was not specified, so search within the current path |
---|
136 | AC_PATH_PROG([PYTHONCONFIG], [python-config]) |
---|
137 | |
---|
138 | # If we couldn't find python-config, display a warning |
---|
139 | if test "x$PYTHONCONFIG" = "x"; then |
---|
140 | AC_MSG_ERROR([could not find python-config from libpython within the current path. You may need to try re-running configure with a --with-python parameter.]) |
---|
141 | fi |
---|
142 | else |
---|
143 | # PYTHON was specified; display a message to the user |
---|
144 | if test "x$PYTHON" = "xyes"; then |
---|
145 | AC_MSG_ERROR([you must specify a parameter to --with-python, e.g. --with-python=/path/to/python]) |
---|
146 | else |
---|
147 | if test -f $PYTHONCONFIG; then |
---|
148 | AC_MSG_RESULT([Using user-specified python-config file: $PYTHONCONFIG]) |
---|
149 | else |
---|
150 | AC_MSG_ERROR([the user-specified python-config file $PYTHONCONFIG does not exist]) |
---|
151 | fi |
---|
152 | fi |
---|
153 | fi |
---|
154 | |
---|
155 | |
---|
156 | # Extract the linker and include flags |
---|
157 | PYTHON_LDFLAGS=`$PYTHONCONFIG --libs` |
---|
158 | PYTHON_CPPFLAGS=`$PYTHONCONFIG --cflags` |
---|
159 | |
---|
160 | # Check headers file |
---|
161 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
162 | CPPFLAGS="$PYTHON_CPPFLAGS" |
---|
163 | AC_CHECK_HEADERS([Python.h], |
---|
164 | [], [AC_MSG_ERROR([could not find headers include related to libpython])]) |
---|
165 | |
---|
166 | # Ensure we can link against libpython |
---|
167 | LIBS_SAVE="$LIBS" |
---|
168 | LIBS="$PYTHON_LDFLAGS" |
---|
169 | # Shouldn't we get python here rather than python2.6 :) ?? |
---|
170 | PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'` |
---|
171 | echo $PY_LIB |
---|
172 | AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
173 | |
---|
174 | AC_SUBST([PYTHON_CPPFLAGS]) |
---|
175 | AC_SUBST([PYTHON_LDFLAGS]) |
---|
176 | |
---|
177 | # =========================================================================== |
---|
178 | # Detect if php is installed |
---|
179 | # =========================================================================== |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | |
---|
184 | AC_ARG_WITH([php], |
---|
185 | [AS_HELP_STRING([--with-php=PATH], [specify an alternative directory for php installation or --with-php=no to disable php support])], |
---|
186 | [PHP_PATH="$withval"], [PHP_PATH=""]) |
---|
187 | if test "$PHP_PATH" != "no"; |
---|
188 | then |
---|
189 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
190 | PHP_ENABLED="-DUSE_PHP" |
---|
191 | PHP_FILE="service_internal_php.o" |
---|
192 | if test "x$PHPCONFIG" = "x"; |
---|
193 | then |
---|
194 | # PHP was not specified, so search within the current path |
---|
195 | AC_PATH_PROG([PHPCONFIG], [php-config]) |
---|
196 | |
---|
197 | # If we couldn't find php-config, display a warning |
---|
198 | if test "x$PHPCONFIG" = "x"; |
---|
199 | then |
---|
200 | AC_MSG_ERROR([could not find php-config from libphp within the current path. You may need to try re-running configure with a --with-php parameter.]) |
---|
201 | fi |
---|
202 | else |
---|
203 | # PHP was specified; display a message to the user |
---|
204 | if test "x$PHP" = "xyes"; |
---|
205 | then |
---|
206 | AC_MSG_ERROR([you must specify a parameter to --with-php, e.g. --with-php=/path/to/php]) |
---|
207 | else |
---|
208 | if test -f $PHPCONFIG; |
---|
209 | then |
---|
210 | AC_MSG_RESULT([Using user-specified php-config file: $PHPCONFIG]) |
---|
211 | else |
---|
212 | AC_MSG_ERROR([the user-specified php-config file $PHPCONFIG does not exist]) |
---|
213 | fi |
---|
214 | fi |
---|
215 | fi |
---|
216 | # Extract the linker and include flags |
---|
217 | PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5" |
---|
218 | PHP_CPPFLAGS=`$PHPCONFIG --includes` |
---|
219 | |
---|
220 | # Check headers file |
---|
221 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
222 | CPPFLAGS="$PHP_CPPFLAGS" |
---|
223 | AC_CHECK_HEADERS([sapi/embed/php_embed.h], |
---|
224 | [], [AC_MSG_ERROR([could not find headers include related to libphp])]) |
---|
225 | |
---|
226 | # Ensure we can link against libphp |
---|
227 | LIBS_SAVE="$LIBS" |
---|
228 | LIBS="$PHP_LDFLAGS" |
---|
229 | # Shouldn't we get php here rather than php5 :) ?? |
---|
230 | AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], []) |
---|
231 | AC_SUBST([PHP_CPPFLAGS]) |
---|
232 | AC_SUBST([PHP_LDFLAGS]) |
---|
233 | else |
---|
234 | PHP_ENABLED="" |
---|
235 | PHP_FILE="" |
---|
236 | fi |
---|
237 | |
---|
238 | AC_SUBST([PHP_ENABLED]) |
---|
239 | AC_SUBST([PHP_FILE]) |
---|
240 | |
---|
241 | |
---|
242 | # =========================================================================== |
---|
243 | # Detect if java is installed |
---|
244 | # =========================================================================== |
---|
245 | |
---|
246 | |
---|
247 | |
---|
248 | AC_ARG_WITH([java], |
---|
249 | [AS_HELP_STRING([--with-java=PATH], [specify an alternative directory for java installation or --with-java=no to disabled java support])], |
---|
250 | [JDKHOME="$withval"], [JDKHOME=""]) |
---|
251 | |
---|
252 | |
---|
253 | if test "$JDKHOME" != "no"; |
---|
254 | then |
---|
255 | JAVA_ENABLED="-DUSE_JAVA" |
---|
256 | JAVA_FILE="service_internal_java.o" |
---|
257 | if test "x$JDKHOME" = "x"; |
---|
258 | then |
---|
259 | # JAVA was not specified, so search within the current path |
---|
260 | #AC_PATH_PROG([JAVACONFIG], [java]) |
---|
261 | |
---|
262 | # If we couldn't find java-config, display a warning |
---|
263 | if test "x$JDKHOME" = "x"; |
---|
264 | then |
---|
265 | 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.]) |
---|
266 | fi |
---|
267 | else |
---|
268 | # JAVA was specified; display a message to the user |
---|
269 | if test "x$JDKHOME" = "xyes"; |
---|
270 | then |
---|
271 | AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java]) |
---|
272 | else |
---|
273 | if test -f $JDKHOME/include/jni.h; |
---|
274 | then |
---|
275 | AC_MSG_RESULT([Using specific java install dir : $JDKHOME]) |
---|
276 | else |
---|
277 | AC_MSG_ERROR([the specific java install dir $DKHOME does not exist]) |
---|
278 | fi |
---|
279 | fi |
---|
280 | fi |
---|
281 | # Extract the linker and include flags |
---|
282 | if test -d "$JDKHOME/jre/lib/i386"; |
---|
283 | then |
---|
284 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/ -ljavaplugin_jni -L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread" |
---|
285 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
286 | else |
---|
287 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/ -ljavaplugin_jni -L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread" |
---|
288 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
289 | fi |
---|
290 | |
---|
291 | # Check headers file (second time we check that in fact) |
---|
292 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
293 | CPPFLAGS="$JAVA_CPPFLAGS" |
---|
294 | AC_CHECK_HEADERS([jni.h], |
---|
295 | [], [AC_MSG_ERROR([could not find headers include related to libjava])]) |
---|
296 | |
---|
297 | # Ensure we can link against libjava |
---|
298 | LIBS_SAVE="$LIBS" |
---|
299 | LIBS="$JAVA_LDFLAGS" |
---|
300 | # Shouldn't we get java here rather than java5 :) ?? |
---|
301 | AC_CHECK_LIB([javaplugin_jni], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
302 | AC_CHECK_LIB([jvm], [main], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
303 | |
---|
304 | AC_SUBST([JAVA_CPPFLAGS]) |
---|
305 | AC_SUBST([JAVA_LDFLAGS]) |
---|
306 | else |
---|
307 | JAVA_ENABLED="" |
---|
308 | JAVA_FILE="" |
---|
309 | fi |
---|
310 | |
---|
311 | AC_SUBST([JAVA_ENABLED]) |
---|
312 | AC_SUBST([JAVA_FILE]) |
---|
313 | |
---|
314 | |
---|
315 | |
---|
316 | |
---|
317 | |
---|
318 | # =========================================================================== |
---|
319 | # Detect if spidermonkey is installed |
---|
320 | # =========================================================================== |
---|
321 | |
---|
322 | AC_ARG_WITH([js], |
---|
323 | [AS_HELP_STRING([--with-js=PATH], [specify an alternative directory for spidermonkey installation or --with-js=no to disabled js support])], |
---|
324 | [JSHOME="$withval"], [JSHOME=""]) |
---|
325 | if test "$JSHOME" != "no"; |
---|
326 | then |
---|
327 | JS_ENABLED="-DUSE_JS" |
---|
328 | JS_FILE="service_internal_js.o" |
---|
329 | |
---|
330 | #if test "x$JSHOME" = "x"; then |
---|
331 | # # JS was not specified, so search within the current path |
---|
332 | # # AC_PATH_PROG([JSCONFIG], [js-config]) |
---|
333 | # |
---|
334 | # # If we couldn't find js-config, display a warning |
---|
335 | # if test "x$JSHOME" = "x"; then |
---|
336 | # AC_MSG_ERROR([could not find js-config from libpython within the current path. You may need to try re-running configure with a --with-js parameter.]) |
---|
337 | # fi |
---|
338 | # else |
---|
339 | # # JS was specified; display a message to the user |
---|
340 | # if test "x$JSHOME" = "xyes"; then |
---|
341 | # AC_MSG_ERROR([you must specify a parameter to --with-js, e.g. --with-js=/path/to/js]) |
---|
342 | # else |
---|
343 | # if test -f $JSHOME; then |
---|
344 | # AC_MSG_RESULT([Using user-specified js-config file: $JSCONFIG]) |
---|
345 | # else |
---|
346 | # AC_MSG_ERROR([the user-specified js-config file $JSCONFIG does not exist]) |
---|
347 | # fi |
---|
348 | # fi |
---|
349 | # fi |
---|
350 | |
---|
351 | |
---|
352 | # Extract the linker and include flags |
---|
353 | JS_CPPFLAGS="-I$JSHOME/include" |
---|
354 | JS_LDFLAGS="-L$JSHOME/lib -ljs -lm" |
---|
355 | # Check headers file |
---|
356 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
357 | CPPFLAGS="$JS_CPPFLAGS" |
---|
358 | #AC_CHECK_HEADERS([jsapi.h], |
---|
359 | # [], [AC_MSG_ERROR([could not find headers include related to libjs])]) |
---|
360 | |
---|
361 | # Ensure we can link against libjs |
---|
362 | LIBS_SAVE="$LIBS" |
---|
363 | LIBS="$JS_LDFLAGS" |
---|
364 | |
---|
365 | AC_CHECK_LIB([js], [JS_CallFunctionName], [], [AC_MSG_ERROR([could not find libjs])], []) |
---|
366 | |
---|
367 | AC_SUBST([JS_CPPFLAGS]) |
---|
368 | AC_SUBST([JS_LDFLAGS]) |
---|
369 | |
---|
370 | else |
---|
371 | JS_ENABLED="" |
---|
372 | JS_FILE="" |
---|
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 |
---|