1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cacao, 0.93+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__X86_64__"
55 CFLAGS="$CFLAGS -D__XDSPCORE__"
59 AC_MSG_ERROR($host_cpu systems are not supported at this time)
67 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"
71 CFLAGS="$CFLAGS -D__DARWIN__ -ansi -pedantic -Wall -Wno-long-long"
75 CFLAGS="$CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
79 CFLAGS="$CFLAGS -D__IRIX__"
86 dnl define and substitute some architecture specific variables
87 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [architecture directory])
90 AC_SUBST(USE_SCHEDULER)
93 dnl Checks for programs.
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
139 AC_CHECK_FUNCS(calloc mprotect getpagesize free)
140 AC_CHECK_FUNCS(getcwd gettimeofday)
141 AC_CHECK_FUNCS(scandir)
144 dnl Checks for libraries.
146 dnl Checking sizeof void *
147 AC_CHECK_SIZEOF(void *)
151 dnl check which ld flags are required to export symbols
152 if test x"$with_gnu_ld" = "xyes"; then
153 EXPORT_SYMBOLS_FLAGS="-Wl,--export-dynamic"
155 EXPORT_SYMBOLS_FLAGS=""
157 AC_SUBST(EXPORT_SYMBOLS_FLAGS)
160 dnl define install prefix
161 if test "x$prefix" = "xNONE"; then
162 CACAO_INSTALL_PREFIX=$ac_default_prefix
164 CACAO_INSTALL_PREFIX=$prefix
166 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [installation prefix])
167 AC_SUBST(CACAO_INSTALL_PREFIX)
174 dnl check for JIT compiler
175 AC_MSG_CHECKING(whether JIT compiler should be compiled)
177 [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])],
178 [case "${enableval}" in
183 AC_MSG_RESULT(${ENABLE_JIT})
184 AM_CONDITIONAL([ENABLE_JIT], test x"${ENABLE_JIT}" = "xyes")
186 if test x"${ENABLE_JIT}" = "xyes"; then
187 AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
191 dnl check for interpreter
192 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
194 AC_MSG_CHECKING(whether interpreter should be compiled)
195 if test x"$enable_intrp" = "xyes"; then
197 AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
198 AM_CONDITIONAL([ENABLE_INTRP], [true])
205 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
207 AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
208 AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
209 AC_DEFINE([WITH_FFI], 1, [use libffi])],
212 dnl check for libffcall
213 AC_ARG_WITH([ffcall],
214 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
216 AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
217 AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
218 AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
221 dnl check for libffi or libffcall
222 if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
223 AC_ERROR(Enable only libffi or libffcall.)
225 if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
226 AC_ERROR(Enable one of libffi or libffcall.)
231 AM_CONDITIONAL([ENABLE_INTRP], [false])
235 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
236 AC_ERROR(You have to enable at least the JIT or the interpreter.)
240 dnl check for garbage collector usage
241 AC_MSG_CHECKING(whether GC should be disabled)
243 [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])],
244 [case "${enableval}" in
246 AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
251 AC_MSG_RESULT(${DISABLE_GC})
252 AM_CONDITIONAL([DISABLE_GC], test x"${DISABLE_GC}" = "xyes")
255 dnl check for dump memory usage
256 AC_MSG_CHECKING(whether dump memory should be disabled)
257 AC_ARG_ENABLE([dump],
258 [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])],
259 [case "${enableval}" in
262 AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
267 AC_MSG_RESULT(${DISABLE_DUMP})
271 AC_MSG_CHECKING(whether debug code generation should be enabled)
272 AC_ARG_ENABLE([debug],
273 [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=yes]])],
274 [case "${enableval}" in
276 AC_DEFINE([NDEBUG], 1, [disable debug code])
282 if test x"${NDEBUG}" = "xno"; then
285 dnl check for binutils headers and libraries on some architectures for the
287 case "${ARCH_DIR}" in
288 arm | i386 | powerpc | x86_64 )
289 AC_CHECK_HEADER([dis-asm.h],, [AC_MSG_ERROR(cannot find dis-asm.h)])
290 AC_CHECK_LIB(bfd, bfd_get_arch,, [AC_MSG_ERROR(cannot find libbfd (from bintuils))])
291 AC_CHECK_LIB(opcodes, init_disassemble_info,, [AC_MSG_ERROR(cannot find libopcodes (from bintuils))])
292 AC_DEFINE([WITH_BINUTILS_DISASSEMBLER], 1, [use binutils disassembler])
293 AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [true])
296 AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
303 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xno")
306 dnl check for statistics
307 AC_MSG_CHECKING(whether statistics generation should be enabled)
308 AC_ARG_ENABLE([statistics],
309 [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])],
310 [case "${enableval}" in
311 no) ENABLE_STATISTICS=no;;
312 *) ENABLE_STATISTICS=yes;;
314 [ENABLE_STATISTICS=yes])
315 AC_MSG_RESULT(${ENABLE_STATISTICS})
316 AM_CONDITIONAL([ENABLE_STATISTICS], test x"${ENABLE_STATISTICS}" = "xyes")
318 if test x"${ENABLE_STATISTICS}" = "xyes"; then
319 AC_DEFINE([ENABLE_STATISTICS], 1, [enable statistics])
324 AC_MSG_CHECKING(whether to compile JVMTI support)
325 AC_ARG_ENABLE([jvmti],
326 [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])],
327 [case "${enableval}" in
328 yes) ENABLE_JVMTI=yes;;
332 AC_MSG_RESULT(${ENABLE_JVMTI})
333 AM_CONDITIONAL([ENABLE_JVMTI], test x"${ENABLE_JVMTI}" = "xyes")
335 if test x"${ENABLE_JVMTI}" = "xyes"; then
336 AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
341 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
342 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
344 AC_MSG_CHECKING(whether to include threads support)
345 enable_threads=${enable_threads:-native}
346 case "$enable_threads" in
349 dnl no threads for boehm
350 ac_configure_args="$ac_configure_args --disable-boehm-threads"
351 AM_CONDITIONAL([USE_THREADS], [false])
352 AM_CONDITIONAL([NATIVE_THREADS], [false])
355 green | native | posix | pthreads)
356 AC_DEFINE([USE_THREADS], 1, [use threads])
358 AM_CONDITIONAL([USE_THREADS], [true])
360 if test x"$enable_threads" != "xgreen"; then
361 AC_MSG_RESULT(yes, native)
362 AC_CHECK_LIB(pthread, main)
363 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
365 CFLAGS="$CFLAGS -D_REENTRANT"
367 dnl tell boehm to support threads as well
368 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
369 AM_CONDITIONAL([NATIVE_THREADS], [true])
372 AC_MSG_RESULT(yes, green)
374 dnl no threads for boehm
375 ac_configure_args="$ac_configure_args --disable-boehm-threads"
376 AM_CONDITIONAL([NATIVE_THREADS], [false])
380 AC_MSG_ERROR($enable_threads is an unknown thread package)
385 dnl Check whether the compiler supports the __thread keyword.
386 if test "x$use__thread" != xno; then
387 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
388 [cat > conftest.c <<\EOF
391 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
392 ac_cv_gcc___thread=yes
394 ac_cv_gcc___thread=no
397 if test "$ac_cv_gcc___thread" = yes; then
398 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
401 ac_cv_gcc___thread=no
405 dnl check if linear scan register allocator(lsra) should be used
406 AC_MSG_CHECKING(whether lsra should be supported)
407 AC_ARG_ENABLE([lsra],
408 [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])],
409 [case "${enableval}" in
414 AC_MSG_RESULT(${ENABLE_LSRA})
415 AM_CONDITIONAL([ENABLE_LSRA], test x"${ENABLE_LSRA}" = "xyes")
417 if test x"${ENABLE_LSRA}" = "xyes"; then
418 AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
422 dnl check for inlining
423 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
425 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
426 dnl if test x"$enable_inlining" = "xno"; then
427 dnl AC_MSG_RESULT(yes)
428 dnl AM_CONDITIONAL([USE_INLINING], [false])
430 dnl AC_MSG_RESULT(no)
431 AC_DEFINE([USE_INLINING], 1, [use method inlining])
432 AM_CONDITIONAL([USE_INLINING], [true])
436 dnl check for instruction scheduler
437 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
439 AC_MSG_CHECKING(whether instruction scheduler should be supported)
440 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
441 case "${ARCH_DIR}" in
445 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
450 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
451 AM_CONDITIONAL([USE_SCHEDULER], [true])
454 AM_CONDITIONAL([USE_SCHEDULER], [false])
458 dnl check if zlib should be used
459 AC_MSG_CHECKING(whether zip archives should be supported)
460 AC_ARG_ENABLE([zlib],
461 [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])],
462 [case "${enableval}" in
463 no) ENABLE_ZLIB=yes;;
467 AC_MSG_RESULT(${ENABLE_ZLIB})
469 if test x"${ENABLE_ZLIB}" = "xyes"; then
470 AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
471 AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
472 AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
474 AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
477 dnl check if CACAO should be linked statically
478 AC_MSG_CHECKING(whether to link GNU classpath native libraries statically into CACAO)
479 AC_ARG_ENABLE([staticvm],
480 [AS_HELP_STRING(--enable-staticvm, link GNU classpath native libraries statically into CACAO [[default=no]])],
481 [case "${enableval}" in
482 yes) ENABLE_STATICVM=yes;;
483 *) ENABLE_STATICVM=no;;
485 [ENABLE_STATICVM=no])
486 AC_MSG_RESULT(${ENABLE_STATICVM})
488 if test x"${ENABLE_STATICVM}" = "xyes"; then
489 AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
491 dnl check for some classpath related stuff when we link statically
494 AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
495 AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
497 AM_CONDITIONAL([ENABLE_STATICVM], test x"${ENABLE_STATICVM}" = "xyes")
498 AC_SUBST(ENABLE_STATICVM)
501 dnl is GNU classpath installed somewhere different
502 AC_MSG_CHECKING(where GNU classpath is installed)
503 AC_ARG_WITH([classpath-install-dir],
504 [AS_HELP_STRING(--with-classpath-install-dir=<dir>,installation directory of GNU classpath [[default=/usr/local/classpath]])],
505 [CLASSPATH_INSTALL_DIR=${withval}],
506 [CLASSPATH_INSTALL_DIR=/usr/local/classpath])
507 AC_MSG_RESULT(${CLASSPATH_INSTALL_DIR})
508 AC_DEFINE_UNQUOTED([CLASSPATH_INSTALL_DIR], "${CLASSPATH_INSTALL_DIR}", [GNU classpath installation directory])
509 AC_SUBST(CLASSPATH_INSTALL_DIR)
512 dnl Maybe the user has Classpath installed 'flat'.
513 AC_ARG_WITH([flat-classpath], [AS_HELP_STRING(--with-flat-classpath, GNU Classpath is not zipped in the install directory)])
514 if test x"$with_flat_classpath" = "x"; then
520 AC_DEFINE_UNQUOTED(GLIBJZ_STRING, "$GLIBJZ", [define to the string base name of the classpath zip file])
523 dnl check for some programs we need
525 AC_PATH_PROG(ZIP, zip)
526 if test -z "${ZIP}"; then
527 AC_MSG_ERROR([cannot find zip])
531 dnl now configure subpackages
532 dnl the export is not my favorite (is there another way?)
534 AC_CONFIG_SUBDIRS(src/boehm-gc)
536 AC_CONFIG_FILES([Makefile]
538 [contrib/setenvinstalled]
539 [contrib/setenvsource]
541 [doc/handbook/Makefile]
545 [src/cacaoh/Makefile]
546 [src/fdlibm/Makefile]
549 [src/native/Makefile]
550 [src/native/include/Makefile]
551 [src/native/jvmti/Makefile]
552 [src/native/tools/Makefile]
553 [src/native/vm/Makefile]
554 [src/scripts/Makefile]
556 [src/scripts/rmiregistry]
557 [src/threads/Makefile]
558 [src/threads/green/Makefile]
559 [src/threads/native/Makefile]
560 [src/toolbox/Makefile]
562 [src/vm/jit/Makefile]
563 [src/vm/jit/allocator/Makefile]
564 [src/vm/jit/alpha/Makefile]
565 [src/vm/jit/alpha/freebsd/Makefile]
566 [src/vm/jit/alpha/linux/Makefile]
567 [src/vm/jit/i386/Makefile]
568 [src/vm/jit/i386/freebsd/Makefile]
569 [src/vm/jit/i386/linux/Makefile]
570 [src/vm/jit/intrp/Makefile]
571 [src/vm/jit/inline/Makefile]
572 [src/vm/jit/loop/Makefile]
573 [src/vm/jit/mips/Makefile]
574 [src/vm/jit/mips/irix/Makefile]
575 [src/vm/jit/mips/linux/Makefile]
576 [src/vm/jit/powerpc/Makefile]
577 [src/vm/jit/powerpc/darwin/Makefile]
578 [src/vm/jit/powerpc/linux/Makefile]
579 [src/vm/jit/schedule/Makefile]
580 [src/vm/jit/tools/Makefile]
581 [src/vm/jit/verify/Makefile]
582 [src/vm/jit/x86_64/Makefile]
584 [tests/codepatching/Makefile]
585 [tests/native/Makefile]
586 [tests/regression/Makefile])
593 ## indent-tabs-mode: t
596 ## compile-command: "automake --add-missing"