openocd: fix build with 'configure --without-capstone'

When configure option --without-capstone is used, the macro
HAVE_CAPSTONE is not defined in config.h, and the following lines
are instead present:
	/* 1 if you have Capstone disassembly framework. */
	/* #undef HAVE_CAPSTONE */

This cause compile error with message:
	arm_disassembler.h:190:5: error: "HAVE_CAPSTONE" is not
		defined, evaluates to 0 [-Werror=undef]
	  190 | #if HAVE_CAPSTONE
	      |     ^~~~~~~~~~~~~

This is caused by configure.ac that does not call AC_DEFINE when
--without-capstone option is present.

Fix configure.ac to always provide the autoconf macro
HAVE_CAPSTONE, with either value 0 or 1.

Change-Id: Ie5ac98b2c25746dd721812c91baaac61ec877ecd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7224
Tested-by: jenkins
This commit is contained in:
Antonio Borneo 2022-09-26 15:32:24 +02:00
parent a69b382efd
commit 978c115dac
1 changed files with 4 additions and 1 deletions

View File

@ -631,7 +631,6 @@ AS_IF([test "x$enable_capstone" != xno], [
PKG_CHECK_MODULES([CAPSTONE], [capstone], [
AC_DEFINE([HAVE_CAPSTONE], [1], [1 if you have Capstone disassembly framework.])
], [
AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have Capstone disassembly framework.])
if test "x$enable_capstone" != xauto; then
AC_MSG_ERROR([--with-capstone was given, but test for Capstone failed])
fi
@ -639,6 +638,10 @@ AS_IF([test "x$enable_capstone" != xno], [
])
])
AS_IF([test "x$enable_capstone" == xno], [
AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have Capstone disassembly framework.])
])
for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
use_hidapi=yes