0002-configure-check-for-the-stdatomic.h-header-in-config.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From a68074b5db2a1fb637853b808e5b263c2ce9cbdd Mon Sep 17 00:00:00 2001
  2. From: Daniel Stenberg <daniel@haxx.se>
  3. Date: Tue, 28 Jun 2022 08:37:22 +0200
  4. Subject: [PATCH] configure: check for the stdatomic.h header in configure
  5. ... and only set HAVE_ATOMIC if that header exists since we use
  6. typedefes set in it.
  7. Reported-by: Ryan Schmidt
  8. Fixes #9059
  9. Closes #9060
  10. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
  11. ---
  12. Upstream status: commit a68074b5db2a1fb637853b808e5b263c2ce9cbdd
  13. m4/curl-functions.m4 | 36 +++++++++++++++++++-----------------
  14. 1 file changed, 19 insertions(+), 17 deletions(-)
  15. diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
  16. index ec406f56aed8..f3e12a53a9fd 100644
  17. --- a/m4/curl-functions.m4
  18. +++ b/m4/curl-functions.m4
  19. @@ -6570,24 +6570,26 @@ AC_DEFUN([CURL_COVERAGE],[
  20. ])
  21. dnl CURL_ATOMIC
  22. -dnl --------------------------------------------------
  23. -dnl Check if _Atomic works
  24. +dnl -------------------------------------------------------------
  25. +dnl Check if _Atomic works. But only check if stdatomic.h exists.
  26. dnl
  27. AC_DEFUN([CURL_ATOMIC],[
  28. - AC_MSG_CHECKING([if _Atomic is available])
  29. - AC_COMPILE_IFELSE([
  30. - AC_LANG_PROGRAM([[
  31. - $curl_includes_unistd
  32. - ]],[[
  33. - _Atomic int i = 0;
  34. - ]])
  35. - ],[
  36. - AC_MSG_RESULT([yes])
  37. - AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
  38. - [Define to 1 if you have _Atomic support.])
  39. - tst_atomic="yes"
  40. - ],[
  41. - AC_MSG_RESULT([no])
  42. - tst_atomic="no"
  43. + AC_CHECK_HEADERS(stdatomic.h, [
  44. + AC_MSG_CHECKING([if _Atomic is available])
  45. + AC_COMPILE_IFELSE([
  46. + AC_LANG_PROGRAM([[
  47. + $curl_includes_unistd
  48. + ]],[[
  49. + _Atomic int i = 0;
  50. + ]])
  51. + ],[
  52. + AC_MSG_RESULT([yes])
  53. + AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
  54. + [Define to 1 if you have _Atomic support.])
  55. + tst_atomic="yes"
  56. + ],[
  57. + AC_MSG_RESULT([no])
  58. + tst_atomic="no"
  59. + ])
  60. ])
  61. ])
  62. --
  63. 2.35.1