1 # Copyright (c) 1999, 2000, 2001, 2002, 2003 by Red Hat, Inc. All rights reserved.
3 # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
4 # OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
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.
12 # Original author: Tom Tromey
14 dnl Process this file with autoconf to produce configure.
18 # This works around the fact that libtool configuration may change LD
19 # for this particular configuration, but some shells, instead of
20 # keeping the changes in LD private, export them just because LD is
22 ORIGINAL_LD_FOR_MULTILIBS=$LD
24 dnl Can't be done in GC_CONFIGURE because that confuses automake.
31 dnl We use these options to decide which functions to include.
32 AC_ARG_WITH(target-subdir,
33 [ --with-target-subdir=SUBDIR
34 configuring with a cross compiler])
35 AC_ARG_WITH(cross-host,
36 [ --with-cross-host=HOST configuring with a cross compiler])
39 # automake wants to see AC_EXEEXT. But we don't need it. And having
40 # it is actually a problem, because the compiler we're passed can't
41 # necessarily do a full link. So we fool automake here.
43 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
44 # to nothing, so nothing would remain between `then' and `fi' if it
45 # were not for the `:' below.
50 AC_MSG_CHECKING([for thread model used by GCC])
51 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
52 if test -z "$THREADS"; then
55 AC_MSG_RESULT([$THREADS])
57 AC_ARG_ENABLE(parallel-mark,
58 [ --enable-parallel-mark parallelize marking and free list construction],
61 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
66 INCLUDES=-I${srcdir}/include
76 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
77 AC_DEFINE(GC_LINUX_THREADS)
79 if test "${enable_parallel_mark}"; then
80 AC_DEFINE(PARALLEL_MARK)
82 AC_DEFINE(THREAD_LOCAL_ALLOC)
85 AC_DEFINE(GC_LINUX_THREADS)
89 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
90 AC_DEFINE(GC_HPUX_THREADS)
91 AC_DEFINE(_POSIX_C_SOURCE,199506L)
92 if test "${enable_parallel_mark}" = yes; then
93 AC_DEFINE(PARALLEL_MARK)
95 AC_DEFINE(THREAD_LOCAL_ALLOC)
96 THREADLIBS="-lpthread -lrt"
99 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
100 AC_DEFINE(GC_FREEBSD_THREADS)
101 INCLUDES="$INCLUDES -pthread"
105 AC_DEFINE(GC_SOLARIS_THREADS)
106 AC_DEFINE(GC_SOLARIS_PTHREADS)
109 AC_DEFINE(GC_IRIX_THREADS)
117 AC_DEFINE(GC_WIN32_THREADS)
120 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
121 AC_MSG_ERROR(thread package $THREADS not yet supported)
124 AC_MSG_ERROR($THREADS is an unknown thread package)
129 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
130 AC_SUBST(EXTRA_TEST_LIBS)
132 target_all=libgcjgc.la
134 AC_SUBST(target_alias)
136 dnl If the target is an eCos system, use the appropriate eCos
138 dnl FIXME: this should not be a local option but a global target
139 dnl system; at present there is no eCos target.
142 [ --with-ecos enable runtime eCos target support],
143 TARGET_ECOS="$with_ecos"
148 case "$TARGET_ECOS" in
153 CXXINCLUDES="-I${TARGET_ECOS}/include"
154 addobjs="$addobjs ecos.lo"
160 AC_SUBST(CXXINCLUDES)
165 machdep="alpha_mach_dep.lo"
166 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
167 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
172 machdep="alpha_mach_dep.lo"
174 i?86-*-solaris2.[[89]]*)
175 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
178 machdep="mips_ultrix_mach_dep.lo"
179 AC_DEFINE(STACKBASE, __stackbase)
180 AC_DEFINE(DATASTART_IS_ETEXT)
183 machdep="mips_ultrix_mach-dep.lo"
188 machdep="mips_sgi_mach_dep.lo"
189 AC_DEFINE(NO_EXECUTE_PERMISSION)
191 sparc-sun-solaris2.3*)
192 machdep="sparc_mach_dep.lo"
193 AC_DEFINE(SUNOS53_SHARED_LIB)
195 sparc-sun-solaris2.*)
196 machdep="sparc_mach_dep.lo"
199 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
202 if test x"$machdep" = x; then
203 machdep="mach_dep.lo"
205 addobjs="$addobjs $machdep"
208 dnl As of 4.13a2, the collector will not properly work on Solaris when
209 dnl built with gcc and -O. So we remove -O in the appropriate case.
212 if test "$GCC" = yes; then
219 new_CFLAGS="$new_CFLAGS $i"
228 dnl We need to override the top-level CFLAGS. This is how we do it.
232 dnl Include defines that have become de facto standard.
233 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
235 AC_DEFINE(NO_SIGNALS)
236 AC_DEFINE(NO_EXECUTE_PERMISSION)
237 AC_DEFINE(ALL_INTERIOR_POINTERS)
239 dnl By default, make the library as general as possible.
240 AC_DEFINE(JAVA_FINALIZATION)
241 AC_DEFINE(GC_GCJ_SUPPORT)
242 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
244 dnl This is something of a hack. When cross-compiling we turn off
245 dnl some functionality. These is only correct when targetting an
246 dnl embedded system. FIXME.
247 if test -n "${with_cross_host}"; then
249 AC_DEFINE(NO_DEBUGGING)
252 AC_ARG_ENABLE(full-debug,
253 [ --enable-full-debug include full support for pointer backtracing etc.],
254 [ if test "$enable_full_debug" = "yes"; then
255 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
256 AC_DEFINE(KEEP_BACK_PTRS)
257 AC_DEFINE(DBG_HDRS_ALL)
260 AC_DEFINE(MAKE_BACK_GRAPH)
262 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
263 AC_DEFINE(MAKE_BACK_GRAPH)
264 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
265 AC_DEFINE(SAVE_CALL_COUNT, 8)
270 if test -n "$with_cross_host" &&
271 test x"$with_cross_host" != x"no"; then
272 toolexecdir='$(exec_prefix)/$(target_alias)'
273 toolexeclibdir='$(toolexecdir)/lib'
275 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
276 toolexeclibdir='$(libdir)'
278 multi_os_directory=`$CC -print-multi-os-directory`
279 case $multi_os_directory in
280 .) ;; # Avoid trailing /.
281 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
283 AC_SUBST(toolexecdir)
284 AC_SUBST(toolexeclibdir)
286 if test "${multilib}" = "yes"; then
287 multilib_arg="--enable-multilib"
292 AC_OUTPUT(Makefile include/Makefile, [
293 dnl Put all the -D options in a file.
294 echo "$DEFS" > boehm-cflags
296 if test -n "$CONFIG_FILES"; then
297 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
298 ac_file=Makefile . ${gc_basedir}/../config-ml.in
303 with_multisubdir=${with_multisubdir}
304 ac_configure_args="${multilib_arg} ${ac_configure_args}"
305 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
306 gc_basedir=${gc_basedir}
308 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"