On Thu, 23 Nov 2023 05:01:14 GMT, Galder Zamarreño <d...@openjdk.org> wrote:
>> make/autoconf/lib-hsdis.m4 line 272: >> >>> 270: >>> 271: AC_MSG_CHECKING([Checking binutils API]) >>> 272: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include $disasm_header],[[void >>> foo() {init_disassemble_info(0, 0, 0, 0);}]])], >> >> Seems to me this is not working as expected but I don't have an env to >> verify this. >> >> I've been working on something similar to deal with `capstone` API changes >> and the pattern here seemed to not compile but not for the reasons expected. >> >> For example, I created: >> >> >> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include $capstone_header],[[void foo() >> {cs_arch test = CS_ARCH_AARCH64;}]])], >> >> >> And when I looked the compilation error it showed: >> >> >> conftest.c:27:12: error: function definition is not allowed here >> void foo() {cs_arch test = CS_ARCH_AARCH64;} >> ^ >> 1 error generated. >> configure:142919: $? = 1 >> configure: failed program was: >> | /* confdefs.h */ >> | #define PACKAGE_NAME "OpenJDK" >> | #define PACKAGE_TARNAME "openjdk" >> | #define PACKAGE_VERSION "openjdk" >> | #define PACKAGE_STRING "OpenJDK openjdk" >> | #define PACKAGE_BUGREPORT "build-dev@openjdk.org" >> | #define PACKAGE_URL "https://openjdk.org" >> | #define HAVE_STDIO_H 1 >> | #define HAVE_STDLIB_H 1 >> | #define HAVE_STRING_H 1 >> | #define HAVE_INTTYPES_H 1 >> | #define HAVE_STDINT_H 1 >> | #define HAVE_STRINGS_H 1 >> | #define HAVE_SYS_STAT_H 1 >> | #define HAVE_SYS_TYPES_H 1 >> | #define HAVE_UNISTD_H 1 >> | #define STDC_HEADERS 1 >> | #define HAVE_STDIO_H 1 >> | #define SIZEOF_INT_P 8 >> | #define HAVE_CUPS_CUPS_H 1 >> | #define HAVE_CUPS_PPD_H 1 >> | /* end confdefs.h. */ >> | #include "/Users/galder/opt/capstone/include/capstone/capstone.h" >> | int >> | main (void) >> | { >> | void foo() {cs_arch test = CS_ARCH_AARCH64;} >> | ; >> | return 0; >> | } >> >> >> So, the code was not compiling not because of the wrong `cs_arch` value but >> because you cannot define a method within main. >> >> Instead I made my `AC_COMPILE_IFELSE` looks like this: >> >> >> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include $capstone_header],[[cs_arch >> test = CS_ARCH_AARCH64;]])], >> >> >> And that works as expected. For example, when using a `capstone` library >> that supports `CS_ARCH_AARCH64`, it does: >> >> >> configure:142754: result: 'capstone' >> configure:142767: checking for capstone >> configure:142770: result: /Users/galder/opt/capstone >> configure:142906: checking capstone aarch64 arch name >> configure:142919: /usr/bin/clang -c -arch arm64 -isysroot >> /Applications/Xcode.app/Content... > > To make it clear, seems to me this line should be this instead: > > > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include > $disasm_header],[[init_disassemble_info(0, 0, 0, 0);]])], > > > You could probably remove the `;` since it's already included. Yes, you are correct, this was not my intention. For some reason I mixed up AC_LANG_SOURCE and AC_LANG_PROGRAM. But nested function are fine, so there is actually no issue with it. (nest case require `;` ) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15138#discussion_r1402975466