configure: Rework HAVE_CAPSTONE #define

Autotools and the current build system define HAVE_* macros only when
the corresponding feature is available, leaving them undefined otherwise.

HAVE_CAPSTONE is an exception, align it with this convention to make the
build system more consistent and slightly simpler.

Change-Id: I0b71743a687802b905e3fe1e17cad815a7febb14
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9540
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink
2026-03-11 12:55:25 +01:00
committed by Antonio Borneo
parent faab1de8b1
commit a22e4331e7
5 changed files with 5 additions and 9 deletions

View File

@@ -527,10 +527,6 @@ 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

View File

@@ -13,7 +13,7 @@
#include "target.h"
#include "a64_disassembler.h"
#if HAVE_CAPSTONE
#ifdef HAVE_CAPSTONE
#include <capstone.h>

View File

@@ -15,7 +15,7 @@
#include "arm_disassembler.h"
#include <helper/log.h>
#if HAVE_CAPSTONE
#ifdef HAVE_CAPSTONE
#include <capstone.h>
#endif
@@ -3019,7 +3019,7 @@ int arm_access_size(struct arm_instruction *instruction)
}
}
#if HAVE_CAPSTONE
#ifdef HAVE_CAPSTONE
static void print_opcode(struct command_invocation *cmd, const cs_insn *insn)
{
uint32_t opcode = 0;

View File

@@ -187,7 +187,7 @@ int arm_evaluate_opcode(uint32_t opcode, uint32_t address,
int thumb_evaluate_opcode(uint16_t opcode, uint32_t address,
struct arm_instruction *instruction);
int arm_access_size(struct arm_instruction *instruction);
#if HAVE_CAPSTONE
#ifdef HAVE_CAPSTONE
int arm_disassemble(struct command_invocation *cmd, struct target *target,
target_addr_t address, size_t count, bool thumb_mode);
#endif

View File

@@ -952,7 +952,7 @@ COMMAND_HANDLER(handle_arm_core_state_command)
COMMAND_HANDLER(handle_arm_disassemble_command)
{
#if HAVE_CAPSTONE
#ifdef HAVE_CAPSTONE
struct target *target = get_current_target(CMD_CTX);
if (!target) {