Skip to contentSkip to conversation

meson: honor --enable-rbd if cc.links test fails

PATCH In review Paolo Bonzini 2 participants 2 messages Jan 26, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: honor --enable-rbd if cc.links test fails

If the link test failed, compilation proceeded with RBD disabled, even if --enable-rbd was used on the configure command line. Fix that.

---
 meson.build | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
meson.build +15 -9
index f991d4274d..5943aa8a51 100644
@@ -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 <stdio.h>
-    #include <rbd/librbd.h>
-    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 <stdio.h>
+      #include <rbd/librbd.h>
+      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
 
Signature · 1 line
2.29.2
Tested-by on v1 1/1
#1 lore raw

Am 26.01.21 um 11:27 schrieb Paolo Bonzini:

Quoted 34 lines

If the link test failed, compilation proceeded with RBD disabled, even if --enable-rbd was used on the configure command line. Fix that.

---
 meson.build | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
meson.build +8 -9
index f991d4274d..5943aa8a51 100644
@@ -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 <stdio.h>
-    #include <rbd/librbd.h>
-    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 <stdio.h>
+      #include <rbd/librbd.h>
+      int main(void) {
+        rados_t cluster;
+        rados_create(&cluster, NULL);
+        return 0;

meson.build if not get_option('rbd').auto() or have_block · line 710

Quoted 10 lines
meson.build +7 -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
 

That was fast, tank you.

Peter