Fix build on arm64 and make use of elf_aux_info to emulate getauxval.

Index: extern/lzma/CpuArch.c
--- extern/lzma/CpuArch.c.orig
+++ extern/lzma/CpuArch.c
@@ -760,13 +760,28 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYP
 
 #else // __APPLE__
 
-#include <sys/auxv.h>
-
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 #define USE_HWCAP
+#endif
 
 #ifdef USE_HWCAP
 
+#include <sys/auxv.h>
+
+#ifdef __linux__
 #include <asm/hwcap.h>
+#endif
+
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+static inline
+unsigned long getauxval(int aux) { 
+	unsigned long val;
+
+	if (elf_aux_info(aux, &val, sizeof(val)) == -1)
+		val = 0;
+	return val;
+}
+#endif
 
   #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
   BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP)  & (HWCAP_  ## name2)) ? 1 : 0; }
