From 1b96b49f65744930050b927a548a3d2e771c7310 Mon Sep 17 00:00:00 2001 From: "Igor V. Kovalenko" Date: Fri, 6 Aug 2021 21:40:23 +0300 Subject: [PATCH] build-sys: meson: Check if cpuid.h header is usable With clang compiler including cpuid.h will produce error if architecture is not x86-based, and cheching if cpuid.h exists via Meson has_header() is not enough. Fix this by creating a list of headers checked to be usable via Meson check_header() function, and move cpuid.h to that list. Part-of: --- meson.build | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a95fefcd4..944dcbb89 100644 --- a/meson.build +++ b/meson.build @@ -216,7 +216,6 @@ endif check_headers = [ 'arpa/inet.h', 'byteswap.h', - 'cpuid.h', 'dlfcn.h', 'execinfo.h', 'grp.h', @@ -276,6 +275,19 @@ if cc.has_header_symbol('pthread.h', 'PTHREAD_PRIO_INHERIT') cdata.set('HAVE_PTHREAD_PRIO_INHERIT', 1) endif +# Headers which are usable + +check_usable_headers = [ + 'cpuid.h', +] + +foreach h : check_usable_headers + if cc.check_header(h) + define = 'HAVE_' + h.underscorify().to_upper() + cdata.set(define, 1) + endif +endforeach + # Functions check_functions = [