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.
20 AC_CONFIG_SRCDIR(gcj_mlc.c)
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(, ..)
32 # Get the 'noncanonical' system names.
33 ACX_NONCANONICAL_TARGET
35 # This works around an automake problem.
36 mkinstalldirs="`cd $ac_aux_dir && ${PWDCMD-pwd}`/mkinstalldirs"
37 AC_SUBST(mkinstalldirs)
39 AM_INIT_AUTOMAKE(gc, 6.3, no-define)
41 # The autoconf 2.5x version of the no-executables hack.
42 sinclude(../config/no-executables.m4)
45 # Yak. We must force CC and CXX to /not/ be precious variables; otherwise
46 # the wrong, non-multilib-adjusted value will be used in multilibs.
47 # As a side effect, we have to subst CFLAGS and CXXFLAGS ourselves.
49 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
50 m4_define([_AC_ARG_VAR_PRECIOUS],[])
53 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
60 # Newer automakes demand CCAS and CCASFLAGS.
62 : ${CCASFLAGS='$(CFLAGS)'}
68 AC_CHECK_TOOL(RANLIB, ranlib, :)
74 . ${srcdir}/configure.host
77 /* | [A-Za-z]:[/\\]*) gc_flagbasedir=${gc_basedir} ;;
78 *) gc_flagbasedir='$(top_builddir)/'${gc_basedir} ;;
81 gc_cflags="${gc_cflags} -Iinclude -I"'$(top_builddir)'"/./targ-include -I${gc_flagbasedir}/libc/include"
84 gc_cflags="${gc_cflags} -I${gc_flagbasedir}/../winsup/include"
88 dnl gc_cflags="${gc_cflags} -fno-builtin"
90 GC_CFLAGS=${gc_cflags}
95 dnl We use these options to decide which functions to include.
96 AC_ARG_WITH(target-subdir,
97 [ --with-target-subdir=SUBDIR
98 configuring with a cross compiler])
99 AC_ARG_WITH(cross-host,
100 [ --with-cross-host=HOST configuring with a cross compiler])
102 AC_MSG_CHECKING([for thread model used by GCC])
103 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
104 if test -z "$THREADS"; then
107 AC_MSG_RESULT([$THREADS])
109 AC_ARG_ENABLE(parallel-mark,
110 [ --enable-parallel-mark parallelize marking and free list construction],
113 AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
118 AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
128 x86-*-linux* | ia64-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha-*-linux*)
129 AC_DEFINE(GC_LINUX_THREADS)
130 AC_DEFINE(_REENTRANT)
131 if test "${enable_parallel_mark}" = yes; then
132 AC_DEFINE(PARALLEL_MARK)
134 AC_DEFINE(THREAD_LOCAL_ALLOC)
137 AC_DEFINE(GC_LINUX_THREADS)
138 AC_DEFINE(_REENTRANT)
141 AC_DEFINE(GC_AIX_THREADS)
142 AC_DEFINE(_REENTRANT)
145 AC_MSG_WARN("Only HP/UX 11 threads are supported.")
146 AC_DEFINE(GC_HPUX_THREADS)
147 AC_DEFINE(_POSIX_C_SOURCE,199506L)
148 if test "${enable_parallel_mark}" = yes; then
149 AC_DEFINE(PARALLEL_MARK)
151 AC_DEFINE(THREAD_LOCAL_ALLOC)
152 THREADLIBS="-lpthread -lrt"
155 AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
156 AC_DEFINE(GC_FREEBSD_THREADS)
157 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
161 AC_DEFINE(GC_SOLARIS_THREADS)
162 AC_DEFINE(GC_SOLARIS_PTHREADS)
165 AC_DEFINE(GC_IRIX_THREADS)
168 AC_DEFINE(GC_WIN32_THREADS)
171 AC_DEFINE(GC_DARWIN_THREADS)
172 AC_DEFINE(THREAD_LOCAL_ALLOC)
173 if test "${enable_parallel_mark}" = yes; then
174 AC_DEFINE(PARALLEL_MARK)
178 AC_DEFINE(GC_OSF1_THREADS)
179 if test "${enable_parallel_mark}" = yes; then
180 AC_DEFINE(PARALLEL_MARK)
181 AC_DEFINE(THREAD_LOCAL_ALLOC)
182 # May want to enable it in other cases, too.
183 # Measurements havent yet been done.
185 AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
186 THREADLIBS="-lpthread -lrt"
191 AC_DEFINE(GC_WIN32_THREADS)
192 dnl Old wine getenv may not return NULL for missing entry.
193 dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
197 AC_MSG_RESULT($THREADLIBS)
198 # Use pthread GCC switch
200 if test "${enable_parallel_mark}" = yes; then
201 AC_DEFINE(PARALLEL_MARK)
203 AC_DEFINE(THREAD_LOCAL_ALLOC)
204 AC_DEFINE(GC_DGUX386_THREADS)
205 AC_DEFINE(DGUX_THREADS)
206 # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
207 AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
212 AC_DEFINE(GC_AIX_THREADS)
213 AC_DEFINE(_REENTRANT)
215 decosf1 | irix | mach | os2 | solaris | dce | vxworks)
216 AC_MSG_ERROR(thread package $THREADS not yet supported)
219 AC_MSG_ERROR($THREADS is an unknown thread package)
229 AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
231 # We never want libdl on darwin. It is a fake libdl that just ends up making
236 AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
240 AC_SUBST(EXTRA_TEST_LIBS)
242 target_all=libgcjgc.la
245 dnl If the target is an eCos system, use the appropriate eCos
247 dnl FIXME: this should not be a local option but a global target
248 dnl system; at present there is no eCos target.
251 [ --with-ecos enable runtime eCos target support],
252 TARGET_ECOS="$with_ecos"
259 case "$TARGET_ECOS" in
264 AM_CPPFLAGS="${AM_CPPFLAGS} -I${TARGET_ECOS}/include"
265 addobjs="$addobjs ecos.lo"
269 if test "${enable_cplusplus}" = yes; then
270 addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
271 addtests="$addtests test_cpp"
274 AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
278 AC_SUBST(AM_CPPFLAGS)
280 # Configuration of shared libraries
282 AC_MSG_CHECKING(whether to build shared libraries)
295 # Configuration of machine-dependent code
297 # We don't set NO_EXECUTE_PERMISSION by default because gcj (and
298 # anything else that creates trampolines in gc-allocated memory)
299 # always needs exec permission. The exceptions to this are IA-64 and
300 # some variations of Power PC, where trampolines don't contain
303 AC_MSG_CHECKING(which machine-dependent code should be used)
307 machdep="alpha_mach_dep.lo"
308 if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
309 AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
313 machdep="alpha_mach_dep.lo"
315 i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
316 AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
319 machdep="mips_ultrix_mach_dep.lo"
320 AC_DEFINE(STACKBASE, __stackbase)
321 AC_DEFINE(DATASTART_IS_ETEXT)
324 machdep="mips_ultrix_mach-dep.lo"
326 mips-nec-sysv*|mips-unknown-sysv*)
331 machdep="mips_sgi_mach_dep.lo"
334 machdep="sparc_netbsd_mach_dep.lo"
336 sparc-sun-solaris2.3)
337 machdep="sparc_mach_dep.lo"
338 AC_DEFINE(SUNOS53_SHARED_LIB)
340 sparc-sun-solaris2.*)
341 machdep="sparc_mach_dep.lo"
344 AC_DEFINE(NO_EXECUTE_PERMISSION)
345 machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
348 if test x"$machdep" = x; then
349 AC_MSG_RESULT($machdep)
350 machdep="mach_dep.lo"
352 addobjs="$addobjs $machdep"
354 AC_SUBST(addincludes)
359 # Check for AViiON Machines running DGUX
361 AC_MSG_CHECKING(if host is AViiON running DGUX)
363 AC_CHECK_HEADER(sys/dg_sys_info.h,
366 AC_MSG_RESULT($ac_is_dgux)
367 ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
368 if test $ac_is_dgux = yes; then
369 if test "$enable_full_debug" = "yes"; then
370 CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
371 CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
373 CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
374 CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
380 dnl As of 4.13a2, the collector will not properly work on Solaris when
381 dnl built with gcc and -O. So we remove -O in the appropriate case.
383 AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
385 sparc-sun-solaris2*|*aix*)
386 if test "$GCC" = yes; then
394 new_CFLAGS="$new_CFLAGS $i"
403 *) AC_MSG_RESULT(no) ;;
406 dnl We need to override the top-level CFLAGS. This is how we do it.
410 dnl Include defines that have become de facto standard.
411 dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
413 AC_DEFINE(NO_SIGNALS)
414 AC_DEFINE(ALL_INTERIOR_POINTERS)
416 dnl By default, make the library as general as possible.
417 AC_DEFINE(JAVA_FINALIZATION)
418 AC_DEFINE(GC_GCJ_SUPPORT)
419 AC_DEFINE(ATOMIC_UNCOLLECTABLE)
421 dnl This is something of a hack. When cross-compiling we turn off
422 dnl some functionality. These is only correct when targetting an
423 dnl embedded system. FIXME.
424 if test -n "${with_cross_host}"; then
426 AC_DEFINE(NO_DEBUGGING)
429 AC_ARG_ENABLE(gc-debug,
430 [ --enable-gc-debug include full support for pointer backtracing etc.],
431 [ if test "$enable_gc_debug" = "yes"; then
432 AC_MSG_WARN("Must define GC_DEBUG and use debug alloc. in clients.")
433 AC_DEFINE(KEEP_BACK_PTRS)
434 AC_DEFINE(DBG_HDRS_ALL)
437 AC_DEFINE(MAKE_BACK_GRAPH)
439 x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
440 AC_DEFINE(MAKE_BACK_GRAPH)
441 AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
442 AC_DEFINE(SAVE_CALL_COUNT, 8)
445 AC_DEFINE(MAKE_BACK_GRAPH)
450 if test -n "$with_cross_host" &&
451 test x"$with_cross_host" != x"no"; then
452 toolexecdir='$(exec_prefix)/$(target_noncanonical)'
453 toolexeclibdir='$(toolexecdir)/lib'
455 toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
456 toolexeclibdir='$(libdir)'
458 multi_os_directory=`$CC -print-multi-os-directory`
459 case $multi_os_directory in
460 .) ;; # Avoid trailing /.
461 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
463 AC_SUBST(toolexecdir)
464 AC_SUBST(toolexeclibdir)
466 if test "${multilib}" = "yes"; then
467 multilib_arg="--enable-multilib"
472 AC_CONFIG_HEADERS([include/gc_config.h])
474 AC_CONFIG_FILES(Makefile include/Makefile)