meson: don't use compiler.has_header
authorDylan Baker <dylan@pnwbakers.com>
Mon, 12 Mar 2018 18:19:52 +0000 (11:19 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Tue, 13 Mar 2018 18:41:10 +0000 (11:41 -0700)
commit8247a30838a74dcdd27cc2468bff8a3d8def640e
tree4f7bb06ea40bafad8de7d49dabffe71cd43ac794
parent8379bff6c4456f8a77041eee225dcd44e5e00a76
meson: don't use compiler.has_header

Meson's compiler.has_header is completely useless, it only checks that a
header exists, not whether it's usable. This creates problems if a
header contains a conditional #error declaration, like so:

> #if __x86_64__
> # error "Doesn't work with x86_64!"
> #endif

Compiler.has_header will return true in this case, even when compiling
for x86_64. This is useless.

Instead, we'll do a compile check so that any #error declarations will
be treated as errors, and compilation will work.

Fixes compilation on x32 architecture.

Gentoo Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=649746
meson bug: https://github.com/mesonbuild/meson/issues/2246
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
meson.build