From 6677811be6e9be9000b3217e8862353b3945a4f3 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Mon, 10 Feb 2020 10:52:33 +0800 Subject: meson: Port cpuid.h test from configure.ac 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 Reviewed-by: Petri Latvala --- meson.build | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'meson.build') 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 +#include + +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') -- cgit v1.2.3