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.
19 # This works around the fact that libtool configuration may change LD
20 # for this particular configuration, but some shells, instead of
21 # keeping the changes in LD private, export them just because LD is
23 ORIGINAL_LD_FOR_MULTILIBS=$LD
25 dnl Can't be done in GC_CONFIGURE because that confuses automake.
32 dnl We use these options to decide which functions to include.
33 AC_ARG_WITH(target-subdir,
34 [ --with-target-subdir=SUBDIR
35 configuring with a cross compiler])
36 AC_ARG_WITH(cross-host,
37 [ --with-cross-host=HOST configuring with a cross compiler])
40 # automake wants to see AC_EXEEXT. But we don't need it. And having
41 # it is actually a problem, because the compiler we're passed can't
42 # necessarily do a full link. So we fool automake here.
44 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
45 # to nothing, so nothing would remain between `then' and `fi' if it
46 # were not for the `:' below.
51 AC_MSG_CHECKING([for thread model used by GCC])
52 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
53 if test -z "$THREADS"; then
56 AC_MSG_RESULT([$THREADS])
58 AC_ARG_ENABLE(parallel-mark,
59 [ --enable-parallel-mark parallelize marking and free list construction],
62 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
67 INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
77 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
78 AC_DEFINE(GC_LINUX_THREADS)
80 if test "${enable_parallel_mark}" = yes; then
81 AC_DEFINE(PARALLEL_MARK)
83 AC_DEFINE(THREAD_LOCAL_ALLOC)
86 AC_DEFINE(GC_LINUX_THREADS)
90 AC_DEFINE(GC_AIX_THREADS)
94 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
95 AC_DEFINE(GC_HPUX_THREADS)
96 AC_DEFINE(_POSIX_C_SOURCE,199506L)
97 if test "${enable_parallel_mark}" = yes; then
98 AC_DEFINE(PARALLEL_MARK)
100 AC_DEFINE(THREAD_LOCAL_ALLOC)
101 THREADLIBS="-lpthread -lrt"
104 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
105 AC_DEFINE(GC_FREEBSD_THREADS)
106 INCLUDES="$INCLUDES -pthread"
110 AC_DEFINE(GC_SOLARIS_THREADS)
111 AC_DEFINE(GC_SOLARIS_PTHREADS)
114 AC_DEFINE(GC_IRIX_THREADS)
117 AC_DEFINE(GC_WIN32_THREADS)
120 AC_DEFINE(GC_DARWIN_THREADS)
121 AC_DEFINE(THREAD_LOCAL_ALLOC)
122 if test "${enable_parallel_mark}" = yes; then
123 AC_DEFINE(PARALLEL_MARK)
127 AC_DEFINE(GC_OSF1_THREADS)
128 if test "${enable_parallel_mark}" = yes; then
129 AC_DEFINE(PARALLEL_MARK)
130 AC_DEFINE(THREAD_LOCAL_ALLOC)
131 # May want to enable it in other cases, too.
132 # Measurements havent yet been done.
134 INCLUDES="$INCLUDES -pthread"
135 THREADLIBS="-lpthread -lrt"
140 AC_DEFINE(GC_WIN32_THREADS)
141 dnl Old wine getenv may not return NULL for missing entry.
142 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
146 AC_MSG_RESULT($THREADLIBS)
147 # Use pthread GCC switch
149 if test "${enable_parallel_mark}" = yes; then
150 AC_DEFINE(PARALLEL_MARK)
152 AC_DEFINE(THREAD_LOCAL_ALLOC)
153 AC_DEFINE(GC_DGUX386_THREADS)
154 AC_DEFINE(DGUX_THREADS)
155 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
156 INCLUDES="-pthread $INCLUDES"
161 AC_DEFINE(GC_AIX_THREADS)
162 AC_DEFINE(_REENTRANT)
164 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
165 AC_MSG_ERROR(thread package $THREADS not yet supported)
168 AC_MSG_ERROR($THREADS is an unknown thread package)
178 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
180 # We never want libdl on darwin. It is a fake libdl that just ends up making
185 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
189 AC_SUBST(EXTRA_TEST_LIBS)
191 target_all=libgcjgc.la
193 AC_SUBST(target_alias)
195 dnl If the target is an eCos system, use the appropriate eCos
197 dnl FIXME: this should not be a local option but a global target
198 dnl system; at present there is no eCos target.
201 [ --with-ecos enable runtime eCos target support],
202 TARGET_ECOS="$with_ecos"
210 case "$TARGET_ECOS" in
215 CXXINCLUDES="-I${TARGET_ECOS}/include"
216 addobjs="$addobjs ecos.lo"
220 if test "${enable_cplusplus}" = yes; then
221 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
222 addtests="$addtests test_cpp"
225 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
230 AC_SUBST(CXXINCLUDES)
232 # Configuration of shared libraries
234 AC_MSG_CHECKING(whether to build shared libraries)
247 # Configuration of machine-dependent code
249 AC_MSG_CHECKING(which machine-dependent code should be used)
253 machdep="alpha_mach_dep.lo"
254 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
255 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
259 machdep="alpha_mach_dep.lo"
261 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
262 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
265 machdep="mips_ultrix_mach_dep.lo"
266 AC_DEFINE(STACKBASE, __stackbase)
267 AC_DEFINE(DATASTART_IS_ETEXT)
270 machdep="mips_ultrix_mach-dep.lo"
272 mips-nec-sysv*|mips-unknown-sysv*)
277 machdep="mips_sgi_mach_dep.lo"
278 AC_DEFINE(NO_EXECUTE_PERMISSION)
281 machdep="sparc_netbsd_mach_dep.lo"
283 sparc-sun-solaris2.3)
284 machdep="sparc_mach_dep.lo"
285 AC_DEFINE(SUNOS53_SHARED_LIB)
287 sparc-sun-solaris2.*)
288 machdep="sparc_mach_dep.lo"
291 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
294 if test x"$machdep" = x; then
295 AC_MSG_RESULT($machdep)
296 machdep="mach_dep.lo"
298 addobjs="$addobjs $machdep"
300 AC_SUBST(addincludes)
307 # Check for AViiON Machines running DGUX
309 AC_MSG_CHECKING(if host is AViiON running DGUX)
311 AC_CHECK_HEADER(sys/dg_sys_info.h,
314 AC_MSG_RESULT($ac_is_dgux)
315 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
316 if test $ac_is_dgux = yes; then
317 if test "$enable_full_debug" = "yes"; then
318 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
319 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
321 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
322 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
328 dnl We use these options to decide which functions to include.
329 AC_ARG_WITH(target-subdir,
330 [ --with-target-subdir=SUBDIR
331 configuring with a cross compiler])
332 AC_ARG_WITH(cross-host,
333 [ --with-cross-host=HOST configuring with a cross compiler])
335 # automake wants to see AC_EXEEXT. But we don't need it. And having
336 # it is actually a problem, because the compiler we're passed can't
337 # necessarily do a full link. So we fool automake here.
339 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
340 # to nothing, so nothing would remain between `then' and `fi' if it
341 # were not for the `:' below.
346 dnl As of 4.13a2, the collector will not properly work on Solaris when
347 dnl built with gcc and -O. So we remove -O in the appropriate case.
349 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
351 sparc-sun-solaris2*|*aix*)
352 if test "$GCC" = yes; then
360 new_CFLAGS="$new_CFLAGS $i"
369 *) AC_MSG_RESULT(no) ;;
372 dnl We need to override the top-level CFLAGS. This is how we do it.
376 dnl Include defines that have become de facto standard.
377 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
379 AC_DEFINE(NO_SIGNALS)
380 AC_DEFINE(NO_EXECUTE_PERMISSION)
381 AC_DEFINE(ALL_INTERIOR_POINTERS)
383 dnl By default, make the library as general as possible.
384 AC_DEFINE(JAVA_FINALIZATION)
385 AC_DEFINE(GC_GCJ_SUPPORT)
386 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
388 dnl This is something of a hack. When cross-compiling we turn off
389 dnl some functionality. These is only correct when targetting an
390 dnl embedded system. FIXME.
391 if test -n "${with_cross_host}"; then
393 AC_DEFINE(NO_DEBUGGING)
396 AC_ARG_ENABLE(full-debug,
397 [ --enable-full-debug include full support for pointer backtracing etc.],
398 [ if test "$enable_full_debug" = "yes"; then
399 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
400 AC_DEFINE(KEEP_BACK_PTRS)
401 AC_DEFINE(DBG_HDRS_ALL)
404 AC_DEFINE(MAKE_BACK_GRAPH)
406 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
407 AC_DEFINE(MAKE_BACK_GRAPH)
408 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
409 AC_DEFINE(SAVE_CALL_COUNT, 8)
412 AC_DEFINE(MAKE_BACK_GRAPH)
417 if test -n "$with_cross_host" &&
418 test x"$with_cross_host" != x"no"; then
419 toolexecdir='$(exec_prefix)/$(target_alias)'
420 toolexeclibdir='$(toolexecdir)/lib'
422 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
423 toolexeclibdir='$(libdir)'
425 multi_os_directory=`$CC -print-multi-os-directory`
426 case $multi_os_directory in
427 .) ;; # Avoid trailing /.
428 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
430 AC_SUBST(toolexecdir)
431 AC_SUBST(toolexeclibdir)
433 if test "${multilib}" = "yes"; then
434 multilib_arg="--enable-multilib"
439 AC_OUTPUT(Makefile include/Makefile, [
440 dnl Put all the -I and -D options in a file.
441 echo "$INCLUDES $DEFS" > boehm-cflags
443 if test -n "$CONFIG_FILES"; then
444 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
445 ac_file=Makefile . ${gc_basedir}/../config-ml.in
450 with_multisubdir=${with_multisubdir}
451 ac_configure_args="${multilib_arg} ${ac_configure_args}"
452 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
453 gc_basedir=${gc_basedir}
455 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"