bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test-langinfo failures on Irix 5.3


From: Bruno Haible
Subject: Re: test-langinfo failures on Irix 5.3
Date: Fri, 10 Sep 2010 20:27:41 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> I'm getting this compilation failure, and haven't had time to look into 
> it further yet...
> 
> gcc  -I. -I../lib  -DIN_M4_GNULIB_TESTS=1 -I. -I. -I.. -I./.. -I../lib 
> -I./../lib   -g -O2 -MT test-langinfo.o -MD -MP -MF 
> .deps/test-langinfo.Tpo -c -o test-langinfo.o test-langinfo.c
> test-langinfo.c:35: error: `T_FMT_AMPM' undeclared here (not in a function)
> test-langinfo.c:35: error: initializer element is not constant
> test-langinfo.c:35: error: (near initialization for `items[6]')
> test-langinfo.c:84: error: `YESEXPR' undeclared here (not in a function)
> test-langinfo.c:84: error: initializer element is not constant
> test-langinfo.c:84: error: (near initialization for `items[53]')
> test-langinfo.c:86: error: `NOEXPR' undeclared here (not in a function)
> test-langinfo.c:86: error: initializer element is not constant
> test-langinfo.c:86: error: (near initialization for `items[54]')
> 
> I'm also planning on repeating these tests on Irix 6.5 (since 5.3 is 
> rather old at this point).

Yes, it's rather old, but it's not much work to support it correctly.
For T_FMT_AMPM, we can use the usual format "%I:%M:%S %p", because IRIX 5.3
strftime() supports these format directives
(<http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0530&db=man&fname=/usr/share/catman/p_man/cat3c/strftime.z>).

I'm applying this workaround.


2010-09-10  Bruno Haible  <address@hidden>

        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.

--- doc/posix-functions/nl_langinfo.texi.orig   Fri Sep 10 20:17:59 2010
+++ doc/posix-functions/nl_langinfo.texi        Fri Sep 10 20:17:33 2010
@@ -18,6 +18,10 @@
 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.
address@hidden
+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:
--- doc/posix-headers/langinfo.texi.orig        Fri Sep 10 20:17:59 2010
+++ doc/posix-headers/langinfo.texi     Fri Sep 10 20:17:38 2010
@@ -17,6 +17,10 @@
 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.
address@hidden
+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:
--- lib/langinfo.in.h.orig      Fri Sep 10 20:17:59 2010
+++ lib/langinfo.in.h   Fri Sep 10 19:50:52 2010
@@ -112,6 +112,11 @@
 #  define GNULIB_defined_CODESET 1
 # endif
 
+# if address@hidden@
+#  define T_FMT_AMPM  10006
+#  define GNULIB_defined_T_FMT_AMPM 1
+# endif
+
 # if address@hidden@
 #  define ERA         10047
 #  define ERA_D_FMT   10048
@@ -121,6 +126,12 @@
 #  define GNULIB_defined_ERA 1
 # endif
 
+# if address@hidden@
+#  define YESEXPR     10053
+#  define NOEXPR      10054
+#  define GNULIB_defined_YESEXPR 1
+# endif
+
 #endif
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
--- lib/nl_langinfo.c.orig      Fri Sep 10 20:17:59 2010
+++ lib/nl_langinfo.c   Fri Sep 10 19:53:24 2010
@@ -67,6 +67,10 @@
         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
@@ -93,6 +97,12 @@
          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;
     }
--- m4/langinfo_h.m4.orig       Fri Sep 10 20:17:59 2010
+++ m4/langinfo_h.m4    Fri Sep 10 19:48:17 2010
@@ -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 @@
   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 @@
     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 @@
     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.
--- modules/langinfo.orig       Fri Sep 10 20:17:59 2010
+++ modules/langinfo    Fri Sep 10 19:48:58 2010
@@ -28,7 +28,9 @@
              -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)' \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]