From 4c4a204bee6620d073d3ccfb98166c5f22509dd9 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 22 Jan 2017 00:03:54 -0500 Subject: [PATCH] fix inclusion of auxv.h header and definition of TORRENT_ANDROID --- include/libtorrent/config.hpp | 3 +-- src/cpuid.cpp | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index ecac833a3..5283f8208 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -183,13 +183,12 @@ POSSIBILITY OF SUCH DAMAGE. // ===== ANDROID ===== (almost linux, sort of) #if defined __ANDROID__ -#define TORRENT_ANDROID 1 +#define TORRENT_ANDROID #define TORRENT_HAS_FALLOCATE 0 #define TORRENT_USE_ICONV 0 #define TORRENT_USE_IFADDRS 0 #define TORRENT_USE_MEMALIGN 1 #else // ANDROID -#define TORRENT_ANDROID 0 #define TORRENT_USE_IFADDRS 1 #define TORRENT_USE_POSIX_MEMALIGN 1 diff --git a/src/cpuid.cpp b/src/cpuid.cpp index a061609d1..6de1d1836 100644 --- a/src/cpuid.cpp +++ b/src/cpuid.cpp @@ -46,7 +46,16 @@ POSSIBILITY OF SUCH DAMAGE. #include // for std::memset #endif -#if TORRENT_HAS_ARM && TORRENT_HAS_ARM_NEON +#if defined __GLIBC__ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)) +#define TORRENT_HAS_AUXV 1 +#elif defined TORRENT_ANDROID +#define TORRENT_HAS_AUXV 1 +#else +#define TORRENT_HAS_AUXV 0 +#endif + + +#if TORRENT_HAS_ARM && TORRENT_HAS_AUXV #include #endif @@ -95,7 +104,7 @@ namespace libtorrent { namespace aux bool supports_arm_neon() { -#if TORRENT_HAS_ARM_NEON +#if TORRENT_HAS_ARM_NEON && TORRENT_HAS_AUXV #if defined __arm__ //return (getauxval(AT_HWCAP) & HWCAP_NEON); return (getauxval(16) & (1 << 12)); @@ -112,7 +121,7 @@ namespace libtorrent { namespace aux bool supports_arm_crc32c() { -#if TORRENT_HAS_ARM_CRC32 +#if TORRENT_HAS_ARM_CRC32 && TORRENT_HAS_AUXV #if defined TORRENT_FORCE_ARM_CRC32 return true; #elif defined __arm__