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="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__FREEBSD__ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
91 CFLAGS="$CFLAGS -D__IRIX__"
98 dnl define and substitute some architecture specific variables
99 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [Architecture directory])
102 AC_SUBST(USE_SCHEDULER)
105 dnl define install prefix
106 if test "x$prefix" = xNONE; then
107 CACAO_INSTALL_PREFIX=$ac_default_prefix
109 CACAO_INSTALL_PREFIX=$prefix
111 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
112 AC_SUBST(CACAO_INSTALL_PREFIX)
115 dnl Checks for programs.
125 AC_LIBLTDL_CONVENIENCE
129 dnl Checks for header files.
132 AC_CHECK_HEADERS([fcntl.h])
133 AC_CHECK_HEADERS([sys/time.h])
134 AC_CHECK_HEADERS([unistd.h])
135 AC_CHECK_HEADERS([sys/ioctl.h])
137 dnl Checks for typedefs, structures, and compiler characteristics.
145 dnl Checks for library functions.
146 AC_PROG_GCC_TRADITIONAL
150 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
152 dnl Checks for libraries.
153 AC_CHECK_LIB(m, fmod)
155 dnl Checking sizeof void *
156 AC_COMPILE_CHECK_SIZEOF(void *)
159 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
160 if test $ac_cv_func_mmap_fixed_mapped = yes; then
161 AC_CACHE_CHECK(whether MAP_FAILED is defined,
164 [#include <sys/mman.h>
168 ac_cv_map_failed=yes,
169 ac_cv_map_failed=no))
171 AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
174 [#include <sys/mman.h>
178 ac_cv_map_anonymous=yes,
179 ac_cv_map_anonymous=no))
181 AC_CACHE_CHECK(whether MAP_ANON is defined,
184 [#include <sys/mman.h>
191 if test $ac_cv_map_failed = yes; then
192 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
195 if test $ac_cv_map_anonymous = yes; then
196 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
199 if test $ac_cv_map_anon = yes; then
200 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
209 dnl check for garbage collector
210 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-gc,disable garbage collector [[default=yes]])])
212 AC_MSG_CHECKING(whether GC should be disabled)
213 if test x"$enable_gc" = "xno"; then
215 AM_CONDITIONAL([DISABLE_GC], [true])
218 AM_CONDITIONAL([DISABLE_GC], [false])
221 dnl check for statistics
222 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
224 AC_MSG_CHECKING(whether statistics generation should be enabled)
225 if test x"$enable_statistics" = "xno"; then
227 AM_CONDITIONAL([STATISTICS], [false])
230 AC_DEFINE([STATISTICS], 1, [use statistics])
231 AM_CONDITIONAL([STATISTICS], [true])
236 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
237 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
239 AC_MSG_CHECKING(whether to include threads support)
240 enable_threads=${enable_threads:-native}
241 case "$enable_threads" in
244 dnl no threads for boehm
245 ac_configure_args="$ac_configure_args --disable-boehm-threads"
246 AM_CONDITIONAL([USE_THREADS], [false])
247 AM_CONDITIONAL([NATIVE_THREADS], [false])
250 green | native | posix | pthreads)
251 AC_DEFINE([USE_THREADS], 1, [use threads])
252 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
253 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
255 AM_CONDITIONAL([USE_THREADS], [true])
257 if test x"$enable_threads" != "xgreen"; then
258 AC_MSG_RESULT(yes, native)
259 AC_CHECK_LIB(pthread, main)
260 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
262 CFLAGS="$CFLAGS -D_REENTRANT"
264 dnl tell boehm to support threads as well
265 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-boehm-threads=posix"
266 AM_CONDITIONAL([NATIVE_THREADS], [true])
269 AC_MSG_RESULT(yes, green)
271 dnl no threads for boehm
272 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-boehm-threads"
273 AM_CONDITIONAL([NATIVE_THREADS], [false])
277 AC_MSG_ERROR($enable_threads is an unknown thread package)
282 dnl Check whether the compiler supports the __thread keyword.
283 if test "x$use__thread" != xno; then
284 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
285 [cat > conftest.c <<\EOF
288 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
289 ac_cv_gcc___thread=yes
291 ac_cv_gcc___thread=no
294 if test "$ac_cv_gcc___thread" = yes; then
295 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
298 ac_cv_gcc___thread=no
302 dnl check if linear scan register allocator(lsra) should be used
303 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
305 AC_MSG_CHECKING(whether lsra should be supported)
306 if test x"$enable_lsra" = "xno"; then
310 AC_DEFINE([LSRA], 1, [use lsra])
314 dnl check for inlining
315 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
317 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
318 dnl if test x"$enable_inlining" = "xno"; then
319 dnl AC_MSG_RESULT(yes)
320 dnl AM_CONDITIONAL([USE_INLINING], [false])
322 dnl AC_MSG_RESULT(no)
323 AC_DEFINE([USE_INLINING], 1, [use method inlining])
324 AM_CONDITIONAL([USE_INLINING], [true])
328 dnl check for instruction scheduler
329 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
331 AC_MSG_CHECKING(whether instruction scheduler should be supported)
332 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
333 case "${ARCH_DIR}" in
337 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
342 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
343 AM_CONDITIONAL([USE_SCHEDULER], [true])
346 AM_CONDITIONAL([USE_SCHEDULER], [false])
350 dnl check if zlib should be used
351 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
353 AC_MSG_CHECKING(whether zip archives should be supported)
354 if test x"$enable_zlib" = "xno"; then
356 AM_CONDITIONAL([USE_ZLIB], [false])
359 AC_DEFINE([USE_ZLIB], 1, [use zlib])
360 AC_CHECK_HEADERS([zlib.h])
361 AC_CHECK_LIB(z, main)
362 AM_CONDITIONAL([USE_ZLIB], [true])
366 dnl check if classpath should be linked statically with CACAO
367 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])
369 AC_MSG_CHECKING(whether to link GNU classpath statically)
370 if test x"$use_dynamicclasspath" = "xno"; then
374 if test x"${STATIC_CLASSPATH}" = "x1"; then
376 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
379 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
381 AC_SUBST(STATIC_CLASSPATH)
385 AC_ARG_ENABLE([gtk-peer], [AS_HELP_STRING(--enable-gtk-peer,compile GTK native peers [[default=no]])])
387 AC_MSG_CHECKING(whether to use GTK awt peers)
388 if test x"$enable_gtk_peer" = "xyes"; then
390 AC_DEFINE([USE_GTK], 1, [use gtk])
391 AM_CONDITIONAL([USE_GTK_PEER], [true])
395 AM_CONDITIONAL([USE_GTK_PEER], [false])
396 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-gtk-peer"
399 AC_SUBST(USE_GTK_PEER)
402 dnl pass configure options to classpath
403 if test x"${STATIC_CLASSPATH}" = "x1"; then
404 AC_DEFINE([STATIC_CLASSPATH], 1, [use classpath statically linked])
405 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
406 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-static --disable-shared"
408 dnl check for some classpath related stuff when we link statically
411 dnl taken from GNU classpath configure.ac
412 if test x"${USE_GTK_PEER}" = "xyes"; then
413 AC_ERROR(XXX this is not supported yet)
415 if test "$no_x" = yes; then
416 AC_MSG_ERROR([GTK+ peers requested but no X library available])
418 dnl We explicitly want the XTest Extension for Robot support.
419 AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
420 [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
422 PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 libart-2.0 gdk-pixbuf-2.0)
427 AC_SUBST(CAIRO_CFLAGS)
428 PKG_CHECK_MODULES(PANGOFT2, pangoft2)
429 AC_SUBST(PANGOFT2_LIBS)
430 AC_SUBST(PANGOFT2_CFLAGS)
433 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
434 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-static --enable-shared"
438 dnl should we use an external classpath installation
439 AC_ARG_WITH([external-classpath], [AS_HELP_STRING(--with-external-classpath=<dir>,installation directory of external GNU classpath [[default=no]])])
441 AC_MSG_CHECKING(whether to use an external GNU classpath)
442 if test x"$with_external_classpath" != "x"; then
443 if test x"$with_external_classpath" = "xyes"; then
444 AC_MSG_ERROR(please specify the installation prefix)
446 AC_MSG_RESULT($with_external_classpath)
447 AC_DEFINE([WITH_EXTERNAL_CLASSPATH], 1, [external classpath])
448 AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [true])
449 EXTERNAL_CLASSPATH_PREFIX="$with_external_classpath"
450 AC_DEFINE_UNQUOTED([EXTERNAL_CLASSPATH_PREFIX], "${EXTERNAL_CLASSPATH_PREFIX}", [external classpath directory])
451 AC_SUBST(EXTERNAL_CLASSPATH_PREFIX)
454 AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [false])
458 dnl set some essential classpath options, even if their classpath default is
460 ac_configure_args="$ac_configure_args --libdir=${CACAO_INSTALL_PREFIX}/jre/lib/${ARCH_DIR} --enable-jni --disable-cni --disable-regen-headers ${CONFIGURE_ARGS}"
463 dnl now configure boehm gc and gnu classpath
464 dnl the export is not my favorite (is there another way?)
466 AC_CONFIG_SUBDIRS(src/boehm-gc src/classpath src/libltdl)
469 AC_CONFIG_FILES([Makefile]
471 [doc/handbook/Makefile]
475 [src/cacaoh/Makefile]
478 [src/native/Makefile]
479 [src/native/include/Makefile]
480 [src/native/tools/Makefile]
481 [src/native/vm/Makefile]
482 [src/scripts/Makefile]
487 [src/scripts/rmiregistry]
488 [src/threads/Makefile]
489 [src/threads/green/Makefile]
490 [src/threads/native/Makefile]
491 [src/toolbox/Makefile]
493 [src/vm/jit/Makefile]
494 [src/vm/jit/alpha/Makefile]
495 [src/vm/jit/arm/Makefile]
496 [src/vm/jit/i386/Makefile]
497 [src/vm/jit/i386/linux/Makefile]
498 [src/vm/jit/i386/freebsd/Makefile]
499 [src/vm/jit/inline/Makefile]
500 [src/vm/jit/loop/Makefile]
501 [src/vm/jit/mips/Makefile]
502 [src/vm/jit/powerpc/Makefile]
503 [src/vm/jit/powerpc/darwin/Makefile]
504 [src/vm/jit/powerpc/linux/Makefile]
505 [src/vm/jit/schedule/Makefile]
506 [src/vm/jit/tools/Makefile]
507 [src/vm/jit/verify/Makefile]
508 [src/vm/jit/x86_64/Makefile]
510 [tests/codepatching/Makefile]
511 [tests/kaffe/Makefile]
512 [tests/native/Makefile])
519 ## indent-tabs-mode: t
522 ## compile-command: "automake --add-missing"