[Spice-devel] [PATCH spice-common 3/3] meson: Cleanup optional dependency checks

Eduardo Lima (Etrunko) etrunko at redhat.com
Thu Jun 21 13:42:25 UTC 2018


We can follow the same practice as in headers and function checks above,
by using the dependency name itself to set the configuration data.

Also, if a combo is used, the first value is used as default if none is
specified. Thus, we can remove the default value for opus from
meson_options.txt.
---
 meson.build       | 9 +++------
 meson_options.txt | 1 -
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index dd5127a..e6ab203 100644
--- a/meson.build
+++ b/meson.build
@@ -113,12 +113,9 @@ endforeach
 #
 # Non-mandatory/optional dependencies
 #
-# 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 foreach block below.
 optional_deps = [
-                    ['celt051', '>= 0.5.1.1', 'HAVE_CELT051'],
-                    ['opus', '>= 0.9.14', 'HAVE_OPUS'],
+                    ['celt051', '>= 0.5.1.1'],
+                    ['opus', '>= 0.9.14'],
                 ]
 foreach dep : optional_deps
   option_value = get_option(dep[0])
@@ -126,7 +123,7 @@ foreach dep : optional_deps
     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')
+      spice_common_config_data.set('HAVE_ at 0@'.format(dep[0].to_upper()), '1')
     endif
   endif
 endforeach
diff --git a/meson_options.txt b/meson_options.txt
index 6994d91..3d04b4d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -19,7 +19,6 @@ option('celt051',
 option('opus',
     type : 'combo',
     choices : ['true', 'false', 'auto'],
-    value : 'true',
     description: 'Enable Opus audio codec (default=true)')
 
 option('python-checks',
-- 
2.14.4



More information about the Spice-devel mailing list