[igt-dev] [PATCH i-g-t] meson: Port cpuid.h test from configure.ac
Nicolas Boichat
drinkcat at chromium.org
Mon Feb 10 02:52:33 UTC 2020
When cross-compiling for arm64, we noticed that the header file
may be present, but it is not functional:
/usr/lib64/clang/10.0.0/include/cpuid.h:11:2: error: this header is for x86 only
Signed-off-by: Nicolas Boichat <drinkcat at chromium.org>
---
meson.build | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 4d5003ba..bcb69e1c 100644
--- a/meson.build
+++ b/meson.build
@@ -207,8 +207,16 @@ endif
if cc.has_header('sys/io.h')
config.set('HAVE_SYS_IO_H', 1)
endif
-if cc.has_header('cpuid.h')
- # FIXME: Do we need the example link test from configure.ac?
+if cc.links('''
+#include <cpuid.h>
+#include <stddef.h>
+
+int main(void) {
+ int eax, ebx, ecx, edx;
+ if (__get_cpuid_max(0, NULL) < 4)
+ return 0;
+ __cpuid_count(4, 0, eax, ebx, ecx, edx);
+}''', name : 'cpuid.h')
config.set('HAVE_CPUID_H', 1)
endif
if cc.has_header_symbol('unistd.h', 'gettid', args : '-D_GNU_SOURCE')
--
2.25.0.341.g760bfbb309-goog
More information about the igt-dev
mailing list