vim: fix with locale support
PATCH 1/1 vim: fix with locale support
--- package/vim/Config.in | 1 + package/vim/vim-0001-fix-nls-check.patch | 120 +++++++++++++++++++++++++++ package/vim/vim.mk | 2 +- 3 files changed, 122 insertions(+), 1 deletions(-)
PATCH 1/1 vim: fix gettext check
Fixes http://autobuild.buildroot.net/results/21b5a910e6a27fa1cb12d0002ffed7e6ed9d6c83/
--- package/vim/vim-0001-fix-nls-check.patch | 120 +++++++++++++++++++++++++++ 1 files changed, 120 insertions(+), 0 deletions(-)
package/vim/vim-0001-fix-nls-check.patch new file +120 -0
@@ -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 <[email protected]> +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
PATCH 1/1 vim: fix gettext check
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas De Schampheleire <[email protected]> writes:
Fixes http://autobuild.buildroot.net/results/21b5a910e6a27fa1cb12d0002ffed7e6ed9d6c83/
Signed-off-by Thomas De Schampheleire <[email protected]>
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 vim: add dependency to gettext if locale support is requested
In reply to Thomas De SchampheleireUntil now, if locale support was requested, vim would be built with NLS or not depending on the build order. This patch now makes the dependency explicit.
--- package/vim/Config.in | 1 + package/vim/vim.mk | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
package/vim/Config.in +1 -0
@@ -2,6 +2,7 @@ config BR2_PACKAGE_VIM bool "vim" depends on BR2_USE_MMU # uses fork() select BR2_PACKAGE_NCURSES + select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT_IF_LOCALE help VIM Text editor
package/vim/vim.mk +1 -1
@@ -8,7 +8,7 @@ VIM_SITE = https://vim.googlecode.com/hg VIM_SITE_METHOD = hg # 7.3 release patchlevel 762 VIM_VERSION = 699f8d8f096d -VIM_DEPENDENCIES = ncurses +VIM_DEPENDENCIES = ncurses $(if $(BR2_NEEDS_GETTEXT_IF_LOCALE),gettext) VIM_SUBDIR = src VIM_CONF_ENV = vim_cv_toupper_broken=no \ vim_cv_terminfo=yes \
PATCH 1/1 vim: add dependency to gettext if locale support is requested
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas De Schampheleire <[email protected]> writes:
Until now, if locale support was requested, vim would be built with NLS or not depending on the build order. This patch now makes the dependency explicit.
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard