1 # Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved.
2 # Copyright 2004 Nathanael Nerode
4 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
5 # OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
13 # Original author: Tom Tromey
14 # Modified by Nathanael Nerode
16 dnl Process this file with autoconf to produce configure.
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
25 ORIGINAL_LD_FOR_MULTILIBS=$LD
27 dnl Default to --enable-multilib
28 AC_ARG_ENABLE(multilib,
29 [ --enable-multilib build many library versions (default)],
30 [case "${enableval}" in
33 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
34 esac], [multilib=yes])dnl
36 dnl We may get other options which we don't document:
37 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
39 dnl I needed to add the -n test to allow configuration in src directory - HB
40 if test "[$]{srcdir}" = "."; then
41 if test "[$]{with_target_subdir}" != "." -a -n "[$]{with_target_subdir}"; then
42 gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../."
44 gc_basedir="[$]{srcdir}/[$]{with_multisrctop}."
47 gc_basedir="[$]{srcdir}/."
50 AC_CONFIG_AUX_DIR($gc_basedir/..)
52 # This overrides the previous occurrence for automake, but not for
53 # autoconf, which is exactly what we want.
59 # Get the 'noncanonical' system names.
60 sinclude(../config/acx.m4)
61 _GCC_TOPLEV_NONCANONICAL_BUILD
62 _GCC_TOPLEV_NONCANONICAL_HOST
63 _GCC_TOPLEV_NONCANONICAL_TARGET
65 # This works around an automake problem.
66 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
67 AC_SUBST(mkinstalldirs)
69 AM_INIT_AUTOMAKE(gc, 6.1a1, no-define)
71 # The autoconf 2.5x version of the no-executables hack.
72 sinclude(../config/no-executables.m4)
75 # Yak. We must force CC and CXX to /not/ be precious variables; otherwise
76 # the wrong, non-multilib-adjusted value will be used in multilibs.
77 # As a side effect, we have to subst CFLAGS and CXXFLAGS ourselves.
79 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
80 m4_define([_AC_ARG_VAR_PRECIOUS],[])
83 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
88 # Newer automakes demand CCAS and CCASFLAGS.
90 : ${CCASFLAGS='$(CFLAGS)'}
96 AC_CHECK_TOOL(RANLIB, ranlib, :)
102 . [$]{srcdir}/configure.host
104 case [$]{gc_basedir} in
105 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=[$]{gc_basedir} ;;
106 *) gc_flagbasedir='[$](top_builddir)/'[$]{gc_basedir} ;;
109 gc_cflags="[$]{gc_cflags} -I"'[$](top_builddir)'"/./targ-include -I[$]{gc_flagbasedir}/libc/include"
112 gc_cflags="[$]{gc_cflags} -I[$]{gc_flagbasedir}/../winsup/include"
116 dnl gc_cflags="[$]{gc_cflags} -fno-builtin"
118 GC_CFLAGS=${gc_cflags}
123 dnl We use these options to decide which functions to include.
124 AC_ARG_WITH(target-subdir,
125 [ --with-target-subdir=SUBDIR
126 configuring with a cross compiler])
127 AC_ARG_WITH(cross-host,
128 [ --with-cross-host=HOST configuring with a cross compiler])
130 AC_MSG_CHECKING([for thread model used by GCC])
131 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
132 if test -z "$THREADS"; then
135 AC_MSG_RESULT([$THREADS])
137 AC_ARG_ENABLE(parallel-mark,
138 [ --enable-parallel-mark parallelize marking and free list construction],
141 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
146 INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
156 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
157 AC_DEFINE(GC_LINUX_THREADS)
158 AC_DEFINE(_REENTRANT)
159 if test "${enable_parallel_mark}" = yes; then
160 AC_DEFINE(PARALLEL_MARK)
162 AC_DEFINE(THREAD_LOCAL_ALLOC)
165 AC_DEFINE(GC_LINUX_THREADS)
166 AC_DEFINE(_REENTRANT)
169 AC_DEFINE(GC_AIX_THREADS)
170 AC_DEFINE(_REENTRANT)
173 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
174 AC_DEFINE(GC_HPUX_THREADS)
175 AC_DEFINE(_POSIX_C_SOURCE,199506L)
176 if test "${enable_parallel_mark}" = yes; then
177 AC_DEFINE(PARALLEL_MARK)
179 AC_DEFINE(THREAD_LOCAL_ALLOC)
180 THREADLIBS="-lpthread -lrt"
183 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
184 AC_DEFINE(GC_FREEBSD_THREADS)
185 INCLUDES="$INCLUDES -pthread"
189 AC_DEFINE(GC_SOLARIS_THREADS)
190 AC_DEFINE(GC_SOLARIS_PTHREADS)
193 AC_DEFINE(GC_IRIX_THREADS)
196 AC_DEFINE(GC_WIN32_THREADS)
199 AC_DEFINE(GC_DARWIN_THREADS)
200 AC_DEFINE(THREAD_LOCAL_ALLOC)
201 if test "${enable_parallel_mark}" = yes; then
202 AC_DEFINE(PARALLEL_MARK)
206 AC_DEFINE(GC_OSF1_THREADS)
207 if test "${enable_parallel_mark}" = yes; then
208 AC_DEFINE(PARALLEL_MARK)
209 AC_DEFINE(THREAD_LOCAL_ALLOC)
210 # May want to enable it in other cases, too.
211 # Measurements havent yet been done.
213 INCLUDES="$INCLUDES -pthread"
214 THREADLIBS="-lpthread -lrt"
219 AC_DEFINE(GC_WIN32_THREADS)
220 dnl Old wine getenv may not return NULL for missing entry.
221 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
225 AC_MSG_RESULT($THREADLIBS)
226 # Use pthread GCC switch
228 if test "${enable_parallel_mark}" = yes; then
229 AC_DEFINE(PARALLEL_MARK)
231 AC_DEFINE(THREAD_LOCAL_ALLOC)
232 AC_DEFINE(GC_DGUX386_THREADS)
233 AC_DEFINE(DGUX_THREADS)
234 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
235 INCLUDES="-pthread $INCLUDES"
240 AC_DEFINE(GC_AIX_THREADS)
241 AC_DEFINE(_REENTRANT)
243 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
244 AC_MSG_ERROR(thread package $THREADS not yet supported)
247 AC_MSG_ERROR($THREADS is an unknown thread package)
257 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
259 # We never want libdl on darwin. It is a fake libdl that just ends up making
264 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
268 AC_SUBST(EXTRA_TEST_LIBS)
270 target_all=libgcjgc.la
272 AC_SUBST(target_noncanonical)
274 dnl If the target is an eCos system, use the appropriate eCos
276 dnl FIXME: this should not be a local option but a global target
277 dnl system; at present there is no eCos target.
280 [ --with-ecos enable runtime eCos target support],
281 TARGET_ECOS="$with_ecos"
289 case "$TARGET_ECOS" in
294 CXXINCLUDES="-I${TARGET_ECOS}/include"
295 addobjs="$addobjs ecos.lo"
299 if test "${enable_cplusplus}" = yes; then
300 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
301 addtests="$addtests test_cpp"
304 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
309 AC_SUBST(CXXINCLUDES)
311 # Configuration of shared libraries
313 AC_MSG_CHECKING(whether to build shared libraries)
326 # Configuration of machine-dependent code
328 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
329 # anything else that creates trampolines in gc-allocated memory)
330 # always needs exec permission. The exceptions to this are IA-64 and
331 # some variations of Power PC, where trampolines don't contain
334 AC_MSG_CHECKING(which machine-dependent code should be used)
338 machdep="alpha_mach_dep.lo"
339 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
340 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
344 machdep="alpha_mach_dep.lo"
346 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
347 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
350 machdep="mips_ultrix_mach_dep.lo"
351 AC_DEFINE(STACKBASE, __stackbase)
352 AC_DEFINE(DATASTART_IS_ETEXT)
355 machdep="mips_ultrix_mach-dep.lo"
357 mips-nec-sysv*|mips-unknown-sysv*)
362 machdep="mips_sgi_mach_dep.lo"
365 machdep="sparc_netbsd_mach_dep.lo"
367 sparc-sun-solaris2.3)
368 machdep="sparc_mach_dep.lo"
369 AC_DEFINE(SUNOS53_SHARED_LIB)
371 sparc-sun-solaris2.*)
372 machdep="sparc_mach_dep.lo"
375 AC_DEFINE(NO_EXECUTE_PERMISSION)
376 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
379 if test x"$machdep" = x; then
380 AC_MSG_RESULT($machdep)
381 machdep="mach_dep.lo"
383 addobjs="$addobjs $machdep"
385 AC_SUBST(addincludes)
392 # Check for AViiON Machines running DGUX
394 AC_MSG_CHECKING(if host is AViiON running DGUX)
396 AC_CHECK_HEADER(sys/dg_sys_info.h,
399 AC_MSG_RESULT($ac_is_dgux)
400 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
401 if test $ac_is_dgux = yes; then
402 if test "$enable_full_debug" = "yes"; then
403 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
404 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
406 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
407 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
413 dnl We use these options to decide which functions to include.
414 AC_ARG_WITH(target-subdir,
415 [ --with-target-subdir=SUBDIR
416 configuring with a cross compiler])
417 AC_ARG_WITH(cross-host,
418 [ --with-cross-host=HOST configuring with a cross compiler])
420 dnl As of 4.13a2, the collector will not properly work on Solaris when
421 dnl built with gcc and -O. So we remove -O in the appropriate case.
423 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
425 sparc-sun-solaris2*|*aix*)
426 if test "$GCC" = yes; then
434 new_CFLAGS="$new_CFLAGS $i"
443 *) AC_MSG_RESULT(no) ;;
446 dnl We need to override the top-level CFLAGS. This is how we do it.
450 dnl Include defines that have become de facto standard.
451 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
453 AC_DEFINE(NO_SIGNALS)
454 AC_DEFINE(ALL_INTERIOR_POINTERS)
456 dnl By default, make the library as general as possible.
457 AC_DEFINE(JAVA_FINALIZATION)
458 AC_DEFINE(GC_GCJ_SUPPORT)
459 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
461 dnl This is something of a hack. When cross-compiling we turn off
462 dnl some functionality. These is only correct when targetting an
463 dnl embedded system. FIXME.
464 if test -n "${with_cross_host}"; then
466 AC_DEFINE(NO_DEBUGGING)
469 AC_ARG_ENABLE(full-debug,
470 [ --enable-full-debug include full support for pointer backtracing etc.],
471 [ if test "$enable_full_debug" = "yes"; then
472 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
473 AC_DEFINE(KEEP_BACK_PTRS)
474 AC_DEFINE(DBG_HDRS_ALL)
477 AC_DEFINE(MAKE_BACK_GRAPH)
479 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
480 AC_DEFINE(MAKE_BACK_GRAPH)
481 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
482 AC_DEFINE(SAVE_CALL_COUNT, 8)
485 AC_DEFINE(MAKE_BACK_GRAPH)
490 if test -n "$with_cross_host" &&
491 test x"$with_cross_host" != x"no"; then
492 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
493 toolexeclibdir='$(toolexecdir)/lib'
495 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
496 toolexeclibdir='$(libdir)'
498 multi_os_directory=`$CC -print-multi-os-directory`
499 case $multi_os_directory in
500 .) ;; # Avoid trailing /.
501 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
503 AC_SUBST(toolexecdir)
504 AC_SUBST(toolexeclibdir)
506 if test "${multilib}" = "yes"; then
507 multilib_arg="--enable-multilib"
512 AC_OUTPUT(Makefile include/Makefile, [
513 dnl Put all the -I and -D options in a file.
514 echo "$INCLUDES $DEFS" > boehm-cflags
516 if test -n "$CONFIG_FILES"; then
517 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
518 ac_file=Makefile . ${gc_basedir}/../config-ml.in
523 with_multisubdir=${with_multisubdir}
524 ac_configure_args="${multilib_arg} ${ac_configure_args}"
525 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
526 gc_basedir=${gc_basedir}
528 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"