1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cacao, 0.94+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)
15 dnl set optimization and debugging for all architectures and systems
16 if test x"$CFLAGS" = "x"; then
22 alpha | alphaev56 | alphapca56 )
24 CFLAGS="$CFLAGS -mieee -D__ALPHA__"
27 arm | armv4tl | armv5b )
29 CFLAGS="$CFLAGS -D__ARM__"
32 i386 | i486 | i586 | i686 )
34 CFLAGS="$CFLAGS -D__I386__"
39 CFLAGS="$CFLAGS -D__MIPS__"
44 CFLAGS="$CFLAGS -D__POWERPC__"
49 CFLAGS="$CFLAGS -D__POWERPC64__"
54 CFLAGS="$CFLAGS -D__X86_64__"
60 CFLAGS="$CFLAGS -D__XDSPCORE__"
64 AC_MSG_ERROR($host_cpu systems are not supported at this time)
72 CFLAGS="$CFLAGS -D__LINUX__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
76 CFLAGS="$CFLAGS -D__DARWIN__ -ansi -pedantic -Wall -Wno-long-long"
80 CFLAGS="$CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
84 CFLAGS="$CFLAGS -D__IRIX__"
91 dnl define and substitute some architecture specific variables
92 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [architecture directory])
95 AC_SUBST(USE_SCHEDULER)
98 dnl Checks for programs.
113 dnl Checks for header files.
116 AC_CHECK_HEADERS([fcntl.h])
117 AC_CHECK_HEADERS([sys/time.h])
118 AC_CHECK_HEADERS([unistd.h])
119 AC_CHECK_HEADERS([sys/ioctl.h])
121 dnl this is for fdlibm
122 AC_CHECK_HEADERS([stdint.h])
123 AC_CHECK_HEADERS([inttypes.h])
124 AC_CHECK_HEADERS([sys/config.h])
125 AC_CHECK_HEADERS([sys/types.h])
126 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
127 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
128 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]))
129 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]))
131 dnl Checks for typedefs, structures, and compiler characteristics.
140 dnl Checks for library functions.
141 AC_PROG_GCC_TRADITIONAL
144 AC_CHECK_FUNCS([calloc mprotect getpagesize free])
145 AC_CHECK_FUNCS([getcwd gettimeofday])
146 AC_CHECK_FUNCS([scandir])
147 AC_CHECK_FUNCS([mmap])
148 AC_CHECK_FUNCS([isnan])
150 dnl Checks for libraries.
152 dnl Checking sizeof void *
153 AC_CHECK_SIZEOF(void *)
157 dnl check which ld flags are required to export symbols
158 if test x"$with_gnu_ld" = "xyes"; then
159 EXPORT_SYMBOLS_FLAGS="-Wl,--export-dynamic"
161 EXPORT_SYMBOLS_FLAGS=""
163 AC_SUBST(EXPORT_SYMBOLS_FLAGS)
166 dnl define install prefix
167 if test "x$prefix" = "xNONE"; then
168 CACAO_PREFIX=$ac_default_prefix
172 AC_DEFINE_UNQUOTED([CACAO_PREFIX], "${CACAO_PREFIX}", [installation prefix])
173 AC_SUBST(CACAO_PREFIX)
180 dnl check for JIT compiler
181 AC_MSG_CHECKING(whether JIT compiler should be compiled)
183 [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])],
184 [case "${enableval}" in
189 AC_MSG_RESULT(${ENABLE_JIT})
190 AM_CONDITIONAL([ENABLE_JIT], test x"${ENABLE_JIT}" = "xyes")
192 if test x"${ENABLE_JIT}" = "xyes"; then
193 AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
197 dnl check for interpreter
198 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
200 AC_MSG_CHECKING(whether interpreter should be compiled)
201 if test x"$enable_intrp" = "xyes"; then
203 AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
204 AM_CONDITIONAL([ENABLE_INTRP], [true])
211 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
213 AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
214 AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
215 AC_DEFINE([WITH_FFI], 1, [use libffi])],
218 dnl check for libffcall
219 AC_ARG_WITH([ffcall],
220 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
222 AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
223 AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
224 AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
227 dnl check for libffi or libffcall
228 if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
229 AC_ERROR(Enable only libffi or libffcall.)
231 if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
232 AC_ERROR(Enable one of libffi or libffcall.)
237 AM_CONDITIONAL([ENABLE_INTRP], [false])
241 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
242 AC_ERROR(You have to enable at least the JIT or the interpreter.)
246 dnl check for garbage collector usage
247 AC_MSG_CHECKING(whether GC should be disabled)
249 [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])],
250 [case "${enableval}" in
252 AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
257 AC_MSG_RESULT(${DISABLE_GC})
258 AM_CONDITIONAL([DISABLE_GC], test x"${DISABLE_GC}" = "xyes")
261 dnl check for dump memory usage
262 AC_MSG_CHECKING(whether dump memory should be disabled)
263 AC_ARG_ENABLE([dump],
264 [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])],
265 [case "${enableval}" in
268 AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
273 AC_MSG_RESULT(${DISABLE_DUMP})
277 AC_MSG_CHECKING(whether debug code generation should be enabled)
278 AC_ARG_ENABLE([debug],
279 [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=yes]])],
280 [case "${enableval}" in
282 AC_DEFINE([NDEBUG], 1, [disable debug code])
288 if test x"${NDEBUG}" = "xno"; then
291 dnl check for binutils headers and libraries on some architectures for the
293 case "${ARCH_DIR}" in
294 arm | i386 | powerpc | x86_64 )
295 AC_CHECK_HEADER([ansidecl.h],, [AC_MSG_ERROR(cannot find ansidecl.h)])
296 AC_CHECK_HEADER([symcat.h],, [AC_MSG_ERROR(cannot find symcat.h)])
297 AC_CHECK_HEADER([bfd.h],, [AC_MSG_ERROR(cannot find bfd.h)])
298 AC_CHECK_HEADER([dis-asm.h],, [AC_MSG_ERROR(cannot find dis-asm.h)])
302 AC_CHECK_LIB(intl, dcgettext,, [AC_MSG_ERROR(cannot find libintl (from bintuils))])
306 AC_CHECK_LIB(iberty, xstrerror,, [AC_MSG_ERROR(cannot find libiberty (from bintuils))])
307 AC_CHECK_LIB(bfd, bfd_get_arch,, [AC_MSG_ERROR(cannot find libbfd (from bintuils))])
308 AC_CHECK_LIB(opcodes, init_disassemble_info,, [AC_MSG_ERROR(cannot find libopcodes (from bintuils))])
309 AC_DEFINE([WITH_BINUTILS_DISASSEMBLER], 1, [use binutils disassembler])
310 AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [true])
313 AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
319 AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
321 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xno")
324 dnl check for statistics
325 AC_MSG_CHECKING(whether statistics generation should be enabled)
326 AC_ARG_ENABLE([statistics],
327 [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])],
328 [case "${enableval}" in
329 no) ENABLE_STATISTICS=no;;
330 *) ENABLE_STATISTICS=yes;;
332 [ENABLE_STATISTICS=yes])
333 AC_MSG_RESULT(${ENABLE_STATISTICS})
334 AM_CONDITIONAL([ENABLE_STATISTICS], test x"${ENABLE_STATISTICS}" = "xyes")
336 if test x"${ENABLE_STATISTICS}" = "xyes"; then
337 AC_DEFINE([ENABLE_STATISTICS], 1, [enable statistics])
342 AC_MSG_CHECKING(whether to compile JVMTI support)
343 AC_ARG_ENABLE([jvmti],
344 [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])],
345 [case "${enableval}" in
346 yes) ENABLE_JVMTI=yes;;
350 AC_MSG_RESULT(${ENABLE_JVMTI})
351 AM_CONDITIONAL([ENABLE_JVMTI], test x"${ENABLE_JVMTI}" = "xyes")
353 if test x"${ENABLE_JVMTI}" = "xyes"; then
354 AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
359 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
360 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
362 AC_MSG_CHECKING(whether to include threads support)
363 enable_threads=${enable_threads:-native}
364 case "$enable_threads" in
367 dnl no threads for boehm
368 ac_configure_args="$ac_configure_args --disable-boehm-threads"
369 AM_CONDITIONAL([USE_THREADS], [false])
370 AM_CONDITIONAL([NATIVE_THREADS], [false])
373 green | native | posix | pthreads)
374 AC_DEFINE([USE_THREADS], 1, [use threads])
376 AM_CONDITIONAL([USE_THREADS], [true])
378 if test x"$enable_threads" != "xgreen"; then
379 AC_MSG_RESULT(yes, native)
380 AC_CHECK_LIB(pthread, main)
381 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
383 CFLAGS="$CFLAGS -D_REENTRANT"
385 dnl tell boehm to support threads as well
386 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
387 AM_CONDITIONAL([NATIVE_THREADS], [true])
390 AC_MSG_RESULT(yes, green)
392 dnl no threads for boehm
393 ac_configure_args="$ac_configure_args --disable-boehm-threads"
394 AM_CONDITIONAL([NATIVE_THREADS], [false])
398 AC_MSG_ERROR($enable_threads is an unknown thread package)
403 dnl Check whether the compiler supports the __thread keyword.
404 if test "x$use__thread" != xno; then
405 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
406 [cat > conftest.c <<\EOF
409 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
410 ac_cv_gcc___thread=yes
412 ac_cv_gcc___thread=no
415 if test "$ac_cv_gcc___thread" = yes; then
416 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
419 ac_cv_gcc___thread=no
423 dnl check if linear scan register allocator(lsra) should be used
424 AC_MSG_CHECKING(whether lsra should be supported)
425 AC_ARG_ENABLE([lsra],
426 [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])],
427 [case "${enableval}" in
432 AC_MSG_RESULT(${ENABLE_LSRA})
433 AM_CONDITIONAL([ENABLE_LSRA], test x"${ENABLE_LSRA}" = "xyes")
435 if test x"${ENABLE_LSRA}" = "xyes"; then
436 AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
440 dnl check for inlining
441 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
443 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
444 dnl if test x"$enable_inlining" = "xno"; then
445 dnl AC_MSG_RESULT(yes)
446 dnl AM_CONDITIONAL([USE_INLINING], [false])
448 dnl AC_MSG_RESULT(no)
449 AC_DEFINE([USE_INLINING], 1, [use method inlining])
450 AM_CONDITIONAL([USE_INLINING], [true])
454 dnl check for instruction scheduler
455 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
457 AC_MSG_CHECKING(whether instruction scheduler should be supported)
458 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
459 case "${ARCH_DIR}" in
463 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
468 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
469 AM_CONDITIONAL([USE_SCHEDULER], [true])
472 AM_CONDITIONAL([USE_SCHEDULER], [false])
476 dnl check if zlib should be used
477 AC_MSG_CHECKING(whether ZIP/JAR archives should be supported)
478 AC_ARG_ENABLE([zlib],
479 [AS_HELP_STRING(--disable-zlib,disable ZIP/JAR archive support (needs zlib) [[default=yes]])],
480 [case "${enableval}" in
485 AC_MSG_RESULT(${ENABLE_ZLIB})
487 if test x"${ENABLE_ZLIB}" = "xyes"; then
488 AC_CHECK_HEADERS([zconf.h],, [AC_MSG_ERROR(cannot find zconf.h)])
489 AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
490 AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
491 AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
493 AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
496 dnl check if CACAO should be linked statically
497 AC_MSG_CHECKING(whether to link GNU classpath native libraries statically into CACAO)
498 AC_ARG_ENABLE([staticvm],
499 [AS_HELP_STRING(--enable-staticvm, link GNU classpath native libraries statically into CACAO [[default=no]])],
500 [case "${enableval}" in
501 yes) ENABLE_STATICVM=yes;;
502 *) ENABLE_STATICVM=no;;
504 [ENABLE_STATICVM=no])
505 AC_MSG_RESULT(${ENABLE_STATICVM})
507 if test x"${ENABLE_STATICVM}" = "xyes"; then
508 AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
510 dnl check for some classpath related stuff when we link statically
513 AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
514 AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
516 AM_CONDITIONAL([ENABLE_STATICVM], test x"${ENABLE_STATICVM}" = "xyes")
517 AC_SUBST(ENABLE_STATICVM)
520 dnl is GNU classpath installed somewhere different
521 AC_MSG_CHECKING(where GNU Classpath is installed)
522 AC_ARG_WITH([classpath-prefix],
523 [AS_HELP_STRING(--with-classpath-prefix=<dir>,installation directory of GNU Classpath [[default=/usr/local/classpath]])],
524 [CLASSPATH_PREFIX=${withval}],
525 [CLASSPATH_PREFIX=/usr/local/classpath])
526 AC_MSG_RESULT(${CLASSPATH_PREFIX})
527 AC_DEFINE_UNQUOTED([CLASSPATH_PREFIX], "${CLASSPATH_PREFIX}", [GNU Classpath installation directory])
528 AC_SUBST(CLASSPATH_PREFIX)
530 AC_MSG_CHECKING(where GNU Classpath libraries are installed)
531 AC_ARG_WITH([classpath-libdir],
532 [AS_HELP_STRING(--with-classpath-libdir=<dir>,installation directory of GNU Classpath libraries [[default=/usr/local/classpath/lib]])],
533 [CLASSPATH_LIBDIR=${withval}],
534 [CLASSPATH_LIBDIR=${CLASSPATH_PREFIX}/lib])
535 AC_MSG_RESULT(${CLASSPATH_LIBDIR})
537 dnl expand CLASSPATH_LIBDIR to something that is usable in C code
538 AS_AC_EXPAND([CLASSPATH_LIBDIR], ${CLASSPATH_LIBDIR})
539 AC_DEFINE_UNQUOTED([CLASSPATH_LIBDIR], "${CLASSPATH_LIBDIR}", [GNU Classpath libraries installation directory])
541 AC_SUBST(CLASSPATH_LIBDIR)
545 dnl Maybe the user has Classpath installed 'flat'.
546 AC_ARG_WITH([flat-classpath], [AS_HELP_STRING(--with-flat-classpath, GNU Classpath is not zipped in the install directory)])
547 if test x"$with_flat_classpath" = "x"; then
553 AC_DEFINE_UNQUOTED(GLIBJZ_STRING, "$GLIBJZ", [define to the string base name of the classpath zip file])
556 dnl check for some programs we need
561 dnl now configure subpackages
562 dnl the export is not my favorite (is there another way?)
564 AC_CONFIG_SUBDIRS(src/boehm-gc)
566 AC_CONFIG_FILES([Makefile]
568 [contrib/setenvinstalled]
569 [contrib/setenvsource]
571 [doc/handbook/Makefile]
575 [src/cacaoh/Makefile]
576 [src/fdlibm/Makefile]
579 [src/native/Makefile]
580 [src/native/include/Makefile]
581 [src/native/jvmti/Makefile]
582 [src/native/tools/Makefile]
583 [src/native/vm/Makefile]
584 [src/scripts/Makefile]
586 [src/scripts/rmiregistry]
587 [src/threads/Makefile]
588 [src/threads/green/Makefile]
589 [src/threads/native/Makefile]
590 [src/toolbox/Makefile]
592 [src/vm/jit/Makefile]
593 [src/vm/jit/allocator/Makefile]
594 [src/vm/jit/alpha/Makefile]
595 [src/vm/jit/alpha/freebsd/Makefile]
596 [src/vm/jit/alpha/linux/Makefile]
597 [src/vm/jit/i386/Makefile]
598 [src/vm/jit/i386/freebsd/Makefile]
599 [src/vm/jit/i386/linux/Makefile]
600 [src/vm/jit/intrp/Makefile]
601 [src/vm/jit/inline/Makefile]
602 [src/vm/jit/loop/Makefile]
603 [src/vm/jit/mips/Makefile]
604 [src/vm/jit/mips/irix/Makefile]
605 [src/vm/jit/mips/linux/Makefile]
606 [src/vm/jit/powerpc/Makefile]
607 [src/vm/jit/powerpc/darwin/Makefile]
608 [src/vm/jit/powerpc/linux/Makefile]
609 [src/vm/jit/schedule/Makefile]
610 [src/vm/jit/tools/Makefile]
611 [src/vm/jit/verify/Makefile]
612 [src/vm/jit/x86_64/Makefile]
614 [tests/regression/Makefile]
615 [tests/regression/codepatching/Makefile]
616 [tests/regression/native/Makefile])
623 ## indent-tabs-mode: t
626 ## compile-command: "automake --add-missing"