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: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/614>
This commit is contained in:
Igor V. Kovalenko 2021-08-06 21:40:23 +03:00 committed by PulseAudio Marge Bot
parent 42af3ee083
commit 1b96b49f65

View File

@ -216,7 +216,6 @@ endif
check_headers = [ check_headers = [
'arpa/inet.h', 'arpa/inet.h',
'byteswap.h', 'byteswap.h',
'cpuid.h',
'dlfcn.h', 'dlfcn.h',
'execinfo.h', 'execinfo.h',
'grp.h', 'grp.h',
@ -276,6 +275,19 @@ if cc.has_header_symbol('pthread.h', 'PTHREAD_PRIO_INHERIT')
cdata.set('HAVE_PTHREAD_PRIO_INHERIT', 1) cdata.set('HAVE_PTHREAD_PRIO_INHERIT', 1)
endif 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 # Functions
check_functions = [ check_functions = [