Commit 0663dbd3 authored by Dylan Baker's avatar Dylan Baker
Browse files

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:

CC: Matt Turner <>
Signed-off-by: Dylan Baker's avatarDylan Baker <>
Reviewed-by: Eric Engestrom's avatarEric Engestrom <>
parent 5236de6c
...@@ -186,10 +186,10 @@ else ...@@ -186,10 +186,10 @@ else
dep_rt = [] dep_rt = []
endif endif
dep_m = cc.find_library('m', required : false) dep_m = cc.find_library('m', required : false)
if cc.has_header('sys/sysctl.h') if cc.compiles('#include <sys/sysctl.h>', name : 'sys/sysctl.h works')
config.set10('HAVE_SYS_SYSCTL_H', true) config.set10('HAVE_SYS_SYSCTL_H', true)
endif endif
if cc.has_header('sys/select.h') if cc.compiles('#include <sys/select.h>', name : 'sys/select.h works')
config.set10('HAVE_SYS_SELECT_H', true) config.set10('HAVE_SYS_SELECT_H', true)
endif endif
if cc.has_header_symbol('sys/sysmacros.h', 'major') if cc.has_header_symbol('sys/sysmacros.h', 'major')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment