Imported Upstream version 1.51.0
[platform/upstream/boost.git] / tools / build / src / engine / 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 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*)
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         if test "${enable_parallel_mark}" = yes; then
166           AC_DEFINE(PARALLEL_MARK)
167         fi
168         darwin_threads=true
169         ;;
170      *-*-osf*)
171         AC_DEFINE(GC_OSF1_THREADS)
172         if test "${enable_parallel_mark}" = yes; then
173           AC_DEFINE(PARALLEL_MARK)
174           AC_DEFINE(THREAD_LOCAL_ALLOC)
175           AC_MSG_WARN("Explict GC_INIT() calls may be required.");
176           # May want to enable it in other cases, too.
177           # Measurements havent yet been done.
178         fi
179         INCLUDES="$INCLUDES -pthread"
180         THREADDLLIBS="-lpthread -lrt"
181         ;;
182       *)
183         AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
184         ;;
185     esac
186     ;;
187  win32)
188     AC_DEFINE(GC_WIN32_THREADS)
189     dnl Wine getenv may not return NULL for missing entry
190     AC_DEFINE(NO_GETENV)
191     ;;
192  dgux386)
193     THREADS=dgux386
194     AC_MSG_RESULT($THREADDLLIBS)
195     # Use pthread GCC  switch
196     THREADDLLIBS=-pthread
197     if test "${enable_parallel_mark}" = yes; then
198         AC_DEFINE(PARALLEL_MARK)
199     fi
200     AC_DEFINE(THREAD_LOCAL_ALLOC)
201     AC_MSG_WARN("Explict GC_INIT() calls may be required.");
202     AC_DEFINE(GC_DGUX386_THREADS)
203     AC_DEFINE(DGUX_THREADS)
204     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
205     INCLUDES="-pthread $INCLUDES"
206     ;;
207  aix)
208     THREADS=posix
209     THREADDLLIBS=-lpthread
210     AC_DEFINE(GC_AIX_THREADS)
211     AC_DEFINE(_REENTRANT)
212     ;;
213  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
214     AC_MSG_ERROR(thread package $THREADS not yet supported)
215     ;;
216  *)
217     AC_MSG_ERROR($THREADS is an unknown thread package)
218     ;;
219 esac
220 AC_SUBST(THREADDLLIBS)
221 AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
222 AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
223 AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
224 AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
225
226 case "$host" in 
227    powerpc-*-darwin*)
228       powerpc_darwin=true
229       ;;
230 esac
231
232 # Darwin needs a few extra special tests to deal with variation in the
233 # system headers.
234 case "$host" in
235   powerpc*-*-darwin*)
236     AC_CHECK_MEMBER(ppc_thread_state_t.r0,
237       AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
238         [ppc_thread_state_t has field r0]),,
239       [#include <mach/thread_status.h>])
240     AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
241       AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
242         [ppc_thread_state_t has field __r0]),,
243       [#include <mach/thread_status.h>])
244     AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
245       AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
246         [ppc_thread_state64_t has field r0]),,
247       [#include <mach/thread_status.h>])
248     AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
249       AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
250         [ppc_thread_state64_t has field __r0]),,
251       [#include <mach/thread_status.h>])
252     ;;
253   i?86*-*-darwin*)
254     AC_CHECK_MEMBER(x86_thread_state32_t.eax,
255       AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
256         [x86_thread_state32_t has field eax]),,
257       [#include <sys/cdefs.h>
258       #include <mach/thread_status.h>])
259     AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
260       AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
261         [x86_thread_state32_t has field __eax]),,
262       [#include <sys/cdefs.h>
263       #include <mach/thread_status.h>])
264     ;;
265   x86_64-*-darwin*)
266     AC_CHECK_MEMBER(x86_thread_state64_t.rax,
267       AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
268         [x86_thread_state64_t has field rax]),,
269       [#include <sys/cdefs.h>
270       #include <mach/thread_status.h>])
271     AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
272       AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
273         [x86_thread_state64_t has field __rax]),,
274       [#include <sys/cdefs.h>
275       #include <mach/thread_status.h>])
276      ;;
277   *) ;;
278 esac
279
280 AC_MSG_CHECKING(for xlc)
281 AC_TRY_COMPILE([],[
282  #ifndef __xlC__
283  # error
284  #endif
285 ], [compiler_xlc=yes], [compiler_xlc=no])
286 AC_MSG_RESULT($compiler_xlc)
287 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
288 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
289   # the darwin stack-frame-walking code is completely broken on xlc
290   AC_DEFINE(DARWIN_DONT_PARSE_STACK)
291 fi
292
293 # We never want libdl on darwin. It is a fake libdl that just ends up making
294 # dyld calls anyway
295 case "$host" in
296   *-*-darwin*) ;;
297   *)
298     AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
299     ;;
300 esac
301
302 # extra LD Flags which are required for targets
303 case "${host}" in
304   *-*-darwin*)
305     extra_ldflags_libgc=-Wl,-single_module
306     ;;
307 esac
308 AC_SUBST(extra_ldflags_libgc)
309
310 AC_SUBST(EXTRA_TEST_LIBS)
311
312 target_all=libgc.la
313 AC_SUBST(target_all)
314
315 dnl If the target is an eCos system, use the appropriate eCos
316 dnl I/O routines.
317 dnl FIXME: this should not be a local option but a global target
318 dnl system; at present there is no eCos target.
319 TARGET_ECOS="no"
320 AC_ARG_WITH(ecos,
321 [  --with-ecos             enable runtime eCos target support],
322 TARGET_ECOS="$with_ecos"
323 )
324
325 addobjs=
326 addlibs=
327 CXXINCLUDES=
328 case "$TARGET_ECOS" in
329    no)
330       ;;
331    *)
332       AC_DEFINE(ECOS)
333       CXXINCLUDES="-I${TARGET_ECOS}/include"
334       addobjs="$addobjs ecos.lo"
335       ;;
336 esac
337
338 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
339
340 AC_SUBST(CXX)
341
342 AC_SUBST(INCLUDES)
343 AC_SUBST(CXXINCLUDES)
344
345 # Configuration of shared libraries
346 #
347 AC_MSG_CHECKING(whether to build shared libraries)
348 AC_ENABLE_SHARED
349
350 case "$host" in
351  alpha-*-openbsd*)
352      enable_shared=no
353      AC_MSG_RESULT(no)
354      ;;
355  *)
356      AC_MSG_RESULT(yes)
357      ;;
358 esac
359
360 # Configuration of machine-dependent code
361 #
362 AC_MSG_CHECKING(which machine-dependent code should be used) 
363 machdep=
364 case "$host" in
365  alpha-*-openbsd*)
366     machdep="mach_dep.lo"
367     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
368        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
369     fi
370     ;;
371  alpha*-*-linux*)
372     machdep="mach_dep.lo"
373     ;;
374  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
375     AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
376     ;;
377  mipstx39-*-elf*)
378     machdep="mach_dep.lo"
379     AC_DEFINE(STACKBASE, __stackbase)
380     AC_DEFINE(DATASTART_IS_ETEXT)
381     ;;
382  mips-dec-ultrix*)
383     machdep="mach-dep.lo"
384     ;;
385  mips-nec-sysv*|mips-unknown-sysv*)
386     ;;
387  mips*-*-linux*) 
388     ;; 
389  mips-*-*)
390     machdep="mach_dep.lo"
391     dnl AC_DEFINE(NO_EXECUTE_PERMISSION)
392     dnl This is now redundant, but it is also important for incremental GC
393     dnl performance under Irix.
394     ;;
395  sparc-*-netbsd*)
396     machdep="mach_dep.lo sparc_netbsd_mach_dep.lo"
397     ;;
398  sparc-sun-solaris2.3)
399     machdep="mach_dep.lo sparc_mach_dep.lo"
400     AC_DEFINE(SUNOS53_SHARED_LIB)
401     ;;
402  sparc*-sun-solaris2.*)
403     machdep="mach_dep.lo sparc_mach_dep.lo"
404     ;;
405  ia64-*-*)
406     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
407     ;;
408 esac
409 if test x"$machdep" = x; then
410 AC_MSG_RESULT($machdep)
411    machdep="mach_dep.lo"
412 fi
413 addobjs="$addobjs $machdep"
414 AC_SUBST(addobjs)
415 AC_SUBST(addlibs)
416
417 AC_PROG_LIBTOOL
418
419 #
420 # Check for AViiON Machines running DGUX
421 #
422 ac_is_dgux=no
423 AC_CHECK_HEADER(sys/dg_sys_info.h,
424 [ac_is_dgux=yes;])
425
426     ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
427 if test $ac_is_dgux = yes; then
428     if test "$enable_full_debug" = "yes"; then
429       CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
430       CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
431     else
432       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
433       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
434     fi
435     AC_SUBST(CFLAGS)
436     AC_SUBST(CXXFLAGS)
437 fi
438
439 dnl We use these options to decide which functions to include.
440 AC_ARG_WITH(target-subdir,
441 [  --with-target-subdir=SUBDIR
442                           configuring with a cross compiler])
443 AC_ARG_WITH(cross-host,
444 [  --with-cross-host=HOST  configuring with a cross compiler])
445
446 # automake wants to see AC_EXEEXT.  But we don't need it.  And having
447 # it is actually a problem, because the compiler we're passed can't
448 # necessarily do a full link.  So we fool automake here.
449 if false; then
450   # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
451   # to nothing, so nothing would remain between `then' and `fi' if it
452   # were not for the `:' below.
453   :
454   AC_EXEEXT
455 fi
456
457 dnl As of 4.13a2, the collector will not properly work on Solaris when
458 dnl built with gcc and -O.  So we remove -O in the appropriate case.
459 dnl Not needed anymore on Solaris.
460 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
461 case "$host" in
462  *aix*)
463     if test "$GCC" = yes; then
464        AC_MSG_RESULT(yes)
465        new_CFLAGS=
466        for i in $CFLAGS; do
467           case "$i" in
468            -O*)
469               ;;
470            *)
471               new_CFLAGS="$new_CFLAGS $i"
472               ;;
473           esac
474        done
475        CFLAGS="$new_CFLAGS"
476     else
477        AC_MSG_RESULT(no)
478     fi
479     ;;
480  *) AC_MSG_RESULT(no) ;;
481 esac
482
483 dnl Include defines that have become de facto standard.
484 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
485 AC_DEFINE(NO_EXECUTE_PERMISSION)
486 AC_DEFINE(ALL_INTERIOR_POINTERS)
487
488
489 dnl Interface Selection
490 dnl -------------------
491 dnl
492 dnl By default, make the library as general as possible.
493 dnl enable_gcj_support=no
494 AC_ARG_ENABLE(gcj-support,
495     [AC_HELP_STRING([--disable-gcj-support],
496         [Disable support for gcj.])])
497 AM_CONDITIONAL(ENABLE_GCJ_SUPPORT,
498     [test x"$enable_gcj_support" != xno])
499 if test x"$enable_gcj_support" != xno; then
500     AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj])
501 fi
502
503 AC_ARG_ENABLE(java-finalization,
504     [AC_HELP_STRING([--disable-java-finalization],
505         [Disable support for java finalization.])])
506 if test x"$enable_java_finalization" != xno; then
507     AC_DEFINE(JAVA_FINALIZATION)
508 fi
509
510 AC_ARG_ENABLE(atomic-uncollectable,
511     [AC_HELP_STRING([--disable-atomic-uncollectible],
512         [Disable support for atomic uncollectible allocation.])])
513 if test x"$enable_atomic_uncollectible" != x"no"; then
514     AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1,
515         [Define to enable atomic uncollectible allocation.])
516 fi
517
518 AC_ARG_ENABLE(redirect-malloc,
519     [AC_HELP_STRING([--enable-redirect-malloc],
520         [Redirect malloc and friends to GC routines])])
521
522 if test "${enable_redirect_malloc}" = yes; then
523     if test "${enable_full_debug}" = yes; then
524         AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
525         AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
526         AC_DEFINE(REDIRECT_FREE, GC_debug_free)
527     else
528         AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
529     fi
530 fi
531
532 AC_ARG_ENABLE(large-config,
533     [AC_HELP_STRING([--enable-large-config],
534         [Optimize for large (> 100 MB) heap or root set])])
535
536 if test "${enable_large_config}" = yes; then
537     AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
538 fi
539
540 dnl This is something of a hack.  When cross-compiling we turn off
541 dnl some functionality.  We also enable the "small" configuration.
542 dnl These is only correct when targetting an embedded system.  FIXME.
543 if test -n "${with_cross_host}"; then
544    AC_DEFINE(NO_CLOCK)
545    AC_DEFINE(SMALL_CONFIG)
546    AC_DEFINE(NO_DEBUGGING)
547 fi
548
549
550 dnl Debugging
551 dnl ---------
552
553 UNWINDLIBS=
554 AC_ARG_ENABLE(gc-debug,
555 [AC_HELP_STRING([--enable-gc-debug],
556     [include full support for pointer backtracing etc.])],
557 [ if test "$enable_gc_debug" = "yes"; then
558     AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
559     AC_DEFINE(KEEP_BACK_PTRS)
560     AC_DEFINE(DBG_HDRS_ALL)
561     case $host in
562       ia64-*-linux* )
563         AC_DEFINE(MAKE_BACK_GRAPH)
564         AC_DEFINE(SAVE_CALL_COUNT, 8)
565         AC_CHECK_LIB(unwind, backtrace, [
566           AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
567           UNWINDLIBS=-lunwind
568           AC_MSG_WARN("Client code may need to link against libunwind.")
569         ])
570       ;;
571       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
572         AC_DEFINE(MAKE_BACK_GRAPH)
573         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
574         AC_DEFINE(SAVE_CALL_COUNT, 8)
575       ;;
576       i[3456]86-*-dgux*)
577         AC_DEFINE(MAKE_BACK_GRAPH)
578       ;;
579     esac ]
580   fi)
581
582 AC_SUBST(UNWINDLIBS)
583
584 AC_ARG_ENABLE(gc-assertions,
585     [AC_HELP_STRING([--enable-gc-assertions],
586         [collector-internal assertion checking])])
587 if test "${enable_gc_assertions}" = yes; then
588     AC_DEFINE(GC_ASSERTIONS)
589 fi
590
591 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
592
593
594 dnl Atomic Ops
595 dnl ----------
596
597 atomic_ops_libs=-latomic_ops
598 AC_CHECK_HEADER(atomic_ops.h,
599   [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
600   [ ao_dir=
601     for candidate in ${srcdir}/libatomic_ops*; do
602         case $candidate in
603             *.tar.gz)
604                 ;;
605             *install)
606                 dnl generated by alternate Makefile.
607                 ;;
608             *)
609                 if test -e "$candidate"; then
610                     ao_dir="$candidate"
611                 fi
612                 ;;
613         esac
614     done
615     if test -z "$ao_dir"; then
616         AC_MSG_ERROR([Missig libatomic_ops.])
617     fi
618     ao_version="${ao_dir#*libatomic_ops-}"
619     AC_MSG_NOTICE([Using internal version of libatomic_ops])
620
621     dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
622     test -e ${srcdir}/libatomic_ops \
623         || ln -s ${ao_dir} ${srcdir}/libatomic_ops
624     AC_CONFIG_SUBDIRS(libatomic_ops)
625
626     dnl Also copy the source files to be linked in.
627     test -e ${srcdir}/atomic_ops.c \
628         || ln -s ${srcdir}/libatomic_ops/src/atomic_ops.c \
629                  ${srcdir}/atomic_ops.c
630
631     test -e ${srcdir}/atomic_ops_sysdeps.S \
632         || ln -s ${srcdir}/libatomic_ops/src/atomic_ops_sysdeps.S \
633                  ${srcdir}/atomic_ops_sysdeps.S
634
635     dnl This gets the source include files, which is often close enough.
636     dnl It also makes atomic_ops_sysdeps.S assemble.
637     GC_CFLAGS="${GC_CFLAGS} -I \$(top_srcdir)/libatomic_ops/src"
638     maybe_libatomic_ops="libatomic_ops"
639   ])
640
641 AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
642                 test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
643 AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
644 AC_SUBST(atomic_ops_libs)
645
646 dnl Produce the Files
647 dnl -----------------
648
649 AC_CONFIG_FILES([Makefile bdw-gc.pc])
650
651 AC_CONFIG_COMMANDS([default],,
652   [ srcdir=${srcdir}
653     host=${host}
654     CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
655     CC="${CC}"
656     DEFS="$DEFS" ])
657
658 AC_OUTPUT