1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cacao, 0.91, cacao@cacaojvm.org)
4 AC_CONFIG_SRCDIR(src/cacao/cacao.c)
9 AM_CONFIG_HEADER([config.h])
11 AC_PREFIX_DEFAULT(/usr/local/cacao)
19 CFLAGS="-mieee -D__ALPHA__"
22 i386 | i486 | i586 | i686 )
25 CFLAGS="-D__I386__ $CFLAGS"
32 dnl for MIPSPro Compiler
33 dnl CFLAGS="-64 -OPT:Olimit=0 -woff 1110,1164,1515 -D__MIPS__ -D__MIPSEB__"
34 CFLAGS="-64 -D__MIPS__ -D__MIPSEB__"
37 dnl CFLAGS="-mabi=64 -D__MIPS__ -D__MIPSEB__"
38 dnl LDFLAGS="-mabi=64"
44 CFLAGS="-D__POWERPC__"
54 AC_MSG_ERROR($host_cpu systems are not supported at this time)
59 dnl set optimization and debugging for all architectures and systems
60 CFLAGS="-O2 -g3 $CFLAGS"
65 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"
68 CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__DARWIN__"
71 CFLAGS="$CFLAGS -D__IRIX__"
78 dnl define install prefix
79 if test "x$prefix" = xNONE; then
80 INSTALL_PREFIX=$ac_default_prefix
82 INSTALL_PREFIX=$prefix
84 AC_DEFINE_UNQUOTED([INSTALL_PREFIX], "$INSTALL_PREFIX", [Installation prefix])
85 AC_SUBST(INSTALL_PREFIX)
88 AC_DEFINE_UNQUOTED([ARCH_DIR], "$ARCH_DIR", [Architecture directory])
92 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])
93 dnl force static classpath linking ??
94 AC_MSG_CHECKING(Link classpath static)
95 if test "xno" == "x$use_dynamicclasspath"; then
99 if test "$STATIC_CLASSPATH" == "1"; then
104 AC_SUBST(STATIC_CLASSPATH)
106 dnl Checks for programs.
115 dnl Checks for header files.
118 AC_CHECK_HEADERS([fcntl.h])
119 AC_CHECK_HEADERS([sys/time.h])
120 AC_CHECK_HEADERS([unistd.h])
121 AC_CHECK_HEADERS([sys/ioctl.h])
123 dnl Checks for typedefs, structures, and compiler characteristics.
131 dnl Checks for library functions.
132 AC_PROG_GCC_TRADITIONAL
136 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
138 dnl Checks for libraries.
139 AC_CHECK_LIB(m, fmod)
141 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
142 if test $ac_cv_func_mmap_fixed_mapped = yes; then
143 AC_CACHE_CHECK(whether MAP_FAILED is defined,
146 [#include <sys/mman.h>
150 ac_cv_map_failed=yes,
151 ac_cv_map_failed=no))
153 AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
156 [#include <sys/mman.h>
160 ac_cv_map_anonymous=yes,
161 ac_cv_map_anonymous=no))
163 AC_CACHE_CHECK(whether MAP_ANON is defined,
166 [#include <sys/mman.h>
173 if test $ac_cv_map_failed = yes; then
174 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
177 if test $ac_cv_map_anonymous = yes; then
178 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
181 if test $ac_cv_map_anon = yes; then
182 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
190 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
191 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--disable-__thread,do not use TLS features even when supporting them)], [use__thread=$enableval], [use__thread=yes])
195 AC_MSG_CHECKING(whether to include threads support)
196 enable_threads=${enable_threads:-native}
197 case "$enable_threads" in
200 dnl no threads for boehm
201 ac_configure_args="$ac_configure_args --disable-boehm-threads"
202 AM_CONDITIONAL([USE_THREADS], [false])
203 AM_CONDITIONAL([NATIVE_THREADS], [false])
206 green | native | posix | pthreads)
207 AC_DEFINE([USE_THREADS], 1, [use threads])
208 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
209 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
211 AM_CONDITIONAL([USE_THREADS], [true])
213 if test x"$enable_threads" != "xgreen"; then
214 AC_MSG_RESULT(yes, native)
215 AC_CHECK_LIB(pthread, main)
216 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
218 CFLAGS="$CFLAGS -D_REENTRANT"
220 dnl tell boehm to support threads as well and classpath to
221 dnl synchronize VM threads portably
222 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix --enable-portable-native-sync"
223 AM_CONDITIONAL([NATIVE_THREADS], [true])
226 AC_MSG_RESULT(yes, green)
228 dnl no threads for boehm
229 ac_configure_args="$ac_configure_args --disable-boehm-threads"
230 AM_CONDITIONAL([NATIVE_THREADS], [false])
234 AC_MSG_ERROR($enable_threads is an unknown thread package)
239 dnl Check whether the compiler supports the __thread keyword.
240 if test "x$use__thread" != xno; then
241 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
242 [cat > conftest.c <<\EOF
245 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
246 ac_cv_gcc___thread=yes
248 ac_cv_gcc___thread=no
251 if test "$ac_cv_gcc___thread" = yes; then
252 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
255 ac_cv_gcc___thread=no
259 dnl check if zlib should be used
260 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
262 AC_MSG_CHECKING(whether zip archives should be supported)
263 if test x"$enable_zlib" = "xno"; then
265 AM_CONDITIONAL([USE_ZLIB], [false])
268 AC_DEFINE([USE_ZLIB], 1, [use zlib])
269 AC_CHECK_HEADERS([zlib.h])
270 AC_CHECK_LIB(z, main)
271 AM_CONDITIONAL([USE_ZLIB], [true])
276 AC_ARG_ENABLE([gtk-peer], [AS_HELP_STRING(--enable-gtk-peer,compile GTK native peers [[default=no]])])
280 AC_MSG_CHECKING(whether to use gtk awt peers)
281 if test x"$enable_gtk_peer" = "xyes"; then
283 AC_DEFINE([USE_GTK], 1, [use gtk])
284 AM_CONDITIONAL([USE_GTK_PEER], [true])
288 ac_configure_args="$ac_configure_args --disable-gtk-peer"
289 AM_CONDITIONAL([USE_GTK_PEER], [false])
293 if test "x1" == "x$STATIC_CLASSPATH"; then
294 AC_DEFINE([STATIC_CLASSPATH], 1, [use classpath statically linked])
295 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
298 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
302 dnl set some essential classpath options, even if their classpath default is
304 ac_configure_args="$ac_configure_args --enable-jni --disable-cni --disable-regen-headers --enable-static --enable-shared --enable-load-library"
307 dnl now configure boehm gc and gnu classpath
308 dnl the export is not my favorite (is there another way?)
310 AC_CONFIG_SUBDIRS(src/boehm-gc src/classpath)
315 doc/handbook/Makefile \
319 src/cacaoh/Makefile \
321 src/native/Makefile \
322 src/native/include/Makefile \
323 src/native/tools/Makefile \
324 src/native/vm/Makefile \
325 src/threads/Makefile \
326 src/threads/green/Makefile \
327 src/threads/native/Makefile \
328 src/toolbox/Makefile \
330 src/vm/jit/Makefile \
331 src/vm/jit/alpha/Makefile \
332 src/vm/jit/i386/Makefile \
333 src/vm/jit/inline/Makefile \
334 src/vm/jit/loop/Makefile \
335 src/vm/jit/mips/Makefile \
336 src/vm/jit/powerpc/Makefile \
337 src/vm/jit/tools/Makefile \
338 src/vm/jit/verify/Makefile \
339 src/vm/jit/x86_64/Makefile \
341 tests/jvm98/Makefile \
342 tests/kaffe/Makefile \
343 tests/native/Makefile )
348 ## indent-tabs-mode: t
351 ## compile-command: "automake --add-missing"