Re: [PATCH] getopt-posix: port better to Alpine 3.20.0_rc1

2024-05-21 Thread Collin Funk
On 5/21/24 10:10 AM, Paul Eggert wrote:
> Sometimes I wish 'bootstrap' and 'configure' were less chatty.

+1, but I can't think of a way to do so without hiding bugs.

Usually I just redirect it to a file since it is easier to read there.

Collin



Re: [PATCH] getopt-posix: port better to Alpine 3.20.0_rc1

2024-05-21 Thread Paul Eggert

On 2024-05-21 09:34, Bruno Haible wrote:

configure.ac:43: warning: AC_REQUIRE: 'gl_CHECK_HEADER_SYS_CDEFS_H' was 
expanded before it was required
configure.ac:43:https://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required


Thanks, I had missed that in all the 'bootstrap' output. I updated 
diffutils to use the latest gnulib.


Sometimes I wish 'bootstrap' and 'configure' were less chatty.



Re: [PATCH] getopt-posix: port better to Alpine 3.20.0_rc1

2024-05-21 Thread Bruno Haible
Paul Eggert wrote:
> + * m4/getopt.m4 (gl_GETOPT_SUBSTITUTE_HEADER):
> + * m4/sched_h.m4 (gl_SCHED_H): Use the new macro
> + gl_CHECK_HEADER_SYS_CDEFS_H instead of checking independently.
> + * m4/sys_cdefs_h.m4: New file.

Running './bootstrap' in diffutils, I see a warning:

autoreconf: running: /darch/x86_64-linux-gnu/gnu/bin/autoconf --include=m4 
--force
configure.ac:43: warning: AC_REQUIRE: 'gl_CHECK_HEADER_SYS_CDEFS_H' was 
expanded before it was required
configure.ac:43: 
https://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required
m4/gnulib-comp.m4:699: gl_INIT is expanded from...
configure.ac:43: the top level

This patch fixes it.


2024-05-21  Bruno Haible  

Fix "'gl_CHECK_HEADER_SYS_CDEFS_H' was expanded before it was required".
* m4/sys_cdefs_h.m4 (gl_CHECK_HEADER_SYS_CDEFS_H): Define through
AC_DEFUN_ONCE.

diff --git a/m4/sys_cdefs_h.m4 b/m4/sys_cdefs_h.m4
index 069146d438..22fa6c3849 100644
--- a/m4/sys_cdefs_h.m4
+++ b/m4/sys_cdefs_h.m4
@@ -1,5 +1,5 @@
 # sys_cdefs_h.m4 - Is  compatible enough with glibc?
-# serial 1
+# serial 2
 dnl Copyright 2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,7 +7,7 @@
 
 dnl Written by Paul Eggert.
 
-AC_DEFUN([gl_CHECK_HEADER_SYS_CDEFS_H],
+AC_DEFUN_ONCE([gl_CHECK_HEADER_SYS_CDEFS_H],
   [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h],
  [gl_cv_header_sys_cdefs_h],
  [AC_COMPILE_IFELSE(






[PATCH] getopt-posix: port better to Alpine 3.20.0_rc1

2024-05-20 Thread Paul Eggert
Alpine’s  is a stub that issues a deprecation #warning.
* m4/getopt.m4 (gl_GETOPT_SUBSTITUTE_HEADER):
* m4/sched_h.m4 (gl_SCHED_H): Use the new macro
gl_CHECK_HEADER_SYS_CDEFS_H instead of checking independently.
* m4/sys_cdefs_h.m4: New file.
* modules/getopt-posix, modules/sched (Files): Add m4/sys_cdefs_h.m4.
---
 ChangeLog| 10 ++
 m4/getopt.m4 | 11 ++-
 m4/sched_h.m4| 12 +++-
 m4/sys_cdefs_h.m4| 25 +
 modules/getopt-posix |  1 +
 modules/sched|  1 +
 6 files changed, 42 insertions(+), 18 deletions(-)
 create mode 100644 m4/sys_cdefs_h.m4

diff --git a/ChangeLog b/ChangeLog
index dd5b0c4c66..2e82a08042 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-05-20  Paul Eggert  
+
+   getopt-posix: port better to Alpine 3.20.0_rc1
+   Alpine’s  is a stub that issues a deprecation #warning.
+   * m4/getopt.m4 (gl_GETOPT_SUBSTITUTE_HEADER):
+   * m4/sched_h.m4 (gl_SCHED_H): Use the new macro
+   gl_CHECK_HEADER_SYS_CDEFS_H instead of checking independently.
+   * m4/sys_cdefs_h.m4: New file.
+   * modules/getopt-posix, modules/sched (Files): Add m4/sys_cdefs_h.m4.
+
 2024-05-20  Collin Funk  
 
tests: Update expected tests results on NetBSD.
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index 297722eae4..53cab8bef9 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,5 +1,5 @@
 # getopt.m4
-# serial 49
+# serial 50
 dnl Copyright (C) 2002-2006, 2008-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -366,14 +366,7 @@ dnl is ambiguous with environment values that contain 
newlines.
 
 AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
 [
-  AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
-  if test $ac_cv_header_sys_cdefs_h = yes; then
-HAVE_SYS_CDEFS_H=1
-  else
-HAVE_SYS_CDEFS_H=0
-  fi
-  AC_SUBST([HAVE_SYS_CDEFS_H])
-
+  gl_CHECK_HEADER_SYS_CDEFS_H
   AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
 [Define to rpl_ if the getopt replacement functions and variables
  should be used.])
diff --git a/m4/sched_h.m4 b/m4/sched_h.m4
index 1e022948b5..61c202ef0c 100644
--- a/m4/sched_h.m4
+++ b/m4/sched_h.m4
@@ -1,5 +1,5 @@
 # sched_h.m4
-# serial 15
+# serial 16
 dnl Copyright (C) 2008-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -15,7 +15,8 @@ AC_DEFUN_ONCE([gl_SCHED_H],
 
   AC_REQUIRE([AC_CANONICAL_HOST])
 
-  AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
+  AC_REQUIRE([gl_CHECK_HEADER_SYS_CDEFS_H])
+
   AC_CHECK_HEADERS([sched.h], [], [],
 [[#if HAVE_SYS_CDEFS_H
#include 
@@ -57,13 +58,6 @@ AC_DEFUN_ONCE([gl_SCHED_H],
   fi
   AC_SUBST([HAVE_STRUCT_SCHED_PARAM])
 
-  if test "$ac_cv_header_sys_cdefs_h" = yes; then
-HAVE_SYS_CDEFS_H=1
-  else
-HAVE_SYS_CDEFS_H=0
-  fi
-  AC_SUBST([HAVE_SYS_CDEFS_H])
-
   dnl Ensure the type pid_t gets defined.
   AC_REQUIRE([AC_TYPE_PID_T])
 
diff --git a/m4/sys_cdefs_h.m4 b/m4/sys_cdefs_h.m4
new file mode 100644
index 00..069146d438
--- /dev/null
+++ b/m4/sys_cdefs_h.m4
@@ -0,0 +1,25 @@
+# sys_cdefs_h.m4 - Is  compatible enough with glibc?
+# serial 1
+dnl Copyright 2024 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Paul Eggert.
+
+AC_DEFUN([gl_CHECK_HEADER_SYS_CDEFS_H],
+  [AC_CACHE_CHECK([for glibc-compatible sys/cdefs.h],
+ [gl_cv_header_sys_cdefs_h],
+ [AC_COMPILE_IFELSE(
+[AC_LANG_DEFINES_PROVIDED
+ [#include 
+  enum { foo = __GNUC_PREREQ (14, 1) } bar;
+]],
+[gl_cv_header_sys_cdefs_h=yes],
+[gl_cv_header_sys_cdefs_h=no])])
+   if test "$gl_cv_header_sys_cdefs_h" = yes; then
+ HAVE_SYS_CDEFS_H=1
+   else
+ HAVE_SYS_CDEFS_H=0
+   fi
+   AC_SUBST([HAVE_SYS_CDEFS_H])])
diff --git a/modules/getopt-posix b/modules/getopt-posix
index 6305e83c8a..0b50620c4b 100644
--- a/modules/getopt-posix
+++ b/modules/getopt-posix
@@ -12,6 +12,7 @@ lib/getopt-pfx-core.h
 lib/getopt-pfx-ext.h
 lib/getopt_int.h
 m4/getopt.m4
+m4/sys_cdefs_h.m4
 
 Depends-on:
 unistd
diff --git a/modules/sched b/modules/sched
index 042aa8be04..7ce972adf7 100644
--- a/modules/sched
+++ b/modules/sched
@@ -5,6 +5,7 @@ Files:
 lib/sched.in.h
 m4/sched_h.m4
 m4/pid_t.m4
+m4/sys_cdefs_h.m4
 
 Depends-on:
 gen-header
-- 
2.45.1