]> git.ipfire.org Git - thirdparty/gcc.git/blob - boehm-gc/configure.ac
configure.ac: Don't use libdl on mips-sgi-irix6*.
[thirdparty/gcc.git] / boehm-gc / configure.ac
1 # Copyright (c) 1999, 2000, 2001, 2002, 2003, 2006, 2010, 2011 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.
13 #
14 # Original author: Tom Tromey
15 # Modified by Nathanael Nerode
16
17 dnl Process this file with autoconf to produce configure.
18
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
27
28 AM_ENABLE_MULTILIB(, ..)
29
30 AC_CANONICAL_HOST
31 AC_CANONICAL_TARGET
32
33 # Get the 'noncanonical' system names.
34 ACX_NONCANONICAL_TARGET
35
36 # This works around an automake problem.
37 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
38 AC_SUBST(mkinstalldirs)
39
40 AM_INIT_AUTOMAKE(gc, 6.6, no-define)
41
42 # The autoconf 2.5x version of the no-executables hack.
43 GCC_NO_EXECUTABLES
44
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.
48
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])
54
55 AM_PROG_CC_C_O
56
57 AC_SUBST(CFLAGS)
58 AC_SUBST(CXXFLAGS)
59
60 # Newer automakes demand CCAS and CCASFLAGS.
61 : ${CCAS='$(CC)'}
62 : ${CCASFLAGS='$(CFLAGS)'}
63 AC_SUBST(CCAS)
64 AC_SUBST(CCASFLAGS)
65
66 AC_CHECK_TOOL(AS, as)
67 AC_CHECK_TOOL(AR, ar)
68 AC_CHECK_TOOL(RANLIB, ranlib, :)
69
70 AC_PROG_INSTALL
71
72 AM_MAINTAINER_MODE
73
74 . ${srcdir}/configure.host
75
76 case ${gc_basedir} in
77 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=${gc_basedir} ;;
78 *) gc_flagbasedir='$(top_builddir)/'${gc_basedir} ;;
79 esac
80
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
87
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
94
95 dnl gc_cflags="${gc_cflags} -fno-builtin"
96
97 GC_CFLAGS=${gc_cflags}
98 AC_SUBST(GC_CFLAGS)
99
100 AC_PROG_LIBTOOL
101
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])
108
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
113 fi
114 AC_MSG_RESULT([$THREADS])
115
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]
123 )
124
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 # nanosleep, sched_yield, and sem_* only live in librt before
197 # Solaris 11.
198 THREADLIBS="-lpthread -lrt"
199 ;;
200 *-*-irix*)
201 AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
202 ;;
203 *-*-cygwin*)
204 AC_DEFINE(GC_WIN32_THREADS,1,[support for win32 threads])
205 ;;
206 *-*-darwin*)
207 AC_DEFINE(GC_DARWIN_THREADS,1,[support for Mac OS X pthreads])
208 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
209 if test "${enable_parallel_mark}" = yes; then
210 AC_DEFINE(PARALLEL_MARK,1)
211 fi
212 ;;
213 *-*-osf*)
214 AC_DEFINE(GC_OSF1_THREADS,1,[support for Tru64 pthreads])
215 if test "${enable_parallel_mark}" = yes; then
216 AC_DEFINE(PARALLEL_MARK,1)
217 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
218 # May want to enable it in other cases, too.
219 # Measurements havent yet been done.
220 fi
221 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
222 THREADLIBS="-lpthread -lrt"
223 ;;
224 esac
225 ;;
226 win32)
227 AC_DEFINE(GC_WIN32_THREADS,1)
228 dnl Old wine getenv may not return NULL for missing entry.
229 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
230 ;;
231 dgux386)
232 THREADS=dgux386
233 AC_MSG_RESULT($THREADLIBS)
234 # Use pthread GCC switch
235 THREADLIBS=-pthread
236 if test "${enable_parallel_mark}" = yes; then
237 AC_DEFINE(PARALLEL_MARK,1)
238 fi
239 AC_DEFINE(THREAD_LOCAL_ALLOC,1)
240 AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
241 AC_DEFINE(DGUX_THREADS,1,[No description])
242 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
243 AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
244 ;;
245 aix)
246 THREADS=posix
247 THREADLIBS=-lpthread
248 AC_DEFINE(GC_AIX_THREADS,1)
249 AC_DEFINE(_REENTRANT,1)
250 ;;
251 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
252 AC_MSG_ERROR(thread package $THREADS not yet supported)
253 ;;
254 *)
255 AC_MSG_ERROR($THREADS is an unknown thread package)
256 ;;
257 esac
258 AC_SUBST(THREADLIBS)
259
260 case "$host" in
261 powerpc-*-darwin*)
262 powerpc_darwin=true
263 ;;
264 esac
265 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
266
267 # Darwin needs a few extra special tests to deal with variation in the
268 # system headers.
269 case "$host" in
270 powerpc*-*-darwin*)
271 AC_CHECK_MEMBER(ppc_thread_state_t.r0,
272 AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
273 [ppc_thread_state_t has field r0]),,
274 [#include <mach/thread_status.h>])
275 AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
276 AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
277 [ppc_thread_state_t has field __r0]),,
278 [#include <mach/thread_status.h>])
279 AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
280 AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
281 [ppc_thread_state64_t has field r0]),,
282 [#include <mach/thread_status.h>])
283 AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
284 AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
285 [ppc_thread_state64_t has field __r0]),,
286 [#include <mach/thread_status.h>])
287 ;;
288 i?86*-*-darwin*)
289 AC_CHECK_MEMBER(x86_thread_state32_t.eax,
290 AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
291 [x86_thread_state32_t has field eax]),,
292 [#include <sys/cdefs.h>
293 #include <mach/thread_status.h>])
294 AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
295 AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
296 [x86_thread_state32_t has field __eax]),,
297 [#include <sys/cdefs.h>
298 #include <mach/thread_status.h>])
299 ;;
300 x86_64-*-darwin*)
301 AC_CHECK_MEMBER(x86_thread_state64_t.rax,
302 AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
303 [x86_thread_state64_t has field rax]),,
304 [#include <sys/cdefs.h>
305 #include <mach/thread_status.h>])
306 AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
307 AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
308 [x86_thread_state64_t has field __rax]),,
309 [#include <sys/cdefs.h>
310 #include <mach/thread_status.h>])
311 ;;
312 *) ;;
313 esac
314
315 case "$host" in
316 # While IRIX 6 has libdl for the O32 and N32 ABIs, it's missing for N64
317 # and unnecessary everywhere.
318 mips-sgi-irix6*) ;;
319 # We never want libdl on darwin. It is a fake libdl that just ends up making
320 # dyld calls anyway
321 *-*-darwin*) ;;
322 *)
323 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
324 ;;
325 esac
326
327 # extra LD Flags which are required for targets
328 case "${host}" in
329 *-*-darwin*)
330 extra_ldflags_libgc=-Wl,-single_module
331 ;;
332 esac
333 AC_SUBST(extra_ldflags_libgc)
334
335 AC_SUBST(EXTRA_TEST_LIBS)
336
337 target_all=libgcjgc.la
338 AC_SUBST(target_all)
339
340 dnl If the target is an eCos system, use the appropriate eCos
341 dnl I/O routines.
342 dnl FIXME: this should not be a local option but a global target
343 dnl system; at present there is no eCos target.
344 TARGET_ECOS="no"
345 AC_ARG_WITH(ecos,
346 [ --with-ecos enable runtime eCos target support],
347 TARGET_ECOS="$with_ecos"
348 )
349
350 addobjs=
351 addlibs=
352 addincludes=
353 addtests=
354 case "$TARGET_ECOS" in
355 no)
356 ;;
357 *)
358 AC_DEFINE(ECOS,1,[Target is ECOS])
359 AM_CPPFLAGS="${AM_CPPFLAGS} -I${TARGET_ECOS}/include"
360 addobjs="$addobjs ecos.lo"
361 ;;
362 esac
363
364 if test "${enable_cplusplus}" = yes; then
365 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
366 addtests="$addtests test_cpp"
367 fi
368
369 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
370
371 AC_SUBST(CXX)
372
373 AC_SUBST(AM_CPPFLAGS)
374
375 # Configuration of shared libraries
376 #
377 AC_MSG_CHECKING(whether to build shared libraries)
378 AC_ENABLE_SHARED
379
380 case "$host" in
381 alpha-*-openbsd*)
382 enable_shared=no
383 AC_MSG_RESULT(no)
384 ;;
385 *)
386 AC_MSG_RESULT(yes)
387 ;;
388 esac
389
390 # Checks for pthreads functions
391 #
392 oldLIBS="$LIBS"
393 LIBS="$LIBS $THREADLIBS"
394 AC_CHECK_FUNCS([pthread_getattr_np])
395 LIBS="$oldLIBS"
396
397 # Configuration of machine-dependent code
398 #
399 # Set NO_EXECUTE_PERMISSION by default because gcj already uses
400 # ffi_closure_{alloc,free} which takes care of allocating trampolines
401 # in executable memory.
402 #
403 AC_MSG_CHECKING(which machine-dependent code should be used)
404 machdep=
405 case "$host" in
406 alpha*-*-openbsd*)
407 machdep="alpha_mach_dep.lo"
408 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
409 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
410 fi
411 ;;
412 alpha*-*-linux*)
413 machdep="alpha_mach_dep.lo"
414 ;;
415 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
416 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED,1,[PROC_VDB in Solaris 2.5 gives wrong values for dirty bits])
417 ;;
418 mipstx39-*-elf*)
419 machdep="mips_ultrix_mach_dep.lo"
420 AC_DEFINE(STACKBASE, __stackbase,[No description])
421 AC_DEFINE(DATASTART_IS_ETEXT,1,[No description])
422 ;;
423 mips-dec-ultrix*)
424 machdep="mips_ultrix_mach-dep.lo"
425 ;;
426 mips-nec-sysv*|mips-unknown-sysv*)
427 ;;
428 mips*-*-linux*)
429 ;;
430 mips-*-*)
431 machdep="mips_sgi_mach_dep.lo"
432 ;;
433 sparc-*-netbsd*)
434 machdep="sparc_netbsd_mach_dep.lo"
435 ;;
436 sparc-sun-solaris2.3)
437 machdep="sparc_mach_dep.lo"
438 AC_DEFINE(SUNOS53_SHARED_LIB,1,[Avoid Solaris 5.3 dynamic library bug])
439 ;;
440 sparc*-sun-solaris2.*)
441 machdep="sparc_mach_dep.lo"
442 ;;
443 ia64-*-*)
444 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
445 ;;
446 esac
447 AC_DEFINE(NO_EXECUTE_PERMISSION,1,[cause some or all of the heap to not have execute permission])
448 if test x"$machdep" = x; then
449 AC_MSG_RESULT($machdep)
450 machdep="mach_dep.lo"
451 fi
452 addobjs="$addobjs $machdep"
453 AC_SUBST(addobjs)
454 AC_SUBST(addincludes)
455 AC_SUBST(addlibs)
456 AC_SUBST(addtests)
457
458 #
459 # Check for AViiON Machines running DGUX
460 #
461 ac_is_dgux=no
462 AC_CHECK_HEADER(sys/dg_sys_info.h, [ac_is_dgux=yes])
463
464 AC_MSG_CHECKING(if host is AViiON running DGUX)
465 AC_MSG_RESULT($ac_is_dgux)
466 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
467 if test $ac_is_dgux = yes; then
468 if test "$enable_full_debug" = "yes"; then
469 GC_CFLAGS="$GC_CFLAGS -mstandard"
470 fi
471 GC_CFLAGS="$GC_CFLAGS -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend"
472 fi
473
474 dnl As of 4.13a2, the collector will not properly work on Solaris when
475 dnl built with gcc and -O. So we remove -O in the appropriate case.
476 dnl Not needed anymore on Solaris.
477 AC_MSG_CHECKING([whether GCC optimization should be disabled])
478 O0_CFLAGS=
479 case "$host" in
480 *aix*) test "$GCC" = yes && O0_CFLAGS=-O0 ;;
481 *) ;;
482 esac
483 if test x"$O0_CFLAGS" != x; then
484 AC_MSG_RESULT(yes)
485 else
486 AC_MSG_RESULT(no)
487 fi
488 AC_SUBST([O0_CFLAGS])
489
490 dnl Include defines that have become de facto standard.
491 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
492 AC_DEFINE(SILENT,1,[disables statistics printing])
493 AC_DEFINE(NO_SIGNALS,1,[does not disable signals])
494 AC_DEFINE(ALL_INTERIOR_POINTERS,1,[allows all pointers to the interior of objects to be recognized])
495
496 dnl By default, make the library as general as possible.
497 AC_DEFINE(JAVA_FINALIZATION,1,[make it somewhat safer to finalize objects out of order])
498 AC_DEFINE(GC_GCJ_SUPPORT,1,[include support for gcj])
499 AC_DEFINE(ATOMIC_UNCOLLECTABLE,1,[include code for GC_malloc_atomic_uncollectable])
500
501 AC_ARG_ENABLE(gc-debug,
502 [ --enable-gc-debug include full support for pointer backtracing etc.],
503 [ if test "$enable_gc_debug" = "yes"; then
504 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
505 AC_DEFINE(KEEP_BACK_PTRS,1,[Add code to save back pointers])
506 AC_DEFINE(DBG_HDRS_ALL,1,[Make sure that all objects have debug headers])
507 case $host in
508 ia64-*-linux* )
509 AC_DEFINE(MAKE_BACK_GRAPH,1,[Enable GC_PRINT_BACK_HEIGHT environment variable])
510 ;;
511 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
512 AC_DEFINE(MAKE_BACK_GRAPH,1)
513 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
514 AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects allocated through the debugging interface])
515 ;;
516 i[3456]86-*-dgux*)
517 AC_DEFINE(MAKE_BACK_GRAPH,1)
518 ;;
519 esac
520 fi])
521
522 if test "${gc_use_mmap}" = "yes"; then
523 AC_DEFINE(USE_MMAP, 1, [use MMAP instead of sbrk to get new memory])
524 fi
525
526 if test -n "$with_cross_host" &&
527 test x"$with_cross_host" != x"no"; then
528 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
529 toolexeclibdir='$(toolexecdir)/lib'
530 else
531 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
532 toolexeclibdir='$(libdir)'
533 fi
534 multi_os_directory=`$CC -print-multi-os-directory`
535 case $multi_os_directory in
536 .) ;; # Avoid trailing /.
537 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
538 esac
539 AC_SUBST(toolexecdir)
540 AC_SUBST(toolexeclibdir)
541
542 if test "${multilib}" = "yes"; then
543 multilib_arg="--enable-multilib"
544 else
545 multilib_arg=
546 fi
547
548 AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
549
550 AC_CONFIG_FILES(Makefile include/Makefile threads.mk)
551 AC_OUTPUT