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__"
23 i386 | i486 | i586 | i686 )
26 CFLAGS="-D__I386__ $CFLAGS"
33 dnl for MIPSPro Compiler
34 dnl CFLAGS="-64 -OPT:Olimit=0 -woff 1110,1164,1515 -D__MIPS__ -D__MIPSEB__"
35 CFLAGS="-64 -OPT:Olimit=0 -D__MIPS__ -D__MIPSEB__"
38 dnl CFLAGS="-mabi=64 -D__MIPS__ -D__MIPSEB__"
39 dnl LDFLAGS="-mabi=64"
45 CFLAGS="-D__POWERPC__"
57 CFLAGS="-D__XDSPCORE__"
61 AC_MSG_ERROR($host_cpu systems are not supported at this time)
66 dnl set optimization and debugging for all architectures and systems
67 CFLAGS="-O0 -g3 $CFLAGS"
72 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"
75 CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__DARWIN__"
78 CFLAGS="$CFLAGS -D__IRIX__"
85 dnl define and substitute some architecture specific variables
86 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [Architecture directory])
88 AC_SUBST(USE_SCHEDULER)
91 dnl define install prefix
92 if test "x$prefix" = xNONE; then
93 CACAO_INSTALL_PREFIX=$ac_default_prefix
95 CACAO_INSTALL_PREFIX=$prefix
97 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
98 AC_SUBST(CACAO_INSTALL_PREFIX)
101 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])
102 dnl force static classpath linking ??
103 AC_MSG_CHECKING(Link classpath static)
104 if test "xno" == "x$use_dynamicclasspath"; then
108 if test "$STATIC_CLASSPATH" == "1"; then
113 AC_SUBST(STATIC_CLASSPATH)
115 dnl Checks for programs.
124 dnl Checks for header files.
127 AC_CHECK_HEADERS([fcntl.h])
128 AC_CHECK_HEADERS([sys/time.h])
129 AC_CHECK_HEADERS([unistd.h])
130 AC_CHECK_HEADERS([sys/ioctl.h])
132 dnl Checks for typedefs, structures, and compiler characteristics.
140 dnl Checks for library functions.
141 AC_PROG_GCC_TRADITIONAL
145 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
147 dnl Checks for libraries.
148 AC_CHECK_LIB(m, fmod)
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 statistics
201 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
203 AC_MSG_CHECKING(whether statistics generation should be enabled)
204 if test x"$enable_statistics" = "xno"; then
206 AM_CONDITIONAL([STATISTICS], [false])
209 AC_DEFINE([STATISTICS], 1, [use statistics])
210 AM_CONDITIONAL([STATISTICS], [true])
215 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
216 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
218 AC_MSG_CHECKING(whether to include threads support)
219 enable_threads=${enable_threads:-native}
220 case "$enable_threads" in
223 dnl no threads for boehm
224 ac_configure_args="$ac_configure_args --disable-boehm-threads"
225 AM_CONDITIONAL([USE_THREADS], [false])
226 AM_CONDITIONAL([NATIVE_THREADS], [false])
229 green | native | posix | pthreads)
230 AC_DEFINE([USE_THREADS], 1, [use threads])
231 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
232 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
234 AM_CONDITIONAL([USE_THREADS], [true])
236 if test x"$enable_threads" != "xgreen"; then
237 AC_MSG_RESULT(yes, native)
238 AC_CHECK_LIB(pthread, main)
239 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
241 CFLAGS="$CFLAGS -D_REENTRANT"
243 dnl tell boehm to support threads as well
244 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-boehm-threads=posix"
245 AM_CONDITIONAL([NATIVE_THREADS], [true])
248 AC_MSG_RESULT(yes, green)
250 dnl no threads for boehm
251 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-boehm-threads"
252 AM_CONDITIONAL([NATIVE_THREADS], [false])
256 AC_MSG_ERROR($enable_threads is an unknown thread package)
261 dnl Check whether the compiler supports the __thread keyword.
262 if test "x$use__thread" != xno; then
263 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
264 [cat > conftest.c <<\EOF
267 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
268 ac_cv_gcc___thread=yes
270 ac_cv_gcc___thread=no
273 if test "$ac_cv_gcc___thread" = yes; then
274 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
277 ac_cv_gcc___thread=no
281 dnl check if linear scan register allocator(lsra) should be used
282 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
284 AC_MSG_CHECKING(whether lsra should be supported)
285 if test x"$enable_lsra" = "xno"; then
289 AC_DEFINE([LSRA], 1, [use lsra])
293 dnl check for instruction scheduler
294 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
296 AC_MSG_CHECKING(whether instruction scheduler should be supported)
297 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
298 case "${ARCH_DIR}" in
302 AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
307 AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
308 AM_CONDITIONAL([USE_SCHEDULER], [true])
311 AM_CONDITIONAL([USE_SCHEDULER], [false])
315 dnl check if zlib should be used
316 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
318 AC_MSG_CHECKING(whether zip archives should be supported)
319 if test x"$enable_zlib" = "xno"; then
321 AM_CONDITIONAL([USE_ZLIB], [false])
324 AC_DEFINE([USE_ZLIB], 1, [use zlib])
325 AC_CHECK_HEADERS([zlib.h])
326 AC_CHECK_LIB(z, main)
327 AM_CONDITIONAL([USE_ZLIB], [true])
332 AC_ARG_ENABLE([gtk-peer], [AS_HELP_STRING(--enable-gtk-peer,compile GTK native peers [[default=no]])])
334 AC_MSG_CHECKING(whether to use gtk awt peers)
335 if test x"$enable_gtk_peer" = "xyes"; then
337 AC_DEFINE([USE_GTK], 1, [use gtk])
338 AM_CONDITIONAL([USE_GTK_PEER], [true])
341 AM_CONDITIONAL([USE_GTK_PEER], [false])
342 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-gtk-peer"
346 if test "x$STATIC_CLASSPATH" = "x1"; then
347 AC_DEFINE([STATIC_CLASSPATH], 1, [use classpath statically linked])
348 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
349 CONFIGURE_ARGS="${CONFIGURE_ARGS} --enable-static --disable-shared --disable-load-library"
351 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
352 CONFIGURE_ARGS="${CONFIGURE_ARGS} --disable-static --enable-shared --enable-load-library"
356 dnl should we use an external classpath installation
357 AC_ARG_WITH([external-classpath], [AS_HELP_STRING(--with-external-classpath=<dir>,installation directory of external GNU classpath [[default=no]])])
359 AC_MSG_CHECKING(whether to use an external GNU classpath)
360 if test x"$with_external_classpath" != "x"; then
361 if test x"$with_external_classpath" = "xyes"; then
362 AC_MSG_ERROR(please specify the installation prefix)
364 AC_MSG_RESULT($with_external_classpath)
365 AC_DEFINE([WITH_EXTERNAL_CLASSPATH], 1, [external classpath])
366 AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [true])
367 EXTERNAL_CLASSPATH_PREFIX="$with_external_classpath"
368 AC_DEFINE_UNQUOTED([EXTERNAL_CLASSPATH_PREFIX], "${EXTERNAL_CLASSPATH_PREFIX}", [external classpath directory])
369 AC_SUBST(EXTERNAL_CLASSPATH_PREFIX)
372 AM_CONDITIONAL([WITH_EXTERNAL_CLASSPATH], [false])
376 dnl set some essential classpath options, even if their classpath default is
378 ac_configure_args="$ac_configure_args --libdir=${CACAO_INSTALL_PREFIX}/jre/lib/${ARCH_DIR} --enable-jni --disable-cni --disable-regen-headers ${CONFIGURE_ARGS}"
381 dnl now configure boehm gc and gnu classpath
382 dnl the export is not my favorite (is there another way?)
384 AC_CONFIG_SUBDIRS(src/boehm-gc src/classpath)
387 AC_CONFIG_FILES([Makefile]
389 [doc/handbook/Makefile]
393 [src/cacaoh/Makefile]
396 [src/native/Makefile]
397 [src/native/include/Makefile]
398 [src/native/vm/Makefile]
399 [src/scripts/Makefile]
403 [src/scripts/rmiregistry]
404 [src/threads/Makefile]
405 [src/threads/green/Makefile]
406 [src/threads/native/Makefile]
407 [src/toolbox/Makefile]
409 [src/vm/jit/Makefile]
410 [src/vm/jit/alpha/Makefile]
411 [src/vm/jit/i386/Makefile]
412 [src/vm/jit/inline/Makefile]
413 [src/vm/jit/loop/Makefile]
414 [src/vm/jit/mips/Makefile]
415 [src/vm/jit/powerpc/Makefile]
416 [src/vm/jit/schedule/Makefile]
417 [src/vm/jit/tools/Makefile]
418 [src/vm/jit/verify/Makefile]
419 [src/vm/jit/x86_64/Makefile]
421 [tests/kaffe/Makefile]
422 [tests/native/Makefile])
429 ## indent-tabs-mode: t
432 ## compile-command: "automake --add-missing"