From: Jim Meyering Date: Mon, 27 Jun 2022 05:38:04 +0000 (-0700) Subject: AC_FUNC_ALLOCA: fix a misplaced (now fatal) closing "fi" X-Git-Tag: v2.72c~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68fac90c09a4a77d9aad730b5939438294c68a43;p=thirdparty%2Fautoconf.git AC_FUNC_ALLOCA: fix a misplaced (now fatal) closing "fi" "autoconf quoting is a pain" * lib/autoconf/functions.m4 (AC_FUNC_ALLOCA): Its AC_CACHE_CHECK contains an if/else block, but the closing "fi" lay just after its ")". Before, this error didn't trigger any failure because the if/else code was in the "else" block of AC_CACHE_CHECK's AS_IF invocation and AS_IF was also implemented using an if..fi block. So the ostensibly-"outer" "fi" provided by AS_IF matched the inner "if/else", and that stray-after-end "fi" served to close the AS_IF block. However, when AS_IF switched from if..fi to case..esac, this became a nesting error: no matching "fi". Initially-harmless error introduced by v2.69-52-gfd29dbd7 in 2012. Error exposed by v2.72a-30-gc8d6d6eb. * tests/mktests.pl (scan_m4_files): Do not elide direct test of AC_FUNC_ALLOCA. FTR, here's the list of macros whose direct tests were being suppressed: AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET AC_CHECK_INCLUDES_DEFAULT AC_DISABLE_OPTION_CHECKING AC_ERLANG_NEED_ERL AC_ERLANG_NEED_ERLC AC_ERLANG_SUBST_ERTS_VER AC_ERLANG_SUBST_INSTALL_LIB_DIR AC_ERLANG_SUBST_LIB_DIR AC_F77_DUMMY_MAIN AC_F77_LIBRARY_LDFLAGS AC_FC_DUMMY_MAIN AC_FC_LIBRARY_LDFLAGS AC_FUNC_ALLOCA AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_GNU_SOURCE AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_PATH_X AC_PROG_CPP AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_F77 AC_PROG_FC AC_PROG_GO AC_PROG_GREP AC_PROG_OBJC AC_PROG_OBJCPP AC_PROG_OBJCXX AC_PROG_OBJCXXCPP AC_STRUCT_TM AC_TYPE_GETGROUPS AC_TYPE_LONG_LONG_INT AC_TYPE_MBSTATE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_TYPE_UNSIGNED_LONG_LONG_INT AC_USE_SYSTEM_EXTENSIONS --- diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index e7c54846..51aeb0b9 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -448,8 +448,10 @@ void *alloca (size_t); ]], [[char *p = (char *) alloca (1); if (p) return 0;]])], [ac_cv_func_alloca_works=yes], - [ac_cv_func_alloca_works=no])]) + [ac_cv_func_alloca_works=no] + ) fi +]) if test $ac_cv_func_alloca_works = yes; then AC_DEFINE(HAVE_ALLOCA, 1, diff --git a/tests/mktests.pl b/tests/mktests.pl index ab47eaf1..b6842682 100644 --- a/tests/mktests.pl +++ b/tests/mktests.pl @@ -290,6 +290,14 @@ sub scan_m4_files push @macros_to_test, [ $file, \@ac_macros, \@au_macros ]; } + # Do **NOT** filter out AC_FUNC_ALLOCA. Filtering it out + # ended up eliding a direct test of AC_FUNC_ALLOCA which + # would have exposed a bug, while no required use does so. + # Clearing this hash entirely would currently enable direct tests + # of 38 macros, but would require designating each that must be + # skipped when cross-compiling. + delete $required_macros{AC_FUNC_ALLOCA}; + # Filter out macros that are AC_REQUIREd by some other macro; # it's not necessary to test them directly. my @pruned_macros_to_test;