Bruno Haible <[email protected]> writes:

> Hi Collin,
>
>> When running 'make check' I saw this error:
>> 
>>     modules/stdio-windows
>>     use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS in modules/
>>     make: *** [Makefile:35: sc_prefer_ac_check_funcs_once] Error 1
>> 
>> Is there any reason for stdio-windows should be treated differently?
>
> That's not relevant; it's only a syntax-check rule.
>
> What is relevant is that there are 3 occurrences of the same AC_CHECK_FUNCS
> invocation. Which can make a 'configure' script do more checking than needed:
>
> $ fgrep -r 'AC_CHECK_FUNCS([vasprintf])' .
> ./modules/stdio-windows:AC_CHECK_FUNCS([vasprintf])
> ./m4/vasprintf.m4:  AC_CHECK_FUNCS([vasprintf])
> ./m4/vasprintf-posix.m4:  AC_CHECK_FUNCS([vasprintf])
>
>> I assume not so I have attached the patch that fixes it, but I don't know
>> much about this module so figured I should ask before pushing.
>
> You are welcome to change all 3 occurrences to use AC_CHECK_FUNCS_ONCE.

Thanks for the review. I pushed the attached patch with those changes.

Collin

>From 7dcb0a5b6c4b37aa89dbfc989ad3fc3682b384b1 Mon Sep 17 00:00:00 2001
Message-ID: <7dcb0a5b6c4b37aa89dbfc989ad3fc3682b384b1.1774057732.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Fri, 20 Mar 2026 18:43:34 -0700
Subject: [PATCH] vasprintf-posix, vasprintf, stdio-windows: Prefer
 AC_CHECK_FUNCS_ONCE.

* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Use
AC_CHECK_FUNCS_ONCE instead of AC_CHECK_FUNCS.
* m4/vasprintf.m4 (gl_FUNC_VASPRINTF): Likewise.
* modules/stdio-windows: Likewise.
---
 ChangeLog             | 8 ++++++++
 m4/vasprintf-posix.m4 | 4 ++--
 m4/vasprintf.m4       | 4 ++--
 modules/stdio-windows | 2 +-
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0119962b0e..f041f6ee67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-03-20  Collin Funk  <[email protected]>
+
+	vasprintf-posix, vasprintf, stdio-windows: Prefer AC_CHECK_FUNCS_ONCE.
+	* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Use
+	AC_CHECK_FUNCS_ONCE instead of AC_CHECK_FUNCS.
+	* m4/vasprintf.m4 (gl_FUNC_VASPRINTF): Likewise.
+	* modules/stdio-windows: Likewise.
+
 2026-03-20  Paul Eggert  <[email protected]>
 
 	byteswap: depend on stdbit-h, not stdint-h
diff --git a/m4/vasprintf-posix.m4 b/m4/vasprintf-posix.m4
index c88e7e4ad3..b31f3e8fd5 100644
--- a/m4/vasprintf-posix.m4
+++ b/m4/vasprintf-posix.m4
@@ -1,5 +1,5 @@
 # vasprintf-posix.m4
-# serial 21
+# serial 22
 dnl Copyright (C) 2007-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,7 +41,7 @@ AC_DEFUN([gl_FUNC_VASPRINTF_IS_POSIX]
   AC_REQUIRE([gl_PRINTF_PRECISION])
   AC_REQUIRE([gl_PRINTF_ENOMEM])
   gl_cv_func_vasprintf_posix=no
-  AC_CHECK_FUNCS([vasprintf])
+  AC_CHECK_FUNCS_ONCE([vasprintf])
   case "$gl_cv_func_printf_sizes_c99" in
     *yes)
       case "$gl_cv_func_printf_sizes_c23" in
diff --git a/m4/vasprintf.m4 b/m4/vasprintf.m4
index 3e6913e280..30a670d4be 100644
--- a/m4/vasprintf.m4
+++ b/m4/vasprintf.m4
@@ -1,5 +1,5 @@
 # vasprintf.m4
-# serial 6
+# serial 7
 dnl Copyright (C) 2002-2003, 2006-2007, 2009-2026 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -9,7 +9,7 @@
 
 AC_DEFUN([gl_FUNC_VASPRINTF],
 [
-  AC_CHECK_FUNCS([vasprintf])
+  AC_CHECK_FUNCS_ONCE([vasprintf])
   if test $ac_cv_func_vasprintf = no; then
     gl_REPLACE_VASPRINTF
   fi
diff --git a/modules/stdio-windows b/modules/stdio-windows
index 8cbca1be1b..9a18fe58d1 100644
--- a/modules/stdio-windows
+++ b/modules/stdio-windows
@@ -23,7 +23,7 @@ case "$host_os" in
     ;;
 esac
 gl_CONDITIONAL([GL_COND_OBJ_STDIO_CONSOLESAFE], [test $USES_MSVCRT = 1])
-AC_CHECK_FUNCS([vasprintf])
+AC_CHECK_FUNCS_ONCE([vasprintf])
 
 Makefile.am:
 if GL_COND_OBJ_STDIO_CONSOLESAFE
-- 
2.53.0

Reply via email to