fix inclusion of auxv.h header and definition of TORRENT_ANDROID

This commit is contained in:
arvidn 2017-01-22 00:03:54 -05:00 committed by Arvid Norberg
parent c15a575e34
commit 4c4a204bee
2 changed files with 13 additions and 5 deletions

View File

@ -183,13 +183,12 @@ POSSIBILITY OF SUCH DAMAGE.
// ===== ANDROID ===== (almost linux, sort of) // ===== ANDROID ===== (almost linux, sort of)
#if defined __ANDROID__ #if defined __ANDROID__
#define TORRENT_ANDROID 1 #define TORRENT_ANDROID
#define TORRENT_HAS_FALLOCATE 0 #define TORRENT_HAS_FALLOCATE 0
#define TORRENT_USE_ICONV 0 #define TORRENT_USE_ICONV 0
#define TORRENT_USE_IFADDRS 0 #define TORRENT_USE_IFADDRS 0
#define TORRENT_USE_MEMALIGN 1 #define TORRENT_USE_MEMALIGN 1
#else // ANDROID #else // ANDROID
#define TORRENT_ANDROID 0
#define TORRENT_USE_IFADDRS 1 #define TORRENT_USE_IFADDRS 1
#define TORRENT_USE_POSIX_MEMALIGN 1 #define TORRENT_USE_POSIX_MEMALIGN 1

View File

@ -46,7 +46,16 @@ POSSIBILITY OF SUCH DAMAGE.
#include <cstring> // for std::memset #include <cstring> // for std::memset
#endif #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 <sys/auxv.h> #include <sys/auxv.h>
#endif #endif
@ -95,7 +104,7 @@ namespace libtorrent { namespace aux
bool supports_arm_neon() bool supports_arm_neon()
{ {
#if TORRENT_HAS_ARM_NEON #if TORRENT_HAS_ARM_NEON && TORRENT_HAS_AUXV
#if defined __arm__ #if defined __arm__
//return (getauxval(AT_HWCAP) & HWCAP_NEON); //return (getauxval(AT_HWCAP) & HWCAP_NEON);
return (getauxval(16) & (1 << 12)); return (getauxval(16) & (1 << 12));
@ -112,7 +121,7 @@ namespace libtorrent { namespace aux
bool supports_arm_crc32c() bool supports_arm_crc32c()
{ {
#if TORRENT_HAS_ARM_CRC32 #if TORRENT_HAS_ARM_CRC32 && TORRENT_HAS_AUXV
#if defined TORRENT_FORCE_ARM_CRC32 #if defined TORRENT_FORCE_ARM_CRC32
return true; return true;
#elif defined __arm__ #elif defined __arm__