On Tue, 9 Sep 2025 07:18:52 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:
>> I also want to put the put the supported check and actions on >> enabled/disabled in the call previous. But I found that the configure will >> stuck at below command: >> >> >> ++ /usr/bin/autoconf -W all -I/home/yansendao/git/jdk-ysd/make/autoconf - >> >> >> The change like that: >> >> >> diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 >> index 97e37cc923b..96ea730e80a 100644 >> --- a/make/autoconf/flags-cflags.m4 >> +++ b/make/autoconf/flags-cflags.m4 >> @@ -940,6 +940,10 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], >> # ACLE and this flag are required to build the aarch64 SVE related >> functions in >> # libvectormath. Apple Silicon does not support SVE; use macOS as a proxy >> for >> # that check. >> + UTIL_ARG_ENABLE(NAME: aarch64-sve, DEFAULT: auto, >> + RESULT: enable_aarch64_sve, >> + DESC: [Use SVE when compile libsleef]) >> + AC_SUBST(enable_aarch64_sve) >> if test "x$OPENJDK_TARGET_CPU" = "xaarch64" && test "x$OPENJDK_TARGET_OS" >> = "xlinux"; then >> if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; >> then >> AC_LANG_PUSH(C) >> @@ -991,14 +995,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], >> AC_SUBST($2SVE_CFLAGS) >> ]) >> >> -AC_DEFUN([BPERF_SETUP_SVE], >> -[ >> - UTIL_ARG_ENABLE(NAME: aarch64-sve, DEFAULT: auto, >> - RESULT: enable_aarch64_sve, >> - DESC: [Use SVE when compile libsleef]) >> - AC_SUBST(enable_aarch64_sve) >> -]) >> - >> AC_DEFUN_ONCE([FLAGS_SETUP_BRANCH_PROTECTION], >> [ >> # Is branch protection available? >> >> >> I think I should find other solution later. > > This is since `FLAGS_SETUP_CFLAGS_CPU_DEP` is called twice. UTIL_ARG_ENABLE > should only be called once. So it is (unfortunately) correct that the call to > UTIL_ARG_ENABLE cannot be close to where it is used, in this case. > > However, it seems excessive to call a separate function from the top-level > configure.ac only for that. I believe you can just inline this into > FLAGS_SETUP_FLAGS, or at the very least, call `FLAGS_SETUP_SVE` (as it should > be called, if kept) from FLAGS_SETUP_FLAGS. Hi @magicus Thanks your suggesions. I choose to inline the `UTIL_ARG_ENABLE aarch64-sve` to FLAGS_SETUP_FLAGS, because call `FLAGS_SETUP_SVE` from `FLAGS_SETUP_FLAGS` seems do not work nornally. This solution results in a difference in code style before and after. If I choose to call FLAGS_SETUP_SVE in FLAGS_SETUP_FLAGS macro solution, if call FLAGS_SETUP_SVE before FLAGS_SETUP_CFLAGS, `bash configure` will report 'unrecognized options: --enable-aarch64-sve''; if call FLAGS_SETUP_SVE after FLAGS_SETUP_CFLAGS, the value of AARCH64_SVE_ENABLED is empty when FLAGS_SETUP_CFLAGS_CPU_DEP read it, seems FLAGS_SETUP_CFLAGS_CPU_DEP been called before FLAGS_SETUP_SVE been called. Sorry I do not familar with makefiles. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27073#discussion_r2336060870