diff mbox series

[v2,06/39] build: validate that system capstone works before using it

Message ID 20210708190941.16980-7-alex.bennee@linaro.org
State Superseded
Headers show
Series testing and plugins pre-PR series | expand

Commit Message

Alex Bennée July 8, 2021, 7:09 p.m. UTC
From: Daniel P. Berrangé <berrange@redhat.com>


Some versions of capstone have shipped a broken pkg-config file which
puts the -I path without the trailing '/capstone' suffix. This breaks
the ability to "#include <capstone.h>". Upstream and most distros have
fixed this, but a few stragglers remain, notably FreeBSD.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Willian Rampazzo <willianr@redhat.com>

Message-Id: <20210625172211.451010-2-berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 meson.build | 13 +++++++++++++
 1 file changed, 13 insertions(+)

-- 
2.20.1

Comments

Richard Henderson July 8, 2021, 8:14 p.m. UTC | #1
On 7/8/21 12:09 PM, Alex Bennée wrote:
> +      error('system capstone requested, it it does not appear to work')


"it it"

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index 7e12de01be..2748721d71 100644
--- a/meson.build
+++ b/meson.build
@@ -1641,6 +1641,19 @@  if capstone_opt in ['enabled', 'auto', 'system']
                         kwargs: static_kwargs, method: 'pkg-config',
                         required: capstone_opt == 'system' or
                                   capstone_opt == 'enabled' and not have_internal)
+
+  # Some versions of capstone have broken pkg-config file
+  # that reports a wrong -I path, causing the #include to
+  # fail later. If the system has such a broken version
+  # do not use it.
+  if capstone.found() and not cc.compiles('#include <capstone.h>',
+                                          dependencies: [capstone])
+    capstone = not_found
+    if capstone_opt == 'system'
+      error('system capstone requested, it it does not appear to work')
+    endif
+  endif
+
   if capstone.found()
     capstone_opt = 'system'
   elif have_internal