Merge pull request #2201 from rolfbjarne/linker-better-xml-processing-errors
[mono.git] / configure.ac
index 00d0aa5ff142e10a4068c16a106e0a9516796ae2..be1e231bd300cd04cb94c6240fd59b29383a27b2 100644 (file)
@@ -13,7 +13,11 @@ AC_CANONICAL_HOST
 # The extra brackets are to foil regex-based scans.
 m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
 
-AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign subdir-objects])
+AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign subdir-objects]
+                 m4_esyscmd([case `automake --version | head -n 1` in    # parallel-tests is default in automake 1.13+, we need to explicitly enable it
+                             *1.11*|*1.12*) echo parallel-tests;;        # for 1.11 and 1.12 but not below as those versions don't recognize the flag
+                             esac]))                                     # TODO: remove this hack once we require automake 1.11+
+
 AC_CONFIG_HEADERS([config.h])
 AM_MAINTAINER_MODE
 
@@ -77,17 +81,10 @@ has_dtrace=no
 parallel_mark=yes
 ikvm_native=yes
 
-case "$host" in
-       powerpc*-*-linux*)
-               # https://bugzilla.novell.com/show_bug.cgi?id=504411
-               disable_munmap=yes
-       ;;
-esac
-
 host_win32=no
 target_win32=no
 platform_android=no
-platform_darwin=no
+host_darwin=no
 case "$host" in
        *-mingw*|*-*-cygwin*)
                AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
@@ -118,7 +115,6 @@ case "$host" in
                libgc_configure_args="$libgc_configure_args --enable-win32-dllmain=yes"
                ;;
        *-*-*netbsd*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE"
                libmono_cflags="-D_REENTRANT"
                LDFLAGS="$LDFLAGS -pthread"
@@ -131,7 +127,6 @@ case "$host" in
                use_sigposix=yes
                ;;
        *-*-kfreebsd*-gnu)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP -DTHREAD_LOCAL_ALLOC -pthread"
                libmono_cflags="-D_REENTRANT -DTHREAD_LOCAL_ALLOC -pthread"
                libmono_ldflags="-lpthread -pthread"
@@ -142,7 +137,6 @@ case "$host" in
                use_sigposix=yes
                ;;
        *-*-*freebsd*)
-               host_win32=no
                if test "x$PTHREAD_CFLAGS" = "x"; then
                        CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
                        libmono_cflags=
@@ -166,7 +160,6 @@ case "$host" in
                has_dtrace=yes
                ;;
        *-*-*openbsd*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DPLATFORM_BSD -D_REENTRANT -DUSE_MMAP"
                if test "x$disable_munmap" != "xyes"; then
                CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
@@ -181,7 +174,6 @@ case "$host" in
                use_sigposix=yes
                ;;
        *-*-linux-android*)
-               host_win32=no
                platform_android=yes
                AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
                AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform])
@@ -220,7 +212,6 @@ case "$host" in
                mono_cv_clang=no
                ;;
        *-*-linux*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
                if test "x$disable_munmap" != "xyes"; then
                        CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
@@ -239,10 +230,13 @@ case "$host" in
                        support_boehm=no
                        with_gc=sgen
                        ;;
+               powerpc*-*-linux*)
+                       # https://bugzilla.novell.com/show_bug.cgi?id=504411
+                       disable_munmap=yes
+                       ;;
                esac
                ;;
        *-*-nacl*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
                if test "x$disable_munmap" != "xyes"; then
                        CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
@@ -256,7 +250,6 @@ case "$host" in
                AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
                ;;
        *-*-hpux*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
                # +ESdbgasm only valid on bundled cc on RISC
                # silently ignored for ia64
@@ -275,7 +268,6 @@ case "$host" in
                use_sigposix=yes
                ;;
        *-*-solaris*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS"
                need_link_unlink=yes
                libmono_cflags="-D_REENTRANT"
@@ -288,8 +280,7 @@ case "$host" in
                ;;
        *-*-darwin*)
                parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
-               host_win32=no
-               platform_darwin=yes
+               host_darwin=yes
                target_mach=yes
                CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
                libmono_cflags="-D_THREAD_SAFE"
@@ -327,7 +318,6 @@ case "$host" in
                esac
                ;;
        *-*-haiku*)
-               host_win32=no
                CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
                libmono_cflags="-D_REENTRANT -D_THREAD_SAFE"
                libdl=
@@ -339,7 +329,6 @@ case "$host" in
                ;;
        *)
                AC_MSG_WARN([*** Please add $host to configure.ac checks!])
-               host_win32=no
                libdl="-ldl"
                ;;
 esac
@@ -360,9 +349,8 @@ 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_GNU, echo x$target_os | grep -q -- -gnu)
 AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
-AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
+AM_CONDITIONAL(PLATFORM_DARWIN, test x$host_darwin = xyes)
 AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
 AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
 
@@ -429,7 +417,7 @@ AC_PROG_LD_GNU
 AM_ICONV()
 
 AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h)
-AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h)
+AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
 AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],
                   [], [], [#include <stddef.h>
                  #include <sys/socket.h>
@@ -558,7 +546,7 @@ if test x"$GCC" = xyes; then
                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 -Wno-parentheses-equality -Wno-self-assign"
+                  WARN="$WARN -Wno-unused-function -Wno-tautological-compare -Wno-parentheses-equality -Wno-self-assign -Wno-return-stack-address"
                fi
 else
        # The Sun Forte compiler complains about inline functions that access static variables
@@ -667,17 +655,9 @@ AC_CONFIG_SUBDIRS(eglib)
 
 GLIB_CFLAGS='-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src'
 GLIB_LIBS='-L$(top_builddir)/eglib/src -leglib -lm'
-BUILD_GLIB_CFLAGS="$GLIB_CFLAGS"
-BUILD_GLIB_LIBS="$GLIB_LIBS"
-GMODULE_CFLAGS="$GLIB_CFLAGS"
-GMODULE_LIBS="$GLIB_LIBS"
   
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
-AC_SUBST(GMODULE_CFLAGS)
-AC_SUBST(GMODULE_LIBS)
-AC_SUBST(BUILD_GLIB_CFLAGS)
-AC_SUBST(BUILD_GLIB_LIBS)
 
 # Enable support for fast thread-local storage
 # Some systems have broken support, so we allow to disable it.
@@ -763,7 +743,8 @@ AC_ARG_ENABLE(minimal, [  --enable-minimal=LIST      drop support for LIST subsy
 AC_DEFINE_UNQUOTED(DISABLED_FEATURES, "$DISABLED_FEATURES", [String of disabled features])
 
 if test "x$mono_feature_disable_aot" = "xyes"; then
-       AC_DEFINE(DISABLE_AOT_COMPILER, 1, [Disable AOT Compiler])
+       AC_DEFINE(DISABLE_AOT, 1, [Disable AOT Compiler])
+       enable_system_aot=no
        AC_MSG_NOTICE([Disabled AOT compiler])
 fi
 
@@ -953,12 +934,6 @@ if test x$has_extension_module != xno ; then
        AC_MSG_NOTICE([Enabling mono extension module.])
 fi
 
-AC_ARG_ENABLE(gsharing, [  --enable-gsharing Enable gsharing], enable_gsharing=$enableval, enable_gsharing=no)
-if test x$enable_gsharing = xyes; then
-       AC_DEFINE(ENABLE_GSHAREDVT,1,[Gsharing])
-fi
-
-# A synonym
 AC_ARG_ENABLE(gsharedvt, [  --enable-gsharedvt Enable generic valuetype sharing], enable_gsharedvt=$enableval, enable_gsharedvt=no)
 if test x$enable_gsharedvt = xyes; then
        AC_DEFINE(ENABLE_GSHAREDVT,1,[Gsharedvt])
@@ -1103,6 +1078,12 @@ AC_CHECK_FUNCS(sigaction)
 AC_CHECK_FUNCS(kill)
 AC_CHECK_FUNCS(signal)
 
+# signal() is declared inline in Android headers
+# so we need to workaround it by overriding the check.
+if test x$platform_android = xyes; then
+       AC_DEFINE(HAVE_SIGNAL,1)
+fi
+
 if test x$host_win32 = xno; then
 
        dnl hires monotonic clock support
@@ -1941,7 +1922,7 @@ if test x$host_win32 = xno; then
        dnl * back 
        dnl **************************************
        if test "x$havekqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes"; then
-               if test "x$platform_darwin" = "xno"; then
+               if test "x$host_darwin" = "xno"; then
                        AC_DEFINE(USE_KQUEUE_FOR_THREADPOOL, 1, [Use kqueue for the threadpool])
                fi
        fi
@@ -2101,6 +2082,7 @@ if test x$host_win32 = xno; then
        AC_CHECK_FUNCS(readv writev preadv pwritev)
        AC_CHECK_FUNCS(setpgid)
        AC_CHECK_FUNCS(system)
+       AC_CHECK_FUNCS(fork execv execve)
        AC_CHECK_SIZEOF(size_t)
        AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], , 
                [#include <sys/types.h>
@@ -2117,6 +2099,8 @@ if test x$host_win32 = xno; then
                 #include <fcntl.h>])
        AC_CHECK_TYPES([struct iovec], [AC_DEFINE(HAVE_STRUCT_IOVEC)], ,
                [#include <sys/uio.h>])
+       AC_CHECK_TYPES([struct linger], [AC_DEFINE(HAVE_STRUCT_LINGER)], ,
+               [#include <sys/socket.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)], ,
@@ -2189,10 +2173,6 @@ if test x$host_win32 = xno; then
         #endif
        ])
        AC_CHECK_HEADERS([termios.h])
-
-       dnl * This is provided in io-layer, but on windows it's only available
-       dnl * on xp+
-       AC_DEFINE(HAVE_GETPROCESSID, 1, [Define if GetProcessId is available])
 else
        dnl *********************************
        dnl *** Checks for Windows compilation ***
@@ -2351,16 +2331,6 @@ else
        AC_CHECK_DECLS(InterlockedAdd, [], [], [[#include <windows.h>]])
        AC_CHECK_DECLS(InterlockedAdd64, [], [], [[#include <windows.h>]])
        AC_CHECK_DECLS(__readfsdword, [], [], [[#include <windows.h>]])
-
-       AC_MSG_CHECKING(for GetProcessId)
-       AC_TRY_COMPILE([#include <windows.h>], [
-               GetProcessId (0);
-       ], [
-          AC_MSG_RESULT(yes)
-          AC_DEFINE(HAVE_GETPROCESSID)
-       ], [
-          AC_MSG_RESULT(no)
-       ])
 fi
 
 dnl socklen_t check
@@ -2405,8 +2375,6 @@ if test "x$ac_cv_truncl" != "xyes"; then
    AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL, 1, [Has the 'aintl' function]) LIBS="$LIBS -lsunmath"])
 fi
 
-AC_CHECK_FUNCS(round)
-AC_CHECK_FUNCS(rint)
 AC_CHECK_FUNCS(execvp)
 
 dnl ****************************
@@ -2601,6 +2569,13 @@ if test "x$enable_nacl_gc" = "xyes"; then
 fi
 AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
 
+dnl **************************
+dnl *** AOT cross offsets  ***
+dnl **************************
+
+AC_ARG_WITH(cross-offsets, [  --with-cross-offsets=<offsets file path>    Explicit AOT cross offsets file],
+    AC_DEFINE_UNQUOTED(MONO_OFFSETS_FILE, "$withval", [AOT cross offsets file]))
+
 dnl **************
 dnl ***  LLVM  ***
 dnl **************
@@ -2608,6 +2583,7 @@ dnl **************
 AC_ARG_ENABLE(llvm,[  --enable-llvm    Enable the LLVM back-end], enable_llvm=$enableval, enable_llvm=no)
 AC_ARG_ENABLE(loadedllvm,[  --enable-loadedllvm        Load the LLVM back-end dynamically], enable_llvm=$enableval && enable_loadedllvm=$enableval, enable_loadedllvm=no)
 AC_ARG_ENABLE(llvm-version-check,[  --enable-llvm-version-check Check that the LLVM matches the version expected by mono], enable_llvm_version_check=$enableval, enable_llvm_version_check=no)
+AC_ARG_ENABLE(llvm-runtime,[  --enable-llvm-runtime    Enable runtime support for llvmonly code], enable_llvm_runtime=$enableval, enable_llvm_runtime=no)
 
 AC_ARG_WITH(llvm, [  --with-llvm=<llvm prefix>    Enable the LLVM back-end], enable_llvm=yes,)
 
@@ -2638,19 +2614,26 @@ if test "x$enable_llvm" = "xyes"; then
 
    # 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_CXXFLAGS=`$LLVM_CONFIG --cxxflags | 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_CXXFLAGS="$LLVM_CXXFLAGS -fno-rtti -fexceptions"
    LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
    # This might include empty lines
    LLVM_SYSTEM_LIBS=`$LLVM_CONFIG --system-libs 2>/dev/null | grep -- -`
    if test "x$host" != "x$target"; then
       # No need for jit libs
-      LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter`
+      LLVM_LIBS=`$LLVM_CONFIG --libs analysis core bitwriter`
+   else
+      LLVM_LIBS=`$LLVM_CONFIG --libs analysis core bitwriter jit mcjit $llvm_codegen`
+   fi
+   LLVM_LIBS="$LLVM_LIBS $LLVM_LDFLAGS $LLVM_SYSTEM_LIBS"
+   # The c++ standard library used by llvm doesn't show up in $LLVM_SYSTEM_LIBS so add it manually
+   if echo $LLVM_CXXFLAGS | grep -q -- '-stdlib=libc++'; then
+      LLVM_LIBS="$LLVM_LIBS -lc++"
    else
-      LLVM_LIBS=`$LLVM_CONFIG --libs core bitwriter jit mcjit $llvm_codegen`
+      LLVM_LIBS="$LLVM_LIBS -lstdc++"
    fi
-   LLVM_LIBS="$LLVM_LIBS $LLVM_LDFLAGS $LLVM_SYSTEM_LIBS -lstdc++"
 
    expected_llvm_version="3.4svn-mono-mono/e656cac"
 
@@ -2671,7 +2654,7 @@ if test "x$enable_llvm" = "xyes"; then
 
    else
        LLVM_CFLAGS="-I$with_llvm/include -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
-       LLVM_CXXFLAGS="$LLVM_CFLAGS -std=gnu++11 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -Woverloaded-virtual -Wcast-qual"
+       LLVM_CXXFLAGS="$LLVM_CFLAGS -std=gnu++11 -fvisibility-inlines-hidden -fno-rtti -Woverloaded-virtual -Wcast-qual"
        LLVM_LDFLAGS="-L$with_llvm/lib"
        LLVM_SYSTEM_LIBS="-lshell32 -lpsapi -limagehlp -ldbghelp -lm"
        LLVM_LIBS="-lLLVMLTO -lLLVMObjCARCOpts -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter \
@@ -2679,6 +2662,7 @@ if test "x$enable_llvm" = "xyes"; then
          -lLLVMARMAsmPrinter -lLLVMTableGen -lLLVMDebugInfo -lLLVMOption -lLLVMX86Disassembler \
          -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc \
          -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT \
+         -lLLVMAnalysis -lLLVMTarget \
          -lLLVMIRReader -lLLVMAsmParser -lLLVMLineEditor -lLLVMMCAnalysis -lLLVMInstrumentation \
          -lLLVMInterpreter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils \
          -lLLVMipa -lLLVMAnalysis -lLLVMProfileData -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld \
@@ -2713,6 +2697,14 @@ if test "x$enable_loadedllvm" = "xyes"; then
 fi
 AM_CONDITIONAL(LOADED_LLVM, [test x$enable_loadedllvm = xyes])
 
+if test "x$enable_llvm" = "xyes"; then
+   enable_llvm_runtime=yes
+fi
+if test "x$enable_llvm_runtime" = "xyes"; then
+   AC_DEFINE(ENABLE_LLVM_RUNTIME, 1, [Runtime support code for llvm enabled])
+fi
+AM_CONDITIONAL(ENABLE_LLVM_RUNTIME, [test x$enable_llvm_runtime = xyes])
+
 TARGET="unknown"
 ACCESS_UNALIGNED="yes"
 
@@ -2728,13 +2720,11 @@ XINERAMA="libXinerama.so.1"
 sizeof_register="SIZEOF_VOID_P"
 
 jit_wanted=true
-sgen_supported=false
 boehm_supported=true
 case "$host" in
        mips*)
                TARGET=MIPS;
                arch_target=mips;
-               sgen_supported=true
                ACCESS_UNALIGNED="no"
 
                AC_MSG_CHECKING(for mips n32)
@@ -2773,25 +2763,20 @@ case "$host" in
                        # foo.c:6: warning: visibility attribute not supported in this configuration; ignored
                        # ld: fatal: relocation error: R_386_GOTOFF: file /var/tmp//ccxYR96k.o: symbol astruct: relocation must bind locally
                        have_visibility_hidden=no
-                       sgen_supported=true
                        ;;
                  mingw*|cygwin*)
-                       sgen_supported=true
                        have_visibility_hidden=no                 
                        ;;
                  haiku*)
                        LIBC=libroot.so
                        ;;
                  linux*)
-                       sgen_supported=true
                        AOT_SUPPORTED="yes"
                        ;;
                  darwin*)
-                       sgen_supported=true
                        AOT_SUPPORTED="yes"
                        ;;
                  openbsd*|freebsd*|kfreebsd-gnu*)
-                       sgen_supported=true
                        ;;
                esac
                ;;
@@ -2804,18 +2789,14 @@ case "$host" in
                fi
                case $host_os in
                  linux*)
-                       sgen_supported=true
                        AOT_SUPPORTED="yes"
                        ;;
                  darwin*)
-                       sgen_supported=true
                        AOT_SUPPORTED="yes"
                        ;;
                  openbsd*|freebsd*|kfreebsd-gnu*)
-                       sgen_supported=true
                        ;;
                  mingw*)
-                       sgen_supported=true
                        ;;
                esac
                case "$host" in
@@ -2855,7 +2836,6 @@ case "$host" in
                if test x"$AR" = xfalse; then
                        AC_MSG_ERROR([The required utility 'ar' is not found in your PATH. Usually it can be found in /usr/ccs/bin.])
                fi
-               sgen_supported=true
                ;;
        *-mingw*|*-*-cygwin*)
                # When this is enabled, it leads to very strange crashes at runtime (gcc-3.4.4)
@@ -2875,22 +2855,27 @@ case "$host" in
                arch_target=ppc;
                case $host_os in
                  linux*|darwin*)
-                       sgen_supported=true
                        ;;
                esac
                ;;
+       armv7k-*-darwin*)
+               TARGET=ARM;
+               TARGET_SYS=WATCHOS
+               arch_target=arm;
+               ACCESS_UNALIGNED="no"
+               CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
+               ;;
+
        arm*-darwin*)
                TARGET=ARM;
                arch_target=arm;
                ACCESS_UNALIGNED="no"
                CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
-               sgen_supported=true
                ;;
        arm*-linux*)
                TARGET=ARM;
                arch_target=arm;
                ACCESS_UNALIGNED="no"
-               sgen_supported=true
                AOT_SUPPORTED="yes"
                CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                ;;
@@ -2899,21 +2884,18 @@ case "$host" in
 #              TARGET=ARM;
 #              arch_target=arm;
 #              ACCESS_UNALIGNED="no"
-#              sgen_supported=true
 #              AOT_SUPPORTED="no"
 #              ;;
        aarch64-*)
                # https://lkml.org/lkml/2012/7/15/133
                TARGET=ARM64
                arch_target=arm64
-               sgen_supported=true
                boehm_supported=false
                ;;
        s390x-*-linux*)
                TARGET=S390X;
                arch_target=s390x;
                ACCESS_UNALIGNED="yes"
-               sgen_supported=true
                CFLAGS="$CFLAGS -mbackchain -D__USE_STRING_INLINES"
                ;;
 esac
@@ -2932,6 +2914,11 @@ if test "x$host" != "x$target"; then
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
+               case "$target" in
+               armv7k-*)
+                       AC_DEFINE(TARGET_WATCHOS, 1, [...])
+                       ;;
+               esac            
                ;;
    powerpc64-ps3-linux-gnu)
                TARGET=POWERPC64
@@ -3012,7 +2999,6 @@ if test "x$host" != "x$target"; then
                AC_DEFINE(TARGET_X86, 1, [...])
                AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
-               sgen_supported=true
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h            
                with_tls=pthread
@@ -3024,7 +3010,6 @@ if test "x$host" != "x$target"; then
                AC_DEFINE(TARGET_AMD64, 1, [...])
                AC_DEFINE(TARGET_ANDROID, 1, [...])
                CPPFLAGS="$CPPFLAGS"
-               sgen_supported=true
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
@@ -3036,7 +3021,6 @@ if test "x$host" != "x$target"; then
                AC_DEFINE(TARGET_AMD64, 1, [...])
                AC_DEFINE(TARGET_PS4, 1, [...])
                CPPFLAGS="$CPPFLAGS"
-               sgen_supported=true
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
                with_tls=pthread
@@ -3149,7 +3133,12 @@ if test x$GCC = "xyes"; then
 fi
 
 if test "x$target_mach" = "xyes"; then
-   if test "x$TARGET" = "xARM" -o "x$TARGET" = "xARM64"; then
+
+   if test "x$TARGET_SYS" = "xWATCHOS"; then
+         AC_DEFINE(TARGET_WATCHOS,1,[The JIT/AOT targets WatchOS])
+         CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
+         CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
+   elif test "x$TARGET" = "xARM" -o "x$TARGET" = "xARM64"; then
          AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
          CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
          CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
@@ -3199,21 +3188,11 @@ fi
 dnl 
 dnl Simple Generational checks (sgen)
 dnl
-if $sgen_supported; then
-   build_sgen_default=yes
-else
-   build_sgen_default=no
-fi
 SGEN_DEFINES=
-AC_ARG_WITH(sgen, [  --with-sgen=yes,no             Extra Generational GC, default=yes],[buildsgen=$with_sgen],[buildsgen=$build_sgen_default])
+AC_ARG_WITH(sgen, [  --with-sgen=yes,no             Extra Generational GC, default=yes],[buildsgen=$with_sgen],[buildsgen=yes])
 if test x$buildsgen = xyes; then
-   if $sgen_supported; then
-       SGEN_DEFINES="-DHAVE_SGEN_GC -DHAVE_MOVING_COLLECTOR"
-       gc_msg="sgen and $gc_msg"
-   else
-       buildsgen=no
-       AC_MSG_WARN("Sgen is not supported on this platform")
-   fi
+   SGEN_DEFINES="-DHAVE_SGEN_GC -DHAVE_MOVING_COLLECTOR"
+   gc_msg="sgen and $gc_msg"
 fi
 AC_SUBST(SGEN_DEFINES)
 AM_CONDITIONAL(SUPPORT_SGEN, test x$buildsgen = xyes)
@@ -3359,7 +3338,7 @@ if test ${TARGET} = ARM; then
        fpu=NONE
 
        # iOS GCC always uses the 'softfp' ABI.
-       if test x"$GCC" = xyes && test x$platform_darwin = xyes; then
+       if test x"$GCC" = xyes && test x$host_darwin = xyes; then
                fpu=VFP
        fi
 
@@ -3493,10 +3472,12 @@ case "x$libgc" in
                ;;
 esac
 
-AC_ARG_WITH(profile4_x,[  --with-profile4=yes,no          If you want to install the 4.6 FX (defaults to yes)],                [], [with_profile4_x=yes])
-AC_ARG_WITH(monodroid, [  --with-monodroid=yes,no         If you want to build the MonoDroid assemblies (defaults to no)],     [], [with_monodroid=no])
-AC_ARG_WITH(monotouch, [  --with-monotouch=yes,no         If you want to build the Xamarin.iOS assemblies (defaults to no)],   [], [with_monotouch=no])
-AC_ARG_WITH(xammac,    [  --with-xammac=yes,no            If you want to build the Xamarin.Mac assemblies (defaults to no)],   [], [with_xammac=no])
+AC_ARG_WITH(profile4_x,      [  --with-profile4=yes,no          If you want to install the 4.6 FX (defaults to yes)],                 [], [with_profile4_x=yes])
+AC_ARG_WITH(monodroid,       [  --with-monodroid=yes,no         If you want to build the MonoDroid assemblies (defaults to no)],      [], [with_monodroid=no])
+AC_ARG_WITH(monotouch,       [  --with-monotouch=yes,no         If you want to build the Xamarin.iOS assemblies (defaults to no)],    [], [with_monotouch=no])
+AC_ARG_WITH(monotouch_watch, [  --with-monotouch_watch=yes,no   If you want to build the Xamarin.WatchOS assemblies (defaults to no)],[], [with_monotouch_watch=no])
+AC_ARG_WITH(monotouch_tv,    [  --with-monotouch_tv=yes,no      If you want to build the Xamarin.TVOS assemblies (defaults to no)],   [], [with_monotouch_tv=no])
+AC_ARG_WITH(xammac,          [  --with-xammac=yes,no            If you want to build the Xamarin.Mac assemblies (defaults to no)],    [], [with_xammac=no])
 
 OPROFILE=no
 AC_ARG_WITH(oprofile,[  --with-oprofile=no,<oprofile install dir>   Enable oprofile support (defaults to no)],[
@@ -3543,6 +3524,13 @@ AC_ARG_WITH(cooperative_gc, [  --with-cooperative-gc=yes|no      Enable cooperat
        fi
 ], [with_cooperative_gc=no])
 
+AC_ARG_WITH(checked_build, [  --with-checked-build=yes|no      Enable checked build (expensive asserts)) (defaults to no)],[
+       if test x$with_checked_build != xno ; then
+               AC_DEFINE(CHECKED_BUILD,1,[Enable checked build.])
+       fi
+], [with_checked_build=no])
+
+
 AC_CHECK_HEADER([malloc.h], 
                [AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1], 
                        [Define to 1 if you have /usr/include/malloc.h.])],,)
@@ -3576,6 +3564,8 @@ if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
    with_profile4_x=no
    with_monodroid=no
    with_monotouch=no
+   with_monotouch_watch=no
+   with_monotouch_tv=no
    with_xammac=no
 fi
 
@@ -3598,6 +3588,8 @@ libmono_ldflags="$libmono_ldflags $LIBS"
 AM_CONDITIONAL(INSTALL_4_x, [test "x$with_profile4_x" = xyes])
 AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
 AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" != "xno"])
+AM_CONDITIONAL(INSTALL_MONOTOUCH_WATCH, [test "x$with_monotouch_watch" != "xno"])
+AM_CONDITIONAL(INSTALL_MONOTOUCH_TV, [test "x$with_monotouch_tv" != "xno"])
 AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
 
 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
@@ -3832,6 +3824,7 @@ AC_CONFIG_COMMANDS([nolock-libtool], [sed -e 's/lock_old_archive_extraction=yes/
 AC_OUTPUT([
 Makefile
 mono-uninstalled.pc
+acceptance-tests/Makefile
 scripts/mono-find-provides
 scripts/mono-find-requires
 mono/Makefile
@@ -3915,7 +3908,7 @@ 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
+if test x$host_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
@@ -3964,7 +3957,7 @@ fi
 
     echo "MONO_VERSION = $myver" >> $mcs_topdir/build/config.make
 
-    if test x$platform_darwin = xyes; then
+    if test x$host_darwin = xyes; then
       echo "PLATFORM = darwin" >> $mcs_topdir/build/config.make
     fi
 
@@ -4012,13 +4005,15 @@ echo "
        LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
 
    Libraries:
-       .NET 4.6:      $with_profile4_x
-       MonoDroid:     $with_monodroid
-       MonoTouch:     $with_monotouch
-       Xamarin.Mac:   $with_xammac
-       JNI support:   $jdk_headers_found
-       libgdiplus:    $libgdiplus_msg
-       zlib:          $zlib_msg
+       .NET 4.6:        $with_profile4_x
+       Xamarin.Android: $with_monodroid
+       Xamarin.iOS:     $with_monotouch
+       Xamarin.WatchOS: $with_monotouch_watch
+       Xamarin.TVOS:    $with_monotouch_tv
+       Xamarin.Mac:     $with_xammac
+       JNI support:     $jdk_headers_found
+       libgdiplus:      $libgdiplus_msg
+       zlib:            $zlib_msg
        $disabled
 "
 if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then