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])
85 AC_MSG_CHECKING([for thread model used by GCC])
86 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
87 if test -z "$THREADS"; then
90 AC_MSG_RESULT([$THREADS])
92 AC_ARG_ENABLE(parallel-mark,
93 [ --enable-parallel-mark parallelize marking and free list construction],
96 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
101 INCLUDES="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
111 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
112 AC_DEFINE(GC_LINUX_THREADS)
113 AC_DEFINE(_REENTRANT)
114 if test "${enable_parallel_mark}" = yes; then
115 AC_DEFINE(PARALLEL_MARK)
117 AC_DEFINE(THREAD_LOCAL_ALLOC)
120 AC_DEFINE(GC_LINUX_THREADS)
121 AC_DEFINE(_REENTRANT)
124 AC_DEFINE(GC_AIX_THREADS)
125 AC_DEFINE(_REENTRANT)
128 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
129 AC_DEFINE(GC_HPUX_THREADS)
130 AC_DEFINE(_POSIX_C_SOURCE,199506L)
131 if test "${enable_parallel_mark}" = yes; then
132 AC_DEFINE(PARALLEL_MARK)
134 AC_DEFINE(THREAD_LOCAL_ALLOC)
135 THREADLIBS="-lpthread -lrt"
138 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
139 AC_DEFINE(GC_FREEBSD_THREADS)
140 INCLUDES="$INCLUDES -pthread"
144 AC_DEFINE(GC_SOLARIS_THREADS)
145 AC_DEFINE(GC_SOLARIS_PTHREADS)
148 AC_DEFINE(GC_IRIX_THREADS)
151 AC_DEFINE(GC_WIN32_THREADS)
154 AC_DEFINE(GC_DARWIN_THREADS)
155 AC_DEFINE(THREAD_LOCAL_ALLOC)
156 if test "${enable_parallel_mark}" = yes; then
157 AC_DEFINE(PARALLEL_MARK)
161 AC_DEFINE(GC_OSF1_THREADS)
162 if test "${enable_parallel_mark}" = yes; then
163 AC_DEFINE(PARALLEL_MARK)
164 AC_DEFINE(THREAD_LOCAL_ALLOC)
165 # May want to enable it in other cases, too.
166 # Measurements havent yet been done.
168 INCLUDES="$INCLUDES -pthread"
169 THREADLIBS="-lpthread -lrt"
174 AC_DEFINE(GC_WIN32_THREADS)
175 dnl Old wine getenv may not return NULL for missing entry.
176 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
180 AC_MSG_RESULT($THREADLIBS)
181 # Use pthread GCC switch
183 if test "${enable_parallel_mark}" = yes; then
184 AC_DEFINE(PARALLEL_MARK)
186 AC_DEFINE(THREAD_LOCAL_ALLOC)
187 AC_DEFINE(GC_DGUX386_THREADS)
188 AC_DEFINE(DGUX_THREADS)
189 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
190 INCLUDES="-pthread $INCLUDES"
195 AC_DEFINE(GC_AIX_THREADS)
196 AC_DEFINE(_REENTRANT)
198 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
199 AC_MSG_ERROR(thread package $THREADS not yet supported)
202 AC_MSG_ERROR($THREADS is an unknown thread package)
212 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
214 # We never want libdl on darwin. It is a fake libdl that just ends up making
219 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
223 AC_SUBST(EXTRA_TEST_LIBS)
225 target_all=libgcjgc.la
227 AC_SUBST(target_noncanonical)
229 dnl If the target is an eCos system, use the appropriate eCos
231 dnl FIXME: this should not be a local option but a global target
232 dnl system; at present there is no eCos target.
235 [ --with-ecos enable runtime eCos target support],
236 TARGET_ECOS="$with_ecos"
244 case "$TARGET_ECOS" in
249 CXXINCLUDES="-I${TARGET_ECOS}/include"
250 addobjs="$addobjs ecos.lo"
254 if test "${enable_cplusplus}" = yes; then
255 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
256 addtests="$addtests test_cpp"
259 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
264 AC_SUBST(CXXINCLUDES)
266 # Configuration of shared libraries
268 AC_MSG_CHECKING(whether to build shared libraries)
281 # Configuration of machine-dependent code
283 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
284 # anything else that creates trampolines in gc-allocated memory)
285 # always needs exec permission. The exceptions to this are IA-64 and
286 # some variations of Power PC, where trampolines don't contain
289 AC_MSG_CHECKING(which machine-dependent code should be used)
293 machdep="alpha_mach_dep.lo"
294 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
295 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
299 machdep="alpha_mach_dep.lo"
301 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
302 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
305 machdep="mips_ultrix_mach_dep.lo"
306 AC_DEFINE(STACKBASE, __stackbase)
307 AC_DEFINE(DATASTART_IS_ETEXT)
310 machdep="mips_ultrix_mach-dep.lo"
312 mips-nec-sysv*|mips-unknown-sysv*)
317 machdep="mips_sgi_mach_dep.lo"
320 machdep="sparc_netbsd_mach_dep.lo"
322 sparc-sun-solaris2.3)
323 machdep="sparc_mach_dep.lo"
324 AC_DEFINE(SUNOS53_SHARED_LIB)
326 sparc-sun-solaris2.*)
327 machdep="sparc_mach_dep.lo"
330 AC_DEFINE(NO_EXECUTE_PERMISSION)
331 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
334 if test x"$machdep" = x; then
335 AC_MSG_RESULT($machdep)
336 machdep="mach_dep.lo"
338 addobjs="$addobjs $machdep"
340 AC_SUBST(addincludes)
347 # Check for AViiON Machines running DGUX
349 AC_MSG_CHECKING(if host is AViiON running DGUX)
351 AC_CHECK_HEADER(sys/dg_sys_info.h,
354 AC_MSG_RESULT($ac_is_dgux)
355 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
356 if test $ac_is_dgux = yes; then
357 if test "$enable_full_debug" = "yes"; then
358 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
359 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
361 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
362 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
368 dnl We use these options to decide which functions to include.
369 AC_ARG_WITH(target-subdir,
370 [ --with-target-subdir=SUBDIR
371 configuring with a cross compiler])
372 AC_ARG_WITH(cross-host,
373 [ --with-cross-host=HOST configuring with a cross compiler])
375 dnl As of 4.13a2, the collector will not properly work on Solaris when
376 dnl built with gcc and -O. So we remove -O in the appropriate case.
378 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
380 sparc-sun-solaris2*|*aix*)
381 if test "$GCC" = yes; then
389 new_CFLAGS="$new_CFLAGS $i"
398 *) AC_MSG_RESULT(no) ;;
401 dnl We need to override the top-level CFLAGS. This is how we do it.
405 dnl Include defines that have become de facto standard.
406 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
408 AC_DEFINE(NO_SIGNALS)
409 AC_DEFINE(ALL_INTERIOR_POINTERS)
411 dnl By default, make the library as general as possible.
412 AC_DEFINE(JAVA_FINALIZATION)
413 AC_DEFINE(GC_GCJ_SUPPORT)
414 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
416 dnl This is something of a hack. When cross-compiling we turn off
417 dnl some functionality. These is only correct when targetting an
418 dnl embedded system. FIXME.
419 if test -n "${with_cross_host}"; then
421 AC_DEFINE(NO_DEBUGGING)
424 AC_ARG_ENABLE(full-debug,
425 [ --enable-full-debug include full support for pointer backtracing etc.],
426 [ if test "$enable_full_debug" = "yes"; then
427 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
428 AC_DEFINE(KEEP_BACK_PTRS)
429 AC_DEFINE(DBG_HDRS_ALL)
432 AC_DEFINE(MAKE_BACK_GRAPH)
434 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
435 AC_DEFINE(MAKE_BACK_GRAPH)
436 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
437 AC_DEFINE(SAVE_CALL_COUNT, 8)
440 AC_DEFINE(MAKE_BACK_GRAPH)
445 if test -n "$with_cross_host" &&
446 test x"$with_cross_host" != x"no"; then
447 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
448 toolexeclibdir='$(toolexecdir)/lib'
450 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
451 toolexeclibdir='$(libdir)'
453 multi_os_directory=`$CC -print-multi-os-directory`
454 case $multi_os_directory in
455 .) ;; # Avoid trailing /.
456 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
458 AC_SUBST(toolexecdir)
459 AC_SUBST(toolexeclibdir)
461 if test "${multilib}" = "yes"; then
462 multilib_arg="--enable-multilib"
467 AC_OUTPUT(Makefile include/Makefile, [
468 dnl Put all the -I and -D options in a file.
469 echo "$INCLUDES $DEFS" > boehm-cflags
471 if test -n "$CONFIG_FILES"; then
472 LD="${ORIGINAL_LD_FOR_MULTILIBS}"
473 ac_file=Makefile . ${gc_basedir}/../config-ml.in
478 with_multisubdir=${with_multisubdir}
479 ac_configure_args="${multilib_arg} ${ac_configure_args}"
480 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
481 gc_basedir=${gc_basedir}
483 ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"