From 528dbf9ebb2688f476ef283be59d0f2232159dcb Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 26 Feb 2013 08:15:47 +0000 Subject: [PATCH] sna: Fix build on older GCC for cpuid() We need to double check that the features we look for are supported by the compiler before doing so. Signed-off-by: Chris Wilson --- src/sna/sna_cpu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sna/sna_cpu.c b/src/sna/sna_cpu.c index 65f6e040..c669eb87 100644 --- a/src/sna/sna_cpu.c +++ b/src/sna/sna_cpu.c @@ -31,8 +31,14 @@ #include "sna.h" +#if defined(__GNUC__) && (__GNUC__ >= 4) /* 4.4 */ + #include +#ifndef bit_AVX2 +#define bit_AVX2 (1<<5) +#endif + unsigned sna_cpu_detect(void) { unsigned int eax, ebx, ecx, edx; @@ -74,3 +80,12 @@ unsigned sna_cpu_detect(void) return features; } + +#else + +unsigned sna_cpu_detect(void) +{ + return 0; +} + +#endif