Define __ANDROID_API__ when building for the NDK.
Traditionally this has come from android/api-level.h, but with the
libc headers unified it must be set by the build system since we don't
have per-API level copies of that header now.
Test: make checkbuild with other libc ndk_library patches
Change-Id: Idf6cbba131f065b048b1b412e992c55e3d17e701
diff --git a/core/binary.mk b/core/binary.mk
index 08a2102..5750928 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -99,6 +99,11 @@
$(shell if [ $(LOCAL_SDK_VERSION) -lt $(my_min_sdk_version) ]; then \
echo $(my_min_sdk_version); else echo $(LOCAL_SDK_VERSION); fi)
+ # Traditionally this has come from android/api-level.h, but with the libc
+ # headers unified it must be set by the build system since we don't have
+ # per-API level copies of that header now.
+ my_cflags += -D__ANDROID_API__=$(my_ndk_api)
+
my_ndk_source_root := \
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
my_ndk_sysroot := \