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