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
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_AIX_THREADS)
97
AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")
98
AC_DEFINE(GC_HPUX_THREADS)
99
AC_DEFINE(_POSIX_C_SOURCE,199506L)
100
if test "${enable_parallel_mark}" = yes; then
101
AC_DEFINE(PARALLEL_MARK)
103
AC_DEFINE(THREAD_LOCAL_ALLOC)
104
AC_MSG_WARN("Explict GC_INIT() calls may be required.");
105
THREADDLLIBS="-lpthread -lrt"
106
# HPUX needs REENTRANT for the _r calls.
107
AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
110
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
113
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
114
AC_DEFINE(GC_FREEBSD_THREADS)
115
INCLUDES="$INCLUDES -pthread"
118
AC_DEFINE(GC_FREEBSD_THREADS)
119
INCLUDES="$INCLUDES -pthread"
120
THREADDLLIBS=-pthread
121
AC_DEFINE(_REENTRANT)
122
if test "${enable_parallel_mark}" = yes; then
123
AC_DEFINE(PARALLEL_MARK)
125
AC_DEFINE(THREAD_LOCAL_ALLOC)
126
AC_DEFINE(USE_COMPILER_TLS)
129
AC_DEFINE(GC_GNU_THREADS)
130
AC_DEFINE(_REENTRANT)
131
AC_DEFINE(THREAD_LOCAL_ALLOC)
134
AC_MSG_WARN("Only on NetBSD 2.0 or later.")
135
AC_DEFINE(GC_NETBSD_THREADS)
136
AC_DEFINE(_REENTRANT)
138
THREADDLLIBS="-lpthread -lrt"
141
AC_DEFINE(GC_SOLARIS_THREADS)
142
AC_DEFINE(THREAD_LOCAL_ALLOC)
143
THREADDLLIBS="-lpthread -lrt"
144
if test "$GCC" != yes; then
146
need_atomic_ops_asm=true
150
AC_DEFINE(GC_IRIX_THREADS)
153
AC_DEFINE(GC_WIN32_THREADS)
154
AC_DEFINE(THREAD_LOCAL_ALLOC)
158
AC_DEFINE(GC_DARWIN_THREADS)
159
AC_DEFINE(THREAD_LOCAL_ALLOC)
160
AC_MSG_WARN("Explict GC_INIT() calls may be required.");
161
# Parallel-mark is currently unreliable on Darwin; ignore request
162
# if test "${enable_parallel_mark}" = yes; then
163
# AC_DEFINE(PARALLEL_MARK)
168
AC_DEFINE(GC_OSF1_THREADS)
169
if test "${enable_parallel_mark}" = yes; then
170
AC_DEFINE(PARALLEL_MARK)
171
AC_DEFINE(THREAD_LOCAL_ALLOC)
172
AC_MSG_WARN("Explict GC_INIT() calls may be required.");
173
# May want to enable it in other cases, too.
174
# Measurements havent yet been done.
176
INCLUDES="$INCLUDES -pthread"
177
THREADDLLIBS="-lpthread -lrt"
180
AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
185
AC_DEFINE(GC_WIN32_THREADS)
186
dnl Wine getenv may not return NULL for missing entry
191
AC_MSG_RESULT($THREADDLLIBS)
192
# Use pthread GCC switch
193
THREADDLLIBS=-pthread
194
if test "${enable_parallel_mark}" = yes; then
195
AC_DEFINE(PARALLEL_MARK)
197
AC_DEFINE(THREAD_LOCAL_ALLOC)
198
AC_MSG_WARN("Explict GC_INIT() calls may be required.");
199
AC_DEFINE(GC_DGUX386_THREADS)
200
AC_DEFINE(DGUX_THREADS)
201
# Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
202
INCLUDES="-pthread $INCLUDES"
206
THREADDLLIBS=-lpthread
207
AC_DEFINE(GC_AIX_THREADS)
208
AC_DEFINE(_REENTRANT)
210
decosf1 | irix | mach | os2 | solaris | dce | vxworks)
211
AC_MSG_ERROR(thread package $THREADS not yet supported)
214
AC_MSG_ERROR($THREADS is an unknown thread package)
217
AC_SUBST(THREADDLLIBS)
218
AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
219
AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
220
AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
221
AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
229
# Darwin needs a few extra special tests to deal with variation in the
233
AC_CHECK_MEMBER(ppc_thread_state_t.r0,
234
AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
235
[ppc_thread_state_t has field r0]),,
236
[#include <mach/thread_status.h>])
237
AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
238
AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
239
[ppc_thread_state_t has field __r0]),,
240
[#include <mach/thread_status.h>])
241
AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
242
AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
243
[ppc_thread_state64_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>])
251
AC_CHECK_MEMBER(x86_thread_state32_t.eax,
252
AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
253
[x86_thread_state32_t has field eax]),,
254
[#include <sys/cdefs.h>
255
#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>])
263
AC_CHECK_MEMBER(x86_thread_state64_t.rax,
264
AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
265
[x86_thread_state64_t has field rax]),,
266
[#include <sys/cdefs.h>
267
#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>])
277
AC_MSG_CHECKING(for xlc)
282
], [compiler_xlc=yes], [compiler_xlc=no])
283
AC_MSG_RESULT($compiler_xlc)
284
AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
285
if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
286
# the darwin stack-frame-walking code is completely broken on xlc
287
AC_DEFINE(DARWIN_DONT_PARSE_STACK)
290
# We never want libdl on darwin. It is a fake libdl that just ends up making
295
AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
306
AM_CONDITIONAL(AVOID_CPP_LIB,test $avoid_cpp_lib = yes)
308
# extra LD Flags which are required for targets
311
extra_ldflags_libgc=-Wl,-single_module
314
AC_SUBST(extra_ldflags_libgc)
316
AC_SUBST(EXTRA_TEST_LIBS)
321
dnl If the target is an eCos system, use the appropriate eCos
323
dnl FIXME: this should not be a local option but a global target
324
dnl system; at present there is no eCos target.
327
[ --with-ecos enable runtime eCos target support],
328
TARGET_ECOS="$with_ecos"
334
case "$TARGET_ECOS" in
339
CXXINCLUDES="-I${TARGET_ECOS}/include"
340
addobjs="$addobjs ecos.lo"
344
AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
349
AC_SUBST(CXXINCLUDES)
351
# Configuration of shared libraries
353
AC_MSG_CHECKING(whether to build shared libraries)
364
AC_MSG_RESULT($enable_shared)
366
# Configuration of machine-dependent code
368
AC_MSG_CHECKING(which machine-dependent code should be used)
372
machdep="mach_dep.lo"
373
if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
374
AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
378
machdep="mach_dep.lo"
380
i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
381
AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
384
machdep="mach_dep.lo"
385
AC_DEFINE(STACKBASE, __stackbase)
386
AC_DEFINE(DATASTART_IS_ETEXT)
389
machdep="mach-dep.lo"
391
mips-nec-sysv*|mips-unknown-sysv*)
396
machdep="mach_dep.lo"
397
dnl AC_DEFINE(NO_EXECUTE_PERMISSION)
398
dnl This is now redundant, but it is also important for incremental GC
399
dnl performance under Irix.
402
machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
404
sparc-sun-solaris2.3)
405
machdep="mach_dep.lo sparc_mach_dep.lo"
406
AC_DEFINE(SUNOS53_SHARED_LIB)
408
sparc*-sun-solaris2.*)
409
machdep="mach_dep.lo sparc_mach_dep.lo"
412
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
415
if test x"$machdep" = x; then
416
AC_MSG_RESULT($machdep)
417
machdep="mach_dep.lo"
419
addobjs="$addobjs $machdep"
426
# Check for AViiON Machines running DGUX
429
AC_CHECK_HEADER(sys/dg_sys_info.h,
432
## :GOTCHA: we do not check anything but sys/dg_sys_info.h
433
if test $ac_is_dgux = yes; then
434
if test "$enable_full_debug" = "yes"; then
435
CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
436
CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
438
CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
439
CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
445
dnl We use these options to decide which functions to include.
446
AC_ARG_WITH(target-subdir,
447
[ --with-target-subdir=SUBDIR
448
configuring with a cross compiler])
449
AC_ARG_WITH(cross-host,
450
[ --with-cross-host=HOST configuring with a cross compiler])
452
# automake wants to see AC_EXEEXT. But we don't need it. And having
453
# it is actually a problem, because the compiler we're passed can't
454
# necessarily do a full link. So we fool automake here.
456
# autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
457
# to nothing, so nothing would remain between `then' and `fi' if it
458
# were not for the `:' below.
463
dnl As of 4.13a2, the collector will not properly work on Solaris when
464
dnl built with gcc and -O. So we remove -O in the appropriate case.
465
dnl Not needed anymore on Solaris.
466
AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
469
if test "$GCC" = yes; then
477
new_CFLAGS="$new_CFLAGS $i"
486
*) AC_MSG_RESULT(no) ;;
489
dnl Include defines that have become de facto standard.
490
dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
491
AC_DEFINE(NO_EXECUTE_PERMISSION)
492
AC_DEFINE(ALL_INTERIOR_POINTERS)
495
dnl Interface Selection
496
dnl -------------------
498
dnl By default, make the library as general as possible.
499
dnl enable_gcj_support=no
500
AC_ARG_ENABLE(gcj-support,
501
[AC_HELP_STRING([--disable-gcj-support],
502
[Disable support for gcj.])])
503
AM_CONDITIONAL(ENABLE_GCJ_SUPPORT,
504
[test x"$enable_gcj_support" != xno])
505
if test x"$enable_gcj_support" != xno; then
506
AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj])
509
AC_ARG_ENABLE(java-finalization,
510
[AC_HELP_STRING([--disable-java-finalization],
511
[Disable support for java finalization.])])
512
if test x"$enable_java_finalization" != xno; then
513
AC_DEFINE(JAVA_FINALIZATION)
516
AC_ARG_ENABLE(atomic-uncollectable,
517
[AC_HELP_STRING([--disable-atomic-uncollectible],
518
[Disable support for atomic uncollectible allocation.])])
519
if test x"$enable_atomic_uncollectible" != x"no"; then
520
AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1,
521
[Define to enable atomic uncollectible allocation.])
524
AC_ARG_ENABLE(redirect-malloc,
525
[AC_HELP_STRING([--enable-redirect-malloc],
526
[Redirect malloc and friends to GC routines])])
528
if test "${enable_redirect_malloc}" = yes; then
529
if test "${enable_full_debug}" = yes; then
530
AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
531
AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
532
AC_DEFINE(REDIRECT_FREE, GC_debug_free)
534
AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
536
AC_DEFINE(GC_USE_DLOPEN_WRAP)
539
AC_ARG_ENABLE(large-config,
540
[AC_HELP_STRING([--enable-large-config],
541
[Optimize for large (> 100 MB) heap or root set])])
543
if test "${enable_large_config}" = yes; then
544
AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
547
dnl This is something of a hack. When cross-compiling we turn off
548
dnl some functionality. We also enable the "small" configuration.
549
dnl These is only correct when targetting an embedded system. FIXME.
550
if test -n "${with_cross_host}"; then
552
AC_DEFINE(SMALL_CONFIG)
553
AC_DEFINE(NO_DEBUGGING)
561
AC_ARG_ENABLE(gc-debug,
562
[AC_HELP_STRING([--enable-gc-debug],
563
[include full support for pointer backtracing etc.])],
564
[ if test "$enable_gc_debug" = "yes"; then
565
AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
566
AC_DEFINE(KEEP_BACK_PTRS)
567
AC_DEFINE(DBG_HDRS_ALL)
570
AC_DEFINE(MAKE_BACK_GRAPH)
571
AC_DEFINE(SAVE_CALL_COUNT, 8)
572
AC_CHECK_LIB(unwind, backtrace, [
573
AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
575
AC_MSG_WARN("Client code may need to link against libunwind.")
578
x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
579
AC_DEFINE(MAKE_BACK_GRAPH)
580
AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
581
AC_DEFINE(SAVE_CALL_COUNT, 8)
584
AC_DEFINE(MAKE_BACK_GRAPH)
591
AC_ARG_ENABLE(gc-assertions,
592
[AC_HELP_STRING([--enable-gc-assertions],
593
[collector-internal assertion checking])])
594
if test "${enable_gc_assertions}" = yes; then
595
AC_DEFINE(GC_ASSERTIONS)
598
AC_ARG_ENABLE(munmap,
599
[AC_HELP_STRING([--enable-munmap=N],
600
[return page to the os if empty for N collections])],
601
MUNMAP_THRESHOLD=$enableval;
604
AC_MSG_ERROR([--enable-munmap requires --enable-mmap])
608
if test "${enable_munmap}" != ""; then
610
AC_DEFINE(USE_MUNMAP)
611
if test "${MUNMAP_THRESHOLD}" = "yes"; then
614
AC_DEFINE_UNQUOTED(MUNMAP_THRESHOLD, ${MUNMAP_THRESHOLD})
617
AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
623
atomic_ops_libs=-latomic_ops
624
AC_CHECK_HEADER(atomic_ops.h,
625
[ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
627
for candidate in ${srcdir}/libatomic_ops*; do
632
dnl generated by alternate Makefile.
635
if test -e "$candidate"; then
641
if test -z "$ao_dir"; then
642
AC_MSG_ERROR([Missig libatomic_ops.])
644
ao_version="${ao_dir#*libatomic_ops-}"
645
AC_MSG_NOTICE([Using internal version of libatomic_ops])
647
dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
648
test -e libatomic_ops \
649
|| ln -s ${ao_dir} libatomic_ops
650
AC_CONFIG_SUBDIRS(libatomic_ops)
652
dnl Also copy the source files to be linked in.
653
test -e atomic_ops.c \
654
|| ln -s libatomic_ops/src/atomic_ops.c \
657
test -e atomic_ops_sysdeps.S \
658
|| ln -s libatomic_ops/src/atomic_ops_sysdeps.S \
661
dnl This gets the source include files, which is often close enough.
662
dnl It also makes atomic_ops_sysdeps.S assemble.
663
GC_CFLAGS="${GC_CFLAGS} -I libatomic_ops/src"
664
maybe_libatomic_ops="libatomic_ops"
667
AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
668
test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
669
AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
670
AC_SUBST(atomic_ops_libs)
672
dnl Produce the Files
673
dnl -----------------
675
AC_CONFIG_FILES([Makefile bdw-gc.pc])
677
AC_CONFIG_COMMANDS([default],,
680
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}