From 78296d4fac57bc03b93c6fade17a05c5888a4eef Mon Sep 17 00:00:00 2001 From: axel Date: Sun, 22 Jan 2006 02:02:34 +1000 Subject: [PATCH] Add autoconf test for presense of _nl_msg_cat_cntr darcs-hash:20060121160234-ac50b-e41abc6688846ab207b9b6c3143cd694f8452154.gz --- configure.ac | 19 ++++++++++++++++++- env.c | 9 +++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 7ba45b2ea..cd8392739 100644 --- a/configure.ac +++ b/configure.ac @@ -143,6 +143,7 @@ else AC_MSG_RESULT(no) fi + # Check for libraries AC_CHECK_LIB(socket, connect) AC_CHECK_LIB(rt, nanosleep) @@ -153,11 +154,27 @@ AC_CHECK_HEADERS([getopt.h termio.h sys/resource.h term.h ncurses/term.h libintl # Check for various functions, and insert results into config.h AC_CHECK_FUNCS( wcsdup wcsndup wcslen wcscasecmp wcsncasecmp gettext fwprintf ) -AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc wcstol ) +AC_CHECK_FUNCS( futimes wcwidth wcswidth getopt_long wcstok fputwc fgetwc ) +AC_CHECK_FUNCS( wcstol dcgettext ) # Check again for gettext library, and insert results into the Makefile AC_CHECK_FUNC(gettext, AC_SUBST(HAVE_GETTEXT,1), AC_SUBST(HAVE_GETTEXT,0) ) +# Check for _nl_msg_cat_cntr symbol +AC_MSG_CHECKING([for _nl_msg_cat_cntr symbol]) +AC_TRY_LINK([#if HAVE_LIBINTL_H] +[#include ] +[#endif], +[extern int _nl_msg_cat_cntr;] +[int tmp = _nl_msg_cat_cntr;], have__nl_msg_cat_cntr=yes, have__nl_msg_cat_cntr=no) +if test "$have__nl_msg_cat_cntr" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE__NL_MSG_CAT_CNTR], [1], + [Define to 1 if the _nl_msg_cat_cntr synbol is exported.]) +else + AC_MSG_RESULT(no) +fi + # Check if we have ncurses, and use it rather than curses if possible. AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])]) diff --git a/env.c b/env.c index 7948ee7e4..a396f67da 100644 --- a/env.c +++ b/env.c @@ -282,12 +282,17 @@ static void handle_locale() if( wcscmp( wsetlocale( LC_MESSAGES, (void *)0 ), old ) != 0 ) { - /* Make change known to gettext. */ + + /* Try to make change known to gettext. */ +#ifdef HAVE__NL_MSG_CAT_CNTR { extern int _nl_msg_cat_cntr; ++_nl_msg_cat_cntr; } - +#elif HAVE_DCGETTEXT + dcgettext("fish","",LC_MESSAGES); +#endif + if( is_interactive ) { complete_destroy();