* configure.ac: Pass ANDROID_CFLAGS to ndk_INIT.
* cross/ndk-build/Makefile.in (NDK_BUILD_CFLAGS):
* cross/ndk-build/ndk-build-shared-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))):
($$(error Unsupported suffix):
* cross/ndk-build/ndk-build-static-library.mk
($(call objname,$(LOCAL_MODULE),$(basename $(1)))):
($$(error Unsupported suffix): Use NDK_BUILD_CFLAGS.
* m4/ndk-build.m4 (ndk_INIT): Accept cflags.
(ndk_CONFIG_FILES): Export NDK_BUILD_CFLAGS.
if test "$XCONFIGURE" = "android"; then
# Initialize the Android NDK build system. Make sure to use the
# passed through NDK path.
+ # Make sure to pass through the CFLAGS, as older versions of the
+ # NDK require them to be able to find system includes.
with_ndk_path="$android_ndk_path"
- ndk_INIT([$android_abi], [$ANDROID_SDK], [cross/ndk-build])
+ ndk_INIT([$android_abi], [$ANDROID_SDK], [cross/ndk-build],\
+ [$ANDROID_CFLAGS])
fi
case $host in
NDK_BUILD_CC = @NDK_BUILD_CC@
NDK_BUILD_AR = @NDK_BUILD_AR@
NDK_BUILD_NASM = @NDK_BUILD_NASM@
+ NDK_BUILD_CFLAGS = @NDK_BUILD_CFLAGS@
# This is a list of targets to build.
NDK_BUILD_MODULES = @NDK_BUILD_MODULES@
ifeq (x$(suffix $(1)),x.c)
$(call objname,$(LOCAL_MODULE),$(basename $(1))): $(LOCAL_PATH)/$(1)
- $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(call LOCAL_C_ADDITIONAL_FLAGS,$(1))
+ $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_BUILD_CFLAGS) $(call LOCAL_C_ADDITIONAL_FLAGS,$(1))
else
ifeq (x$(suffix $(1)),x.$(or $(LOCAL_CPP_EXTENSION),cpp))
$(call objname,$(LOCAL_MODULE),$(basename $(1))): $(LOCAL_PATH)/$(1)
- $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
+ $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_BUILD_CFLAGS) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
else
ifneq ($(or $(call eq,x$(suffix $(1)),x.s),$(call eq,x$(suffix $(1)),x.S)),)
ifeq (x$(suffix $(1)),x.cc)
$(call objname,$(LOCAL_MODULE),$(basename $(1))): $(LOCAL_PATH)/$(1)
- $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
+ $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_BUILD_CFLAGS) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
else
$$(error Unsupported suffix: $(suffix $(1)))
ifeq (x$(suffix $(1)),x.c)
$(call objname,$(LOCAL_MODULE),$(basename $(1))): $(LOCAL_PATH)/$(1)
- $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(call LOCAL_C_ADDITIONAL_FLAGS,$(1))
+ $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_BUILD_CFLAGS) $(NDK_CFLAGS_$(LOCAL_MODULE)) $(call LOCAL_C_ADDITIONAL_FLAGS,$(1))
else
ifeq (x$(suffix $(1)),x.$(or $(LOCAL_CPP_EXTENSION),cpp))
$(call objname,$(LOCAL_MODULE),$(basename $(1))): $(LOCAL_PATH)/$(1)
- $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
+ $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_BUILD_CFLAGS) $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
else
ifneq ($(or $(call eq,x$(suffix $(1)),x.s),$(call eq,x$(suffix $(1)),x.S)),)
ifeq (x$(suffix $(1)),x.cc)
$(call objname,$(LOCAL_MODULE),$(basename $(1))): $(LOCAL_PATH)/$(1)
- $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
+ $(NDK_BUILD_CC) -c $$< -o $$@ $(NDK_BUILD_CFLAGS) $(NDK_CFLAGS_$(LOCAL_MODULE)) $(NDK_CXXFLAGS_$(LOCAL_MODULE))
else
$$(error Unsupported suffix: $(suffix $(1)))
[AS_HELP_STRING([--with-ndk-cxx-shared],
[name of the C++ standard library included with the NDK])])
-# ndk_INIT(ABI, API, DIR)
-# --------
+# ndk_INIT(ABI, API, DIR, CFLAGS)
+# -------------------------------
# Initialize the Android NDK. ABI is the ABI being built for.
# API is the API version being built for.
+# CFLAGS is a list of compiler flags.
# As a side effect, set the variable ndk_INITIALIZED to true.
# DIR should be a directory containing the Makefile.in actually
# implementing the Android NDK build system.
ndk_API=$2
ndk_DIR=$3
ndk_ANY_CXX=
+ndk_BUILD_CFLAGS="$4"
case "$ndk_ABI" in
*arm64* )
NDK_BUILD_MODULES="$ndk_MODULES"
NDK_BUILD_CXX_SHARED="$ndk_CXX_SHARED"
NDK_BUILD_ANY_CXX_MODULE=$ndk_ANY_CXX
+ NDK_BUILD_CFLAGS="$ndk_BUILD_CFLAGS"
AC_SUBST([NDK_BUILD_ANDROID_MK])
AC_SUBST([NDK_BUILD_ARCH])
AC_SUBST([NDK_BUILD_MODULES])
AC_SUBST([NDK_BUILD_CXX_SHARED])
AC_SUBST([NDK_BUILD_ANY_CXX_MODULE])
+ AC_SUBST([NDK_BUILD_CFLAGS])
AC_CONFIG_FILES([$ndk_DIR/Makefile])
AC_CONFIG_FILES([$ndk_DIR/ndk-build.mk])