diff mbox series

[scarthgap,05/22] gawk: fix readline detection

Message ID b97aa1c3488b8f6aeb8e25f4ce810babc46a3ce5.1718625680.git.steve@sakoman.com
State Accepted
Delegated to: Steve Sakoman
Headers show
Series [scarthgap,01/22] yocto-uninative: Update to 4.5 for gcc 14 | expand

Commit Message

Steve Sakoman June 17, 2024, 12:04 p.m. UTC
From: Ross Burton <ross.burton@arm.com>

The code fragment used to detect readline in cross builds doesn't compile
cleanly with GCC 14.1, so readline is never enabled.

Add missing includes so the test works, and readline can be enabled.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a6e7c3ce700b82c57f1102187fea6b387339eca3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 ...001-m4-readline-add-missing-includes.patch | 38 +++++++++++++++++++
 meta/recipes-extended/gawk/gawk_5.3.0.bb      |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-extended/gawk/gawk/0001-m4-readline-add-missing-includes.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/gawk/gawk/0001-m4-readline-add-missing-includes.patch b/meta/recipes-extended/gawk/gawk/0001-m4-readline-add-missing-includes.patch
new file mode 100644
index 0000000000..5be2fd97ee
--- /dev/null
+++ b/meta/recipes-extended/gawk/gawk/0001-m4-readline-add-missing-includes.patch
@@ -0,0 +1,38 @@ 
+From 4f4e84f139e2a8682f1374a592f2636c43ad857b Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Tue, 21 May 2024 15:10:11 +0000
+Subject: [PATCH] m4/readline: add missing includes
+
+The cross-specific code fragment only includes stdio.h, where the native
+fragment also includes fcntl.h and unistd.h.  This is important because
+GCC 14.1 has made the implicit definitions an error:
+
+conftest.c: In function 'main':
+conftest.c:144:9: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
+conftest.c:146:14: error: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration]
+
+Add the missing includes so that the check doesn't always fail due to
+these errors.
+
+Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-gawk/2024-05/msg00000.html]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ m4/readline.m4 | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/m4/readline.m4 b/m4/readline.m4
+index 38f96326..efd52d4e 100644
+--- a/m4/readline.m4
++++ b/m4/readline.m4
+@@ -66,6 +66,8 @@ dnl action if false:
+ dnl action if cross compiling:
+ 		[AC_LINK_IFELSE(
+ 			[AC_LANG_PROGRAM([[#include <stdio.h>
++#include <fcntl.h>
++#include <unistd.h>
+ #include <readline/readline.h>
+ #include <readline/history.h>]],		dnl includes
+ 			dnl function body
+-- 
+2.34.1
+
diff --git a/meta/recipes-extended/gawk/gawk_5.3.0.bb b/meta/recipes-extended/gawk/gawk_5.3.0.bb
index d7a0fc616d..e94cf19db4 100644
--- a/meta/recipes-extended/gawk/gawk_5.3.0.bb
+++ b/meta/recipes-extended/gawk/gawk_5.3.0.bb
@@ -16,6 +16,7 @@  PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
 PACKAGECONFIG[mpfr] = "--with-mpfr,--without-mpfr, mpfr"
 
 SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
+           file://0001-m4-readline-add-missing-includes.patch \
            file://run-ptest \
            "