0001-configure.ac-Properly-check-for-libintl.patch 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 01da08fd60a0bdb2994f85f943dba148d9321d4d Mon Sep 17 00:00:00 2001
  2. From: Vadim Kochan <vadim4j@gmail.com>
  3. Date: Wed, 17 Apr 2019 01:25:40 +0300
  4. Subject: [PATCH 1/1] configure.ac: Properly check for libintl
  5. Some libc implementations like uclibc or musl provides
  6. gettext stubs via libintl library but this case is not checked
  7. by AC_CHECK_LIBRARY(c, gettext ...) because gcc has gettext as builtin
  8. which passess the check.
  9. So check it with included libintl.h where gettext may unfold into
  10. libintl_gettext which will cause check to fail if libintl_gettext are
  11. needed to be linked with -lintl.
  12. Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
  13. ---
  14. configure.ac | 16 +++++++++++++---
  15. 1 file changed, 13 insertions(+), 3 deletions(-)
  16. diff --git a/configure.ac b/configure.ac
  17. index 7f84151..0b8e25f 100644
  18. --- a/configure.ac
  19. +++ b/configure.ac
  20. @@ -762,9 +762,19 @@ AC_CHECK_LIB([c], [basename],
  21. GIT_CONF_SUBST([NEEDS_LIBGEN])
  22. test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen"
  23. -AC_CHECK_LIB([c], [gettext],
  24. -[LIBC_CONTAINS_LIBINTL=YesPlease],
  25. -[LIBC_CONTAINS_LIBINTL=])
  26. +AC_DEFUN([LIBINTL_SRC], [
  27. +AC_LANG_PROGRAM([[
  28. +#include <libintl.h>
  29. +]],[[
  30. +char *msg = gettext("test");
  31. +]])])
  32. +
  33. +AC_MSG_CHECKING([if libc contains libintl])
  34. +AC_LINK_IFELSE([LIBINTL_SRC],
  35. + [AC_MSG_RESULT([yes])
  36. + LIBC_CONTAINS_LIBINTL=YesPlease],
  37. + [AC_MSG_RESULT([no])
  38. + LIBC_CONTAINS_LIBINTL=])
  39. GIT_CONF_SUBST([LIBC_CONTAINS_LIBINTL])
  40. #
  41. --
  42. 2.14.1