diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2020-02-10 10:52:33 +0800 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2020-02-10 13:45:24 +0200 |
commit | 6677811be6e9be9000b3217e8862353b3945a4f3 (patch) | |
tree | 60322fa629ac26a6e91cfcfedef31c35b051c6f8 /meson.build | |
parent | 81f8719360fc99e93fd1d22e8b929997fbad591c (diff) |
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 <drinkcat@chromium.org>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 4d5003ba0..bcb69e1c7 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') |