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)
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 __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.
105 AC_LIBLTDL_CONVENIENCE
109 dnl Checks for header files.
112 AC_CHECK_HEADERS([fcntl.h])
113 AC_CHECK_HEADERS([sys/time.h])
114 AC_CHECK_HEADERS([unistd.h])
115 AC_CHECK_HEADERS([sys/ioctl.h])
117 dnl this is for fdlibm
118 AC_CHECK_HEADERS([stdint.h])
119 AC_CHECK_HEADERS([inttypes.h])
120 AC_CHECK_HEADERS([sys/config.h])
121 AC_CHECK_HEADERS([sys/types.h])
122 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
123 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
124 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]))
125 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]))
127 dnl Checks for typedefs, structures, and compiler characteristics.
136 dnl Checks for library functions.
137 AC_PROG_GCC_TRADITIONAL
140 AC_CHECK_FUNCS(calloc mprotect getpagesize free)
141 AC_CHECK_FUNCS(getcwd gettimeofday)
143 dnl Checks for libraries.
145 dnl Checking sizeof void *
146 AC_COMPILE_CHECK_SIZEOF(void *)
149 dnl check which ld flags are required to export symbols
150 if test x"$with_gnu_ld" = "xyes"; then
151 EXPORT_SYMBOLS_FLAGS="-Wl,--export-dynamic"
153 EXPORT_SYMBOLS_FLAGS=""
155 AC_SUBST(EXPORT_SYMBOLS_FLAGS)
158 dnl define install prefix
159 if test "x$prefix" = "xNONE"; then
160 CACAO_INSTALL_PREFIX=$ac_default_prefix
162 CACAO_INSTALL_PREFIX=$prefix
164 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
165 AC_SUBST(CACAO_INSTALL_PREFIX)
172 dnl check for JIT compiler
173 AC_ARG_ENABLE([jit], [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])])
175 AC_MSG_CHECKING(whether JIT compiled should be compiled)
176 if test x"$enable_jit" = "xno"; then
178 AM_CONDITIONAL([ENABLE_JIT], [false])
181 AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
182 AM_CONDITIONAL([ENABLE_JIT], [true])
185 dnl check for interpreter
186 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
188 AC_MSG_CHECKING(whether interpreter should be compiled)
189 if test x"$enable_intrp" = "xyes"; then
191 AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
192 AM_CONDITIONAL([ENABLE_INTRP], [true])
196 AM_CONDITIONAL([ENABLE_INTRP], [false])
200 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
201 AC_ERROR(You have to enable at least the JIT or the interpreter.)
203 if test x"${ENABLE_JIT}" = "xyes" -a x"${ENABLE_INTRP}" = "xyes"; then
204 AC_ERROR(This is currently not supported. Please disable the JIT or the interpreter.)
207 dnl check for garbage collector usage
208 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])])
210 AC_MSG_CHECKING(whether GC should be used)
211 if test x"$enable_gc" = "xno"; then
213 AM_CONDITIONAL([DISABLE_GC], [true])
217 AM_CONDITIONAL([DISABLE_GC], [false])
221 dnl check for dump memory usage
222 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])])
224 AC_MSG_CHECKING(whether dump memory should be used)
225 if test x"$enable_dump" = "xno"; then
227 AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
232 dnl check for statistics
233 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
235 AC_MSG_CHECKING(whether statistics generation should be enabled)
236 if test x"$enable_statistics" = "xno"; then
238 AM_CONDITIONAL([STATISTICS], [false])
241 AC_DEFINE([STATISTICS], 1, [use statistics])
242 AM_CONDITIONAL([STATISTICS], [true])
246 AC_ARG_ENABLE([jvmti], [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])])
248 AC_MSG_CHECKING(whether to compile JVMTI support)
249 if test x"$enable_jvmti" = "xyes"; then
251 AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
252 AM_CONDITIONAL([ENABLE_JVMTI], [true])
255 AM_CONDITIONAL([ENABLE_JVMTI], [false])
260 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
261 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
263 AC_MSG_CHECKING(whether to include threads support)
264 enable_threads=${enable_threads:-native}
265 case "$enable_threads" in
268 dnl no threads for boehm
269 ac_configure_args="$ac_configure_args --disable-boehm-threads"
270 AM_CONDITIONAL([USE_THREADS], [false])
271 AM_CONDITIONAL([NATIVE_THREADS], [false])
274 green | native | posix | pthreads)
275 AC_DEFINE([USE_THREADS], 1, [use threads])
276 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
277 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
279 AM_CONDITIONAL([USE_THREADS], [true])
281 if test x"$enable_threads" != "xgreen"; then
282 AC_MSG_RESULT(yes, native)
283 AC_CHECK_LIB(pthread, main)
284 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
286 CFLAGS="$CFLAGS -D_REENTRANT"
288 dnl tell boehm to support threads as well
289 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
290 AM_CONDITIONAL([NATIVE_THREADS], [true])
293 AC_MSG_RESULT(yes, green)
295 dnl no threads for boehm
296 ac_configure_args="$ac_configure_args --disable-boehm-threads"
297 AM_CONDITIONAL([NATIVE_THREADS], [false])
301 AC_MSG_ERROR($enable_threads is an unknown thread package)
306 dnl Check whether the compiler supports the __thread keyword.
307 if test "x$use__thread" != xno; then
308 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
309 [cat > conftest.c <<\EOF
312 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
313 ac_cv_gcc___thread=yes
315 ac_cv_gcc___thread=no
318 if test "$ac_cv_gcc___thread" = yes; then
319 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
322 ac_cv_gcc___thread=no
326 dnl check if linear scan register allocator(lsra) should be used
327 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
329 AC_MSG_CHECKING(whether lsra should be supported)
330 if test x"$enable_lsra" = "xno"; then
334 AC_DEFINE([LSRA], 1, [use lsra])
338 dnl check for inlining
339 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
341 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
342 dnl if test x"$enable_inlining" = "xno"; then
343 dnl AC_MSG_RESULT(yes)
344 dnl AM_CONDITIONAL([USE_INLINING], [false])
346 dnl AC_MSG_RESULT(no)
347 AC_DEFINE([USE_INLINING], 1, [use method inlining])
348 AM_CONDITIONAL([USE_INLINING], [true])
352 dnl check for instruction scheduler
353 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
355 AC_MSG_CHECKING(whether instruction scheduler should be supported)
356 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
357 case "${ARCH_DIR}" in
361 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
366 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
367 AM_CONDITIONAL([USE_SCHEDULER], [true])
370 AM_CONDITIONAL([USE_SCHEDULER], [false])
374 dnl check if zlib should be used
375 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
377 AC_MSG_CHECKING(whether zip archives should be supported)
378 if test x"$enable_zlib" = "xno"; then
380 AM_CONDITIONAL([USE_ZLIB], [false])
383 AC_DEFINE([USE_ZLIB], 1, [use zlib])
384 AC_CHECK_HEADERS([zlib.h])
385 AC_CHECK_LIB(z, main)
386 AM_CONDITIONAL([USE_ZLIB], [true])
390 dnl check if CACAO should be linked statically
391 AC_ARG_ENABLE([staticvm], [AS_HELP_STRING(--enable-staticvm, link GNU classpath's native libraries statically into CACAO [[default=no]])])
393 AC_MSG_CHECKING(whether to link GNU classpath statically into CACAO)
394 if test x"$enable_staticvm" = "xyes"; then
395 ENABLE_STATICVM="yes"
400 if test x"${ENABLE_STATICVM}" = "xyes"; then
402 AM_CONDITIONAL([ENABLE_STATICVM], [true])
405 AM_CONDITIONAL([ENABLE_STATICVM], [false])
407 AC_SUBST(ENABLE_STATICVM)
410 dnl pass configure options to classpath
411 if test x"${ENABLE_STATICVM}" = "xyes"; then
412 AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
413 AM_CONDITIONAL([ENABLE_STATICVM], [true])
415 dnl check for some classpath related stuff when we link statically
418 AM_CONDITIONAL([ENABLE_STATICVM], [false])
422 dnl is GNU classpath installed somewhere different
423 AC_ARG_WITH([classpath-install-dir], [AS_HELP_STRING(--with-classpath-install-dir=<dir>,installation directory of GNU classpath [[default=/usr/local/classpath]])])
425 AC_MSG_CHECKING(where GNU classpath is installed)
426 if test x"$with_classpath_install_dir" != "x"; then
427 if test x"$with_classpath_install_dir" = "xyes"; then
428 AC_MSG_ERROR(please specify the installation prefix)
430 CLASSPATH_INSTALL_DIR="$with_classpath_install_dir"
432 CLASSPATH_INSTALL_DIR="/usr/local/classpath"
434 AC_MSG_RESULT(${CLASSPATH_INSTALL_DIR})
435 AC_DEFINE_UNQUOTED([CLASSPATH_INSTALL_DIR], "${CLASSPATH_INSTALL_DIR}", [GNU classpath installation directory])
436 AC_SUBST(CLASSPATH_INSTALL_DIR)
439 dnl now configure subpackages
440 dnl the export is not my favorite (is there another way?)
442 AC_CONFIG_SUBDIRS(src/boehm-gc src/libltdl src/libffi)
444 AC_CONFIG_FILES([Makefile]
446 [contrib/setenvinstalled]
447 [contrib/setenvsource]
449 [doc/handbook/Makefile]
453 [src/cacaoh/Makefile]
454 [src/fdlibm/Makefile]
457 [src/native/Makefile]
458 [src/native/include/Makefile]
459 [src/native/jvmti/Makefile]
460 [src/native/tools/Makefile]
461 [src/native/vm/Makefile]
462 [src/scripts/Makefile]
464 [src/scripts/rmiregistry]
465 [src/threads/Makefile]
466 [src/threads/green/Makefile]
467 [src/threads/native/Makefile]
468 [src/toolbox/Makefile]
470 [src/vm/jit/Makefile]
471 [src/vm/jit/alpha/Makefile]
472 [src/vm/jit/i386/Makefile]
473 [src/vm/jit/i386/linux/Makefile]
474 [src/vm/jit/i386/freebsd/Makefile]
475 [src/vm/jit/intrp/Makefile]
476 [src/vm/jit/inline/Makefile]
477 [src/vm/jit/loop/Makefile]
478 [src/vm/jit/mips/Makefile]
479 [src/vm/jit/mips/irix/Makefile]
480 [src/vm/jit/mips/linux/Makefile]
481 [src/vm/jit/powerpc/Makefile]
482 [src/vm/jit/powerpc/darwin/Makefile]
483 [src/vm/jit/powerpc/linux/Makefile]
484 [src/vm/jit/schedule/Makefile]
485 [src/vm/jit/tools/Makefile]
486 [src/vm/jit/verify/Makefile]
487 [src/vm/jit/x86_64/Makefile]
489 [tests/codepatching/Makefile]
490 [tests/native/Makefile]
491 [tests/regression/Makefile])
498 ## indent-tabs-mode: t
501 ## compile-command: "automake --add-missing"