Re: [libvirt PATCH] meson: Check usability of linux/kvm.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 27, 2023 at 11:50:05AM +0200, Michal Prívozník wrote:
> On 4/27/23 11:41, Andrea Bolognani wrote:
> > +# headers for which we need to check actual usability. in most
> > +# cases, checking for presence is enough (and it's way faster)
> > +check_headers = [
> > +  'linux/kvm.h',
> > +]
> > +
> > +foreach name : check_headers
> > +  if cc.check_header(name)
> > +    conf.set('WITH_@0@'.format(name.underscorify().to_upper()), 1)
> > +  endif
> > +endforeach
>
> One could argue, that the semantics of has_header() is broken then. What
> good is there to check if the host has a header file when compiler
> rejects it subsequently?
>
> But leaving meson aside, shouldn't we just use check_header() for every
> header file then? I mean, this fixes this particular instance of the
> problem, but can't we hit it again with say ifaddrs.h or any other
> header file on the list?

We could. The Meson documentation recommends not doing this, as
check_header() is (understandably) slower than has_header().

I haven't tried to see how much slower we're actually talking...
Maybe for the 20-ish headers that we care about, it wouldn't make a
measurable difference? Especially since the results of the check are
cached between Meson runs.

Anyway, I believe the reason why only linux/kvm.h is proving to be
problematic here is that KVM support might or might not be present
depending on the architecture. All the other stuff is going to be
affected by whether or not we're targeting Linux, not the specific
Linux architecture.

-- 
Andrea Bolognani / Red Hat / Virtualization





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux