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