On Thu, 23 Nov 2023 04:58:22 GMT, Galder Zamarreño <d...@openjdk.org> wrote:

>> Robbin Ehn has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Added back guard
>
> 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/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk
>  -iframework 
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.pla...

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 `;` too seems that seems to also be included.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15138#discussion_r1402918327

Reply via email to