aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2017-09-28 09:01:23 -0700
committerRichard Henderson <richard.henderson@linaro.org>2017-10-26 11:56:20 +0200
commite219c499e9f5d4fa0e25dc07682f75531ee84d86 (patch)
tree27b6c4a77e0cd48264f79ed40749fcd78434d5fa /configure
parentb8d8720892f7912e8a2621b30ebac0e9a48e89e3 (diff)
disas: Add capstone as submodule
Do not require the submodule, but use it if present. Allow the command-line to override system or git submodule either way. Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure68
1 files changed, 57 insertions, 11 deletions
diff --git a/configure b/configure
index d06ad64058..23eddc2f50 100755
--- a/configure
+++ b/configure
@@ -1299,6 +1299,10 @@ for opt do
;;
--enable-capstone) capstone="yes"
;;
+ --enable-capstone=git) capstone="git"
+ ;;
+ --enable-capstone=system) capstone="system"
+ ;;
*)
echo "ERROR: unknown option $opt"
echo "Try '$0 --help' for more information"
@@ -4419,18 +4423,54 @@ fi
##########################################
# capstone
-if test "$capstone" != no; then
- if $pkg_config capstone; then
- capstone=yes
+case "$capstone" in
+ "" | yes)
+ if $pkg_config capstone; then
+ capstone=system
+ elif test -e "${source_path}/.git" ; then
+ capstone=git
+ elif test -e "${source_path}/capstone/Makefile" ; then
+ capstone=internal
+ elif test -z "$capstone" ; then
+ capstone=no
+ else
+ feature_not_found "capstone" "Install capstone devel or git submodule"
+ fi
+ ;;
+
+ system)
+ if ! $pkg_config capstone; then
+ feature_not_found "capstone" "Install capstone devel"
+ fi
+ ;;
+esac
+
+case "$capstone" in
+ git | internal)
+ if test "$capstone" = git; then
+ git_submodules="${git_submodules} capstone"
+ fi
+ mkdir -p capstone
+ QEMU_CFLAGS="$QEMU_CFLAGS -I\$(SRC_PATH)/capstone/include"
+ if test "$mingw32" = "yes"; then
+ LIBCAPSTONE=capstone.lib
+ else
+ LIBCAPSTONE=libcapstone.a
+ fi
+ LIBS="-L\$(BUILD_DIR)/capstone -lcapstone $LIBS"
+ ;;
+
+ system)
QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags capstone)"
LIBS="$($pkg_config --libs capstone) $LIBS"
- else
- if test "$capstone" = yes; then
- feature_not_found capstone
- fi
- capstone=no
- fi
-fi
+ ;;
+
+ no)
+ ;;
+ *)
+ error_exit "Unknown state for capstone: $capstone"
+ ;;
+esac
##########################################
# check if we have fdatasync
@@ -6165,7 +6205,7 @@ fi
if test "$ivshmem" = "yes" ; then
echo "CONFIG_IVSHMEM=y" >> $config_host_mak
fi
-if test "$capstone" = "yes" ; then
+if test "$capstone" != "no" ; then
echo "CONFIG_CAPSTONE=y" >> $config_host_mak
fi
@@ -6650,6 +6690,12 @@ done # for target in $targets
if [ "$dtc_internal" = "yes" ]; then
echo "config-host.h: subdir-dtc" >> $config_host_mak
fi
+if [ "$capstone" = "git" -o "$capstone" = "internal" ]; then
+ echo "config-host.h: subdir-capstone" >> $config_host_mak
+fi
+if test -n "$LIBCAPSTONE"; then
+ echo "LIBCAPSTONE=$LIBCAPSTONE" >> $config_host_mak
+fi
if test "$numa" = "yes"; then
echo "CONFIG_NUMA=y" >> $config_host_mak