1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(cacao, 0.90, cacao@complang.tuwien.ac.at)
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="-O0 -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 CFLAGS="$CFLAGS -DINSTALL_PREFIX=\"\\\"$ac_default_prefix\\\"\""
82 CFLAGS="$CFLAGS -DINSTALL_PREFIX=\"\\\"$prefix\\\"\""
86 AC_DEFINE_UNQUOTED([ARCH_DIR], "$ARCH_DIR", [Architecture directory])
90 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])
91 dnl force static classpath linking ??
92 AC_MSG_CHECKING(Link classpath static)
93 if test "xno" == "x$use_dynamicclasspath"; then
97 if test "$STATIC_CLASSPATH" == "1"; then
102 AC_SUBST(STATIC_CLASSPATH)
104 dnl Checks for programs.
113 dnl Checks for header files.
116 AC_CHECK_HEADERS([fcntl.h])
117 AC_CHECK_HEADERS([sys/time.h])
118 AC_CHECK_HEADERS([unistd.h])
119 AC_CHECK_HEADERS([sys/ioctl.h])
121 dnl Checks for typedefs, structures, and compiler characteristics.
129 dnl Checks for library functions.
130 AC_PROG_GCC_TRADITIONAL
134 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
136 dnl Checks for libraries.
137 AC_CHECK_LIB(m, fmod)
139 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
140 if test $ac_cv_func_mmap_fixed_mapped = yes; then
141 AC_CACHE_CHECK(whether MAP_FAILED is defined,
144 [#include <sys/mman.h>
148 ac_cv_map_failed=yes,
149 ac_cv_map_failed=no))
151 AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
154 [#include <sys/mman.h>
158 ac_cv_map_anonymous=yes,
159 ac_cv_map_anonymous=no))
161 AC_CACHE_CHECK(whether MAP_ANON is defined,
164 [#include <sys/mman.h>
171 if test $ac_cv_map_failed = yes; then
172 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
175 if test $ac_cv_map_anonymous = yes; then
176 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
179 if test $ac_cv_map_anon = yes; then
180 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
188 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
189 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--disable-__thread,do not use TLS features even when supporting them)], [use__thread=$enableval], [use__thread=yes])
193 AC_MSG_CHECKING(whether to include threads support)
194 enable_threads=${enable_threads:-native}
195 case "$enable_threads" in
198 dnl no threads for boehm
199 ac_configure_args="$ac_configure_args --disable-boehm-threads"
200 AM_CONDITIONAL([USE_THREADS], [false])
201 AM_CONDITIONAL([NATIVE_THREADS], [false])
204 green | native | posix | pthreads)
205 AC_DEFINE([USE_THREADS], 1, [use threads])
206 AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
207 AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
209 AM_CONDITIONAL([USE_THREADS], [true])
211 if test x"$enable_threads" != "xgreen"; then
212 AC_MSG_RESULT(yes, native)
213 AC_CHECK_LIB(pthread, main)
214 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
216 CFLAGS="$CFLAGS -D_REENTRANT"
218 dnl tell boehm to support threads as well and classpath to
219 dnl synchronize VM threads portably
220 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix --enable-portable-native-sync"
221 AM_CONDITIONAL([NATIVE_THREADS], [true])
224 AC_MSG_RESULT(yes, green)
226 dnl no threads for boehm
227 ac_configure_args="$ac_configure_args --disable-boehm-threads"
228 AM_CONDITIONAL([NATIVE_THREADS], [false])
232 AC_MSG_ERROR($enable_threads is an unknown thread package)
237 dnl Check whether the compiler supports the __thread keyword.
238 if test "x$use__thread" != xno; then
239 AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
240 [cat > conftest.c <<\EOF
243 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
244 ac_cv_gcc___thread=yes
246 ac_cv_gcc___thread=no
249 if test "$ac_cv_gcc___thread" = yes; then
250 AC_DEFINE([HAVE___THREAD], 1, [have __thread])
253 ac_cv_gcc___thread=no
257 dnl check if zlib should be used
258 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
260 AC_MSG_CHECKING(whether zip archives should be supported)
261 if test x"$enable_zlib" = "xno"; then
263 AM_CONDITIONAL([USE_ZLIB], [false])
266 AC_DEFINE([USE_ZLIB], 1, [use zlib])
267 AC_CHECK_HEADERS([zlib.h])
268 AC_CHECK_LIB(z, main)
269 AM_CONDITIONAL([USE_ZLIB], [true])
274 AC_ARG_ENABLE([gtk-peer], [AS_HELP_STRING(--enable-gtk-peer,compile GTK native peers [[default=no]])])
278 AC_MSG_CHECKING(whether to use gtk awt peers)
279 if test x"$enable_gtk_peer" = "xyes"; then
281 AC_DEFINE([USE_GTK], 1, [use gtk])
282 AM_CONDITIONAL([USE_GTK_PEER], [true])
286 ac_configure_args="$ac_configure_args --disable-gtk-peer"
287 AM_CONDITIONAL([USE_GTK_PEER], [false])
291 if test "x1" == "x$STATIC_CLASSPATH"; then
292 AC_DEFINE([STATIC_CLASSPATH], 1, [use classpath statically linked])
293 AM_CONDITIONAL([STATIC_CLASSPATH], [true])
296 AM_CONDITIONAL([STATIC_CLASSPATH], [false])
300 dnl set some essential classpath options, even if their classpath default is
302 ac_configure_args="$ac_configure_args --enable-jni --disable-cni --disable-regen-headers --enable-static --enable-shared --enable-load-library"
305 dnl now configure boehm gc and gnu classpath
306 dnl the export is not my favorite (is there another way?)
308 AC_CONFIG_SUBDIRS(src/boehm-gc src/classpath)
313 doc/handbook/Makefile \
317 src/cacaoh/Makefile \
319 src/native/Makefile \
320 src/native/include/Makefile \
321 src/native/tools/Makefile \
322 src/native/vm/Makefile \
323 src/threads/Makefile \
324 src/threads/green/Makefile \
325 src/threads/native/Makefile \
326 src/toolbox/Makefile \
328 src/vm/jit/Makefile \
329 src/vm/jit/alpha/Makefile \
330 src/vm/jit/i386/Makefile \
331 src/vm/jit/inline/Makefile \
332 src/vm/jit/loop/Makefile \
333 src/vm/jit/mips/Makefile \
334 src/vm/jit/powerpc/Makefile \
335 src/vm/jit/tools/Makefile \
336 src/vm/jit/verify/Makefile \
337 src/vm/jit/x86_64/Makefile \
339 tests/jvm98/Makefile \
340 tests/kaffe/Makefile \
341 tests/native/Makefile )
346 ## indent-tabs-mode: t
349 ## compile-command: "automake --add-missing"