android_fseek.diff 1.3 KB

123456789101112131415161718192021222324252627
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 9396130dcc..0b09f40509 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -122,14 +122,17 @@ else()
  6. endif()
  7. -if(ANDROID AND CMAKE_SYSTEM_VERSION VERSION_LESS 24 AND (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a"))
  8. +if(ANDROID AND CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|i686")
  9. # fseeko/ftello may link, but it's not usable before Android API 24 on 32-bit Android
  10. # https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
  11. - message(STATUS "Disabling fseeko/ftello for 32-bit Android before API 24")
  12. - set(HAVE_FSEEKO 0 CACHE INTERNAL "")
  13. -else()
  14. - check_function_exists(fseeko HAVE_FSEEKO)
  15. + # The API level can be in different variables, subject to actual toolchain.
  16. + string(REPLACE "android-" "" api_level "${ANDROID_PLATFORM}")
  17. + if(NOT (CMAKE_SYSTEM_VERSION GREATER_EQUAL "24" OR api_level GREATER_EQUAL "24"))
  18. + message(STATUS "Disabling fseeko/ftello for 32-bit Android before API 24")
  19. + set(HAVE_FSEEKO 0 CACHE INTERNAL "")
  20. + endif()
  21. endif()
  22. +check_function_exists(fseeko HAVE_FSEEKO)
  23. check_c_source_compiles("int main() { return __builtin_bswap16 (0) ; }" HAVE_BSWAP16)
  24. check_c_source_compiles("int main() { return __builtin_bswap32 (0) ; }" HAVE_BSWAP32)