1 # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
6 # Permission is hereby granted to use or copy this program
7 # for any purpose, provided the above notices are retained on all copies.
8 # Permission to modify the code and to distribute modified code is granted,
9 # provided the above notices are retained, and a notice that the code was
10 # modified is included with the above copyright notice.
12 # Original author: Tom Tromey
13 # Modified by: Grzegorz Jakacki <jakacki at acm dot org>
15 dnl Process this file with autoconf to produce configure.
20 AC_INIT(gc,7.1,Hans.Boehm@hp.com)
21 ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)?
22 AC_CONFIG_SRCDIR(gcj_mlc.c)
25 AC_REVISION($Revision: 1.35 $)
27 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
37 ## FIXME: really needed? (AC_LIBTOOL already provides this)
39 AC_CHECK_TOOL(RANLIB, ranlib, :) # :)
43 . ${srcdir}/configure.host
45 GC_CFLAGS=${gc_cflags}
48 AC_ARG_ENABLE(threads,
49 [AC_HELP_STRING([--enable-threads=TYPE], [choose threading package])],
51 [ AC_MSG_CHECKING([for thread model used by GCC])
52 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
53 if test -z "$THREADS"; then
56 AC_MSG_RESULT([$THREADS]) ])
58 AC_ARG_ENABLE(parallel-mark,
59 [AC_HELP_STRING([--enable-parallel-mark],
60 [parallelize marking and free list construction])],
63 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
68 AC_ARG_ENABLE(cplusplus,
69 [AC_HELP_STRING([--enable-cplusplus], [install C++ support])])
71 INCLUDES=-I${srcdir}/include
73 need_atomic_ops_asm=false
74 ## Libraries needed to support dynamic loading and/or threads.
81 THREADDLLIBS=-lpthread
83 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
84 AC_DEFINE(GC_LINUX_THREADS)
86 if test "${enable_parallel_mark}" = yes; then
87 AC_DEFINE(PARALLEL_MARK)
89 AC_DEFINE(THREAD_LOCAL_ALLOC)
90 AC_MSG_WARN("Explict GC_INIT() calls may be required.");
93 AC_DEFINE(GC_LINUX_THREADS)
97 AC_DEFINE(GC_AIX_THREADS)
101 AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")
102 AC_DEFINE(GC_HPUX_THREADS)
103 AC_DEFINE(_POSIX_C_SOURCE,199506L)
104 if test "${enable_parallel_mark}" = yes; then
105 AC_DEFINE(PARALLEL_MARK)
107 AC_DEFINE(THREAD_LOCAL_ALLOC)
108 AC_MSG_WARN("Explict GC_INIT() calls may be required.");
109 THREADDLLIBS="-lpthread -lrt"
110 # HPUX needs REENTRANT for the _r calls.
111 AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
114 AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
117 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
118 AC_DEFINE(GC_FREEBSD_THREADS)
119 INCLUDES="$INCLUDES -pthread"
122 AC_DEFINE(GC_FREEBSD_THREADS)
123 INCLUDES="$INCLUDES -pthread"
124 THREADDLLIBS=-pthread
125 AC_DEFINE(_REENTRANT)
126 if test "${enable_parallel_mark}" = yes; then
127 AC_DEFINE(PARALLEL_MARK)
129 AC_DEFINE(THREAD_LOCAL_ALLOC)
130 AC_DEFINE(USE_COMPILER_TLS)
133 AC_DEFINE(GC_GNU_THREADS)
134 AC_DEFINE(_REENTRANT)
135 AC_DEFINE(THREAD_LOCAL_ALLOC)
138 AC_MSG_WARN("Only on NetBSD 2.0 or later.")
139 AC_DEFINE(GC_NETBSD_THREADS)
140 AC_DEFINE(_REENTRANT)
142 THREADDLLIBS="-lpthread -lrt"
145 AC_DEFINE(GC_SOLARIS_THREADS)
146 AC_DEFINE(THREAD_LOCAL_ALLOC)
147 THREADDLLIBS="-lpthread -lrt"
148 if test "$GCC" != yes; then
150 need_atomic_ops_asm=true
154 AC_DEFINE(GC_IRIX_THREADS)
157 AC_DEFINE(GC_WIN32_THREADS)
158 AC_DEFINE(THREAD_LOCAL_ALLOC)
162 AC_DEFINE(GC_DARWIN_THREADS)
163 AC_DEFINE(THREAD_LOCAL_ALLOC)
164 AC_MSG_WARN("Explict GC_INIT() calls may be required.");
165 # Parallel-mark is currently unreliable on Darwin; ignore request
166 # if test "${enable_parallel_mark}" = yes; then
167 # AC_DEFINE(PARALLEL_MARK)
172 AC_DEFINE(GC_OSF1_THREADS)
173 if test "${enable_parallel_mark}" = yes; then
174 AC_DEFINE(PARALLEL_MARK)
175 AC_DEFINE(THREAD_LOCAL_ALLOC)
176 AC_MSG_WARN("Explict GC_INIT() calls may be required.");
177 # May want to enable it in other cases, too.
178 # Measurements havent yet been done.
180 INCLUDES="$INCLUDES -pthread"
181 THREADDLLIBS="-lpthread -lrt"
184 AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
189 AC_DEFINE(GC_WIN32_THREADS)
190 dnl Wine getenv may not return NULL for missing entry
195 AC_MSG_RESULT($THREADDLLIBS)
196 # Use pthread GCC switch
197 THREADDLLIBS=-pthread
198 if test "${enable_parallel_mark}" = yes; then
199 AC_DEFINE(PARALLEL_MARK)
201 AC_DEFINE(THREAD_LOCAL_ALLOC)
202 AC_MSG_WARN("Explict GC_INIT() calls may be required.");
203 AC_DEFINE(GC_DGUX386_THREADS)
204 AC_DEFINE(DGUX_THREADS)
205 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
206 INCLUDES="-pthread $INCLUDES"
210 THREADDLLIBS=-lpthread
211 AC_DEFINE(GC_AIX_THREADS)
212 AC_DEFINE(_REENTRANT)
214 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
215 AC_MSG_ERROR(thread package $THREADS not yet supported)
218 AC_MSG_ERROR($THREADS is an unknown thread package)
221 AC_SUBST(THREADDLLIBS)
222 AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
223 AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
224 AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
225 AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
233 # Darwin needs a few extra special tests to deal with variation in the
237 AC_CHECK_MEMBER(ppc_thread_state_t.r0,
238 AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
239 [ppc_thread_state_t has field r0]),,
240 [#include <mach/thread_status.h>])
241 AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
242 AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
243 [ppc_thread_state_t has field __r0]),,
244 [#include <mach/thread_status.h>])
245 AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
246 AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
247 [ppc_thread_state64_t has field r0]),,
248 [#include <mach/thread_status.h>])
249 AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
250 AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
251 [ppc_thread_state64_t has field __r0]),,
252 [#include <mach/thread_status.h>])
255 AC_CHECK_MEMBER(x86_thread_state32_t.eax,
256 AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
257 [x86_thread_state32_t has field eax]),,
258 [#include <sys/cdefs.h>
259 #include <mach/thread_status.h>])
260 AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
261 AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
262 [x86_thread_state32_t has field __eax]),,
263 [#include <sys/cdefs.h>
264 #include <mach/thread_status.h>])
267 AC_CHECK_MEMBER(x86_thread_state64_t.rax,
268 AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
269 [x86_thread_state64_t has field rax]),,
270 [#include <sys/cdefs.h>
271 #include <mach/thread_status.h>])
272 AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
273 AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
274 [x86_thread_state64_t has field __rax]),,
275 [#include <sys/cdefs.h>
276 #include <mach/thread_status.h>])
281 AC_MSG_CHECKING(for xlc)
286 ], [compiler_xlc=yes], [compiler_xlc=no])
287 AC_MSG_RESULT($compiler_xlc)
288 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
289 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
290 # the darwin stack-frame-walking code is completely broken on xlc
291 AC_DEFINE(DARWIN_DONT_PARSE_STACK)
294 # We never want libdl on darwin. It is a fake libdl that just ends up making
299 AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
310 AM_CONDITIONAL(AVOID_CPP_LIB,test $avoid_cpp_lib = yes)
312 # extra LD Flags which are required for targets
315 extra_ldflags_libgc=-Wl,-single_module
318 AC_SUBST(extra_ldflags_libgc)
320 AC_SUBST(EXTRA_TEST_LIBS)
325 dnl If the target is an eCos system, use the appropriate eCos
327 dnl FIXME: this should not be a local option but a global target
328 dnl system; at present there is no eCos target.
331 [ --with-ecos enable runtime eCos target support],
332 TARGET_ECOS="$with_ecos"
338 case "$TARGET_ECOS" in
343 CXXINCLUDES="-I${TARGET_ECOS}/include"
344 addobjs="$addobjs ecos.lo"
348 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
353 AC_SUBST(CXXINCLUDES)
355 # Configuration of shared libraries
357 AC_MSG_CHECKING(whether to build shared libraries)
368 AC_MSG_RESULT($enable_shared)
370 # Configuration of machine-dependent code
372 AC_MSG_CHECKING(which machine-dependent code should be used)
376 machdep="mach_dep.lo"
377 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
378 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
382 machdep="mach_dep.lo"
384 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
385 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
388 machdep="mach_dep.lo"
389 AC_DEFINE(STACKBASE, __stackbase)
390 AC_DEFINE(DATASTART_IS_ETEXT)
393 machdep="mach-dep.lo"
395 mips-nec-sysv*|mips-unknown-sysv*)
400 machdep="mach_dep.lo"
401 dnl AC_DEFINE(NO_EXECUTE_PERMISSION)
402 dnl This is now redundant, but it is also important for incremental GC
403 dnl performance under Irix.
406 machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
408 sparc-sun-solaris2.3)
409 machdep="mach_dep.lo sparc_mach_dep.lo"
410 AC_DEFINE(SUNOS53_SHARED_LIB)
412 sparc*-sun-solaris2.*)
413 machdep="mach_dep.lo sparc_mach_dep.lo"
416 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
419 if test x"$machdep" = x; then
420 AC_MSG_RESULT($machdep)
421 machdep="mach_dep.lo"
423 addobjs="$addobjs $machdep"
430 # Check for AViiON Machines running DGUX
433 AC_CHECK_HEADER(sys/dg_sys_info.h,
436 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
437 if test $ac_is_dgux = yes; then
438 if test "$enable_full_debug" = "yes"; then
439 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
440 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
442 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
443 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
449 dnl We use these options to decide which functions to include.
450 AC_ARG_WITH(target-subdir,
451 [ --with-target-subdir=SUBDIR
452 configuring with a cross compiler])
453 AC_ARG_WITH(cross-host,
454 [ --with-cross-host=HOST configuring with a cross compiler])
456 # automake wants to see AC_EXEEXT. But we don't need it. And having
457 # it is actually a problem, because the compiler we're passed can't
458 # necessarily do a full link. So we fool automake here.
460 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
461 # to nothing, so nothing would remain between `then' and `fi' if it
462 # were not for the `:' below.
467 dnl As of 4.13a2, the collector will not properly work on Solaris when
468 dnl built with gcc and -O. So we remove -O in the appropriate case.
469 dnl Not needed anymore on Solaris.
470 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
473 if test "$GCC" = yes; then
481 new_CFLAGS="$new_CFLAGS $i"
490 *) AC_MSG_RESULT(no) ;;
493 dnl Include defines that have become de facto standard.
494 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
495 AC_DEFINE(NO_EXECUTE_PERMISSION)
496 AC_DEFINE(ALL_INTERIOR_POINTERS)
499 dnl Interface Selection
500 dnl -------------------
502 dnl By default, make the library as general as possible.
503 dnl enable_gcj_support=no
504 AC_ARG_ENABLE(gcj-support,
505 [AC_HELP_STRING([--disable-gcj-support],
506 [Disable support for gcj.])])
507 AM_CONDITIONAL(ENABLE_GCJ_SUPPORT,
508 [test x"$enable_gcj_support" != xno])
509 if test x"$enable_gcj_support" != xno; then
510 AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj])
513 AC_ARG_ENABLE(java-finalization,
514 [AC_HELP_STRING([--disable-java-finalization],
515 [Disable support for java finalization.])])
516 if test x"$enable_java_finalization" != xno; then
517 AC_DEFINE(JAVA_FINALIZATION)
520 AC_ARG_ENABLE(atomic-uncollectable,
521 [AC_HELP_STRING([--disable-atomic-uncollectible],
522 [Disable support for atomic uncollectible allocation.])])
523 if test x"$enable_atomic_uncollectible" != x"no"; then
524 AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1,
525 [Define to enable atomic uncollectible allocation.])
528 AC_ARG_ENABLE(redirect-malloc,
529 [AC_HELP_STRING([--enable-redirect-malloc],
530 [Redirect malloc and friends to GC routines])])
532 if test "${enable_redirect_malloc}" = yes; then
533 if test "${enable_full_debug}" = yes; then
534 AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
535 AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
536 AC_DEFINE(REDIRECT_FREE, GC_debug_free)
538 AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
540 AC_DEFINE(GC_USE_DLOPEN_WRAP)
543 AC_ARG_ENABLE(large-config,
544 [AC_HELP_STRING([--enable-large-config],
545 [Optimize for large (> 100 MB) heap or root set])])
547 if test "${enable_large_config}" = yes; then
548 AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
551 dnl This is something of a hack. When cross-compiling we turn off
552 dnl some functionality. We also enable the "small" configuration.
553 dnl These is only correct when targetting an embedded system. FIXME.
554 if test -n "${with_cross_host}"; then
556 AC_DEFINE(SMALL_CONFIG)
557 AC_DEFINE(NO_DEBUGGING)
565 AC_ARG_ENABLE(gc-debug,
566 [AC_HELP_STRING([--enable-gc-debug],
567 [include full support for pointer backtracing etc.])],
568 [ if test "$enable_gc_debug" = "yes"; then
569 AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
570 AC_DEFINE(KEEP_BACK_PTRS)
571 AC_DEFINE(DBG_HDRS_ALL)
574 AC_DEFINE(MAKE_BACK_GRAPH)
575 AC_DEFINE(SAVE_CALL_COUNT, 8)
576 AC_CHECK_LIB(unwind, backtrace, [
577 AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
579 AC_MSG_WARN("Client code may need to link against libunwind.")
582 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
583 AC_DEFINE(MAKE_BACK_GRAPH)
584 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
585 AC_DEFINE(SAVE_CALL_COUNT, 8)
588 AC_DEFINE(MAKE_BACK_GRAPH)
595 AC_ARG_ENABLE(gc-assertions,
596 [AC_HELP_STRING([--enable-gc-assertions],
597 [collector-internal assertion checking])])
598 if test "${enable_gc_assertions}" = yes; then
599 AC_DEFINE(GC_ASSERTIONS)
602 AC_ARG_ENABLE(munmap,
603 [AC_HELP_STRING([--enable-munmap=N],
604 [return page to the os if empty for N collections])],
605 MUNMAP_THRESHOLD=$enableval;
608 AC_MSG_ERROR([--enable-munmap requires --enable-mmap])
612 if test "${enable_munmap}" != ""; then
614 AC_DEFINE(USE_MUNMAP)
615 if test "${MUNMAP_THRESHOLD}" = "yes"; then
618 AC_DEFINE_UNQUOTED(MUNMAP_THRESHOLD, ${MUNMAP_THRESHOLD})
621 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
627 atomic_ops_libs=-latomic_ops
628 AC_CHECK_HEADER(atomic_ops.h,
629 [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
631 for candidate in ${srcdir}/libatomic_ops*; do
636 dnl generated by alternate Makefile.
639 if test -e "$candidate"; then
645 if test -z "$ao_dir"; then
646 AC_MSG_ERROR([Missig libatomic_ops.])
648 ao_version="${ao_dir#*libatomic_ops-}"
649 AC_MSG_NOTICE([Using internal version of libatomic_ops])
651 dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
652 test -e libatomic_ops \
653 || ln -s ${ao_dir} libatomic_ops
654 AC_CONFIG_SUBDIRS(libatomic_ops)
656 dnl Also copy the source files to be linked in.
657 test -e atomic_ops.c \
658 || ln -s libatomic_ops/src/atomic_ops.c \
661 test -e atomic_ops_sysdeps.S \
662 || ln -s libatomic_ops/src/atomic_ops_sysdeps.S \
665 dnl This gets the source include files, which is often close enough.
666 dnl It also makes atomic_ops_sysdeps.S assemble.
667 GC_CFLAGS="${GC_CFLAGS} -I libatomic_ops/src"
668 maybe_libatomic_ops="libatomic_ops"
671 AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
672 test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
673 AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
674 AC_SUBST(atomic_ops_libs)
676 dnl Produce the Files
677 dnl -----------------
679 AC_CONFIG_FILES([Makefile bdw-gc.pc])
681 AC_CONFIG_COMMANDS([default],,
684 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}