Merged revisions 7797-7917 via svnmerge from
[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 7902 2007-05-11 22:33:15Z 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
216 dnl keep them alpha-sorted!
217 AC_CHECK_HEADERS([fcntl.h])
218 AC_CHECK_HEADERS([string.h])
219 AC_CHECK_HEADERS([time.h])
220 AC_CHECK_HEADERS([unistd.h])
221 AC_CHECK_HEADERS([sys/ioctl.h])
222 AC_CHECK_HEADERS([sys/mman.h])
223 AC_CHECK_HEADERS([sys/resource.h])
224 AC_CHECK_HEADERS([sys/time.h])
225
226 dnl this is for fdlibm
227 AC_CHECK_HEADERS([stdint.h])
228 AC_CHECK_HEADERS([inttypes.h])
229 AC_CHECK_HEADERS([sys/config.h])
230 AC_CHECK_HEADERS([sys/types.h])
231 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
232 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
233 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]))
234 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]))
235
236 dnl Checks for typedefs, structures, and compiler characteristics.
237 AC_C_CONST
238 AC_C_INLINE
239 AC_C_ATTRIBUTE
240 AC_TYPE_OFF_T
241 AC_TYPE_SIZE_T
242 AC_HEADER_TIME
243 AC_STRUCT_TM
244
245 dnl Checks for library functions.
246 AC_PROG_GCC_TRADITIONAL
247 AC_TYPE_SIGNAL
248 AC_FUNC_MEMCMP
249 AC_FUNC_MMAP
250
251 dnl keep them alpha-sorted!
252 AC_CHECK_FUNCS([calloc])
253 AC_CHECK_FUNCS([getpagesize])
254 AC_CHECK_FUNCS([free])
255 AC_CHECK_FUNCS([getcwd])
256 AC_CHECK_FUNCS([gettimeofday])
257 AC_CHECK_FUNCS([getrusage])
258 AC_CHECK_FUNCS([isnan])
259 AC_CHECK_FUNCS([localtime])
260 AC_CHECK_FUNCS([localtime_r])
261 AC_CHECK_FUNCS([mmap])
262 AC_CHECK_FUNCS([mprotect])
263 AC_CHECK_FUNCS([scandir])
264 AC_CHECK_FUNCS([strdup])
265 AC_CHECK_FUNCS([time])
266
267
268 dnl Checks for libraries.
269
270 dnl Checking sizeof void *
271 AC_CHECK_SIZEOF(void *)
272 AC_C_BIGENDIAN
273
274
275 dnl define install prefix
276 if test "x$prefix" = "xNONE"; then
277     CACAO_PREFIX=$ac_default_prefix
278 else
279     CACAO_PREFIX=$prefix
280 fi
281 AC_DEFINE_UNQUOTED([CACAO_PREFIX], "${CACAO_PREFIX}", [installation prefix])
282 AC_SUBST(CACAO_PREFIX)
283
284 dnl define libdir prefix
285 if test "x$libdir" = "xNONE"; then
286     CACAO_LIBDIR=$ac_default_libdir
287 else
288     CACAO_LIBDIR=$libdir
289 fi
290 dnl expand CACAO_LIBDIR to something that is usable in C code
291 AS_AC_EXPAND([CACAO_LIBDIR], ${CACAO_LIBDIR})
292 AC_DEFINE_UNQUOTED([CACAO_LIBDIR], "${CACAO_LIBDIR}", [library installation prefix])
293 AC_SUBST(CACAO_LIBDIR)
294
295
296 dnl Features
297
298 AC_CHECK_ENABLE_JAVA
299 AC_CHECK_ENABLE_JIT
300
301 dnl with-options
302 AC_CHECK_WITH_CACAOH
303
304 dnl check for stuff that should be done in software
305 AC_CHECK_SOFTFLOAT
306 AC_CHECK_SOFT_FLOAT_CMP
307 AC_CHECK_SOFT_DOUBLE_CMP
308
309
310 dnl check for interpreter
311 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
312
313 AC_MSG_CHECKING(whether interpreter should be compiled)
314 if test x"$enable_intrp" = "xyes"; then
315     AC_MSG_RESULT(yes)
316     AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
317     AM_CONDITIONAL([ENABLE_INTRP], [true])
318     ENABLE_INTRP=yes
319
320     AC_ASM_SKIP16
321
322     dnl check for libffi
323     AC_ARG_WITH([ffi],
324                 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
325                 [WITH_FFI=yes
326                  AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
327                  AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
328                  AC_DEFINE([WITH_FFI], 1, [use libffi])],
329                 [WITH_FFI=no])
330
331     dnl check for libffcall
332     AC_ARG_WITH([ffcall],
333                 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
334                 [WITH_FFCALL=yes
335                  AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
336                  AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
337                  AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
338                 [WITH_FFCALL=no])
339
340     dnl check for libffi or libffcall
341     if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
342         AC_ERROR(Enable only libffi or libffcall.)
343     fi
344     if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
345         AC_ERROR(Enable one of libffi or libffcall.)
346     fi
347
348 else
349     AC_MSG_RESULT(no)
350     AM_CONDITIONAL([ENABLE_INTRP], [false])
351     ENABLE_INTRP="no"
352 fi
353
354 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
355     AC_ERROR(You have to enable at least the JIT or the interpreter.)
356 fi
357
358
359 dnl check for garbage collector usage
360 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--enable-gc,enable garbage collector support (none,boehm,cacao) [[default=boehm]])])
361 AC_MSG_CHECKING(whether GC should be enabled)
362 enable_gc=${enable_gc:-boehm}
363 case "$enable_gc" in
364 no | none)
365     AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
366     ENABLE_GC=none
367     AC_MSG_RESULT(no)
368     ;;
369
370 boehm)
371     AC_DEFINE([ENABLE_GC_BOEHM], 1, [enable conservative boehm-gc])
372     ENABLE_GC=boehm
373     AC_MSG_RESULT(yes, boehm-gc)
374     ;;
375
376 cacao)
377     AC_DEFINE([ENABLE_GC_CACAO], 1, [enable exact cacao-gc])
378     ENABLE_GC=cacao
379     AC_MSG_RESULT(yes, cacao-gc)
380     ;;
381
382 *)
383     AC_MSG_ERROR($enable_gc is an unknown garbage collector package)
384     ;;
385 esac
386 AM_CONDITIONAL([DISABLE_GC], test x"${ENABLE_GC}" = "xnone")
387 AM_CONDITIONAL([ENABLE_GC_BOEHM], test x"${ENABLE_GC}" = "xboehm")
388 AM_CONDITIONAL([ENABLE_GC_CACAO], test x"${ENABLE_GC}" = "xcacao")
389
390
391
392 dnl check for dump memory usage
393 AC_MSG_CHECKING(whether dump memory should be disabled)
394 AC_ARG_ENABLE([dump],
395               [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])],
396               [case "${enableval}" in
397                    no)
398                        DISABLE_DUMP=yes
399                        AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
400                        ;;
401                    *) DISABLE_DUMP=no;;
402                esac],
403                [DISABLE_DUMP=no])
404 AC_MSG_RESULT(${DISABLE_DUMP})
405
406
407 dnl check for debug
408 AC_MSG_CHECKING(whether debug code generation should be enabled)
409 AC_ARG_ENABLE([debug],
410               [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=yes]])],
411               [case "${enableval}" in
412                    no) NDEBUG=yes
413                        AC_DEFINE([NDEBUG], 1, [disable debug code])
414                        ;;
415                    *) NDEBUG=no;;
416                esac],
417               [NDEBUG=no])
418
419 if test x"${NDEBUG}" = "xno"; then
420     AC_MSG_RESULT(yes)
421 else
422     AC_MSG_RESULT(no)
423 fi
424 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xyes")
425
426
427 dnl check for memcheck support
428 AC_MSG_CHECKING(whether debugging memory checks should be enabled)
429 AC_ARG_ENABLE([memcheck],
430               [AS_HELP_STRING(--enable-memcheck,enable debugging memory checks [[default=no]])],
431               [case "${enableval}" in
432                    yes) ENABLE_MEMCHECK=yes;;
433                    *) ENABLE_MEMCHECK=no;;
434                esac],
435               [ENABLE_MEMCHECK=no])
436 AC_MSG_RESULT(${ENABLE_MEMCHECK})
437 AM_CONDITIONAL([ENABLE_MEMCHECK], test x"${ENABLE_MEMCHECK}" = "xyes")
438
439 if test x"${ENABLE_MEMCHECK}" = "xyes"; then
440     AC_DEFINE([ENABLE_MEMCHECK], 1, [perform debugging memory checks])
441 fi
442
443
444 dnl check for vmlog support
445 AC_MSG_CHECKING(whether vmlog tracing should be enabled)
446 AC_ARG_ENABLE([vmlog],
447               [AS_HELP_STRING(--enable-vmlog,enable vmlog tracing [[default=no]])],
448               [case "${enableval}" in
449                    yes) ENABLE_VMLOG=yes;;
450                    *) ENABLE_VMLOG=no;;
451                esac],
452               [ENABLE_VMLOG=no])
453 AC_MSG_RESULT(${ENABLE_VMLOG})
454 AM_CONDITIONAL([ENABLE_VMLOG], test x"${ENABLE_VMLOG}" = "xyes")
455
456 if test x"${ENABLE_VMLOG}" = "xyes"; then
457     AC_DEFINE([ENABLE_VMLOG], 1, [enable vmlog tracing code])
458 fi
459
460
461 dnl check for disassembler support
462 AC_MSG_CHECKING(whether disassembler should be enabled)
463 AC_ARG_ENABLE([disassembler],
464               [AS_HELP_STRING(--enable-disassembler,enable disassembler [[default=no]])],
465               [case "${enableval}" in
466                    yes) ENABLE_DISASSEMBLER=yes;;
467                    *) ENABLE_DISASSEMBLER=no;;
468                esac],
469               [ENABLE_DISASSEMBLER=no])
470 AC_MSG_RESULT(${ENABLE_DISASSEMBLER})
471 AM_CONDITIONAL([ENABLE_DISASSEMBLER], test x"${ENABLE_DISASSEMBLER}" = "xyes")
472
473 if test x"${ENABLE_DISASSEMBLER}" = "xyes"; then
474     AC_DEFINE([ENABLE_DISASSEMBLER], 1, [enable disassembler])
475
476     dnl check for binutils headers and libraries on some architectures for the
477     dnl disassembler
478     case "${ARCH_DIR}" in
479         arm | i386 | powerpc | x86_64 | sparc64 | powerpc64 | s390 | m68k)
480             AC_CHECK_HEADER([ansidecl.h],, [AC_MSG_ERROR(cannot find ansidecl.h)])
481             AC_CHECK_HEADER([symcat.h],, [AC_MSG_ERROR(cannot find symcat.h)])
482             AC_CHECK_HEADER([bfd.h],, [AC_MSG_ERROR(cannot find bfd.h)])
483             AC_CHECK_HEADER([dis-asm.h],, [AC_MSG_ERROR(cannot find dis-asm.h)])
484
485             case "${OS_DIR}" in
486                 cygwin | darwin | netbsd | solaris)
487                      AC_CHECK_LIB(intl, dcgettext,, [AC_MSG_ERROR(cannot find libintl (from binutils))])
488                      ;;
489             esac
490
491             AC_CHECK_LIB(iberty, xstrerror,, [AC_MSG_ERROR(cannot find libiberty (from binutils))])
492             AC_CHECK_LIB(bfd, bfd_get_arch,, [AC_MSG_ERROR(cannot find libbfd (from binutils))])
493             AC_CHECK_LIB(opcodes, disassembler,, [AC_MSG_ERROR(cannot find libopcodes (from binutils))])
494             AC_DEFINE([WITH_BINUTILS_DISASSEMBLER], 1, [use binutils disassembler])
495             AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [true])
496             ;;
497         * )
498             AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
499             ;;
500     esac
501 else
502     AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
503 fi
504
505
506 dnl check for statistics
507 AC_MSG_CHECKING(whether statistics generation should be enabled)
508 AC_ARG_ENABLE([statistics],
509               [AS_HELP_STRING(--enable-statistics,enable statistics generation [[default=no]])],
510               [case "${enableval}" in
511                    yes) ENABLE_STATISTICS=yes;;
512                    *) ENABLE_STATISTICS=no;;
513                esac],
514               [ENABLE_STATISTICS=no])
515 AC_MSG_RESULT(${ENABLE_STATISTICS})
516 AM_CONDITIONAL([ENABLE_STATISTICS], test x"${ENABLE_STATISTICS}" = "xyes")
517
518 if test x"${ENABLE_STATISTICS}" = "xyes"; then
519     AC_DEFINE([ENABLE_STATISTICS], 1, [enable statistics])
520 fi
521
522
523 dnl check for verifier
524 AC_MSG_CHECKING(whether classfile verification should be enabled)
525 AC_ARG_ENABLE([verifier],
526               [AS_HELP_STRING(--disable-verifier,disable classfile verification [[default=yes]])],
527               [case "${enableval}" in
528                    no) ENABLE_VERIFIER=no;;
529                    *) ENABLE_VERIFIER=yes;;
530                esac],
531               [ENABLE_VERIFIER=yes])
532 AC_MSG_RESULT(${ENABLE_VERIFIER})
533 AM_CONDITIONAL([ENABLE_VERIFIER], test x"${ENABLE_VERIFIER}" = "xyes")
534
535 if test x"${ENABLE_VERIFIER}" = "xyes"; then
536     AC_DEFINE([ENABLE_VERIFIER], 1, [enable classfile verification])
537 fi
538
539
540 dnl check for compiler timing
541 AC_MSG_CHECKING(whether real-time timing should be enabled)
542 AC_ARG_ENABLE([rt-timing],
543               [AS_HELP_STRING(--enable-rt-timing,enable real-time timing [[default=no]])],
544               [case "${enableval}" in
545                    yes) ENABLE_RT_TIMING=yes;;
546                    *) ENABLE_RT_TIMING=no;;
547                esac],
548               [ENABLE_RT_TIMING=no])
549 AC_MSG_RESULT(${ENABLE_RT_TIMING})
550 AM_CONDITIONAL([ENABLE_RT_TIMING], test x"${ENABLE_RT_TIMING}" = "xyes")
551
552 if test x"${ENABLE_RT_TIMING}" = "xyes"; then
553     AC_DEFINE([ENABLE_RT_TIMING], 1, [enable real-time timing])
554 fi
555
556
557 dnl check for cycle count statistics
558 AC_MSG_CHECKING(whether cycle count statistics should be enabled)
559 AC_ARG_ENABLE([cycles-stats],
560               [AS_HELP_STRING(--enable-cycles-stats,enable cycle count statistics [[default=no]])],
561               [case "${enableval}" in
562                    yes) ENABLE_CYCLES_STATS=yes;;
563                    *) ENABLE_CYCLES_STATS=no;;
564                esac],
565               [ENABLE_CYCLES_STATS=no])
566 AC_MSG_RESULT(${ENABLE_CYCLES_STATS})
567 AM_CONDITIONAL([ENABLE_CYCLES_STATS], test x"${ENABLE_CYCLES_STATS}" = "xyes")
568
569 if test x"${ENABLE_CYCLES_STATS}" = "xyes"; then
570     AC_DEFINE([ENABLE_CYCLES_STATS], 1, [enable cycle count statistics])
571 fi
572
573
574 dnl check for JVMTI
575 AC_MSG_CHECKING(whether to compile JVMTI support)
576 AC_ARG_ENABLE([jvmti],
577               [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])],
578               [case "${enableval}" in
579                    yes) ENABLE_JVMTI=yes;;
580                    *) ENABLE_JVMTI=no;;
581                esac],
582               [ENABLE_JVMTI=no])
583 AC_MSG_RESULT(${ENABLE_JVMTI})
584 AM_CONDITIONAL([ENABLE_JVMTI], test x"${ENABLE_JVMTI}" = "xyes")
585
586 if test x"${ENABLE_JVMTI}" = "xyes"; then
587     AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
588 fi
589
590
591 AC_CHECK_ENABLE_THREADS
592
593
594 dnl check if if-conversion should be supported
595 AC_MSG_CHECKING(whether if-conversion should be supported)
596 AC_ARG_ENABLE([ifconv],
597               [AS_HELP_STRING(--disable-ifconv,disable if-conversion [[default=yes]])],
598               [case "${enableval}" in
599                    no) ENABLE_IFCONV=no;;
600                    *) ENABLE_IFCONV=yes;;
601                esac],
602               [ENABLE_IFCONV=yes])
603 AC_MSG_RESULT(${ENABLE_IFCONV})
604 AM_CONDITIONAL([ENABLE_IFCONV], test x"${ENABLE_IFCONV}" = "xyes")
605    
606 if test x"${ENABLE_IFCONV}" = "xyes"; then
607     AC_DEFINE([ENABLE_IFCONV], 1, [enable if-conversion])
608 fi
609
610
611 dnl check for inlining
612 AC_MSG_CHECKING(whether method inlining should be supported)
613 AC_ARG_ENABLE([inlining],
614               [AS_HELP_STRING(--enable-inlining,enable method inlining [[default=no]])],
615               [case "${enableval}" in
616                    yes) ENABLE_INLINING=yes;;
617                    *) ENABLE_INLINING=no;;
618                esac],
619               [ENABLE_INLINING=no])
620 AC_MSG_RESULT(${ENABLE_INLINING})
621 AM_CONDITIONAL([ENABLE_INLINING], test x"${ENABLE_INLINING}" = "xyes")
622
623 if test x"${ENABLE_INLINING}" = "xyes"; then
624     AC_DEFINE([ENABLE_INLINING], 1, [use method inlining])
625 fi
626
627
628 dnl check for inlining debug options
629 AC_MSG_CHECKING(whether method inlining debug options should be enabled)
630 AC_ARG_ENABLE([inlining-debug],
631               [AS_HELP_STRING(--enable-inlining-debug,enable method inlining debug options [[default=no]])],
632               [case "${enableval}" in
633                    yes) ENABLE_INLINING_DEBUG=yes;;
634                    *) ENABLE_INLINING_DEBUG=no;;
635                esac],
636               [ENABLE_INLINING_DEBUG=no])
637 AC_MSG_RESULT(${ENABLE_INLINING_DEBUG})
638 AM_CONDITIONAL([ENABLE_INLINING_DEBUG], test x"${ENABLE_INLINING_DEBUG}" = "xyes")
639
640 if test x"${ENABLE_INLINING_DEBUG}" = "xyes"; then
641     AC_DEFINE([ENABLE_INLINING_DEBUG], 1, [enable method inlining debug options])
642 fi
643
644
645 dnl check for replacement
646 AC_MSG_CHECKING(whether on-stack replacement should be supported)
647 AC_ARG_ENABLE([replacement],
648               [AS_HELP_STRING(--enable-replacement,enable on-stack replacement [[default=no]])],
649               [case "${enableval}" in
650                    yes) ENABLE_REPLACEMENT=yes;;
651                    *) ENABLE_REPLACEMENT=no;;
652                esac],
653               [ENABLE_REPLACEMENT=no])
654 AC_MSG_RESULT(${ENABLE_REPLACEMENT})
655 AM_CONDITIONAL([ENABLE_REPLACEMENT], test x"${ENABLE_REPLACEMENT}" = "xyes")
656
657 if test x"${ENABLE_REPLACEMENT}" = "xyes"; then
658     AC_DEFINE([ENABLE_REPLACEMENT], 1, [use on-stack replacement])
659 fi
660
661
662 dnl check for loop optimization
663 AC_MSG_CHECKING(whether loop optimization should be supported)
664 AC_ARG_ENABLE([loop],
665               [AS_HELP_STRING(--enable-loop,enable loop optimization [[default=no]])],
666               [case "${enableval}" in
667                    yes) ENABLE_LOOP=yes;;
668                    *) ENABLE_LOOP=no;;
669                esac],
670               [ENABLE_LOOP=no])
671 AC_MSG_RESULT(${ENABLE_LOOP})
672 AM_CONDITIONAL([ENABLE_LOOP], test x"${ENABLE_LOOP}" = "xyes")
673
674 if test x"${ENABLE_LOOP}" = "xyes"; then
675     AC_DEFINE([ENABLE_LOOP], 1, [use loop optimization])
676 fi
677
678
679 dnl check if linear scan register allocator(lsra) with SSA should be used
680 AC_MSG_CHECKING(whether lsra with ssa should be supported)
681 AC_ARG_ENABLE([ssa],
682               [AS_HELP_STRING(--disable-ssa,disable ssa [[default=no]])],
683               [case "${enableval}" in
684                    no) ENABLE_SSA=no;;
685                    *) ENABLE_SSA=yes;;
686                esac],
687               [ENABLE_SSA=no])
688 AC_MSG_RESULT(${ENABLE_SSA})
689 AM_CONDITIONAL([ENABLE_SSA], test x"${ENABLE_SSA}" = "xyes")
690
691 if test x"${ENABLE_SSA}" = "xyes"; then
692     AC_DEFINE([ENABLE_SSA], 1, [enable lsra with ssa])
693     ENABLE_LSRA="no"
694 fi
695
696
697 dnl check if linear scan register allocator(lsra) should be used
698 AC_MSG_CHECKING(whether lsra should be supported)
699 AC_ARG_ENABLE([lsra],
700               [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=no]])],
701               [case "${enableval}" in
702                    yes) ENABLE_LSRA=yes;;
703                    *) ENABLE_LSRA=no;;
704                esac],
705               [ENABLE_LSRA=no])
706    
707 if test x"${ENABLE_LSRA}" = "xyes"; then
708     if test x"${ENABLE_SSA}" = "xyes"; then
709         ENABLE_LSRA="no"
710     fi
711 fi
712 AC_MSG_RESULT(${ENABLE_LSRA})
713 AM_CONDITIONAL([ENABLE_LSRA], test x"${ENABLE_LSRA}" = "xyes")
714  
715 if test x"${ENABLE_LSRA}" = "xyes"; then
716     AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
717 fi
718
719
720 dnl check if profiling should be supported
721 AC_MSG_CHECKING(whether profiling should be supported)
722 AC_ARG_ENABLE([profiling],
723               [AS_HELP_STRING(--enable-profiling,enable profiling [[default=no]])],
724               [case "${enableval}" in
725                    yes) ENABLE_PROFILING=yes;;
726                    *) ENABLE_PROFILING=no;;
727                esac],
728               [ENABLE_PROFILING=no])
729 AC_MSG_RESULT(${ENABLE_PROFILING})
730 AM_CONDITIONAL([ENABLE_PROFILING], test x"${ENABLE_PROFILING}" = "xyes")
731    
732 if test x"${ENABLE_PROFILING}" = "xyes"; then
733     AC_DEFINE([ENABLE_PROFILING], 1, [enable profiling])
734 fi
735
736
737 dnl check for instruction scheduler
738 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
739
740 AC_MSG_CHECKING(whether instruction scheduler should be supported)
741 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
742         case "${ARCH_DIR}" in
743                 xdspcore )
744                         ;;
745                 * )
746                         AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
747                         ;;
748         esac
749
750         AC_MSG_RESULT(yes)
751         AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
752         AM_CONDITIONAL([USE_SCHEDULER], [true])
753 else
754         AC_MSG_RESULT(no)
755         AM_CONDITIONAL([USE_SCHEDULER], [false])
756 fi
757
758
759 dnl check if zlib should be used
760 AC_MSG_CHECKING(whether ZIP/JAR archives should be supported)
761 AC_ARG_ENABLE([zlib],
762               [AS_HELP_STRING(--disable-zlib,disable ZIP/JAR archive support (needs zlib) [[default=yes]])],
763               [case "${enableval}" in
764                   no) ENABLE_ZLIB=no;;
765                   *) ENABLE_ZLIB=yes;;
766                esac],
767               [ENABLE_ZLIB=yes])
768 AC_MSG_RESULT(${ENABLE_ZLIB})
769
770 if test x"${ENABLE_ZLIB}" = "xyes"; then
771     AC_CHECK_HEADERS([zconf.h],, [AC_MSG_ERROR(cannot find zconf.h)])
772     AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
773     AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
774     AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
775 fi
776 AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
777
778
779 dnl check for stuff to be built
780 AC_CHECK_ENABLE_JNI
781
782
783 dnl check if a libjvm.so should be built
784 AC_MSG_CHECKING(whether to build a libjvm.so)
785 AC_ARG_ENABLE([libjvm],
786               [AS_HELP_STRING(--disable-libjvm,build a libjvm.so [[default=yes]])],
787               [case "${enableval}" in
788                   no) ENABLE_LIBJVM=no;;
789                   *) ENABLE_LIBJVM=yes;;
790                esac],
791               [ENABLE_LIBJVM=yes])
792 AC_MSG_RESULT(${ENABLE_LIBJVM})
793 AM_CONDITIONAL([ENABLE_LIBJVM], test x"${ENABLE_LIBJVM}" = "xyes")
794 AC_SUBST(ENABLE_LIBJVM)
795
796 if test x"${ENABLE_LIBJVM}" = "xyes"; then
797     AC_DEFINE([ENABLE_LIBJVM], 1, [enable libjvm.so])
798
799     dnl set AC_ENABLE_SHARED and AC_DISABLE_STATIC properly
800     enable_shared=yes
801     enable_static=no
802 else
803     enable_shared=no
804     enable_static=yes
805 fi
806
807 dnl libtool stuff
808 AC_LIBTOOL_DLOPEN
809 AC_PROG_LIBTOOL
810
811
812 dnl check if CACAO should be linked statically
813 AC_MSG_CHECKING(whether to link CACAO statically)
814 AC_ARG_ENABLE([staticvm],
815               [AS_HELP_STRING(--enable-staticvm,link CACAO statically [[default=no]])],
816               [case "${enableval}" in
817                   yes) ENABLE_STATICVM=yes
818                        AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
819                        ;;
820                   *) ENABLE_STATICVM=no;;
821                esac],
822               [ENABLE_STATICVM=no])
823 AC_MSG_RESULT(${ENABLE_STATICVM})
824 AM_CONDITIONAL([ENABLE_STATICVM], test x"${ENABLE_STATICVM}" = "xyes")
825 AC_SUBST(ENABLE_STATICVM)
826
827
828 dnl where is CACAO's vm.zip
829 AC_MSG_CHECKING(where CACAO's vm.zip is installed)
830 AC_ARG_WITH([vm-zip],
831             [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]])],
832             [CACAO_VM_ZIP=${withval}],
833             [CACAO_VM_ZIP=${CACAO_PREFIX}/share/cacao/vm.zip])
834 AC_MSG_RESULT(${CACAO_VM_ZIP})
835 AC_DEFINE_UNQUOTED([CACAO_VM_ZIP], "${CACAO_VM_ZIP}", [CACAO's vm.zip])
836 AC_SUBST(CACAO_VM_ZIP)
837
838
839 AC_CHECK_WITH_CLASSPATH
840 AC_CHECK_WITH_CLASSPATH_PREFIX
841 AC_CHECK_WITH_CLASSPATH_CLASSES
842 AC_CHECK_WITH_CLASSPATH_LIBDIR
843 AC_CHECK_WITH_CLASSPATH_INCLUDEDIR
844
845
846 dnl if we compile for a JRE-style directory layout
847 AC_MSG_CHECKING(if we compile for a JRE-style directory layout)
848 AC_ARG_WITH([jre-layout],
849             [AS_HELP_STRING(--with-jre-layout,compile for JRE-style directory layout [[default=no]])],
850             [case "${enableval}" in
851                 yes) WITH_JRE_LAYOUT=yes
852                      AC_DEFINE([WITH_JRE_LAYOUT], 1, [with JRE layout])
853                      ;;
854                 *) WITH_JRE_LAYOUT=no;;
855              esac],
856             [WITH_JRE_LAYOUT=no])
857 AC_MSG_RESULT(${WITH_JRE_LAYOUT})
858
859
860 dnl check if GNU Classpath should be linked statically into CACAO
861 AC_MSG_CHECKING(whether to link GNU Classpath native libraries statically into CACAO)
862 AC_ARG_WITH([static-classpath],
863             [AS_HELP_STRING(--with-static-classpath,link GNU classpath native libraries statically into CACAO [[default=no]])],
864             [case "${enableval}" in
865                 yes) WITH_STATIC_CLASSPATH=yes;;
866                 *) WITH_STATIC_CLASSPATH=no;;
867              esac],
868             [WITH_STATIC_CLASSPATH=no])
869 AC_MSG_RESULT(${WITH_STATIC_CLASSPATH})
870
871 if test x"${WITH_STATIC_CLASSPATH}" = "xyes"; then
872     AC_DEFINE([WITH_STATIC_CLASSPATH], 1, [link GNU classpath native libraries statically into CACAO])
873
874     dnl check for some classpath related stuff when we link statically
875     AM_ICONV_LINK
876 else
877     dnl we need this check for --enable-staticvm, otherwise ltdl can't find dlopen
878     if test x"${ENABLE_STATICVM}" = "xyes"; then
879         AC_CHECK_LIB(dl, dlopen,, [AC_MSG_ERROR(cannot find libdl)])
880     fi
881
882     AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
883     AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
884 fi
885 AM_CONDITIONAL([WITH_STATIC_CLASSPATH], test x"${WITH_STATIC_CLASSPATH}" = "xyes")
886 AC_SUBST(WITH_STATIC_CLASSPATH)
887
888
889 dnl check for some programs we need
890 AC_PROG_JAVAC
891 AC_PROG_JAR
892
893
894 dnl finally pass CFLAGS to Makefiles via AM_CFLAGS
895 CFLAGS=$OPT_CFLAGS
896 AM_CFLAGS=$ARCH_CFLAGS
897 AC_SUBST(AM_CFLAGS)
898
899
900 AC_CONFIG_FILES([Makefile]
901                 [contrib/Makefile]
902                 [contrib/setenvinstalled]
903                 [contrib/setenvsource]
904                 [contrib/vmlog/Makefile]
905                 [contrib/vmlog/t/Makefile]
906                 [doc/Makefile]
907                 [doc/handbook/Makefile]
908                 [man/Makefile]
909                 [src/Makefile]
910                 [src/cacao/Makefile]
911                 [src/cacaoh/Makefile]
912                 [src/fdlibm/Makefile]
913                 [src/lib/Makefile]
914                 [src/mm/Makefile]
915                 [src/mm/cacao-gc/Makefile]
916                 [src/native/Makefile]
917                 [src/native/include/Makefile]
918                 [src/native/jvmti/Makefile]
919                 [src/native/tools/Makefile]
920                 [src/native/vm/Makefile]
921                 [src/native/vm/cldc1.1/Makefile]
922                 [src/native/vm/gnu/Makefile]
923                 [src/scripts/Makefile]
924                 [src/scripts/java]
925                 [src/threads/Makefile]
926                 [src/threads/native/Makefile]
927                 [src/threads/none/Makefile]
928                 [src/toolbox/Makefile]
929                 [src/vm/Makefile]
930                 [src/vm/jit/Makefile]
931                 [src/vm/jit/allocator/Makefile]
932                 [src/vm/jit/alpha/Makefile]
933                 [src/vm/jit/alpha/freebsd/Makefile]
934                 [src/vm/jit/alpha/linux/Makefile]
935                 [src/vm/jit/arm/Makefile]
936                 [src/vm/jit/arm/linux/Makefile]
937                 [src/vm/jit/i386/Makefile]
938                 [src/vm/jit/i386/cygwin/Makefile]
939                 [src/vm/jit/i386/darwin/Makefile]
940                 [src/vm/jit/i386/freebsd/Makefile]
941                 [src/vm/jit/i386/linux/Makefile]
942                 [src/vm/jit/intrp/Makefile]
943                 [src/vm/jit/inline/Makefile]
944                 [src/vm/jit/loop/Makefile]
945                 [src/vm/jit/m68k/Makefile]
946                 [src/vm/jit/m68k/linux/Makefile]
947                 [src/vm/jit/mips/Makefile]
948                 [src/vm/jit/mips/irix/Makefile]
949                 [src/vm/jit/mips/linux/Makefile]
950                 [src/vm/jit/mips/uclinux/Makefile]
951                 [src/vm/jit/optimizing/Makefile]
952                 [src/vm/jit/parisc/Makefile]
953                 [src/vm/jit/parisc/linux/Makefile]
954                 [src/vm/jit/powerpc/Makefile]
955                 [src/vm/jit/powerpc/darwin/Makefile]
956                 [src/vm/jit/powerpc/linux/Makefile]
957                 [src/vm/jit/powerpc/netbsd/Makefile]
958                 [src/vm/jit/powerpc64/Makefile]
959                 [src/vm/jit/powerpc64/linux/Makefile]
960                 [src/vm/jit/s390/Makefile]
961                 [src/vm/jit/schedule/Makefile]
962                 [src/vm/jit/sparc64/Makefile]
963                 [src/vm/jit/sparc64/linux/Makefile]
964                 [src/vm/jit/sparc64/solaris/Makefile]
965                 [src/vm/jit/tools/Makefile]
966                 [src/vm/jit/verify/Makefile]
967                 [src/vm/jit/x86_64/Makefile]
968                 [src/vm/jit/x86_64/freebsd/Makefile]
969                 [src/vm/jit/x86_64/linux/Makefile]
970                 [src/vmcore/Makefile]
971                 [tests/Makefile]
972                 [tests/regression/Makefile]
973                 [tests/regression/codepatching/Makefile]
974                 [tests/regression/jasmin/Makefile]
975                 [tests/regression/native/Makefile]
976                 [tests/regression/resolving/Makefile]
977                 [tests/regression/resolving/classes1/Makefile]
978                 [tests/regression/resolving/classes2/Makefile]
979                 [tests/regression/resolving/classes3/Makefile]
980                 )
981
982
983 dnl now configure subpackages with OPT_CFLAGS and ARCH_CFLAGS
984 export OPT_CFLAGS
985 export ARCH_CFLAGS
986 AC_CONFIG_SUBDIRS(src/mm/boehm-gc)
987
988
989 AC_OUTPUT
990
991
992 ## Local variables:
993 ## mode: m4
994 ## indent-tabs-mode: t
995 ## c-basic-offset: 4
996 ## tab-width: 8
997 ## compile-command: "automake --add-missing"
998 ## End: