[mpg123-devel] [PATCH v2] fix lfs_alias_t type for Android
Brought to you by:
sobukus
From: <mp...@yc...> - 2020-06-10 14:24:50
|
From: Steve Lhomme <robux4@ycbcr.xyz> --- configure.ac | 20 ++++++++++++++++++++ ports/cmake/src/CMakeLists.txt | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/configure.ac b/configure.ac index c494221..4fc0e36 100644 --- a/configure.ac +++ b/configure.ac @@ -159,6 +159,7 @@ fi dnl We need the windows header also for checking the module mechanism. AC_CHECK_HEADERS([windows.h]) +android_build=no case "$host" in *-*-mingw*) win32=yes @@ -180,6 +181,21 @@ case "$host" in AC_DEFINE( [WINDOWS_UWP], 1, [Windows UWP build] ) fi ;; + linux*) + dnl Android is linux, but a bit different + AC_MSG_CHECKING([for an Android system]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM( + [[#ifndef __ANDROID__ + # error Not Android + #endif + ]],[[;]]) + ],[ + android_build=yes + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + ]) + ;; *) win32=no ;; @@ -1158,6 +1174,7 @@ AC_CHECK_TYPE(uint16_t, unsigned short) AC_CHECK_SIZEOF(size_t,4) AC_CHECK_SIZEOF(ssize_t,4) AC_CHECK_SIZEOF(off_t,4) +AC_CHECK_SIZEOF(off64_t,8) AC_CHECK_SIZEOF(int32_t) AC_CHECK_SIZEOF(long,4) @@ -1167,6 +1184,9 @@ dnl but it is actual plain off_t if the system does not have such switches. if test "x$largefile_sensitive" = xyes; then lfs_alias_type=long lfs_alias_size=$ac_cv_sizeof_long +elif test "x$android_build" = xyes; then + lfs_alias_type=off64_t + lfs_alias_size=$ac_cv_sizeof_off64_t else lfs_alias_type=off_t lfs_alias_size=$ac_cv_sizeof_off_t diff --git a/ports/cmake/src/CMakeLists.txt b/ports/cmake/src/CMakeLists.txt index 7ea2282..4b7b931 100644 --- a/ports/cmake/src/CMakeLists.txt +++ b/ports/cmake/src/CMakeLists.txt @@ -109,6 +109,10 @@ check_type_size(off_t SIZEOF_OFF_T) if(LFS_SENSITIVE) set(LFS_ALIAS_TYPE long) math(EXPR LFS_ALIAS_BITS "${SIZEOF_LONG} * 8") +elseif(CMAKE_ANDROID_ARCH_ABI) + check_type_size(off64_t SIZEOF_OFF64_T) + set(LFS_ALIAS_TYPE off64_t) + math(EXPR LFS_ALIAS_BITS "${SIZEOF_OFF64_T} * 8") else() set(LFS_ALIAS_TYPE off_t) math(EXPR LFS_ALIAS_BITS "${SIZEOF_OFF_T} * 8") -- 2.26.2 |