diff --git a/meson.build b/meson.build index 6d6537d74a..5bd22f431a 100644 --- a/meson.build +++ b/meson.build @@ -690,15 +690,21 @@ if not get_option('rbd').auto() or have_block librbd = cc.find_library('rbd', has_headers: ['rbd/librbd.h'], required: get_option('rbd'), kwargs: static_kwargs) - if librados.found() and librbd.found() and cc.links(''' - #include - #include - int main(void) { - rados_t cluster; - rados_create(&cluster, NULL); - return 0; - }''', dependencies: [librbd, librados]) - rbd = declare_dependency(dependencies: [librbd, librados]) + if librados.found() and librbd.found() + if cc.links(''' + #include + #include + int main(void) { + rados_t cluster; + rados_create(&cluster, NULL); + return 0; + }''', dependencies: [librbd, librados]) + rbd = declare_dependency(dependencies: [librbd, librados]) + elif get_option('rbd').enabled() + error('could not link librados') + else + warning('could not link librados, disabling') + endif endif endif