0003-configure-invert-condition-for-strtoimax-builtin.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 754e0d1edc1c01b18f4890de7c58f7610e589d76 Mon Sep 17 00:00:00 2001
  2. From: Vincent Fazio <vfazio@gmail.com>
  3. Date: Tue, 7 Feb 2023 03:55:28 -0600
  4. Subject: [PATCH] configure: invert condition for strtoimax builtin
  5. Previously, bash would attempt to build a replacement for strtoimax if
  6. it found that the C library had the function already declared.
  7. This caused build errors when linking against static libraries that did
  8. not define the function as a weak alias but, in reality, was a logic
  9. error since bash should only provide it's own implementation if one is
  10. not provided by the C library.
  11. Now, fix this by inverting the logic.
  12. Upstream:
  13. https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=43e861c2cd840946a81dfd0386966eb4f3a17ce9
  14. Signed-off-by: Vincent Fazio <vfazio@gmail.com>
  15. [yann.morin.1998@free.fr: patch configure after the m file]
  16. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
  17. ---
  18. configure | 6 +++++-
  19. m4/strtoimax.m4 | 5 ++++-
  20. 2 files changed, 9 insertions(+), 2 deletions(-)
  21. diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
  22. index 30985723..fa43ac7b 100644
  23. --- a/m4/strtoimax.m4
  24. +++ b/m4/strtoimax.m4
  25. @@ -29,7 +29,10 @@ AC_CACHE_VAL(bash_cv_func_strtoimax,
  26. fi
  27. ])
  28. AC_MSG_RESULT($bash_cv_func_strtoimax)
  29. -if test $bash_cv_func_strtoimax = yes; then
  30. +if test "$ac_cv_have_decl_strtoimax" = "yes" ; then
  31. +AC_DEFINE([HAVE_DECL_STRTOIMAX], [1])
  32. +fi
  33. +if test $bash_cv_func_strtoimax = no; then
  34. AC_LIBOBJ(strtoimax)
  35. fi
  36. ])
  37. diff --git a/configure b/configure
  38. index 47313753..6039cee7 100755
  39. --- a/configure
  40. +++ b/configure
  41. @@ -20443,7 +20443,11 @@ fi
  42. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $bash_cv_func_strtoimax" >&5
  43. printf "%s\n" "$bash_cv_func_strtoimax" >&6; }
  44. -if test $bash_cv_func_strtoimax = yes; then
  45. +if test "$ac_cv_have_decl_strtoimax" = "yes" ; then
  46. +printf "%s\n" "#define HAVE_DECL_STRTOIMAX 1" >>confdefs.h
  47. +
  48. +fi
  49. +if test $bash_cv_func_strtoimax = no; then
  50. case " $LIBOBJS " in
  51. *" strtoimax.$ac_objext "* ) ;;
  52. *) LIBOBJS="$LIBOBJS strtoimax.$ac_objext"
  53. --
  54. 2.25.1