At the moment, missing optional dependencies will be silently ignored when the corresponding configuration flag is 'true', and won't be tested for when the flag is 'false'. In the autotools build, this corresponds respectively to --enable-foo=auto and --disable-foo. Having a way to get an error when the package is enabled but missing is quite desirable. f52247384 has some half-baked attempt at that, but this was supposed to be removed from the series. This causes errors when processing meson.build, breaking the meson build. This commit adds 'true'/'false'/'auto' in a proper way. --- Changes since v1: - rebased - added (default: xxx) to option description for consistency meson.build | 23 ++++++++++------------- meson_options.txt | 12 +++++++----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/meson.build b/meson.build index 9c12467..02ebbd8 100644 --- a/meson.build +++ b/meson.build @@ -117,22 +117,19 @@ endforeach # # Check deps which are optional but enabled by default. This foreach block only # checks the option, and adds the package to the deps list, while the real check -# for the dependency is done in the foeach block below. +# for the dependency is done in the foreach block below. optional_deps = [ - ['celt051', '>= 0.5.1.1', false, 'HAVE_CELT051'], - ['opus', '>= 0.9.14', true, 'HAVE_OPUS'], + ['celt051', '>= 0.5.1.1', 'HAVE_CELT051'], + ['opus', '>= 0.9.14', 'HAVE_OPUS'], ] foreach dep : optional_deps - if get_option(dep[0]) - deps += [dep] - endif -endforeach - -foreach dep : deps - d = dependency(dep[0], required : dep[2], version : dep[1]) - if d.found() - spice_common_deps += d - spice_common_config_data.set(dep[3], '1') + option_value = get_option(dep[0]) + if option_value != 'false' + d = dependency(dep[0], required: (option_value == 'true'), version : dep[1]) + if d.found() + spice_common_deps += d + spice_common_config_data.set(dep[2], '1') + endif endif endforeach diff --git a/meson_options.txt b/meson_options.txt index 9796833..6994d91 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -11,13 +11,15 @@ option('extra-checks', description : 'Enable extra checks on code (default=false)') option('celt051', - type : 'boolean', - value : false, - description: 'Enable celt051 audio codec (default=false)') + type : 'combo', + choices : ['true', 'false', 'auto'], + value : 'auto', + description: 'Enable celt051 audio codec (default=auto)') option('opus', - type : 'boolean', - value : true, + type : 'combo', + choices : ['true', 'false', 'auto'], + value : 'true', description: 'Enable Opus audio codec (default=true)') option('python-checks', -- 2.17.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel