Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- m4/virt-storage-rbd.m4 | 12 ------------ meson.build | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/m4/virt-storage-rbd.m4 b/m4/virt-storage-rbd.m4 index f3d9d049084..cd3b24ea2fa 100644 --- a/m4/virt-storage-rbd.m4 +++ b/m4/virt-storage-rbd.m4 @@ -25,18 +25,6 @@ AC_DEFUN([LIBVIRT_STORAGE_ARG_RBD], [ AC_DEFUN([LIBVIRT_STORAGE_CHECK_RBD], [ LIBRBD_LIBS= if test "$with_storage_rbd" = "yes" || test "$with_storage_rbd" = "check"; then - AC_CHECK_HEADER([rbd/librbd.h], [LIBRBD_FOUND=yes; break;]) - - if test "$LIBRBD_FOUND" = "yes"; then - LIBRBD_LIBS="-lrbd -lrados" - - old_LIBS="$LIBS" - LIBS="$LIBS $LIBRBD_LIBS" - AC_CHECK_FUNCS([rbd_get_features],[],[LIBRBD_FOUND=no]) - AC_CHECK_FUNCS([rbd_list2]) - LIBS="$old_LIBS" - fi - if test "$LIBRBD_FOUND" = "yes"; then with_storage_rbd=yes AC_DEFINE_UNQUOTED([WITH_STORAGE_RBD], [1], diff --git a/meson.build b/meson.build index e6dc0aa8717..d272b5cca05 100644 --- a/meson.build +++ b/meson.build @@ -1232,6 +1232,21 @@ 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('HAVE_RBD_LIST2', 1) + endif + + rbd_dep = declare_dependency(dependencies: [ rbd_dep, rados_dep ]) +else + rbd_dep = dependency('', required: false) +endif + # readline 7.0 is the first version which includes pkg-config support readline_version = '7.0' readline_dep = dependency('readline', version: '>=' + readline_version, required: false) @@ -1395,6 +1410,7 @@ libs_summary = { 'openwsman': openwsman_dep.found(), 'pciaccess': pciaccess_dep.found(), 'polkit': conf.has('WITH_POLKIT'), + 'rbd': rbd_dep.found(), 'readline': readline_dep.found(), } summary(libs_summary, section: 'Libraries', bool_yn: true) -- 2.26.2