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