* configure.ac: Use ARCH_CFLAGS and OPT_CFLAGS instead of CFLAGS and
[cacao.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT(cacao, 0.96+svn, cacao@cacaojvm.org)
4 AC_CONFIG_SRCDIR(src/cacao/cacao.c)
5 AC_CANONICAL_HOST
6 AC_PREREQ(2.59)
7 AM_INIT_AUTOMAKE([1.9.0])
8 AM_MAINTAINER_MODE
9
10 AM_CONFIG_HEADER([config.h])
11
12 AC_PREFIX_DEFAULT(/usr/local/cacao)
13
14
15 dnl set optimization and debugging for all architectures and systems
16 if test x"$CFLAGS" = "x"; then
17     OPT_CFLAGS="-O0 -g3"
18 else
19     OPT_CFLAGS=$CFLAGS
20 fi
21
22 dnl system type
23 case "$host_cpu" in
24 alpha | alphaev56 | alphapca56 )
25     ARCH_DIR="alpha"
26     ARCH_CFLAGS="-mieee -D__ALPHA__"
27     ;;
28
29 arm | armv4tl | armv5b | armv5l )
30     ARCH_DIR="arm"
31     ARCH_CFLAGS="-D__ARM__"
32     ;;
33
34 i386 | i486 | i586 | i686 )
35     ARCH_DIR="i386"
36     ARCH_CFLAGS="-D__I386__"
37     ;;
38
39 mips )
40     ARCH_DIR="mips"
41     ARCH_CFLAGS="-D__MIPS__"
42     ;;
43
44 powerpc )
45     ARCH_DIR="powerpc"
46     ARCH_CFLAGS="-D__POWERPC__"
47     ;;
48
49 powerpc64 )
50     ARCH_DIR="powerpc64"
51     ARCH_CFLAGS="-D__POWERPC64__"
52     ;;
53
54 sparc64 )
55     ARCH_DIR="sparc64"
56     ARCH_CFLAGS="-mcpu=v9 -m64 -D__SPARC_64__"
57     ;;
58
59 x86_64 )
60     ARCH_DIR="x86_64"
61     ARCH_CFLAGS="-D__X86_64__"
62     ;;
63
64 xdspcore )
65     ARCH_DIR="xdspcore"
66     ENABLE_STATICVM="yes"
67     ARCH_CFLAGS="-D__XDSPCORE__"
68     USE_SCHEDULER="1"
69     ;;
70
71 * )
72     AC_MSG_ERROR($host_cpu systems are not supported at this time)
73     ;;
74 esac
75
76 dnl host type
77 case "$host_os" in
78 *darwin* )
79     OS_DIR="darwin"
80     INTRP_CFLAGS="$ARCH_CFLAGS -D__DARWIN__ -Wall -Wno-long-long"
81     ARCH_CFLAGS="$ARCH_CFLAGS -D__DARWIN__ -ansi -pedantic -Wall -Wno-long-long"
82     ;;
83
84 *freebsd* )
85     OS_DIR="freebsd"
86     INTRP_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
87     ARCH_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
88     ;;
89
90 *irix* )
91     OS_DIR="irix"
92     INTRP_CFLAGS="$ARCH_CFLAGS -D__IRIX__"
93     ARCH_CFLAGS="$ARCH_CFLAGS -D__IRIX__"
94     ;;
95
96 *linux* | *Linux* )
97     OS_DIR="linux"
98     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"
99     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"
100     ;;
101
102 *netbsd* )
103     OS_DIR="netbsd"
104     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"
105     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"
106     ;;
107
108 * )
109     ;;
110 esac
111
112
113 dnl temporary set the CFLAGS for configure tests
114 dnl we set it properly at the end of this file
115 CFLAGS="$ARCH_CFLAGS $OPT_CFLAGS"
116
117
118 dnl define some stuff required for --fullversion
119 AC_DEFINE_UNQUOTED(VERSION_CONFIGURE_ARGS, "$ac_configure_args", [configure arguments])
120 AC_DEFINE_UNQUOTED(VERSION_CC, "$CC", [CC used])
121 AC_DEFINE_UNQUOTED(VERSION_CFLAGS, "$OPT_CFLAGS $ARCH_CFLAGS", [CFLAGS used])
122
123
124 dnl define and substitute some architecture specific variables
125 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [architecture directory])
126 AC_SUBST(ARCH_DIR)
127 AC_SUBST(OS_DIR)
128 AC_SUBST(INTRP_CFLAGS)
129 AC_SUBST(USE_SCHEDULER)
130
131
132 dnl Checks for programs.
133 AC_PROG_CC
134 AM_PROG_AS
135 AC_PROG_LD
136 AC_PROG_LD_GNU
137 AC_PROG_RANLIB
138 AC_PROG_LN_S
139 AC_PROG_MAKE_SET
140 AM_PROG_MKDIR_P
141
142 dnl Checks for header files.
143 AC_HEADER_DIRENT
144 AC_HEADER_STDC
145 AC_CHECK_HEADERS([fcntl.h])
146 AC_CHECK_HEADERS([sys/time.h])
147 AC_CHECK_HEADERS([unistd.h])
148 AC_CHECK_HEADERS([sys/ioctl.h])
149
150 dnl this is for fdlibm
151 AC_CHECK_HEADERS([stdint.h])
152 AC_CHECK_HEADERS([inttypes.h])
153 AC_CHECK_HEADERS([sys/config.h])
154 AC_CHECK_HEADERS([sys/types.h])
155 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
156 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
157 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]))
158 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]))
159
160 dnl Checks for typedefs, structures, and compiler characteristics.
161 AC_C_CONST
162 AC_C_INLINE
163 AC_C_ATTRIBUTE
164 AC_TYPE_OFF_T
165 AC_TYPE_SIZE_T
166 AC_HEADER_TIME
167 AC_STRUCT_TM
168
169 dnl Checks for library functions.
170 AC_PROG_GCC_TRADITIONAL
171 AC_TYPE_SIGNAL
172 AC_FUNC_MEMCMP
173 AC_CHECK_FUNCS([calloc mprotect getpagesize free])
174 AC_CHECK_FUNCS([getcwd gettimeofday])
175 AC_CHECK_FUNCS([scandir])
176 AC_CHECK_FUNCS([mmap])
177 AC_CHECK_FUNCS([isnan])
178
179 dnl Checks for libraries.
180
181 dnl Checking sizeof void *
182 AC_CHECK_SIZEOF(void *)
183 AC_C_BIGENDIAN
184
185
186 dnl define install prefix
187 if test "x$prefix" = "xNONE"; then
188     CACAO_PREFIX=$ac_default_prefix
189 else
190     CACAO_PREFIX=$prefix
191 fi
192 AC_DEFINE_UNQUOTED([CACAO_PREFIX], "${CACAO_PREFIX}", [installation prefix])
193 AC_SUBST(CACAO_PREFIX)
194
195
196 dnl Features
197
198 dnl check arguments
199
200 dnl check for JIT compiler
201 AC_MSG_CHECKING(whether JIT compiler should be compiled)
202 AC_ARG_ENABLE([jit],
203               [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])],
204               [case "${enableval}" in
205                    no) ENABLE_JIT=no;;
206                    *) ENABLE_JIT=yes;;
207                esac],
208               [ENABLE_JIT=yes])
209 AC_MSG_RESULT(${ENABLE_JIT})
210 AM_CONDITIONAL([ENABLE_JIT], test x"${ENABLE_JIT}" = "xyes")
211
212 if test x"${ENABLE_JIT}" = "xyes"; then
213     AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
214 fi
215
216
217 dnl check if softfloat should be used
218 AC_MSG_CHECKING(whether softfloat should be used)
219 AC_ARG_ENABLE([softfloat],
220               [AS_HELP_STRING(--enable-softfloat,use softfloat [[default=no]])],
221               [case "${enableval}" in
222                   yes) ENABLE_SOFTFLOAT=yes;;
223                   *) ENABLE_SOFTFLOAT=no;;
224                esac],
225               [ENABLE_SOFTFLOAT=no])
226 AC_MSG_RESULT(${ENABLE_SOFTFLOAT})
227
228 if test x"${ENABLE_SOFTFLOAT}" = "xyes"; then
229     AC_DEFINE([ENABLE_SOFTFLOAT], 1, [enable softfloat])
230 fi
231
232
233 dnl check for interpreter
234 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
235
236 AC_MSG_CHECKING(whether interpreter should be compiled)
237 if test x"$enable_intrp" = "xyes"; then
238     AC_MSG_RESULT(yes)
239     AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
240     AM_CONDITIONAL([ENABLE_INTRP], [true])
241     ENABLE_INTRP=yes
242
243     AC_ASM_SKIP16
244
245     dnl check for libffi
246     AC_ARG_WITH([ffi],
247                 [AS_HELP_STRING(--with-ffi,use libffi to call native functions)],
248                 [WITH_FFI=yes
249                  AC_CHECK_HEADERS([ffi.h],, [AC_MSG_ERROR(cannot find ffi.h)])
250                  AC_CHECK_LIB(ffi, ffi_call,, [AC_MSG_ERROR(cannot find libffi)])
251                  AC_DEFINE([WITH_FFI], 1, [use libffi])],
252                 [WITH_FFI=no])
253
254     dnl check for libffcall
255     AC_ARG_WITH([ffcall],
256                 [AS_HELP_STRING(--with-ffcall,use libffcall to call native functions)],
257                 [WITH_FFCALL=yes
258                  AC_CHECK_HEADERS([avcall.h],, [AC_MSG_ERROR(cannot find avcall.h)])
259                  AC_CHECK_LIB(avcall, __builtin_avcall,, [AC_MSG_ERROR(cannot find libavcall (from libffcall))])
260                  AC_DEFINE([WITH_FFCALL], 1, [use libffcall])],
261                 [WITH_FFCALL=no])
262
263     dnl check for libffi or libffcall
264     if test x"${WITH_FFI}" = "xyes" -a x"${WITH_FFCALL}" = "xyes"; then
265         AC_ERROR(Enable only libffi or libffcall.)
266     fi
267     if test x"${WITH_FFI}" = "xno" -a x"${WITH_FFCALL}" = "xno"; then
268         AC_ERROR(Enable one of libffi or libffcall.)
269     fi
270
271 else
272     AC_MSG_RESULT(no)
273     AM_CONDITIONAL([ENABLE_INTRP], [false])
274     ENABLE_INTRP="no"
275 fi
276
277 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
278     AC_ERROR(You have to enable at least the JIT or the interpreter.)
279 fi
280
281
282 dnl check for garbage collector usage
283 AC_MSG_CHECKING(whether GC should be disabled)
284 AC_ARG_ENABLE([gc],
285               [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])],
286               [case "${enableval}" in
287                    no) DISABLE_GC=yes
288                        AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
289                        ;;
290                    *) DISABLE_GC=no;;
291                esac],
292               [DISABLE_GC=no])
293 AC_MSG_RESULT(${DISABLE_GC})
294 AM_CONDITIONAL([DISABLE_GC], test x"${DISABLE_GC}" = "xyes")
295
296
297 dnl check for dump memory usage
298 AC_MSG_CHECKING(whether dump memory should be disabled)
299 AC_ARG_ENABLE([dump],
300               [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])],
301               [case "${enableval}" in
302                    no)
303                        DISABLE_DUMP=yes
304                        AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
305                        ;;
306                    *) DISABLE_DUMP=no;;
307                esac],
308                [DISABLE_DUMP=no])
309 AC_MSG_RESULT(${DISABLE_DUMP})
310
311
312 dnl check for debug
313 AC_MSG_CHECKING(whether debug code generation should be enabled)
314 AC_ARG_ENABLE([debug],
315               [AS_HELP_STRING(--disable-debug,disable debug code generation [[default=yes]])],
316               [case "${enableval}" in
317                    no) NDEBUG=yes
318                        AC_DEFINE([NDEBUG], 1, [disable debug code])
319                        ;;
320                    *) NDEBUG=no;;
321                esac],
322               [NDEBUG=no])
323
324 if test x"${NDEBUG}" = "xno"; then
325     AC_MSG_RESULT(yes)
326 else
327     AC_MSG_RESULT(no)
328 fi
329 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xyes")
330
331
332 dnl check for disassembler support
333 AC_MSG_CHECKING(whether disassembler should be enabled)
334 AC_ARG_ENABLE([disassembler],
335               [AS_HELP_STRING(--disable-disassembler,disable disassembler [[default=yes]])],
336               [case "${enableval}" in
337                    no) ENABLE_DISASSEMBLER=no;;
338                    *) ENABLE_DISASSEMBLER=yes;;
339                esac],
340               [ENABLE_DISASSEMBLER=yes])
341 AC_MSG_RESULT(${ENABLE_DISASSEMBLER})
342 AM_CONDITIONAL([ENABLE_DISASSEMBLER], test x"${ENABLE_DISASSEMBLER}" = "xyes")
343
344 if test x"${ENABLE_DISASSEMBLER}" = "xyes"; then
345     AC_DEFINE([ENABLE_DISASSEMBLER], 1, [enable disassembler])
346
347     dnl check for binutils headers and libraries on some architectures for the
348     dnl disassembler
349     case "${ARCH_DIR}" in
350         arm | i386 | powerpc | x86_64 | sparc64 | powerpc64)
351             AC_CHECK_HEADER([ansidecl.h],, [AC_MSG_ERROR(cannot find ansidecl.h)])
352             AC_CHECK_HEADER([symcat.h],, [AC_MSG_ERROR(cannot find symcat.h)])
353             AC_CHECK_HEADER([bfd.h],, [AC_MSG_ERROR(cannot find bfd.h)])
354             AC_CHECK_HEADER([dis-asm.h],, [AC_MSG_ERROR(cannot find dis-asm.h)])
355
356             case "${OS_DIR}" in
357                 cygwin | darwin | netbsd )
358                      AC_CHECK_LIB(intl, dcgettext,, [AC_MSG_ERROR(cannot find libintl (from binutils))])
359                      ;;
360             esac
361
362             AC_CHECK_LIB(iberty, xstrerror,, [AC_MSG_ERROR(cannot find libiberty (from binutils))])
363             AC_CHECK_LIB(bfd, bfd_get_arch,, [AC_MSG_ERROR(cannot find libbfd (from binutils))])
364             AC_CHECK_LIB(opcodes, disassembler,, [AC_MSG_ERROR(cannot find libopcodes (from binutils))])
365             AC_DEFINE([WITH_BINUTILS_DISASSEMBLER], 1, [use binutils disassembler])
366             AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [true])
367             ;;
368         * )
369             AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
370             ;;
371     esac
372 else
373     AM_CONDITIONAL([WITH_BINUTILS_DISASSEMBLER], [false])
374 fi
375
376
377 dnl check for statistics
378 AC_MSG_CHECKING(whether statistics generation should be enabled)
379 AC_ARG_ENABLE([statistics],
380               [AS_HELP_STRING(--enable-statistics,enable statistics generation [[default=no]])],
381               [case "${enableval}" in
382                    yes) ENABLE_STATISTICS=yes;;
383                    *) ENABLE_STATISTICS=no;;
384                esac],
385               [ENABLE_STATISTICS=no])
386 AC_MSG_RESULT(${ENABLE_STATISTICS})
387 AM_CONDITIONAL([ENABLE_STATISTICS], test x"${ENABLE_STATISTICS}" = "xyes")
388
389 if test x"${ENABLE_STATISTICS}" = "xyes"; then
390     AC_DEFINE([ENABLE_STATISTICS], 1, [enable statistics])
391 fi
392
393
394 dnl check for verifier
395 AC_MSG_CHECKING(whether classfile verification should be enabled)
396 AC_ARG_ENABLE([verifier],
397               [AS_HELP_STRING(--disable-verifier,disable classfile verification [[default=yes]])],
398               [case "${enableval}" in
399                    no) ENABLE_VERIFIER=no;;
400                    *) ENABLE_VERIFIER=yes;;
401                esac],
402               [ENABLE_VERIFIER=yes])
403 AC_MSG_RESULT(${ENABLE_VERIFIER})
404 AM_CONDITIONAL([ENABLE_VERIFIER], test x"${ENABLE_VERIFIER}" = "xyes")
405
406 if test x"${ENABLE_VERIFIER}" = "xyes"; then
407     AC_DEFINE([ENABLE_VERIFIER], 1, [enable classfile verification])
408 fi
409
410
411 dnl check for compiler timing
412 AC_MSG_CHECKING(whether real-time timing should be enabled)
413 AC_ARG_ENABLE([rt-timing],
414               [AS_HELP_STRING(--enable-rt-timing,enable real-time timing [[default=no]])],
415               [case "${enableval}" in
416                    yes) ENABLE_RT_TIMING=yes;;
417                    *) ENABLE_RT_TIMING=no;;
418                esac],
419               [ENABLE_RT_TIMING=no])
420 AC_MSG_RESULT(${ENABLE_RT_TIMING})
421 AM_CONDITIONAL([ENABLE_RT_TIMING], test x"${ENABLE_RT_TIMING}" = "xyes")
422
423 if test x"${ENABLE_RT_TIMING}" = "xyes"; then
424     AC_DEFINE([ENABLE_RT_TIMING], 1, [enable real-time timing])
425 fi
426
427
428 dnl check for cycle count statistics
429 AC_MSG_CHECKING(whether cycle count statistics should be enabled)
430 AC_ARG_ENABLE([cycles-stats],
431               [AS_HELP_STRING(--enable-cycles-stats,enable cycle count statistics [[default=no]])],
432               [case "${enableval}" in
433                    yes) ENABLE_CYCLES_STATS=yes;;
434                    *) ENABLE_CYCLES_STATS=no;;
435                esac],
436               [ENABLE_CYCLES_STATS=no])
437 AC_MSG_RESULT(${ENABLE_CYCLES_STATS})
438 AM_CONDITIONAL([ENABLE_CYCLES_STATS], test x"${ENABLE_CYCLES_STATS}" = "xyes")
439
440 if test x"${ENABLE_CYCLES_STATS}" = "xyes"; then
441     AC_DEFINE([ENABLE_CYCLES_STATS], 1, [enable cycle count statistics])
442 fi
443
444
445 dnl check for JVMTI
446 AC_MSG_CHECKING(whether to compile JVMTI support)
447 AC_ARG_ENABLE([jvmti],
448               [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])],
449               [case "${enableval}" in
450                    yes) ENABLE_JVMTI=yes;;
451                    *) ENABLE_JVMTI=no;;
452                esac],
453               [ENABLE_JVMTI=no])
454 AC_MSG_RESULT(${ENABLE_JVMTI})
455 AM_CONDITIONAL([ENABLE_JVMTI], test x"${ENABLE_JVMTI}" = "xyes")
456
457 if test x"${ENABLE_JVMTI}" = "xyes"; then
458     AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
459 fi
460
461
462 dnl threads
463 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
464 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
465
466 AC_MSG_CHECKING(whether to include threads support)
467 enable_threads=${enable_threads:-native}
468 case "$enable_threads" in
469 no | none | single)
470     AC_MSG_RESULT(no)
471     dnl no threads for boehm
472     ac_configure_args="$ac_configure_args --disable-boehm-threads"
473     AM_CONDITIONAL([ENABLE_THREADS], [false])
474     ;;
475
476 native | posix | pthreads)
477     AC_DEFINE([ENABLE_THREADS], 1, [enable threads])
478     
479     AM_CONDITIONAL([ENABLE_THREADS], [true])
480     
481     AC_MSG_RESULT(yes, native)
482     AC_CHECK_LIB(pthread, main)
483     
484     ARCH_CFLAGS="$ARCH_CFLAGS -D_REENTRANT"
485
486     dnl we changed ARCH_CFLAGS, set CFLAGS again
487     CFLAGS="$ARCH_CFLAGS $OPT_CFLAGS"
488     
489     dnl tell boehm to support threads as well
490     ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
491     ;;
492
493 *)
494     AC_MSG_ERROR($enable_threads is an unknown thread package)
495     ;;
496 esac
497
498
499 dnl Check whether the compiler supports the __thread keyword.
500 if test "x$use__thread" != xno; then
501   AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
502   [cat > conftest.c <<\EOF
503 __thread int a = 42;
504 EOF
505   if AC_TRY_COMMAND([${CC-cc} $ARCH_CFLAGS $OPT_CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
506     ac_cv_gcc___thread=yes 
507   else
508     ac_cv_gcc___thread=no
509   fi
510   rm -f conftest*])
511   if test "$ac_cv_gcc___thread" = yes; then
512     AC_DEFINE([HAVE___THREAD], 1, [have __thread])
513   fi
514 else
515   ac_cv_gcc___thread=no
516 fi
517
518
519 dnl check if if-conversion should be supported
520 AC_MSG_CHECKING(whether if-conversion should be supported)
521 AC_ARG_ENABLE([ifconv],
522               [AS_HELP_STRING(--disable-ifconv,disable if-conversion [[default=yes]])],
523               [case "${enableval}" in
524                    no) ENABLE_IFCONV=no;;
525                    *) ENABLE_IFCONV=yes;;
526                esac],
527               [ENABLE_IFCONV=yes])
528 AC_MSG_RESULT(${ENABLE_IFCONV})
529 AM_CONDITIONAL([ENABLE_IFCONV], test x"${ENABLE_IFCONV}" = "xyes")
530    
531 if test x"${ENABLE_IFCONV}" = "xyes"; then
532     AC_DEFINE([ENABLE_IFCONV], 1, [enable if-conversion])
533 fi
534
535
536 dnl check for inlining
537 AC_MSG_CHECKING(whether method inlining should be supported)
538 AC_ARG_ENABLE([inlining],
539               [AS_HELP_STRING(--enable-inlining,enable method inlining [[default=no]])],
540               [case "${enableval}" in
541                    yes) ENABLE_INLINING=yes;;
542                    *) ENABLE_INLINING=no;;
543                esac],
544               [ENABLE_INLINING=no])
545 AC_MSG_RESULT(${ENABLE_INLINING})
546 AM_CONDITIONAL([ENABLE_INLINING], test x"${ENABLE_INLINING}" = "xyes")
547
548 if test x"${ENABLE_INLINING}" = "xyes"; then
549     AC_DEFINE([ENABLE_INLINING], 1, [use method inlining])
550 fi
551
552
553 dnl check for loop optimization
554 AC_MSG_CHECKING(whether loop optimization should be supported)
555 AC_ARG_ENABLE([loop],
556               [AS_HELP_STRING(--enable-loop,enable loop optimization [[default=no]])],
557               [case "${enableval}" in
558                    yes) ENABLE_LOOP=yes;;
559                    *) ENABLE_LOOP=no;;
560                esac],
561               [ENABLE_LOOP=no])
562 AC_MSG_RESULT(${ENABLE_LOOP})
563 AM_CONDITIONAL([ENABLE_LOOP], test x"${ENABLE_LOOP}" = "xyes")
564
565 if test x"${ENABLE_LOOP}" = "xyes"; then
566     AC_DEFINE([ENABLE_LOOP], 1, [use loop optimization])
567 fi
568
569
570 dnl check if linear scan register allocator(lsra) should be used
571 AC_MSG_CHECKING(whether lsra should be supported)
572 AC_ARG_ENABLE([lsra],
573               [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=no]])],
574               [case "${enableval}" in
575                    yes) ENABLE_LSRA=yes;;
576                    *) ENABLE_LSRA=no;;
577                esac],
578               [ENABLE_LSRA=no])
579 AC_MSG_RESULT(${ENABLE_LSRA})
580 AM_CONDITIONAL([ENABLE_LSRA], test x"${ENABLE_LSRA}" = "xyes")
581    
582 if test x"${ENABLE_LSRA}" = "xyes"; then
583     AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
584 fi
585
586
587 dnl check if profiling should be supported
588 AC_MSG_CHECKING(whether profiling should be supported)
589 AC_ARG_ENABLE([profiling],
590               [AS_HELP_STRING(--enable-profiling,enable profiling [[default=no]])],
591               [case "${enableval}" in
592                    yes) ENABLE_PROFILING=yes;;
593                    *) ENABLE_PROFILING=no;;
594                esac],
595               [ENABLE_PROFILING=no])
596 AC_MSG_RESULT(${ENABLE_PROFILING})
597 AM_CONDITIONAL([ENABLE_PROFILING], test x"${ENABLE_PROFILING}" = "xyes")
598    
599 if test x"${ENABLE_PROFILING}" = "xyes"; then
600     AC_DEFINE([ENABLE_PROFILING], 1, [enable profiling])
601 fi
602
603
604 dnl check for instruction scheduler
605 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
606
607 AC_MSG_CHECKING(whether instruction scheduler should be supported)
608 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
609         case "${ARCH_DIR}" in
610                 xdspcore )
611                         ;;
612                 * )
613                         AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
614                         ;;
615         esac
616
617         AC_MSG_RESULT(yes)
618         AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
619         AM_CONDITIONAL([USE_SCHEDULER], [true])
620 else
621         AC_MSG_RESULT(no)
622         AM_CONDITIONAL([USE_SCHEDULER], [false])
623 fi
624
625
626 dnl check if zlib should be used
627 AC_MSG_CHECKING(whether ZIP/JAR archives should be supported)
628 AC_ARG_ENABLE([zlib],
629               [AS_HELP_STRING(--disable-zlib,disable ZIP/JAR archive support (needs zlib) [[default=yes]])],
630               [case "${enableval}" in
631                   no) ENABLE_ZLIB=no;;
632                   *) ENABLE_ZLIB=yes;;
633                esac],
634               [ENABLE_ZLIB=yes])
635 AC_MSG_RESULT(${ENABLE_ZLIB})
636
637 if test x"${ENABLE_ZLIB}" = "xyes"; then
638     AC_CHECK_HEADERS([zconf.h],, [AC_MSG_ERROR(cannot find zconf.h)])
639     AC_CHECK_HEADERS([zlib.h],, [AC_MSG_ERROR(cannot find zlib.h)])
640     AC_CHECK_LIB(z, inflate,, [AC_MSG_ERROR(cannot find libz)])
641     AC_DEFINE([ENABLE_ZLIB], 1, [use zlib])
642 fi
643 AM_CONDITIONAL([ENABLE_ZLIB], test x"${ENABLE_ZLIB}" = "xyes")
644
645
646 dnl check if a libjvm.so should be built
647 AC_MSG_CHECKING(whether to build a libjvm.so)
648 AC_ARG_ENABLE([libjvm],
649               [AS_HELP_STRING(--disable-libjvm,build a libjvm.so [[default=yes]])],
650               [case "${enableval}" in
651                   no) ENABLE_LIBJVM=no;;
652                   *) ENABLE_LIBJVM=yes;;
653                esac],
654               [ENABLE_LIBJVM=yes])
655 AC_MSG_RESULT(${ENABLE_LIBJVM})
656 AM_CONDITIONAL([ENABLE_LIBJVM], test x"${ENABLE_LIBJVM}" = "xyes")
657 AC_SUBST(ENABLE_LIBJVM)
658
659 if test x"${ENABLE_LIBJVM}" = "xyes"; then
660     AC_DEFINE([ENABLE_LIBJVM], 1, [enable libjvm.so])
661
662     dnl set AC_ENABLE_SHARED and AC_DISABLE_STATIC properly
663     enable_shared=yes
664     enable_static=no
665 else
666     enable_shared=no
667     enable_static=yes
668 fi
669
670 dnl libtool stuff
671 AC_LIBTOOL_DLOPEN
672 AC_PROG_LIBTOOL
673
674
675 dnl check if CACAO should be linked statically
676 AC_MSG_CHECKING(whether to link CACAO statically)
677 AC_ARG_ENABLE([staticvm],
678               [AS_HELP_STRING(--enable-staticvm,link CACAO statically [[default=no]])],
679               [case "${enableval}" in
680                   yes) ENABLE_STATICVM=yes
681                        AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
682                        ;;
683                   *) ENABLE_STATICVM=no;;
684                esac],
685               [ENABLE_STATICVM=no])
686 AC_MSG_RESULT(${ENABLE_STATICVM})
687 AM_CONDITIONAL([ENABLE_STATICVM], test x"${ENABLE_STATICVM}" = "xyes")
688 AC_SUBST(ENABLE_STATICVM)
689
690
691 dnl where is CACAO's vm.zip
692 AC_MSG_CHECKING(where CACAO's vm.zip is installed)
693 AC_ARG_WITH([vm-zip],
694             [AS_HELP_STRING(--with-vm-zip,path to CACAO's vm.zip (includes the name of the file and may be flat) [[default=/usr/local/cacao/share/cacao/vm.zip]])],
695             [CACAO_VM_ZIP=${withval}],
696             [CACAO_VM_ZIP=${CACAO_PREFIX}/share/cacao/vm.zip])
697 AC_MSG_RESULT(${CACAO_VM_ZIP})
698 AC_DEFINE_UNQUOTED([CACAO_VM_ZIP], "${CACAO_VM_ZIP}", [CACAO's vm.zip])
699 AC_SUBST(CACAO_VM_ZIP)
700
701
702 dnl is GNU classpath installed somewhere different
703 AC_MSG_CHECKING(where GNU Classpath is installed)
704 AC_ARG_WITH([classpath-prefix],
705             [AS_HELP_STRING(--with-classpath-prefix=<dir>,installation directory of GNU Classpath [[default=/usr/local/classpath]])],
706             [CLASSPATH_PREFIX=${withval}],
707             [CLASSPATH_PREFIX=/usr/local/classpath])
708 AC_MSG_RESULT(${CLASSPATH_PREFIX})
709 AC_DEFINE_UNQUOTED([CLASSPATH_PREFIX], "${CLASSPATH_PREFIX}", [GNU Classpath installation directory])
710 AC_SUBST(CLASSPATH_PREFIX)
711
712
713 dnl where is GNU Classpath's glibj.zip
714 AC_MSG_CHECKING(where GNU Classpath's glibj.zip is installed)
715 AC_ARG_WITH([classpath-glibj-zip],
716             [AS_HELP_STRING(--with-classpath-glibj-zip,path to GNU Classpath's glibj.zip (includes the name of the file and may be flat) [[default=/usr/local/classpath/share/classpath/glibj.zip]])],
717             [CLASSPATH_GLIBJ_ZIP=${withval}],
718             [CLASSPATH_GLIBJ_ZIP=${CLASSPATH_PREFIX}/share/classpath/glibj.zip])
719 AC_MSG_RESULT(${CLASSPATH_GLIBJ_ZIP})
720 AC_DEFINE_UNQUOTED([CLASSPATH_GLIBJ_ZIP], "${CLASSPATH_GLIBJ_ZIP}", [GNU Classpath's glibj.zip])
721 AC_SUBST(CLASSPATH_GLIBJ_ZIP)
722
723
724 dnl where are the GNU Classpath libraries installed
725 AC_MSG_CHECKING(where GNU Classpath libraries are installed)
726 AC_ARG_WITH([classpath-libdir],
727             [AS_HELP_STRING(--with-classpath-libdir=<dir>,installation directory of GNU Classpath libraries [[default=/usr/local/classpath/lib]])],
728             [CLASSPATH_LIBDIR=${withval}],
729             [CLASSPATH_LIBDIR=${CLASSPATH_PREFIX}/lib])
730 AC_MSG_RESULT(${CLASSPATH_LIBDIR})
731
732 dnl expand CLASSPATH_LIBDIR to something that is usable in C code
733 AS_AC_EXPAND([CLASSPATH_LIBDIR], ${CLASSPATH_LIBDIR})
734 AC_DEFINE_UNQUOTED([CLASSPATH_LIBDIR], "${CLASSPATH_LIBDIR}", [GNU Classpath libraries installation directory])
735 AC_SUBST(CLASSPATH_LIBDIR)
736
737
738 dnl where are the GNU Classpath headers installed
739 AC_MSG_CHECKING(where GNU Classpath headers are installed)
740 AC_ARG_WITH([classpath-includedir],
741             [AS_HELP_STRING(--with-classpath-includedir=<dir>,installation directory of GNU Classpath headers [[default=/usr/local/classpath/include]])],
742             [CLASSPATH_INCLUDEDIR=${withval}],
743             [CLASSPATH_INCLUDEDIR=${CLASSPATH_PREFIX}/include])
744 AC_MSG_RESULT(${CLASSPATH_INCLUDEDIR})
745
746 AC_CHECK_HEADER([${CLASSPATH_INCLUDEDIR}/jni.h],
747                 [AC_DEFINE_UNQUOTED([CLASSPATH_JNI_H], "${CLASSPATH_INCLUDEDIR}/jni.h", [GNU Classpath jni.h header])],
748                 [AC_MSG_ERROR(cannot find jni.h)])
749
750
751 dnl check if GNU Classpath should be linked statically into CACAO
752 AC_MSG_CHECKING(whether to link GNU Classpath native libraries statically into CACAO)
753 AC_ARG_WITH([static-classpath],
754             [AS_HELP_STRING(--with-static-classpath,link GNU classpath native libraries statically into CACAO [[default=no]])],
755             [case "${enableval}" in
756                 yes) WITH_STATIC_CLASSPATH=yes;;
757                 *) WITH_STATIC_CLASSPATH=no;;
758              esac],
759             [WITH_STATIC_CLASSPATH=no])
760 AC_MSG_RESULT(${WITH_STATIC_CLASSPATH})
761
762 if test x"${WITH_STATIC_CLASSPATH}" = "xyes"; then
763     AC_DEFINE([WITH_STATIC_CLASSPATH], 1, [link GNU classpath native libraries statically into CACAO])
764
765     dnl check for some classpath related stuff when we link statically
766     AM_ICONV_LINK
767 else
768     AC_CHECK_HEADERS([ltdl.h],, [AC_MSG_ERROR(cannot find ltdl.h)])
769     AC_CHECK_LIB(ltdl, lt_dlopen,, [AC_MSG_ERROR(cannot find libltdl)])
770 fi
771 AM_CONDITIONAL([WITH_STATIC_CLASSPATH], test x"${WITH_STATIC_CLASSPATH}" = "xyes")
772 AC_SUBST(WITH_STATIC_CLASSPATH)
773
774
775 dnl check for some programs we need
776 AC_PROG_JAVAC
777 AC_PROG_JAR
778
779
780 dnl now configure subpackages
781 dnl the export is not my favorite (is there another way?)
782 export CFLAGS
783 AC_CONFIG_SUBDIRS(src/boehm-gc)
784
785
786 dnl finally pass CFLAGS to Makefiles via AM_CFLAGS
787 CFLAGS=$OPT_CFLAGS
788 AM_CFLAGS=$ARCH_CFLAGS
789 AC_SUBST(AM_CFLAGS)
790
791
792 AC_CONFIG_FILES([Makefile]
793                 [contrib/Makefile]
794                 [contrib/setenvinstalled]
795                 [contrib/setenvsource]
796                 [doc/Makefile]
797                 [doc/handbook/Makefile]
798                 [man/Makefile]
799                 [src/Makefile]
800                 [src/cacao/Makefile]
801                 [src/cacaoh/Makefile]
802                 [src/fdlibm/Makefile]
803                 [src/lib/Makefile]
804                 [src/mm/Makefile]
805                 [src/native/Makefile]
806                 [src/native/include/Makefile]
807                 [src/native/jvmti/Makefile]
808                 [src/native/tools/Makefile]
809                 [src/native/vm/Makefile]
810                 [src/scripts/Makefile]
811                 [src/scripts/java]
812                 [src/scripts/rmic]
813                 [src/scripts/rmiregistry]
814                 [src/threads/Makefile]
815                 [src/threads/native/Makefile]
816                 [src/toolbox/Makefile]
817                 [src/vm/Makefile]
818                 [src/vm/jit/Makefile]
819                 [src/vm/jit/allocator/Makefile]
820                 [src/vm/jit/alpha/Makefile]
821                 [src/vm/jit/alpha/freebsd/Makefile]
822                 [src/vm/jit/alpha/linux/Makefile]
823                 [src/vm/jit/i386/Makefile]
824                 [src/vm/jit/i386/freebsd/Makefile]
825                 [src/vm/jit/i386/linux/Makefile]
826                 [src/vm/jit/ifconv/Makefile]
827                 [src/vm/jit/intrp/Makefile]
828                 [src/vm/jit/inline/Makefile]
829                 [src/vm/jit/loop/Makefile]
830                 [src/vm/jit/mips/Makefile]
831                 [src/vm/jit/mips/irix/Makefile]
832                 [src/vm/jit/mips/linux/Makefile]
833                 [src/vm/jit/powerpc/Makefile]
834                 [src/vm/jit/powerpc/darwin/Makefile]
835                 [src/vm/jit/powerpc/linux/Makefile]
836                 [src/vm/jit/powerpc/netbsd/Makefile]
837                 [src/vm/jit/powerpc64/Makefile]
838                 [src/vm/jit/powerpc64/linux/Makefile]
839                 [src/vm/jit/profile/Makefile]
840                 [src/vm/jit/schedule/Makefile]
841                 [src/vm/jit/sparc64/Makefile]
842                 [src/vm/jit/sparc64/linux/Makefile]
843                 [src/vm/jit/tools/Makefile]
844                 [src/vm/jit/verify/Makefile]
845                 [src/vm/jit/x86_64/Makefile]
846                 [tests/Makefile]
847                 [tests/regression/Makefile]
848                 [tests/regression/codepatching/Makefile]
849                 [tests/regression/native/Makefile])
850
851 AC_OUTPUT
852
853
854 ## Local variables:
855 ## mode: m4
856 ## indent-tabs-mode: t
857 ## c-basic-offset: 4
858 ## tab-width: 8
859 ## compile-command: "automake --add-missing"
860 ## End: