]> git.ipfire.org Git - thirdparty/libvirt.git/commit
meson: Check header usability v9.3.0-rc2
authorAndrea Bolognani <abologna@redhat.com>
Thu, 27 Apr 2023 09:30:59 +0000 (11:30 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 27 Apr 2023 13:29:10 +0000 (15:29 +0200)
commit0324adb647885932efc97eefcfe08f6a8db60ae1
treebf8abe7940e534c6802573415e70582e6c563069
parenta3cc0e9ceb3ed20e2f87cc7518b441beffe3b2f8
meson: Check header usability

This fixes cross-building in some scenarios.

Specifically, when building for armv7l on x86_64, has_header()
will see the x86_64 version of the linux/kmv.h header and
consider it to be usable. Later, when an attempt is made to
actually include it, the compiler will quickly realize that
things can't quite work.

The reason why we haven't hit this in our CI is that we only ever
install the foreign version of header files. When building the
Debian package, however, some of the Debian-specific tooling will
bring in the native version of the Linux headers in addition to
the foreign one, causing meson to misreport the header's
availability status.

Checking for actual usability, as opposed to mere presence, of
headers is enough to make things work correctly in all cases.

The meson documentation recommends using has_header() instead of
check_header() whenever possible for performance reasons, but
while testing this change on fairly old and underpowered hardware
I haven't been able to measure any meaningful slowdown.

https://bugs.debian.org/1024504

Suggested-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
meson.build