[1] | 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 | AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], []) |
---|
| 172 | |
---|
| 173 | AC_SUBST([PYTHON_CPPFLAGS]) |
---|
| 174 | AC_SUBST([PYTHON_LDFLAGS]) |
---|
| 175 | |
---|
| 176 | # =========================================================================== |
---|
| 177 | # Detect if php is installed |
---|
| 178 | # =========================================================================== |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | AC_ARG_WITH([php], |
---|
| 184 | [AS_HELP_STRING([--with-php=PATH], [specify an alternative directory for php installation or --with-php=no to disable php support])], |
---|
| 185 | [PHP_PATH="$withval"], [PHP_PATH=""]) |
---|
| 186 | if test "$PHP_PATH" != "no"; |
---|
| 187 | then |
---|
| 188 | PHPCONFIG="$PHP_PATH/bin/php-config" |
---|
| 189 | PHP_ENABLED="-DUSE_PHP" |
---|
| 190 | PHP_FILE="service_internal_php.o" |
---|
| 191 | if test "x$PHPCONFIG" = "x"; |
---|
| 192 | then |
---|
| 193 | # PHP was not specified, so search within the current path |
---|
| 194 | AC_PATH_PROG([PHPCONFIG], [php-config]) |
---|
| 195 | |
---|
| 196 | # If we couldn't find php-config, display a warning |
---|
| 197 | if test "x$PHPCONFIG" = "x"; |
---|
| 198 | then |
---|
| 199 | 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.]) |
---|
| 200 | fi |
---|
| 201 | else |
---|
| 202 | # PHP was specified; display a message to the user |
---|
| 203 | if test "x$PHP" = "xyes"; |
---|
| 204 | then |
---|
| 205 | AC_MSG_ERROR([you must specify a parameter to --with-php, e.g. --with-php=/path/to/php]) |
---|
| 206 | else |
---|
| 207 | if test -f $PHPCONFIG; |
---|
| 208 | then |
---|
| 209 | AC_MSG_RESULT([Using user-specified php-config file: $PHPCONFIG]) |
---|
| 210 | else |
---|
| 211 | AC_MSG_ERROR([the user-specified php-config file $PHPCONFIG does not exist]) |
---|
| 212 | fi |
---|
| 213 | fi |
---|
| 214 | fi |
---|
| 215 | # Extract the linker and include flags |
---|
| 216 | PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5" |
---|
| 217 | PHP_CPPFLAGS=`$PHPCONFIG --includes` |
---|
| 218 | |
---|
| 219 | # Check headers file |
---|
| 220 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
| 221 | CPPFLAGS="$PHP_CPPFLAGS" |
---|
| 222 | AC_CHECK_HEADERS([sapi/embed/php_embed.h], |
---|
| 223 | [], [AC_MSG_ERROR([could not find headers include related to libphp])]) |
---|
| 224 | |
---|
| 225 | # Ensure we can link against libphp |
---|
| 226 | LIBS_SAVE="$LIBS" |
---|
| 227 | LIBS="$PHP_LDFLAGS" |
---|
| 228 | # Shouldn't we get php here rather than php5 :) ?? |
---|
| 229 | AC_CHECK_LIB([php5], [call_user_function], [], [AC_MSG_ERROR([could not find libphp])], []) |
---|
| 230 | AC_SUBST([PHP_CPPFLAGS]) |
---|
| 231 | AC_SUBST([PHP_LDFLAGS]) |
---|
| 232 | else |
---|
| 233 | PHP_ENABLED="" |
---|
| 234 | PHP_FILE="" |
---|
| 235 | fi |
---|
| 236 | |
---|
| 237 | AC_SUBST([PHP_ENABLED]) |
---|
| 238 | AC_SUBST([PHP_FILE]) |
---|
| 239 | |
---|
| 240 | |
---|
| 241 | # =========================================================================== |
---|
| 242 | # Detect if java is installed |
---|
| 243 | # =========================================================================== |
---|
| 244 | |
---|
| 245 | |
---|
| 246 | |
---|
| 247 | AC_ARG_WITH([java], |
---|
| 248 | [AS_HELP_STRING([--with-java=PATH], [specify an alternative directory for java installation or --with-java=no to disabled java support])], |
---|
| 249 | [JDKHOME="$withval"], [JDKHOME=""]) |
---|
| 250 | |
---|
| 251 | |
---|
| 252 | if test "$JDKHOME" != "no"; |
---|
| 253 | then |
---|
| 254 | JAVA_ENABLED="-DUSE_JAVA" |
---|
| 255 | JAVA_FILE="service_internal_java.o" |
---|
| 256 | if test "x$JDKHOME" = "x"; |
---|
| 257 | then |
---|
| 258 | # JAVA was not specified, so search within the current path |
---|
| 259 | #AC_PATH_PROG([JAVACONFIG], [java]) |
---|
| 260 | |
---|
| 261 | # If we couldn't find java-config, display a warning |
---|
| 262 | if test "x$JDKHOME" = "x"; |
---|
| 263 | then |
---|
| 264 | 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.]) |
---|
| 265 | fi |
---|
| 266 | else |
---|
| 267 | # JAVA was specified; display a message to the user |
---|
| 268 | if test "x$JDKHOME" = "xyes"; |
---|
| 269 | then |
---|
| 270 | AC_MSG_ERROR([you must specify a parameter to --with-java, e.g. --with-java=/path/to/java]) |
---|
| 271 | else |
---|
| 272 | if test -f $JDKHOME/include/jni.h; |
---|
| 273 | then |
---|
| 274 | AC_MSG_RESULT([Using specific java install dir : $JDKHOME]) |
---|
| 275 | else |
---|
| 276 | AC_MSG_ERROR([the specific java install dir $DKHOME does not exist]) |
---|
| 277 | fi |
---|
| 278 | fi |
---|
| 279 | fi |
---|
| 280 | # Extract the linker and include flags |
---|
| 281 | if test -d "$JDKHOME/jre/lib/i386"; |
---|
| 282 | then |
---|
| 283 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/i386/ -ljavaplugin_jni -L$JDKHOME/jre/lib/i386/server/ -ljvm -lpthread" |
---|
| 284 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
| 285 | else |
---|
| 286 | JAVA_LDFLAGS="-L$JDKHOME/jre/lib/amd64/ -ljavaplugin_jni -L$JDKHOME/jre/lib/amd64/server/ -ljvm -lpthread" |
---|
| 287 | JAVA_CPPFLAGS="-I$JDKHOME/include -I$JDKHOME/include/linux" |
---|
| 288 | fi |
---|
| 289 | |
---|
| 290 | # Check headers file (second time we check that in fact) |
---|
| 291 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
| 292 | CPPFLAGS="$JAVA_CPPFLAGS" |
---|
| 293 | AC_CHECK_HEADERS([jni.h], |
---|
| 294 | [], [AC_MSG_ERROR([could not find headers include related to libjava])]) |
---|
| 295 | |
---|
| 296 | # Ensure we can link against libjava |
---|
| 297 | LIBS_SAVE="$LIBS" |
---|
| 298 | LIBS="$JAVA_LDFLAGS" |
---|
| 299 | # Shouldn't we get java here rather than java5 :) ?? |
---|
| 300 | AC_CHECK_LIB([javaplugin_jni], [JNI_CreateJavaVM], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
| 301 | AC_CHECK_LIB([jvm], [main], [], [AC_MSG_ERROR([could not find libjava])], []) |
---|
| 302 | |
---|
| 303 | AC_SUBST([JAVA_CPPFLAGS]) |
---|
| 304 | AC_SUBST([JAVA_LDFLAGS]) |
---|
| 305 | else |
---|
| 306 | JAVA_ENABLED="" |
---|
| 307 | JAVA_FILE="" |
---|
| 308 | fi |
---|
| 309 | |
---|
| 310 | AC_SUBST([JAVA_ENABLED]) |
---|
| 311 | AC_SUBST([JAVA_FILE]) |
---|
| 312 | |
---|
| 313 | |
---|
| 314 | |
---|
| 315 | |
---|
| 316 | |
---|
| 317 | # =========================================================================== |
---|
| 318 | # Detect if spidermonkey is installed |
---|
| 319 | # =========================================================================== |
---|
| 320 | |
---|
| 321 | AC_ARG_WITH([js], |
---|
[3] | 322 | [AS_HELP_STRING([--with-js=PATH], [specify --with-js to enabled js support or --with-js=path-to-js js support is disabled by default ])], |
---|
[1] | 323 | [JSHOME="$withval"], [JSHOME=""]) |
---|
[3] | 324 | |
---|
| 325 | JS_ENABLED="" |
---|
| 326 | JS_FILE="" |
---|
| 327 | |
---|
| 328 | |
---|
| 329 | if test "$JSHOME" = "yes" |
---|
[1] | 330 | then |
---|
[3] | 331 | JS_ENABLED="-DUSE_JS" |
---|
[1] | 332 | JS_FILE="service_internal_js.o" |
---|
| 333 | |
---|
[3] | 334 | #on teste si on est sous debian like |
---|
| 335 | if test -f "/usr/bin/dpkg" |
---|
| 336 | then |
---|
| 337 | if test -n "`dpkg -l | grep libmozjs-dev`" |
---|
| 338 | then |
---|
| 339 | JS_CPPFLAGS="-I/usr/include/mozjs/" |
---|
| 340 | JS_LDFLAGS="-L/usr/lib -lmozjs -lm" |
---|
| 341 | JS_LIB="mozjs" |
---|
| 342 | else |
---|
| 343 | AC_MSG_ERROR([You must install libmozjs-dev or specify your custom install of libjs]) |
---|
| 344 | fi |
---|
| 345 | else |
---|
| 346 | JS_LIB="js" |
---|
| 347 | fi |
---|
| 348 | |
---|
[1] | 349 | |
---|
| 350 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
[3] | 351 | CPPFLAGS="$JS_CPPFLAGS" |
---|
| 352 | #AC_CHECK_HEADERS([jsapi.h], |
---|
| 353 | # [], [AC_MSG_ERROR([could not find headers include related to libjs])]) |
---|
[1] | 354 | |
---|
[3] | 355 | # Ensure we can link against libjs |
---|
| 356 | LIBS_SAVE="$LIBS" |
---|
| 357 | LIBS="$JS_LDFLAGS" |
---|
[1] | 358 | |
---|
[3] | 359 | AC_CHECK_LIB([$JS_LIB], [JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) |
---|
[1] | 360 | |
---|
[3] | 361 | AC_SUBST([JS_CPPFLAGS]) |
---|
| 362 | AC_SUBST([JS_LDFLAGS]) |
---|
| 363 | |
---|
| 364 | |
---|
| 365 | else if test "$JSHOME" != "" |
---|
| 366 | then |
---|
| 367 | JS_ENABLED="-DUSE_JS" |
---|
| 368 | JS_FILE="service_internal_js.o" |
---|
| 369 | JS_CPPFLAGS="-I$JSHOME/include" |
---|
| 370 | JS_LDFLAGS="-L$JSHOME/lib -ljs -lm" |
---|
| 371 | JS_LIB="js" |
---|
| 372 | |
---|
| 373 | CPPFLAGS_SAVE="$CPPFLAGS" |
---|
| 374 | CPPFLAGS="$JS_CPPFLAGS" |
---|
| 375 | #AC_CHECK_HEADERS([jsapi.h], |
---|
| 376 | # [], [AC_MSG_ERROR([could not find headers include related to libjs])]) |
---|
| 377 | |
---|
| 378 | # Ensure we can link against libjs |
---|
| 379 | LIBS_SAVE="$LIBS" |
---|
| 380 | LIBS="$JS_LDFLAGS" |
---|
| 381 | |
---|
| 382 | AC_CHECK_LIB([$JS_LIB], [JS_CallFunctionName], [], [AC_MSG_ERROR([could not find $JS_LIB])], []) |
---|
| 383 | |
---|
| 384 | AC_SUBST([JS_CPPFLAGS]) |
---|
| 385 | AC_SUBST([JS_LDFLAGS]) |
---|
| 386 | fi |
---|
[1] | 387 | fi |
---|
| 388 | AC_SUBST([JS_ENABLED]) |
---|
| 389 | AC_SUBST([JS_FILE]) |
---|
| 390 | |
---|
| 391 | |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | |
---|
| 395 | |
---|
| 396 | AC_CONFIG_FILES([Makefile]) |
---|
| 397 | AC_OUTPUT |
---|