openocd: fix build with 'configure --without-capstone' 24/7224/3
authorAntonio Borneo <borneo.antonio@gmail.com>
Mon, 26 Sep 2022 13:32:24 +0000 (15:32 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sat, 8 Oct 2022 07:59:44 +0000 (07:59 +0000)
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
configure.ac

index cfd23846b4e25f6fff5cdcfe96d95a8488a78cd7..13c99046563e36b8fd08dc083aecced7ee2bf60d 100644 (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

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)