-# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2006 by Red Hat, Inc. All rights reserved.
+# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2006, 2010, 2011 by Red Hat, Inc.
+# All rights reserved.
# Copyright 2004 Nathanael Nerode
#
# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
dnl Process this file with autoconf to produce configure.
-AC_PREREQ(2.59)
+AC_PREREQ(2.64)
AC_INIT
AC_CONFIG_SRCDIR(gcj_mlc.c)
# This works around the fact that libtool configuration may change LD
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
AC_PROG_CXX
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AM_PROG_CC_C_O
;;
esac
+dnl Add for mingw targets GC_BUILD option
+case "${host}" in
+ *-*-mingw*)
+ gc_cflags="${gc_cflags} -DGC_BUILD=1"
+ ;;
+esac
+
dnl gc_cflags="${gc_cflags} -fno-builtin"
GC_CFLAGS=${gc_cflags}
)
AM_CPPFLAGS="-I`cd $srcdir && ${PWDCMD-pwd}`/include"
+THREADCFLAGS=
THREADLIBS=
case "$THREADS" in
no | none | single)
THREADS=none
;;
- posix | posix95 | pthreads)
+ posix | pthreads)
THREADS=posix
THREADLIBS=-lpthread
case "$host" in
*-*-hpux10*)
AC_MSG_WARN("Only HP-UX 11 POSIX threads are supported.")
;;
- *-*-kfreebsd*-gnu)
+ *-*-kfreebsd*-gnu)
AC_DEFINE(GC_FREEBSD_THREADS)
- INCLUDES="$INCLUDES -pthread"
- THREADDLLIBS=-pthread
+ THREADCFLAGS=-pthread
+ THREADLIBS=-pthread
AC_DEFINE(_REENTRANT)
if test "${enable_parallel_mark}" = yes; then
AC_DEFINE(PARALLEL_MARK)
fi
AC_DEFINE(THREAD_LOCAL_ALLOC)
AC_DEFINE(USE_COMPILER_TLS, 1,[use tls for boehm])
- ;;
+ ;;
+ *-*-gnu*)
+ AC_DEFINE(GC_GNU_THREADS,1,[support GNU threads])
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(THREAD_LOCAL_ALLOC)
+ ;;
*-*-freebsd*)
AC_MSG_WARN("FreeBSD does not yet fully support threads with Boehm GC.")
AC_DEFINE(GC_FREEBSD_THREADS,1,[support FreeBSD threads])
- AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
+ THREADCFLAGS=-pthread
THREADLIBS=-pthread
;;
- *-*-solaris*)
- AC_DEFINE(GC_SOLARIS_THREADS,1,[support for Solaris (thr_) threads])
+ *-*-solaris2.8*)
+ AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
+ # Need to use alternate thread library, otherwise gctest hangs
+ # on Solaris 8.
+ multi_os_directory=`$CC -print-multi-os-directory`
+ THREADLIBS="-L/usr/lib/lwp/$multi_os_directory \
+ -R/usr/lib/lwp/$multi_os_directory -lpthread -lthread -lrt"
+ ;;
+ *-*-solaris2*)
AC_DEFINE(GC_SOLARIS_PTHREADS,1,[support for Solaris pthreads])
+ # The alternate thread library was only introduced in Solaris 8 and
+ # became the default in Solaris 9, so no need for the special code
+ # above otherwise.
+ # nanosleep, sched_yield, and sem_* only live in librt before
+ # Solaris 11.
+ THREADLIBS="-lpthread -lrt"
;;
*-*-irix*)
AC_DEFINE(GC_IRIX_THREADS,1,[support for Irix pthreads])
# May want to enable it in other cases, too.
# Measurements havent yet been done.
fi
- AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
+ THREADCFLAGS=-pthread
THREADLIBS="-lpthread -lrt"
;;
esac
dnl Old wine getenv may not return NULL for missing entry.
dnl Define EMPTY_GETENV_RESULTS here to work around the bug.
;;
- dgux386)
- THREADS=dgux386
-AC_MSG_RESULT($THREADLIBS)
- # Use pthread GCC switch
- THREADLIBS=-pthread
- if test "${enable_parallel_mark}" = yes; then
- AC_DEFINE(PARALLEL_MARK,1)
- fi
- AC_DEFINE(THREAD_LOCAL_ALLOC,1)
- AC_DEFINE(GC_DGUX386_THREADS,1,[support for DB/UX on I386 threads])
- AC_DEFINE(DGUX_THREADS,1,[No description])
- # Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
- AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
- ;;
aix)
THREADS=posix
THREADLIBS=-lpthread
AC_DEFINE(GC_AIX_THREADS,1)
AC_DEFINE(_REENTRANT,1)
;;
- decosf1 | irix | mach | os2 | solaris | dce | vxworks)
+ dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
;;
*)
AC_MSG_ERROR($THREADS is an unknown thread package)
;;
esac
+AC_SUBST(THREADCFLAGS)
AC_SUBST(THREADLIBS)
case "$host" in
case "$host" in
powerpc*-*-darwin*)
AC_CHECK_MEMBER(ppc_thread_state_t.r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE_R0,,[ppc_thread_state_t has field r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE_R0,1,
+ [ppc_thread_state_t has field r0]),,
[#include <mach/thread_status.h>])
AC_CHECK_MEMBER(ppc_thread_state_t.__r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE___R0,,dnl
- [ppc_thread_state_t has field __r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE___R0,1,dnl
+ [ppc_thread_state_t has field __r0]),,
[#include <mach/thread_status.h>])
AC_CHECK_MEMBER(ppc_thread_state64_t.r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,,dnl
- [ppc_thread_state64_t has field r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE64_R0,1,dnl
+ [ppc_thread_state64_t has field r0]),,
[#include <mach/thread_status.h>])
AC_CHECK_MEMBER(ppc_thread_state64_t.__r0,
- AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,,dnl
- [ppc_thread_state64_t has field __r0]),,
+ AC_DEFINE(HAS_PPC_THREAD_STATE64___R0,1,dnl
+ [ppc_thread_state64_t has field __r0]),,
[#include <mach/thread_status.h>])
;;
i?86*-*-darwin*)
- AC_CHECK_MEMBER(i386_thread_state_t.eax,
- AC_DEFINE(HAS_I386_THREAD_STATE_EAX,,dnl
- [i386_thread_state_t has field eax]),,
- [#include <mach/thread_status.h>])
- AC_CHECK_MEMBER(i386_thread_state_t.__eax,
- AC_DEFINE(HAS_I386_THREAD_STATE___EAX,,dnl
- [i386_thread_state_t has field __eax]),,
- [#include <mach/thread_status.h>])
+ AC_CHECK_MEMBER(x86_thread_state32_t.eax,
+ AC_DEFINE(HAS_X86_THREAD_STATE32_EAX,1,dnl
+ [x86_thread_state32_t has field eax]),,
+ [#include <sys/cdefs.h>
+ #include <mach/thread_status.h>])
+ AC_CHECK_MEMBER(x86_thread_state32_t.__eax,
+ AC_DEFINE(HAS_X86_THREAD_STATE32___EAX,1,dnl
+ [x86_thread_state32_t has field __eax]),,
+ [#include <sys/cdefs.h>
+ #include <mach/thread_status.h>])
;;
+ x86_64-*-darwin*)
+ AC_CHECK_MEMBER(x86_thread_state64_t.rax,
+ AC_DEFINE(HAS_X86_THREAD_STATE64_RAX,1,dnl
+ [x86_thread_state64_t has field rax]),,
+ [#include <sys/cdefs.h>
+ #include <mach/thread_status.h>])
+ AC_CHECK_MEMBER(x86_thread_state64_t.__rax,
+ AC_DEFINE(HAS_X86_THREAD_STATE64___RAX,1,dnl
+ [x86_thread_state64_t has field __rax]),,
+ [#include <sys/cdefs.h>
+ #include <mach/thread_status.h>])
+ ;;
*) ;;
esac
-# We never want libdl on darwin. It is a fake libdl that just ends up making
-# dyld calls anyway
case "$host" in
+ # While IRIX 6 has libdl for the O32 and N32 ABIs, it's missing for N64
+ # and unnecessary everywhere.
+ mips-sgi-irix6*) ;;
+ # We never want libdl on darwin. It is a fake libdl that just ends up making
+ # dyld calls anyway
*-*-darwin*) ;;
*)
AC_CHECK_LIB(dl, dlopen, EXTRA_TEST_LIBS="$EXTRA_TEST_LIBS -ldl")
;;
esac
+# extra LD Flags which are required for targets
+case "${host}" in
+ *-*-darwin*)
+ extra_ldflags_libgc=-Wl,-single_module
+ ;;
+esac
+AC_SUBST(extra_ldflags_libgc)
+
AC_SUBST(EXTRA_TEST_LIBS)
target_all=libgcjgc.la
oldLIBS="$LIBS"
LIBS="$LIBS $THREADLIBS"
AC_CHECK_FUNCS([pthread_getattr_np])
+AC_CHECK_FUNCS([pthread_get_stackaddr_np])
LIBS="$oldLIBS"
# Configuration of machine-dependent code
#
-# We don't set NO_EXECUTE_PERMISSION by default because gcj (and
-# anything else that creates trampolines in gc-allocated memory)
-# always needs exec permission. The exceptions to this are IA-64 and
-# some variations of Power PC, where trampolines don't contain
-# executable code.
+# Set NO_EXECUTE_PERMISSION by default because gcj already uses
+# ffi_closure_{alloc,free} which takes care of allocating trampolines
+# in executable memory.
#
AC_MSG_CHECKING(which machine-dependent code should be used)
machdep=
alpha*-*-linux*)
machdep="alpha_mach_dep.lo"
;;
- i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
+ i?86-*-solaris2.[[89]] | i?86-*-solaris2.1? | x86_64-*-solaris2.1?)
AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED,1,[PROC_VDB in Solaris 2.5 gives wrong values for dirty bits])
;;
mipstx39-*-elf*)
machdep="sparc_mach_dep.lo"
;;
ia64-*-*)
- AC_DEFINE(NO_EXECUTE_PERMISSION,1,[cause some or all of the heap to not have execute permission])
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
;;
esac
+AC_DEFINE(NO_EXECUTE_PERMISSION,1,[cause some or all of the heap to not have execute permission])
if test x"$machdep" = x; then
AC_MSG_RESULT($machdep)
machdep="mach_dep.lo"
AC_SUBST(addlibs)
AC_SUBST(addtests)
-#
-# Check for AViiON Machines running DGUX
-#
-AC_MSG_CHECKING(if host is AViiON running DGUX)
-ac_is_dgux=no
-AC_CHECK_HEADER(sys/dg_sys_info.h,
-[ac_is_dgux=yes;])
-
-AC_MSG_RESULT($ac_is_dgux)
- ## :GOTCHA: we do not check anything but sys/dg_sys_info.h
-if test $ac_is_dgux = yes; then
- if test "$enable_full_debug" = "yes"; then
- CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
- CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
- else
- CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
- CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
- fi
- AC_SUBST(CFLAGS)
- AC_SUBST(CXXFLAGS)
-fi
-
dnl As of 4.13a2, the collector will not properly work on Solaris when
dnl built with gcc and -O. So we remove -O in the appropriate case.
dnl Not needed anymore on Solaris.
-AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
+AC_MSG_CHECKING([whether GCC optimization should be disabled])
+O0_CFLAGS=
case "$host" in
- *aix*)
- if test "$GCC" = yes; then
- AC_MSG_RESULT(yes)
- new_CFLAGS=
- for i in $CFLAGS; do
- case "$i" in
- -O*)
- ;;
- *)
- new_CFLAGS="$new_CFLAGS $i"
- ;;
- esac
- done
- CFLAGS="$new_CFLAGS"
- else
- AC_MSG_RESULT(no)
- fi
- ;;
- *) AC_MSG_RESULT(no) ;;
+ *aix*) test "$GCC" = yes && O0_CFLAGS=-O0 ;;
+ *) ;;
esac
-
-dnl We need to override the top-level CFLAGS. This is how we do it.
-MY_CFLAGS="$CFLAGS"
-AC_SUBST(MY_CFLAGS)
+if test x"$O0_CFLAGS" != x; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+AC_SUBST([O0_CFLAGS])
dnl Include defines that have become de facto standard.
dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
AC_DEFINE(GC_GCJ_SUPPORT,1,[include support for gcj])
AC_DEFINE(ATOMIC_UNCOLLECTABLE,1,[include code for GC_malloc_atomic_uncollectable])
-dnl This is something of a hack. When cross-compiling we turn off
-dnl some functionality. These is only correct when targetting an
-dnl embedded system. FIXME.
-if test -n "${with_cross_host}"; then
- AC_DEFINE(NO_SIGSET,1,[use empty GC_disable_signals and GC_enable_signals])
- AC_DEFINE(NO_DEBUGGING,1,[removes GC_dump])
-fi
-
AC_ARG_ENABLE(gc-debug,
[ --enable-gc-debug include full support for pointer backtracing etc.],
[ if test "$enable_gc_debug" = "yes"; then
AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
AC_DEFINE(SAVE_CALL_COUNT, 8, [number of call frames saved with objects allocated through the debugging interface])
;;
- i[3456]86-*-dgux*)
- AC_DEFINE(MAKE_BACK_GRAPH,1)
- ;;
esac
fi])
AC_CONFIG_HEADERS([include/gc_config.h include/gc_ext_config.h])
-AC_CONFIG_FILES(Makefile include/Makefile)
+AC_CONFIG_FILES(Makefile include/Makefile testsuite/Makefile threads.mk)
AC_OUTPUT