diff options
authorDylan Baker2018-03-12 12:10:51 -0500
committerDylan Baker2018-03-13 13:30:51 -0500
commit0663dbd3efc7e6d644662c903722d1fc4a199cfa (patch)
treebf61321cdb26d8b49506e19a9ee2ee0cfa6df15c /meson.build
parent5236de6cc1ee3759567e0fd8cd6260386b8d5b7e (diff)
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 CC: Matt Turner <mattst88@gmail.com> Signed-off-by: Dylan Baker <dylan.c.baker@intel.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Diffstat (limited to 'meson.build')
1 files changed, 2 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index df6f2bd2..a0c79e30 100644
--- a/meson.build
+++ b/meson.build
@@ -186,10 +186,10 @@ else
186 dep_rt = [] 186 dep_rt = []
187endif 187endif
188dep_m = cc.find_library('m', required : false) 188dep_m = cc.find_library('m', required : false)
189if cc.has_header('sys/sysctl.h') 189if cc.compiles('#include <sys/sysctl.h>', name : 'sys/sysctl.h works')
190 config.set10('HAVE_SYS_SYSCTL_H', true) 190 config.set10('HAVE_SYS_SYSCTL_H', true)
191endif 191endif
192if cc.has_header('sys/select.h') 192if cc.compiles('#include <sys/select.h>', name : 'sys/select.h works')
193 config.set10('HAVE_SYS_SELECT_H', true) 193 config.set10('HAVE_SYS_SELECT_H', true)
194endif 194endif
195if cc.has_header_symbol('sys/sysmacros.h', 'major') 195if cc.has_header_symbol('sys/sysmacros.h', 'major')