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.
107 dnl Checks for header files.
110 AC_CHECK_HEADERS([fcntl.h])
111 AC_CHECK_HEADERS([sys/time.h])
112 AC_CHECK_HEADERS([unistd.h])
113 AC_CHECK_HEADERS([sys/ioctl.h])
115 dnl this is for fdlibm
116 AC_CHECK_HEADERS([stdint.h])
117 AC_CHECK_HEADERS([inttypes.h])
118 AC_CHECK_HEADERS([sys/config.h])
119 AC_CHECK_HEADERS([sys/types.h])
120 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
121 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
122 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]))
123 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]))
125 dnl Checks for typedefs, structures, and compiler characteristics.
134 dnl Checks for library functions.
135 AC_PROG_GCC_TRADITIONAL
138 AC_CHECK_FUNCS(calloc mprotect getpagesize free)
139 AC_CHECK_FUNCS(getcwd gettimeofday)
140 AC_CHECK_FUNCS(scandir)
143 dnl Checks for libraries.
145 dnl Checking sizeof void *
146 AC_CHECK_SIZEOF(void *)
150 dnl check which ld flags are required to export symbols
151 if test x"$with_gnu_ld" = "xyes"; then
152 EXPORT_SYMBOLS_FLAGS="-Wl,--export-dynamic"
154 EXPORT_SYMBOLS_FLAGS=""
156 AC_SUBST(EXPORT_SYMBOLS_FLAGS)
159 dnl define install prefix
160 if test "x$prefix" = "xNONE"; then
161 CACAO_INSTALL_PREFIX=$ac_default_prefix
163 CACAO_INSTALL_PREFIX=$prefix
165 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [installation prefix])
166 AC_SUBST(CACAO_INSTALL_PREFIX)
173 dnl check for JIT compiler
174 AC_MSG_CHECKING(whether JIT compiler should be compiled)
176 [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])],
177 [case "${enableval}" in
182 AC_MSG_RESULT(${ENABLE_JIT})
183 AM_CONDITIONAL([ENABLE_JIT], test x"${ENABLE_JIT}" = "xyes")
185 if test x"${ENABLE_JIT}" = "xyes"; then
186 AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
190 dnl check for interpreter
191 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
193 AC_MSG_CHECKING(whether interpreter should be compiled)
194 if test x"$enable_intrp" = "xyes"; then
196 AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
197 AM_CONDITIONAL([ENABLE_INTRP], [true])
204 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
206 AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
207 AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
208 AC_DEFINE([WITH_FFI], 1, [use libffi])],
211 dnl check for libffcall
212 AC_ARG_WITH([ffcall],
213 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
215 AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
216 AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
217 AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
220 dnl check for libffi or libffcall
221 if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
222 AC_ERROR(Enable only libffi or libffcall.)
224 if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
225 AC_ERROR(Enable one of libffi or libffcall.)
230 AM_CONDITIONAL([ENABLE_INTRP], [false])
234 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
235 AC_ERROR(You have to enable at least the JIT or the interpreter.)
239 dnl check for garbage collector usage
240 AC_MSG_CHECKING(whether GC should be disabled)
242 [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])],
243 [case "${enableval}" in
245 AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
250 AC_MSG_RESULT(${DISABLE_GC})
251 AM_CONDITIONAL([DISABLE_GC], test x"${DISABLE_GC}" = "xyes")
254 dnl check for dump memory usage
255 AC_MSG_CHECKING(whether dump memory should be disabled)
256 AC_ARG_ENABLE([dump],
257 [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])],
258 [case "${enableval}" in
261 AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
266 AC_MSG_RESULT(${DISABLE_DUMP})
270 AC_MSG_CHECKING(whether debug code generation should be enabled)
271 AC_ARG_ENABLE([debug],
272 [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=yes]])],
273 [case "${enableval}" in
275 AC_DEFINE([NDEBUG], 1, [disable debug code])
281 if test x"${NDEBUG}" = "xno"; then
288 dnl check for statistics
289 AC_MSG_CHECKING(whether statistics generation should be enabled)
290 AC_ARG_ENABLE([statistics],
291 [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])],
292 [case "${enableval}" in
293 no) ENABLE_STATISTICS=no;;
294 *) ENABLE_STATISTICS=yes;;
296 [ENABLE_STATISTICS=yes])
297 AC_MSG_RESULT(${ENABLE_STATISTICS})
298 AM_CONDITIONAL([ENABLE_STATISTICS], test x"${ENABLE_STATISTICS}" = "xyes")
300 if test x"$enable_statistics" = "xno"; then
301 AC_DEFINE([ENABLE_STATISTICS], 1, [enable statistics])
306 AC_MSG_CHECKING(whether to compile JVMTI support)
307 AC_ARG_ENABLE([jvmti],
308 [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])],
309 [case "${enableval}" in
310 yes) ENABLE_JVMTI=yes;;
314 AC_MSG_RESULT(${ENABLE_JVMTI})
315 AM_CONDITIONAL([ENABLE_JVMTI], test x"${ENABLE_JVMTI}" = "xyes")
317 if test x"${ENABLE_JVMTI}" = "xyes"; then
318 AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
323 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
324 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
326 AC_MSG_CHECKING(whether to include threads support)
327 enable_threads=${enable_threads:-native}
328 case "$enable_threads" in
331 dnl no threads for boehm
332 ac_configure_args="$ac_configure_args --disable-boehm-threads"
333 AM_CONDITIONAL([USE_THREADS], [false])
334 AM_CONDITIONAL([NATIVE_THREADS], [false])
337 green | native | posix | pthreads)
338 AC_DEFINE([USE_THREADS], 1, [use threads])
340 AM_CONDITIONAL([USE_THREADS], [true])
342 if test x"$enable_threads" != "xgreen"; then
343 AC_MSG_RESULT(yes, native)
344 AC_CHECK_LIB(pthread, main)
345 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
347 CFLAGS="$CFLAGS -D_REENTRANT"
349 dnl tell boehm to support threads as well
350 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
351 AM_CONDITIONAL([NATIVE_THREADS], [true])
354 AC_MSG_RESULT(yes, green)
356 dnl no threads for boehm
357 ac_configure_args="$ac_configure_args --disable-boehm-threads"
358 AM_CONDITIONAL([NATIVE_THREADS], [false])
362 AC_MSG_ERROR($enable_threads is an unknown thread package)
367 dnl Check whether the compiler supports the __thread keyword.
368 if test "x$use__thread" != xno; then
369 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
370 [cat > conftest.c <<\EOF
373 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
374 ac_cv_gcc___thread=yes
376 ac_cv_gcc___thread=no
379 if test "$ac_cv_gcc___thread" = yes; then
380 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
383 ac_cv_gcc___thread=no
387 dnl check if linear scan register allocator(lsra) should be used
388 AC_MSG_CHECKING(whether lsra should be supported)
389 AC_ARG_ENABLE([lsra],
390 [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])],
391 [case "${enableval}" in
396 AC_MSG_RESULT(${ENABLE_LSRA})
398 if test x"${ENABLE_LSRA}" = "xyes"; then
399 AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
403 dnl check for inlining
404 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
406 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
407 dnl if test x"$enable_inlining" = "xno"; then
408 dnl AC_MSG_RESULT(yes)
409 dnl AM_CONDITIONAL([USE_INLINING], [false])
411 dnl AC_MSG_RESULT(no)
412 AC_DEFINE([USE_INLINING], 1, [use method inlining])
413 AM_CONDITIONAL([USE_INLINING], [true])
417 dnl check for instruction scheduler
418 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
420 AC_MSG_CHECKING(whether instruction scheduler should be supported)
421 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
422 case "${ARCH_DIR}" in
426 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
431 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
432 AM_CONDITIONAL([USE_SCHEDULER], [true])
435 AM_CONDITIONAL([USE_SCHEDULER], [false])
439 dnl check if zlib should be used
440 AC_MSG_CHECKING(whether zip archives should be supported)
441 AC_ARG_ENABLE([zlib],
442 [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])],
443 [case "${enableval}" in
444 no) ENABLE_ZLIB=yes;;
448 AC_MSG_RESULT(${ENABLE_ZLIB})
450 if test x"${ENABLE_ZLIB}" = "xyes"; then
451 AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
452 AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
453 AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
455 AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
458 dnl check if CACAO should be linked statically
459 AC_MSG_CHECKING(whether to link GNU classpath native libraries statically into CACAO)
460 AC_ARG_ENABLE([staticvm],
461 [AS_HELP_STRING(--enable-staticvm, link GNU classpath native libraries statically into CACAO [[default=no]])],
462 [case "${enableval}" in
463 yes) ENABLE_STATICVM=yes;;
464 *) ENABLE_STATICVM=no;;
466 [ENABLE_STATICVM=no])
467 AC_MSG_RESULT(${ENABLE_STATICVM})
469 if test x"${ENABLE_STATICVM}" = "xyes"; then
470 AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
472 dnl check for some classpath related stuff when we link statically
475 AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
476 AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
478 AM_CONDITIONAL([ENABLE_STATICVM], test x"${ENABLE_STATICVM}" = "xyes")
479 AC_SUBST(ENABLE_STATICVM)
482 dnl is GNU classpath installed somewhere different
483 AC_MSG_CHECKING(where GNU classpath is installed)
484 AC_ARG_WITH([classpath-install-dir],
485 [AS_HELP_STRING(--with-classpath-install-dir=<dir>,installation directory of GNU classpath [[default=/usr/local/classpath]])],
486 [CLASSPATH_INSTALL_DIR=${withval}],
487 [CLASSPATH_INSTALL_DIR=/usr/local/classpath])
488 AC_MSG_RESULT(${CLASSPATH_INSTALL_DIR})
489 AC_DEFINE_UNQUOTED([CLASSPATH_INSTALL_DIR], "${CLASSPATH_INSTALL_DIR}", [GNU classpath installation directory])
490 AC_SUBST(CLASSPATH_INSTALL_DIR)
493 dnl Maybe the user has Classpath installed 'flat'.
494 AC_ARG_WITH([flat-classpath], [AS_HELP_STRING(--with-flat-classpath, GNU Classpath is not zipped in the install directory)])
495 if test x"$with_flat_classpath" = "x"; then
501 AC_DEFINE_UNQUOTED(GLIBJZ_STRING, "$GLIBJZ", [define to the string base name of the classpath zip file])
504 dnl now configure subpackages
505 dnl the export is not my favorite (is there another way?)
507 AC_CONFIG_SUBDIRS(src/boehm-gc)
509 AC_CONFIG_FILES([Makefile]
511 [contrib/setenvinstalled]
512 [contrib/setenvsource]
514 [doc/handbook/Makefile]
518 [src/cacaoh/Makefile]
519 [src/fdlibm/Makefile]
522 [src/native/Makefile]
523 [src/native/include/Makefile]
524 [src/native/jvmti/Makefile]
525 [src/native/tools/Makefile]
526 [src/native/vm/Makefile]
527 [src/scripts/Makefile]
529 [src/scripts/rmiregistry]
530 [src/threads/Makefile]
531 [src/threads/green/Makefile]
532 [src/threads/native/Makefile]
533 [src/toolbox/Makefile]
535 [src/vm/jit/Makefile]
536 [src/vm/jit/alpha/Makefile]
537 [src/vm/jit/alpha/freebsd/Makefile]
538 [src/vm/jit/alpha/linux/Makefile]
539 [src/vm/jit/i386/Makefile]
540 [src/vm/jit/i386/freebsd/Makefile]
541 [src/vm/jit/i386/linux/Makefile]
542 [src/vm/jit/intrp/Makefile]
543 [src/vm/jit/inline/Makefile]
544 [src/vm/jit/loop/Makefile]
545 [src/vm/jit/mips/Makefile]
546 [src/vm/jit/mips/irix/Makefile]
547 [src/vm/jit/mips/linux/Makefile]
548 [src/vm/jit/powerpc/Makefile]
549 [src/vm/jit/powerpc/darwin/Makefile]
550 [src/vm/jit/powerpc/linux/Makefile]
551 [src/vm/jit/schedule/Makefile]
552 [src/vm/jit/tools/Makefile]
553 [src/vm/jit/verify/Makefile]
554 [src/vm/jit/x86_64/Makefile]
556 [tests/codepatching/Makefile]
557 [tests/native/Makefile]
558 [tests/regression/Makefile])
565 ## indent-tabs-mode: t
568 ## compile-command: "automake --add-missing"