boehm-gc: revert all CACAO-specific modifications; this is now an exact copy of the...
[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.2alpha3,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.44 $)
26 GC_SET_VERSION
27 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects nostdinc])
28 AM_MAINTAINER_MODE
29
30 AC_SUBST(PACKAGE)
31 AC_SUBST(GC_VERSION)
32
33 AM_PROG_CC_C_O
34 AC_PROG_CXX
35
36 AM_PROG_AS
37 ## FIXME: really needed? (AC_LIBTOOL already provides this)
38 AC_CHECK_TOOL(AR, ar)
39 AC_CHECK_TOOL(RANLIB, ranlib, :)  # :)
40
41 AC_PROG_INSTALL
42
43 . ${srcdir}/configure.host
44
45 GC_CFLAGS=${gc_cflags}
46 AC_SUBST(GC_CFLAGS)
47
48 AC_ARG_ENABLE(threads,
49   [AC_HELP_STRING([--enable-threads=TYPE], [choose threading package])],
50   THREADS=$enableval,
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
54       THREADS=no
55     fi
56     AC_MSG_RESULT([$THREADS]) ])
57
58 AC_ARG_ENABLE(parallel-mark,
59    [AC_HELP_STRING([--enable-parallel-mark],
60         [parallelize marking and free list construction])],
61    [case "$THREADS" in
62       no | none | single)
63         AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
64         ;;
65     esac ]
66 )
67
68 AC_ARG_ENABLE(cplusplus,
69     [AC_HELP_STRING([--enable-cplusplus], [install C++ support])])
70
71 INCLUDES=-I${srcdir}/include
72 THREADDLLIBS=
73 need_atomic_ops_asm=false
74 ## Libraries needed to support dynamic loading and/or threads.
75 case "$THREADS" in
76  no | none | single)
77     THREADS=none
78     ;;
79  posix | pthreads)
80     THREADS=posix
81     THREADDLLIBS=-lpthread
82     case "$host" in
83      x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux* | sparc*-*-linux*)
84         AC_DEFINE(GC_LINUX_THREADS)
85         AC_DEFINE(_REENTRANT)
86         if test "${enable_parallel_mark}" = yes; then
87           AC_DEFINE(PARALLEL_MARK)
88         fi
89         AC_DEFINE(THREAD_LOCAL_ALLOC)
90         AC_MSG_WARN("Explict GC_INIT() calls may be required.");
91         ;;
92      *-*-linux*)
93         AC_DEFINE(GC_LINUX_THREADS)
94         AC_DEFINE(_REENTRANT)
95         ;;
96      *-*-aix*)
97         AC_DEFINE(GC_AIX_THREADS)
98         AC_DEFINE(_REENTRANT)
99         ;;
100      *-*-hpux11*)
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)
106         fi
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])
112         ;;
113      *-*-hpux10*)
114         AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
115         ;;
116      *-*-freebsd*)
117         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
118         AC_DEFINE(GC_FREEBSD_THREADS)
119         INCLUDES="$INCLUDES -pthread"
120         ;;
121      *-*-kfreebsd*-gnu)
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)
128         fi
129         AC_DEFINE(THREAD_LOCAL_ALLOC)
130         AC_DEFINE(USE_COMPILER_TLS)
131         ;;
132      *-*-gnu*)
133         AC_DEFINE(GC_GNU_THREADS)
134         AC_DEFINE(_REENTRANT)
135         AC_DEFINE(THREAD_LOCAL_ALLOC)
136         ;;
137      *-*-netbsd*)
138         AC_MSG_WARN("Only on NetBSD 2.0 or later.")
139         AC_DEFINE(GC_NETBSD_THREADS)
140         AC_DEFINE(_REENTRANT)
141         AC_DEFINE(_PTHREADS)
142         THREADDLLIBS="-lpthread -lrt"
143         ;;
144      *-*-solaris*)
145         AC_DEFINE(GC_SOLARIS_THREADS)
146         AC_DEFINE(THREAD_LOCAL_ALLOC)
147         THREADDLLIBS="-lpthread -lrt"
148         if test "$GCC" != yes; then
149           CFLAGS="$CFLAGS -O"
150           need_atomic_ops_asm=true
151         fi
152         ;;
153      *-*-irix*)
154         AC_DEFINE(GC_IRIX_THREADS)
155         ;;
156      *-*-cygwin*)
157         AC_DEFINE(GC_WIN32_THREADS)
158         AC_DEFINE(THREAD_LOCAL_ALLOC)
159         win32_threads=true
160         ;;
161      *-*-darwin*)
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)
168         # fi
169         darwin_threads=true
170         ;;
171      *-*-osf*)
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.
179         fi
180         INCLUDES="$INCLUDES -pthread"
181         THREADDLLIBS="-lpthread -lrt"
182         ;;
183       *)
184         AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
185         ;;
186     esac
187     ;;
188  win32)
189     AC_DEFINE(GC_WIN32_THREADS)
190     win32_threads=true
191     dnl Wine getenv may not return NULL for missing entry
192     AC_DEFINE(NO_GETENV)
193     ;;
194  dgux386)
195     THREADS=dgux386
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)
201     fi
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"
208     ;;
209  aix)
210     THREADS=posix
211     THREADDLLIBS=-lpthread
212     AC_DEFINE(GC_AIX_THREADS)
213     AC_DEFINE(_REENTRANT)
214     ;;
215  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
216     AC_MSG_ERROR(thread package $THREADS not yet supported)
217     ;;
218  *)
219     AC_MSG_ERROR($THREADS is an unknown thread package)
220     ;;
221 esac
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)
227
228 case "$host" in 
229    powerpc-*-darwin*)
230       powerpc_darwin=true
231       ;;
232 esac
233
234 # Darwin needs a few extra special tests to deal with variation in the
235 # system headers.
236 case "$host" in
237   powerpc*-*-darwin*)
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>])
254     ;;
255   i?86*-*-darwin*)
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>])
266     ;;
267   x86_64-*-darwin*)
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>])
278      ;;
279   *) ;;
280 esac
281
282 AC_MSG_CHECKING(for xlc)
283 AC_TRY_COMPILE([],[
284  #ifndef __xlC__
285  # error
286  #endif
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)
293 fi
294
295 # We never want libdl on darwin. It is a fake libdl that just ends up making
296 # dyld calls anyway
297 case "$host" in
298   *-*-darwin*) ;;
299   *)
300     AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
301     ;;
302 esac
303
304 case "$host" in
305   *-*-hpux*)
306     avoid_cpp_lib=yes;;
307   *)
308     avoid_cpp_lib=no;
309     ;;
310 esac
311 AM_CONDITIONAL(AVOID_CPP_LIB,test $avoid_cpp_lib = yes)
312
313 # extra LD Flags which are required for targets
314 case "${host}" in
315   *-*-darwin*)
316     extra_ldflags_libgc=-Wl,-single_module
317     ;;
318 esac
319 AC_SUBST(extra_ldflags_libgc)
320
321 AC_SUBST(EXTRA_TEST_LIBS)
322
323 target_all=libgc.la
324 AC_SUBST(target_all)
325
326 dnl If the target is an eCos system, use the appropriate eCos
327 dnl I/O routines.
328 dnl FIXME: this should not be a local option but a global target
329 dnl system; at present there is no eCos target.
330 TARGET_ECOS="no"
331 AC_ARG_WITH(ecos,
332 [  --with-ecos             enable runtime eCos target support],
333 TARGET_ECOS="$with_ecos"
334 )
335
336 addobjs=
337 addlibs=
338 CXXINCLUDES=
339 case "$TARGET_ECOS" in
340    no)
341       ;;
342    *)
343       AC_DEFINE(ECOS)
344       CXXINCLUDES="-I${TARGET_ECOS}/include"
345       addobjs="$addobjs ecos.lo"
346       ;;
347 esac
348
349 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
350
351 AC_SUBST(CXX)
352
353 AC_SUBST(INCLUDES)
354 AC_SUBST(CXXINCLUDES)
355
356 # Configuration of shared libraries
357 #
358 AC_MSG_CHECKING(whether to build shared libraries)
359 AC_ENABLE_SHARED
360
361 case "$host" in
362  alpha-*-openbsd*)
363      enable_shared=no
364      ;;
365  *)
366      ;;
367 esac
368
369 AC_MSG_RESULT($enable_shared)
370
371 # Configuration of machine-dependent code
372 #
373 AC_MSG_CHECKING(which machine-dependent code should be used) 
374 machdep=
375 case "$host" in
376  alpha-*-openbsd*)
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)
380     fi
381     ;;
382  alpha*-*-linux*)
383     machdep="mach_dep.lo"
384     ;;
385  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
386     AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
387     ;;
388  mipstx39-*-elf*)
389     machdep="mach_dep.lo"
390     AC_DEFINE(STACKBASE, __stackbase)
391     AC_DEFINE(DATASTART_IS_ETEXT)
392     ;;
393  mips-dec-ultrix*)
394     machdep="mach-dep.lo"
395     ;;
396  mips-nec-sysv*|mips-unknown-sysv*)
397     ;;
398  mips*-*-linux*) 
399     ;; 
400  mips-*-*)
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.
405     ;;
406  sparc*-*-linux*)
407     machdep="mach_dep.lo sparc_mach_dep.lo"
408     ;;
409  sparc-*-netbsd*)
410     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
411     ;;
412  sparc64-*-netbsd*)
413     machdep="mach_dep.lo sparc_mach_dep.lo"
414     ;;
415  sparc-sun-solaris2.3)
416     machdep="mach_dep.lo sparc_mach_dep.lo"
417     AC_DEFINE(SUNOS53_SHARED_LIB)
418     ;;
419  sparc*-sun-solaris2*)
420     machdep="mach_dep.lo sparc_mach_dep.lo"
421     ;;
422  ia64-*-*)
423     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
424     ;;
425 esac
426 if test x"$machdep" = x; then
427 AC_MSG_RESULT($machdep)
428    machdep="mach_dep.lo"
429 fi
430 addobjs="$addobjs $machdep"
431 AC_SUBST(addobjs)
432 AC_SUBST(addlibs)
433
434 AC_PROG_LIBTOOL
435
436 #
437 # Check for AViiON Machines running DGUX
438 # FIXME: Should this be moved down to below the gc-debug processing?
439 #
440 ac_is_dgux=no
441 AC_CHECK_HEADER(sys/dg_sys_info.h,
442 [ac_is_dgux=yes;])
443
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"
449     else
450       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
451       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
452     fi
453     AC_SUBST(CFLAGS)
454     AC_SUBST(CXXFLAGS)
455 fi
456
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])
463
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.
467 if false; then
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.
471   :
472   AC_EXEEXT
473 fi
474
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)
479 case "$host" in
480  *aix*)
481     if test "$GCC" = yes; then
482        AC_MSG_RESULT(yes)
483        new_CFLAGS=
484        for i in $CFLAGS; do
485           case "$i" in
486            -O*)
487               ;;
488            *)
489               new_CFLAGS="$new_CFLAGS $i"
490               ;;
491           esac
492        done
493        CFLAGS="$new_CFLAGS"
494     else
495        AC_MSG_RESULT(no)
496     fi
497     ;;
498  *) AC_MSG_RESULT(no) ;;
499 esac
500
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)
505
506
507 dnl Interface Selection
508 dnl -------------------
509 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])
519 fi
520
521 dnl Debugging
522 dnl ---------
523
524 UNWINDLIBS=
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)
532     case $host in
533       ia64-*-linux* )
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)
538           UNWINDLIBS=-lunwind
539           AC_MSG_WARN("Client code may need to link against libunwind.")
540         ])
541       ;;
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)
546       ;;
547       i[3456]86-*-dgux*)
548         AC_DEFINE(MAKE_BACK_GRAPH)
549       ;;
550     esac ]
551   fi)
552
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)
558 fi
559
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.])
566 fi
567
568 AC_ARG_ENABLE(redirect-malloc,
569     [AC_HELP_STRING([--enable-redirect-malloc],
570         [Redirect malloc and friends to GC routines])])
571
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)
577     else
578         AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
579     fi
580     AC_DEFINE(GC_USE_DLOPEN_WRAP)
581 fi
582
583 AC_ARG_ENABLE(large-config,
584     [AC_HELP_STRING([--enable-large-config],
585         [Optimize for large (> 100 MB) heap or root set])])
586
587 if test "${enable_large_config}" = yes; then
588     AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
589 fi
590
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
595    AC_DEFINE(NO_CLOCK)
596    AC_DEFINE(SMALL_CONFIG)
597    AC_DEFINE(NO_DEBUGGING)
598 fi
599
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)
608 fi
609
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;
614    [case "$MMAP" in
615       no)
616         AC_MSG_ERROR([--enable-munmap requires --enable-mmap])
617         ;;
618     esac]
619    )
620 if test "${enable_munmap}" != ""; then
621     AC_DEFINE(USE_MMAP)
622     AC_DEFINE(USE_MUNMAP)
623     if test "${MUNMAP_THRESHOLD}" = "yes"; then
624       MUNMAP_THRESHOLD=6
625     fi
626     AC_DEFINE_UNQUOTED(MUNMAP_THRESHOLD, ${MUNMAP_THRESHOLD})
627 fi
628
629 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
630
631
632 dnl Atomic Ops
633 dnl ----------
634
635 atomic_ops_libs=-latomic_ops
636 AC_CHECK_HEADER(atomic_ops.h,
637   [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
638   [ ao_dir=
639     for candidate in ${srcdir}/libatomic_ops*; do
640         case $candidate in
641             *.tar.gz)
642                 ;;
643             *install)
644                 dnl generated by alternate Makefile.
645                 ;;
646             *)
647                 if test -e "$candidate"; then
648                     ao_dir="$candidate"
649                 fi
650                 ;;
651         esac
652     done
653     if test -z "$ao_dir"; then
654         AC_MSG_ERROR([Missig libatomic_ops.])
655     fi
656     ao_version="${ao_dir#*libatomic_ops-}"
657     AC_MSG_NOTICE([Using internal version of libatomic_ops])
658
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)
663
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 \
667                  atomic_ops.c
668
669     test -e atomic_ops_sysdeps.S \
670         || ln -s libatomic_ops/src/atomic_ops_sysdeps.S \
671                  atomic_ops_sysdeps.S
672
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"
677   ])
678
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)
683
684 dnl Produce the Files
685 dnl -----------------
686
687 AC_CONFIG_FILES([Makefile bdw-gc.pc])
688
689 AC_CONFIG_COMMANDS([default],,
690   [ srcdir=${srcdir}
691     host=${host}
692     CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
693     CC="${CC}"
694     DEFS="$DEFS" ])
695
696 AC_OUTPUT