1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

i18n: Define `nl_item' when it's not available (needed for Cygwin).

* configure.ac: Add check for `nl_item'.

* libguile/i18n.c: Separate check for `HAVE_LANGINFO_H' and
  `HAVE_NL_TYPES_H'.
  [!HAVE_NL_ITEM]: Define `nl_item'.
This commit is contained in:
Ludovic Courtès 2010-02-16 20:46:49 +01:00
parent 2b386ab09f
commit 56d288b844
2 changed files with 21 additions and 2 deletions

View file

@ -671,6 +671,16 @@ sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
direct.h langinfo.h nl_types.h machine/fpu.h])
# Reasons for testing:
# nl_item - lacking on Cygwin
AC_CHECK_TYPES([nl_item], [], [],
[[#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
#ifdef HAVE_NL_TYPES_H
# include <nl_types.h>
#endif]])
# "complex double" is new in C99, and "complex" is only a keyword if
# <complex.h> is included
AC_CHECK_TYPES(complex double,,,

View file

@ -59,10 +59,16 @@
#include "libguile/posix.h" /* for `scm_i_locale_mutex' */
#if (defined HAVE_LANGINFO_H) && (defined HAVE_NL_TYPES_H)
#ifdef HAVE_LANGINFO_H
# include <langinfo.h>
#endif
#ifdef HAVE_NL_TYPES_H
# include <nl_types.h>
#endif
#ifndef HAVE_NL_ITEM
/* Cygwin has <langinfo.h> but lacks <nl_types.h> and `nl_item'. */
typedef int nl_item;
#endif
#ifndef HAVE_SETLOCALE
static inline char *
@ -1459,7 +1465,10 @@ SCM_DEFINE (scm_locale_string_to_inexact, "locale-string->inexact",
setting of the current locale. If nl_langinfo supports CODESET,
we can convert the string properly using scm_from_stringn. If
CODESET is not supported, we won't be able to make much sense of
the returned string. */
the returned string.
Note: We don't use Gnulib's `nl_langinfo' module because it's currently not
as complete as the compatibility hacks in `i18n.scm'. */
SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,