* src/vm/jit/powerpc/codegen.c (codegen): Fixed ICMD_BALOAD, use
[cacao.git] / configure.ac
index 77be62674644c93773b01d131136f6bd8cc916c8..217a4273c55dc892a67efbcddf68af5cec8f24e2 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-AC_INIT(cacao, 0.96+svn, cacao@cacaojvm.org)
+AC_INIT(cacao, 0.97+svn, cacao@cacaojvm.org)
 AC_CONFIG_SRCDIR(src/cacao/cacao.c)
 AC_CANONICAL_HOST
 AC_PREREQ(2.59)
@@ -14,58 +14,65 @@ AC_PREFIX_DEFAULT(/usr/local/cacao)
 
 dnl set optimization and debugging for all architectures and systems
 if test x"$CFLAGS" = "x"; then
-    CFLAGS="-O0 -g3"
+    OPT_CFLAGS="-O0 -g3"
+else
+    OPT_CFLAGS=$CFLAGS
 fi
 
 dnl system type
 case "$host_cpu" in
 alpha | alphaev56 | alphapca56 )
     ARCH_DIR="alpha"
-    CFLAGS="$CFLAGS -mieee -D__ALPHA__"
+    ARCH_CFLAGS="-mieee -D__ALPHA__"
     ;;
 
 arm | armv4tl | armv5b | armv5l )
     ARCH_DIR="arm"
-    CFLAGS="$CFLAGS -D__ARM__"
+    ARCH_CFLAGS="-D__ARM__"
+    ;;
+
+hppa2.0 )
+    ARCH_DIR="parisc"
+    ARCH_CFLAGS="-D__PARISC__"
     ;;
 
 i386 | i486 | i586 | i686 )
     ARCH_DIR="i386"
-    CFLAGS="$CFLAGS -D__I386__"
+    ARCH_CFLAGS="-D__I386__"
     ;;
 
-mips )
+mips | mipsel )
     ARCH_DIR="mips"
-    CFLAGS="$CFLAGS -D__MIPS__"
+    ARCH_CFLAGS="-D__MIPS__"
     ;;
 
 powerpc )
     ARCH_DIR="powerpc"
-    CFLAGS="$CFLAGS -D__POWERPC__"
+    ARCH_CFLAGS="-D__POWERPC__"
     ;;
 
 powerpc64 )
     ARCH_DIR="powerpc64"
-    CFLAGS="$CFLAGS -D__POWERPC64__"
+    ARCH_CFLAGS="-D__POWERPC64__"
+    ;;
+
+sparc64 )
+    ARCH_DIR="sparc64"
+    ARCH_CFLAGS="-mcpu=v9 -m64 -D__SPARC_64__"
     ;;
 
 x86_64 )
     ARCH_DIR="x86_64"
-    CFLAGS="$CFLAGS -D__X86_64__"
+    ARCH_CFLAGS="-D__X86_64__"
     ;;
 
 xdspcore )
     ARCH_DIR="xdspcore"
     ENABLE_STATICVM="yes"
-    CFLAGS="$CFLAGS -D__XDSPCORE__"
+    ARCH_CFLAGS="-D__XDSPCORE__"
     USE_SCHEDULER="1"
     ;;
 
-sparc64 )
-    ARCH_DIR="sparc64"
-    CFLAGS="$CFLAGS -mcpu=v9 -m64 -D__SPARC_64__"
-    ;;
-
 * )
     AC_MSG_ERROR($host_cpu systems are not supported at this time)
     ;;
@@ -73,34 +80,40 @@ esac
 
 dnl host type
 case "$host_os" in
+*cygwin* )
+    OS_DIR="cygwin"
+    INTRP_CFLAGS="$ARCH_CFLAGS -D__WINDOWS__ -D__CYGWIN__ -Wall -Wno-long-long"
+    ARCH_CFLAGS="$ARCH_CFLAGS -D__WINDOWS__ -D__CYGWIN__ -ansi -pedantic -Wall -Wno-long-long"
+    ;;
+
 *darwin* )
     OS_DIR="darwin"
-    INTRP_CFLAGS="$CFLAGS -D__DARWIN__ -Wall -Wno-long-long"
-    CFLAGS="$CFLAGS -D__DARWIN__ -ansi -pedantic -Wall -Wno-long-long"
+    INTRP_CFLAGS="$ARCH_CFLAGS -D__DARWIN__ -Wall -Wno-long-long"
+    ARCH_CFLAGS="$ARCH_CFLAGS -D__DARWIN__ -ansi -pedantic -Wall -Wno-long-long"
     ;;
 
 *freebsd* )
     OS_DIR="freebsd"
-    INTRP_CFLAGS="$CFLAGS -D__FREEBSD__ -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
-    CFLAGS="$CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
+    INTRP_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
+    ARCH_CFLAGS="$ARCH_CFLAGS -D__FREEBSD__ -ansi -pedantic -Wall -Wno-long-long -D_XOPEN_SOURCE_EXTENDED"
     ;;
 
 *irix* )
     OS_DIR="irix"
-    INTRP_CFLAGS="$CFLAGS -D__IRIX__"
-    CFLAGS="$CFLAGS -D__IRIX__"
+    INTRP_CFLAGS="$ARCH_CFLAGS -D__IRIX__"
+    ARCH_CFLAGS="$ARCH_CFLAGS -D__IRIX__"
     ;;
 
 *linux* | *Linux* )
     OS_DIR="linux"
-    INTRP_CFLAGS="$CFLAGS -D__LINUX__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
-    CFLAGS="$CFLAGS -D__LINUX__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
+    INTRP_CFLAGS="$ARCH_CFLAGS -D__LINUX__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
+    ARCH_CFLAGS="$ARCH_CFLAGS -D__LINUX__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
     ;;
 
 *netbsd* )
     OS_DIR="netbsd"
-    INTRP_CFLAGS="$CFLAGS -D__NETBSD__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
-    CFLAGS="$CFLAGS -D__NETBSD__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
+    INTRP_CFLAGS="$ARCH_CFLAGS -D__NETBSD__ -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
+    ARCH_CFLAGS="$ARCH_CFLAGS -D__NETBSD__ -ansi -pedantic -Wall -Wno-long-long -D_POSIX_C_SOURCE=199506L -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE"
     ;;
 
 * )
@@ -108,17 +121,23 @@ case "$host_os" in
 esac
 
 
+dnl temporary set the CFLAGS for configure tests (e.g. inline keyword)
+dnl we set it properly at the end of this file
+CFLAGS="$ARCH_CFLAGS $OPT_CFLAGS"
+
+dnl set interpreter flags
+AC_SUBST(INTRP_CFLAGS)
+
 dnl define some stuff required for --fullversion
 AC_DEFINE_UNQUOTED(VERSION_CONFIGURE_ARGS, "$ac_configure_args", [configure arguments])
 AC_DEFINE_UNQUOTED(VERSION_CC, "$CC", [CC used])
-AC_DEFINE_UNQUOTED(VERSION_CFLAGS, "$CFLAGS", [CFLAGS used])
+AC_DEFINE_UNQUOTED(VERSION_CFLAGS, "$OPT_CFLAGS $ARCH_CFLAGS", [CFLAGS used])
 
 
 dnl define and substitute some architecture specific variables
 AC_DEFINE_UNQUOTED([ARCH_DIR], "${ARCH_DIR}", [architecture directory])
 AC_SUBST(ARCH_DIR)
 AC_SUBST(OS_DIR)
-AC_SUBST(INTRP_CFLAGS)
 AC_SUBST(USE_SCHEDULER)
 
 
@@ -163,10 +182,10 @@ dnl Checks for library functions.
 AC_PROG_GCC_TRADITIONAL
 AC_TYPE_SIGNAL
 AC_FUNC_MEMCMP
-AC_CHECK_FUNCS([calloc mprotect getpagesize free])
+AC_FUNC_MMAP
+AC_CHECK_FUNCS([calloc mmap getpagesize free])
 AC_CHECK_FUNCS([getcwd gettimeofday])
 AC_CHECK_FUNCS([scandir])
-AC_CHECK_FUNCS([mmap])
 AC_CHECK_FUNCS([isnan])
 
 dnl Checks for libraries.
@@ -185,6 +204,17 @@ fi
 AC_DEFINE_UNQUOTED([CACAO_PREFIX], "${CACAO_PREFIX}", [installation prefix])
 AC_SUBST(CACAO_PREFIX)
 
+dnl define libdir prefix
+if test "x$libdir" = "xNONE"; then
+    CACAO_LIBDIR=$ac_default_libdir
+else
+    CACAO_LIBDIR=$libdir
+fi
+dnl expand CACAO_LIBDIR to something that is usable in C code
+AS_AC_EXPAND([CACAO_LIBDIR], ${CACAO_LIBDIR})
+AC_DEFINE_UNQUOTED([CACAO_LIBDIR], "${CACAO_LIBDIR}", [library installation prefix])
+AC_SUBST(CACAO_LIBDIR)
+
 
 dnl Features
 
@@ -273,18 +303,35 @@ fi
 
 
 dnl check for garbage collector usage
-AC_MSG_CHECKING(whether GC should be disabled)
-AC_ARG_ENABLE([gc],
-              [AS_HELP_STRING(--disable-gc,disable garbage collector (for debugging only!) [[default=yes]])],
-              [case "${enableval}" in
-                   no) DISABLE_GC=yes
-                       AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
-                       ;;
-                   *) DISABLE_GC=no;;
-               esac],
-              [DISABLE_GC=no])
-AC_MSG_RESULT(${DISABLE_GC})
-AM_CONDITIONAL([DISABLE_GC], test x"${DISABLE_GC}" = "xyes")
+AC_ARG_ENABLE([gc], [AS_HELP_STRING(--enable-gc,enable garbage collector support (none,boehm,cacao) [[default=boehm]])])
+AC_MSG_CHECKING(whether GC should be enabled)
+enable_gc=${enable_gc:-boehm}
+case "$enable_gc" in
+no | none)
+    AC_DEFINE([DISABLE_GC], 1, [disable garbage collector])
+    ENABLE_GC=none
+    AC_MSG_RESULT(no)
+    ;;
+
+boehm)
+    AC_DEFINE([ENABLE_GC_BOEHM], 1, [enable conservative boehm-gc])
+    ENABLE_GC=boehm
+    AC_MSG_RESULT(yes, boehm-gc)
+    ;;
+
+cacao)
+    AC_DEFINE([ENABLE_GC_CACAO], 1, [enable exact cacao-gc])
+    ENABLE_GC=cacao
+    AC_MSG_RESULT(yes, cacao-gc)
+    ;;
+
+*)
+    AC_MSG_ERROR($enable_gc is an unknown garbage collector package)
+    ;;
+esac
+AM_CONDITIONAL([DISABLE_GC], test x"${ENABLE_GC}" = "xnone")
+AM_CONDITIONAL([ENABLE_GC_BOEHM], test x"${ENABLE_GC}" = "xboehm")
+AM_CONDITIONAL([ENABLE_GC_CACAO], test x"${ENABLE_GC}" = "xcacao")
 
 
 dnl check for dump memory usage
@@ -322,15 +369,32 @@ fi
 AM_CONDITIONAL([NDEBUG], test x"${NDEBUG}" = "xyes")
 
 
+dnl check for memcheck support
+AC_MSG_CHECKING(whether debugging memory checks should be enabled)
+AC_ARG_ENABLE([memcheck],
+              [AS_HELP_STRING(--enable-memcheck,enable debugging memory checks [[default=no]])],
+              [case "${enableval}" in
+                   yes) ENABLE_MEMCHECK=yes;;
+                   *) ENABLE_MEMCHECK=no;;
+               esac],
+              [ENABLE_MEMCHECK=no])
+AC_MSG_RESULT(${ENABLE_MEMCHECK})
+AM_CONDITIONAL([ENABLE_MEMCHECK], test x"${ENABLE_MEMCHECK}" = "xyes")
+
+if test x"${ENABLE_MEMCHECK}" = "xyes"; then
+    AC_DEFINE([ENABLE_MEMCHECK], 1, [perform debugging memory checks])
+fi
+
+
 dnl check for disassembler support
 AC_MSG_CHECKING(whether disassembler should be enabled)
 AC_ARG_ENABLE([disassembler],
-              [AS_HELP_STRING(--disable-disassembler,disable disassembler [[default=yes]])],
+              [AS_HELP_STRING(--enable-disassembler,enable disassembler [[default=no]])],
               [case "${enableval}" in
-                   no) ENABLE_DISASSEMBLER=no;;
-                   *) ENABLE_DISASSEMBLER=yes;;
+                   yes) ENABLE_DISASSEMBLER=yes;;
+                   *) ENABLE_DISASSEMBLER=no;;
                esac],
-              [ENABLE_DISASSEMBLER=yes])
+              [ENABLE_DISASSEMBLER=no])
 AC_MSG_RESULT(${ENABLE_DISASSEMBLER})
 AM_CONDITIONAL([ENABLE_DISASSEMBLER], test x"${ENABLE_DISASSEMBLER}" = "xyes")
 
@@ -453,7 +517,7 @@ fi
 
 
 dnl threads
-AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,green,native) [[default=native]])])
+AC_ARG_ENABLE([threads], [AS_HELP_STRING(--enable-threads,enable threads support (none,native) [[default=native]])])
 AC_ARG_ENABLE([__thread], [AS_HELP_STRING(--enable-__thread,use TLS features)], [use__thread=$enableval], [use__thread=no])
 
 AC_MSG_CHECKING(whether to include threads support)
@@ -473,9 +537,12 @@ native | posix | pthreads)
     
     AC_MSG_RESULT(yes, native)
     AC_CHECK_LIB(pthread, main)
-    
-    CFLAGS="$CFLAGS -D_REENTRANT"
-    
+
+    ARCH_CFLAGS="$ARCH_CFLAGS -D_REENTRANT"
+
+    dnl we changed ARCH_CFLAGS, set CFLAGS again
+    CFLAGS="$ARCH_CFLAGS $OPT_CFLAGS"
+
     dnl tell boehm to support threads as well
     ac_configure_args="$ac_configure_args --enable-boehm-threads=posix"
     ;;
@@ -492,7 +559,7 @@ if test "x$use__thread" != xno; then
   [cat > conftest.c <<\EOF
 __thread int a = 42;
 EOF
-  if AC_TRY_COMMAND([${CC-cc} $CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
+  if AC_TRY_COMMAND([${CC-cc} $ARCH_CFLAGS $OPT_CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
     ac_cv_gcc___thread=yes 
   else
     ac_cv_gcc___thread=no
@@ -557,6 +624,24 @@ if test x"${ENABLE_LOOP}" = "xyes"; then
 fi
 
 
+dnl check if linear scan register allocator(lsra) with SSA should be used
+AC_MSG_CHECKING(whether lsra with ssa should be supported)
+AC_ARG_ENABLE([ssa],
+              [AS_HELP_STRING(--disable-ssa,disable ssa [[default=no]])],
+              [case "${enableval}" in
+                   no) ENABLE_SSA=no;;
+                   *) ENABLE_SSA=yes;;
+               esac],
+              [ENABLE_SSA=no])
+AC_MSG_RESULT(${ENABLE_SSA})
+AM_CONDITIONAL([ENABLE_SSA], test x"${ENABLE_SSA}" = "xyes")
+
+if test x"${ENABLE_SSA}" = "xyes"; then
+    AC_DEFINE([ENABLE_SSA], 1, [enable lsra with ssa])
+    ENABLE_LSRA="no"
+fi
+
+
 dnl check if linear scan register allocator(lsra) should be used
 AC_MSG_CHECKING(whether lsra should be supported)
 AC_ARG_ENABLE([lsra],
@@ -566,9 +651,15 @@ AC_ARG_ENABLE([lsra],
                    *) ENABLE_LSRA=no;;
                esac],
               [ENABLE_LSRA=no])
+   
+if test x"${ENABLE_LSRA}" = "xyes"; then
+    if test x"${ENABLE_SSA}" = "xyes"; then
+        ENABLE_LSRA="no"
+    fi
+fi
 AC_MSG_RESULT(${ENABLE_LSRA})
 AM_CONDITIONAL([ENABLE_LSRA], test x"${ENABLE_LSRA}" = "xyes")
-   
 if test x"${ENABLE_LSRA}" = "xyes"; then
     AC_DEFINE([ENABLE_LSRA], 1, [enable lsra])
 fi
@@ -738,6 +829,20 @@ AC_CHECK_HEADER([${CLASSPATH_INCLUDEDIR}/jni.h],
                 [AC_MSG_ERROR(cannot find jni.h)])
 
 
+dnl if we compile for a JRE-style directory layout
+AC_MSG_CHECKING(if we compile for a JRE-style directory layout)
+AC_ARG_WITH([jre-layout],
+            [AS_HELP_STRING(--with-jre-layout,compile for JRE-style directory layout [[default=no]])],
+            [case "${enableval}" in
+                yes) WITH_JRE_LAYOUT=yes
+                     AC_DEFINE([WITH_JRE_LAYOUT], 1, [with JRE layout])
+                     ;;
+                *) WITH_JRE_LAYOUT=no;;
+             esac],
+            [WITH_JRE_LAYOUT=no])
+AC_MSG_RESULT(${WITH_JRE_LAYOUT})
+
+
 dnl check if GNU Classpath should be linked statically into CACAO
 AC_MSG_CHECKING(whether to link GNU Classpath native libraries statically into CACAO)
 AC_ARG_WITH([static-classpath],
@@ -767,10 +872,10 @@ AC_PROG_JAVAC
 AC_PROG_JAR
 
 
-dnl now configure subpackages
-dnl the export is not my favorite (is there another way?)
-export CFLAGS
-AC_CONFIG_SUBDIRS(src/boehm-gc)
+dnl finally pass CFLAGS to Makefiles via AM_CFLAGS
+CFLAGS=$OPT_CFLAGS
+AM_CFLAGS=$ARCH_CFLAGS
+AC_SUBST(AM_CFLAGS)
 
 
 AC_CONFIG_FILES([Makefile]
@@ -786,6 +891,7 @@ AC_CONFIG_FILES([Makefile]
                [src/fdlibm/Makefile]
                [src/lib/Makefile]
                [src/mm/Makefile]
+               [src/mm/cacao-gc/Makefile]
                [src/native/Makefile]
                [src/native/include/Makefile]
                [src/native/jvmti/Makefile]
@@ -793,10 +899,9 @@ AC_CONFIG_FILES([Makefile]
                [src/native/vm/Makefile]
                [src/scripts/Makefile]
                [src/scripts/java]
-               [src/scripts/rmic]
-               [src/scripts/rmiregistry]
                [src/threads/Makefile]
                [src/threads/native/Makefile]
+               [src/threads/none/Makefile]
                [src/toolbox/Makefile]
                [src/vm/Makefile]
                [src/vm/jit/Makefile]
@@ -805,22 +910,24 @@ AC_CONFIG_FILES([Makefile]
                [src/vm/jit/alpha/freebsd/Makefile]
                [src/vm/jit/alpha/linux/Makefile]
                [src/vm/jit/i386/Makefile]
+               [src/vm/jit/i386/cygwin/Makefile]
+               [src/vm/jit/i386/darwin/Makefile]
                [src/vm/jit/i386/freebsd/Makefile]
                [src/vm/jit/i386/linux/Makefile]
-               [src/vm/jit/ifconv/Makefile]
                [src/vm/jit/intrp/Makefile]
                [src/vm/jit/inline/Makefile]
                [src/vm/jit/loop/Makefile]
                [src/vm/jit/mips/Makefile]
                [src/vm/jit/mips/irix/Makefile]
                [src/vm/jit/mips/linux/Makefile]
+                [src/vm/jit/optimizing/Makefile]
+               [src/vm/jit/parisc/Makefile]
                [src/vm/jit/powerpc/Makefile]
                [src/vm/jit/powerpc/darwin/Makefile]
                [src/vm/jit/powerpc/linux/Makefile]
                [src/vm/jit/powerpc/netbsd/Makefile]
                [src/vm/jit/powerpc64/Makefile]
                [src/vm/jit/powerpc64/linux/Makefile]
-               [src/vm/jit/profile/Makefile]
                [src/vm/jit/schedule/Makefile]
                [src/vm/jit/sparc64/Makefile]
                [src/vm/jit/sparc64/linux/Makefile]
@@ -830,8 +937,16 @@ AC_CONFIG_FILES([Makefile]
                [tests/Makefile]
                [tests/regression/Makefile]
                [tests/regression/codepatching/Makefile]
+               [tests/regression/jasmin/Makefile]
                [tests/regression/native/Makefile])
 
+
+dnl now configure subpackages with OPT_CFLAGS and ARCH_CFLAGS
+export OPT_CFLAGS
+export ARCH_CFLAGS
+AC_CONFIG_SUBDIRS(src/mm/boehm-gc)
+
+
 AC_OUTPUT