Paul Eggert wrote in
<https://lists.gnu.org/archive/html/bug-autoconf/2025-05/msg00024.html>.
> Two questions about this patch installed a couple days ago 
> <https://cgit.git.savannah.gnu.org/cgit/autoconf.git/commit/?id=e1bbc9b93cdff61d70719c224b37970e065008bb>.
> 
> Should Gnulib's gl_CHECK_FUNCS_MACOS be adjusted to work better with 
> future Autoconf versions that have the patch?

Indeed, well spotted! The patch below fixes it. Tested with a testdir for
module 'mkfifoat' on macOS 12.6:

With the original Autoconf 2.72 and without the patch below, the results were:
  ac_cv_func_mkfifoat=${ac_cv_func_mkfifoat=no}
  ac_cv_have_decl_mkfifoat=${ac_cv_have_decl_mkfifoat=yes}
  gl_cv_onwards_func_mkfifoat=${gl_cv_onwards_func_mkfifoat='future OS version'}

With current Autoconf master and without the patch below, the results were:
  ac_cv_func_mkfifoat=${ac_cv_func_mkfifoat=no}
  ac_cv_have_decl_mkfifoat=${ac_cv_have_decl_mkfifoat=no}
  gl_cv_onwards_func_mkfifoat=${gl_cv_onwards_func_mkfifoat=no}

With current Autoconf master and with the patch below, the results are:
  ac_cv_func_mkfifoat=${ac_cv_func_mkfifoat=no}
  ac_cv_have_decl_mkfifoat=${ac_cv_have_decl_mkfifoat=no}
  gl_cv_onwards_func_mkfifoat=${gl_cv_onwards_func_mkfifoat='future OS version'}

> Is there a similar issue with Android? (I think not, but I'm asking as a 
> double-check.)

There is no such issue on Android, because in the Android header files, the
idiom is:

#if __ANDROID_API__ >= 30
int mlock2(const void* _Nonnull __addr, size_t __size, int __flags) 
__INTRODUCED_IN(30);
#endif /* __ANDROID_API__ >= 30 */

or

#if __ANDROID_API__ >= 26
wint_t towctrans_l(wint_t __wc, wctrans_t _Nonnull __transform, locale_t 
_Nonnull __l) __INTRODUCED_IN(26);
wctrans_t _Nonnull wctrans_l(const char* _Nonnull __name, locale_t _Nonnull 
__l) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */


2025-05-31  Bruno Haible  <br...@clisp.org>

        Make gl_CHECK_FUNCS_MACOS work with current unreleased Autoconf.
        Reported by Paul Eggert in
        <https://lists.gnu.org/archive/html/bug-autoconf/2025-05/msg00024.html>.
        * m4/gnulib-common.m4 (gl_CHECK_FUNCS_CASE_FOR_MACOS): Temporarily set
        ac_c_future_darwin_options, ac_cxx_future_darwin_options to empty for
        the second AC_CHECK_DECL invocation.

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index a07c7dd5a8..76a8a323fb 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1571,13 +1571,25 @@ AC_DEFUN([gl_CHECK_FUNCS_CASE_FOR_MACOS]
              if test $[ac_cv_func_][$1] = yes; then
                [gl_cv_onwards_func_][$1]=yes
              else
+               dnl This is a bit complicated, because here we need the 
behaviour
+               dnl of AC_CHECK_DECL before the
+               dnl commit e1bbc9b93cdff61d70719c224b37970e065008bb 
(2025-05-26).
+               [ac_cv_have_decl_][$1][_saved]="$[ac_cv_have_decl_][$1]"
                unset [ac_cv_have_decl_][$1]
+               ac_c_future_darwin_options_saved="$ac_c_future_darwin_options"
+               
ac_cxx_future_darwin_options_saved="$ac_cxx_future_darwin_options"
+               ac_c_future_darwin_options=
+               ac_cxx_future_darwin_options=
                AC_CHECK_DECL([$1], , , [$2])
+               ac_c_future_darwin_options="$ac_c_future_darwin_options_saved"
+               
ac_cxx_future_darwin_options="$ac_cxx_future_darwin_options_saved"
                if test $[ac_cv_have_decl_][$1] = yes; then
                  [gl_cv_onwards_func_][$1]='future OS version'
                else
                  [gl_cv_onwards_func_][$1]=no
                fi
+               [ac_cv_have_decl_][$1]="$[ac_cv_have_decl_][$1][_saved]"
+               unset [ac_cv_have_decl_][$1][_saved]
              fi
            else
              AC_CHECK_FUNC([$1])




Reply via email to