]> git.ipfire.org Git - thirdparty/gcc.git/blame - boehm-gc/configure.ac
Don't build thread library for targets that don't support threads.
[thirdparty/gcc.git] / boehm-gc / configure.ac
CommitLineData
13b6e5b4 1# Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved.
d38d6003 2# Copyright 2004 Nathanael Nerode
5a2586cf
TT
3#
4# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
5# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
6#
7# Permission is hereby granted to use or copy this program
8# for any purpose, provided the above notices are retained on all copies.
9# Permission to modify the code and to distribute modified code is granted,
10# provided the above notices are retained, and a notice that the code was
11# modified is included with the above copyright notice.
12#
13# Original author: Tom Tromey
d38d6003 14# Modified by Nathanael Nerode
5a2586cf 15
1530be84
TT
16dnl Process this file with autoconf to produce configure.
17
8ab705be 18AC_PREREQ(2.59)
13b040f1
NN
19AC_INIT
20AC_CONFIG_SRCDIR(gcj_mlc.c)
6706f116
AO
21# This works around the fact that libtool configuration may change LD
22# for this particular configuration, but some shells, instead of
23# keeping the changes in LD private, export them just because LD is
24# exported.
25ORIGINAL_LD_FOR_MULTILIBS=$LD
26
bf9a420e 27AM_ENABLE_MULTILIB(, ..)
b1891e51 28
13b040f1
NN
29AC_CANONICAL_HOST
30AC_CANONICAL_TARGET
b1891e51 31
d38d6003 32# Get the 'noncanonical' system names.
13b040f1 33ACX_NONCANONICAL_TARGET
d38d6003 34
b1891e51
NN
35# This works around an automake problem.
36mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
37AC_SUBST(mkinstalldirs)
38
4109fe85 39AM_INIT_AUTOMAKE(gc, 6.3, no-define)
a749e46c
NN
40
41# The autoconf 2.5x version of the no-executables hack.
a749e46c
NN
42GCC_NO_EXECUTABLES
43
44# Yak. We must force CC and CXX to /not/ be precious variables; otherwise
45# the wrong, non-multilib-adjusted value will be used in multilibs.
46# As a side effect, we have to subst CFLAGS and CXXFLAGS ourselves.
47
48m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
49m4_define([_AC_ARG_VAR_PRECIOUS],[])
50AC_PROG_CC
51AC_PROG_CXX
52m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
53
bf9a420e
PB
54AM_PROG_CC_C_O
55
a749e46c
NN
56AC_SUBST(CFLAGS)
57AC_SUBST(CXXFLAGS)
58
7664e6f8
NN
59# Newer automakes demand CCAS and CCASFLAGS.
60: ${CCAS='$(CC)'}
61: ${CCASFLAGS='$(CFLAGS)'}
62AC_SUBST(CCAS)
63AC_SUBST(CCASFLAGS)
64
a749e46c
NN
65AC_CHECK_TOOL(AS, as)
66AC_CHECK_TOOL(AR, ar)
67AC_CHECK_TOOL(RANLIB, ranlib, :)
68
69AC_PROG_INSTALL
70
71AM_MAINTAINER_MODE
72
13b040f1 73. ${srcdir}/configure.host
a749e46c 74
13b040f1
NN
75case ${gc_basedir} in
76/* | [A-Za-z]:[/\\]*) gc_flagbasedir=${gc_basedir} ;;
77*) gc_flagbasedir='$(top_builddir)/'${gc_basedir} ;;
a749e46c
NN
78esac
79
13b040f1 80gc_cflags="${gc_cflags} -Iinclude -I"'$(top_builddir)'"/./targ-include -I${gc_flagbasedir}/libc/include"
a749e46c
NN
81case "${host}" in
82 *-*-cygwin32*)
13b040f1 83 gc_cflags="${gc_cflags} -I${gc_flagbasedir}/../winsup/include"
a749e46c
NN
84 ;;
85esac
86
13b040f1 87dnl gc_cflags="${gc_cflags} -fno-builtin"
a749e46c
NN
88
89GC_CFLAGS=${gc_cflags}
90AC_SUBST(GC_CFLAGS)
1530be84 91
13b040f1 92AC_PROG_LIBTOOL
66deb2be 93
1530be84
TT
94dnl We use these options to decide which functions to include.
95AC_ARG_WITH(target-subdir,
61e922d2
RO
96[ --with-target-subdir=SUBDIR
97 configuring with a cross compiler])
1530be84 98AC_ARG_WITH(cross-host,
61e922d2 99[ --with-cross-host=HOST configuring with a cross compiler])
1530be84 100
0ff95153
TT
101AC_MSG_CHECKING([for thread model used by GCC])
102THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
103if test -z "$THREADS"; then
104 THREADS=no
105fi
106AC_MSG_RESULT([$THREADS])
5a2586cf
TT
107
108AC_ARG_ENABLE(parallel-mark,
109[ --enable-parallel-mark parallelize marking and free list construction],
110 [case "$THREADS" in
111 no | none | single)
112 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
113 ;;
114 esac]
115)
1530be84 116
bf9a420e 117AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
e301621d 118THREADLIBS=
1530be84
TT
119case "$THREADS" in
120 no | none | single)
121 THREADS=none
122 ;;
f3968b05 123 posix | posix95 | pthreads)
1530be84 124 THREADS=posix
62aa6b06 125 THREADLIBS=-lpthread
1530be84 126 case "$host" in
30c3de1f 127 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
5572488d
KC
128 AC_DEFINE(GC_LINUX_THREADS,1,[support for Xavier Leroy's Linux threads])
129 AC_DEFINE(_REENTRANT,1,[Use reentrant code])
30c3de1f 130 if test "${enable_parallel_mark}" = yes; then
5572488d 131 AC_DEFINE(PARALLEL_MARK,1,[allow the marker to run in multiple threads])
5a2586cf 132 fi
5572488d 133 AC_DEFINE(THREAD_LOCAL_ALLOC,1,[define GC_local_malloc() & GC_local_malloc_atomic()])
5a2586cf 134 ;;
1530be84 135 *-*-linux*)
5572488d
KC
136 AC_DEFINE(GC_LINUX_THREADS,1)
137 AC_DEFINE(_REENTRANT,1)
1530be84 138 ;;
30c3de1f 139 *-*-aix*)
5572488d
KC
140 AC_DEFINE(GC_AIX_THREADS,1,[support AIX threads])
141 AC_DEFINE(_REENTRANT,1)
30c3de1f 142 ;;
5a2586cf
TT
143 *-*-hpux*)
144 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
5572488d
KC
145 AC_DEFINE(GC_HPUX_THREADS,1,[enables support for HP/UX 11 pthreads])
146 AC_DEFINE(_POSIX_C_SOURCE,199506L,[POSIX version of C Source])
5a2586cf 147 if test "${enable_parallel_mark}" = yes; then
5572488d 148 AC_DEFINE(PARALLEL_MARK,1)
5a2586cf 149 fi
5572488d 150 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
5a2586cf
TT
151 THREADLIBS="-lpthread -lrt"
152 ;;
62aa6b06 153 *-*-freebsd*)
79f777fd 154 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
5572488d 155 AC_DEFINE(GC_FREEBSD_THREADS,1,[support FreeBSD threads])
bf9a420e 156 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
62aa6b06
LR
157 THREADLIBS=-pthread
158 ;;
1530be84 159 *-*-solaris*)
5572488d
KC
160 AC_DEFINE(GC_SOLARIS_THREADS,1,[support for Solaris (thr_) threads])
161 AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
1530be84 162 ;;
14caa62f 163 *-*-irix*)
5572488d 164 AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
14caa62f 165 ;;
a2d6e915 166 *-*-cygwin*)
5572488d 167 AC_DEFINE(GC_WIN32_THREADS,1,[support for win32 threads])
30c3de1f
JS
168 ;;
169 *-*-darwin*)
5572488d
KC
170 AC_DEFINE(GC_DARWIN_THREADS,1,[support for Mac OS X pthreads])
171 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
30c3de1f 172 if test "${enable_parallel_mark}" = yes; then
5572488d 173 AC_DEFINE(PARALLEL_MARK,1)
30c3de1f
JS
174 fi
175 ;;
176 *-*-osf*)
5572488d 177 AC_DEFINE(GC_OSF1_THREADS,1,[support for Tru64 pthreads])
30c3de1f 178 if test "${enable_parallel_mark}" = yes; then
5572488d
KC
179 AC_DEFINE(PARALLEL_MARK,1)
180 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
30c3de1f
JS
181 # May want to enable it in other cases, too.
182 # Measurements havent yet been done.
183 fi
bf9a420e 184 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
30c3de1f 185 THREADLIBS="-lpthread -lrt"
a2d6e915 186 ;;
1530be84
TT
187 esac
188 ;;
df61a3d2 189 win32)
5572488d 190 AC_DEFINE(GC_WIN32_THREADS,1)
aa44273b
HB
191 dnl Old wine getenv may not return NULL for missing entry.
192 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
30c3de1f
JS
193 ;;
194 dgux386)
195 THREADS=dgux386
196AC_MSG_RESULT($THREADLIBS)
197 # Use pthread GCC switch
198 THREADLIBS=-pthread
199 if test "${enable_parallel_mark}" = yes; then
5572488d 200 AC_DEFINE(PARALLEL_MARK,1)
e83a44d2 201 fi
5572488d
KC
202 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
203 AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
204 AC_DEFINE(DGUX_THREADS,1,[No description])
30c3de1f 205 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
bf9a420e 206 AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
30c3de1f
JS
207 ;;
208 aix)
209 THREADS=posix
210 THREADLIBS=-lpthread
5572488d
KC
211 AC_DEFINE(GC_AIX_THREADS,1)
212 AC_DEFINE(_REENTRANT,1)
df61a3d2
AM
213 ;;
214 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
1530be84
TT
215 AC_MSG_ERROR(thread package $THREADS not yet supported)
216 ;;
217 *)
218 AC_MSG_ERROR($THREADS is an unknown thread package)
219 ;;
220esac
e301621d 221AC_SUBST(THREADLIBS)
1530be84 222
8c048b48 223case "$host" in
30c3de1f
JS
224 powerpc-*-darwin*)
225 powerpc_darwin=true
226 ;;
227esac
228AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
229
230# We never want libdl on darwin. It is a fake libdl that just ends up making
231# dyld calls anyway
232case "$host" in
233 *-*-darwin*) ;;
8c048b48 234 *)
30c3de1f
JS
235 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
236 ;;
237esac
238
f2beb7ef
APB
239AC_SUBST(EXTRA_TEST_LIBS)
240
5a2586cf 241target_all=libgcjgc.la
1530be84
TT
242AC_SUBST(target_all)
243
244dnl If the target is an eCos system, use the appropriate eCos
245dnl I/O routines.
246dnl FIXME: this should not be a local option but a global target
247dnl system; at present there is no eCos target.
248TARGET_ECOS="no"
249AC_ARG_WITH(ecos,
61e922d2 250[ --with-ecos enable runtime eCos target support],
1530be84
TT
251TARGET_ECOS="$with_ecos"
252)
253
254addobjs=
30c3de1f
JS
255addlibs=
256addincludes=
257addtests=
1530be84
TT
258case "$TARGET_ECOS" in
259 no)
260 ;;
261 *)
5572488d 262 AC_DEFINE(ECOS,1,[Target is ECOS])
bf9a420e 263 AM_CPPFLAGS="${AM_CPPFLAGS} -I${TARGET_ECOS}/include"
66deb2be 264 addobjs="$addobjs ecos.lo"
1530be84
TT
265 ;;
266esac
30c3de1f
JS
267
268if test "${enable_cplusplus}" = yes; then
269 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
270 addtests="$addtests test_cpp"
271fi
272
273AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
274
1530be84
TT
275AC_SUBST(CXX)
276
bf9a420e 277AC_SUBST(AM_CPPFLAGS)
1530be84 278
30c3de1f
JS
279# Configuration of shared libraries
280#
281AC_MSG_CHECKING(whether to build shared libraries)
282AC_ENABLE_SHARED
283
284case "$host" in
285 alpha-*-openbsd*)
286 enable_shared=no
287 AC_MSG_RESULT(no)
288 ;;
289 *)
290 AC_MSG_RESULT(yes)
291 ;;
292esac
293
294# Configuration of machine-dependent code
295#
b27317b5
AH
296# We don't set NO_EXECUTE_PERMISSION by default because gcj (and
297# anything else that creates trampolines in gc-allocated memory)
1bec19cc 298# always needs exec permission. The exceptions to this are IA-64 and
b27317b5
AH
299# some variations of Power PC, where trampolines don't contain
300# executable code.
301#
8c048b48 302AC_MSG_CHECKING(which machine-dependent code should be used)
1530be84
TT
303machdep=
304case "$host" in
adb60117
RH
305 alpha*-*-openbsd*)
306 machdep="alpha_mach_dep.lo"
4c7726b1
BM
307 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
308 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
4c7726b1
BM
309 fi
310 ;;
30c3de1f 311 alpha*-*-linux*)
adb60117
RH
312 machdep="alpha_mach_dep.lo"
313 ;;
51ac684e 314 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
5572488d 315 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED,1,[PROC_VDB in Solaris 2.5 gives wrong values for dirty bits])
adb60117 316 ;;
1530be84 317 mipstx39-*-elf*)
66deb2be 318 machdep="mips_ultrix_mach_dep.lo"
5572488d
KC
319 AC_DEFINE(STACKBASE, __stackbase,[No description])
320 AC_DEFINE(DATASTART_IS_ETEXT,1,[No description])
1530be84 321 ;;
276836f0
RO
322 mips-dec-ultrix*)
323 machdep="mips_ultrix_mach-dep.lo"
324 ;;
30c3de1f 325 mips-nec-sysv*|mips-unknown-sysv*)
5316699d 326 ;;
8c048b48
NN
327 mips*-*-linux*)
328 ;;
276836f0
RO
329 mips-*-*)
330 machdep="mips_sgi_mach_dep.lo"
d42058b1 331 ;;
30c3de1f
JS
332 sparc-*-netbsd*)
333 machdep="sparc_netbsd_mach_dep.lo"
334 ;;
51ac684e 335 sparc-sun-solaris2.3)
79f777fd 336 machdep="sparc_mach_dep.lo"
5572488d 337 AC_DEFINE(SUNOS53_SHARED_LIB,1,[Avoid Solaris 5.3 dynamic library bug])
1530be84 338 ;;
ab52d207 339 sparc*-sun-solaris2.*)
79f777fd
BM
340 machdep="sparc_mach_dep.lo"
341 ;;
342 ia64-*-*)
5572488d 343 AC_DEFINE(NO_EXECUTE_PERMISSION,1,[cause some or all of the heap to not have execute permission])
4c7726b1
BM
344 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
345 ;;
1530be84
TT
346esac
347if test x"$machdep" = x; then
30c3de1f 348AC_MSG_RESULT($machdep)
66deb2be 349 machdep="mach_dep.lo"
1530be84
TT
350fi
351addobjs="$addobjs $machdep"
352AC_SUBST(addobjs)
30c3de1f
JS
353AC_SUBST(addincludes)
354AC_SUBST(addlibs)
355AC_SUBST(addtests)
356
30c3de1f
JS
357#
358# Check for AViiON Machines running DGUX
359#
360AC_MSG_CHECKING(if host is AViiON running DGUX)
361ac_is_dgux=no
362AC_CHECK_HEADER(sys/dg_sys_info.h,
363[ac_is_dgux=yes;])
364
8c048b48 365AC_MSG_RESULT($ac_is_dgux)
30c3de1f
JS
366 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
367if test $ac_is_dgux = yes; then
368 if test "$enable_full_debug" = "yes"; then
369 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
370 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
371 else
372 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
373 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
374 fi
375 AC_SUBST(CFLAGS)
376 AC_SUBST(CXXFLAGS)
377fi
378
1530be84
TT
379dnl As of 4.13a2, the collector will not properly work on Solaris when
380dnl built with gcc and -O. So we remove -O in the appropriate case.
ab52d207 381dnl Not needed anymore on Solaris.
30c3de1f 382AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
1530be84 383case "$host" in
ab52d207 384 *aix*)
1530be84 385 if test "$GCC" = yes; then
30c3de1f 386 AC_MSG_RESULT(yes)
1530be84
TT
387 new_CFLAGS=
388 for i in $CFLAGS; do
389 case "$i" in
390 -O*)
391 ;;
392 *)
393 new_CFLAGS="$new_CFLAGS $i"
394 ;;
395 esac
396 done
397 CFLAGS="$new_CFLAGS"
30c3de1f
JS
398 else
399 AC_MSG_RESULT(no)
1530be84
TT
400 fi
401 ;;
30c3de1f 402 *) AC_MSG_RESULT(no) ;;
1530be84
TT
403esac
404
405dnl We need to override the top-level CFLAGS. This is how we do it.
406MY_CFLAGS="$CFLAGS"
407AC_SUBST(MY_CFLAGS)
408
5a2586cf
TT
409dnl Include defines that have become de facto standard.
410dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
5572488d
KC
411AC_DEFINE(SILENT,1,[disables statistics printing])
412AC_DEFINE(NO_SIGNALS,1,[does not disable signals])
413AC_DEFINE(ALL_INTERIOR_POINTERS,1,[allows all pointers to the interior of objects to be recognized])
5a2586cf
TT
414
415dnl By default, make the library as general as possible.
5572488d
KC
416AC_DEFINE(JAVA_FINALIZATION,1,[make it somewhat safer to finalize objects out of order])
417AC_DEFINE(GC_GCJ_SUPPORT,1,[include support for gcj])
418AC_DEFINE(ATOMIC_UNCOLLECTABLE,1,[include code for GC_malloc_atomic_uncollectable])
1530be84 419
1530be84 420dnl This is something of a hack. When cross-compiling we turn off
df61a3d2
AM
421dnl some functionality. These is only correct when targetting an
422dnl embedded system. FIXME.
1530be84 423if test -n "${with_cross_host}"; then
5572488d
KC
424 AC_DEFINE(NO_SIGSET,1,[use empty GC_disable_signals and GC_enable_signals])
425 AC_DEFINE(NO_DEBUGGING,1,[removes GC_dump])
1530be84
TT
426fi
427
3c1cbf58
HB
428AC_ARG_ENABLE(gc-debug,
429[ --enable-gc-debug include full support for pointer backtracing etc.],
430[ if test "$enable_gc_debug" = "yes"; then
5a2586cf 431 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
5572488d
KC
432 AC_DEFINE(KEEP_BACK_PTRS,1,[Add code to save back pointers])
433 AC_DEFINE(DBG_HDRS_ALL,1,[Make sure that all objects have debug headers])
5a2586cf 434 case $host in
79f777fd 435 ia64-*-linux* )
5572488d 436 AC_DEFINE(MAKE_BACK_GRAPH,1,[Enable GC_PRINT_BACK_HEIGHT environment variable])
79f777fd 437 ;;
48528b67 438 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
5572488d 439 AC_DEFINE(MAKE_BACK_GRAPH,1)
5a2586cf 440 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
5572488d 441 AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects allocated through the debugging interface])
5a2586cf 442 ;;
30c3de1f 443 i[3456]86-*-dgux*)
5572488d 444 AC_DEFINE(MAKE_BACK_GRAPH,1)
30c3de1f 445 ;;
3c1cbf58
HB
446 esac
447 fi])
5a2586cf 448
5909b034
BM
449if test "${gc_use_mmap}" = "yes"; then
450 AC_DEFINE(USE_MMAP, 1, [use MMAP instead of sbrk to get new memory])
451fi
452
13b6e5b4
AO
453if test -n "$with_cross_host" &&
454 test x"$with_cross_host" != x"no"; then
d38d6003 455 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
13b6e5b4
AO
456 toolexeclibdir='$(toolexecdir)/lib'
457else
d38d6003 458 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
13b6e5b4
AO
459 toolexeclibdir='$(libdir)'
460fi
ff8b9ca8
AS
461multi_os_directory=`$CC -print-multi-os-directory`
462case $multi_os_directory in
463 .) ;; # Avoid trailing /.
464 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
465esac
13b6e5b4
AO
466AC_SUBST(toolexecdir)
467AC_SUBST(toolexeclibdir)
b48ed568 468
1530be84
TT
469if test "${multilib}" = "yes"; then
470 multilib_arg="--enable-multilib"
471else
472 multilib_arg=
473fi
474
9a060b37 475AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
4109fe85 476
bf9a420e
PB
477AC_CONFIG_FILES(Makefile include/Makefile)
478AC_OUTPUT