* contrib/vmlog/Makefile.am (AM_CPPFLAGS): Add include directories for vmlog.
[cacao.git] / configure.ac
1 dnl configure.ac
2 dnl
3 dnl Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
4 dnl C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 dnl E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 dnl J. Wenninger, Institut f. Computersprachen - TU Wien
7 dnl 
8 dnl This file is part of CACAO.
9 dnl 
10 dnl This program is free software; you can redistribute it and/or
11 dnl modify it under the terms of the GNU General Public License as
12 dnl published by the Free Software Foundation; either version 2, or (at
13 dnl your option) any later version.
14 dnl 
15 dnl This program is distributed in the hope that it will be useful, but
16 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 dnl General Public License for more details.
19 dnl 
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program; if not, write to the Free Software
22 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 dnl 02110-1301, USA.
24 dnl 
25 dnl $Id: configure.ac 7799 2007-04-23 23:03:31Z twisti $
26
27 dnl Process this file with autoconf to produce a configure script.
28
29
30 AC_INIT(cacao, 0.98rc, cacao@cacaojvm.org)
31 AC_CONFIG_SRCDIR(src/cacao/cacao.c)
32 AC_CANONICAL_HOST
33 AC_PREREQ(2.59)
34 AM_INIT_AUTOMAKE([1.9.0])
35 AM_MAINTAINER_MODE
36
37 AM_CONFIG_HEADER([config.h])
38
39 AC_PREFIX_DEFAULT(/usr/local/cacao)
40
41
42 dnl set optimization and debugging for all architectures and systems
43 if test x"$CFLAGS" = "x"; then
44     OPT_CFLAGS="-O0 -g3"
45 else
46     OPT_CFLAGS=$CFLAGS
47 fi
48
49 dnl system type
50 case "$host_cpu" in
51 alpha | alphaev56 | alphapca56 )
52     ARCH_DIR="alpha"
53     ARCH_CFLAGS="-mieee -D__ALPHA__"
54     ;;
55
56 arm | armv4 | armv4tl | armv5b | armv5l )
57     ARCH_DIR="arm"
58     ARCH_CFLAGS="-D__ARM__"
59     ;;
60
61 hppa2.0 )
62     ARCH_DIR="parisc"
63     ARCH_CFLAGS="-D__PARISC__"
64     ;;
65
66 i386 | i486 | i586 | i686 )
67     ARCH_DIR="i386"
68     ARCH_CFLAGS="-D__I386__"
69     ;;
70
71 m68k )
72     ARCH_DIR="m68k"
73     ARCH_CFLAGS="-D__M68K__"
74     ;;
75
76 mips | mipsel )
77     ARCH_DIR="mips"
78     ARCH_CFLAGS="-D__MIPS__"
79     ;;
80
81 powerpc )
82     ARCH_DIR="powerpc"
83     ARCH_CFLAGS="-D__POWERPC__"
84     ;;
85
86 powerpc64 )
87     ARCH_DIR="powerpc64"
88     ARCH_CFLAGS="-D__POWERPC64__"
89     ;;
90
91 s390 )
92     ARCH_DIR="s390"
93     ARCH_CFLAGS="-D__S390__"
94     ;;
95
96 sparc | sparc64 )
97     ARCH_DIR="sparc64"
98     ARCH_CFLAGS="-mcpu=v9 -m64 -D__SPARC_64__"
99     ;;
100
101 x86_64 )
102     ARCH_DIR="x86_64"
103     ARCH_CFLAGS="-D__X86_64__"
104     ;;
105
106 xdspcore )
107     ARCH_DIR="xdspcore"
108     ENABLE_STATICVM="yes"
109     ARCH_CFLAGS="-D__XDSPCORE__"
110     USE_SCHEDULER="1"
111     ;;
112
113 * )
114     AC_MSG_ERROR($host_cpu systems are not supported at this time)
115     ;;
116 esac
117
118 dnl host type
119 case "$host_os" in
120 *cygwin* )
121     OS_DIR="cygwin"
122     INTRP_CFLAGS="$ARCH_CFLAGS -D__WINDOWS__ -D__CYGWIN__ -Wall -Wno-long-long"
123     ARCH_CFLAGS="$ARCH_CFLAGS -D__WINDOWS__ -D__CYGWIN__ -ansi -pedantic -Wall -Wno-long-long"
124     ;;
125
126 *darwin* )
127     OS_DIR="darwin"
128     INTRP_CFLAGS="$ARCH_CFLAGS -D__DARWIN__ -Wall -Wno-long-long"
129     ARCH_CFLAGS="$ARCH_CFLAGS -D__DARWIN__ -ansi -pedantic -Wall -Wno-long-long"
130     ;;
131
132 *freebsd* )
133     OS_DIR="freebsd"
134     INTRP_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
135     ARCH_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
136     ;;
137
138 *irix* )
139     OS_DIR="irix"
140     INTRP_CFLAGS="$ARCH_CFLAGS -D__IRIX__"
141     ARCH_CFLAGS="$ARCH_CFLAGS -D__IRIX__"
142     ;;
143
144 *kfreebsd*-gnu)
145     OS_DIR="freebsd"
146     INTRP_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
147     ARCH_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
148     ;;
149
150 dnl must be before *linux*
151 *uclinux | *elf )
152     OS_DIR="uclinux"
153     INTRP_CFLAGS="$ARCH_CFLAGS -D__LINUX__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
154     ARCH_CFLAGS="$ARCH_CFLAGS -D__LINUX__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
155     ;;
156
157 *linux* | *Linux* )
158     OS_DIR="linux"
159     INTRP_CFLAGS="$ARCH_CFLAGS -D__LINUX__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
160     ARCH_CFLAGS="$ARCH_CFLAGS -D__LINUX__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
161     ;;
162
163 *netbsd* )
164     OS_DIR="netbsd"
165     INTRP_CFLAGS="$ARCH_CFLAGS -D__NETBSD__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
166     ARCH_CFLAGS="$ARCH_CFLAGS -D__NETBSD__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
167     ;;
168
169 *solaris* )
170     OS_DIR="solaris"
171         dnl on solaris the architecture defines 'sparc','sun','unix' are not set when cpp is called with -ansi
172         dnl therefore we add them here
173     INTRP_CFLAGS="$ARCH_CFLAGS -D__SOLARIS__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -D_BSD_SOURCE -Dsparc -Dsun -Dunix"
174     ARCH_CFLAGS="$ARCH_CFLAGS -D__SOLARIS__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -D_BSD_SOURCE -Dsparc -Dsun -Dunix"
175     ;;
176
177 * )
178     ;;
179 esac
180
181
182 dnl temporary set the CFLAGS for configure tests (e.g. inline keyword)
183 dnl we set it properly at the end of this file
184 CFLAGS="$ARCH_CFLAGS $OPT_CFLAGS"
185
186 dnl set interpreter flags
187 AC_SUBST(INTRP_CFLAGS)
188
189 dnl define some stuff required for --fullversion
190 AC_DEFINE_UNQUOTED(VERSION_CONFIGURE_ARGS, "$ac_configure_args", [configure arguments])
191 AC_DEFINE_UNQUOTED(VERSION_CC, "$CC", [CC used])
192 AC_DEFINE_UNQUOTED(VERSION_CFLAGS, "$OPT_CFLAGS $ARCH_CFLAGS", [CFLAGS used])
193
194
195 dnl define and substitute some architecture specific variables
196 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [architecture directory])
197 AC_SUBST(ARCH_DIR)
198 AC_SUBST(OS_DIR)
199 AC_SUBST(USE_SCHEDULER)
200
201
202 dnl Checks for programs.
203 AC_PROG_CC
204 AM_PROG_AS
205 AC_PROG_LD
206 AC_PROG_LD_GNU
207 AC_PROG_RANLIB
208 AC_PROG_LN_S
209 AC_PROG_MAKE_SET
210 AM_PROG_MKDIR_P
211
212 dnl Checks for header files.
213 AC_HEADER_DIRENT
214 AC_HEADER_STDC
215 AC_CHECK_HEADERS([fcntl.h])
216 AC_CHECK_HEADERS([sys/time.h])
217 AC_CHECK_HEADERS([unistd.h])
218 AC_CHECK_HEADERS([sys/ioctl.h])
219
220 dnl this is for fdlibm
221 AC_CHECK_HEADERS([stdint.h])
222 AC_CHECK_HEADERS([inttypes.h])
223 AC_CHECK_HEADERS([sys/config.h])
224 AC_CHECK_HEADERS([sys/types.h])
225 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
226 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
227 AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
228 AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
229
230 dnl Checks for typedefs, structures, and compiler characteristics.
231 AC_C_CONST
232 AC_C_INLINE
233 AC_C_ATTRIBUTE
234 AC_TYPE_OFF_T
235 AC_TYPE_SIZE_T
236 AC_HEADER_TIME
237 AC_STRUCT_TM
238
239 dnl Checks for library functions.
240 AC_PROG_GCC_TRADITIONAL
241 AC_TYPE_SIGNAL
242 AC_FUNC_MEMCMP
243 AC_FUNC_MMAP
244 AC_CHECK_FUNCS([calloc mmap getpagesize free])
245 AC_CHECK_FUNCS([getcwd gettimeofday])
246 AC_CHECK_FUNCS([scandir])
247 AC_CHECK_FUNCS([isnan])
248
249 dnl Checks for libraries.
250
251 dnl Checking sizeof void *
252 AC_CHECK_SIZEOF(void *)
253 AC_C_BIGENDIAN
254
255
256 dnl define install prefix
257 if test "x$prefix" = "xNONE"; then
258     CACAO_PREFIX=$ac_default_prefix
259 else
260     CACAO_PREFIX=$prefix
261 fi
262 AC_DEFINE_UNQUOTED([CACAO_PREFIX], "${CACAO_PREFIX}", [installation prefix])
263 AC_SUBST(CACAO_PREFIX)
264
265 dnl define libdir prefix
266 if test "x$libdir" = "xNONE"; then
267     CACAO_LIBDIR=$ac_default_libdir
268 else
269     CACAO_LIBDIR=$libdir
270 fi
271 dnl expand CACAO_LIBDIR to something that is usable in C code
272 AS_AC_EXPAND([CACAO_LIBDIR], ${CACAO_LIBDIR})
273 AC_DEFINE_UNQUOTED([CACAO_LIBDIR], "${CACAO_LIBDIR}", [library installation prefix])
274 AC_SUBST(CACAO_LIBDIR)
275
276
277 dnl Features
278
279 AC_CHECK_ENABLE_JAVA
280 AC_CHECK_ENABLE_JIT
281
282 dnl with-options
283 AC_CHECK_WITH_CACAOH
284
285 dnl check for stuff that should be done in software
286 AC_CHECK_SOFTFLOAT
287 AC_CHECK_SOFT_FLOAT_CMP
288 AC_CHECK_SOFT_DOUBLE_CMP
289
290
291 dnl check for interpreter
292 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
293
294 AC_MSG_CHECKING(whether interpreter should be compiled)
295 if test x"$enable_intrp" = "xyes"; then
296     AC_MSG_RESULT(yes)
297     AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
298     AM_CONDITIONAL([ENABLE_INTRP], [true])
299     ENABLE_INTRP=yes
300
301     AC_ASM_SKIP16
302
303     dnl check for libffi
304     AC_ARG_WITH([ffi],
305                 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
306                 [WITH_FFI=yes
307                  AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
308                  AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
309                  AC_DEFINE([WITH_FFI], 1, [use libffi])],
310                 [WITH_FFI=no])
311
312     dnl check for libffcall
313     AC_ARG_WITH([ffcall],
314                 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
315                 [WITH_FFCALL=yes
316                  AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
317                  AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
318                  AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
319                 [WITH_FFCALL=no])
320
321     dnl check for libffi or libffcall
322     if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
323         AC_ERROR(Enable only libffi or libffcall.)
324     fi
325     if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
326         AC_ERROR(Enable one of libffi or libffcall.)
327     fi
328
329 else
330     AC_MSG_RESULT(no)
331     AM_CONDITIONAL([ENABLE_INTRP], [false])
332     ENABLE_INTRP="no"
333 fi
334
335 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
336     AC_ERROR(You have to enable at least the JIT or the interpreter.)
337 fi
338
339
340 dnl check for garbage collector usage
341 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--enable-gc,enable garbage collector support (none,boehm,cacao) [[default=boehm]])])
342 AC_MSG_CHECKING(whether GC should be enabled)
343 enable_gc=${enable_gc:-boehm}
344 case "$enable_gc" in
345 no | none)
346     AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
347     ENABLE_GC=none
348     AC_MSG_RESULT(no)
349     ;;
350
351 boehm)
352     AC_DEFINE([ENABLE_GC_BOEHM], 1, [enable conservative boehm-gc])
353     ENABLE_GC=boehm
354     AC_MSG_RESULT(yes, boehm-gc)
355     ;;
356
357 cacao)
358     AC_DEFINE([ENABLE_GC_CACAO], 1, [enable exact cacao-gc])
359     ENABLE_GC=cacao
360     AC_MSG_RESULT(yes, cacao-gc)
361     ;;
362
363 *)
364     AC_MSG_ERROR($enable_gc is an unknown garbage collector package)
365     ;;
366 esac
367 AM_CONDITIONAL([DISABLE_GC], test x"${ENABLE_GC}" = "xnone")
368 AM_CONDITIONAL([ENABLE_GC_BOEHM], test x"${ENABLE_GC}" = "xboehm")
369 AM_CONDITIONAL([ENABLE_GC_CACAO], test x"${ENABLE_GC}" = "xcacao")
370
371
372
373 dnl check for dump memory usage
374 AC_MSG_CHECKING(whether dump memory should be disabled)
375 AC_ARG_ENABLE([dump],
376               [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])],
377               [case "${enableval}" in
378                    no)
379                        DISABLE_DUMP=yes
380                        AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
381                        ;;
382                    *) DISABLE_DUMP=no;;
383                esac],
384                [DISABLE_DUMP=no])
385 AC_MSG_RESULT(${DISABLE_DUMP})
386
387
388 dnl check for debug
389 AC_MSG_CHECKING(whether debug code generation should be enabled)
390 AC_ARG_ENABLE([debug],
391               [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=yes]])],
392               [case "${enableval}" in
393                    no) NDEBUG=yes
394                        AC_DEFINE([NDEBUG], 1, [disable debug code])
395                        ;;
396                    *) NDEBUG=no;;
397                esac],
398               [NDEBUG=no])
399
400 if test x"${NDEBUG}" = "xno"; then
401     AC_MSG_RESULT(yes)
402 else
403     AC_MSG_RESULT(no)
404 fi
405 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xyes")
406
407
408 dnl check for memcheck support
409 AC_MSG_CHECKING(whether debugging memory checks should be enabled)
410 AC_ARG_ENABLE([memcheck],
411               [AS_HELP_STRING(--enable-memcheck,enable debugging memory checks [[default=no]])],
412               [case "${enableval}" in
413                    yes) ENABLE_MEMCHECK=yes;;
414                    *) ENABLE_MEMCHECK=no;;
415                esac],
416               [ENABLE_MEMCHECK=no])
417 AC_MSG_RESULT(${ENABLE_MEMCHECK})
418 AM_CONDITIONAL([ENABLE_MEMCHECK], test x"${ENABLE_MEMCHECK}" = "xyes")
419
420 if test x"${ENABLE_MEMCHECK}" = "xyes"; then
421     AC_DEFINE([ENABLE_MEMCHECK], 1, [perform debugging memory checks])
422 fi
423
424
425 dnl check for vmlog support
426 AC_MSG_CHECKING(whether vmlog tracing should be enabled)
427 AC_ARG_ENABLE([vmlog],
428               [AS_HELP_STRING(--enable-vmlog,enable vmlog tracing [[default=no]])],
429               [case "${enableval}" in
430                    yes) ENABLE_VMLOG=yes;;
431                    *) ENABLE_VMLOG=no;;
432                esac],
433               [ENABLE_VMLOG=no])
434 AC_MSG_RESULT(${ENABLE_VMLOG})
435 AM_CONDITIONAL([ENABLE_VMLOG], test x"${ENABLE_VMLOG}" = "xyes")
436
437 if test x"${ENABLE_VMLOG}" = "xyes"; then
438     AC_DEFINE([ENABLE_VMLOG], 1, [enable vmlog tracing code])
439 fi
440
441
442 dnl check for disassembler support
443 AC_MSG_CHECKING(whether disassembler should be enabled)
444 AC_ARG_ENABLE([disassembler],
445               [AS_HELP_STRING(--enable-disassembler,enable disassembler [[default=no]])],
446               [case "${enableval}" in
447                    yes) ENABLE_DISASSEMBLER=yes;;
448                    *) ENABLE_DISASSEMBLER=no;;
449                esac],
450               [ENABLE_DISASSEMBLER=no])
451 AC_MSG_RESULT(${ENABLE_DISASSEMBLER})
452 AM_CONDITIONAL([ENABLE_DISASSEMBLER], test x"${ENABLE_DISASSEMBLER}" = "xyes")
453
454 if test x"${ENABLE_DISASSEMBLER}" = "xyes"; then
455     AC_DEFINE([ENABLE_DISASSEMBLER], 1, [enable disassembler])
456
457     dnl check for binutils headers and libraries on some architectures for the
458     dnl disassembler
459     case "${ARCH_DIR}" in
460         arm | i386 | powerpc | x86_64 | sparc64 | powerpc64 | s390 | m68k)
461             AC_CHECK_HEADER([ansidecl.h],, [AC_MSG_ERROR(cannot find ansidecl.h)])
462             AC_CHECK_HEADER([symcat.h],, [AC_MSG_ERROR(cannot find symcat.h)])
463             AC_CHECK_HEADER([bfd.h],, [AC_MSG_ERROR(cannot find bfd.h)])
464             AC_CHECK_HEADER([dis-asm.h],, [AC_MSG_ERROR(cannot find dis-asm.h)])
465
466             case "${OS_DIR}" in
467                 cygwin | darwin | netbsd | solaris)
468                      AC_CHECK_LIB(intl, dcgettext,, [AC_MSG_ERROR(cannot find libintl (from binutils))])
469                      ;;
470             esac
471
472             AC_CHECK_LIB(iberty, xstrerror,, [AC_MSG_ERROR(cannot find libiberty (from binutils))])
473             AC_CHECK_LIB(bfd, bfd_get_arch,, [AC_MSG_ERROR(cannot find libbfd (from binutils))])
474             AC_CHECK_LIB(opcodes, disassembler,, [AC_MSG_ERROR(cannot find libopcodes (from binutils))])
475             AC_DEFINE([WITH_BINUTILS_DISASSEMBLER], 1, [use binutils disassembler])
476             AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [true])
477             ;;
478         * )
479             AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
480             ;;
481     esac
482 else
483     AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
484 fi
485
486
487 dnl check for statistics
488 AC_MSG_CHECKING(whether statistics generation should be enabled)
489 AC_ARG_ENABLE([statistics],
490               [AS_HELP_STRING(--enable-statistics,enable statistics generation [[default=no]])],
491               [case "${enableval}" in
492                    yes) ENABLE_STATISTICS=yes;;
493                    *) ENABLE_STATISTICS=no;;
494                esac],
495               [ENABLE_STATISTICS=no])
496 AC_MSG_RESULT(${ENABLE_STATISTICS})
497 AM_CONDITIONAL([ENABLE_STATISTICS], test x"${ENABLE_STATISTICS}" = "xyes")
498
499 if test x"${ENABLE_STATISTICS}" = "xyes"; then
500     AC_DEFINE([ENABLE_STATISTICS], 1, [enable statistics])
501 fi
502
503
504 dnl check for verifier
505 AC_MSG_CHECKING(whether classfile verification should be enabled)
506 AC_ARG_ENABLE([verifier],
507               [AS_HELP_STRING(--disable-verifier,disable classfile verification [[default=yes]])],
508               [case "${enableval}" in
509                    no) ENABLE_VERIFIER=no;;
510                    *) ENABLE_VERIFIER=yes;;
511                esac],
512               [ENABLE_VERIFIER=yes])
513 AC_MSG_RESULT(${ENABLE_VERIFIER})
514 AM_CONDITIONAL([ENABLE_VERIFIER], test x"${ENABLE_VERIFIER}" = "xyes")
515
516 if test x"${ENABLE_VERIFIER}" = "xyes"; then
517     AC_DEFINE([ENABLE_VERIFIER], 1, [enable classfile verification])
518 fi
519
520
521 dnl check for compiler timing
522 AC_MSG_CHECKING(whether real-time timing should be enabled)
523 AC_ARG_ENABLE([rt-timing],
524               [AS_HELP_STRING(--enable-rt-timing,enable real-time timing [[default=no]])],
525               [case "${enableval}" in
526                    yes) ENABLE_RT_TIMING=yes;;
527                    *) ENABLE_RT_TIMING=no;;
528                esac],
529               [ENABLE_RT_TIMING=no])
530 AC_MSG_RESULT(${ENABLE_RT_TIMING})
531 AM_CONDITIONAL([ENABLE_RT_TIMING], test x"${ENABLE_RT_TIMING}" = "xyes")
532
533 if test x"${ENABLE_RT_TIMING}" = "xyes"; then
534     AC_DEFINE([ENABLE_RT_TIMING], 1, [enable real-time timing])
535 fi
536
537
538 dnl check for cycle count statistics
539 AC_MSG_CHECKING(whether cycle count statistics should be enabled)
540 AC_ARG_ENABLE([cycles-stats],
541               [AS_HELP_STRING(--enable-cycles-stats,enable cycle count statistics [[default=no]])],
542               [case "${enableval}" in
543                    yes) ENABLE_CYCLES_STATS=yes;;
544                    *) ENABLE_CYCLES_STATS=no;;
545                esac],
546               [ENABLE_CYCLES_STATS=no])
547 AC_MSG_RESULT(${ENABLE_CYCLES_STATS})
548 AM_CONDITIONAL([ENABLE_CYCLES_STATS], test x"${ENABLE_CYCLES_STATS}" = "xyes")
549
550 if test x"${ENABLE_CYCLES_STATS}" = "xyes"; then
551     AC_DEFINE([ENABLE_CYCLES_STATS], 1, [enable cycle count statistics])
552 fi
553
554
555 dnl check for JVMTI
556 AC_MSG_CHECKING(whether to compile JVMTI support)
557 AC_ARG_ENABLE([jvmti],
558               [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])],
559               [case "${enableval}" in
560                    yes) ENABLE_JVMTI=yes;;
561                    *) ENABLE_JVMTI=no;;
562                esac],
563               [ENABLE_JVMTI=no])
564 AC_MSG_RESULT(${ENABLE_JVMTI})
565 AM_CONDITIONAL([ENABLE_JVMTI], test x"${ENABLE_JVMTI}" = "xyes")
566
567 if test x"${ENABLE_JVMTI}" = "xyes"; then
568     AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
569 fi
570
571
572 AC_CHECK_ENABLE_THREADS
573
574
575 dnl check if if-conversion should be supported
576 AC_MSG_CHECKING(whether if-conversion should be supported)
577 AC_ARG_ENABLE([ifconv],
578               [AS_HELP_STRING(--disable-ifconv,disable if-conversion [[default=yes]])],
579               [case "${enableval}" in
580                    no) ENABLE_IFCONV=no;;
581                    *) ENABLE_IFCONV=yes;;
582                esac],
583               [ENABLE_IFCONV=yes])
584 AC_MSG_RESULT(${ENABLE_IFCONV})
585 AM_CONDITIONAL([ENABLE_IFCONV], test x"${ENABLE_IFCONV}" = "xyes")
586    
587 if test x"${ENABLE_IFCONV}" = "xyes"; then
588     AC_DEFINE([ENABLE_IFCONV], 1, [enable if-conversion])
589 fi
590
591
592 dnl check for inlining
593 AC_MSG_CHECKING(whether method inlining should be supported)
594 AC_ARG_ENABLE([inlining],
595               [AS_HELP_STRING(--enable-inlining,enable method inlining [[default=no]])],
596               [case "${enableval}" in
597                    yes) ENABLE_INLINING=yes;;
598                    *) ENABLE_INLINING=no;;
599                esac],
600               [ENABLE_INLINING=no])
601 AC_MSG_RESULT(${ENABLE_INLINING})
602 AM_CONDITIONAL([ENABLE_INLINING], test x"${ENABLE_INLINING}" = "xyes")
603
604 if test x"${ENABLE_INLINING}" = "xyes"; then
605     AC_DEFINE([ENABLE_INLINING], 1, [use method inlining])
606 fi
607
608
609 dnl check for inlining debug options
610 AC_MSG_CHECKING(whether method inlining debug options should be enabled)
611 AC_ARG_ENABLE([inlining-debug],
612               [AS_HELP_STRING(--enable-inlining-debug,enable method inlining debug options [[default=no]])],
613               [case "${enableval}" in
614                    yes) ENABLE_INLINING_DEBUG=yes;;
615                    *) ENABLE_INLINING_DEBUG=no;;
616                esac],
617               [ENABLE_INLINING_DEBUG=no])
618 AC_MSG_RESULT(${ENABLE_INLINING_DEBUG})
619 AM_CONDITIONAL([ENABLE_INLINING_DEBUG], test x"${ENABLE_INLINING_DEBUG}" = "xyes")
620
621 if test x"${ENABLE_INLINING_DEBUG}" = "xyes"; then
622     AC_DEFINE([ENABLE_INLINING_DEBUG], 1, [enable method inlining debug options])
623 fi
624
625
626 dnl check for replacement
627 AC_MSG_CHECKING(whether on-stack replacement should be supported)
628 AC_ARG_ENABLE([replacement],
629               [AS_HELP_STRING(--enable-replacement,enable on-stack replacement [[default=no]])],
630               [case "${enableval}" in
631                    yes) ENABLE_REPLACEMENT=yes;;
632                    *) ENABLE_REPLACEMENT=no;;
633                esac],
634               [ENABLE_REPLACEMENT=no])
635 AC_MSG_RESULT(${ENABLE_REPLACEMENT})
636 AM_CONDITIONAL([ENABLE_REPLACEMENT], test x"${ENABLE_REPLACEMENT}" = "xyes")
637
638 if test x"${ENABLE_REPLACEMENT}" = "xyes"; then
639     AC_DEFINE([ENABLE_REPLACEMENT], 1, [use on-stack replacement])
640 fi
641
642
643 dnl check for loop optimization
644 AC_MSG_CHECKING(whether loop optimization should be supported)
645 AC_ARG_ENABLE([loop],
646               [AS_HELP_STRING(--enable-loop,enable loop optimization [[default=no]])],
647               [case "${enableval}" in
648                    yes) ENABLE_LOOP=yes;;
649                    *) ENABLE_LOOP=no;;
650                esac],
651               [ENABLE_LOOP=no])
652 AC_MSG_RESULT(${ENABLE_LOOP})
653 AM_CONDITIONAL([ENABLE_LOOP], test x"${ENABLE_LOOP}" = "xyes")
654
655 if test x"${ENABLE_LOOP}" = "xyes"; then
656     AC_DEFINE([ENABLE_LOOP], 1, [use loop optimization])
657 fi
658
659
660 dnl check if linear scan register allocator(lsra) with SSA should be used
661 AC_MSG_CHECKING(whether lsra with ssa should be supported)
662 AC_ARG_ENABLE([ssa],
663               [AS_HELP_STRING(--disable-ssa,disable ssa [[default=no]])],
664               [case "${enableval}" in
665                    no) ENABLE_SSA=no;;
666                    *) ENABLE_SSA=yes;;
667                esac],
668               [ENABLE_SSA=no])
669 AC_MSG_RESULT(${ENABLE_SSA})
670 AM_CONDITIONAL([ENABLE_SSA], test x"${ENABLE_SSA}" = "xyes")
671
672 if test x"${ENABLE_SSA}" = "xyes"; then
673     AC_DEFINE([ENABLE_SSA], 1, [enable lsra with ssa])
674     ENABLE_LSRA="no"
675 fi
676
677
678 dnl check if linear scan register allocator(lsra) should be used
679 AC_MSG_CHECKING(whether lsra should be supported)
680 AC_ARG_ENABLE([lsra],
681               [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=no]])],
682               [case "${enableval}" in
683                    yes) ENABLE_LSRA=yes;;
684                    *) ENABLE_LSRA=no;;
685                esac],
686               [ENABLE_LSRA=no])
687    
688 if test x"${ENABLE_LSRA}" = "xyes"; then
689     if test x"${ENABLE_SSA}" = "xyes"; then
690         ENABLE_LSRA="no"
691     fi
692 fi
693 AC_MSG_RESULT(${ENABLE_LSRA})
694 AM_CONDITIONAL([ENABLE_LSRA], test x"${ENABLE_LSRA}" = "xyes")
695  
696 if test x"${ENABLE_LSRA}" = "xyes"; then
697     AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
698 fi
699
700
701 dnl check if profiling should be supported
702 AC_MSG_CHECKING(whether profiling should be supported)
703 AC_ARG_ENABLE([profiling],
704               [AS_HELP_STRING(--enable-profiling,enable profiling [[default=no]])],
705               [case "${enableval}" in
706                    yes) ENABLE_PROFILING=yes;;
707                    *) ENABLE_PROFILING=no;;
708                esac],
709               [ENABLE_PROFILING=no])
710 AC_MSG_RESULT(${ENABLE_PROFILING})
711 AM_CONDITIONAL([ENABLE_PROFILING], test x"${ENABLE_PROFILING}" = "xyes")
712    
713 if test x"${ENABLE_PROFILING}" = "xyes"; then
714     AC_DEFINE([ENABLE_PROFILING], 1, [enable profiling])
715 fi
716
717
718 dnl check for instruction scheduler
719 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
720
721 AC_MSG_CHECKING(whether instruction scheduler should be supported)
722 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
723         case "${ARCH_DIR}" in
724                 xdspcore )
725                         ;;
726                 * )
727                         AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
728                         ;;
729         esac
730
731         AC_MSG_RESULT(yes)
732         AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
733         AM_CONDITIONAL([USE_SCHEDULER], [true])
734 else
735         AC_MSG_RESULT(no)
736         AM_CONDITIONAL([USE_SCHEDULER], [false])
737 fi
738
739
740 dnl check if zlib should be used
741 AC_MSG_CHECKING(whether ZIP/JAR archives should be supported)
742 AC_ARG_ENABLE([zlib],
743               [AS_HELP_STRING(--disable-zlib,disable ZIP/JAR archive support (needs zlib) [[default=yes]])],
744               [case "${enableval}" in
745                   no) ENABLE_ZLIB=no;;
746                   *) ENABLE_ZLIB=yes;;
747                esac],
748               [ENABLE_ZLIB=yes])
749 AC_MSG_RESULT(${ENABLE_ZLIB})
750
751 if test x"${ENABLE_ZLIB}" = "xyes"; then
752     AC_CHECK_HEADERS([zconf.h],, [AC_MSG_ERROR(cannot find zconf.h)])
753     AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
754     AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
755     AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
756 fi
757 AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
758
759
760 dnl check for stuff to be built
761 AC_CHECK_ENABLE_JNI
762
763
764 dnl check if a libjvm.so should be built
765 AC_MSG_CHECKING(whether to build a libjvm.so)
766 AC_ARG_ENABLE([libjvm],
767               [AS_HELP_STRING(--disable-libjvm,build a libjvm.so [[default=yes]])],
768               [case "${enableval}" in
769                   no) ENABLE_LIBJVM=no;;
770                   *) ENABLE_LIBJVM=yes;;
771                esac],
772               [ENABLE_LIBJVM=yes])
773 AC_MSG_RESULT(${ENABLE_LIBJVM})
774 AM_CONDITIONAL([ENABLE_LIBJVM], test x"${ENABLE_LIBJVM}" = "xyes")
775 AC_SUBST(ENABLE_LIBJVM)
776
777 if test x"${ENABLE_LIBJVM}" = "xyes"; then
778     AC_DEFINE([ENABLE_LIBJVM], 1, [enable libjvm.so])
779
780     dnl set AC_ENABLE_SHARED and AC_DISABLE_STATIC properly
781     enable_shared=yes
782     enable_static=no
783 else
784     enable_shared=no
785     enable_static=yes
786 fi
787
788 dnl libtool stuff
789 AC_LIBTOOL_DLOPEN
790 AC_PROG_LIBTOOL
791
792
793 dnl check if CACAO should be linked statically
794 AC_MSG_CHECKING(whether to link CACAO statically)
795 AC_ARG_ENABLE([staticvm],
796               [AS_HELP_STRING(--enable-staticvm,link CACAO statically [[default=no]])],
797               [case "${enableval}" in
798                   yes) ENABLE_STATICVM=yes
799                        AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
800                        ;;
801                   *) ENABLE_STATICVM=no;;
802                esac],
803               [ENABLE_STATICVM=no])
804 AC_MSG_RESULT(${ENABLE_STATICVM})
805 AM_CONDITIONAL([ENABLE_STATICVM], test x"${ENABLE_STATICVM}" = "xyes")
806 AC_SUBST(ENABLE_STATICVM)
807
808
809 dnl where is CACAO's vm.zip
810 AC_MSG_CHECKING(where CACAO's vm.zip is installed)
811 AC_ARG_WITH([vm-zip],
812             [AS_HELP_STRING(--with-vm-zip=<path>,path to CACAO's vm.zip (includes the name of the file and may be flat) [[default=/usr/local/cacao/share/cacao/vm.zip]])],
813             [CACAO_VM_ZIP=${withval}],
814             [CACAO_VM_ZIP=${CACAO_PREFIX}/share/cacao/vm.zip])
815 AC_MSG_RESULT(${CACAO_VM_ZIP})
816 AC_DEFINE_UNQUOTED([CACAO_VM_ZIP], "${CACAO_VM_ZIP}", [CACAO's vm.zip])
817 AC_SUBST(CACAO_VM_ZIP)
818
819
820 AC_CHECK_WITH_CLASSPATH
821 AC_CHECK_WITH_CLASSPATH_PREFIX
822 AC_CHECK_WITH_CLASSPATH_CLASSES
823 AC_CHECK_WITH_CLASSPATH_LIBDIR
824 AC_CHECK_WITH_CLASSPATH_INCLUDEDIR
825
826
827 dnl if we compile for a JRE-style directory layout
828 AC_MSG_CHECKING(if we compile for a JRE-style directory layout)
829 AC_ARG_WITH([jre-layout],
830             [AS_HELP_STRING(--with-jre-layout,compile for JRE-style directory layout [[default=no]])],
831             [case "${enableval}" in
832                 yes) WITH_JRE_LAYOUT=yes
833                      AC_DEFINE([WITH_JRE_LAYOUT], 1, [with JRE layout])
834                      ;;
835                 *) WITH_JRE_LAYOUT=no;;
836              esac],
837             [WITH_JRE_LAYOUT=no])
838 AC_MSG_RESULT(${WITH_JRE_LAYOUT})
839
840
841 dnl check if GNU Classpath should be linked statically into CACAO
842 AC_MSG_CHECKING(whether to link GNU Classpath native libraries statically into CACAO)
843 AC_ARG_WITH([static-classpath],
844             [AS_HELP_STRING(--with-static-classpath,link GNU classpath native libraries statically into CACAO [[default=no]])],
845             [case "${enableval}" in
846                 yes) WITH_STATIC_CLASSPATH=yes;;
847                 *) WITH_STATIC_CLASSPATH=no;;
848              esac],
849             [WITH_STATIC_CLASSPATH=no])
850 AC_MSG_RESULT(${WITH_STATIC_CLASSPATH})
851
852 if test x"${WITH_STATIC_CLASSPATH}" = "xyes"; then
853     AC_DEFINE([WITH_STATIC_CLASSPATH], 1, [link GNU classpath native libraries statically into CACAO])
854
855     dnl check for some classpath related stuff when we link statically
856     AM_ICONV_LINK
857 else
858     dnl we need this check for --enable-staticvm, otherwise ltdl can't find dlopen
859     if test x"${ENABLE_STATICVM}" = "xyes"; then
860         AC_CHECK_LIB(dl, dlopen,, [AC_MSG_ERROR(cannot find libdl)])
861     fi
862
863     AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
864     AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
865 fi
866 AM_CONDITIONAL([WITH_STATIC_CLASSPATH], test x"${WITH_STATIC_CLASSPATH}" = "xyes")
867 AC_SUBST(WITH_STATIC_CLASSPATH)
868
869
870 dnl check for some programs we need
871 AC_PROG_JAVAC
872 AC_PROG_JAR
873
874
875 dnl finally pass CFLAGS to Makefiles via AM_CFLAGS
876 CFLAGS=$OPT_CFLAGS
877 AM_CFLAGS=$ARCH_CFLAGS
878 AC_SUBST(AM_CFLAGS)
879
880
881 AC_CONFIG_FILES([Makefile]
882                 [contrib/Makefile]
883                 [contrib/setenvinstalled]
884                 [contrib/setenvsource]
885                 [contrib/vmlog/Makefile]
886                 [contrib/vmlog/t/Makefile]
887                 [doc/Makefile]
888                 [doc/handbook/Makefile]
889                 [man/Makefile]
890                 [src/Makefile]
891                 [src/cacao/Makefile]
892                 [src/cacaoh/Makefile]
893                 [src/fdlibm/Makefile]
894                 [src/lib/Makefile]
895                 [src/mm/Makefile]
896                 [src/mm/cacao-gc/Makefile]
897                 [src/native/Makefile]
898                 [src/native/include/Makefile]
899                 [src/native/jvmti/Makefile]
900                 [src/native/tools/Makefile]
901                 [src/native/vm/Makefile]
902                 [src/native/vm/cldc1.1/Makefile]
903                 [src/native/vm/gnu/Makefile]
904                 [src/scripts/Makefile]
905                 [src/scripts/java]
906                 [src/threads/Makefile]
907                 [src/threads/native/Makefile]
908                 [src/threads/none/Makefile]
909                 [src/toolbox/Makefile]
910                 [src/vm/Makefile]
911                 [src/vm/jit/Makefile]
912                 [src/vm/jit/allocator/Makefile]
913                 [src/vm/jit/alpha/Makefile]
914                 [src/vm/jit/alpha/freebsd/Makefile]
915                 [src/vm/jit/alpha/linux/Makefile]
916                 [src/vm/jit/arm/Makefile]
917                 [src/vm/jit/arm/linux/Makefile]
918                 [src/vm/jit/i386/Makefile]
919                 [src/vm/jit/i386/cygwin/Makefile]
920                 [src/vm/jit/i386/darwin/Makefile]
921                 [src/vm/jit/i386/freebsd/Makefile]
922                 [src/vm/jit/i386/linux/Makefile]
923                 [src/vm/jit/intrp/Makefile]
924                 [src/vm/jit/inline/Makefile]
925                 [src/vm/jit/loop/Makefile]
926                 [src/vm/jit/m68k/Makefile]
927                 [src/vm/jit/m68k/linux/Makefile]
928                 [src/vm/jit/mips/Makefile]
929                 [src/vm/jit/mips/irix/Makefile]
930                 [src/vm/jit/mips/linux/Makefile]
931                 [src/vm/jit/optimizing/Makefile]
932                 [src/vm/jit/parisc/Makefile]
933                 [src/vm/jit/parisc/linux/Makefile]
934                 [src/vm/jit/powerpc/Makefile]
935                 [src/vm/jit/powerpc/darwin/Makefile]
936                 [src/vm/jit/powerpc/linux/Makefile]
937                 [src/vm/jit/powerpc/netbsd/Makefile]
938                 [src/vm/jit/powerpc64/Makefile]
939                 [src/vm/jit/powerpc64/linux/Makefile]
940                 [src/vm/jit/s390/Makefile]
941                 [src/vm/jit/schedule/Makefile]
942                 [src/vm/jit/sparc64/Makefile]
943                 [src/vm/jit/sparc64/linux/Makefile]
944                 [src/vm/jit/sparc64/solaris/Makefile]
945                 [src/vm/jit/tools/Makefile]
946                 [src/vm/jit/verify/Makefile]
947                 [src/vm/jit/x86_64/Makefile]
948                 [src/vm/jit/x86_64/freebsd/Makefile]
949                 [src/vm/jit/x86_64/linux/Makefile]
950                 [src/vmcore/Makefile]
951                 [tests/Makefile]
952                 [tests/regression/Makefile]
953                 [tests/regression/codepatching/Makefile]
954                 [tests/regression/jasmin/Makefile]
955                 [tests/regression/native/Makefile]
956                 [tests/regression/resolving/Makefile]
957                 [tests/regression/resolving/classes1/Makefile]
958                 [tests/regression/resolving/classes2/Makefile]
959                 [tests/regression/resolving/classes3/Makefile]
960                 )
961
962
963 dnl now configure subpackages with OPT_CFLAGS and ARCH_CFLAGS
964 export OPT_CFLAGS
965 export ARCH_CFLAGS
966 AC_CONFIG_SUBDIRS(src/mm/boehm-gc)
967
968
969 AC_OUTPUT
970
971
972 ## Local variables:
973 ## mode: m4
974 ## indent-tabs-mode: t
975 ## c-basic-offset: 4
976 ## tab-width: 8
977 ## compile-command: "automake --add-missing"
978 ## End: