On 09/06/21 18:47, Richard Henderson wrote:
feature==disabled does not map to required: false
https://mesonbuild.com/Build-options.html#features
[quote]
enabled is the same as passing required : true.
auto is the same as passing required : false.
disabled do not look for the dependency and always return
'not-found'.
[/quote]
Ah, thanks. Documentation is all over the place with meson. Anyway, I
would very much prefer the "if have_system" test above.
The more complicated one was done to cover two cases:
* "not get_option('xyz').auto() makes --enable-xyz fail even if the
library is otherwise unused. This matches what configure does and I
think it makes sense.
* have_system makes --disable-user without any --enable-* option not
warn if a library is only used by system emulation and only has a shared
library version available. Here, configure used not to warn even though
the configuration is bad, while meson does.
With Meson 0.59 there will be another way to write all of this:
pam = cc.find_library('pam', has_headers: ['security/pam_appl.h'],
required: get_option('auth_pam').disable_auto_if(not have_system),
kwargs: static_kwargs)
Also, for something like
if targetos != 'linux' and get_option('mpath').enabled()
error('Multipath is supported only on Linux')
endif
It will be possible to write
get_option('mpath').require(targetos == 'linux',
error_message: 'Multipath is supported only on Linux')
However, that's a few months away in QEMU.
Paolo