1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cacao, 0.92cvs, 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)
20 CFLAGS="-mieee -D__ALPHA__"
29 i386 | i486 | i586 | i686 )
32 CFLAGS="-D__I386__ $CFLAGS"
39 dnl for MIPSPro Compiler
40 dnl CFLAGS="-64 -OPT:Olimit=0 -woff 1110,1164,1515 -D__MIPS__ -D__MIPSEB__"
41 CFLAGS="-64 -OPT:Olimit=0 -D__MIPS__ -D__MIPSEB__"
44 dnl CFLAGS="-mabi=64 -D__MIPS__ -D__MIPSEB__"
45 dnl LDFLAGS="-mabi=64"
51 CFLAGS="-D__POWERPC__"
63 CFLAGS="-D__XDSPCORE__"
67 AC_MSG_ERROR($host_cpu systems are not supported at this time)
72 dnl set optimization and debugging for all architectures and systems
73 CFLAGS="-O0 -g3 $CFLAGS"
79 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"
83 CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__DARWIN__"
87 CFLAGS="$CFLAGS -D__IRIX__"
94 dnl define and substitute some architecture specific variables
95 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [Architecture directory])
98 AC_SUBST(USE_SCHEDULER)
101 dnl define install prefix
102 if test "x$prefix" = xNONE; then
103 CACAO_INSTALL_PREFIX=$ac_default_prefix
105 CACAO_INSTALL_PREFIX=$prefix
107 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
108 AC_SUBST(CACAO_INSTALL_PREFIX)
111 dnl Checks for programs.
120 dnl Checks for header files.
123 AC_CHECK_HEADERS([fcntl.h])
124 AC_CHECK_HEADERS([sys/time.h])
125 AC_CHECK_HEADERS([unistd.h])
126 AC_CHECK_HEADERS([sys/ioctl.h])
128 dnl Checks for typedefs, structures, and compiler characteristics.
136 dnl Checks for library functions.
137 AC_PROG_GCC_TRADITIONAL
141 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
143 dnl Checks for libraries.
144 AC_CHECK_LIB(m, fmod)
146 dnl Checking sizeof void *
147 AC_COMPILE_CHECK_SIZEOF(void *)
150 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
151 if test $ac_cv_func_mmap_fixed_mapped = yes; then
152 AC_CACHE_CHECK(whether MAP_FAILED is defined,
155 [#include <sys/mman.h>
159 ac_cv_map_failed=yes,
160 ac_cv_map_failed=no))
162 AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
165 [#include <sys/mman.h>
169 ac_cv_map_anonymous=yes,
170 ac_cv_map_anonymous=no))
172 AC_CACHE_CHECK(whether MAP_ANON is defined,
175 [#include <sys/mman.h>
182 if test $ac_cv_map_failed = yes; then
183 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
186 if test $ac_cv_map_anonymous = yes; then
187 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
190 if test $ac_cv_map_anon = yes; then
191 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
200 dnl check for garbage collector
201 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-gc,disable garbage collector [[default=yes]])])
203 AC_MSG_CHECKING(whether GC should be disabled)
204 if test x"$disable_gc" = "xyes"; then
206 AM_CONDITIONAL([DISABLE_GC], [true])
209 AM_CONDITIONAL([DISABLE_GC], [false])
213 dnl check for statistics
214 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
216 AC_MSG_CHECKING(whether statistics generation should be enabled)
217 if test x"$enable_statistics" = "xno"; then
219 AM_CONDITIONAL([STATISTICS], [false])
222 AC_DEFINE([STATISTICS], 1, [use statistics])
223 AM_CONDITIONAL([STATISTICS], [true])
228 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
229 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
231 AC_MSG_CHECKING(whether to include threads support)
232 enable_threads=${enable_threads:-native}
233 case "$enable_threads" in
236 dnl no threads for boehm
237 ac_configure_args="$ac_configure_args --disable-boehm-threads"
238 AM_CONDITIONAL([USE_THREADS], [false])
239 AM_CONDITIONAL([NATIVE_THREADS], [false])
242 green | native | posix | pthreads)
243 AC_DEFINE([USE_THREADS], 1, [use threads])
244 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
245 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
247 AM_CONDITIONAL([USE_THREADS], [true])
249 if test x"$enable_threads" != "xgreen"; then
250 AC_MSG_RESULT(yes, native)
251 AC_CHECK_LIB(pthread, main)
252 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
254 CFLAGS="$CFLAGS -D_REENTRANT"
256 dnl tell boehm to support threads as well
257 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-boehm-threads=posix"
258 AM_CONDITIONAL([NATIVE_THREADS], [true])
261 AC_MSG_RESULT(yes, green)
263 dnl no threads for boehm
264 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-boehm-threads"
265 AM_CONDITIONAL([NATIVE_THREADS], [false])
269 AC_MSG_ERROR($enable_threads is an unknown thread package)
274 dnl Check whether the compiler supports the __thread keyword.
275 if test "x$use__thread" != xno; then
276 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
277 [cat > conftest.c <<\EOF
280 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
281 ac_cv_gcc___thread=yes
283 ac_cv_gcc___thread=no
286 if test "$ac_cv_gcc___thread" = yes; then
287 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
290 ac_cv_gcc___thread=no
294 dnl check if linear scan register allocator(lsra) should be used
295 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
297 AC_MSG_CHECKING(whether lsra should be supported)
298 if test x"$enable_lsra" = "xno"; then
302 AC_DEFINE([LSRA], 1, [use lsra])
306 dnl check for inlining
307 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
309 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
310 dnl if test x"$enable_inlining" = "xno"; then
311 dnl AC_MSG_RESULT(yes)
312 dnl AM_CONDITIONAL([USE_INLINING], [false])
314 dnl AC_MSG_RESULT(no)
315 AC_DEFINE([USE_INLINING], 1, [use method inlining])
316 AM_CONDITIONAL([USE_INLINING], [true])
320 dnl check for instruction scheduler
321 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
323 AC_MSG_CHECKING(whether instruction scheduler should be supported)
324 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
325 case "${ARCH_DIR}" in
329 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
334 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
335 AM_CONDITIONAL([USE_SCHEDULER], [true])
338 AM_CONDITIONAL([USE_SCHEDULER], [false])
342 dnl check if zlib should be used
343 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
345 AC_MSG_CHECKING(whether zip archives should be supported)
346 if test x"$enable_zlib" = "xno"; then
348 AM_CONDITIONAL([USE_ZLIB], [false])
351 AC_DEFINE([USE_ZLIB], 1, [use zlib])
352 AC_CHECK_HEADERS([zlib.h])
353 AC_CHECK_LIB(z, main)
354 AM_CONDITIONAL([USE_ZLIB], [true])
358 dnl check if classpath should be linked statically with CACAO
359 AC_ARG_ENABLE([dynamicclasspath], [AS_HELP_STRING(--disable-dynamicclasspath, link classpath native code static even on platforms supporting dynamic loading)], [use_dynamicclasspath=$enableval], [use_dynamicclasspath=yes])
361 AC_MSG_CHECKING(whether to link GNU classpath statically)
362 if test x"$use_dynamicclasspath" = "xno"; then
366 if test x"${STATIC_CLASSPATH}" = "x1"; then
368 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
371 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
373 AC_SUBST(STATIC_CLASSPATH)
377 AC_ARG_ENABLE([gtk-peer], [AS_HELP_STRING(--enable-gtk-peer,compile GTK native peers [[default=no]])])
379 AC_MSG_CHECKING(whether to use GTK awt peers)
380 if test x"$enable_gtk_peer" = "xyes"; then
382 AC_DEFINE([USE_GTK], 1, [use gtk])
383 AM_CONDITIONAL([USE_GTK_PEER], [true])
387 AM_CONDITIONAL([USE_GTK_PEER], [false])
388 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-gtk-peer"
391 AC_SUBST(USE_GTK_PEER)
394 dnl pass configure options to classpath
395 if test x"${STATIC_CLASSPATH}" = "x1"; then
396 AC_DEFINE([STATIC_CLASSPATH], 1, [use classpath statically linked])
397 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
398 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-static --disable-shared"
400 dnl check for some classpath related stuff when we link statically
403 dnl taken from GNU classpath configure.ac
404 if test x"${USE_GTK_PEER}" = "xyes"; then
405 AC_ERROR(XXX this is not supported yet)
407 if test "$no_x" = yes; then
408 AC_MSG_ERROR([GTK+ peers requested but no X library available])
410 dnl We explicitly want the XTest Extension for Robot support.
411 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
412 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
414 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0)
419 AC_SUBST(CAIRO_CFLAGS)
420 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
421 AC_SUBST(PANGOFT2_LIBS)
422 AC_SUBST(PANGOFT2_CFLAGS)
425 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
426 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-static --enable-shared"
430 dnl should we use an external classpath installation
431 AC_ARG_WITH([external-classpath], [AS_HELP_STRING(--with-external-classpath=<dir>,installation directory of external GNU classpath [[default=no]])])
433 AC_MSG_CHECKING(whether to use an external GNU classpath)
434 if test x"$with_external_classpath" != "x"; then
435 if test x"$with_external_classpath" = "xyes"; then
436 AC_MSG_ERROR(please specify the installation prefix)
438 AC_MSG_RESULT($with_external_classpath)
439 AC_DEFINE([WITH_EXTERNAL_CLASSPATH], 1, [external classpath])
440 AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [true])
441 EXTERNAL_CLASSPATH_PREFIX="$with_external_classpath"
442 AC_DEFINE_UNQUOTED([EXTERNAL_CLASSPATH_PREFIX], "${EXTERNAL_CLASSPATH_PREFIX}", [external classpath directory])
443 AC_SUBST(EXTERNAL_CLASSPATH_PREFIX)
446 AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [false])
450 dnl set some essential classpath options, even if their classpath default is
452 ac_configure_args="$ac_configure_args --libdir=${CACAO_INSTALL_PREFIX}/jre/lib/${ARCH_DIR} --enable-jni --disable-cni --disable-regen-headers ${CONFIGURE_ARGS}"
455 dnl now configure boehm gc and gnu classpath
456 dnl the export is not my favorite (is there another way?)
458 AC_CONFIG_SUBDIRS(src/boehm-gc src/classpath)
461 AC_CONFIG_FILES([Makefile]
463 [doc/handbook/Makefile]
467 [src/cacaoh/Makefile]
470 [src/native/Makefile]
471 [src/native/include/Makefile]
472 [src/native/tools/Makefile]
473 [src/native/vm/Makefile]
474 [src/scripts/Makefile]
479 [src/scripts/rmiregistry]
480 [src/threads/Makefile]
481 [src/threads/green/Makefile]
482 [src/threads/native/Makefile]
483 [src/toolbox/Makefile]
485 [src/vm/jit/Makefile]
486 [src/vm/jit/alpha/Makefile]
487 [src/vm/jit/i386/Makefile]
488 [src/vm/jit/inline/Makefile]
489 [src/vm/jit/loop/Makefile]
490 [src/vm/jit/mips/Makefile]
491 [src/vm/jit/powerpc/Makefile]
492 [src/vm/jit/powerpc/darwin/Makefile]
493 [src/vm/jit/powerpc/linux/Makefile]
494 [src/vm/jit/schedule/Makefile]
495 [src/vm/jit/tools/Makefile]
496 [src/vm/jit/verify/Makefile]
497 [src/vm/jit/x86_64/Makefile]
499 [tests/codepatching/Makefile]
500 [tests/kaffe/Makefile]
501 [tests/native/Makefile])
508 ## indent-tabs-mode: t
511 ## compile-command: "automake --add-missing"