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 AM_ENABLE_MULTILIB(, ..)
31 # Get the 'noncanonical' system names.
32 _GCC_TOPLEV_NONCANONICAL_BUILD
33 _GCC_TOPLEV_NONCANONICAL_HOST
34 _GCC_TOPLEV_NONCANONICAL_TARGET
36 # This works around an automake problem.
37 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
38 AC_SUBST(mkinstalldirs)
40 AM_INIT_AUTOMAKE(gc, 6.1a1, no-define)
42 # The autoconf 2.5x version of the no-executables hack.
43 sinclude(../config/no-executables.m4)
46 # Yak. We must force CC and CXX to /not/ be precious variables; otherwise
47 # the wrong, non-multilib-adjusted value will be used in multilibs.
48 # As a side effect, we have to subst CFLAGS and CXXFLAGS ourselves.
50 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
51 m4_define([_AC_ARG_VAR_PRECIOUS],[])
54 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
61 # Newer automakes demand CCAS and CCASFLAGS.
63 : ${CCASFLAGS='$(CFLAGS)'}
69 AC_CHECK_TOOL(RANLIB, ranlib, :)
75 . [$]{srcdir}/configure.host
77 case [$]{gc_basedir} in
78 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=[$]{gc_basedir} ;;
79 *) gc_flagbasedir='[$](top_builddir)/'[$]{gc_basedir} ;;
82 gc_cflags="[$]{gc_cflags} -I"'[$](top_builddir)'"/./targ-include -I[$]{gc_flagbasedir}/libc/include"
85 gc_cflags="[$]{gc_cflags} -I[$]{gc_flagbasedir}/../winsup/include"
89 dnl gc_cflags="[$]{gc_cflags} -fno-builtin"
91 GC_CFLAGS=${gc_cflags}
96 dnl We use these options to decide which functions to include.
97 AC_ARG_WITH(target-subdir,
98 [ --with-target-subdir=SUBDIR
99 configuring with a cross compiler])
100 AC_ARG_WITH(cross-host,
101 [ --with-cross-host=HOST configuring with a cross compiler])
103 AC_MSG_CHECKING([for thread model used by GCC])
104 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
105 if test -z "$THREADS"; then
108 AC_MSG_RESULT([$THREADS])
110 AC_ARG_ENABLE(parallel-mark,
111 [ --enable-parallel-mark parallelize marking and free list construction],
114 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
119 AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
129 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
130 AC_DEFINE(GC_LINUX_THREADS)
131 AC_DEFINE(_REENTRANT)
132 if test "${enable_parallel_mark}" = yes; then
133 AC_DEFINE(PARALLEL_MARK)
135 AC_DEFINE(THREAD_LOCAL_ALLOC)
138 AC_DEFINE(GC_LINUX_THREADS)
139 AC_DEFINE(_REENTRANT)
142 AC_DEFINE(GC_AIX_THREADS)
143 AC_DEFINE(_REENTRANT)
146 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
147 AC_DEFINE(GC_HPUX_THREADS)
148 AC_DEFINE(_POSIX_C_SOURCE,199506L)
149 if test "${enable_parallel_mark}" = yes; then
150 AC_DEFINE(PARALLEL_MARK)
152 AC_DEFINE(THREAD_LOCAL_ALLOC)
153 THREADLIBS="-lpthread -lrt"
156 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
157 AC_DEFINE(GC_FREEBSD_THREADS)
158 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
162 AC_DEFINE(GC_SOLARIS_THREADS)
163 AC_DEFINE(GC_SOLARIS_PTHREADS)
166 AC_DEFINE(GC_IRIX_THREADS)
169 AC_DEFINE(GC_WIN32_THREADS)
172 AC_DEFINE(GC_DARWIN_THREADS)
173 AC_DEFINE(THREAD_LOCAL_ALLOC)
174 if test "${enable_parallel_mark}" = yes; then
175 AC_DEFINE(PARALLEL_MARK)
179 AC_DEFINE(GC_OSF1_THREADS)
180 if test "${enable_parallel_mark}" = yes; then
181 AC_DEFINE(PARALLEL_MARK)
182 AC_DEFINE(THREAD_LOCAL_ALLOC)
183 # May want to enable it in other cases, too.
184 # Measurements havent yet been done.
186 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
187 THREADLIBS="-lpthread -lrt"
192 AC_DEFINE(GC_WIN32_THREADS)
193 dnl Old wine getenv may not return NULL for missing entry.
194 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
198 AC_MSG_RESULT($THREADLIBS)
199 # Use pthread GCC switch
201 if test "${enable_parallel_mark}" = yes; then
202 AC_DEFINE(PARALLEL_MARK)
204 AC_DEFINE(THREAD_LOCAL_ALLOC)
205 AC_DEFINE(GC_DGUX386_THREADS)
206 AC_DEFINE(DGUX_THREADS)
207 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
208 AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
213 AC_DEFINE(GC_AIX_THREADS)
214 AC_DEFINE(_REENTRANT)
216 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
217 AC_MSG_ERROR(thread package $THREADS not yet supported)
220 AC_MSG_ERROR($THREADS is an unknown thread package)
230 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
232 # We never want libdl on darwin. It is a fake libdl that just ends up making
237 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
241 AC_SUBST(EXTRA_TEST_LIBS)
243 target_all=libgcjgc.la
245 AC_SUBST(target_noncanonical)
247 dnl If the target is an eCos system, use the appropriate eCos
249 dnl FIXME: this should not be a local option but a global target
250 dnl system; at present there is no eCos target.
253 [ --with-ecos enable runtime eCos target support],
254 TARGET_ECOS="$with_ecos"
261 case "$TARGET_ECOS" in
266 AM_CPPFLAGS="${AM_CPPFLAGS} -I${TARGET_ECOS}/include"
267 addobjs="$addobjs ecos.lo"
271 if test "${enable_cplusplus}" = yes; then
272 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
273 addtests="$addtests test_cpp"
276 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
280 AC_SUBST(AM_CPPFLAGS)
282 # Configuration of shared libraries
284 AC_MSG_CHECKING(whether to build shared libraries)
297 # Configuration of machine-dependent code
299 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
300 # anything else that creates trampolines in gc-allocated memory)
301 # always needs exec permission. The exceptions to this are IA-64 and
302 # some variations of Power PC, where trampolines don't contain
305 AC_MSG_CHECKING(which machine-dependent code should be used)
309 machdep="alpha_mach_dep.lo"
310 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
311 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
315 machdep="alpha_mach_dep.lo"
317 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
318 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
321 machdep="mips_ultrix_mach_dep.lo"
322 AC_DEFINE(STACKBASE, __stackbase)
323 AC_DEFINE(DATASTART_IS_ETEXT)
326 machdep="mips_ultrix_mach-dep.lo"
328 mips-nec-sysv*|mips-unknown-sysv*)
333 machdep="mips_sgi_mach_dep.lo"
336 machdep="sparc_netbsd_mach_dep.lo"
338 sparc-sun-solaris2.3)
339 machdep="sparc_mach_dep.lo"
340 AC_DEFINE(SUNOS53_SHARED_LIB)
342 sparc-sun-solaris2.*)
343 machdep="sparc_mach_dep.lo"
346 AC_DEFINE(NO_EXECUTE_PERMISSION)
347 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
350 if test x"$machdep" = x; then
351 AC_MSG_RESULT($machdep)
352 machdep="mach_dep.lo"
354 addobjs="$addobjs $machdep"
356 AC_SUBST(addincludes)
363 # Check for AViiON Machines running DGUX
365 AC_MSG_CHECKING(if host is AViiON running DGUX)
367 AC_CHECK_HEADER(sys/dg_sys_info.h,
370 AC_MSG_RESULT($ac_is_dgux)
371 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
372 if test $ac_is_dgux = yes; then
373 if test "$enable_full_debug" = "yes"; then
374 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
375 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
377 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
378 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
384 dnl We use these options to decide which functions to include.
385 AC_ARG_WITH(target-subdir,
386 [ --with-target-subdir=SUBDIR
387 configuring with a cross compiler])
388 AC_ARG_WITH(cross-host,
389 [ --with-cross-host=HOST configuring with a cross compiler])
391 dnl As of 4.13a2, the collector will not properly work on Solaris when
392 dnl built with gcc and -O. So we remove -O in the appropriate case.
394 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
396 sparc-sun-solaris2*|*aix*)
397 if test "$GCC" = yes; then
405 new_CFLAGS="$new_CFLAGS $i"
414 *) AC_MSG_RESULT(no) ;;
417 dnl We need to override the top-level CFLAGS. This is how we do it.
421 dnl Include defines that have become de facto standard.
422 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
424 AC_DEFINE(NO_SIGNALS)
425 AC_DEFINE(ALL_INTERIOR_POINTERS)
427 dnl By default, make the library as general as possible.
428 AC_DEFINE(JAVA_FINALIZATION)
429 AC_DEFINE(GC_GCJ_SUPPORT)
430 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
432 dnl This is something of a hack. When cross-compiling we turn off
433 dnl some functionality. These is only correct when targetting an
434 dnl embedded system. FIXME.
435 if test -n "${with_cross_host}"; then
437 AC_DEFINE(NO_DEBUGGING)
440 AC_ARG_ENABLE(full-debug,
441 [ --enable-full-debug include full support for pointer backtracing etc.],
442 [ if test "$enable_full_debug" = "yes"; then
443 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
444 AC_DEFINE(KEEP_BACK_PTRS)
445 AC_DEFINE(DBG_HDRS_ALL)
448 AC_DEFINE(MAKE_BACK_GRAPH)
450 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
451 AC_DEFINE(MAKE_BACK_GRAPH)
452 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
453 AC_DEFINE(SAVE_CALL_COUNT, 8)
456 AC_DEFINE(MAKE_BACK_GRAPH)
461 if test -n "$with_cross_host" &&
462 test x"$with_cross_host" != x"no"; then
463 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
464 toolexeclibdir='$(toolexecdir)/lib'
466 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
467 toolexeclibdir='$(libdir)'
469 multi_os_directory=`$CC -print-multi-os-directory`
470 case $multi_os_directory in
471 .) ;; # Avoid trailing /.
472 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
474 AC_SUBST(toolexecdir)
475 AC_SUBST(toolexeclibdir)
477 if test "${multilib}" = "yes"; then
478 multilib_arg="--enable-multilib"
483 AC_CONFIG_COMMANDS(boehm-cflags, [
484 dnl Put all the -I and -D options in a file.
485 echo "$AM_CPPFLAGS $DEFS" > boehm-cflags], [
487 AM_CPPFLAGS="$AM_CPPFLAGS"])
488 AC_CONFIG_FILES(Makefile include/Makefile)