Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Carlier <frederik.carlier@quamotion.mobi>2017-02-07 21:37:15 +0300
committerStephen Toub <stoub@microsoft.com>2017-02-07 21:37:15 +0300
commitb5b0a77d2b77f40de96e0a185266adc51d5fe460 (patch)
treed63b5557e8f885f16be7675f1aa09729f56636ed
parentcfed28ccb666fdf99cf45600f03c826c133f6567 (diff)
Android - Support cross-compiling System.Native for Android (#15912)
* Last batch of fixes to get compilation to run on Android * Move the MNTOPT_RO definition inside HAVE_MNTINFO to avoid a unused identifier
-rw-r--r--src/Native/Unix/System.Native/CMakeLists.txt2
-rw-r--r--src/Native/Unix/System.Native/pal_mount.cpp5
-rw-r--r--src/Native/Unix/configure.cmake7
3 files changed, 13 insertions, 1 deletions
diff --git a/src/Native/Unix/System.Native/CMakeLists.txt b/src/Native/Unix/System.Native/CMakeLists.txt
index 2e8f87370b..256bd644e1 100644
--- a/src/Native/Unix/System.Native/CMakeLists.txt
+++ b/src/Native/Unix/System.Native/CMakeLists.txt
@@ -42,7 +42,7 @@ add_library(System.Native-Static
SET_TARGET_PROPERTIES(System.Native-Static PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(System.Native-Static PROPERTIES OUTPUT_NAME System.Native CLEAN_DIRECT_OUTPUT 1)
-if (CMAKE_SYSTEM_NAME STREQUAL Linux)
+if (CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_PLATFORM_ANDROID)
target_link_libraries(System.Native rt)
endif ()
diff --git a/src/Native/Unix/System.Native/pal_mount.cpp b/src/Native/Unix/System.Native/pal_mount.cpp
index 53b249af7f..ee62ba9e6e 100644
--- a/src/Native/Unix/System.Native/pal_mount.cpp
+++ b/src/Native/Unix/System.Native/pal_mount.cpp
@@ -16,6 +16,11 @@
#include <sys/statfs.h>
#include <mntent.h>
#define STRING_BUFFER_SIZE 8192
+
+// Android does not define MNTOPT_RO
+#ifndef MNTOPT_RO
+#define MNTOPT_RO "r"
+#endif
#endif
static int32_t GetMountInfo(MountPointFound onFound)
diff --git a/src/Native/Unix/configure.cmake b/src/Native/Unix/configure.cmake
index ef36d58d85..ac1f693594 100644
--- a/src/Native/Unix/configure.cmake
+++ b/src/Native/Unix/configure.cmake
@@ -294,6 +294,10 @@ set(HAVE_THREAD_SAFE_GETHOSTBYNAME_AND_GETHOSTBYADDR 0)
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CMAKE_REQUIRED_LIBRARIES rt)
set(HAVE_SUPPORT_FOR_DUAL_MODE_IPV4_PACKET_INFO 1)
+
+ if (CLR_CMAKE_PLATFORM_ANDROID)
+ set(HAVE_THREAD_SAFE_GETHOSTBYNAME_AND_GETHOSTBYADDR 1)
+ endif()
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(HAVE_THREAD_SAFE_GETHOSTBYNAME_AND_GETHOSTBYADDR 1)
endif ()
@@ -463,8 +467,11 @@ check_cxx_source_compiles(
HAVE_TCP_VAR_H
)
+# If sys/cdefs is not included on Android, this check will fail because
+# __BEGIN_DECLS is not defined
check_cxx_source_compiles(
"
+ #include <sys/cdefs.h>
#include <netinet/tcp.h>
int main() { int x = TCP_ESTABLISHED; return x; }
"