Fix a mixed-decls-and-code warning.
[mono.git] / configure.in
index 0fd24114bb38bf2377cdd14b18150bc319e53018..60aee64a178ca4e2cd0c839ba8f2a659891c096a 100644 (file)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 #AC_PREREQ([2.62])
 
-AC_INIT(mono, [3.0.6],
+AC_INIT(mono, [3.3.0],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README])
@@ -72,6 +72,9 @@ no_version_script=no
 # Set to yes if Unix sockets cannot be created in an anonymous namespace
 need_link_unlink=no
 
+#Set to extra linker flags to be passed to the runtime binaries (mono /mono-sgen)
+extra_runtime_ldflags=""
+
 # Thread configuration inspired by sleepycat's db
 AC_MSG_CHECKING([host platform characteristics])
 libgc_threads=no
@@ -171,9 +174,8 @@ case "$host" in
                AC_DEFINE(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
                libdl=
                libgc_threads=pthreads
-               # This doesn't seem to work as of 7.0 on amd64
-               with_sigaltstack=no
                use_sigposix=yes
+               has_dtrace=yes
                ;;
        *-*-*openbsd*)
                host_win32=no
@@ -314,14 +316,19 @@ case "$host" in
                        dnl Snow Leopard and newer config.guess reports as this
                        i*86-*-darwin*)
                                BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE"
-                               CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
+                               BROKEN_DARWIN_CPPFLAGS="-D_XOPEN_SOURCE"
+                               CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_CPPFLAGS"
                                CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
                                CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
                                CCASFLAGS="$CCASFLAGS $BROKEN_DARWIN_FLAGS"
-                               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
+                               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_CPPFLAGS"
                                CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
-                               CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
+                               CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_CPPFLAGS"
                                CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
+                               extra_runtime_ldflags="-stack_size,0x800000"
+                               ;;
+                       x*64-*-darwin*)
+                               extra_runtime_ldflags="-stack_size,0x800000"
                                ;;
                        arm*-darwin*)
                                has_dtrace=no
@@ -351,6 +358,7 @@ if test x$need_link_unlink = xyes; then
    AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
 fi
 
+AC_SUBST(extra_runtime_ldflags)
 AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes)
 AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
 AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
@@ -490,6 +498,20 @@ AC_CHECK_HEADERS(linux/magic.h)
 # not 64 bit clean in cross-compile
 AC_CHECK_SIZEOF(void *, 4)
 
+AC_CACHE_CHECK([for clang],
+       mono_cv_clang,[
+       AC_TRY_COMPILE([], [
+               #ifdef __clang__
+               #else
+               #error "FAILED"
+               #endif
+               return 0;
+       ],
+       [mono_cv_clang=yes],
+       [mono_cv_clang=no],
+       [])
+])
+
 WARN=''
 if test x"$GCC" = xyes; then
         WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes  -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value'
@@ -510,7 +532,7 @@ if test x"$GCC" = xyes; then
 
                ORIG_CFLAGS=$CFLAGS
                # Check for the normal version, since gcc ignores unknown -Wno options
-               CFLAGS="$CFLAGS -Wunused-but-set-variable"
+               CFLAGS="$CFLAGS -Wunused-but-set-variable -Werror"
                AC_MSG_CHECKING(for -Wno-unused-but-set-variable option to gcc)
                AC_TRY_COMPILE([],[
                                return 0;
@@ -521,6 +543,12 @@ if test x"$GCC" = xyes; then
                   AC_MSG_RESULT(no)
                   CFLAGS=$ORIG_CFLAGS
                ])
+
+               if test "x$mono_cv_clang" = "xyes"; then
+                  # https://bugzilla.samba.org/show_bug.cgi?id=8118
+                  WARN="$WARN -Qunused-arguments"
+                  WARN="$WARN -Wno-unused-function -Wno-tautological-compare"
+               fi
 else
        # The Sun Forte compiler complains about inline functions that access static variables
        # so disable all inlining.
@@ -533,20 +561,6 @@ fi
 CFLAGS="$CFLAGS -g $WARN"
 CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
 
-AC_CACHE_CHECK([for clang],
-       mono_cv_clang,[
-       AC_TRY_COMPILE([], [
-               #ifdef __clang__
-               #else
-               #error "FAILED"
-               #endif
-               return 0;
-       ],
-       [mono_cv_clang=yes],
-       [mono_cv_clang=no],
-       [])
-])
-
 # Where's the 'mcs' source tree?
 if test -d $srcdir/mcs; then
   mcsdir=mcs
@@ -742,8 +756,8 @@ DISABLED_FEATURES=none
 
 AC_ARG_ENABLE(minimal, [  --enable-minimal=LIST      drop support for LIST subsystems.
      LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier, 
-     reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters,
-        sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
+     reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters, remoting,
+        security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
 [
        for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
                eval "mono_feature_disable_$feature='yes'"
@@ -882,6 +896,16 @@ if test "x$mono_feature_disable_appdomains" = "xyes"; then
        AC_MSG_NOTICE([Disabled support for multiple appdomains.])
 fi
 
+if test "x$mono_feature_disable_remoting" = "xyes"; then
+       AC_DEFINE(DISABLE_REMOTING, 1, [Disable remoting support (This disables type proxies and make com non-functional)])
+       AC_MSG_NOTICE([Disabled remoting])
+fi
+
+if test "x$mono_feature_disable_security" = "xyes"; then
+       AC_DEFINE(DISABLE_SECURITY, 1, [Disable CAS/CoreCLR security])
+       AC_MSG_NOTICE([Disabled CAS/CoreCLR security manager (used e.g. for Moonlight)])
+fi
+
 if test "x$mono_feature_disable_sgen_remset" = "xyes"; then
        AC_DEFINE(DISABLE_SGEN_REMSET, 1, [Disable wbarrier=remset support in SGEN.])
        AC_MSG_NOTICE([Disabled wbarrier=remset support in SGEN.])
@@ -1069,6 +1093,8 @@ AC_TRY_COMPILE([
        AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 1, [Length of zero length arrays])
 ])
 
+AC_CHECK_HEADERS(nacl/nacl_dyncode.h)
+
 if test x$target_win32 = xno; then
 
        dnl hires monotonic clock support
@@ -1124,6 +1150,8 @@ if test x$target_win32 = xno; then
 
        AC_CHECK_HEADERS(execinfo.h)
 
+       AC_CHECK_HEADERS(sys/auxv.h)
+
        AC_CHECK_FUNCS(getgrgid_r)
        AC_CHECK_FUNCS(getgrnam_r)
        AC_CHECK_FUNCS(getpwnam_r)
@@ -1537,8 +1565,7 @@ if test x$target_win32 = xno; then
                AC_MSG_RESULT(ok)
        ], [
                AC_MSG_RESULT(no)
-               AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
-               AC_DEFINE(USE_MONO_MUTEX, 1, [Use mono_mutex_t])
+               AC_ERROR(Posix system lacks support for recursive mutexes)
        ])
        AC_CHECK_FUNCS(pthread_attr_setstacksize)
        AC_CHECK_FUNCS(pthread_attr_getstack pthread_attr_getstacksize)
@@ -1779,11 +1806,13 @@ if test x$target_win32 = xno; then
        dnl **********************************
        dnl *** epoll                      ***
        dnl **********************************
-       AC_CHECK_HEADERS(sys/epoll.h)
-       haveepoll=no
-       AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
-       if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
-               AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
+       if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xno"; then
+               AC_CHECK_HEADERS(sys/epoll.h)
+               haveepoll=no
+               AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
+               if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+                       AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
+               fi
        fi
 
        havekqueue=no
@@ -1954,6 +1983,9 @@ if test x$target_win32 = xno; then
        AC_CHECK_FUNCS(lockf)
        AC_CHECK_FUNCS(swab)
        AC_CHECK_FUNCS(setusershell endusershell)
+       AC_CHECK_FUNCS(futimens utimensat)
+       AC_CHECK_FUNCS(fstatat mknodat readlinkat)
+       AC_CHECK_FUNCS(readv writev preadv pwritev)
        AC_CHECK_SIZEOF(size_t)
        AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], , 
                [#include <sys/types.h>
@@ -1968,6 +2000,8 @@ if test x$target_win32 = xno; then
        AC_CHECK_TYPES([struct flock], [AC_DEFINE(HAVE_STRUCT_FLOCK)], ,
                [#include <unistd.h>
                 #include <fcntl.h>])
+       AC_CHECK_TYPES([struct iovec], [AC_DEFINE(HAVE_STRUCT_IOVEC)], ,
+               [#include <sys/uio.h>])
        AC_CHECK_TYPES([struct pollfd], [AC_DEFINE(HAVE_STRUCT_POLLFD)], ,
                [#include <sys/poll.h>])
        AC_CHECK_TYPES([struct stat], [AC_DEFINE(HAVE_STRUCT_STAT)], ,
@@ -1997,6 +2031,11 @@ if test x$target_win32 = xno; then
                [struct statfs.f_flags],,, 
                [#include <sys/types.h>
                 #include <sys/vfs.h>])
+       AC_CHECK_MEMBERS(
+               [struct stat.st_atim, struct stat.st_mtim, struct stat.st_ctim],,, 
+               [#include <sys/types.h>
+                #include <sys/stat.h>
+                #include <unistd.h>])
 
        dnl Favour xattr through glibc, but use libattr if we have to
        AC_CHECK_FUNC(lsetxattr, ,
@@ -2289,16 +2328,32 @@ AC_ARG_ENABLE(nacl_codegen, [  --enable-nacl-codegen      Enable Native Client c
 AC_ARG_ENABLE(nacl_gc, [  --enable-nacl-gc           Enable Native Client garbage collection], enable_nacl_gc=$enableval, enable_nacl_gc=no)
 
 AM_CONDITIONAL(NACL_CODEGEN, test x$enable_nacl_codegen != xno)
+
+dnl
+dnl Hack to use system mono for operations in build/install not allowed in NaCl.
+dnl
+nacl_self_host=""
+if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xyes"; then
+   nacl_self_host="nacl_self_host"
+fi
+AC_SUBST(nacl_self_host)
+
 if test "x$enable_nacl_codegen" = "xyes"; then
    MONO_NACL_ALIGN_MASK_OFF=1
-   CPPFLAGS="$CPPFLAGS -D__native_client_codegen__"
    AC_DEFINE(TARGET_NACL, 1, [...])
+   AC_DEFINE(__native_client_codegen__, 1, [...])
 else
    MONO_NACL_ALIGN_MASK_OFF=0
-   CPPFLAGS="$CPPFLAGS -D__default_codegen__"
+   AC_DEFINE(__default_codegen__, 1, [...])
 fi
 if test "x$enable_nacl_gc" = "xyes"; then
-   CPPFLAGS="$CPPFLAGS -finstrument-for-thread-suspension -D__native_client_gc__"
+   if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
+      INSTRUMENT_CFLAG="-finstrument-for-thread-suspension"
+   else
+      # Not yet implemented
+      INSTRUMENT_CFLAG=""
+   fi
+   CPPFLAGS="$CPPFLAGS $INSTRUMENT_CFLAG -D__native_client_gc__"
 fi
 AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
 
@@ -2322,14 +2377,18 @@ if test "x$enable_llvm" = "xyes"; then
                ;;
    esac
 
-
    # The output of --cflags seems to include optimizations flags too
    LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
    # LLVM is compiled with -fno-rtti, so we need this too, since our classes inherit
    # from LLVM classes.
    LLVM_CXXFLAGS="`$LLVM_CONFIG --cxxflags` -fno-rtti"
    LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
-   LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit $llvm_codegen`
+   if test "x$host" != "x$target"; then
+      # No need for jit libs
+      LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter`
+   else
+      LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit $llvm_codegen`
+   fi
    LLVM_LIBS="$LLVM_LDFLAGS $LLVM_LIBS -lstdc++"
 
    # Should be something like '2.6' or '2.7svn'
@@ -2457,6 +2516,10 @@ case "$host" in
                TARGET=AMD64;
                arch_target=amd64;
                JIT_SUPPORTED=yes
+               if test "x$ac_cv_sizeof_void_p" = "x4"; then
+                       AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
+                       sizeof_register=8
+               fi
                case $host_os in
                  linux*)
                        sgen_supported=true
@@ -2507,18 +2570,6 @@ case "$host" in
                fi
                sgen_supported=true
                ;;
-       alpha*-*-linux* | alpha*-*-osf*)
-               TARGET=ALPHA;
-               ACCESS_UNALIGNED="no"
-               JIT_SUPPORTED=yes
-               arch_target=alpha;
-               CFLAGS="$CFLAGS -mieee -O0"
-               case $host_os in
-                 linux*)
-                       LIBC="libc.so.6.1"
-                       INTL="libc.so.6.1"
-               esac
-              ;;
        *-mingw*|*-*-cygwin*)
                # When this is enabled, it leads to very strange crashes at runtime (gcc-3.4.4)
                have_visibility_hidden=no
@@ -2547,9 +2598,9 @@ case "$host" in
                arch_target=arm;
                ACCESS_UNALIGNED="no"
                JIT_SUPPORTED=yes
-               CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6=1"
+               CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                # libgc's gc_locks.h depends on this
-           NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
+           CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC"
                sgen_supported=true
                ;;
        arm*-linux*)
@@ -2559,23 +2610,19 @@ case "$host" in
                JIT_SUPPORTED=yes
                sgen_supported=true
                AOT_SUPPORTED="yes"
-               if test "x$cross_compiling" != "xno"; then
-                  # Provide sane defaults when cross-compiling
-                  CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6=1"
-                  NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
-               fi
-               ;;
-       s390-*-linux*)
-               TARGET=S390;
-               arch_target=s390;
-               ACCESS_UNALIGNED="yes"
-               JIT_SUPPORTED=yes
-               sgen_supported=true
-               # Required CFLAGS for s390[x].  USE_STRING_INLINES is automatic with gcc 4.1
-               CFLAGS="$CFLAGS -mbackchain -D__USE_STRING_INLINES"
+               CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                ;;
+# TODO: make proper support for NaCl host.
+#        arm*-*nacl)
+#              TARGET=ARM;
+#              arch_target=arm;
+#              ACCESS_UNALIGNED="no"
+#              JIT_SUPPORTED=yes
+#              sgen_supported=true
+#              AOT_SUPPORTED="no"
+#              ;;
        s390x-*-linux*)
-               TARGET=S390x;
+               TARGET=S390X;
                arch_target=s390x;
                ACCESS_UNALIGNED="yes"
                JIT_SUPPORTED=yes
@@ -2595,7 +2642,7 @@ if test "x$host" != "x$target"; then
                arch_target=arm;
                ACCESS_UNALIGNED="no"
                JIT_SUPPORTED=yes
-               CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1 -D__ARM_EABI__ -DHAVE_ARMV6=1"
+               CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                jit_wanted=true
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
@@ -2629,13 +2676,34 @@ if test "x$host" != "x$target"; then
                AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
                sizeof_register=8
                ;;
-   *-*-nacl)
+# TODO: make proper support for NaCl target.
+#   arm*-*nacl)
+#              TARGET=ARM
+#              arch_target=arm
+#              AC_DEFINE(TARGET_ARM, 1, [...])
+#              ACCESS_UNALIGNED="no"
+#              JIT_SUPPORTED=yes
+#              sizeof_register=4
+#               CPPFLAGS="$CPPFLAGS \
+#                    -D__ARM_EABI__ \
+#                    -D__arm__ \
+#                    -D__portable_native_client__ \
+#                    -Dtimezone=_timezone \
+#                    -DDISABLE_SOCKETS \
+#                    -DDISABLE_ATTACH \
+#                    -DUSE_NEWLIB"
+#              jit_wanted=true
+               # Can't use tls, since it depends on the runtime detection of tls offsets
+               # in mono-compiler.h
+#              with_tls=pthread
+#              ;;
+   i686-*-nacl)
                TARGET=X86
                arch_target=x86
                AC_DEFINE(TARGET_X86, 1, [...])
                sizeof_register=4
                ;;
-   arm*-unknown-linux-*)
+   arm*-linux-*)
                TARGET=ARM;
                arch_target=arm;
                AC_DEFINE(TARGET_ARM, 1, [...])
@@ -2650,11 +2718,11 @@ if test "x$host" != "x$target"; then
                case "$target" in
                armv7l-unknown-linux-gnueabi*)
                        # TEGRA
-                       CPPFLAGS="$CPPFLAGS -DARM_FPU_VFP=1"
+                       CPPFLAGS="$CPPFLAGS"
                        ;;
                armv5-*-linux-androideabi*)
                        AC_DEFINE(TARGET_ANDROID, 1, [...])
-                       CPPFLAGS="$CPPFLAGS -DARM_FPU_NONE"
+                       CPPFLAGS="$CPPFLAGS"
                        ;;
                esac
                ;;
@@ -2663,7 +2731,6 @@ if test "x$host" != "x$target"; then
        esac
 fi
 
-# FIXME: Define the others as well
 case "$TARGET" in
 X86)
        AC_DEFINE(TARGET_X86, 1, [...])
@@ -2681,14 +2748,32 @@ POWERPC64)
        AC_DEFINE(TARGET_POWERPC, 1, [...])
        AC_DEFINE(TARGET_POWERPC64, 1, [...])
        ;;
-S390x)
+S390X)
        AC_DEFINE(TARGET_S390X, 1, [...])
        ;;
 MIPS)
        AC_DEFINE(TARGET_MIPS, 1, [...])
        ;;
+IA64)
+       AC_DEFINE(TARGET_IA64, 1, [...])
+       ;;
+SPARC)
+       AC_DEFINE(TARGET_SPARC, 1, [...])
+       ;;
+SPARC64)
+       AC_DEFINE(TARGET_SPARC64, 1, [...])
+       ;;
 esac
 
+dnl Use GCC atomic ops if they work on the target.
+if test x$GCC = "xyes"; then
+       case $TARGET in
+       X86 | AMD64 | ARM | POWERPC | POWERPC64 | MIPS)
+               AC_DEFINE(USE_GCC_ATOMIC_OPS, 1, [...])
+               ;;
+       esac
+fi
+
 if test "x$target_mach" = "xyes"; then
    if test "x$TARGET" = "xARM"; then
          AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
@@ -2852,7 +2937,7 @@ fi
 mono_debugger_supported=no
 AC_ARG_ENABLE(mono-debugger, [  --disable-mono-debugger disable support for the mdb debugger], try_mono_debugger=$enableval, try_mono_debugger=yes)
 if test "x$try_mono_debugger" = "xyes"; then
-       if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86" -o "x$TARGET" = "xALPHA" -o "x$TARGET" = "xS390x"; then
+       if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86" -o "x$TARGET" = "xS390x"; then
                if test x$use_included_gc = xyes; then
                        case "$host" in
                        *-*-*linux*)
@@ -2877,7 +2962,7 @@ mono_debugger_supported=no
 AC_MSG_CHECKING(if the Mono Debugger is supported on this platform)
 if test "x$mono_debugger_supported" = "xyes"; then
        BOEHM_DEFINES="$BOEHM_DEFINES -DMONO_DEBUGGER_SUPPORTED"
-       NESTED_LIBGC_FLAGS="-DMONO_DEBUGGER_SUPPORTED"
+       CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DMONO_DEBUGGER_SUPPORTED"
 fi
 AM_CONDITIONAL(MONO_DEBUGGER_SUPPORTED, test x$mono_debugger_supported = xyes)
 AC_MSG_RESULT($mono_debugger_supported)
@@ -2897,11 +2982,6 @@ if test "x$icall_tables" = "xno"; then
    AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
 fi
 
-if test "x$mono_cv_clang" = "xyes"; then
-   # FIXME: This causes many compilation errors
-   with_tls=pthread
-fi
-
 if test "x$with_tls" = "x__thread"; then
        AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
        # Pass the information to libgc
@@ -2910,55 +2990,122 @@ if test "x$with_tls" = "x__thread"; then
        AC_TRY_COMPILE([static __thread int foo __attribute__((tls_model("initial-exec")));], [
                ], [
                        AC_MSG_RESULT(yes)
-                       # CLANG doesn't support this yet, and it prints warnings about it
-                       if test "x$mono_cv_clang" = "xno"; then
-                               AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tld_model available])
-                       fi
+                       AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tls_model available])
                ], [
                        AC_MSG_RESULT(no)
        ])
 fi
 
-if test ${TARGET} = ARM && test x$cross_compiling = xno && test x$enable_mcs_build != xno; then
+if test ${TARGET} = ARM; then
        dnl ******************************************
        dnl *** Check to see what FPU is available ***
        dnl ******************************************
        AC_MSG_CHECKING(which FPU to use)
 
+       #
+       # This is a bit tricky:
+       #
+       # if (__ARM_PCS_VFP) {
+       #       /* mfloat-abi=hard == VFP with hard ABI */
+       # } elif (!__SOFTFP__) {
+       #       /* mfloat-abi=softfp == VFP with soft ABI */
+       # } else {
+       #       /* mfloat-abi=soft == no VFP */
+       # }
+       #
+       # The exception is iOS (w/ GCC) where none of the above
+       # are defined (but iOS always uses the 'softfp' ABI).
+       #
+       # No support for FPA.
+       #
+
        fpu=NONE
-       if gcc -v 2>&1 | grep -q -- '--with-float=hard'; then
-          fpu=VFP_HARD
+
+       # iOS GCC always uses the 'softfp' ABI.
+       if test x"$GCC" = xyes && test x$platform_darwin = xyes; then
+               fpu=VFP
        fi
 
+       # Are we using the 'hard' ABI?
        if test x$fpu = xNONE; then
-          ORIG_CFLAGS=$CFLAGS
-          CFLAGS="$CFLAGS -mfpu=vfp -mfloat-abi=softfp"
-          AC_TRY_RUN([
-                               int main () { __asm__ ("faddd   d7, d6, d7"); return 0; }
-                               ], fpu=VFP, fpu=NONE)
-          CFLAGS=$ORIG_CFLAGS
+               AC_TRY_COMPILE([], [
+                       #ifndef __ARM_PCS_VFP
+                       #error "Float ABI is not 'hard'"
+                       #endif
+                       return 0;
+               ], [
+                       fpu=VFP_HARD
+               ], [
+                       fpu=NONE
+               ])
        fi
 
+       # No 'hard' ABI. 'soft' or 'softfp'?
        if test x$fpu = xNONE; then
                AC_TRY_COMPILE([], [
-                       __asm__ ("ldfd f0, [r0]");
-                       ], fpu=FPA, fpu=NONE)
+                       #ifdef __SOFTFP__
+                       #error "Float ABI is not 'softfp'"
+                       #endif
+                       return 0;
+               ], [
+                       fpu=VFP
+               ], [
+                       fpu=NONE
+               ])
        fi
 
        AC_MSG_RESULT($fpu)
        CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu=1"
        unset fpu
 
-       AC_MSG_CHECKING(for ARMV6)
-       AC_TRY_RUN([
-               int main () { __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); return 0; }
-                       ], armv6=yes, armv6=no)
+       dnl *********************************************
+       dnl *** Check which ARM version(s) we can use ***
+       dnl *********************************************
+       AC_MSG_CHECKING(which ARM version to use)
+
+       AC_TRY_COMPILE([], [
+               #if !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) && !defined(__ARM_ARCH_5TEJ__)
+               #error Not on ARM v5.
+               #endif
+               return 0;
+       ], [
+               arm_v5=yes
+       ], [])
+
+       AC_TRY_COMPILE([], [
+               #if !defined(__ARM_ARCH_6J__) && !defined(__ARM_ARCH_6ZK__) && !defined(__ARM_ARCH_6K__) && !defined(__ARM_ARCH_6T2__) && !defined(__ARM_ARCH_6M__)
+               #error Not on ARM v6.
+               #endif
+               return 0;
+       ], [
+               arm_v5=yes
+               arm_v6=yes
+       ], [])
 
-       AC_MSG_RESULT($armv6)
-       if test ${armv6} = yes; then
-          AC_DEFINE(HAVE_ARMV6, 1, "Host supports ARMV6 instructions")
-          # libgc's gc_locks.h depends on this
-          NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
+       AC_TRY_COMPILE([], [
+               #if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_7R__) && !defined(__ARM_ARCH_7EM__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7S__)
+               #error Not on ARM v7.
+               #endif
+               return 0;
+       ], [
+               arm_v5=yes
+               arm_v6=yes
+               arm_v7=yes
+       ], [])
+
+       if test x$arm_v5 = xyes; then
+               AC_DEFINE(HAVE_ARMV5, 1, [ARM v5])
+               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV5=1"
+       fi
+
+       if test x$arm_v6 = xyes; then
+               AC_DEFINE(HAVE_ARMV6, 1, [ARM v6])
+               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6=1"
+       fi
+
+       if test x$arm_v7 = xyes; then
+               AC_DEFINE(HAVE_ARMV7, 1, [ARM v7])
+               CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV7=1"
        fi
 fi
 
@@ -2986,7 +3133,7 @@ case "x$gc" in
                # The problem with this approach, is that during a reconfigure, the main
                # configure scripts gets invoked with these arguments, so we use separate
                # variables understood by libgc's configure to pass CPPFLAGS and CFLAGS.
-               TMP_CPPFLAGS="$CPPFLAGS $NESTED_LIBGC_FLAGS"
+               TMP_CPPFLAGS="$CPPFLAGS $CPPFLAGS_FOR_LIBGC"
                if test x$TARGET = xSPARC -o x$TARGET = xSPARC64; then
                        TMP_CPPFLAGS=`echo $TMP_CPPFLAGS | sed -e 's/-D_FILE_OFFSET_BITS=64//g'`
                fi
@@ -3076,7 +3223,7 @@ fi
 if test "x$enable_shared" = "xno" -a "x$enable_executables" = "xyes"; then
    LIBMONO_LA=libmini-static.la
 else
-   LIBMONO_LA=libmono-$API_VER.la
+   LIBMONO_LA=libmonosgen-$API_VER.la
 fi
 AC_SUBST(LIBMONO_LA)
 
@@ -3128,15 +3275,12 @@ AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
 AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
 AM_CONDITIONAL(X86, test x$TARGET = xX86)
 AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
-AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
 AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
-AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
 AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
 AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
 AM_CONDITIONAL(POWERPC64, test x$TARGET = xPOWERPC64)
 AM_CONDITIONAL(ARM, test x$TARGET = xARM)
-AM_CONDITIONAL(S390, test x$TARGET = xS390)
-AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
+AM_CONDITIONAL(S390X, test x$TARGET = xS390X)
 AM_CONDITIONAL(HOST_X86, test x$HOST = xX86)
 AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64)
 AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
@@ -3328,10 +3472,8 @@ mono/arch/x86/Makefile
 mono/arch/amd64/Makefile
 mono/arch/ppc/Makefile
 mono/arch/sparc/Makefile
-mono/arch/s390/Makefile
 mono/arch/s390x/Makefile
 mono/arch/arm/Makefile
-mono/arch/alpha/Makefile
 mono/arch/ia64/Makefile
 mono/arch/mips/Makefile
 mono/interpreter/Makefile
@@ -3344,6 +3486,7 @@ mono/tests/cas/demand/Makefile
 mono/tests/cas/inheritance/Makefile
 mono/tests/cas/linkdemand/Makefile
 mono/tests/cas/threads/Makefile
+mono/tests/gc-descriptors/Makefile
 mono/benchmark/Makefile
 mono/monograph/Makefile
 mono/io-layer/Makefile
@@ -3403,6 +3546,11 @@ if test x$host_win32 = xyes; then
    sed -e "s,-mno-cygwin,,g" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
 fi
 
+if test x$platform_darwin = xyes; then
+   # This doesn't seem to be required and it slows down parallel builds
+   sed -e 's,lock_old_archive_extraction=yes,lock_old_archive_extraction=no,g' < libtool > libtool.new && mv libtool.new libtool && chmod +x libtool
+fi
+
 (
   case $prefix in
   NONE) prefix=$ac_default_prefix ;;