Mercurial > hg > octave-lojdl > gnulib-hg
changeset 14067:10c3545b10f8
nl_langinfo: fix YESEXPR on Irix 6.5
* m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Test for Irix bug.
* lib/nl_langinfo.c (rpl_nl_langinfo): Work around it.
* doc/posix-functions/nl_langinfo.texi (nl_langinfo): Document
it.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Fri, 31 Dec 2010 11:42:21 -0700 |
parents | 4da5a61188fb |
children | 9e65dc87f826 |
files | ChangeLog doc/posix-functions/nl_langinfo.texi lib/nl_langinfo.c m4/nl_langinfo.m4 |
diffstat | 4 files changed, 42 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-12-31 Eric Blake <eblake@redhat.com> + + nl_langinfo: fix YESEXPR on Irix 6.5 + * m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Test for Irix bug. + * lib/nl_langinfo.c (rpl_nl_langinfo): Work around it. + * doc/posix-functions/nl_langinfo.texi (nl_langinfo): Document + it. + 2010-12-31 Bruno Haible <bruno@clisp.org> iconv: Document HP-UX 11 bug.
--- a/doc/posix-functions/nl_langinfo.texi +++ b/doc/posix-functions/nl_langinfo.texi @@ -22,6 +22,10 @@ The constants @code{T_FMT_AMPM}, @code{YESEXPR}, @code{NOEXPR} are not supported on some platforms: IRIX 5.3. +@item +The constants @code{YESEXPR} and @code{NOEXPR} do not return a valid +string on some platforms: +Irix 6.5. @end itemize Portability problems not fixed by Gnulib:
--- a/lib/nl_langinfo.c +++ b/lib/nl_langinfo.c @@ -97,7 +97,7 @@ strings, appended in memory. */ return "\0\0\0\0\0\0\0\0\0\0"; # endif -# if GNULIB_defined_YESEXPR +# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS case YESEXPR: return "^[yY]"; case NOEXPR:
--- a/m4/nl_langinfo.m4 +++ b/m4/nl_langinfo.m4 @@ -1,4 +1,4 @@ -# nl_langinfo.m4 serial 3 +# nl_langinfo.m4 serial 4 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, @@ -9,8 +9,35 @@ AC_REQUIRE([gl_LANGINFO_H_DEFAULTS]) AC_REQUIRE([gl_LANGINFO_H]) AC_CHECK_FUNCS_ONCE([nl_langinfo]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles if test $ac_cv_func_nl_langinfo = yes; then - if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1; then + # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. + AC_CACHE_CHECK([whether YESEXPR works], + [gl_cv_func_nl_langinfo_yesexpr_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM([[#include <langinfo.h> +]], [[return !*nl_langinfo(YESEXPR); +]])], + [gl_cv_func_nl_langinfo_yesexpr_works=yes], + [gl_cv_func_nl_langinfo_yesexpr_works=no], + [ + case "$host_os" in + # Guess no on irix systems. + irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";; + # Guess yes elsewhere. + *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";; + esac + ]) + ]) + case $gl_cv_func_nl_langinfo_yesexpr_works in + *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;; + *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;; + esac + AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS], + [$FUNC_NL_LANGINFO_YESEXPR_WORKS], + [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.]) + if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1 \ + && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then : else REPLACE_NL_LANGINFO=1