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 Can't be done in GC_CONFIGURE because that confuses automake.
30 dnl Default to --enable-multilib
31 AC_ARG_ENABLE(multilib,
32 [ --enable-multilib build many library versions (default)],
33 [case "${enableval}" in
36 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
37 esac], [multilib=yes])dnl
39 dnl We may get other options which we don't document:
40 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
42 dnl I needed to add the -n test to allow configuration in src directory - HB
43 if test "[$]{srcdir}" = "."; then
44 if test "[$]{with_target_subdir}" != "." -a -n "[$]{with_target_subdir}"; then
45 gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../."
47 gc_basedir="[$]{srcdir}/[$]{with_multisrctop}."
50 gc_basedir="[$]{srcdir}/."
53 AC_CONFIG_AUX_DIR($gc_basedir/..)
55 # This overrides the previous occurrence for automake, but not for
56 # autoconf, which is exactly what we want.
62 # Get the 'noncanonical' system names.
63 sinclude(../config/acx.m4)
64 _GCC_TOPLEV_NONCANONICAL_BUILD
65 _GCC_TOPLEV_NONCANONICAL_HOST
66 _GCC_TOPLEV_NONCANONICAL_TARGET
68 # This works around an automake problem.
69 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
70 AC_SUBST(mkinstalldirs)
76 dnl We use these options to decide which functions to include.
77 AC_ARG_WITH(target-subdir,
78 [ --with-target-subdir=SUBDIR
79 configuring with a cross compiler])
80 AC_ARG_WITH(cross-host,
81 [ --with-cross-host=HOST configuring with a cross compiler])
84 # automake wants to see AC_EXEEXT. But we don't need it. And having
85 # it is actually a problem, because the compiler we're passed can't
86 # necessarily do a full link. So we fool automake here.
88 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
89 # to nothing, so nothing would remain between `then' and `fi' if it
90 # were not for the `:' below.
95 AC_MSG_CHECKING([for thread model used by GCC])
96 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
97 if test -z "$THREADS"; then
100 AC_MSG_RESULT([$THREADS])
102 AC_ARG_ENABLE(parallel-mark,
103 [ --enable-parallel-mark parallelize marking and free list construction],
106 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
111 INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
121 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
122 AC_DEFINE(GC_LINUX_THREADS)
123 AC_DEFINE(_REENTRANT)
124 if test "${enable_parallel_mark}" = yes; then
125 AC_DEFINE(PARALLEL_MARK)
127 AC_DEFINE(THREAD_LOCAL_ALLOC)
130 AC_DEFINE(GC_LINUX_THREADS)
131 AC_DEFINE(_REENTRANT)
134 AC_DEFINE(GC_AIX_THREADS)
135 AC_DEFINE(_REENTRANT)
138 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
139 AC_DEFINE(GC_HPUX_THREADS)
140 AC_DEFINE(_POSIX_C_SOURCE,199506L)
141 if test "${enable_parallel_mark}" = yes; then
142 AC_DEFINE(PARALLEL_MARK)
144 AC_DEFINE(THREAD_LOCAL_ALLOC)
145 THREADLIBS="-lpthread -lrt"
148 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
149 AC_DEFINE(GC_FREEBSD_THREADS)
150 INCLUDES="$INCLUDES -pthread"
154 AC_DEFINE(GC_SOLARIS_THREADS)
155 AC_DEFINE(GC_SOLARIS_PTHREADS)
158 AC_DEFINE(GC_IRIX_THREADS)
161 AC_DEFINE(GC_WIN32_THREADS)
164 AC_DEFINE(GC_DARWIN_THREADS)
165 AC_DEFINE(THREAD_LOCAL_ALLOC)
166 if test "${enable_parallel_mark}" = yes; then
167 AC_DEFINE(PARALLEL_MARK)
171 AC_DEFINE(GC_OSF1_THREADS)
172 if test "${enable_parallel_mark}" = yes; then
173 AC_DEFINE(PARALLEL_MARK)
174 AC_DEFINE(THREAD_LOCAL_ALLOC)
175 # May want to enable it in other cases, too.
176 # Measurements havent yet been done.
178 INCLUDES="$INCLUDES -pthread"
179 THREADLIBS="-lpthread -lrt"
184 AC_DEFINE(GC_WIN32_THREADS)
185 dnl Old wine getenv may not return NULL for missing entry.
186 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
190 AC_MSG_RESULT($THREADLIBS)
191 # Use pthread GCC switch
193 if test "${enable_parallel_mark}" = yes; then
194 AC_DEFINE(PARALLEL_MARK)
196 AC_DEFINE(THREAD_LOCAL_ALLOC)
197 AC_DEFINE(GC_DGUX386_THREADS)
198 AC_DEFINE(DGUX_THREADS)
199 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
200 INCLUDES="-pthread $INCLUDES"
205 AC_DEFINE(GC_AIX_THREADS)
206 AC_DEFINE(_REENTRANT)
208 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
209 AC_MSG_ERROR(thread package $THREADS not yet supported)
212 AC_MSG_ERROR($THREADS is an unknown thread package)
222 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
224 # We never want libdl on darwin. It is a fake libdl that just ends up making
229 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
233 AC_SUBST(EXTRA_TEST_LIBS)
235 target_all=libgcjgc.la
237 AC_SUBST(target_noncanonical)
239 dnl If the target is an eCos system, use the appropriate eCos
241 dnl FIXME: this should not be a local option but a global target
242 dnl system; at present there is no eCos target.
245 [ --with-ecos enable runtime eCos target support],
246 TARGET_ECOS="$with_ecos"
254 case "$TARGET_ECOS" in
259 CXXINCLUDES="-I${TARGET_ECOS}/include"
260 addobjs="$addobjs ecos.lo"
264 if test "${enable_cplusplus}" = yes; then
265 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
266 addtests="$addtests test_cpp"
269 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
274 AC_SUBST(CXXINCLUDES)
276 # Configuration of shared libraries
278 AC_MSG_CHECKING(whether to build shared libraries)
291 # Configuration of machine-dependent code
293 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
294 # anything else that creates trampolines in gc-allocated memory)
295 # always needs exec permission. The exceptions to this are IA-64 and
296 # some variations of Power PC, where trampolines don't contain
299 AC_MSG_CHECKING(which machine-dependent code should be used)
303 machdep="alpha_mach_dep.lo"
304 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
305 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
309 machdep="alpha_mach_dep.lo"
311 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
312 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
315 machdep="mips_ultrix_mach_dep.lo"
316 AC_DEFINE(STACKBASE, __stackbase)
317 AC_DEFINE(DATASTART_IS_ETEXT)
320 machdep="mips_ultrix_mach-dep.lo"
322 mips-nec-sysv*|mips-unknown-sysv*)
327 machdep="mips_sgi_mach_dep.lo"
330 machdep="sparc_netbsd_mach_dep.lo"
332 sparc-sun-solaris2.3)
333 machdep="sparc_mach_dep.lo"
334 AC_DEFINE(SUNOS53_SHARED_LIB)
336 sparc-sun-solaris2.*)
337 machdep="sparc_mach_dep.lo"
340 AC_DEFINE(NO_EXECUTE_PERMISSION)
341 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
344 if test x"$machdep" = x; then
345 AC_MSG_RESULT($machdep)
346 machdep="mach_dep.lo"
348 addobjs="$addobjs $machdep"
350 AC_SUBST(addincludes)
357 # Check for AViiON Machines running DGUX
359 AC_MSG_CHECKING(if host is AViiON running DGUX)
361 AC_CHECK_HEADER(sys/dg_sys_info.h,
364 AC_MSG_RESULT($ac_is_dgux)
365 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
366 if test $ac_is_dgux = yes; then
367 if test "$enable_full_debug" = "yes"; then
368 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
369 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
371 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
372 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
378 dnl We use these options to decide which functions to include.
379 AC_ARG_WITH(target-subdir,
380 [ --with-target-subdir=SUBDIR
381 configuring with a cross compiler])
382 AC_ARG_WITH(cross-host,
383 [ --with-cross-host=HOST configuring with a cross compiler])
385 # automake wants to see AC_EXEEXT. But we don't need it. And having
386 # it is actually a problem, because the compiler we're passed can't
387 # necessarily do a full link. So we fool automake here.
389 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
390 # to nothing, so nothing would remain between `then' and `fi' if it
391 # were not for the `:' below.
396 dnl As of 4.13a2, the collector will not properly work on Solaris when
397 dnl built with gcc and -O. So we remove -O in the appropriate case.
399 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
401 sparc-sun-solaris2*|*aix*)
402 if test "$GCC" = yes; then
410 new_CFLAGS="$new_CFLAGS $i"
419 *) AC_MSG_RESULT(no) ;;
422 dnl We need to override the top-level CFLAGS. This is how we do it.
426 dnl Include defines that have become de facto standard.
427 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
429 AC_DEFINE(NO_SIGNALS)
430 AC_DEFINE(ALL_INTERIOR_POINTERS)
432 dnl By default, make the library as general as possible.
433 AC_DEFINE(JAVA_FINALIZATION)
434 AC_DEFINE(GC_GCJ_SUPPORT)
435 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
437 dnl This is something of a hack. When cross-compiling we turn off
438 dnl some functionality. These is only correct when targetting an
439 dnl embedded system. FIXME.
440 if test -n "${with_cross_host}"; then
442 AC_DEFINE(NO_DEBUGGING)
445 AC_ARG_ENABLE(full-debug,
446 [ --enable-full-debug include full support for pointer backtracing etc.],
447 [ if test "$enable_full_debug" = "yes"; then
448 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
449 AC_DEFINE(KEEP_BACK_PTRS)
450 AC_DEFINE(DBG_HDRS_ALL)
453 AC_DEFINE(MAKE_BACK_GRAPH)
455 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
456 AC_DEFINE(MAKE_BACK_GRAPH)
457 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
458 AC_DEFINE(SAVE_CALL_COUNT, 8)
461 AC_DEFINE(MAKE_BACK_GRAPH)
466 if test -n "$with_cross_host" &&
467 test x"$with_cross_host" != x"no"; then
468 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
469 toolexeclibdir='$(toolexecdir)/lib'
471 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
472 toolexeclibdir='$(libdir)'
474 multi_os_directory=`$CC -print-multi-os-directory`
475 case $multi_os_directory in
476 .) ;; # Avoid trailing /.
477 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
479 AC_SUBST(toolexecdir)
480 AC_SUBST(toolexeclibdir)
482 if test "${multilib}" = "yes"; then
483 multilib_arg="--enable-multilib"
488 AC_OUTPUT(Makefile include/Makefile, [
489 dnl Put all the -I and -D options in a file.
490 echo "$INCLUDES $DEFS" > boehm-cflags
492 if test -n "$CONFIG_FILES"; then
493 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
494 ac_file=Makefile . ${gc_basedir}/../config-ml.in
499 with_multisubdir=${with_multisubdir}
500 ac_configure_args="${multilib_arg} ${ac_configure_args}"
501 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
502 gc_basedir=${gc_basedir}
504 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"