# include <sys/param.h>
#endif
+#if !defined _LIBC && HAVE_NL_LOCALE_NAME
+# include <langinfo.h>
+#endif
+
#include "gettextP.h"
#include "plural-exp.h"
#ifdef _LIBC
#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
# 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. */
{
else
localename = "";
}
+# endif
# endif
# endif
search->localename = localename;
-# 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,
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 <langinfo.h>],
+ [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 <langinfo.h> 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