#if __has_include() #include #else #include #include #include #include #include static unsigned long getauxval(unsigned long type) { Elf_Auxinfo auxv[AT_COUNT]; size_t len = sizeof(auxv); int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_AUXV, getpid(), }; if (sysctl(mib, nitems(mib), auxv, &len, NULL, 0) != -1) { for (size_t i = 0; i < nitems(auxv); i++) if ((unsigned long)auxv[i].a_type == type) return auxv[i].a_un.a_val; errno = ENOENT; } return 0; } #endif #if defined __FreeBSD__ #define AT_HWCAP 25 #else #define AT_HWCAP 16 #endif #ifndef HWCAP_NEON #define HWCAP_NEON (1 << 12) #endif #include int main() { printf("NEON: %s supported\n", getauxval(AT_HWCAP) & HWCAP_NEON ? "" : "not"); return 0; }