* gcc.target/powerpc/altivec-volatile.c: Adjust expected warning.
[official-gcc.git] / boehm-gc / configure.ac
blob32c627524a77b8583b73b9ebcbaf57c4dcb7b3f5
1 # Copyright (c) 1999, 2000, 2001, 2002, 2003, 2006, 2010 by Red Hat, Inc.
2 # All rights reserved.
3 # Copyright 2004 Nathanael Nerode
4
5 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6 # OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
7
8 # Permission is hereby granted to use or copy this program
9 # for any purpose,  provided the above notices are retained on all copies.
10 # Permission to modify the code and to distribute modified code is granted,
11 # provided the above notices are retained, and a notice that the code was
12 # modified is included with the above copyright notice.
14 # Original author: Tom Tromey
15 # Modified by Nathanael Nerode
17 dnl Process this file with autoconf to produce configure.
19 AC_PREREQ(2.64)
20 AC_INIT
21 AC_CONFIG_SRCDIR(gcj_mlc.c)
22 # This works around the fact that libtool configuration may change LD
23 # for this particular configuration, but some shells, instead of
24 # keeping the changes in LD private, export them just because LD is
25 # exported.
26 ORIGINAL_LD_FOR_MULTILIBS=$LD
28 AM_ENABLE_MULTILIB(, ..)
30 AC_CANONICAL_HOST
31 AC_CANONICAL_TARGET
33 # Get the 'noncanonical' system names.
34 ACX_NONCANONICAL_TARGET
36 # This works around an automake problem.
37 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
38 AC_SUBST(mkinstalldirs)
40 AM_INIT_AUTOMAKE(gc, 6.6, no-define)
42 # The autoconf 2.5x version of the no-executables hack.
43 GCC_NO_EXECUTABLES
45 # Yak.  We must force CC and CXX to /not/ be precious variables; otherwise
46 # the wrong, non-multilib-adjusted value will be used in multilibs.
47 # As a side effect, we have to subst CFLAGS and CXXFLAGS ourselves.
49 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
50 m4_define([_AC_ARG_VAR_PRECIOUS],[])
51 AC_PROG_CC
52 AC_PROG_CXX
53 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
55 AM_PROG_CC_C_O
57 AC_SUBST(CFLAGS)
58 AC_SUBST(CXXFLAGS)
60 # Newer automakes demand CCAS and CCASFLAGS.
61 : ${CCAS='$(CC)'}
62 : ${CCASFLAGS='$(CFLAGS)'}
63 AC_SUBST(CCAS)
64 AC_SUBST(CCASFLAGS)
66 AC_CHECK_TOOL(AS, as)
67 AC_CHECK_TOOL(AR, ar)
68 AC_CHECK_TOOL(RANLIB, ranlib, :)
70 AC_PROG_INSTALL
72 AM_MAINTAINER_MODE
74 . ${srcdir}/configure.host
76 case ${gc_basedir} in
77 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=${gc_basedir} ;;
78 *) gc_flagbasedir='$(top_builddir)/'${gc_basedir} ;;
79 esac
81 gc_cflags="${gc_cflags} -Iinclude -I"'$(top_builddir)'"/./targ-include -I${gc_flagbasedir}/libc/include"
82 case "${host}" in
83   *-*-cygwin32*)
84     gc_cflags="${gc_cflags} -I${gc_flagbasedir}/../winsup/include"
85     ;;
86 esac
88 dnl Add for mingw targets GC_BUILD option
89 case "${host}" in
90   *-*-mingw*)
91     gc_cflags="${gc_cflags} -DGC_BUILD=1"
92     ;;
93 esac
95 dnl gc_cflags="${gc_cflags} -fno-builtin"
97 GC_CFLAGS=${gc_cflags}
98 AC_SUBST(GC_CFLAGS)
100 AC_PROG_LIBTOOL
102 dnl We use these options to decide which functions to include.
103 AC_ARG_WITH(target-subdir,
104 [  --with-target-subdir=SUBDIR
105                           configuring with a cross compiler])
106 AC_ARG_WITH(cross-host,
107 [  --with-cross-host=HOST  configuring with a cross compiler])
109 AC_MSG_CHECKING([for thread model used by GCC])
110 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
111 if test -z "$THREADS"; then
112    THREADS=no
114 AC_MSG_RESULT([$THREADS])
116 AC_ARG_ENABLE(parallel-mark,
117 [  --enable-parallel-mark       parallelize marking and free list construction],
118    [case "$THREADS" in
119       no | none | single)
120         AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
121         ;;
122     esac]
125 AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
126 THREADLIBS=
127 case "$THREADS" in
128  no | none | single)
129     THREADS=none
130     ;;
131  posix | posix95 | pthreads)
132     THREADS=posix
133     THREADLIBS=-lpthread
134     case "$host" in
135      x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
136         AC_DEFINE(GC_LINUX_THREADS,1,[support for Xavier Leroy's Linux threads])
137         AC_DEFINE(_REENTRANT,1,[Use reentrant code])
138         if test "${enable_parallel_mark}" = yes; then
139           AC_DEFINE(PARALLEL_MARK,1,[allow the marker to run in multiple threads])
140         fi
141         AC_DEFINE(THREAD_LOCAL_ALLOC,1,[define GC_local_malloc() & GC_local_malloc_atomic()])
142         ;;
143      *-*-linux*)
144         AC_DEFINE(GC_LINUX_THREADS,1)
145         AC_DEFINE(_REENTRANT,1)
146         ;;
147      *-*-aix*)
148         AC_DEFINE(GC_AIX_THREADS,1,[support AIX threads])
149         AC_DEFINE(_REENTRANT,1)
150         ;;
151      *-*-hpux11*)
152         AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
153         AC_DEFINE(GC_HPUX_THREADS,1,[enables support for HP/UX 11 pthreads])
154         AC_DEFINE(_POSIX_C_SOURCE,199506L,[POSIX version of C Source])
155         if test "${enable_parallel_mark}" = yes; then
156           AC_DEFINE(PARALLEL_MARK,1)
157         fi
158         AC_DEFINE(THREAD_LOCAL_ALLOC,1)
159         THREADLIBS="-lpthread -lrt"
160         # HPUX needs REENTRANT for the _r calls.
161         AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads])
162         ;;
163      *-*-hpux10*)
164         AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
165         ;;
166       *-*-kfreebsd*-gnu)
167        AC_DEFINE(GC_FREEBSD_THREADS)
168        INCLUDES="$INCLUDES -pthread"
169        THREADDLLIBS=-pthread
170        AC_DEFINE(_REENTRANT)
171          if test "${enable_parallel_mark}" = yes; then
172          AC_DEFINE(PARALLEL_MARK)
173        fi
174        AC_DEFINE(THREAD_LOCAL_ALLOC)
175        AC_DEFINE(USE_COMPILER_TLS, 1,[use tls for boehm])
176                ;;
177      *-*-freebsd*)
178         AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
179         AC_DEFINE(GC_FREEBSD_THREADS,1,[support FreeBSD threads])
180         AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
181         THREADLIBS=-pthread
182         ;;
183      *-*-solaris2.8*)
184         AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
185         # Need to use alternate thread library, otherwise gctest hangs
186         # on Solaris 8.
187         multi_os_directory=`$CC -print-multi-os-directory`
188         THREADLIBS="-L/usr/lib/lwp/$multi_os_directory \
189                     -R/usr/lib/lwp/$multi_os_directory -lpthread -lthread -lrt"
190         ;;
191      *-*-solaris2*)
192         AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
193         # The alternate thread library was only introduced in Solaris 8 and
194         # became the default in Solaris 9, so no need for the special code
195         # above otherwise.
196         THREADLIBS=-lpthread
197         ;;
198      *-*-irix*)
199         AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
200         ;;
201      *-*-cygwin*)
202         AC_DEFINE(GC_WIN32_THREADS,1,[support for win32 threads])
203         ;;
204      *-*-darwin*)
205         AC_DEFINE(GC_DARWIN_THREADS,1,[support for Mac OS X pthreads])
206         AC_DEFINE(THREAD_LOCAL_ALLOC,1)
207         if test "${enable_parallel_mark}" = yes; then
208           AC_DEFINE(PARALLEL_MARK,1)
209         fi
210         ;;
211      *-*-osf*)
212         AC_DEFINE(GC_OSF1_THREADS,1,[support for Tru64 pthreads])
213         if test "${enable_parallel_mark}" = yes; then
214           AC_DEFINE(PARALLEL_MARK,1)
215           AC_DEFINE(THREAD_LOCAL_ALLOC,1)
216           # May want to enable it in other cases, too.
217           # Measurements havent yet been done.
218         fi
219         AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
220         THREADLIBS="-lpthread -lrt"
221         ;;
222     esac
223     ;;
224  win32)
225     AC_DEFINE(GC_WIN32_THREADS,1)
226     dnl Old wine getenv may not return NULL for missing entry.
227     dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
228     ;;
229  dgux386)
230     THREADS=dgux386
231 AC_MSG_RESULT($THREADLIBS)
232     # Use pthread GCC  switch
233     THREADLIBS=-pthread
234     if test "${enable_parallel_mark}" = yes; then
235         AC_DEFINE(PARALLEL_MARK,1)
236     fi
237     AC_DEFINE(THREAD_LOCAL_ALLOC,1)
238     AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
239     AC_DEFINE(DGUX_THREADS,1,[No description])
240     # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
241     AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
242     ;;
243  aix)
244     THREADS=posix
245     THREADLIBS=-lpthread
246     AC_DEFINE(GC_AIX_THREADS,1)
247     AC_DEFINE(_REENTRANT,1)
248     ;;
249  decosf1 | irix | mach | os2 | solaris | dce | vxworks)
250     AC_MSG_ERROR(thread package $THREADS not yet supported)
251     ;;
252  *)
253     AC_MSG_ERROR($THREADS is an unknown thread package)
254     ;;
255 esac
256 AC_SUBST(THREADLIBS)
258 case "$host" in
259    powerpc-*-darwin*)
260       powerpc_darwin=true
261       ;;
262 esac
263 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
265 # Darwin needs a few extra special tests to deal with variation in the
266 # system headers.
267 case "$host" in
268   powerpc*-*-darwin*)
269     AC_CHECK_MEMBER(ppc_thread_state_t.r0,
270       AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
271         [ppc_thread_state_t has field r0]),,
272       [#include <mach/thread_status.h>])
273     AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
274       AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
275         [ppc_thread_state_t has field __r0]),,
276       [#include <mach/thread_status.h>])
277     AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
278       AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
279         [ppc_thread_state64_t has field r0]),,
280       [#include <mach/thread_status.h>])
281     AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
282       AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
283         [ppc_thread_state64_t has field __r0]),,
284       [#include <mach/thread_status.h>])
285     ;;
286   i?86*-*-darwin*)
287     AC_CHECK_MEMBER(x86_thread_state32_t.eax,
288       AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
289         [x86_thread_state32_t has field eax]),,
290       [#include <sys/cdefs.h>
291       #include <mach/thread_status.h>])
292     AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
293       AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
294         [x86_thread_state32_t has field __eax]),,
295       [#include <sys/cdefs.h>
296       #include <mach/thread_status.h>])
297     ;;
298   x86_64-*-darwin*)
299     AC_CHECK_MEMBER(x86_thread_state64_t.rax,
300       AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
301         [x86_thread_state64_t has field rax]),,
302       [#include <sys/cdefs.h>
303       #include <mach/thread_status.h>])
304     AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
305       AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
306         [x86_thread_state64_t has field __rax]),,
307       [#include <sys/cdefs.h>
308       #include <mach/thread_status.h>])
309      ;;
310   *) ;;
311 esac
313 # We never want libdl on darwin. It is a fake libdl that just ends up making
314 # dyld calls anyway
315 case "$host" in
316   *-*-darwin*) ;;
317   *)
318     AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
319     ;;
320 esac
322 # extra LD Flags which are required for targets
323 case "${host}" in
324   *-*-darwin*)
325     extra_ldflags_libgc=-Wl,-single_module
326     ;;
327 esac
328 AC_SUBST(extra_ldflags_libgc)
330 AC_SUBST(EXTRA_TEST_LIBS)
332 target_all=libgcjgc.la
333 AC_SUBST(target_all)
335 dnl If the target is an eCos system, use the appropriate eCos
336 dnl I/O routines.
337 dnl FIXME: this should not be a local option but a global target
338 dnl system; at present there is no eCos target.
339 TARGET_ECOS="no"
340 AC_ARG_WITH(ecos,
341 [  --with-ecos             enable runtime eCos target support],
342 TARGET_ECOS="$with_ecos"
345 addobjs=
346 addlibs=
347 addincludes=
348 addtests=
349 case "$TARGET_ECOS" in
350    no)
351       ;;
352    *)
353       AC_DEFINE(ECOS,1,[Target is ECOS])
354       AM_CPPFLAGS="${AM_CPPFLAGS} -I${TARGET_ECOS}/include"
355       addobjs="$addobjs ecos.lo"
356       ;;
357 esac
359 if test "${enable_cplusplus}" = yes; then
360       addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
361       addtests="$addtests test_cpp"
364 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
366 AC_SUBST(CXX)
368 AC_SUBST(AM_CPPFLAGS)
370 # Configuration of shared libraries
372 AC_MSG_CHECKING(whether to build shared libraries)
373 AC_ENABLE_SHARED
375 case "$host" in
376  alpha-*-openbsd*)
377      enable_shared=no
378      AC_MSG_RESULT(no)
379      ;;
380  *)
381      AC_MSG_RESULT(yes)
382      ;;
383 esac
385 # Checks for pthreads functions
387 oldLIBS="$LIBS"
388 LIBS="$LIBS $THREADLIBS"
389 AC_CHECK_FUNCS([pthread_getattr_np])
390 LIBS="$oldLIBS"
392 # Configuration of machine-dependent code
394 # Set NO_EXECUTE_PERMISSION by default because gcj already uses
395 # ffi_closure_{alloc,free} which takes care of allocating trampolines
396 # in executable memory.
398 AC_MSG_CHECKING(which machine-dependent code should be used)
399 machdep=
400 case "$host" in
401  alpha*-*-openbsd*)
402     machdep="alpha_mach_dep.lo"
403     if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
404        AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
405     fi
406     ;;
407  alpha*-*-linux*)
408     machdep="alpha_mach_dep.lo"
409     ;;
410  i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
411     AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED,1,[PROC_VDB in Solaris 2.5 gives wrong values for dirty bits])
412     ;;
413  mipstx39-*-elf*)
414     machdep="mips_ultrix_mach_dep.lo"
415     AC_DEFINE(STACKBASE, __stackbase,[No description])
416     AC_DEFINE(DATASTART_IS_ETEXT,1,[No description])
417     ;;
418  mips-dec-ultrix*)
419     machdep="mips_ultrix_mach-dep.lo"
420     ;;
421  mips-nec-sysv*|mips-unknown-sysv*)
422     ;;
423  mips*-*-linux*)
424     ;;
425  mips-*-*)
426     machdep="mips_sgi_mach_dep.lo"
427     ;;
428  sparc-*-netbsd*)
429     machdep="sparc_netbsd_mach_dep.lo"
430     ;;
431  sparc-sun-solaris2.3)
432     machdep="sparc_mach_dep.lo"
433     AC_DEFINE(SUNOS53_SHARED_LIB,1,[Avoid Solaris 5.3 dynamic library bug])
434     ;;
435  sparc*-sun-solaris2.*)
436     machdep="sparc_mach_dep.lo"
437     ;;
438  ia64-*-*)
439     machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
440     ;;
441 esac
442 AC_DEFINE(NO_EXECUTE_PERMISSION,1,[cause some or all of the heap to not have execute permission])
443 if test x"$machdep" = x; then
444 AC_MSG_RESULT($machdep)
445    machdep="mach_dep.lo"
447 addobjs="$addobjs $machdep"
448 AC_SUBST(addobjs)
449 AC_SUBST(addincludes)
450 AC_SUBST(addlibs)
451 AC_SUBST(addtests)
454 # Check for AViiON Machines running DGUX
456 AC_MSG_CHECKING(if host is AViiON running DGUX)
457 ac_is_dgux=no
458 AC_CHECK_HEADER(sys/dg_sys_info.h,
459 [ac_is_dgux=yes;])
461 AC_MSG_RESULT($ac_is_dgux)
462     ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
463 if test $ac_is_dgux = yes; then
464     if test "$enable_full_debug" = "yes"; then
465       CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
466       CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
467     else
468       CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
469       CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
470     fi
471     AC_SUBST(CFLAGS)
472     AC_SUBST(CXXFLAGS)
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
501 dnl We need to override the top-level CFLAGS.  This is how we do it.
502 MY_CFLAGS="$CFLAGS"
503 AC_SUBST(MY_CFLAGS)
505 dnl Include defines that have become de facto standard.
506 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
507 AC_DEFINE(SILENT,1,[disables statistics printing])
508 AC_DEFINE(NO_SIGNALS,1,[does not disable signals])
509 AC_DEFINE(ALL_INTERIOR_POINTERS,1,[allows all pointers to the interior of objects to be recognized])
511 dnl By default, make the library as general as possible.
512 AC_DEFINE(JAVA_FINALIZATION,1,[make it somewhat safer to finalize objects out of order])
513 AC_DEFINE(GC_GCJ_SUPPORT,1,[include support for gcj])
514 AC_DEFINE(ATOMIC_UNCOLLECTABLE,1,[include code for GC_malloc_atomic_uncollectable])
516 AC_ARG_ENABLE(gc-debug,
517 [  --enable-gc-debug    include full support for pointer backtracing etc.],
518 [ if test "$enable_gc_debug" = "yes"; then
519     AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
520     AC_DEFINE(KEEP_BACK_PTRS,1,[Add code to save back pointers])
521     AC_DEFINE(DBG_HDRS_ALL,1,[Make sure that all objects have debug headers])
522     case $host in
523       ia64-*-linux* )
524         AC_DEFINE(MAKE_BACK_GRAPH,1,[Enable GC_PRINT_BACK_HEIGHT environment variable])
525       ;;
526       x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
527         AC_DEFINE(MAKE_BACK_GRAPH,1)
528         AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
529         AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects allocated through the debugging interface])
530       ;;
531       i[3456]86-*-dgux*)
532         AC_DEFINE(MAKE_BACK_GRAPH,1)
533       ;;
534     esac 
535   fi])
537 if test "${gc_use_mmap}" = "yes"; then
538   AC_DEFINE(USE_MMAP, 1, [use MMAP instead of sbrk to get new memory])
541 if test -n "$with_cross_host" &&
542    test x"$with_cross_host" != x"no"; then
543   toolexecdir='$(exec_prefix)/$(target_noncanonical)'
544   toolexeclibdir='$(toolexecdir)/lib'
545 else
546   toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
547   toolexeclibdir='$(libdir)'
549 multi_os_directory=`$CC -print-multi-os-directory`
550 case $multi_os_directory in
551   .) ;; # Avoid trailing /.
552   *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
553 esac
554 AC_SUBST(toolexecdir)
555 AC_SUBST(toolexeclibdir)
557 if test "${multilib}" = "yes"; then
558   multilib_arg="--enable-multilib"
559 else
560   multilib_arg=
563 AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
565 AC_CONFIG_FILES(Makefile include/Makefile threads.mk)
566 AC_OUTPUT