1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cacao, 0.92+cvs, cacao@cacaojvm.org)
4 AC_CONFIG_SRCDIR(src/cacao/cacao.c)
7 AM_INIT_AUTOMAKE([1.9.0])
10 AM_CONFIG_HEADER([config.h])
12 AC_PREFIX_DEFAULT(/usr/local/cacao)
17 alpha | alphaev56 | alphapca56 )
19 CFLAGS="-mieee -D__ALPHA__"
22 arm | armv4tl | armv5b )
27 i386 | i486 | i586 | i686 )
39 CFLAGS="-D__POWERPC__"
50 CFLAGS="-D__XDSPCORE__"
54 AC_MSG_ERROR($host_cpu systems are not supported at this time)
59 dnl set optimization and debugging for all architectures and systems
60 CFLAGS="-O0 -g3 $CFLAGS"
66 CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__LINUX__ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
70 CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__DARWIN__"
74 CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__FREEBSD__ -D_XOPEN_SOURCE_EXTENDED"
78 CFLAGS="$CFLAGS -D__IRIX__"
85 dnl define and substitute some architecture specific variables
86 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [Architecture directory])
89 AC_SUBST(USE_SCHEDULER)
92 dnl Checks for programs.
104 AC_LIBLTDL_CONVENIENCE
108 dnl Checks for header files.
111 AC_CHECK_HEADERS([fcntl.h])
112 AC_CHECK_HEADERS([sys/time.h])
113 AC_CHECK_HEADERS([unistd.h])
114 AC_CHECK_HEADERS([sys/ioctl.h])
116 dnl this is for fdlibm
117 AC_CHECK_HEADERS([stdint.h])
118 AC_CHECK_HEADERS([inttypes.h])
119 AC_CHECK_HEADERS([sys/config.h])
120 AC_CHECK_HEADERS([sys/types.h])
121 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
122 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
123 AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
124 AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
126 dnl Checks for typedefs, structures, and compiler characteristics.
135 dnl Checks for library functions.
136 AC_PROG_GCC_TRADITIONAL
140 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
142 dnl Checks for libraries.
144 dnl Checking sizeof void *
145 AC_COMPILE_CHECK_SIZEOF(void *)
148 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
149 if test $ac_cv_func_mmap_fixed_mapped = yes; then
150 AC_CACHE_CHECK(whether MAP_FAILED is defined,
153 [#include <sys/mman.h>
157 ac_cv_map_failed=yes,
158 ac_cv_map_failed=no))
160 AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
163 [#include <sys/mman.h>
167 ac_cv_map_anonymous=yes,
168 ac_cv_map_anonymous=no))
170 AC_CACHE_CHECK(whether MAP_ANON is defined,
173 [#include <sys/mman.h>
180 if test $ac_cv_map_failed = yes; then
181 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
184 if test $ac_cv_map_anonymous = yes; then
185 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
188 if test $ac_cv_map_anon = yes; then
189 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
194 dnl check which ld flags are required to export symbols
195 if test x"$with_gnu_ld" = "xyes"; then
196 EXPORT_SYMBOLS_FLAGS="-Wl,--export-dynamic"
198 EXPORT_SYMBOLS_FLAGS=""
200 AC_SUBST(EXPORT_SYMBOLS_FLAGS)
203 dnl define install prefix
204 if test "x$prefix" = "xNONE"; then
205 CACAO_INSTALL_PREFIX=$ac_default_prefix
207 CACAO_INSTALL_PREFIX=$prefix
209 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
210 AC_SUBST(CACAO_INSTALL_PREFIX)
217 dnl check for JIT compiler
218 AC_ARG_ENABLE([jit], [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])])
220 AC_MSG_CHECKING(whether JIT compiled should be compiled)
221 if test x"$enable_jit" = "xno"; then
223 AM_CONDITIONAL([ENABLE_JIT], [false])
226 AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
227 AM_CONDITIONAL([ENABLE_JIT], [true])
230 dnl check for interpreter
231 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
233 AC_MSG_CHECKING(whether interpreter should be compiled)
234 if test x"$enable_intrp" = "xyes"; then
236 AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
237 AM_CONDITIONAL([ENABLE_INTRP], [true])
241 AM_CONDITIONAL([ENABLE_INTRP], [false])
245 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
246 AC_ERROR(You have to enable at least the JIT or the interpreter.)
248 if test x"${ENABLE_JIT}" = "xyes" -a x"${ENABLE_INTRP}" = "xyes"; then
249 AC_ERROR(This is currently not supported. Please disable the JIT or the interpreter.)
252 dnl check for garbage collector usage
253 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])])
255 AC_MSG_CHECKING(whether GC should be used)
256 if test x"$enable_gc" = "xno"; then
258 AM_CONDITIONAL([DISABLE_GC], [true])
262 AM_CONDITIONAL([DISABLE_GC], [false])
266 dnl check for dump memory usage
267 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])])
269 AC_MSG_CHECKING(whether dump memory should be used)
270 if test x"$enable_dump" = "xno"; then
272 AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
277 dnl check for statistics
278 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
280 AC_MSG_CHECKING(whether statistics generation should be enabled)
281 if test x"$enable_statistics" = "xno"; then
283 AM_CONDITIONAL([STATISTICS], [false])
286 AC_DEFINE([STATISTICS], 1, [use statistics])
287 AM_CONDITIONAL([STATISTICS], [true])
291 AC_ARG_ENABLE([jvmti], [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])])
293 AC_MSG_CHECKING(whether to compile JVMTI support)
294 if test x"$enable_jvmti" = "xyes"; then
296 AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
297 AM_CONDITIONAL([ENABLE_JVMTI], [true])
300 AM_CONDITIONAL([ENABLE_JVMTI], [false])
305 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
306 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
308 AC_MSG_CHECKING(whether to include threads support)
309 enable_threads=${enable_threads:-native}
310 case "$enable_threads" in
313 dnl no threads for boehm
314 ac_configure_args="$ac_configure_args --disable-boehm-threads"
315 AM_CONDITIONAL([USE_THREADS], [false])
316 AM_CONDITIONAL([NATIVE_THREADS], [false])
319 green | native | posix | pthreads)
320 AC_DEFINE([USE_THREADS], 1, [use threads])
321 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
322 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
324 AM_CONDITIONAL([USE_THREADS], [true])
326 if test x"$enable_threads" != "xgreen"; then
327 AC_MSG_RESULT(yes, native)
328 AC_CHECK_LIB(pthread, main)
329 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
331 CFLAGS="$CFLAGS -D_REENTRANT"
333 dnl tell boehm to support threads as well
334 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
335 AM_CONDITIONAL([NATIVE_THREADS], [true])
338 AC_MSG_RESULT(yes, green)
340 dnl no threads for boehm
341 ac_configure_args="$ac_configure_args --disable-boehm-threads"
342 AM_CONDITIONAL([NATIVE_THREADS], [false])
346 AC_MSG_ERROR($enable_threads is an unknown thread package)
351 dnl Check whether the compiler supports the __thread keyword.
352 if test "x$use__thread" != xno; then
353 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
354 [cat > conftest.c <<\EOF
357 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
358 ac_cv_gcc___thread=yes
360 ac_cv_gcc___thread=no
363 if test "$ac_cv_gcc___thread" = yes; then
364 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
367 ac_cv_gcc___thread=no
371 dnl check if linear scan register allocator(lsra) should be used
372 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
374 AC_MSG_CHECKING(whether lsra should be supported)
375 if test x"$enable_lsra" = "xno"; then
379 AC_DEFINE([LSRA], 1, [use lsra])
383 dnl check for inlining
384 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
386 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
387 dnl if test x"$enable_inlining" = "xno"; then
388 dnl AC_MSG_RESULT(yes)
389 dnl AM_CONDITIONAL([USE_INLINING], [false])
391 dnl AC_MSG_RESULT(no)
392 AC_DEFINE([USE_INLINING], 1, [use method inlining])
393 AM_CONDITIONAL([USE_INLINING], [true])
397 dnl check for instruction scheduler
398 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
400 AC_MSG_CHECKING(whether instruction scheduler should be supported)
401 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
402 case "${ARCH_DIR}" in
406 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
411 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
412 AM_CONDITIONAL([USE_SCHEDULER], [true])
415 AM_CONDITIONAL([USE_SCHEDULER], [false])
419 dnl check if zlib should be used
420 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
422 AC_MSG_CHECKING(whether zip archives should be supported)
423 if test x"$enable_zlib" = "xno"; then
425 AM_CONDITIONAL([USE_ZLIB], [false])
428 AC_DEFINE([USE_ZLIB], 1, [use zlib])
429 AC_CHECK_HEADERS([zlib.h])
430 AC_CHECK_LIB(z, main)
431 AM_CONDITIONAL([USE_ZLIB], [true])
435 dnl check if CACAO should be linked statically
436 AC_ARG_ENABLE([staticvm], [AS_HELP_STRING(--enable-staticvm, link GNU classpath's native libraries statically into CACAO [[default=no]])])
438 AC_MSG_CHECKING(whether to link GNU classpath statically into CACAO)
439 if test x"$enable_staticvm" = "xyes"; then
440 ENABLE_STATICVM="yes"
445 if test x"${ENABLE_STATICVM}" = "xyes"; then
447 AM_CONDITIONAL([ENABLE_STATICVM], [true])
450 AM_CONDITIONAL([ENABLE_STATICVM], [false])
452 AC_SUBST(ENABLE_STATICVM)
455 dnl pass configure options to classpath
456 if test x"${ENABLE_STATICVM}" = "xyes"; then
457 AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
458 AM_CONDITIONAL([ENABLE_STATICVM], [true])
460 dnl check for some classpath related stuff when we link statically
463 AM_CONDITIONAL([ENABLE_STATICVM], [false])
467 dnl is GNU classpath installed somewhere different
468 AC_ARG_WITH([classpath-install-dir], [AS_HELP_STRING(--with-classpath-install-dir=<dir>,installation directory of GNU classpath [[default=/usr/local/classpath]])])
470 AC_MSG_CHECKING(where GNU classpath is installed)
471 if test x"$with_classpath_install_dir" != "x"; then
472 if test x"$with_classpath_install_dir" = "xyes"; then
473 AC_MSG_ERROR(please specify the installation prefix)
475 CLASSPATH_INSTALL_DIR="$with_classpath_install_dir"
477 CLASSPATH_INSTALL_DIR="/usr/local/classpath"
479 AC_MSG_RESULT(${CLASSPATH_INSTALL_DIR})
480 AC_DEFINE_UNQUOTED([CLASSPATH_INSTALL_DIR], "${CLASSPATH_INSTALL_DIR}", [GNU classpath installation directory])
481 AC_SUBST(CLASSPATH_INSTALL_DIR)
484 dnl now configure subpackages
485 dnl the export is not my favorite (is there another way?)
487 AC_CONFIG_SUBDIRS(src/boehm-gc src/libltdl src/libffi)
489 AC_CONFIG_FILES([Makefile]
491 [contrib/setenvinstalled]
492 [contrib/setenvsource]
494 [doc/handbook/Makefile]
498 [src/cacaoh/Makefile]
499 [src/fdlibm/Makefile]
502 [src/native/Makefile]
503 [src/native/include/Makefile]
504 [src/native/jvmti/Makefile]
505 [src/native/tools/Makefile]
506 [src/native/vm/Makefile]
507 [src/scripts/Makefile]
509 [src/scripts/rmiregistry]
510 [src/threads/Makefile]
511 [src/threads/green/Makefile]
512 [src/threads/native/Makefile]
513 [src/toolbox/Makefile]
515 [src/vm/jit/Makefile]
516 [src/vm/jit/alpha/Makefile]
517 [src/vm/jit/i386/Makefile]
518 [src/vm/jit/i386/linux/Makefile]
519 [src/vm/jit/i386/freebsd/Makefile]
520 [src/vm/jit/intrp/Makefile]
521 [src/vm/jit/inline/Makefile]
522 [src/vm/jit/loop/Makefile]
523 [src/vm/jit/mips/Makefile]
524 [src/vm/jit/mips/irix/Makefile]
525 [src/vm/jit/mips/linux/Makefile]
526 [src/vm/jit/powerpc/Makefile]
527 [src/vm/jit/powerpc/darwin/Makefile]
528 [src/vm/jit/powerpc/linux/Makefile]
529 [src/vm/jit/schedule/Makefile]
530 [src/vm/jit/tools/Makefile]
531 [src/vm/jit/verify/Makefile]
532 [src/vm/jit/x86_64/Makefile]
534 [tests/codepatching/Makefile]
535 [tests/native/Makefile]
536 [tests/regression/Makefile])
543 ## indent-tabs-mode: t
546 ## compile-command: "automake --add-missing"