diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-03-12 11:19:52 -0700 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2018-04-12 21:49:29 +0200 |
commit | 42cf180fb5eba6efdfa66eb99f3c819607ecb908 (patch) | |
tree | d691d5c6a5d5811389fd58698999511696265065 | |
parent | 50e3fb590c615155ad9fb694b7c49992e0319a24 (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
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>
(cherry picked from commit 8247a30838a74dcdd27cc2468bff8a3d8def640e)
[Juan A. Suarez: resolve trivial conflicts]
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Conflicts:
meson.build
-rw-r--r-- | meson.build | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/meson.build b/meson.build index 5eef2227e0f..341d9ae5b43 100644 --- a/meson.build +++ b/meson.build @@ -839,7 +839,7 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') endif foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.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()) endif endforeach |