Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable fseeko in android before API 24 #691

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions include/share/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@
#endif
#endif
#else
#ifndef HAVE_FSEEKO
#define fseeko fseek
#define ftello ftell
#define FLAC__off_t long
#define FLAC__OFF_T_MAX LONG_MAX
#else
#define FLAC__off_t off_t
#define FLAC__OFF_T_MAX OFF_T_MAX
#endif
#endif



Expand Down