aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@ycbcr.xyz>2024-04-22 12:03:33 +0200
committerMartijn van Beurden <mvanb1@gmail.com>2024-04-22 14:37:41 +0200
commit49ab34dfefec4e964e7e32164be6c6acee0c51ab (patch)
treeefedf9b52b72d0199bb4a4c6ec2f1d8fede56dc0
parent9977bb5b77eacab80c646d7f970d6a194abbc536 (diff)
downloadflac-49ab34dfefec4e964e7e32164be6c6acee0c51ab.tar.gz
[CMake] disable fseeko on 32-bit Android before API 24
It can be linked in the NDK so check_function_exists detects it. But it's only supporting _FILE_OFFSET_BITS=64 since Android API 24 [1]. With NDK 26 it's no longer possible to build assuming the API is always available. [1] https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
-rw-r--r--CMakeLists.txt10
1 files changed, 9 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5823a33c..e7407c67 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,7 +125,15 @@ else()
check_include_file("x86intrin.h" FLAC__HAS_X86INTRIN)
endif()
-check_function_exists(fseeko HAVE_FSEEKO)
+
+if(ANDROID AND CMAKE_SYSTEM_VERSION VERSION_LESS 24 AND (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a"))
+ # fseeko/ftello may link, but it's not usable before Android API 24 on 32-bit Android
+ # https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
+ message(STATUS "Disabling fseeko/ftello for 32-bit Android before API 24")
+ set(HAVE_FSEEKO 0 CACHE INTERNAL "")
+else()
+ check_function_exists(fseeko HAVE_FSEEKO)
+endif()
check_c_source_compiles("int main() { return __builtin_bswap16 (0) ; }" HAVE_BSWAP16)
check_c_source_compiles("int main() { return __builtin_bswap32 (0) ; }" HAVE_BSWAP32)