0003-m4-ccforbuild.m4-include-stdlib.h-in-test-program.patch 1.6 KB

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