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