From ee85acd70c1998851f7aa3a8fc8c533939b0df8b Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Wed, 24 Apr 2024 19:59:48 +0200
Subject: [PATCH] Fix warnings triggered by including <config.h> twice (regr.
 2024-04-19).

Reported by Collin Funk in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00398.html>.

* m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Use AH_VERBATIM instead
of AC_DEFINE.
---
 ChangeLog        | 10 +++++++++-
 m4/extensions.m4 | 11 ++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a5b5544b85..a63ddaeae1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,17 @@
+2024-04-24  Bruno Haible  <bruno@clisp.org>
+
+	Fix warnings triggered by including <config.h> twice (regr. 2024-04-19).
+	Reported by Collin Funk in
+	<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00398.html>.
+	* m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Use AH_VERBATIM instead
+	of AC_DEFINE.
+
 2024-04-23  Paul Eggert  <eggert@cs.ucla.edu>
 
 	manywarnings: update C warnings for GCC 14
 	Adjust for C programs compiled by GCC 14.
 	(A C++ expert still needs to look at manywarnings-c++.m4.)
-	* build-aux/gcc-warning.spec: Add warnings introduced in GCC 13.
+	* build-aux/gcc-warning.spec: Add warnings introduced in GCC 14.
 	* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC):
 	Add -Wflex-array-member-not-at-end, -Wmissing-variable-declarations.
 
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index fae4141358..1fb68956b3 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,5 +1,5 @@
 # extensions.m4
-# serial 24  -*- Autoconf -*-
+# serial 25  -*- Autoconf -*-
 dnl Copyright (C) 2003, 2006-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,
@@ -234,6 +234,11 @@ AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
   dnl On OpenSolaris derivatives, the include files contains a couple of
   dnl declarations that are only activated with an explicit
   dnl -D__STDC_WANT_LIB_EXT1__.
-  AC_DEFINE([__STDC_WANT_LIB_EXT1__], [1],
-    [Define to enable the declarations of ISO C 23 Annex K types and functions.])
+  AH_VERBATIM([USE_ISO_C_23_ANNEX_K_EXTENSIONS],
+[/* Define to enable the declarations of ISO C 23 Annex K types and functions.  */
+#if !(defined __STDC_WANT_LIB_EXT1__ && __STDC_WANT_LIB_EXT1__)
+#undef/**/__STDC_WANT_LIB_EXT1__
+#define __STDC_WANT_LIB_EXT1__ 1
+#endif
+])
 ])
-- 
2.39.5