|
|
@@ -2967,7 +2967,7 @@ if test x$host_win32 = xno; then
|
|
|
fi
|
|
|
|
|
|
dnl *********************************
|
|
|
- dnl *** Checks for System.Native ***
|
|
|
+ dnl *** Checks for Mono.Native ***
|
|
|
dnl *********************************
|
|
|
|
|
|
AC_MSG_CHECKING(for linux/in.h)
|
|
|
@@ -4308,6 +4308,7 @@ if test "x$target_mach" = "xyes"; then
|
|
|
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
|
|
|
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
|
|
|
BTLS_SUPPORTED=no
|
|
|
+ target_ios=yes
|
|
|
else
|
|
|
AC_TRY_COMPILE([#include "TargetConditionals.h"],[
|
|
|
#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
|
|
|
@@ -5515,6 +5516,201 @@ if test x"$GCC" = xyes; then
|
|
|
])
|
|
|
fi
|
|
|
|
|
|
+#
|
|
|
+# Mono.Native Support
|
|
|
+# -------------------
|
|
|
+# Mono.Native is the new name for both System.Native and System.Security.Cryptography.Apple.
|
|
|
+# It is built as a stand-alone shared library and not bundled with the runtime because we
|
|
|
+# may need to build two different versions of it.
|
|
|
+#
|
|
|
+# Starting with macOS 10.12+ and iOS 10+, Apple introduced a new Unified API for some of the
|
|
|
+# crypto primitives that we're using as part of System.Security.Cryptography.Apple.
|
|
|
+#
|
|
|
+# On Desktop, we can check at runtime whether the OS version is recent enough and switch
|
|
|
+# implementation accordingly. We build a single `libmono_native` shared library.
|
|
|
+#
|
|
|
+# However, on Mobile we cannot have any undefined symbols as this would break Bitcode.
|
|
|
+#
|
|
|
+# During the mobile build, we are called with `CC` containing an explicit minium version flag,
|
|
|
+# which is eiter `-mmacosx-version-min=`, `-mios-simulator-version-min=` or `-miphoneos-version-min=`
|
|
|
+# depending on platform.
|
|
|
+#
|
|
|
+# We build two versions of the shared library:
|
|
|
+# - `libmono_native_compat` is built with whichever minimum version is passed to us via `CC`.
|
|
|
+# - `libmono_native_unifed` is built with the minimum version set to macOS 10.12+ / iOS 10+.
|
|
|
+#
|
|
|
+# For testing purpuses, there is a function called `mono_native_get_platform_type ()`
|
|
|
+# (see mono/native/mono-native-platform.c), which returns a `MonoNativePlatformType` enum value.
|
|
|
+# There is also `Mono.MonoNativePlatform.GetPlatformType ()` (see mcs/class/System/Mono/MonoNativePlatform.cs).
|
|
|
+#
|
|
|
+# This can be called by automated tests both to ensure that the library has been correctly installed and also
|
|
|
+# to verify that it's the correct version of it.
|
|
|
+#
|
|
|
+
|
|
|
+# `target_ios=yes` does not detect watch devices and fails when cross-compiling
|
|
|
+AC_MONO_APPLE_TARGET(TARGET_OS_IPHONE, [mono_native_platform_ios=yes])
|
|
|
+
|
|
|
+sed_version_pattern='[[0-9]]\{1,2\}\(\.[[0-9]]\{1,2\}\)'
|
|
|
+if test x$target_osx = xyes; then
|
|
|
+ sed_remove_mac_version_pattern="s/-mmacosx-version-min=$sed_version_pattern//g"
|
|
|
+ grep_find_mac_version_pattern="-mmacosx-version-min=$sed_version_pattern"
|
|
|
+ mono_native_compat_version=`echo $CC | grep -o -e $grep_find_mac_version_pattern`
|
|
|
+ MONO_NATIVE_CC=`echo $CC | sed -e $sed_remove_mac_version_pattern`
|
|
|
+ MONO_NATIVE_CXX=`echo $CXX | sed -e $sed_remove_mac_version_pattern`
|
|
|
+ MONO_NATIVE_CPPFLAGS=`echo $CPPFLAGS | sed -e $sed_remove_mac_version_pattern`
|
|
|
+ MONO_NATIVE_CFLAGS=`echo $CFLAGS | sed -e $sed_remove_mac_version_pattern`
|
|
|
+ MONO_NATIVE_CXXFLAGS=`echo $CXXFLAGS | sed -e $sed_remove_mac_version_pattern`
|
|
|
+ MONO_NATIVE_LDFLAGS=`echo $LDFLAGS | sed -e $sed_remove_mac_version_pattern`
|
|
|
+
|
|
|
+ mono_native=yes
|
|
|
+ MONO_NATIVE_PLATFORM=macos
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_MACOS"
|
|
|
+ AC_MSG_CHECKING([Mono.Native support])
|
|
|
+ AC_MSG_RESULT(macos)
|
|
|
+
|
|
|
+ AC_MONO_APPLE_AVAILABLE(mono_native_compat, [whether we need the compatibility layer],
|
|
|
+ [!(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12)])
|
|
|
+
|
|
|
+ if test x$mono_native_compat = xyes; then
|
|
|
+ mono_native_compat=yes
|
|
|
+ mono_native_text="Mac OSX (compat+unified)"
|
|
|
+ MONO_NATIVE_COMPAT_CFLAGS="$CFLAGS $mono_native_compat_version"
|
|
|
+ MONO_NATIVE_COMPAT_LDFLAGS="$LDFLAGS $mono_native_compat_version"
|
|
|
+ MONO_NATIVE_UNIFIED_CFLAGS="$MONO_NATIVE_CFLAGS -mmacosx-version-min=10.12"
|
|
|
+ MONO_NATIVE_UNIFIED_LDFLAGS="$MONO_NATIVE_LDFLAGS -mmacosx-version-min=10.12"
|
|
|
+ else
|
|
|
+ mono_native_compat=no
|
|
|
+ mono_native_text="Mac OSX"
|
|
|
+ fi
|
|
|
+elif test x$mono_native_platform_ios = xyes; then
|
|
|
+ AC_MONO_APPLE_TARGET(TARGET_OS_SIMULATOR, [mono_native_ios_sim=yes], [mono_native_ios_sim=no])
|
|
|
+
|
|
|
+ AC_MONO_APPLE_TARGET(TARGET_OS_IOS, [
|
|
|
+ if test x$mono_native_ios_sim = xyes; then
|
|
|
+ mono_native_ios_target=ios-simulator
|
|
|
+ mono_native_text="iOS Simulator"
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_IOS | MONO_NATIVE_PLATFORM_TYPE_IPHONE | MONO_NATIVE_PLATFORM_TYPE_SIMULATOR"
|
|
|
+ else
|
|
|
+ mono_native_ios_target=iphoneos
|
|
|
+ mono_native_text="iOS Device"
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_IOS | MONO_NATIVE_PLATFORM_TYPE_IPHONE | MONO_NATIVE_PLATFORM_TYPE_DEVICE"
|
|
|
+ fi
|
|
|
+ mono_native_unified_version="10.0"
|
|
|
+ mono_native_compat_check="__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0"
|
|
|
+ ], [
|
|
|
+ AC_MONO_APPLE_TARGET(TARGET_OS_TV, [
|
|
|
+ if test x$mono_native_ios_sim = xyes; then
|
|
|
+ mono_native_ios_target=tvos-simulator
|
|
|
+ mono_native_text="AppleTV Simulator"
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_IOS | MONO_NATIVE_PLATFORM_TYPE_TV | MONO_NATIVE_PLATFORM_TYPE_SIMULATOR"
|
|
|
+ else
|
|
|
+ mono_native_ios_target=tvos
|
|
|
+ mono_native_text="AppleTV Device"
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_IOS | MONO_NATIVE_PLATFORM_TYPE_TV | MONO_NATIVE_PLATFORM_TYPE_DEVICE"
|
|
|
+ fi
|
|
|
+ mono_native_unified_version="10.0"
|
|
|
+ mono_native_compat_check="__TV_OS_VERSION_MIN_REQUIRED >= __TVOS_10_0"
|
|
|
+ ], [
|
|
|
+ AC_MONO_APPLE_TARGET(TARGET_OS_WATCH, [
|
|
|
+ if test x$mono_native_ios_sim = xyes; then
|
|
|
+ mono_native_ios_target=watchos-simulator
|
|
|
+ mono_native_text="Apple Watch Simulator"
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_IOS | MONO_NATIVE_PLATFORM_TYPE_WATCH | MONO_NATIVE_PLATFORM_TYPE_SIMULATOR"
|
|
|
+ else
|
|
|
+ mono_native_ios_target=watchos
|
|
|
+ mono_native_text="Apple Watch Device"
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_IOS | MONO_NATIVE_PLATFORM_TYPE_WATCH | MONO_NATIVE_PLATFORM_TYPE_DEVICE"
|
|
|
+ fi
|
|
|
+ mono_native_unified_version="5.0"
|
|
|
+ mono_native_compat_check="__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_5_0"
|
|
|
+ ], [
|
|
|
+ AC_MSG_ERROR([Unknown iOS Target])
|
|
|
+ ])
|
|
|
+ ])
|
|
|
+ ])
|
|
|
+
|
|
|
+ AC_MSG_CHECKING([Mono.Native support])
|
|
|
+ AC_MSG_RESULT([$mono_native_ios_target])
|
|
|
+
|
|
|
+ AC_MONO_APPLE_AVAILABLE(mono_native_compat, [whether we need the compatibility layer], [!($mono_native_compat_check)])
|
|
|
+
|
|
|
+ sed_remove_ios_version_pattern="s/-m\(.*\)-version-min=$sed_version_pattern//g"
|
|
|
+ grep_find_ios_version_pattern="-m$mono_native_ios_target-version-min=$sed_version_pattern"
|
|
|
+
|
|
|
+ mono_native_compat_version=`echo $CC | grep -o -e $grep_find_ios_version_pattern`
|
|
|
+
|
|
|
+ mono_native_ldflags="-framework CoreFoundation -framework Foundation -no-undefined -fatal_warnings"
|
|
|
+ MONO_NATIVE_CC=`echo $CC | sed -e $sed_remove_ios_version_pattern`
|
|
|
+ MONO_NATIVE_CXX=`echo $CXX | sed -e $sed_remove_ios_version_pattern`
|
|
|
+ MONO_NATIVE_CPPFLAGS=`echo $CPPFLAGS | sed -e $sed_remove_ios_version_pattern`
|
|
|
+ MONO_NATIVE_CXXFLAGS=`echo $CXXFLAGS | sed -e $sed_remove_ios_version_pattern`
|
|
|
+ MONO_NATIVE_CFLAGS=`echo $CFLAGS | sed -e $sed_remove_ios_version_pattern`
|
|
|
+ MONO_NATIVE_LDFLAGS=`echo $LDFLAGS $mono_native_ldflags | sed -e $sed_remove_ios_version_pattern`
|
|
|
+
|
|
|
+ if test x$mono_native_compat = xyes; then
|
|
|
+ mono_native_text="$mono_native_text (compat+unified)"
|
|
|
+ MONO_NATIVE_COMPAT_CFLAGS="$CFLAGS $mono_native_compat_version"
|
|
|
+ MONO_NATIVE_COMPAT_LDFLAGS="$LDFLAGS $mono_native_compat_version"
|
|
|
+ MONO_NATIVE_UNIFIED_CFLAGS="$MONO_NATIVE_CFLAGS -m$mono_native_ios_target-version-min=$mono_native_unified_version"
|
|
|
+ MONO_NATIVE_UNIFIED_LDFLAGS="$MONO_NATIVE_LDFLAGS -m$mono_native_ios_target-version-min=$mono_native_unified_version"
|
|
|
+ fi
|
|
|
+
|
|
|
+ mono_native=yes
|
|
|
+ MONO_NATIVE_PLATFORM=ios
|
|
|
+elif test x$host_linux = xyes; then
|
|
|
+ mono_native_text="Linux"
|
|
|
+ MONO_NATIVE_CC=$CC
|
|
|
+ MONO_NATIVE_CXX=$CXX
|
|
|
+ MONO_NATIVE_CPPFLAGS=$CPPFLAGS
|
|
|
+ MONO_NATIVE_CXXFLAGS=$CXXFLAGS
|
|
|
+ MONO_NATIVE_CFLAGS=$CFLAGS
|
|
|
+ MONO_NATIVE_LDFLAGS=$LDFLAGS
|
|
|
+
|
|
|
+ mono_native=yes
|
|
|
+ mono_native_compat=no
|
|
|
+ MONO_NATIVE_PLATFORM=linux
|
|
|
+ AC_MSG_CHECKING([Mono.Native support])
|
|
|
+ AC_MSG_RESULT(linux)
|
|
|
+
|
|
|
+ MONO_NATIVE_PLATFORM_TYPE="MONO_NATIVE_PLATFORM_TYPE_LINUX"
|
|
|
+else
|
|
|
+ mono_native=no
|
|
|
+ mono_native_text="no"
|
|
|
+ AC_MSG_CHECKING([Mono.Native support])
|
|
|
+ AC_MSG_RESULT(no)
|
|
|
+fi
|
|
|
+
|
|
|
+if test x$mono_native_compat = xyes; then
|
|
|
+ MONO_NATIVE_LIBRARY_NAME=libmono-native-compat
|
|
|
+else
|
|
|
+ MONO_NATIVE_LIBRARY_NAME=libmono-native
|
|
|
+fi
|
|
|
+
|
|
|
+AC_SUBST(MONO_NATIVE_PLATFORM)
|
|
|
+AC_SUBST(MONO_NATIVE_CC)
|
|
|
+AC_SUBST(MONO_NATIVE_CXX)
|
|
|
+AC_SUBST(MONO_NATIVE_CPPFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_CXXFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_CFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_COMPAT_CFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_UNIFIED_CFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_LDFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_COMPAT_LDFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_UNIFIED_LDFLAGS)
|
|
|
+AC_SUBST(MONO_NATIVE_LIBRARY_NAME)
|
|
|
+
|
|
|
+AM_CONDITIONAL(MONO_NATIVE, test x$mono_native = xyes)
|
|
|
+AM_CONDITIONAL(MONO_NATIVE_COMPAT, test x$mono_native_compat = xyes)
|
|
|
+AM_CONDITIONAL(MONO_NATIVE_PLATFORM_MACOS, test x$MONO_NATIVE_PLATFORM = xmacos)
|
|
|
+AM_CONDITIONAL(MONO_NATIVE_PLATFORM_IOS, test x$MONO_NATIVE_PLATFORM = xios)
|
|
|
+AM_CONDITIONAL(MONO_NATIVE_PLATFORM_LINUX, test x$MONO_NATIVE_PLATFORM = xlinux)
|
|
|
+
|
|
|
+MONO_NATIVE_PLATFORM_TYPE_COMPAT="$MONO_NATIVE_PLATFORM_TYPE | MONO_NATIVE_PLATFORM_TYPE_COMPAT"
|
|
|
+MONO_NATIVE_PLATFORM_TYPE_UNIFIED="$MONO_NATIVE_PLATFORM_TYPE | MONO_NATIVE_PLATFORM_TYPE_UNIFIED"
|
|
|
+AC_SUBST(MONO_NATIVE_PLATFORM_TYPE)
|
|
|
+AC_SUBST(MONO_NATIVE_PLATFORM_TYPE_COMPAT)
|
|
|
+AC_SUBST(MONO_NATIVE_PLATFORM_TYPE_UNIFIED)
|
|
|
+
|
|
|
# Update all submodules recursively to ensure everything is checked out
|
|
|
(cd $srcdir && scripts/update_submodules.sh)
|
|
|
|
|
|
@@ -5528,6 +5724,7 @@ scripts/mono-find-requires
|
|
|
mk/Makefile
|
|
|
mono/Makefile
|
|
|
mono/btls/Makefile
|
|
|
+mono/native/Makefile
|
|
|
mono/utils/Makefile
|
|
|
mono/utils/jemalloc/Makefile
|
|
|
mono/metadata/Makefile
|
|
|
@@ -5543,6 +5740,9 @@ mono/arch/arm/Makefile
|
|
|
mono/arch/arm64/Makefile
|
|
|
mono/arch/mips/Makefile
|
|
|
mono/sgen/Makefile
|
|
|
+mono/native/platform-type.c
|
|
|
+mono/native/platform-type-compat.c
|
|
|
+mono/native/platform-type-unified.c
|
|
|
mono/tests/Makefile
|
|
|
mono/tests/assembly-load-reference/Makefile
|
|
|
mono/tests/tests-config
|
|
|
@@ -5724,6 +5924,21 @@ fi
|
|
|
echo "HAVE_BTLS=1" >> $srcdir/$mcsdir/build/config.make
|
|
|
fi
|
|
|
|
|
|
+ if test "x$mono_native" = "xyes"; then
|
|
|
+ echo "MONO_NATIVE_SUPPORTED=true" >> $srcdir/$mcsdir/build/config.make
|
|
|
+ else
|
|
|
+ echo "MONO_NATIVE_SUPPORTED=false" >> $srcdir/$mcsdir/build/config.make
|
|
|
+ fi
|
|
|
+
|
|
|
+ if test x$mono_native_compat = xyes; then
|
|
|
+ echo "MONO_NATIVE_USING_COMPAT=true" >> $srcdir/$mcsdir/build/config.make
|
|
|
+ else
|
|
|
+ echo "MONO_NATIVE_USING_COMPAT=false" >> $srcdir/$mcsdir/build/config.make
|
|
|
+ fi
|
|
|
+
|
|
|
+ echo "MONO_NATIVE_PLATFORM_TYPE=$MONO_NATIVE_PLATFORM_TYPE" >> $srcdir/$mcsdir/build/config.make
|
|
|
+ echo "MONO_NATIVE_PLATFORM=$MONO_NATIVE_PLATFORM" >> $srcdir/$mcsdir/build/config.make
|
|
|
+
|
|
|
fi
|
|
|
|
|
|
)
|
|
|
@@ -5766,6 +5981,7 @@ echo "
|
|
|
DTrace: $enable_dtrace
|
|
|
LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm, built in-tree: $internal_llvm, assertions: $enable_llvm_asserts)
|
|
|
Spectre: $spectre_mitigation_status
|
|
|
+ Mono.Native: $mono_native_text
|
|
|
|
|
|
Libraries:
|
|
|
.NET 4.x: $with_profile4_x
|