Support for libc variants without fseeko/ftello

Some older Android libc implementations don't support `fseeko` or `ftello`.
This commit adds a new compile-time macro `LIBC_NO_FSEEKO` as well as a usage in CMake for old Android APIs.
This commit is contained in:
Victor Zhang
2025-01-02 14:02:10 -08:00
parent f5d9d57fe6
commit 54c3d998a0
4 changed files with 25 additions and 3 deletions
+12
View File
@@ -82,8 +82,19 @@ else ()
add_definitions(-DZSTD_LEGACY_SUPPORT=0)
endif ()
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message("${_variableName}=${${_variableName}}")
endforeach()
if (ANDROID)
set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT OFF)
# Old versions of bionic libc don't have fseeko/ftello
if ((NOT ${ANDROID_PLATFORM_LEVEL}) OR ${ANDROID_PLATFORM_LEVEL} VERSION_LESS 24)
message("Hi Android SDK")
add_compile_definitions(LIBC_NO_FSEEKO)
endif ()
else()
set(ZSTD_MULTITHREAD_SUPPORT_DEFAULT ON)
endif()
@@ -153,6 +164,7 @@ if (ZSTD_BUILD_PROGRAMS)
elseif(NOT ZSTD_BUILD_SHARED AND ZSTD_PROGRAMS_LINK_SHARED)
message(SEND_ERROR "You need to build shared library to build zstd CLI")
endif ()
message("Building program")
add_subdirectory(programs)
endif ()