From: Bruno Haible Date: Tue, 3 May 2005 10:37:26 +0000 (+0000) Subject: Add support for glibc's new NL_LOCALE_NAME macro. X-Git-Tag: v0.15~539 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4cc049f775f58d5dc7b2ab26273c1b4e0143ff8;p=thirdparty%2Fgettext.git Add support for glibc's new NL_LOCALE_NAME macro. --- diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index f5a8915b1..8cb5ec88d 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -87,6 +87,10 @@ extern int errno; # include #endif +#if !defined _LIBC && HAVE_NL_LOCALE_NAME +# include +#endif + #include "gettextP.h" #include "plural-exp.h" #ifdef _LIBC @@ -217,7 +221,7 @@ static void *mempcpy (void *dest, const void *src, size_t n); #endif /* Whether to support different locales in different threads. */ -#if defined _LIBC || (HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS) +#if defined _LIBC || HAVE_NL_LOCALE_NAME || (HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS) # define HAVE_PER_THREAD_LOCALE #endif @@ -510,7 +514,11 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, # ifdef _LIBC localename = __current_locale_name (category); # else -# if HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS +# if HAVE_NL_LOCALE_NAME + /* NL_LOCALE_NAME is public glibc API introduced in glibc-2.4. */ + localename = nl_langinfo (NL_LOCALE_NAME (category)); +# else +# if HAVE_STRUCT___LOCALE_STRUCT___NAMES && defined USE_IN_GETTEXT_TESTS /* The __names field is not public glibc API and must therefore not be used in code that is installed in public locations. */ { @@ -520,6 +528,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, else localename = ""; } +# endif # endif # endif search->localename = localename; diff --git a/gettext-runtime/m4/gettext.m4 b/gettext-runtime/m4/gettext.m4 index 624a80785..c0caa41b4 100644 --- a/gettext-runtime/m4/gettext.m4 +++ b/gettext-runtime/m4/gettext.m4 @@ -1,4 +1,4 @@ -# gettext.m4 serial 37 (gettext-0.14.4) +# gettext.m4 serial 38 (gettext-0.15) dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -444,6 +444,19 @@ __fsetlocking]) gt_LC_MESSAGES fi + dnl glibc >= 2.4 has a NL_LOCALE_NAME macro when _GNU_SOUURCE is defined, + dnl and a _NL_LOCALE_NAME macro always. + AC_CACHE_CHECK([for NL_LOCALE_NAME macro], gt_cv_nl_locale_name, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(_NL_LOCALE_NAME(LC_MESSAGES));], + gt_cv_nl_locale_name=yes, + gt_cv_nl_locale_name=no) + ]) + if test $gt_cv_nl_locale_name = yes; then + AC_DEFINE(HAVE_NL_LOCALE_NAME, 1, + [Define if you have and it defines the NL_LOCALE_NAME macro if _GNU_SOUURCE is defined.]) + fi + if test -n "$INTL_MACOSX_LIBS"; then CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" fi