From 59610e5336b55739908beef6914083b7c4712280 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Wed, 29 Apr 2020 11:37:40 +0200 Subject: [PATCH] meson: add rbd build dependency Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa Reviewed-by: Neal Gompa --- 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 f3d9d04908..cd3b24ea2f 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 0b69c12cd7..10bbcff9b9 100644 --- a/meson.build +++ b/meson.build @@ -1250,6 +1250,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) @@ -1413,6 +1428,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)