langinfo, nl_langinfo: Fix for IRIX 5.3.
authorBruno Haible <bruno@clisp.org>
Fri, 10 Sep 2010 18:23:49 +0000 (20:23 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 10 Sep 2010 18:23:49 +0000 (20:23 +0200)
* m4/langinfo_h.m4 (gl_LANGINFO_H): Test whether langinfo.h defines
T_FMT_AMPM, YESEXPR. Set HAVE_LANGINFO_T_FMT_AMPM,
HAVE_LANGINFO_YESEXPR.
* modules/langinfo (Makefile.am): Substitute HAVE_LANGINFO_T_FMT_AMPM,
HAVE_LANGINFO_YESEXPR.
* lib/langinfo.in.h (T_FMT_AMPM, GNULIB_defined_T_FMT_AMPM): Define if
HAVE_LANGINFO_T_FMT_AMPM is 0.
(YESEXPR, NOEXPR, GNULIB_defined_YESEXPR): Define if
HAVE_LANGINFO_YESEXPR is 0.
* lib/nl_langinfo.c (rpl_nl_langinfo): Handle also T_FMT_AMPM, YESEXPR,
NOEXPR.
* doc/posix-headers/langinfo.texi: Mention the IRIX 5.3 problem.
* doc/posix-functions/nl_langinfo.texi: Likewise.
Reported by Eric Blake.

ChangeLog
doc/posix-functions/nl_langinfo.texi
doc/posix-headers/langinfo.texi
lib/langinfo.in.h
lib/nl_langinfo.c
m4/langinfo_h.m4
modules/langinfo

index 47613441efcb832c4bf888bb8cb128a7278055ab..16f4a21830a5ac831260d0cfe089d8c5a3aec63f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-10  Bruno Haible  <bruno@clisp.org>
+
+       langinfo, nl_langinfo: Fix for IRIX 5.3.
+       * m4/langinfo_h.m4 (gl_LANGINFO_H): Test whether langinfo.h defines
+       T_FMT_AMPM, YESEXPR. Set HAVE_LANGINFO_T_FMT_AMPM,
+       HAVE_LANGINFO_YESEXPR.
+       * modules/langinfo (Makefile.am): Substitute HAVE_LANGINFO_T_FMT_AMPM,
+       HAVE_LANGINFO_YESEXPR.
+       * lib/langinfo.in.h (T_FMT_AMPM, GNULIB_defined_T_FMT_AMPM): Define if
+       HAVE_LANGINFO_T_FMT_AMPM is 0.
+       (YESEXPR, NOEXPR, GNULIB_defined_YESEXPR): Define if
+       HAVE_LANGINFO_YESEXPR is 0.
+       * lib/nl_langinfo.c (rpl_nl_langinfo): Handle also T_FMT_AMPM, YESEXPR,
+       NOEXPR.
+       * doc/posix-headers/langinfo.texi: Mention the IRIX 5.3 problem.
+       * doc/posix-functions/nl_langinfo.texi: Likewise.
+       Reported by Eric Blake.
+
 2010-09-10  Bruno Haible  <bruno@clisp.org>
 
        pty, readutmp: Fix for FreeBSD 8.0 and OpenBSD 4.6.
index 03aaed2b71b8065d8889cf306e87fdc4002b6d72..27b8c16d9de519a9faf60b8a80ab9e1a51438ab4 100644 (file)
@@ -18,6 +18,10 @@ glibc 2.0.6, OpenBSD 3.8.
 The constants @code{ERA}, @code{ERA_D_FMT}, @code{ERA_D_T_FMT},
 @code{ERA_T_FMT}, @code{ALT_DIGITS} are not supported on some platforms:
 OpenBSD 3.8.
+@item
+The constants @code{T_FMT_AMPM}, @code{YESEXPR}, @code{NOEXPR} are not
+supported on some platforms:
+IRIX 5.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index fa48cee63e6f4efb69a8a48b86ec0dfc6d32d83d..e39f13fbcfa84def06245aa1ad17c8c3f538b034 100644 (file)
@@ -17,6 +17,10 @@ glibc 2.0.6, OpenBSD 3.8.
 The constants @code{ERA}, @code{ERA_D_FMT}, @code{ERA_D_T_FMT},
 @code{ERA_T_FMT}, @code{ALT_DIGITS} are not defined on some platforms:
 OpenBSD 3.8.
+@item
+The constants @code{T_FMT_AMPM}, @code{YESEXPR}, @code{NOEXPR} are not
+defined on some platforms:
+IRIX 5.3.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 54fa1af350dcd7e0895e78947538dcca989937a3..b79908a652ecc65d915959933c61420eef2a3c6f 100644 (file)
@@ -112,6 +112,11 @@ typedef int nl_item;
 #  define GNULIB_defined_CODESET 1
 # endif
 
+# if !@HAVE_LANGINFO_T_FMT_AMPM@
+#  define T_FMT_AMPM  10006
+#  define GNULIB_defined_T_FMT_AMPM 1
+# endif
+
 # if !@HAVE_LANGINFO_ERA@
 #  define ERA         10047
 #  define ERA_D_FMT   10048
@@ -121,6 +126,12 @@ typedef int nl_item;
 #  define GNULIB_defined_ERA 1
 # endif
 
+# if !@HAVE_LANGINFO_YESEXPR@
+#  define YESEXPR     10053
+#  define NOEXPR      10054
+#  define GNULIB_defined_YESEXPR 1
+# endif
+
 #endif
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
index e81c81e7d2b1d56d31259d33b313bc674f8c2fad..a3d0d11eb3d233648938b842b3700ace621067ce 100644 (file)
@@ -67,6 +67,10 @@ rpl_nl_langinfo (nl_item item)
         return "";
       }
 # endif
+# if GNULIB_defined_T_FMT_AMPM
+    case T_FMT_AMPM:
+      return "%I:%M:%S %p";
+# endif
 # if GNULIB_defined_ERA
     case ERA:
       /* The format is not standardized.  In glibc it is a sequence of strings
@@ -92,6 +96,12 @@ rpl_nl_langinfo (nl_item item)
       /* The format is not standardized.  In glibc it is a sequence of 10
          strings, appended in memory.  */
       return "\0\0\0\0\0\0\0\0\0\0";
+# endif
+# if GNULIB_defined_YESEXPR
+    case YESEXPR:
+      return "^[yY]";
+    case NOEXPR:
+      return "^[nN]";
 # endif
     default:
       break;
index 11a56980f7bfa3c3e0e9b4e796d444ddf03b7319..c5824c6c84bc5d7711f7d60b7a5c5f0500b4ee35 100644 (file)
@@ -1,4 +1,4 @@
-# langinfo_h.m4 serial 6
+# langinfo_h.m4 serial 7
 dnl Copyright (C) 2009-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,7 @@ AC_DEFUN([gl_LANGINFO_H],
   if test $ac_cv_header_langinfo_h = yes; then
     HAVE_LANGINFO_H=1
     dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
-    dnl on OpenBSD 3.8.
+    dnl on OpenBSD 3.8. T_FMT_AMPM an YESEXPR, NOEXPR are missing on IRIX 5.3.
     AC_CACHE_CHECK([whether langinfo.h defines CODESET],
       [gl_cv_header_langinfo_codeset],
       [AC_COMPILE_IFELSE(
@@ -34,6 +34,18 @@ int a = CODESET;
     if test $gl_cv_header_langinfo_codeset = yes; then
       HAVE_LANGINFO_CODESET=1
     fi
+    AC_CACHE_CHECK([whether langinfo.h defines T_FMT_AMPM],
+      [gl_cv_header_langinfo_t_fmt_ampm],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = T_FMT_AMPM;
+]])],
+         [gl_cv_header_langinfo_t_fmt_ampm=yes],
+         [gl_cv_header_langinfo_t_fmt_ampm=no])
+      ])
+    if test $gl_cv_header_langinfo_t_fmt_ampm = yes; then
+      HAVE_LANGINFO_T_FMT_AMPM=1
+    fi
     AC_CACHE_CHECK([whether langinfo.h defines ERA],
       [gl_cv_header_langinfo_era],
       [AC_COMPILE_IFELSE(
@@ -46,12 +58,26 @@ int a = ERA;
     if test $gl_cv_header_langinfo_era = yes; then
       HAVE_LANGINFO_ERA=1
     fi
+    AC_CACHE_CHECK([whether langinfo.h defines YESEXPR],
+      [gl_cv_header_langinfo_yesexpr],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[#include <langinfo.h>
+int a = YESEXPR;
+]])],
+         [gl_cv_header_langinfo_yesexpr=yes],
+         [gl_cv_header_langinfo_yesexpr=no])
+      ])
+    if test $gl_cv_header_langinfo_yesexpr = yes; then
+      HAVE_LANGINFO_YESEXPR=1
+    fi
   else
     HAVE_LANGINFO_H=0
   fi
   AC_SUBST([HAVE_LANGINFO_H])
   AC_SUBST([HAVE_LANGINFO_CODESET])
+  AC_SUBST([HAVE_LANGINFO_T_FMT_AMPM])
   AC_SUBST([HAVE_LANGINFO_ERA])
+  AC_SUBST([HAVE_LANGINFO_YESEXPR])
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
index c7f545e7bc3452f33cbb43a1fcb460e72c1f9e85..b6f5373d7c6d33e2b4bdac6e6a11b19a0b7b0cfa 100644 (file)
@@ -28,7 +28,9 @@ langinfo.h: langinfo.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
              -e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \
              -e 's|@''GNULIB_NL_LANGINFO''@|$(GNULIB_NL_LANGINFO)|g' \
              -e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
+             -e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
              -e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
+             -e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \
              -e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
              -e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \