Subject: bug#57380: 29.0.50; configure --config-cache --with-native-compilation failing

From: Andreas Schwab <[email-masked]>
Date: Wed, 24 Aug 2022 16:32:20 +0200

On Aug 24 2022, Gerd Möllmann wrote:

> diff --git a/configure.ac b/configure.ac
> index 7616e450d0..08a41a7808 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -4273,6 +4273,7 @@ AC_DEFUN
>        [], [libgccjit_not_found])
>      AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found])
>      # Check if libgccjit really works.
> +    AC_LANG(C)
>      AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken])
>      HAVE_NATIVE_COMP=yes
>      case "${opsys}" in
>
> This makes it work for me.

That appears to be a misuse of AC_LANG_PUSH/POP.  Apparently they must
not be used inside AC_CACHE_CHECK.

diff --git a/configure.ac b/configure.ac
index 7616e450d0..39bfe7800b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2155,32 +2155,32 @@ AC_SUBST([NS_OBJ])
 AC_SUBST([NS_OBJC_OBJ])
 
 if test "${HAVE_NS}" = yes; then
+  AC_LANG_PUSH([Objective C])
   AC_CACHE_CHECK(
     [if the Objective C compiler supports instancetype],
     [emacs_cv_objc_instancetype],
-    [AC_LANG_PUSH([Objective C])
-     AC_COMPILE_IFELSE(
+    [AC_COMPILE_IFELSE(
        [AC_LANG_SOURCE([[@interface Test
                           + (instancetype)test;
                           @end]])],
        [emacs_cv_objc_instancetype=yes],
-       [emacs_cv_objc_instancetype=no])
-     AC_LANG_POP([Objective C])])
+       [emacs_cv_objc_instancetype=no])])
+  AC_LANG_POP([Objective C])
 
   if test x$emacs_cv_objc_instancetype = xyes ; then
     AC_DEFINE([NATIVE_OBJC_INSTANCETYPE], [1],
               [Define if ObjC compiler supports instancetype natively.])
   fi
 
+  AC_LANG_PUSH([Objective C])
   AC_CACHE_CHECK(
     [if the Objective C compiler defaults to C99],
     [emacs_cv_objc_c99],
-    [AC_LANG_PUSH([Objective C])
-     AC_COMPILE_IFELSE(
+    [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([], [[for (int i = 0;;);]])],
        [emacs_cv_objc_c99=yes],
-       [emacs_cv_objc_c99=no])
-     AC_LANG_POP([Objective C])])
+       [emacs_cv_objc_c99=no])])
+  AC_LANG_POP([Objective C])
 
    if test x$emacs_cv_objc_c99 = xno ; then
      GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -std=c99"

-- 
Andreas Schwab, SUSE Labs, [email-masked]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."