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