qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH] capstone: fix building using system package
@ 2018-02-15 17:35 Philippe Mathieu-Daudé
  2018-02-15 18:21 ` Sergei Trofimovich
  2018-02-16  3:01 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-02-15 17:35 UTC (permalink / raw)
  To: Richard Henderson, Mike Frysinger, Sergei Trofimovich,
	Zoltán Mizsei
  Cc: Philippe Mathieu-Daudé, Daniel P . Berrange, Eric Blake,
	Marc-André Lureau, Paolo Bonzini, Alexey Kardashevskiy,
	Thomas Huth, qemu-devel

The use of <capstone/capstone.h> is recommended by the upstream project:
  http://www.capstone-engine.org/lang_c.html
However when building the in-tree cloned submodule, the header is accessible
via <capstone.h>.

This fixes building on Gentoo (and Haiku OS - not supported since 898be3e0415):
    CC      disas.o
  /sources/qemu-2.11.0/include/disas/capstone.h:6:22: fatal error: capstone.h: No such file or directory
  #include <capstone.h>
           ^~~~~~~~~~~~

On Haiku `pkg-config --cflags capstone` reports "-I/usr/develop/headers".

Bug: https://bugs.gentoo.org/647570
Reported-by: Zoltán Mizsei <miqlas@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
RFC because this might be a Gentoo portage issue.

 configure                | 1 +
 include/disas/capstone.h | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 913e14839d..3657a61a35 100755
--- a/configure
+++ b/configure
@@ -7017,6 +7017,7 @@ if [ "$dtc_internal" = "yes" ]; then
   echo "config-host.h: subdir-dtc" >> $config_host_mak
 fi
 if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
+  echo "CONFIG_LIBCAPSTONE_INTERNAL=y" >> $config_host_mak
   echo "config-host.h: subdir-capstone" >> $config_host_mak
 fi
 if test -n "$LIBCAPSTONE"; then
diff --git a/include/disas/capstone.h b/include/disas/capstone.h
index 84e214956d..aea9601f41 100644
--- a/include/disas/capstone.h
+++ b/include/disas/capstone.h
@@ -3,9 +3,13 @@
 
 #ifdef CONFIG_CAPSTONE
 
+#ifdef CONFIG_LIBCAPSTONE_INTERNAL
 #include <capstone.h>
-
 #else
+#include <capstone/capstone.h>
+#endif /* CONFIG_LIBCAPSTONE_INTERNAL */
+
+#else /* CONFIG_CAPSTONE */
 
 /* Just enough to allow backends to init without ifdefs.  */
 
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-16  3:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15 17:35 [Qemu-devel] [RFC PATCH] capstone: fix building using system package Philippe Mathieu-Daudé
2018-02-15 18:21 ` Sergei Trofimovich
2018-02-15 18:39   ` Philippe Mathieu-Daudé
2018-02-15 18:45     ` miqlas
2018-02-16  3:01 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).