summaryrefslogtreecommitdiff
path: root/src/pal
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2018-01-16 05:20:41 +0100
committerJan Kotas <jkotas@microsoft.com>2018-01-15 20:20:41 -0800
commit8b8b3b95adada2a9cb2b00876c6d11ef3e4438f7 (patch)
tree4d41308dcda353c160327abc5cacccb120c5ffae /src/pal
parentd5818013f1dcf376932a6092afbcd8d5e7b0c40b (diff)
downloadcoreclr-8b8b3b95adada2a9cb2b00876c6d11ef3e4438f7.tar.gz
coreclr-8b8b3b95adada2a9cb2b00876c6d11ef3e4438f7.tar.bz2
coreclr-8b8b3b95adada2a9cb2b00876c6d11ef3e4438f7.zip
Fix Android build (#15868)
There were the following issues: * The current versions of packages available at the termux site were obsolete. * The libintl.h was removed from the Android SDK, so the dgettext and bindtextdomain are not available. But they were dummy implementations before anyways, so we can remove their usage on Android. * The detection of the ucol_setMaxVariable needs to be done using the check_cxx_symbol_exists instead of check_symbol_exists, since on Android, the ICU libraries now depend on C++ runtime. * The SIZE_T_MAX is already defined in Android headers, so the definition in cgroup.cpp was colliding with it. * The pthread_condattr_setclock detection was using pthread library, but on Android, it is located in the "c" library instead. So it was not being detected.
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/src/configure.cmake3
-rw-r--r--src/pal/src/locale/unicode.cpp18
2 files changed, 11 insertions, 10 deletions
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index 86b5d945b3..d1c7506375 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -38,6 +38,7 @@ check_include_files(sys/prctl.h HAVE_PRCTL_H)
check_include_files(numa.h HAVE_NUMA_H)
check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
check_include_files("sys/auxv.h;asm/hwcap.h" HAVE_AUXV_HWCAP_H)
+check_include_files("libintl.h" HAVE_LIBINTL_H)
if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(CMAKE_REQUIRED_FLAGS "-ldl")
@@ -421,7 +422,7 @@ int main()
exit(ret);
}" HAVE_CLOCK_MONOTONIC)
-check_library_exists(pthread pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK)
+check_library_exists(${PTHREAD_LIBRARY} pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK)
check_cxx_source_runs("
#include <stdlib.h>
diff --git a/src/pal/src/locale/unicode.cpp b/src/pal/src/locale/unicode.cpp
index 97d4731198..c9c1ae1c4d 100644
--- a/src/pal/src/locale/unicode.cpp
+++ b/src/pal/src/locale/unicode.cpp
@@ -37,9 +37,9 @@ Revision History:
#include <pthread.h>
#include <locale.h>
-#ifndef __APPLE__
+#if HAVE_LIBINTL_H
#include <libintl.h>
-#endif // __APPLE__
+#endif // HAVE_LIBINTL_H
#include <errno.h>
#if HAVE_COREFOUNDATION
#include <CoreFoundation/CoreFoundation.h>
@@ -915,7 +915,7 @@ BOOL
PALAPI
PAL_BindResources(IN LPCSTR lpDomain)
{
-#ifndef __APPLE__
+#if HAVE_LIBINTL_H
_ASSERTE(g_szCoreCLRPath != NULL);
char * coreCLRDirectoryPath;
PathCharString coreCLRDirectoryPathPS;
@@ -931,10 +931,10 @@ PAL_BindResources(IN LPCSTR lpDomain)
LPCSTR boundPath = bindtextdomain(lpDomain, coreCLRDirectoryPath);
return boundPath != NULL;
-#else // __APPLE__
- // UNIXTODO: Implement for OSX if necessary
+#else // HAVE_LIBINTL_H
+ // UNIXTODO: Implement for Unixes without libintl if necessary
return TRUE;
-#endif // __APPLE__
+#endif // HAVE_LIBINTL_H
}
/*++
@@ -955,16 +955,16 @@ PAL_GetResourceString(
IN int cchWideChar
)
{
-#ifndef __APPLE__
+#if HAVE_LIBINTL_H
// NOTE: dgettext returns the key if it fails to locate the appropriate
// resource. In our case, that will be the English string.
LPCSTR resourceString = dgettext(lpDomain, lpResourceStr);
-#else // __APPLE__
+#else // HAVE_LIBINTL_H
// UNIXTODO: Implement for OSX using the native localization API
// This is a temporary solution until we add the real native resource support.
LPCSTR resourceString = lpResourceStr;
-#endif // __APPLE__
+#endif // HAVE_LIBINTL_H
int length = strlen(resourceString);
return UTF8ToUnicode(lpResourceStr, length + 1, lpWideCharStr, cchWideChar, 0);