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.2alpha3,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.44 $)
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* | sparc*-*-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)
191 dnl Wine getenv may not return NULL for missing entry
196 AC_MSG_RESULT($THREADDLLIBS)
197 # Use pthread GCC switch
198 THREADDLLIBS=-pthread
199 if test "${enable_parallel_mark}" = yes; then
200 AC_DEFINE(PARALLEL_MARK)
202 AC_DEFINE(THREAD_LOCAL_ALLOC)
203 AC_MSG_WARN("Explict GC_INIT() calls may be required.");
204 AC_DEFINE(GC_DGUX386_THREADS)
205 AC_DEFINE(DGUX_THREADS)
206 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
207 INCLUDES="-pthread $INCLUDES"
211 THREADDLLIBS=-lpthread
212 AC_DEFINE(GC_AIX_THREADS)
213 AC_DEFINE(_REENTRANT)
215 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
216 AC_MSG_ERROR(thread package $THREADS not yet supported)
219 AC_MSG_ERROR($THREADS is an unknown thread package)
222 AC_SUBST(THREADDLLIBS)
223 AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
224 AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
225 AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
226 AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
234 # Darwin needs a few extra special tests to deal with variation in the
238 AC_CHECK_MEMBER(ppc_thread_state_t.r0,
239 AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
240 [ppc_thread_state_t has field r0]),,
241 [#include <mach/thread_status.h>])
242 AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
243 AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
244 [ppc_thread_state_t has field __r0]),,
245 [#include <mach/thread_status.h>])
246 AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
247 AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
248 [ppc_thread_state64_t has field r0]),,
249 [#include <mach/thread_status.h>])
250 AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
251 AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
252 [ppc_thread_state64_t has field __r0]),,
253 [#include <mach/thread_status.h>])
256 AC_CHECK_MEMBER(x86_thread_state32_t.eax,
257 AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
258 [x86_thread_state32_t has field eax]),,
259 [#include <sys/cdefs.h>
260 #include <mach/thread_status.h>])
261 AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
262 AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
263 [x86_thread_state32_t has field __eax]),,
264 [#include <sys/cdefs.h>
265 #include <mach/thread_status.h>])
268 AC_CHECK_MEMBER(x86_thread_state64_t.rax,
269 AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
270 [x86_thread_state64_t has field rax]),,
271 [#include <sys/cdefs.h>
272 #include <mach/thread_status.h>])
273 AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
274 AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
275 [x86_thread_state64_t has field __rax]),,
276 [#include <sys/cdefs.h>
277 #include <mach/thread_status.h>])
282 AC_MSG_CHECKING(for xlc)
287 ], [compiler_xlc=yes], [compiler_xlc=no])
288 AC_MSG_RESULT($compiler_xlc)
289 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
290 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
291 # the darwin stack-frame-walking code is completely broken on xlc
292 AC_DEFINE(DARWIN_DONT_PARSE_STACK)
295 # We never want libdl on darwin. It is a fake libdl that just ends up making
300 AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
311 AM_CONDITIONAL(AVOID_CPP_LIB,test $avoid_cpp_lib = yes)
313 # extra LD Flags which are required for targets
316 extra_ldflags_libgc=-Wl,-single_module
319 AC_SUBST(extra_ldflags_libgc)
321 AC_SUBST(EXTRA_TEST_LIBS)
326 dnl If the target is an eCos system, use the appropriate eCos
328 dnl FIXME: this should not be a local option but a global target
329 dnl system; at present there is no eCos target.
332 [ --with-ecos enable runtime eCos target support],
333 TARGET_ECOS="$with_ecos"
339 case "$TARGET_ECOS" in
344 CXXINCLUDES="-I${TARGET_ECOS}/include"
345 addobjs="$addobjs ecos.lo"
349 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
354 AC_SUBST(CXXINCLUDES)
356 # Configuration of shared libraries
358 AC_MSG_CHECKING(whether to build shared libraries)
369 AC_MSG_RESULT($enable_shared)
371 # Configuration of machine-dependent code
373 AC_MSG_CHECKING(which machine-dependent code should be used)
377 machdep="mach_dep.lo"
378 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
379 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
383 machdep="mach_dep.lo"
385 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
386 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
389 machdep="mach_dep.lo"
390 AC_DEFINE(STACKBASE, __stackbase)
391 AC_DEFINE(DATASTART_IS_ETEXT)
394 machdep="mach-dep.lo"
396 mips-nec-sysv*|mips-unknown-sysv*)
401 machdep="mach_dep.lo"
402 dnl AC_DEFINE(NO_EXECUTE_PERMISSION)
403 dnl This is now redundant, but it is also important for incremental GC
404 dnl performance under Irix.
407 machdep="mach_dep.lo sparc_mach_dep.lo"
410 machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
413 machdep="mach_dep.lo sparc_mach_dep.lo"
415 sparc-sun-solaris2.3)
416 machdep="mach_dep.lo sparc_mach_dep.lo"
417 AC_DEFINE(SUNOS53_SHARED_LIB)
419 sparc*-sun-solaris2*)
420 machdep="mach_dep.lo sparc_mach_dep.lo"
423 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
426 if test x"$machdep" = x; then
427 AC_MSG_RESULT($machdep)
428 machdep="mach_dep.lo"
430 addobjs="$addobjs $machdep"
437 # Check for AViiON Machines running DGUX
438 # FIXME: Should this be moved down to below the gc-debug processing?
441 AC_CHECK_HEADER(sys/dg_sys_info.h,
444 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
445 if test $ac_is_dgux = yes; then
446 if test "$enable_gc_debug" = "yes"; then
447 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
448 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
450 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
451 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
457 dnl We use these options to decide which functions to include.
458 AC_ARG_WITH(target-subdir,
459 [ --with-target-subdir=SUBDIR
460 configuring with a cross compiler])
461 AC_ARG_WITH(cross-host,
462 [ --with-cross-host=HOST configuring with a cross compiler])
464 # automake wants to see AC_EXEEXT. But we don't need it. And having
465 # it is actually a problem, because the compiler we're passed can't
466 # necessarily do a full link. So we fool automake here.
468 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
469 # to nothing, so nothing would remain between `then' and `fi' if it
470 # were not for the `:' below.
475 dnl As of 4.13a2, the collector will not properly work on Solaris when
476 dnl built with gcc and -O. So we remove -O in the appropriate case.
477 dnl Not needed anymore on Solaris.
478 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
481 if test "$GCC" = yes; then
489 new_CFLAGS="$new_CFLAGS $i"
498 *) AC_MSG_RESULT(no) ;;
501 dnl Include defines that have become de facto standard.
502 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
503 AC_DEFINE(NO_EXECUTE_PERMISSION)
504 AC_DEFINE(ALL_INTERIOR_POINTERS)
507 dnl Interface Selection
508 dnl -------------------
510 dnl By default, make the library as general as possible.
511 dnl enable_gcj_support=no
512 AC_ARG_ENABLE(gcj-support,
513 [AC_HELP_STRING([--disable-gcj-support],
514 [Disable support for gcj.])])
515 AM_CONDITIONAL(ENABLE_GCJ_SUPPORT,
516 [test x"$enable_gcj_support" != xno])
517 if test x"$enable_gcj_support" != xno; then
518 AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj])
525 AC_ARG_ENABLE(gc-debug,
526 [AC_HELP_STRING([--enable-gc-debug],
527 [include full support for pointer backtracing etc.])],
528 [ if test "$enable_gc_debug" = "yes"; then
529 AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
530 AC_DEFINE(KEEP_BACK_PTRS)
531 AC_DEFINE(DBG_HDRS_ALL)
534 AC_DEFINE(MAKE_BACK_GRAPH)
535 AC_DEFINE(SAVE_CALL_COUNT, 8)
536 AC_CHECK_LIB(unwind, backtrace, [
537 AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
539 AC_MSG_WARN("Client code may need to link against libunwind.")
542 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
543 AC_DEFINE(MAKE_BACK_GRAPH)
544 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
545 AC_DEFINE(SAVE_CALL_COUNT, 8)
548 AC_DEFINE(MAKE_BACK_GRAPH)
553 AC_ARG_ENABLE(java-finalization,
554 [AC_HELP_STRING([--disable-java-finalization],
555 [Disable support for java finalization.])])
556 if test x"$enable_java_finalization" != xno; then
557 AC_DEFINE(JAVA_FINALIZATION)
560 AC_ARG_ENABLE(atomic-uncollectable,
561 [AC_HELP_STRING([--disable-atomic-uncollectible],
562 [Disable support for atomic uncollectible allocation.])])
563 if test x"$enable_atomic_uncollectible" != x"no"; then
564 AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1,
565 [Define to enable atomic uncollectible allocation.])
568 AC_ARG_ENABLE(redirect-malloc,
569 [AC_HELP_STRING([--enable-redirect-malloc],
570 [Redirect malloc and friends to GC routines])])
572 if test "${enable_redirect_malloc}" = yes; then
573 if test "${enable_gc_debug}" = yes; then
574 AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
575 AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
576 AC_DEFINE(REDIRECT_FREE, GC_debug_free)
578 AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
580 AC_DEFINE(GC_USE_DLOPEN_WRAP)
583 AC_ARG_ENABLE(large-config,
584 [AC_HELP_STRING([--enable-large-config],
585 [Optimize for large (> 100 MB) heap or root set])])
587 if test "${enable_large_config}" = yes; then
588 AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
591 dnl This is something of a hack. When cross-compiling we turn off
592 dnl some functionality. We also enable the "small" configuration.
593 dnl These is only correct when targetting an embedded system. FIXME.
594 if test -n "${with_cross_host}"; then
596 AC_DEFINE(SMALL_CONFIG)
597 AC_DEFINE(NO_DEBUGGING)
603 AC_ARG_ENABLE(gc-assertions,
604 [AC_HELP_STRING([--enable-gc-assertions],
605 [collector-internal assertion checking])])
606 if test "${enable_gc_assertions}" = yes; then
607 AC_DEFINE(GC_ASSERTIONS)
610 AC_ARG_ENABLE(munmap,
611 [AC_HELP_STRING([--enable-munmap=N],
612 [return page to the os if empty for N collections])],
613 MUNMAP_THRESHOLD=$enableval;
616 AC_MSG_ERROR([--enable-munmap requires --enable-mmap])
620 if test "${enable_munmap}" != ""; then
622 AC_DEFINE(USE_MUNMAP)
623 if test "${MUNMAP_THRESHOLD}" = "yes"; then
626 AC_DEFINE_UNQUOTED(MUNMAP_THRESHOLD, ${MUNMAP_THRESHOLD})
629 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
635 atomic_ops_libs=-latomic_ops
636 AC_CHECK_HEADER(atomic_ops.h,
637 [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
639 for candidate in ${srcdir}/libatomic_ops*; do
644 dnl generated by alternate Makefile.
647 if test -e "$candidate"; then
653 if test -z "$ao_dir"; then
654 AC_MSG_ERROR([Missig libatomic_ops.])
656 ao_version="${ao_dir#*libatomic_ops-}"
657 AC_MSG_NOTICE([Using internal version of libatomic_ops])
659 dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
660 test -e libatomic_ops \
661 || ln -s ${ao_dir} libatomic_ops
662 AC_CONFIG_SUBDIRS(libatomic_ops)
664 dnl Also copy the source files to be linked in.
665 test -e atomic_ops.c \
666 || ln -s libatomic_ops/src/atomic_ops.c \
669 test -e atomic_ops_sysdeps.S \
670 || ln -s libatomic_ops/src/atomic_ops_sysdeps.S \
673 dnl This gets the source include files, which is often close enough.
674 dnl It also makes atomic_ops_sysdeps.S assemble.
675 GC_CFLAGS="${GC_CFLAGS} -I libatomic_ops/src"
676 maybe_libatomic_ops="libatomic_ops"
679 AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
680 test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
681 AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
682 AC_SUBST(atomic_ops_libs)
684 dnl Produce the Files
685 dnl -----------------
687 AC_CONFIG_FILES([Makefile bdw-gc.pc])
689 AC_CONFIG_COMMANDS([default],,
692 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}