TIVI-153: Add as dependency for Iputils
[profile/ivi/gc.git] / 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.1,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.35 $)
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         # 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     dnl Wine getenv may not return NULL for missing entry
191     AC_DEFINE(NO_GETENV)
192     ;;
193  dgux386)
194     THREADS=dgux386
195     AC_MSG_RESULT($THREADDLLIBS)
196     # Use pthread GCC  switch
197     THREADDLLIBS=-pthread
198     if test "${enable_parallel_mark}" = yes; then
199         AC_DEFINE(PARALLEL_MARK)
200     fi
201     AC_DEFINE(THREAD_LOCAL_ALLOC)
202     AC_MSG_WARN("Explict GC_INIT() calls may be required.");
203     AC_DEFINE(GC_DGUX386_THREADS)
204     AC_DEFINE(DGUX_THREADS)
205     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
206     INCLUDES="-pthread $INCLUDES"
207     ;;
208  aix)
209     THREADS=posix
210     THREADDLLIBS=-lpthread
211     AC_DEFINE(GC_AIX_THREADS)
212     AC_DEFINE(_REENTRANT)
213     ;;
214  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
215     AC_MSG_ERROR(thread package $THREADS not yet supported)
216     ;;
217  *)
218     AC_MSG_ERROR($THREADS is an unknown thread package)
219     ;;
220 esac
221 AC_SUBST(THREADDLLIBS)
222 AM_CONDITIONAL(THREADS, test x$THREADS != xnone)
223 AM_CONDITIONAL(PTHREADS, test x$THREADS = xposix)
224 AM_CONDITIONAL(DARWIN_THREADS, test x$darwin_threads = xtrue)
225 AM_CONDITIONAL(WIN32_THREADS, test x$win32_threads = xtrue)
226
227 case "$host" in 
228    powerpc-*-darwin*)
229       powerpc_darwin=true
230       ;;
231 esac
232
233 # Darwin needs a few extra special tests to deal with variation in the
234 # system headers.
235 case "$host" in
236   powerpc*-*-darwin*)
237     AC_CHECK_MEMBER(ppc_thread_state_t.r0,
238       AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
239         [ppc_thread_state_t has field r0]),,
240       [#include <mach/thread_status.h>])
241     AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
242       AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
243         [ppc_thread_state_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>])
249     AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
250       AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
251         [ppc_thread_state64_t has field __r0]),,
252       [#include <mach/thread_status.h>])
253     ;;
254   i?86*-*-darwin*)
255     AC_CHECK_MEMBER(x86_thread_state32_t.eax,
256       AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
257         [x86_thread_state32_t has field eax]),,
258       [#include <sys/cdefs.h>
259       #include <mach/thread_status.h>])
260     AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
261       AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
262         [x86_thread_state32_t has field __eax]),,
263       [#include <sys/cdefs.h>
264       #include <mach/thread_status.h>])
265     ;;
266   x86_64-*-darwin*)
267     AC_CHECK_MEMBER(x86_thread_state64_t.rax,
268       AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
269         [x86_thread_state64_t has field rax]),,
270       [#include <sys/cdefs.h>
271       #include <mach/thread_status.h>])
272     AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
273       AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
274         [x86_thread_state64_t has field __rax]),,
275       [#include <sys/cdefs.h>
276       #include <mach/thread_status.h>])
277      ;;
278   *) ;;
279 esac
280
281 AC_MSG_CHECKING(for xlc)
282 AC_TRY_COMPILE([],[
283  #ifndef __xlC__
284  # error
285  #endif
286 ], [compiler_xlc=yes], [compiler_xlc=no])
287 AC_MSG_RESULT($compiler_xlc)
288 AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
289 if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
290   # the darwin stack-frame-walking code is completely broken on xlc
291   AC_DEFINE(DARWIN_DONT_PARSE_STACK)
292 fi
293
294 # We never want libdl on darwin. It is a fake libdl that just ends up making
295 # dyld calls anyway
296 case "$host" in
297   *-*-darwin*) ;;
298   *)
299     AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
300     ;;
301 esac
302
303 case "$host" in
304   *-*-hpux*)
305     avoid_cpp_lib=yes;;
306   *)
307     avoid_cpp_lib=no;
308     ;;
309 esac
310 AM_CONDITIONAL(AVOID_CPP_LIB,test $avoid_cpp_lib = yes)
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)
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      ;;
364  *)
365      ;;
366 esac
367
368 AC_MSG_RESULT($enable_shared)
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)
386     ;;
387  mipstx39-*-elf*)
388     machdep="mach_dep.lo"
389     AC_DEFINE(STACKBASE, __stackbase)
390     AC_DEFINE(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     dnl AC_DEFINE(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)
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 Include defines that have become de facto standard.
494 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
495 AC_DEFINE(NO_EXECUTE_PERMISSION)
496 AC_DEFINE(ALL_INTERIOR_POINTERS)
497
498
499 dnl Interface Selection
500 dnl -------------------
501 dnl
502 dnl By default, make the library as general as possible.
503 dnl enable_gcj_support=no
504 AC_ARG_ENABLE(gcj-support,
505     [AC_HELP_STRING([--disable-gcj-support],
506         [Disable support for gcj.])])
507 AM_CONDITIONAL(ENABLE_GCJ_SUPPORT,
508     [test x"$enable_gcj_support" != xno])
509 if test x"$enable_gcj_support" != xno; then
510     AC_DEFINE(GC_GCJ_SUPPORT, 1, [Define to include support for gcj])
511 fi
512
513 AC_ARG_ENABLE(java-finalization,
514     [AC_HELP_STRING([--disable-java-finalization],
515         [Disable support for java finalization.])])
516 if test x"$enable_java_finalization" != xno; then
517     AC_DEFINE(JAVA_FINALIZATION)
518 fi
519
520 AC_ARG_ENABLE(atomic-uncollectable,
521     [AC_HELP_STRING([--disable-atomic-uncollectible],
522         [Disable support for atomic uncollectible allocation.])])
523 if test x"$enable_atomic_uncollectible" != x"no"; then
524     AC_DEFINE(ATOMIC_UNCOLLECTABLE, 1,
525         [Define to enable atomic uncollectible allocation.])
526 fi
527
528 AC_ARG_ENABLE(redirect-malloc,
529     [AC_HELP_STRING([--enable-redirect-malloc],
530         [Redirect malloc and friends to GC routines])])
531
532 if test "${enable_redirect_malloc}" = yes; then
533     if test "${enable_full_debug}" = yes; then
534         AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
535         AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
536         AC_DEFINE(REDIRECT_FREE, GC_debug_free)
537     else
538         AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
539     fi
540     AC_DEFINE(GC_USE_DLOPEN_WRAP)
541 fi
542
543 AC_ARG_ENABLE(large-config,
544     [AC_HELP_STRING([--enable-large-config],
545         [Optimize for large (> 100 MB) heap or root set])])
546
547 if test "${enable_large_config}" = yes; then
548     AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
549 fi
550
551 dnl This is something of a hack.  When cross-compiling we turn off
552 dnl some functionality.  We also enable the "small" configuration.
553 dnl These is only correct when targetting an embedded system.  FIXME.
554 if test -n "${with_cross_host}"; then
555    AC_DEFINE(NO_CLOCK)
556    AC_DEFINE(SMALL_CONFIG)
557    AC_DEFINE(NO_DEBUGGING)
558 fi
559
560
561 dnl Debugging
562 dnl ---------
563
564 UNWINDLIBS=
565 AC_ARG_ENABLE(gc-debug,
566 [AC_HELP_STRING([--enable-gc-debug],
567     [include full support for pointer backtracing etc.])],
568 [ if test "$enable_gc_debug" = "yes"; then
569     AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
570     AC_DEFINE(KEEP_BACK_PTRS)
571     AC_DEFINE(DBG_HDRS_ALL)
572     case $host in
573       ia64-*-linux* )
574         AC_DEFINE(MAKE_BACK_GRAPH)
575         AC_DEFINE(SAVE_CALL_COUNT, 8)
576         AC_CHECK_LIB(unwind, backtrace, [
577           AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
578           UNWINDLIBS=-lunwind
579           AC_MSG_WARN("Client code may need to link against libunwind.")
580         ])
581       ;;
582       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
583         AC_DEFINE(MAKE_BACK_GRAPH)
584         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
585         AC_DEFINE(SAVE_CALL_COUNT, 8)
586       ;;
587       i[3456]86-*-dgux*)
588         AC_DEFINE(MAKE_BACK_GRAPH)
589       ;;
590     esac ]
591   fi)
592
593 AC_SUBST(UNWINDLIBS)
594
595 AC_ARG_ENABLE(gc-assertions,
596     [AC_HELP_STRING([--enable-gc-assertions],
597         [collector-internal assertion checking])])
598 if test "${enable_gc_assertions}" = yes; then
599     AC_DEFINE(GC_ASSERTIONS)
600 fi
601
602 AC_ARG_ENABLE(munmap,
603     [AC_HELP_STRING([--enable-munmap=N],
604         [return page to the os if empty for N collections])],
605   MUNMAP_THRESHOLD=$enableval;
606    [case "$MMAP" in
607       no)
608         AC_MSG_ERROR([--enable-munmap requires --enable-mmap])
609         ;;
610     esac]
611    )
612 if test "${enable_munmap}" != ""; then
613     AC_DEFINE(USE_MMAP)
614     AC_DEFINE(USE_MUNMAP)
615     if test "${MUNMAP_THRESHOLD}" = "yes"; then
616       MUNMAP_THRESHOLD=6
617     fi
618     AC_DEFINE_UNQUOTED(MUNMAP_THRESHOLD, ${MUNMAP_THRESHOLD})
619 fi
620
621 AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
622
623
624 dnl Atomic Ops
625 dnl ----------
626
627 atomic_ops_libs=-latomic_ops
628 AC_CHECK_HEADER(atomic_ops.h,
629   [ AC_MSG_NOTICE([Using pre-installed libatomic_ops]) ],
630   [ ao_dir=
631     for candidate in ${srcdir}/libatomic_ops*; do
632         case $candidate in
633             *.tar.gz)
634                 ;;
635             *install)
636                 dnl generated by alternate Makefile.
637                 ;;
638             *)
639                 if test -e "$candidate"; then
640                     ao_dir="$candidate"
641                 fi
642                 ;;
643         esac
644     done
645     if test -z "$ao_dir"; then
646         AC_MSG_ERROR([Missig libatomic_ops.])
647     fi
648     ao_version="${ao_dir#*libatomic_ops-}"
649     AC_MSG_NOTICE([Using internal version of libatomic_ops])
650
651     dnl Automake does not accept shell variables in AC_CONFIG_SUBDIRS
652     test -e libatomic_ops \
653         || ln -s ${ao_dir} libatomic_ops
654     AC_CONFIG_SUBDIRS(libatomic_ops)
655
656     dnl Also copy the source files to be linked in.
657     test -e atomic_ops.c \
658         || ln -s libatomic_ops/src/atomic_ops.c \
659                  atomic_ops.c
660
661     test -e atomic_ops_sysdeps.S \
662         || ln -s libatomic_ops/src/atomic_ops_sysdeps.S \
663                  atomic_ops_sysdeps.S
664
665     dnl This gets the source include files, which is often close enough.
666     dnl It also makes atomic_ops_sysdeps.S assemble.
667     GC_CFLAGS="${GC_CFLAGS} -I libatomic_ops/src"
668     maybe_libatomic_ops="libatomic_ops"
669   ])
670
671 AM_CONDITIONAL(USE_INTERNAL_LIBATOMIC_OPS,
672                 test -n "$maybe_libatomic_ops" -a "$THREADS" != "none")
673 AM_CONDITIONAL(NEED_ATOMIC_OPS_ASM, test -n "$maybe_libatomic_ops" -a x$need_atomic_ops_asm = xtrue)
674 AC_SUBST(atomic_ops_libs)
675
676 dnl Produce the Files
677 dnl -----------------
678
679 AC_CONFIG_FILES([Makefile bdw-gc.pc])
680
681 AC_CONFIG_COMMANDS([default],,
682   [ srcdir=${srcdir}
683     host=${host}
684     CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
685     CC="${CC}"
686     DEFS="$DEFS" ])
687
688 AC_OUTPUT