diff mbox series

[1/2] gnutls: make C99 detection more resiliant

Message ID 20260305115130.914001-1-ross.burton@arm.com
State Under Review
Headers show
Series [1/2] gnutls: make C99 detection more resiliant | expand

Commit Message

Ross Burton March 5, 2026, 11:51 a.m. UTC
gnutls checks that the compiler supports C99 code by checking that the
standard being used is C99 or C11. This will fail with autoconf 2.73,
which will tell the compiler to use C23 by default.

Change the logic so that the build works with C23 by flipping the logic:
we know that C89 is less than C99, but we don't know the names of future
standards.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-support/gnutls/gnutls/c99.patch | 41 ++++++++++++++++++++
 meta/recipes-support/gnutls/gnutls_3.8.12.bb |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta/recipes-support/gnutls/gnutls/c99.patch
diff mbox series

Patch

diff --git a/meta/recipes-support/gnutls/gnutls/c99.patch b/meta/recipes-support/gnutls/gnutls/c99.patch
new file mode 100644
index 0000000000..f176c0c339
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/c99.patch
@@ -0,0 +1,41 @@ 
+From 203d8f2187bb7f483290e0f8b7b48b152b1d027f Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Thu, 5 Mar 2026 11:33:57 +0000
+Subject: [PATCH] configure: make the C99 detection more resiliant
+
+autoconf 2.73 will default to C23 by default, which means that the >C99
+detection logic in configure.ac will fail because it only handles c11
+and c99.
+
+Instead of adding c23 to the list and then breaking again in the future,
+flip the logic around (as suggested by Zack Weinberg) and check
+explicitly for just c89.
+
+Closes #1806.
+
+Upstream-Status: Submitted [https://gitlab.com/gnutls/gnutls/-/merge_requests/2081]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 740fb6339..c708d8f5e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -54,9 +54,9 @@ AC_USE_SYSTEM_EXTENSIONS
+ # Require C99 support
+ #
+ AS_CASE([$ac_prog_cc_stdc],
+-  [c11 | c99], [AC_DEFINE([C99_MACROS], 1, [C99 macros are supported])],
+-  [AC_MSG_WARN([[Compiler does not support C99. It may not be able to compile the project.]])]
+-)
++  [c89],
++  [AC_MSG_WARN([[Compiler does not support C99. It may not be able to compile the project.]])],
++  [AC_DEFINE([C99_MACROS], 1, [C99 macros are supported])])
+ 
+ AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = yes)
+ 
+-- 
+2.43.0
+
diff --git a/meta/recipes-support/gnutls/gnutls_3.8.12.bb b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
index d13a1365dc..c601d34069 100644
--- a/meta/recipes-support/gnutls/gnutls_3.8.12.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.8.12.bb
@@ -23,6 +23,7 @@  SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
            file://0001-Creating-.hmac-file-should-be-excuted-in-target-envi.patch \
            file://run-ptest \
            file://Add-ptest-support.patch \
+           file://c99.patch \
            "
 
 SRC_URI[sha256sum] = "a7b341421bfd459acf7a374ca4af3b9e06608dcd7bd792b2bf470bea012b8e51"