libc++: Initial Android support

WARNING: THIS DOES *NOT* BUILD PROPERLY FOR NOW.

This patch contains initial changes to support building for Android
with GCC 4.6 (at a minimum). This includes:

 - android/README explaining how to build this. Note that the
   library doesn't compile yet (working on it).

 - android/llvm-libc++/Android.mk containing module definitions
   for the static and shared library versions of libc++.

   Note that -std=c++11 is required when building the library,
   this means it requires GCC 4.6 at a minimum (forget about
   GCC 4.4.3).

 - android/test/, a small ndk-build project to build the library
   and link a trivial test program to it.

 - include/support/android/ directory, containing wrappers for
   system headers that don't always provide the features needed
   to build or use the library.

   Implementation files will go under src/support/android/...

 - include/__config changes to support GCC properly.

Change-Id: Ia0301386e871ae748c375ddc91f04756db82bec4
diff --git a/sources/cxx-stl/llvm-libc++/android/README b/sources/cxx-stl/llvm-libc++/android/README
new file mode 100644
index 0000000..c9c9042
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/android/README
@@ -0,0 +1,66 @@
+This directory contains support files to build libc++ with
+the Android NDK for ARM, x86 and MIPS.
+
+You need a recent NDK release, one which provides a version
+of the GAbi++ C++ runtime that supports rtti _and_ exceptions.
+
+Build instructions:
+
+  1/ Set NDK to the path of a recent Android NDK install path
+     (Use Android NDK r8c or above), e.g.:
+
+      NDK=$HOME/android/ndk-r8c
+
+  2/ From the top-level directory, do:
+
+      $NDK/ndk-build -C android/test
+
+     This is actually equivalent to:
+
+      cd android/test
+      $NDK/ndk-build
+
+  3/ To see build commands, use V=1, as in:
+
+      $NDK/ndk-build -C android/test V=1
+
+
+Android support files:
+
+  include/support/android:
+     Android system header wrappers, to add missing declarations
+
+  src/support/android:
+     Put the implementation of the missing system functions here.
+
+  android/llvm-libc++/Android.mk:
+     Main build file for the library. This builds one static and
+     one shared version of the library.
+
+     If modifications are not obvious, read $NDK/docs/ANDROID-MK.html
+     for a description of the Android.mk format.
+
+  android/test/jni:
+     NDK build project for two test programs that link against the
+     static and shared versions of the library.
+
+     See the Android.mk and Application.mk files in this directory
+     if you want to add new test files.
+
+
+Toolchain selection:
+  By default, ndk-build tries to build with GCC 4.6, however, experimental
+  versions of GCC 4.7 and Clang 3.1 are available with recent NDK releases.
+
+  Use the NDK_TOOLCHAIN_VERSION environment variable to switch to a
+  different one, valid examples:
+
+
+    export NDK_TOOLCHAIN_VERSION=4.6    # this is the default
+    $NDK/ndk-build -C android/test
+
+    # This is equivalent, but for GCC 4.7
+    $NDK/ndk-build -C android/test NDK_TOOLCHAIN_VERSION=4.7
+
+    # Also equivalent, but for Clang 3.1
+    NDK_TOOLCHAIN_VERSION=Clang3.1 $NDK/ndk-build -C android/test
diff --git a/sources/cxx-stl/llvm-libc++/android/llvm-libc++/Android.mk b/sources/cxx-stl/llvm-libc++/android/llvm-libc++/Android.mk
new file mode 100644
index 0000000..4e2448a
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/android/llvm-libc++/Android.mk
@@ -0,0 +1,53 @@
+LOCAL_PATH := $(call my-dir)/../..
+
+llvm_libc++_includes := $(LOCAL_PATH)/include $(LOCAL_PATH)/include/support/android
+llvm_libc++_export_includes := $(llvm_libc++_includes)
+llvm_libc++_sources := \
+	algorithm.cpp \
+	bind.cpp \
+	chrono.cpp \
+	condition_variable.cpp \
+	debug.cpp \
+	exception.cpp \
+	future.cpp \
+	hash.cpp \
+	ios.cpp \
+	iostream.cpp \
+	locale.cpp \
+	memory.cpp \
+	mutex.cpp \
+	new.cpp \
+	random.cpp \
+	regex.cpp \
+	stdexcept.cpp \
+	string.cpp \
+	strstream.cpp \
+	system_error.cpp \
+	thread.cpp \
+	typeinfo.cpp \
+	utility.cpp \
+	valarray.cpp
+
+llvm_libc++_sources := $(llvm_libc++_sources:%=src/%)
+llvm_libc++_cxxflags := -std=c++11
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := llvm_libc++_static
+LOCAL_SRC_FILES := $(llvm_libc++_sources)
+LOCAL_C_INCLUDES := $(llvm_libc++_includes)
+LOCAL_CPPFLAGS := $(llvm_libc++_cxxflags)
+LOCAL_EXPORT_C_INCLUDES := $(llvm_libc++_export_includes)
+LOCAL_EXPORT_STATIC_LIBRARIES := libgabi++_static
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := llvm_libc++_shared
+LOCAL_SRC_FILES := $(llvm_libc++_sources)
+LOCAL_C_INCLUDES := $(llvm_libc++_includes)
+LOCAL_CPPFLAGS := $(llvm_libc++_cxxflags)
+LOCAL_EXPORT_C_INCLUDES := $(llvm_libc++_export_includes)
+LOCAL_WHOLE_STATIC_LIBRARIES := libgabi++_static
+include $(BUILD_SHARED_LIBRARY)
+
+$(call import-module,cxx-stl/gabi++)
+
diff --git a/sources/cxx-stl/llvm-libc++/android/test/jni/Android.mk b/sources/cxx-stl/llvm-libc++/android/test/jni/Android.mk
new file mode 100644
index 0000000..4305c97
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/android/test/jni/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := test_1_shared
+LOCAL_SRC_FILES := test_1.cc
+LOCAL_SHARED_LIBRARIES := llvm_libc++_shared
+include $(BUILD_EXECUTABLE)
+
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := test_1_static
+LOCAL_SRC_FILES := test_1.cc
+LOCAL_SHARED_LIBRARIES := llvm_libc++_static
+include $(BUILD_EXECUTABLE)
+
+include $(LOCAL_PATH)/../../llvm-libc++/Android.mk
diff --git a/sources/cxx-stl/llvm-libc++/android/test/jni/Application.mk b/sources/cxx-stl/llvm-libc++/android/test/jni/Application.mk
new file mode 100644
index 0000000..a252a72
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/android/test/jni/Application.mk
@@ -0,0 +1 @@
+APP_ABI := all
diff --git a/sources/cxx-stl/llvm-libc++/android/test/jni/test_1.cc b/sources/cxx-stl/llvm-libc++/android/test/jni/test_1.cc
new file mode 100644
index 0000000..376997f
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/android/test/jni/test_1.cc
@@ -0,0 +1,6 @@
+#include <iostream>
+
+int main(void) {
+  std::cout << "Hello World\n" << std::endl;
+  return 0;
+}
diff --git a/sources/cxx-stl/llvm-libc++/include/__config b/sources/cxx-stl/llvm-libc++/include/__config
index 8617b86..9ad939d 100644
--- a/sources/cxx-stl/llvm-libc++/include/__config
+++ b/sources/cxx-stl/llvm-libc++/include/__config
@@ -331,6 +331,10 @@
 #define _LIBCPP_HAS_NO_STATIC_ASSERT
 #endif
 
+#if _GNUC_VER < 407
+#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#endif
+
 #if _GNUC_VER < 404
 #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
 #define _LIBCPP_HAS_NO_DECLTYPE
@@ -347,6 +351,10 @@
 
 #endif  // __GXX_EXPERIMENTAL_CXX0X__
 
+#if _GNUC_VER > 403
+#define _LIBCP_HAS_IS_BASE_OF
+#endif
+
 #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
 #define _LIBCPP_END_NAMESPACE_STD  } }
 #define _VSTD std::_LIBCPP_NAMESPACE
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/ctype.h b/sources/cxx-stl/llvm-libc++/include/support/android/ctype.h
new file mode 100644
index 0000000..830fb78
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/ctype.h
@@ -0,0 +1,29 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_CTYPE_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_CTYPE_H
+
+#include_next <ctype.h>
+#include <xlocale.h>
+
+extern "C" {
+
+# define __exctype_l(name)  extern int name (int, locale_t)
+
+__exctype_l (isalnum_l);
+__exctype_l (isalpha_l);
+__exctype_l (iscntrl_l);
+__exctype_l (isdigit_l);
+__exctype_l (islower_l);
+__exctype_l (isgraph_l);
+__exctype_l (isprint_l);
+__exctype_l (ispunct_l);
+__exctype_l (isspace_l);
+__exctype_l (isupper_l);
+__exctype_l (isxdigit_l);
+__exctype_l (isblank_l);
+
+int tolower_l(int c, locale_t);
+int toupper_l(int c, locale_t);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_CTYPE_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/langinfo.h b/sources/cxx-stl/llvm-libc++/include/support/android/langinfo.h
new file mode 100644
index 0000000..c3a6ebb
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/langinfo.h
@@ -0,0 +1,82 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_LANGINFO_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_LANGINFO_H
+
+#define _NL_ITEM(category,index)  (((category) << 10) | (index))
+
+#define _NL_ITEM_CATEGORY(nl)  ((nl) >> 10)
+#define _NL_ITEM_INDEX(nl)     ((nl) & 0x3ff)
+
+#define CODESET _NL_ITEM(LC_CTYPE, 0)
+
+/* Abbreviated days of the week */
+#define ABDAY_1 _NL_ITEM(LC_TIME,1)
+#define ABDAY_2 _NL_ITEM(LC_TIME,2)
+#define ABDAY_3 _NL_ITEM(LC_TIME,3)
+#define ABDAY_4 _NL_ITEM(LC_TIME,4)
+#define ABDAY_5 _NL_ITEM(LC_TIME,5)
+#define ABDAY_6 _NL_ITEM(LC_TIME,6)
+#define ABDAY_7 _NL_ITEM(LC_TIME,7)
+
+/* Long names of the week */
+#define DAY_1   _NL_ITEM(LC_TIME,11)
+#define DAY_2   _NL_ITEM(LC_TIME,12)
+#define DAY_3   _NL_ITEM(LC_TIME,13)
+#define DAY_4   _NL_ITEM(LC_TIME,14)
+#define DAY_5   _NL_ITEM(LC_TIME,15)
+#define DAY_6   _NL_ITEM(LC_TIME,16)
+#define DAY_7   _NL_ITEM(LC_TIME,17)
+
+/* Abbreviated month names */
+#define ABMON_1  _NL_ITEM(LC_TIME,21)
+#define ABMON_2  _NL_ITEM(LC_TIME,22)
+#define ABMON_3  _NL_ITEM(LC_TIME,23)
+#define ABMON_4  _NL_ITEM(LC_TIME,24)
+#define ABMON_5  _NL_ITEM(LC_TIME,25)
+#define ABMON_6  _NL_ITEM(LC_TIME,26)
+#define ABMON_7  _NL_ITEM(LC_TIME,27)
+#define ABMON_8  _NL_ITEM(LC_TIME,28)
+#define ABMON_9  _NL_ITEM(LC_TIME,29)
+#define ABMON_10 _NL_ITEM(LC_TIME,30)
+#define ABMON_11 _NL_ITEM(LC_TIME,31)
+#define ABMON_12 _NL_ITEM(LC_TIME,32)
+
+/* Long month names */
+#define MON_1    _NL_ITEM(LC_TIME,41)
+#define MON_2    _NL_ITEM(LC_TIME,42)
+#define MON_3    _NL_ITEM(LC_TIME,43)
+#define MON_4    _NL_ITEM(LC_TIME,44)
+#define MON_5    _NL_ITEM(LC_TIME,45)
+#define MON_6    _NL_ITEM(LC_TIME,46)
+#define MON_7    _NL_ITEM(LC_TIME,47)
+#define MON_8    _NL_ITEM(LC_TIME,48)
+#define MON_9    _NL_ITEM(LC_TIME,49)
+#define MON_10   _NL_ITEM(LC_TIME,50)
+#define MON_11   _NL_ITEM(LC_TIME,51)
+#define MON_12   _NL_ITEM(LC_TIME,52)
+
+#define AM_STR      _NL_ITEM(LC_TIME,53)
+#define PM_STR      _NL_ITEM(LC_TIME,54)
+#define D_T_FMT     _NL_ITEM(LC_TIME,55)
+#define D_FMT       _NL_ITEM(LC_TIME,56)
+#define T_FMT       _NL_ITEM(LC_TIME,57)
+#define T_FMT_AMPM  _NL_ITEM(LC_TIME,58)
+#define ERA         _NL_ITEM(LC_TIME,59)
+#define ERA_D_FMT   _NL_ITEM(LC_TIME,60)
+#define ERA_D_T_FMT _NL_ITEM(LC_TIME,61)
+#define ERA_T_FMT   _NL_ITEM(LC_TIME,62)
+#define ALT_DIGITS  _NL_ITEM(LC_TIME,70)
+
+#define INT_CURRENCY_SYMBOL     _NL_ITEM(LC_MONETARY,0)
+#define CURRENCY_SYMBOL         _NL_ITEM(LC_MONETARY,1)
+#define MON_DECIMAL_POINT       _NL_ITEM(LC_MONETARY,2)
+#define MON_THOUSANDS_SEP       _NL_ITEM(LC_MONETARY,3)
+#define MON_GROUPING            _NL_ITEM(LC_MONETARY,4)
+#define POSITIVE_SIGN           _NL_ITEM(LC_MONETARY,5)
+#define NEGATIVE_SIGN           _NL_ITEM(LC_MONETARY,6)
+#define INT_FRAC_DIGITS         _NL_ITEM(LC_MONETARY,7)
+#define FRAC_DIGITS             _NL_ITEM(LC_MONETARY,8)
+
+
+
+#endif  /* LLVM_LIBCXX_SUPPORT_ANDROID_LANGINFO_H */
+
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/locale.h b/sources/cxx-stl/llvm-libc++/include/support/android/locale.h
new file mode 100644
index 0000000..9270560
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/locale.h
Binary files differ
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/math.h b/sources/cxx-stl/llvm-libc++/include/support/android/math.h
new file mode 100644
index 0000000..ec5e566
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/math.h
@@ -0,0 +1,59 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_MATH_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_MATH_H
+
+#include_next <math.h>
+
+// TODO(digit): Check that this is not needed for Clang.
+typedef double      double_t;
+typedef double      float_t;
+
+// Missing long double functions. Note that 'long double' is the same
+// than 'double' on Android, so this will define stubs.
+#define LLVM_LIBCXX_LONG_DOUBLE_FUNCTIONS
+long double     acosl(long double);
+long double     asinl(long double);
+long double     atanl(long double);
+long double     atan2l(long double x, long double y);
+long double     cosl(long double);
+long double     coshl(long double);
+long double     expl(long double);
+long double     fmodl(long double, long double);
+long double     powl(long double, long double);
+long double     sinl(long double);
+long double     sinhl(long double);
+long double     sqrtl(long double);
+long double     tanl(long double);
+long double     tanhl(long double);
+long double     acoshl(long double);
+long double     asinhl(long double);
+long double     atanhl(long double);
+long double     cbrtl(long double);
+long double     erfl(long double);
+long double     erfcl(long double);
+long double     expm1l(long double);
+long double     hypotl(long double, long double);
+long double     lgammal(long double);
+long long int   llrintl(long double);
+long double     logl(long double);
+long double     log1pl(long double);
+long double     log2l(long double);
+long double     logbl(long double);
+long double     log10l(long double);
+long double     nanl(const char*);
+long double     nearbyintl(long double);
+long double     remainderl(long double, long double);
+long double     remquol(long double, long double, int*);
+long double     rintl(long double);
+long int        lrintl(long double);
+long double     tgammal(long double);
+long double     modfl(long double, long double*);
+long double     exp2l(long double);
+
+float           tgammaf(float);
+double          nan(const char*);
+float           nanf(const char*);
+
+float           log2f(float);
+double          log2(double);
+
+#endif  /* LLVM_LIBCXX_SUPPORT_ANDROID_MATH_H */
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/nl_types.h b/sources/cxx-stl/llvm-libc++/include/support/android/nl_types.h
new file mode 100644
index 0000000..46248c5
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/nl_types.h
@@ -0,0 +1,15 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_NL_TYPES_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_NL_TYPES_H
+
+#define NL_SETD 1
+#define NL_CAT_LOCALE 1
+
+typedef void* nl_catd;
+typedef int nl_item;
+
+nl_catd  catopen(const char*, int);
+char*    catgets(nl_catd, int, int, const char*);
+int      catclose(nl_catd);
+
+#endif  /* LLVM_LIBCXX_SUPPORT_ANDROID_NL_TYPES_H */
+
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/stdio.h b/sources/cxx-stl/llvm-libc++/include/support/android/stdio.h
new file mode 100644
index 0000000..8a2915b
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/stdio.h
@@ -0,0 +1,26 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_STDIO_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_STDIO_H
+
+// This is to avoid a compiler error when the putc() macro definition
+// in <stdio.h> follows a putc() function definition which is apparently
+// not compatible with it.
+#define _POSIX_THREADS 1
+#include_next <stdio.h>
+
+#include <stdarg.h>
+#include <xlocale.h>
+
+extern "C" {
+
+char* asprintf_l(char**, locale_t, const char*, ...);
+int sprintf_l(char*, locale_t, const char*, ...);
+int snprintf_l(char*, size_t, locale_t, const char*, ...);
+int sscanf_l(const char*, locale_t, const char*, ...);
+
+int vfwscanf(FILE*, const wchar_t*, va_list);
+int vswscanf(const wchar_t *, const wchar_t *, va_list);
+int vwscanf(const wchar_t *, va_list);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_STDIO_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/stdlib.h b/sources/cxx-stl/llvm-libc++/include/support/android/stdlib.h
new file mode 100644
index 0000000..bb01582
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/stdlib.h
@@ -0,0 +1,21 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_STDLIB_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_STDLIB_H
+
+#include_next <stdlib.h>
+#include <xlocale.h>
+
+extern "C" {
+
+long long   strtoll(const char*, char**, int);
+long double strtold(const char*, char**);
+void _Exit(int);
+
+long                 strtol_l(const char *nptr, char **endptr, int base, locale_t loc);
+long long            strtoll_l(const char *nptr, char **endptr, int base, locale_t loc);
+unsigned long        strtoul_l(const char *nptr, char **endptr, int base, locale_t loc);
+unsigned long long   strtoull_l(const char *nptr, char **endptr, int base, locale_t loc);
+long double          strtold_l (const char *nptr, char **endptr, locale_t loc);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_STDLIB_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/string.h b/sources/cxx-stl/llvm-libc++/include/support/android/string.h
new file mode 100644
index 0000000..d6b8500
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/string.h
@@ -0,0 +1,14 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_STRING_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_STRING_H
+
+#include_next <string.h>
+#include <xlocale.h>
+
+extern "C" {
+
+int strcoll_l(const char*, const char*, locale_t);
+int strxfrm_l(char*, const char*, size_t, locale_t);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_STRING_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/time.h b/sources/cxx-stl/llvm-libc++/include/support/android/time.h
new file mode 100644
index 0000000..2715b3e
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/time.h
@@ -0,0 +1,14 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_TIME_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_TIME_H
+
+#include_next <time.h>
+#include <xlocale.h>
+
+extern "C" {
+
+size_t strftime_l(char *s, size_t maxsize, const char *format,
+                  const struct tm * timeptr, locale_t locale);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_TIME_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/wchar.h b/sources/cxx-stl/llvm-libc++/include/support/android/wchar.h
new file mode 100644
index 0000000..8030876
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/wchar.h
@@ -0,0 +1,29 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_WCHAR_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_WCHAR_H
+
+#include_next <wchar.h>
+#include <xlocale.h>
+
+extern "C" {
+
+// Add missing declarations that are not in the NDK.
+float               wcstof(const wchar_t*, wchar_t**);
+long double         wcstold(const wchar_t*, wchar_t**);
+long long           wcstoll(const wchar_t*, wchar_t**);
+unsigned long long  wcstoull(const wchar_t*, wchar_t**);
+
+extern size_t wcsnrtombs (char *dst,
+                          const wchar_t **src,
+                          size_t nwc, size_t len,
+                          mbstate_t *ps);
+
+extern size_t mbsnrtowcs (wchar_t *dst,
+                          const char **src, size_t nmc,
+                          size_t len, mbstate_t *ps);
+
+int wcscoll_l(const wchar_t*, const wchar_t*, locale_t);
+int wcsxfrm_l(wchar_t*, const wchar_t*, size_t, locale_t);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_WCHAR_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/wctype.h b/sources/cxx-stl/llvm-libc++/include/support/android/wctype.h
new file mode 100644
index 0000000..7dd272f
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/wctype.h
@@ -0,0 +1,30 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_WCTYPES_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_WCTYPES_H
+
+#include_next <wctype.h>
+#include <xlocale.h>
+
+extern "C" {
+
+// Add missing declarations from the NDK header. Implemented under
+// src/android/wctype.cc
+
+int iswblank(wint_t c);
+
+int iswspace_l(wint_t, locale_t);
+int iswprint_l(wint_t, locale_t);
+int iswcntrl_l(wint_t, locale_t);
+int iswupper_l(wint_t, locale_t);
+int iswlower_l(wint_t, locale_t);
+int iswalpha_l(wint_t, locale_t);
+int iswdigit_l(wint_t, locale_t);
+int iswpunct_l(wint_t, locale_t);
+int iswxdigit_l(wint_t, locale_t);
+int iswblank_l(wint_t, locale_t);
+
+wint_t towlower_l(wint_t, locale_t);
+wint_t towupper_l(wint_t, locale_t);
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_WCTYPES_H
diff --git a/sources/cxx-stl/llvm-libc++/include/support/android/xlocale.h b/sources/cxx-stl/llvm-libc++/include/support/android/xlocale.h
new file mode 100644
index 0000000..23e2def
--- /dev/null
+++ b/sources/cxx-stl/llvm-libc++/include/support/android/xlocale.h
@@ -0,0 +1,14 @@
+#ifndef LLVM_LIBCXX_SUPPORT_ANDROID_XLOCALE_H
+#define LLVM_LIBCXX_SUPPORT_ANDROID_XLOCALE_H
+
+extern "C" {
+
+typedef struct locale_struct*  locale_t;
+
+struct locale_struct {
+    void* dummy;
+};
+
+}  // extern "C"
+
+#endif  // LLVM_LIBCXX_SUPPORT_ANDROID_XLOCALE_H