[前][次][番号順一覧][スレッド一覧]

ruby-changes:64571

From: Yusuke <ko1@a...>
Date: Fri, 25 Dec 2020 00:14:49 +0900 (JST)
Subject: [ruby-changes:64571] c64a067d05 (master): configure.ac: Make it possible to build on Android Termux

https://git.ruby-lang.org/ruby.git/commit/?id=c64a067d05

From c64a067d0569a0aa20ff325c800c1cd74977313c Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Fri, 25 Dec 2020 00:06:16 +0900
Subject: 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

diff --git a/configure.ac b/configure.ac
index c3157ff..ebbe24a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -458,17 +458,10 @@ AC_TRY_COMPILE([ https://github.com/ruby/ruby/blob/trunk/configure.ac#L458
 	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)
-	])
+        # hacky workaround: https://github.com/termux/termux-packages/issues/6176
+        rb_android_api=`getprop ro.build.version.sdk`
+        AC_MSG_RESULT($rb_android_api)
+        RUBY_APPEND_OPTIONS(CPPFLAGS, -D__ANDROID_API__=$rb_android_api -Wno-macro-redefined)
 ])
 
 AC_SUBST(RM, ['rm -f'])
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]