[libvirt PATCH 09/15] meson: add rbd build option

Pavel Hrdina phrdina at redhat.com
Thu Oct 8 13:58:58 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 meson.build       | 26 +++++++++++++++++---------
 meson_options.txt |  1 +
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/meson.build b/meson.build
index b6e0b1cb76..af82f37d32 100644
--- a/meson.build
+++ b/meson.build
@@ -1228,17 +1228,25 @@ else
   pkcheck_prog = dependency('', required: false)
 endif
 
-rbd_dep = cc.find_library('rbd', required: false)
-rados_dep = cc.find_library('rados', required: false)
-if rbd_dep.found() and not cc.has_function('rbd_get_features', dependencies: rbd_dep)
-  rbd_dep = dependency('', required: false)
-endif
-if rbd_dep.found() and rados_dep.found()
-  if cc.has_function('rbd_list2', dependencies: rbd_dep)
-    conf.set('WITH_RBD_LIST2', 1)
+if not get_option('rbd').disabled()
+  rbd_dep = cc.find_library('rbd', required: get_option('rbd'))
+  rados_dep = cc.find_library('rados', required: get_option('rbd'))
+
+  if rbd_dep.found() and not cc.has_function('rbd_get_features', dependencies: rbd_dep)
+    if get_option('rbd').enabled()
+      error('rbd is missing rbd_get_features')
+    else
+      rbd_dep = dependency('', required: false)
+    endif
   endif
 
-  rbd_dep = declare_dependency(dependencies: [ rbd_dep, rados_dep ])
+  if rbd_dep.found() and rados_dep.found()
+    if cc.has_function('rbd_list2', dependencies: rbd_dep)
+      conf.set('WITH_RBD_LIST2', 1)
+    endif
+
+    rbd_dep = declare_dependency(dependencies: [ rbd_dep, rados_dep ])
+  endif
 else
   rbd_dep = dependency('', required: false)
 endif
diff --git a/meson_options.txt b/meson_options.txt
index b3f4d7744f..452fdab4d0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -31,6 +31,7 @@ option('numactl', type: 'feature', value: 'auto', description: 'numactl support'
 option('openwsman', type: 'feature', value: 'auto', description: 'openwsman support')
 option('pciaccess', type: 'feature', value: 'auto', description: 'pciaccess support')
 option('polkit', type: 'feature', value: 'auto', description: 'use PolicyKit for UNIX socket access checks')
+option('rbd', type: 'feature', value: 'auto', description: 'rbd support')
 option('readline', type: 'feature', value: 'auto', description: 'readline support')
 option('sanlock', type: 'feature', value: 'auto', description: 'sanlock support')
 option('sasl', type: 'feature', value: 'auto', description: 'sasl support')
-- 
2.26.2




More information about the libvir-list mailing list