From: Antonio Borneo Date: Mon, 26 Sep 2022 13:32:24 +0000 (+0200) Subject: openocd: fix build with 'configure --without-capstone' X-Git-Tag: v0.12.0-rc2~22 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=978c115dac5a2f420b9ef70207f384f09e380e35 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 Reviewed-on: https://review.openocd.org/c/openocd/+/7224 Tested-by: jenkins --- diff --git a/configure.ac b/configure.ac index cfd23846b4..13c9904656 100644 --- a/configure.ac +++ b/configure.ac @@ -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