diff options
author | David Schleef <ds@hutch-2.local> | 2008-12-08 17:34:46 -0800 |
---|---|---|
committer | David Schleef <ds@hutch-2.local> | 2008-12-08 17:34:46 -0800 |
commit | 89703e8d6c57c5427a7387d5069af1276d6ca22b (patch) | |
tree | 6a29334965e250d867762611d38fdd181dccb105 | |
parent | a28a9de744adfa810537fa5c5cdd6baef08e7919 (diff) | |
download | liboil-89703e8d6c57c5427a7387d5069af1276d6ca22b.tar.gz |
Fix cpu detection on OS/X
-rw-r--r-- | liboil/liboilcpu-x86.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/liboil/liboilcpu-x86.c b/liboil/liboilcpu-x86.c index 56f7790..ae7261f 100644 --- a/liboil/liboilcpu-x86.c +++ b/liboil/liboilcpu-x86.c @@ -302,7 +302,17 @@ oil_cpu_detect_getisax (void) static void oil_cpu_detect_kernel_support (void) { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) +#if defined(__APPLE__) + int ret, enabled; + size_t len; + + len = sizeof(enabled); + ret = sysctlbyname("hw.optional.sse", &enabled, &len, NULL, 0); + if (ret || !enabled) { + oil_cpu_flags &= ~(OIL_IMPL_FLAG_SSE | OIL_IMPL_FLAG_SSE2 | + OIL_IMPL_FLAG_MMXEXT | OIL_IMPL_FLAG_SSE3); + } +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) int ret, enabled; size_t len; |