buildroot/package/bcusdk/0003-m4-ccforbuild.m4-include-stdlib.h-in-test-program.patch
Thomas Petazzoni e4109c1d2d package/bcusdk: fix build with host GCC 14.x
With GCC 14.x as the host compiler, bcusdk fails to build as follows:

configure: error: Specified CC_FOR_BUILD doesn't seem to work

This is due to missing includes in the test programs used in the
configure script to check the host compiler. We fix this with patch
0003.

However, this patch requires to autoreconf the package, and autoreconf
would need the definition of AM_PATH_XML2, which would require libxml2
even though we don't have libxml2 as a dependency of this package (we
don't enable the features that requires libxml2). As it turns out that
the AM_PATH_XML2 macro is in fact deprecated, we replaced it by its
equivalent using PKG_CHECK_MODULES(), which is in fact exactly how
AM_PATH_XML2 is implemented in upstream libxml2.

Fixes:

  http://autobuild.buildroot.net/results/458880bd6c207e5bb7afce1a1186f204c30c0941/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-08-02 19:50:00 +02:00

51 lines
1.6 KiB
Diff

From 1c78aa3541f730e9624504168fb0e1f413e5cbb8 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Fri, 2 Aug 2024 19:28:36 +0200
Subject: [PATCH] m4/ccforbuild.m4: include <stdlib.h> in test program
The GMP_PROG_CC_FOR_BUILD_WORKS and GMP_PROG_EXEEXT_FOR_BUILD macros
do various checks to verify if the host compiler works, but their test
programs lack the inclusion of <stdlib.h>, needed for exit(). This
causes a build failure with gcc 14.x:
conftest.c: In function 'main':
conftest.c:4:3: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
4 | exit(0);
which then causes the configure script to think that the host compiler
does not work:
configure: error: Specified CC_FOR_BUILD doesn't seem to work
so let's include <stdlib.h> to fix this issue.
Upstream: https://sourceforge.net/p/bcusdk/patches/4/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
m4/ccforbuild.m4 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/m4/ccforbuild.m4 b/m4/ccforbuild.m4
index a466cab..389deaa 100644
--- a/m4/ccforbuild.m4
+++ b/m4/ccforbuild.m4
@@ -66,6 +66,7 @@ AC_DEFUN([GMP_PROG_CC_FOR_BUILD_WORKS],
# remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF
+#include <stdlib.h>
int
main ()
{
@@ -140,6 +141,7 @@ AC_DEFUN([GMP_PROG_EXEEXT_FOR_BUILD],
AC_CACHE_CHECK([for build system executable suffix],
gmp_cv_prog_exeext_for_build,
[cat >conftest.c <<EOF
+#include <stdlib.h>
int
main ()
{
--
2.45.2