Module: Mesa
Branch: master
Commit: 8247a30838a74dcdd27cc2468bff8a3d8def640e

Author: Dylan Baker <>
Date:   Mon Mar 12 11:19:52 2018 -0700

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:
meson bug:
Signed-off-by: Dylan Baker <>
Acked-by: Matt Turner <>
Reviewed-by: Eric Engestrom <>

--- | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ b/
index 3c63f38438..51b470253f 100644
--- a/
+++ b/
@@ -912,7 +912,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major')
 foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h']
-  if cc.has_header(h)
+  if cc.compiles('#include <@0@>'.format(h), name : '@0@ works'.format(h))
     pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())

mesa-commit mailing list

Reply via email to