Merged cleanup -> gc7-branch
[cacao.git] / src / mm / boehm-gc / configure.ac
1 # Copyright (c) 1999-2001 by Red Hat, Inc. All rights reserved.
2
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
5
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.
11 #
12 # Original author: Tom Tromey
13 # Modified by: Grzegorz Jakacki <jakacki at acm dot org>
14
15 dnl Process this file with autoconf to produce configure.
16
17 # Initialization
18 # ==============
19
20 AC_INIT(gc,7.0,Hans.Boehm@hp.com) 
21     ## version must conform to [0-9]+[.][0-9]+(alpha[0-9]+)?
22 AC_CONFIG_SRCDIR(gcj_mlc.c)
23 AC_CANONICAL_TARGET 
24 AC_PREREQ(2.53)
25 AC_REVISION($Revision: 1.25 $)
26 GC_SET_VERSION
27 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
28 AM_MAINTAINER_MODE
29
30 AM_CONFIG_HEADER([include/config.h])
31
32 AC_SUBST(PACKAGE)
33 AC_SUBST(GC_VERSION)
34
35 AM_PROG_CC_C_O
36 AC_PROG_CXX
37
38 dnl temporary set the CFLAGS for configure tests (e.g. inline keyword)
39 dnl we set it properly later in this file
40 CFLAGS="$ARCH_CFLAGS $OPT_CFLAGS"
41 AC_C_INLINE
42
43 AM_PROG_AS
44 ## FIXME: really needed? (AC_LIBTOOL already provides this)
45 AC_CHECK_TOOL(AR, ar)
46 AC_CHECK_TOOL(RANLIB, ranlib, :)  # :)
47
48 AC_PROG_LIBTOOL
49 AC_PROG_INSTALL
50
51 . ${srcdir}/configure.host
52
53 GC_CFLAGS=${gc_cflags}
54 AC_SUBST(GC_CFLAGS)
55
56 AC_ARG_ENABLE(boehm-threads,
57   [AC_HELP_STRING([--enable-boehm-threads=TYPE], [choose threading package])],
58   THREADS=$enableval,
59   [ AC_MSG_CHECKING([for thread model used by GCC])
60     THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
61     if test -z "$THREADS"; then
62       THREADS=no
63     fi
64     AC_MSG_RESULT([$THREADS]) ])
65
66 AC_ARG_ENABLE(parallel-mark,
67    [AC_HELP_STRING([--enable-parallel-mark],
68         [parallelize marking and free list construction])],
69    [case "$THREADS" in
70       no | none | single)
71         AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
72         ;;
73     esac ]
74 )
75
76 AC_ARG_ENABLE(cplusplus,
77     [AC_HELP_STRING([--enable-cplusplus], [install C++ support])])
78
79 INCLUDES=-I${srcdir}/include
80 THREADDLLIBS=
81 need_atomic_ops_asm=false
82 ## Libraries needed to support dynamic loading and/or threads.
83 case "$THREADS" in
84  no | none | single)
85     THREADS=none
86     ;;
87  posix | pthreads)
88     THREADS=posix
89     THREADDLLIBS=-lpthread
90     case "$host" in
91      x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
92         AC_DEFINE([GC_LINUX_THREADS], 1, [gc linux threads])
93         AC_DEFINE([_REENTRANT], 1, [reentrant])
94         if test "${enable_parallel_mark}" = yes; then
95           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
96         fi
97         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
98         AC_MSG_WARN("Explict GC_INIT() calls may be required.");
99         ;;
100      *-*-linux*)
101         AC_DEFINE([GC_LINUX_THREADS], 1, [gc linux threads])
102         AC_DEFINE([_REENTRANT], 1, [reentrant])
103         ;;
104      *-*-aix*)
105         AC_DEFINE([GC_AIX_THREADS], 1, [gc aix threads])
106         AC_DEFINE([_REENTRANT], 1, [reentrant])
107         ;;
108      *-*-hpux11*)
109         AC_MSG_WARN("Only HP/UX 11 POSIX threads are supported.")
110         AC_DEFINE([GC_HPUX_THREADS], 1, [gc hpux threads])
111         AC_DEFINE([_POSIX_C_SOURCE], 199506L, [posix c source])
112         if test "${enable_parallel_mark}" = yes; then
113           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
114         fi
115         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
116         AC_MSG_WARN("Explict GC_INIT() calls may be required.");
117         THREADDLLIBS="-lpthread -lrt"
118         # HPUX needs REENTRANT for the _r calls.
119         AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
120         ;;
121      *-*-hpux10*)
122         AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
123         ;;
124      *-*-freebsd*)
125         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
126         AC_DEFINE([GC_FREEBSD_THREADS], 1, [gc freebsd threads])
127         INCLUDES="$INCLUDES -pthread"
128         ;;
129      *-*-kfreebsd*-gnu)
130         AC_DEFINE([GC_FREEBSD_THREADS], 1, [gc freebsd threads])
131         INCLUDES="$INCLUDES -pthread"
132         THREADDLLIBS=-pthread
133         AC_DEFINE([_REENTRANT], 1, [reentrant])
134         if test "${enable_parallel_mark}" = yes; then
135           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
136         fi
137         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
138         AC_DEFINE([USE_COMPILER_TLS], 1, [use compiler tls])
139         ;;
140      *-*-gnu*)
141         AC_DEFINE([GC_GNU_THREADS], 1, [GC GNU threads])
142         AC_DEFINE(_REENTRANT)
143         AC_DEFINE(THREAD_LOCAL_ALLOC)
144         ;;
145      *-*-netbsd*)
146         AC_MSG_WARN("Only on NetBSD 2.0 or later.")
147         AC_DEFINE([GC_NETBSD_THREADS], 1, [GC NetBSD threads])
148         AC_DEFINE([_REENTRANT], 1, [reentrant])
149         AC_DEFINE([_PTHREADS], 1, [pthreads])
150         THREADDLLIBS="-lpthread -lrt"
151         ;;
152      *-*-solaris*)
153         AC_DEFINE([GC_SOLARIS_THREADS], 1, [gc solaris threads])
154         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
155         THREADDLLIBS="-lpthread -lrt"
156         if test "$GCC" != yes; then
157           CFLAGS="$CFLAGS -O"
158           need_atomic_ops_asm=true
159         fi
160         ;;
161      *-*-irix*)
162         AC_DEFINE([GC_IRIX_THREADS], 1, [gc irix threads])
163         ;;
164      *-*-cygwin*)
165         AC_DEFINE([GC_WIN32_THREADS], 1, [gc win32 threads])
166         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
167         win32_threads=true
168         ;;
169      *-*-darwin*)
170         AC_DEFINE([GC_DARWIN_THREADS], 1, [gc darwin threads])
171         AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
172         AC_MSG_WARN("Explict GC_INIT() calls may be required.");
173         if test "${enable_parallel_mark}" = yes; then
174           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
175         fi
176         darwin_threads=true
177         ;;
178      *-*-osf*)
179         AC_DEFINE([GC_OSF1_THREADS], 1, [gc osf1 threads])
180         if test "${enable_parallel_mark}" = yes; then
181           AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
182           AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
183           AC_MSG_WARN("Explict GC_INIT() calls may be required.");
184           # May want to enable it in other cases, too.
185           # Measurements havent yet been done.
186         fi
187         INCLUDES="$INCLUDES -pthread"
188         THREADDLLIBS="-lpthread -lrt"
189         ;;
190       *)
191         AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
192         ;;
193     esac
194     ;;
195  win32)
196     AC_DEFINE([GC_WIN32_THREADS], 1, [gc win32 threads])
197     dnl Wine getenv may not return NULL for missing entry
198     AC_DEFINE([NO_GETENV], 1, [no getenv])
199     ;;
200  dgux386)
201     THREADS=dgux386
202     AC_MSG_RESULT($THREADDLLIBS)
203     # Use pthread GCC  switch
204     THREADDLLIBS=-pthread
205     if test "${enable_parallel_mark}" = yes; then
206         AC_DEFINE([PARALLEL_MARK], 1, [parallel mark])
207     fi
208     AC_DEFINE([THREAD_LOCAL_ALLOC], 1, [thread local alloc])
209     AC_MSG_WARN("Explict GC_INIT() calls may be required.");
210     AC_DEFINE([GC_DGUX386_THREADS], 1, [gc dgux386 threads])
211     AC_DEFINE([DGUX_THREADS], 1, [dgux threads])
212     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
213     INCLUDES="-pthread $INCLUDES"
214     ;;
215  aix)
216     THREADS=posix
217     THREADDLLIBS=-lpthread
218     AC_DEFINE([GC_AIX_THREADS], 1, [gc aix threads])
219     AC_DEFINE([_REENTRANT], 1, [reentrant])
220     ;;
221  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
222     AC_MSG_ERROR(thread package $THREADS not yet supported)
223     ;;
224  *)
225     AC_MSG_ERROR($THREADS is an unknown thread package)
226     ;;
227 esac
228 AC_SUBST(THREADDLLIBS)
229 AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
230 AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
231 AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
232 AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
233
234 case "$host" in 
235    powerpc-*-darwin*)
236       powerpc_darwin=true
237       dnl CACAO: disable this for now
238       AC_DEFINE([DARWIN_DONT_PARSE_STACK], 1, [don't use FindTopOfStack])
239       ;;
240 esac
241
242 # Darwin needs a few extra special tests to deal with variation in the
243 # system headers.
244 case "$host" in
245   powerpc*-*-darwin*)
246     AC_CHECK_MEMBER(ppc_thread_state_t.r0,
247       AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
248         [ppc_thread_state_t has field r0]),,
249       [#include <mach/thread_status.h>])
250     AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
251       AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
252         [ppc_thread_state_t has field __r0]),,
253       [#include <mach/thread_status.h>])
254     AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
255       AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
256         [ppc_thread_state64_t has field r0]),,
257       [#include <mach/thread_status.h>])
258     AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
259       AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
260         [ppc_thread_state64_t has field __r0]),,
261       [#include <mach/thread_status.h>])
262     ;;
263   i?86*-*-darwin*)
264     AC_CHECK_MEMBER(x86_thread_state32_t.eax,
265       AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
266         [x86_thread_state32_t has field eax]),,
267       [#include <sys/cdefs.h>
268       #include <mach/thread_status.h>])
269     AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
270       AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
271         [x86_thread_state32_t has field __eax]),,
272       [#include <sys/cdefs.h>
273       #include <mach/thread_status.h>])
274     ;;
275   x86_64-*-darwin*)
276     AC_CHECK_MEMBER(x86_thread_state64_t.rax,
277       AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
278         [x86_thread_state64_t has field rax]),,
279       [#include <sys/cdefs.h>
280       #include <mach/thread_status.h>])
281     AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
282       AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
283         [x86_thread_state64_t has field __rax]),,
284       [#include <sys/cdefs.h>
285       #include <mach/thread_status.h>])
286      ;;
287   *) ;;
288 esac
289
290 AC_MSG_CHECKING(for xlc)
291 AC_TRY_COMPILE([],[
292  #ifndef __xlC__
293  # error
294  #endif
295 ], [compiler_xlc=yes], [compiler_xlc=no])
296 AC_MSG_RESULT($compiler_xlc)
297 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
298 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
299   # the darwin stack-frame-walking code is completely broken on xlc
300   AC_DEFINE(DARWIN_DONT_PARSE_STACK)
301 fi
302
303 # We never want libdl on darwin. It is a fake libdl that just ends up making
304 # dyld calls anyway
305 case "$host" in
306   *-*-darwin*) ;;
307   *)
308     AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
309     ;;
310 esac
311
312 # extra LD Flags which are required for targets
313 case "${host}" in
314   *-*-darwin*)
315     extra_ldflags_libgc=-Wl,-single_module
316     ;;
317 esac
318 AC_SUBST(extra_ldflags_libgc)
319
320 AC_SUBST(EXTRA_TEST_LIBS)
321
322 target_all=libgc.la
323 AC_SUBST(target_all)
324
325 dnl If the target is an eCos system, use the appropriate eCos
326 dnl I/O routines.
327 dnl FIXME: this should not be a local option but a global target
328 dnl system; at present there is no eCos target.
329 TARGET_ECOS="no"
330 AC_ARG_WITH(ecos,
331 [  --with-ecos             enable runtime eCos target support],
332 TARGET_ECOS="$with_ecos"
333 )
334
335 addobjs=
336 addlibs=
337 CXXINCLUDES=
338 case "$TARGET_ECOS" in
339    no)
340       ;;
341    *)
342       AC_DEFINE([ECOS], 1, [ecos])
343       CXXINCLUDES="-I${TARGET_ECOS}/include"
344       addobjs="$addobjs ecos.lo"
345       ;;
346 esac
347
348 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
349
350 AC_SUBST(CXX)
351
352 AC_SUBST(INCLUDES)
353 AC_SUBST(CXXINCLUDES)
354
355 # Configuration of shared libraries
356 #
357 AC_MSG_CHECKING(whether to build shared libraries)
358 AC_ENABLE_SHARED
359
360 case "$host" in
361  alpha-*-openbsd*)
362      enable_shared=no
363      AC_MSG_RESULT(no)
364      ;;
365  *)
366      AC_MSG_RESULT(yes)
367      ;;
368 esac
369
370 # Configuration of machine-dependent code
371 #
372 AC_MSG_CHECKING(which machine-dependent code should be used) 
373 machdep=
374 case "$host" in
375  alpha-*-openbsd*)
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)
379     fi
380     ;;
381  alpha*-*-linux*)
382     machdep="mach_dep.lo"
383     ;;
384  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
385     AC_DEFINE([SOLARIS25_PROC_VDB_BUG_FIXED], 1, [solaris 2.5 proc vdb bug fixed])
386     ;;
387  mipstx39-*-elf*)
388     machdep="mach_dep.lo"
389     AC_DEFINE([STACKBASE], __stackbase, [stackbase])
390     AC_DEFINE([DATASTART_IS_ETEXT], 1, [datastart is etext])
391     ;;
392  mips-dec-ultrix*)
393     machdep="mach-dep.lo"
394     ;;
395  mips-nec-sysv*|mips-unknown-sysv*)
396     ;;
397  mips*-*-linux*) 
398     ;; 
399  mips-*-*)
400     machdep="mach_dep.lo"
401     AC_DEFINE([NO_EXECUTE_PERMISSION], 1, [no execute permission])
402     dnl This is now redundant, but it is also important for incremental GC
403     dnl performance under Irix.
404     ;;
405  sparc-*-netbsd*)
406     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
407     ;;
408  sparc-sun-solaris2.3)
409     machdep="mach_dep.lo sparc_mach_dep.lo"
410     AC_DEFINE([SUNOS53_SHARED_LIB], 1, [sun os 5.3 shared lib])
411     ;;
412  sparc*-sun-solaris2.*)
413     machdep="mach_dep.lo sparc_mach_dep.lo"
414     ;;
415  ia64-*-*)
416     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
417     ;;
418 esac
419 if test x"$machdep" = x; then
420 AC_MSG_RESULT($machdep)
421    machdep="mach_dep.lo"
422 fi
423 addobjs="$addobjs $machdep"
424 AC_SUBST(addobjs)
425 AC_SUBST(addlibs)
426
427 AC_PROG_LIBTOOL
428
429 #
430 # Check for AViiON Machines running DGUX
431 #
432 ac_is_dgux=no
433 AC_CHECK_HEADER(sys/dg_sys_info.h,
434 [ac_is_dgux=yes;])
435
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"
441     else
442       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
443       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
444     fi
445     AC_SUBST(CFLAGS)
446     AC_SUBST(CXXFLAGS)
447 fi
448
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])
455
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.
459 if false; then
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.
463   :
464   AC_EXEEXT
465 fi
466
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)
471 case "$host" in
472  *aix*)
473     if test "$GCC" = yes; then
474        AC_MSG_RESULT(yes)
475        new_CFLAGS=
476        for i in $CFLAGS; do
477           case "$i" in
478            -O*)
479               ;;
480            *)
481               new_CFLAGS="$new_CFLAGS $i"
482               ;;
483           esac
484        done
485        CFLAGS="$new_CFLAGS"
486     else
487        AC_MSG_RESULT(no)
488     fi
489     ;;
490  *) AC_MSG_RESULT(no) ;;
491 esac
492
493 dnl We need to override the top-level CFLAGS.  This is how we do it.
494 dnl MY_CFLAGS="$CFLAGS"
495 dnl AC_SUBST(MY_CFLAGS)
496
497 dnl pass CFLAGS to Makefiles via AM_CFLAGS
498 CFLAGS=$OPT_CFLAGS
499 AM_CFLAGS=$ARCH_CFLAGS
500 AC_SUBST(AM_CFLAGS)
501
502 dnl Include defines that have become de facto standard.
503 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
504 AC_DEFINE([NO_EXECUTE_PERMISSION], 1, [no exceute permission])
505 AC_DEFINE([ALL_INTERIOR_POINTERS], 1, [all interior pointers])
506
507
508 dnl Interface Selection
509 dnl -------------------
510 dnl
511 dnl By default, make the library as general as possible.
512 dnl enable_gcj_support=no
513 AC_ARG_ENABLE(gcj-support,
514     [AC_HELP_STRING([--disable-gcj-support],
515         [Disable support for gcj.])])
516 AM_CONDITIONAL(ENABLE_GCJ_SUPPORT,
517     [test x"$enable_gcj_support" != xno])
518 if test x"$enable_gcj_support" != xno; then
519     AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj])
520 fi
521
522 AC_ARG_ENABLE(java-finalization,
523     [AC_HELP_STRING([--disable-java-finalization],
524         [Disable support for java finalization.])])
525 if test x"$enable_java_finalization" != xno; then
526     AC_DEFINE([JAVA_FINALIZATION], 1, [java finalization])
527 fi
528
529 AC_ARG_ENABLE(atomic-uncollectable,
530     [AC_HELP_STRING([--disable-atomic-uncollectible],
531         [Disable support for atomic uncollectible allocation.])])
532 if test x"$enable_atomic_uncollectible" != x"no"; then
533     AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1,
534         [Define to enable atomic uncollectible allocation.])
535 fi
536
537 AC_ARG_ENABLE(redirect-malloc,
538     [AC_HELP_STRING([--enable-redirect-malloc],
539         [Redirect malloc and friends to GC routines])])
540
541 if test "${enable_redirect_malloc}" = yes; then
542     if test "${enable_full_debug}" = yes; then
543         AC_DEFINE([REDIRECT_MALLOC], GC_debug_malloc_replacement, [redirect malloc])
544         AC_DEFINE([REDIRECT_REALLOC], GC_debug_realloc_replacement, [redirect realloc])
545         AC_DEFINE([REDIRECT_FREE], GC_debug_free, [redirect free])
546     else
547         AC_DEFINE([REDIRECT_MALLOC], GC_malloc, [redirect malloc])
548     fi
549 fi
550
551 AC_ARG_ENABLE(large-config,
552     [AC_HELP_STRING([--enable-large-config],
553         [Optimize for large (> 100 MB) heap or root set])])
554
555 if test "${enable_large_config}" = yes; then
556     AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
557 fi
558
559 dnl This is something of a hack.  When cross-compiling we turn off
560 dnl some functionality.  We also enable the "small" configuration.
561 dnl These is only correct when targetting an embedded system.  FIXME.
562 if test -n "${with_cross_host}"; then
563    AC_DEFINE([NO_CLOCK], 1, [no clock])
564    AC_DEFINE([SMALL_CONFIG], 1, [small config])
565    AC_DEFINE([NO_DEBUGGING], 1, [no debugging])
566 fi
567
568
569 dnl Debugging
570 dnl ---------
571
572 UNWINDLIBS=
573 AC_ARG_ENABLE(gc-debug,
574 [AC_HELP_STRING([--enable-gc-debug],
575     [include full support for pointer backtracing etc.])],
576 [ if test "$enable_gc_debug" = "yes"; then
577     AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
578     AC_DEFINE([KEEP_BACK_PTRS], 1, [keep back ptrs])
579     AC_DEFINE([DBG_HDRS_ALL], 1, [dbg hdrs all])
580     case $host in
581       ia64-*-linux* )
582         AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
583         AC_DEFINE([SAVE_CALL_COUNT], 8, [save call count])
584         AC_CHECK_LIB(unwind, backtrace, [
585           AC_DEFINE([GC_HAVE_BUILTIN_BACKTRACE], 1, [have builtin backtrace])
586           UNWINDLIBS=-lunwind
587           AC_MSG_WARN("Client code may need to link against libunwind.")
588         ])
589       ;;
590       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
591         AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
592         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
593         AC_DEFINE([SAVE_CALL_COUNT], 8, [save call count])
594       ;;
595       i[3456]86-*-dgux*)
596         AC_DEFINE([MAKE_BACK_GRAPH], 1, [make back graph])
597       ;;
598     esac ]
599   fi)
600
601 AC_SUBST(UNWINDLIBS)
602
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], 1, [gc assertions])
608 fi
609
610 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
611
612
613 dnl Atomic Ops
614 dnl ----------
615
616 atomic_ops_libs=-latomic_ops
617 AC_CHECK_HEADER(atomic_ops.h,
618   [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
619   [ ao_dir=
620     for candidate in ${srcdir}/libatomic_ops*; do
621         case $candidate in
622             *.tar.gz)
623                 ;;
624             *install)
625                 dnl generated by alternate Makefile.
626                 ;;
627             *)
628                 if test -e "$candidate"; then
629                     ao_dir="$candidate"
630                 fi
631                 ;;
632         esac
633     done
634     if test -z "$ao_dir"; then
635         AC_MSG_ERROR([Missig libatomic_ops.])
636     fi
637     ao_version="${ao_dir#*libatomic_ops-}"
638     AC_MSG_NOTICE([Using internal version of libatomic_ops])
639
640     dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
641     test -e ${srcdir}/libatomic_ops \
642         || ln -s ${ao_dir} ${srcdir}/libatomic_ops
643     AC_CONFIG_SUBDIRS(libatomic_ops)
644
645     dnl Also copy the source files to be linked in.
646     test -e ${srcdir}/atomic_ops.c \
647         || ln -s ${srcdir}/libatomic_ops/src/atomic_ops.c \
648                  ${srcdir}/atomic_ops.c
649
650     test -e ${srcdir}/atomic_ops_sysdeps.S \
651         || ln -s ${srcdir}/libatomic_ops/src/atomic_ops_sysdeps.S \
652                  ${srcdir}/atomic_ops_sysdeps.S
653
654     dnl This gets the source include files, which is often close enough.
655     dnl It also makes atomic_ops_sysdeps.S assemble.
656     GC_CFLAGS="${GC_CFLAGS} -I \$(top_srcdir)/libatomic_ops/src"
657     maybe_libatomic_ops="libatomic_ops"
658   ])
659
660 AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
661                 test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
662 AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
663 AC_SUBST(atomic_ops_libs)
664
665 dnl Produce the Files
666 dnl -----------------
667
668 AC_CONFIG_FILES([Makefile bdw-gc.pc])
669
670 AC_CONFIG_COMMANDS([default],,
671   [ srcdir=${srcdir}
672     host=${host}
673     CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
674     CC="${CC}"
675     DEFS="$DEFS" ])
676
677 AC_OUTPUT