1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

configure.ac: Make it possible to build on Android Termux

The recent Termux's clang predefines `__ANDROID_API__` as a fixed number
24. However, when it is lower to the current device version, some
functions that "configure" detemines available are not declared
correctly in the header files.

This change forces to overwrite the predefined `__ANDROID_API__` macro
with the current device version.

ref: https://github.com/termux/termux-packages/issues/6176
This commit is contained in:
Yusuke Endoh 2020-12-25 00:06:16 +09:00
parent 81562f943e
commit c64a067d05

View file

@ -458,17 +458,10 @@ AC_TRY_COMPILE([
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
target_os=${target_os}-android target_os=${target_os}-android
AC_MSG_CHECKING([for Android API version]) AC_MSG_CHECKING([for Android API version])
AC_TRY_COMPILE([ # hacky workaround: https://github.com/termux/termux-packages/issues/6176
@%:@ifndef __ANDROID_API__ rb_android_api=`getprop ro.build.version.sdk`
@%:@error android AC_MSG_RESULT($rb_android_api)
@%:@endif RUBY_APPEND_OPTIONS(CPPFLAGS, -D__ANDROID_API__=$rb_android_api -Wno-macro-redefined)
], [],
[AC_MSG_RESULT(defined by the compiler)],
[
rb_android_api=`getprop ro.build.version.sdk`
AC_MSG_RESULT($rb_android_api)
RUBY_APPEND_OPTIONS(CPPFLAGS, -D__ANDROID_API__=$rb_android_api)
])
]) ])
AC_SUBST(RM, ['rm -f']) AC_SUBST(RM, ['rm -f'])