All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1 of 2 for-2013.11] vim: fix gettext check
Date: Tue, 19 Nov 2013 12:15:49 +0100	[thread overview]
Message-ID: <ce400fba8b71790cc45f.1384859749@argentina> (raw)
In-Reply-To: <patchbomb.1384859748@argentina>

Fixes http://autobuild.buildroot.net/results/21b5a910e6a27fa1cb12d0002ffed7e6ed9d6c83/

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
 package/vim/vim-0001-fix-nls-check.patch |  120 +++++++++++++++++++++++++++
 1 files changed, 120 insertions(+), 0 deletions(-)

diff --git a/package/vim/vim-0001-fix-nls-check.patch b/package/vim/vim-0001-fix-nls-check.patch
new file mode 100644
--- /dev/null
+++ b/package/vim/vim-0001-fix-nls-check.patch
@@ -0,0 +1,120 @@
+configure: use minimal LIBS during gettext check
+
+In some configurations, vim fails to link correctly with messages such as:
+edit.c:(.text+0x1614): undefined reference to `libintl_gettext'
+
+In particular, this has been seen by the buildroot autobuilds (see [1]) but
+has also been reported at [2] and [3].
+
+In the bad case, the configure script says:
+checking for NLS... gettext() works
+In the good case, it says:
+checking for NLS... gettext() works with -lintl
+
+In the bad case, the system has libelf, vim detects that and takes it along
+in $LIBS. Libelf needs libintl on this system, and so linking the test
+program with -lelf will automatically take -lintl too. This causes configure
+to think gettext() does not need libintl, while in reality it does.
+
+In the good case, libelf is not present and thus not used. The first
+configure test for gettext fails, and then configure retries with -lintl
+(which succeeds).
+
+Until now, there isn't really a problem. In both cases, you could link
+correctly. In the 'bad' case, libintl is implicitly taken through libelf, in
+the second case it is explicitly taken.
+
+The real problem occurs because configure also tests whether the linker
+supports --as-needed and uses it when possible, instead of the link.sh
+script. However, --as-needed seems to cause libintl NOT to be taken in the
+bad case, causing the undefined references to libintl_gettext.
+
+This patch changes the configure script so that the gettext check does not
+use additional libraries such as libelf. The test program is linked either
+with nothing, or with libintl alone. This will cause libintl to
+be added explicitly to LIBS, when needed.
+
+[1] http://autobuild.buildroot.net/results/21b5a910e6a27fa1cb12d0002ffed7e6ed9d6c83/
+[2] http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-November/243930.html
+[3] http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-May/234184.html
+
+
+Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
+Upstream-status: accepted (http://article.gmane.org/gmane.editors.vim.devel/43528)
+
+---
+ src/auto/configure |  11 ++++++-----
+ src/configure.in   |  13 +++++++++----
+ 2 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/src/auto/configure b/src/auto/configure
+--- a/src/auto/configure
++++ b/src/auto/configure
+@@ -12271,6 +12271,8 @@ fi
+   if test -f po/Makefile; then
+     have_gettext="no"
+     if test -n "$MSGFMT"; then
++      olibs=$LIBS
++      LIBS=""
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <libintl.h>
+@@ -12284,10 +12286,9 @@ gettext("Test");
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: gettext() works" >&5
+-$as_echo "gettext() works" >&6; }; have_gettext="yes"
+-else
+-  olibs=$LIBS
+-	  LIBS="$LIBS -lintl"
++$as_echo "gettext() works" >&6; }; have_gettext="yes"; LIBS=$olibs;
++else
++	  LIBS="-lintl"
+ 	  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <libintl.h>
+@@ -12301,7 +12302,7 @@ gettext("Test");
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: gettext() works with -lintl" >&5
+-$as_echo "gettext() works with -lintl" >&6; }; have_gettext="yes"
++$as_echo "gettext() works with -lintl" >&6; }; have_gettext="yes"; LIBS="$olibs -lintl";
+ else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: gettext() doesn't work" >&5
+ $as_echo "gettext() doesn't work" >&6; };
+diff --git a/src/configure.in b/src/configure.in
+--- a/src/configure.in
++++ b/src/configure.in
+@@ -3484,6 +3484,9 @@ if test "$MANDEF" = "man -s"; then
+ fi
+ 
+ dnl Check if gettext() is working and if it needs -lintl
++dnl We take care to base this on an empty LIBS: on some systems libelf would be
++dnl in LIBS and implicitly take along libintl. The final LIBS would then not
++dnl contain libintl, and the link step would fail due to -Wl,--as-needed.
+ AC_MSG_CHECKING(--disable-nls argument)
+ AC_ARG_ENABLE(nls,
+ 	[  --disable-nls           Don't support NLS (gettext()).], ,
+@@ -3502,16 +3505,18 @@ if test "$enable_nls" = "yes"; then
+   if test -f po/Makefile; then
+     have_gettext="no"
+     if test -n "$MSGFMT"; then
++      olibs=$LIBS
++      LIBS=""
+       AC_TRY_LINK(
+ 	[#include <libintl.h>],
+ 	[gettext("Test");],
+-	AC_MSG_RESULT([gettext() works]); have_gettext="yes",
+-	  olibs=$LIBS
+-	  LIBS="$LIBS -lintl"
++	AC_MSG_RESULT([gettext() works]); have_gettext="yes"; LIBS=$olibs,
++	  LIBS="-lintl"
+ 	  AC_TRY_LINK(
+ 	      [#include <libintl.h>],
+ 	      [gettext("Test");],
+-	      AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes",
++	      AC_MSG_RESULT([gettext() works with -lintl]); have_gettext="yes";
++	      LIBS="$olibs -lintl",
+ 	      AC_MSG_RESULT([gettext() doesn't work]);
+ 	      LIBS=$olibs))
+     else

  reply	other threads:[~2013-11-19 11:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 11:15 [Buildroot] [PATCH 0 of 2 for-2013.11] vim: fix with locale support Thomas De Schampheleire
2013-11-19 11:15 ` Thomas De Schampheleire [this message]
2013-11-19 12:28   ` [Buildroot] [PATCH 1 of 2 for-2013.11] vim: fix gettext check Peter Korsgaard
2013-11-19 11:15 ` [Buildroot] [PATCH 2 of 2 for-2013.11] vim: add dependency to gettext if locale support is requested Thomas De Schampheleire
2013-11-19 12:29   ` Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce400fba8b71790cc45f.1384859749@argentina \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.