i18n: Define `nl_item' when it's not available (needed for Cygwin).
authorLudovic Courtès <ludo@gnu.org>
Tue, 16 Feb 2010 19:46:49 +0000 (20:46 +0100)
committerLudovic Courtès <ludo@gnu.org>
Tue, 16 Feb 2010 19:57:13 +0000 (20:57 +0100)
* 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'.

configure.ac
libguile/i18n.c

index 35e902c..9397882 100644 (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,,,
index b381b05..d8e2c3c 100644 (file)
 
 #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,