* debugSetPathes: Removed.
[cacao.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_INIT(cacao, 0.92+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 system type
16 case "$host_cpu" in
17 alpha | alphaev56 | alphapca56 )
18         ARCH_DIR="alpha"
19         CFLAGS="-mieee -D__ALPHA__"
20         ;;
21
22 arm | armv4tl | armv5b )
23         ARCH_DIR="arm"
24         CFLAGS="-D__ARM__"
25         ;;
26
27 i386 | i486 | i586 | i686 )
28         ARCH_DIR="i386"
29         CFLAGS="-D__I386__"
30         ;;
31
32 mips )
33         ARCH_DIR="mips"
34
35 dnl for MIPSPro Compiler
36 dnl     CFLAGS="-64 -OPT:Olimit=0 -woff 1110,1164,1515 -D__MIPS__ -D__MIPSEB__"
37         CFLAGS="-64 -OPT:Olimit=0 -D__MIPS__ -D__MIPSEB__"
38 dnl     CFLAGS="-D__MIPS__ -D__MIPSEB__"
39
40 dnl for GCC
41 dnl     CFLAGS="-mabi=64 -D__MIPS__ -D__MIPSEB__"
42 dnl     LDFLAGS="-mabi=64"
43         ;;
44
45 powerpc )
46         ARCH_DIR="powerpc"
47         CFLAGS="-D__POWERPC__"
48         ;;
49
50 x86_64 )
51         ARCH_DIR="x86_64"
52         CFLAGS="-D__X86_64__"
53         ;;
54
55 xdspcore )
56         ARCH_DIR="xdspcore"
57         ENABLE_STATICVM="yes"
58         CFLAGS="-D__XDSPCORE__"
59         USE_SCHEDULER="1"
60         ;;
61 * )
62         AC_MSG_ERROR($host_cpu systems are not supported at this time)
63         ;;
64 esac
65
66
67 dnl set optimization and debugging for all architectures and systems
68 CFLAGS="-O0 -g3 $CFLAGS"
69
70
71 case "$host_os" in
72 *linux* | *Linux* )
73         OS_DIR="linux"
74         CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__LINUX__ -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
75         ;;
76 *darwin* )
77         OS_DIR="darwin"
78         CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__DARWIN__"
79         ;;
80 *freebsd* )
81         OS_DIR="freebsd"
82         CFLAGS="-ansi -pedantic -Wall -Wno-long-long $CFLAGS -D__FREEBSD__ -D_XOPEN_SOURCE_EXTENDED"
83         ;;
84 *irix* )
85         OS_DIR="irix"
86         CFLAGS="$CFLAGS -D__IRIX__"
87         ;;
88 * )
89         ;;
90 esac
91
92
93 dnl define and substitute some architecture specific variables
94 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [Architecture directory])
95 AC_SUBST(ARCH_DIR)
96 AC_SUBST(OS_DIR)
97 AC_SUBST(USE_SCHEDULER)
98
99
100 dnl Checks for programs.
101 AC_PROG_CC
102 AM_PROG_AS
103 AC_PROG_LD
104 AC_PROG_LD_GNU
105 AC_PROG_RANLIB
106 AC_DISABLE_SHARED
107 AC_PROG_LN_S
108 AC_PROG_MAKE_SET
109
110 dnl libtool stuff
111 AC_LIBTOOL_DLOPEN
112 AC_LIBLTDL_CONVENIENCE
113 AC_PROG_LIBTOOL
114 AC_SUBST(LIBLTDL)
115
116 dnl Checks for header files.
117 AC_HEADER_DIRENT
118 AC_HEADER_STDC
119 AC_CHECK_HEADERS([fcntl.h])
120 AC_CHECK_HEADERS([sys/time.h])
121 AC_CHECK_HEADERS([unistd.h])
122 AC_CHECK_HEADERS([sys/ioctl.h])
123
124 dnl this is for fdlibm
125 AC_CHECK_HEADERS([stdint.h])
126 AC_CHECK_HEADERS([inttypes.h])
127 AC_CHECK_HEADERS([sys/config.h])
128 AC_CHECK_HEADERS([sys/types.h])
129 AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
130 AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
131 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]))
132 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]))
133
134 dnl Checks for typedefs, structures, and compiler characteristics.
135 AC_C_CONST
136 AC_C_INLINE
137 AC_C_ATTRIBUTE
138 AC_TYPE_OFF_T
139 AC_TYPE_SIZE_T
140 AC_HEADER_TIME
141 AC_STRUCT_TM
142
143 dnl Checks for library functions.
144 AC_PROG_GCC_TRADITIONAL
145 AC_FUNC_MEMCMP
146 AC_FUNC_MMAP
147 AC_TYPE_SIGNAL
148 AC_CHECK_FUNCS(getcwd gettimeofday mkdir mktime select socket)
149
150 dnl Checks for libraries.
151
152 dnl Checking sizeof void *
153 AC_COMPILE_CHECK_SIZEOF(void *)
154 AC_C_BIGENDIAN
155
156 dnl Check for mmap header anomalies (missing MAP_FAILED, etc.)
157 if test $ac_cv_func_mmap_fixed_mapped = yes; then
158         AC_CACHE_CHECK(whether MAP_FAILED is defined,
159                        ac_cv_map_failed,
160                        AC_EGREP_CPP(yes, 
161                                     [#include <sys/mman.h>
162                                      #ifdef MAP_FAILED
163                                         yes
164                                      #endif],
165                                     ac_cv_map_failed=yes,
166                                     ac_cv_map_failed=no))
167
168         AC_CACHE_CHECK(whether MAP_ANONYMOUS is defined,
169                        ac_cv_map_anonymous,
170                        AC_EGREP_CPP(yes, 
171                                     [#include <sys/mman.h>
172                                      #ifdef MAP_ANONYMOUS
173                                         yes
174                                      #endif],
175                                     ac_cv_map_anonymous=yes,
176                                     ac_cv_map_anonymous=no))
177
178         AC_CACHE_CHECK(whether MAP_ANON is defined,
179                        ac_cv_map_anon,
180                        AC_EGREP_CPP(yes, 
181                                     [#include <sys/mman.h>
182                                      #ifdef MAP_ANON
183                                         yes
184                                      #endif],
185                                     ac_cv_map_anon=yes,
186                                     ac_cv_map_anon=no))
187
188         if test $ac_cv_map_failed = yes; then
189                 AC_DEFINE([HAVE_MAP_FAILED], 1, [Define if <sys/mman.h> defines MAP_FAILED])
190         fi
191
192         if test $ac_cv_map_anonymous = yes; then
193                 AC_DEFINE([HAVE_MAP_ANONYMOUS], 1, [Define if <sys/mman.h> defines MAP_ANONYMOUS])
194         fi
195
196         if test $ac_cv_map_anon = yes; then
197                 AC_DEFINE([HAVE_MAP_ANON], 1, [Define if <sys/mman.h> defines MAP_ANON])
198         fi
199 fi
200
201
202 dnl check which ld flags are required to export symbols
203 if test x"$with_gnu_ld" = "xyes"; then
204         EXPORT_SYMBOLS_FLAGS="-Wl,--export-dynamic"
205 else
206         EXPORT_SYMBOLS_FLAGS=""
207 fi
208 AC_SUBST(EXPORT_SYMBOLS_FLAGS)
209
210
211 dnl define install prefix
212 if test "x$prefix" = "xNONE"; then
213         CACAO_INSTALL_PREFIX=$ac_default_prefix
214 else
215         CACAO_INSTALL_PREFIX=$prefix
216 fi
217 AC_DEFINE_UNQUOTED([CACAO_INSTALL_PREFIX], "${CACAO_INSTALL_PREFIX}", [Installation prefix])
218 AC_SUBST(CACAO_INSTALL_PREFIX)
219
220
221 dnl Features
222
223 dnl check arguments
224
225 dnl check for JIT compiler
226 AC_ARG_ENABLE([jit], [AS_HELP_STRING(--disable-jit,disable JIT compiler [[default=yes]])])
227
228 AC_MSG_CHECKING(whether JIT compiled should be compiled)
229 if test x"$enable_jit" = "xno"; then
230         AC_MSG_RESULT(no)
231         AM_CONDITIONAL([ENABLE_JIT], [false])
232 else
233         AC_MSG_RESULT(yes)
234         AC_DEFINE([ENABLE_JIT], 1, [enable JIT compiler])
235         AM_CONDITIONAL([ENABLE_JIT], [true])
236 fi
237
238 dnl check for interpreter
239 AC_ARG_ENABLE([intrp], [AS_HELP_STRING(--enable-intrp,enable interpreter [[default=no]])])
240
241 AC_MSG_CHECKING(whether interpreter should be compiled)
242 if test x"$enable_intrp" = "xyes"; then
243         AC_MSG_RESULT(yes)
244         AC_DEFINE([ENABLE_INTRP], 1, [enable interpreter])
245         AM_CONDITIONAL([ENABLE_INTRP], [true])
246         ENABLE_INTRP="yes"
247 else
248         AC_MSG_RESULT(no)
249         AM_CONDITIONAL([ENABLE_INTRP], [false])
250         ENABLE_INTRP="no"
251 fi
252
253 if test x"${ENABLE_JIT}" = "xno" -a x"${ENABLE_INTRP}" = "xno"; then
254         AC_ERROR(You have to enable at least the JIT or the interpreter.)
255 fi
256 if test x"${ENABLE_JIT}" = "xyes" -a x"${ENABLE_INTRP}" = "xyes"; then
257         AC_ERROR(This is currently not supported. Please disable the JIT or the interpreter.)
258 fi
259
260 dnl check for garbage collector usage
261 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])])
262
263 AC_MSG_CHECKING(whether GC should be used)
264 if test x"$enable_gc" = "xno"; then
265         AC_MSG_RESULT(no)
266         AM_CONDITIONAL([DISABLE_GC], [true])
267         DISABLE_GC="yes"
268 else
269         AC_MSG_RESULT(yes)
270         AM_CONDITIONAL([DISABLE_GC], [false])
271         DISABLE_GC="no"
272 fi
273
274 dnl check for dump memory usage
275 AC_ARG_ENABLE([gc], [AS_HELP_STRING(--disable-dump,disable dump memory (for debugging only!) [[default=yes]])])
276
277 AC_MSG_CHECKING(whether dump memory should be used)
278 if test x"$enable_dump" = "xno"; then
279         AC_MSG_RESULT(no)
280         AC_DEFINE([DISABLE_DUMP], 1, [disable dump memory])
281 else
282         AC_MSG_RESULT(yes)
283 fi
284
285 dnl check for statistics
286 AC_ARG_ENABLE([statistics], [AS_HELP_STRING(--disable-statistics,disable statistics generation [[default=yes]])])
287
288 AC_MSG_CHECKING(whether statistics generation should be enabled)
289 if test x"$enable_statistics" = "xno"; then
290         AC_MSG_RESULT(no)
291         AM_CONDITIONAL([STATISTICS], [false])
292 else
293         AC_MSG_RESULT(yes)
294         AC_DEFINE([STATISTICS], 1, [use statistics])
295         AM_CONDITIONAL([STATISTICS], [true])
296 fi
297
298 dnl check for JVMTI
299 AC_ARG_ENABLE([jvmti], [AS_HELP_STRING(--enable-jvmti,enable JVMTI [[default=no]])])
300
301 AC_MSG_CHECKING(whether to compile JVMTI support)
302 if test x"$enable_jvmti" = "xyes"; then
303         AC_MSG_RESULT(yes)
304         AC_DEFINE([ENABLE_JVMTI], 1, [use JVMTI])
305         AM_CONDITIONAL([ENABLE_JVMTI], [true])
306 else
307         AC_MSG_RESULT(no)
308         AM_CONDITIONAL([ENABLE_JVMTI], [false])
309 fi
310
311
312 dnl threads
313 AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
314 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
315
316 AC_MSG_CHECKING(whether to include threads support)
317 enable_threads=${enable_threads:-native}
318 case "$enable_threads" in
319 no | none | single)
320         AC_MSG_RESULT(no)
321         dnl no threads for boehm
322         ac_configure_args="$ac_configure_args --disable-boehm-threads"
323         AM_CONDITIONAL([USE_THREADS], [false])
324         AM_CONDITIONAL([NATIVE_THREADS], [false])
325         ;;
326
327 green | native | posix | pthreads)
328         AC_DEFINE([USE_THREADS], 1, [use threads])
329         AC_DEFINE([EXTERNAL_OVERFLOW], 1, [external overflow])
330         AC_DEFINE([DONT_FREE_FIRST], 1, [don't free first])
331
332         AM_CONDITIONAL([USE_THREADS], [true])
333
334         if test x"$enable_threads" != "xgreen"; then
335                 AC_MSG_RESULT(yes, native)
336                 AC_CHECK_LIB(pthread, main)
337                 AC_DEFINE([NATIVE_THREADS], 1, [use pthreads])
338
339                 CFLAGS="$CFLAGS -D_REENTRANT"
340
341                 dnl tell boehm to support threads as well
342                 ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
343                 AM_CONDITIONAL([NATIVE_THREADS], [true])
344
345         else
346                 AC_MSG_RESULT(yes, green)
347
348                 dnl no threads for boehm
349                 ac_configure_args="$ac_configure_args --disable-boehm-threads"
350                 AM_CONDITIONAL([NATIVE_THREADS], [false])
351         fi
352     ;;
353 *)
354     AC_MSG_ERROR($enable_threads is an unknown thread package)
355     ;;
356 esac
357
358
359 dnl Check whether the compiler supports the __thread keyword.
360 if test "x$use__thread" != xno; then
361   AC_CACHE_CHECK([for __thread], ac_cv_gcc___thread,
362   [cat > conftest.c <<\EOF
363 __thread int a = 42;
364 EOF
365   if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
366     ac_cv_gcc___thread=yes 
367   else
368     ac_cv_gcc___thread=no
369   fi
370   rm -f conftest*])
371   if test "$ac_cv_gcc___thread" = yes; then
372     AC_DEFINE([HAVE___THREAD], 1, [have __thread])
373   fi
374 else
375   ac_cv_gcc___thread=no
376 fi
377
378
379 dnl check if linear scan register allocator(lsra) should be used
380 AC_ARG_ENABLE([lsra], [AS_HELP_STRING(--enable-lsra,enable linear scan register allocator [[default=yes]])])
381
382 AC_MSG_CHECKING(whether lsra should be supported)
383 if test x"$enable_lsra" = "xno"; then
384         AC_MSG_RESULT(no)
385 else
386         AC_MSG_RESULT(yes)
387         AC_DEFINE([LSRA], 1, [use lsra])
388 fi
389
390
391 dnl check for inlining
392 dnl AC_ARG_ENABLE([inlining], [AS_HELP_STRING(--disable-inlining,disable method inlining [[default=yes]])])
393
394 dnl AC_MSG_CHECKING(whether method inlining should be disabled)
395 dnl if test x"$enable_inlining" = "xno"; then
396 dnl     AC_MSG_RESULT(yes)
397 dnl     AM_CONDITIONAL([USE_INLINING], [false])
398 dnl else
399 dnl     AC_MSG_RESULT(no)
400         AC_DEFINE([USE_INLINING], 1, [use method inlining])
401         AM_CONDITIONAL([USE_INLINING], [true])
402 dnl fi
403
404
405 dnl check for instruction scheduler
406 AC_ARG_ENABLE([scheduler], [AS_HELP_STRING(--enable-scheduler,enable instruction scheduler [[default=no]])])
407
408 AC_MSG_CHECKING(whether instruction scheduler should be supported)
409 if test x"${USE_SCHEDULER}" = "x1" -o x"$enable_scheduler" = "xyes"; then
410         case "${ARCH_DIR}" in
411                 xdspcore )
412                         ;;
413                 * )
414                         AC_MSG_ERROR(instruction scheduler is not available for ${ARCH_DIR} code generator)
415                         ;;
416         esac
417
418         AC_MSG_RESULT(yes)
419         AC_DEFINE([USE_SCHEDULER], 1, [use scheduler])
420         AM_CONDITIONAL([USE_SCHEDULER], [true])
421 else
422         AC_MSG_RESULT(no)
423         AM_CONDITIONAL([USE_SCHEDULER], [false])
424 fi
425
426
427 dnl check if zlib should be used
428 AC_ARG_ENABLE([zlib], [AS_HELP_STRING(--enable-zlib,enable zip archive class storage (needs zlib) [[default=yes]])])
429
430 AC_MSG_CHECKING(whether zip archives should be supported)
431 if test x"$enable_zlib" = "xno"; then
432         AC_MSG_RESULT(no)
433         AM_CONDITIONAL([USE_ZLIB], [false])
434 else
435         AC_MSG_RESULT(yes)
436         AC_DEFINE([USE_ZLIB], 1, [use zlib])
437         AC_CHECK_HEADERS([zlib.h])
438         AC_CHECK_LIB(z, main)
439         AM_CONDITIONAL([USE_ZLIB], [true])
440 fi
441
442
443 dnl check if CACAO should be linked statically
444 AC_ARG_ENABLE([staticvm], [AS_HELP_STRING(--enable-staticvm, link GNU classpath's native libraries statically into CACAO [[default=no]])])
445
446 AC_MSG_CHECKING(whether to link GNU classpath statically into CACAO)
447 if test x"$enable_staticvm" = "xyes"; then
448         ENABLE_STATICVM="yes"
449 else
450         ENABLE_STATICVM="no"
451 fi
452
453 if test x"${ENABLE_STATICVM}" = "xyes"; then
454         AC_MSG_RESULT(yes)
455         AM_CONDITIONAL([ENABLE_STATICVM], [true])
456 else
457         AC_MSG_RESULT(no)
458         AM_CONDITIONAL([ENABLE_STATICVM], [false])
459 fi
460 AC_SUBST(ENABLE_STATICVM)
461
462
463 dnl pass configure options to classpath
464 if test x"${ENABLE_STATICVM}" = "xyes"; then
465         AC_DEFINE([ENABLE_STATICVM], 1, [link CACAO statically])
466         AM_CONDITIONAL([ENABLE_STATICVM], [true])
467
468         dnl check for some classpath related stuff when we link statically
469         AM_ICONV_LINK
470 else
471         AM_CONDITIONAL([ENABLE_STATICVM], [false])
472 fi
473
474
475 dnl is GNU classpath installed somewhere different
476 AC_ARG_WITH([classpath-install-dir], [AS_HELP_STRING(--with-classpath-install-dir=<dir>,installation directory of GNU classpath [[default=/usr/local/classpath]])])
477
478 AC_MSG_CHECKING(where GNU classpath is installed)
479 if test x"$with_classpath_install_dir" != "x"; then
480         if test x"$with_classpath_install_dir" = "xyes"; then
481                 AC_MSG_ERROR(please specify the installation prefix)
482         fi
483         CLASSPATH_INSTALL_DIR="$with_classpath_install_dir"
484 else
485         CLASSPATH_INSTALL_DIR="/usr/local/classpath"
486 fi
487 AC_MSG_RESULT(${CLASSPATH_INSTALL_DIR})
488 AC_DEFINE_UNQUOTED([CLASSPATH_INSTALL_DIR], "${CLASSPATH_INSTALL_DIR}", [GNU classpath installation directory])
489 AC_SUBST(CLASSPATH_INSTALL_DIR)
490
491
492 dnl now configure subpackages
493 dnl the export is not my favorite (is there another way?)
494 export CFLAGS
495 if test x"${DISABLE_GC}" = "xno"; then
496         AC_CONFIG_SUBDIRS(src/boehm-gc)
497 fi
498
499 if test x"${ENABLE_STATICVM}" = "xno"; then
500         AC_CONFIG_SUBDIRS(src/libltdl)
501 fi
502
503 if test x"${ENABLE_INTRP}" = "xyes"; then
504         AC_CONFIG_SUBDIRS(src/libffi)
505 fi
506
507
508 AC_CONFIG_FILES([Makefile]
509                 [contrib/Makefile]
510                 [doc/Makefile]
511                 [doc/handbook/Makefile]
512                 [man/Makefile]
513                 [src/Makefile]
514                 [src/cacao/Makefile]
515                 [src/cacaoh/Makefile]
516                 [src/fdlibm/Makefile]
517                 [src/lib/Makefile]
518                 [src/mm/Makefile]
519                 [src/native/Makefile]
520                 [src/native/include/Makefile]
521                 [src/native/jvmti/Makefile]
522                 [src/native/tools/Makefile]
523                 [src/native/vm/Makefile]
524                 [src/scripts/Makefile]
525                 [src/scripts/cacao]
526                 [src/scripts/java]
527                 [src/scripts/javac]
528                 [src/scripts/rmiregistry]
529                 [src/threads/Makefile]
530                 [src/threads/green/Makefile]
531                 [src/threads/native/Makefile]
532                 [src/toolbox/Makefile]
533                 [src/vm/Makefile]
534                 [src/vm/jit/Makefile]
535                 [src/vm/jit/alpha/Makefile]
536                 [src/vm/jit/i386/Makefile]
537                 [src/vm/jit/i386/linux/Makefile]
538                 [src/vm/jit/i386/freebsd/Makefile]
539                 [src/vm/jit/intrp/Makefile]
540                 [src/vm/jit/inline/Makefile]
541                 [src/vm/jit/loop/Makefile]
542                 [src/vm/jit/mips/Makefile]
543                 [src/vm/jit/mips/irix/Makefile]
544                 [src/vm/jit/powerpc/Makefile]
545                 [src/vm/jit/powerpc/darwin/Makefile]
546                 [src/vm/jit/powerpc/linux/Makefile]
547                 [src/vm/jit/schedule/Makefile]
548                 [src/vm/jit/tools/Makefile]
549                 [src/vm/jit/verify/Makefile]
550                 [src/vm/jit/x86_64/Makefile]
551                 [tests/Makefile]
552                 [tests/codepatching/Makefile]
553                 [tests/native/Makefile]
554                 [tests/regression/Makefile])
555
556 AC_OUTPUT
557
558
559 ## Local variables:
560 ## mode: m4
561 ## indent-tabs-mode: t
562 ## c-basic-offset: 4
563 ## tab-width: 8
564 ## compile-command: "automake --add-missing"
565 ## End: