aboutsummaryrefslogtreecommitdiffstats
path: root/audio/flac/files
diff options
context:
space:
mode:
authornaddy <naddy@FreeBSD.org>2005-01-16 00:38:09 +0800
committernaddy <naddy@FreeBSD.org>2005-01-16 00:38:09 +0800
commit4d8b01553998536069e37a0f66c577f133c7b1e3 (patch)
tree6b82bbdb018fd08730393a1d9902e2278cf51135 /audio/flac/files
parent96b6d880766f28e4c0a475faf16307d62fedde90 (diff)
downloadfreebsd-ports-gnome-4d8b01553998536069e37a0f66c577f133c7b1e3.tar.gz
freebsd-ports-gnome-4d8b01553998536069e37a0f66c577f133c7b1e3.tar.zst
freebsd-ports-gnome-4d8b01553998536069e37a0f66c577f133c7b1e3.zip
Don't enable SSE code if sysctl hw.instruction_sse is 0.
Original bug report and testing by Bryan Levin <bryan.levin@gmail.com>.
Diffstat (limited to 'audio/flac/files')
-rw-r--r--audio/flac/files/patch-src_libFLAC_cpu.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/audio/flac/files/patch-src_libFLAC_cpu.c b/audio/flac/files/patch-src_libFLAC_cpu.c
new file mode 100644
index 000000000000..36a52ecc2fb8
--- /dev/null
+++ b/audio/flac/files/patch-src_libFLAC_cpu.c
@@ -0,0 +1,33 @@
+
+$FreeBSD$
+
+--- src/libFLAC/cpu.c.orig
++++ src/libFLAC/cpu.c
+@@ -25,6 +25,11 @@
+ #include <config.h>
+ #endif
+
++#ifdef __FreeBSD__
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000;
+ const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000;
+ const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000;
+@@ -52,6 +57,15 @@
+
+ #ifndef FLAC__SSE_OS
+ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = false;
++#else
++#if defined(__FreeBSD__)
++ {
++ int sse;
++ size_t len = sizeof(sse);
++ if (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) || !sse)
++ info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = false;
++ }
++#endif
+ #endif
+
+ #ifdef FLAC__USE_3DNOW