diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-04-22 01:45:19 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-04-22 02:31:37 +0900 |
commit | 92afac8f3346f050ff25ad15a640a6861f690427 (patch) | |
tree | 1ba61d9e20f8d876db8da836fe49a0b290265e3d | |
parent | cebf575de89e69809e9750ac0f6c5a5f3bcdec2c (diff) | |
download | ruby-92afac8f3346f050ff25ad15a640a6861f690427.tar.gz |
configure.ac: Automatically add -D__ANDROID_API=ver on Android
-rw-r--r-- | configure.ac | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index ba86deffbe..e16c3e44ed 100644 --- a/configure.ac +++ b/configure.ac @@ -414,6 +414,30 @@ AC_CHECK_PROG(PKG_CONFIG, pkg-config, [pkg-config], [], [], # checks for UNIX variants that set C preprocessor variables AC_USE_SYSTEM_EXTENSIONS +AC_MSG_CHECKING([whether it is Android]) +AC_TRY_COMPILE([ + @%:@ifdef __ANDROID__ + @%:@error android + @%:@endif +], [], +[AC_MSG_RESULT(no)], +[ + AC_MSG_RESULT(yes) + target_os=${target_os}-android + AC_MSG_CHECKING([for Android API version]) + AC_TRY_COMPILE([ + @%:@ifndef __ANDROID_API__ + @%:@error android + @%:@endif + ], [], + [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(CP, ['cp']) RMDIRS='$(top_srcdir)/tool/rmdirs' |