[mcs] Accept and ignore command line args supported by csc that we don't
[mono.git] / configure.ac
index 11dba9d461bd3538dd01532a969f1a74e5f63319..94160c5fe0ac02e69d33275fae2d3935b2b29735 100644 (file)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 #AC_PREREQ([2.62])
 
-AC_INIT(mono, [4.3.0],
+AC_INIT(mono, [4.3.3],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README.md])
@@ -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
 
@@ -413,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/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>
@@ -542,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 -Wno-constant-logical-operand"
                fi
 else
        # The Sun Forte compiler complains about inline functions that access static variables
@@ -727,7 +731,7 @@ 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, remoting,
-        security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying, shared_handles.],
+        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'"
@@ -739,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
 
@@ -901,11 +906,6 @@ if test "x$mono_feature_disable_sgen_copying" = "xyes"; then
        AC_MSG_NOTICE([Disabled major=copying support in SGEN.])
 fi
 
-if test "x$mono_feature_disable_shared_handles" = "xyes"; then
-       AC_DEFINE(DISABLE_SHARED_HANDLES, 1, [Disable inter-process shared handles])
-       AC_SUBST(DISABLE_SHARED_HANDLES)
-fi
-
 AC_ARG_ENABLE(executables, [  --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
 AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
 
@@ -976,7 +976,7 @@ AC_ARG_WITH(libgc,   [  --with-gc=included,none  Controls the Boehm GC config, d
 AC_ARG_ENABLE(boehm, [  --disable-boehm            Disable the Boehm GC.], support_boehm=$enableval,support_boehm=${support_boehm:-yes})
 AM_CONDITIONAL(SUPPORT_BOEHM, test x$support_boehm = xyes)
 
-AC_ARG_ENABLE(parallel-mark, [  --enable-parallel-mark     Enables GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
+AC_ARG_ENABLE(parallel-mark, [  --enable-parallel-mark     Enables Boehm GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
 if test x$enable_parallel_mark = xyes; then
        libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
 fi
@@ -1073,6 +1073,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
@@ -2072,6 +2078,7 @@ if test x$host_win32 = xno; then
        AC_CHECK_FUNCS(setpgid)
        AC_CHECK_FUNCS(system)
        AC_CHECK_FUNCS(fork execv execve)
+       AC_CHECK_FUNCS(accept4)
        AC_CHECK_SIZEOF(size_t)
        AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], , 
                [#include <sys/types.h>
@@ -2083,6 +2090,8 @@ if test x$host_win32 = xno; then
                 #include <unistd.h>])
        AC_CHECK_TYPES([suseconds_t], [AC_DEFINE(HAVE_SUSECONDS_T)], ,
                [#include <sys/time.h>])
+       AC_CHECK_TYPES([struct cmsghdr], [AC_DEFINE(HAVE_STRUCT_CMSGHDR)], ,
+               [#include <sys/socket.h>])
        AC_CHECK_TYPES([struct flock], [AC_DEFINE(HAVE_STRUCT_FLOCK)], ,
                [#include <unistd.h>
                 #include <fcntl.h>])
@@ -2442,15 +2451,6 @@ if test "x$ac_cv_have_dev_random" = "xno" \
 *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
 ***]])
 fi
-AC_MSG_CHECKING([if inter-process shared handles are requested])
-# Same as --enable-minimal=shared_handles
-AC_ARG_ENABLE(shared-handles, [  --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=no)
-AC_MSG_RESULT($try_shared_handles)
-if test "x$try_shared_handles" != "xyes"; then
-       AC_DEFINE(DISABLE_SHARED_HANDLES, 1, [Disable inter-process shared handles])
-       AC_SUBST(DISABLE_SHARED_HANDLES)
-fi
 
 AC_ARG_ENABLE(bcl-opt, [  --disable-bcl-opt    BCL is compiled with no optimizations (allows accurate BCL debugging)], test_bcl_opt=$enableval, test_bcl_opt=yes)
 
@@ -2568,6 +2568,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 **************
@@ -2575,6 +2582,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,)
 
@@ -2605,19 +2613,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"
 
@@ -2638,7 +2653,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 \
@@ -2646,6 +2661,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 \
@@ -2680,6 +2696,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"
 
@@ -2700,6 +2724,7 @@ case "$host" in
        mips*)
                TARGET=MIPS;
                arch_target=mips;
+               with_tls=pthread;
                ACCESS_UNALIGNED="no"
 
                AC_MSG_CHECKING(for mips n32)
@@ -2995,6 +3020,7 @@ if test "x$host" != "x$target"; then
                arch_target=amd64;
                AC_DEFINE(TARGET_AMD64, 1, [...])
                AC_DEFINE(TARGET_PS4, 1, [...])
+               AC_DEFINE(DISABLE_HW_TRAPS, 1, [...])
                CPPFLAGS="$CPPFLAGS"
                # Can't use tls, since it depends on the runtime detection of tls offsets
                # in mono-compiler.h
@@ -3166,7 +3192,8 @@ dnl
 SGEN_DEFINES=
 AC_ARG_WITH(sgen, [  --with-sgen=yes,no             Extra Generational GC, default=yes],[buildsgen=$with_sgen],[buildsgen=yes])
 if test x$buildsgen = xyes; then
-   SGEN_DEFINES="-DHAVE_SGEN_GC -DHAVE_MOVING_COLLECTOR"
+   AC_DEFINE(HAVE_MOVING_COLLECTOR, 1, [Moving collector])
+   SGEN_DEFINES="-DHAVE_SGEN_GC"
    gc_msg="sgen and $gc_msg"
 fi
 AC_SUBST(SGEN_DEFINES)
@@ -3451,6 +3478,8 @@ AC_ARG_WITH(profile4_x,      [  --with-profile4=yes,no          If you want to i
 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(bitcode,         [  --with-bitcode=yes,no           If bitcode is enabled (defaults to no)],                              [], [with_bitcode=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
@@ -3504,6 +3533,29 @@ AC_ARG_WITH(checked_build, [  --with-checked-build=yes|no      Enable checked bu
        fi
 ], [with_checked_build=no])
 
+if test x$with_checked_build != xno ; then
+       DISABLED_CHECKED_BUILD_TEST=none
+
+       AC_ARG_ENABLE(checked_build_test, [  --enable-checked-build-test=LIST      drop support for LIST checked build tests. LIST is a comma-separated list from: gc, metadata, thread.],
+       [
+               for feature in `echo "$enable_checked_build_test" | sed -e "s/,/ /g"`; do
+                       eval "mono_checked_build_test_disable_$feature='yes'"
+               done
+               DISABLED_CHECKED_BUILD_TEST=$enable_checked_build_test
+       ],[])
+
+       if test "x$mono_checked_build_test_disable_gc" = "xyes"; then
+               AC_DEFINE(DISABLE_CHECKED_BUILD_GC, 1, [Disable GC checked build])
+       fi
+
+       if test "x$mono_checked_build_test_disable_metadata" = "xyes"; then
+               AC_DEFINE(DISABLE_CHECKED_BUILD_METADATA, 1, [Disable metadata checked build])
+       fi
+
+       if test "x$mono_checked_build_test_disable_thread" = "xyes"; then
+               AC_DEFINE(DISABLE_CHECKED_BUILD_THREAD, 1, [Disable thread checked build])
+       fi
+fi
 
 AC_CHECK_HEADER([malloc.h], 
                [AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1], 
@@ -3539,6 +3591,7 @@ if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
    with_monodroid=no
    with_monotouch=no
    with_monotouch_watch=no
+   with_monotouch_tv=no
    with_xammac=no
 fi
 
@@ -3562,6 +3615,8 @@ 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(BITCODE, test "x$with_bitcode" = "xyes")
 AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
 
 AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
@@ -3591,12 +3646,15 @@ AC_SUBST(X11)
 AC_SUBST(GDKX11)
 AC_SUBST(GTKX11)
 AC_SUBST(XINERAMA)
-AC_DEFINE_UNQUOTED(ARCHITECTURE,"$arch_target",[The architecture this is running on])
+AC_DEFINE_UNQUOTED(MONO_ARCHITECTURE,"$arch_target",[The architecture this is running on])
 AC_SUBST(arch_target)
 AC_SUBST(CFLAGS)
 AC_SUBST(CPPFLAGS)
 AC_SUBST(LDFLAGS)
 
+#This must always be defined when building the runtime
+AC_DEFINE(MONO_INSIDE_RUNTIME,1, [Disable banned functions from being used by the runtime])
+
 mono_build_root=`pwd`
 AC_SUBST(mono_build_root)
 
@@ -3796,6 +3854,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
@@ -3977,9 +4036,10 @@ echo "
 
    Libraries:
        .NET 4.6:        $with_profile4_x
-       MonoDroid:       $with_monodroid
+       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