[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] nl_langinfo: fix YESEXPR on Irix 6.5
From: |
Eric Blake |
Subject: |
[PATCH] nl_langinfo: fix YESEXPR on Irix 6.5 |
Date: |
Fri, 31 Dec 2010 12:14:03 -0700 |
* m4/nl_langinfo.m4 (gl_FUNC_NL_LANGINFO): Test for Irix bug.
* lib/nl_langinfo.c (rpl_nl_langinfo): Work around it.
Signed-off-by: Eric Blake <address@hidden>
---
> YESEXPR is meant to be used as a regular expression against which a
> line of user input is to be matched. It makes no sense for it to be
> empty. Therefore the test is fine, and it's the nl_langinfo wrapper
> that needs to be taught about a workaround.
This fixes the test for me on Irix 6.5 - does it look okay to apply?
Oh, I guess I should also update docs/posix-functions/nl_langinfo.texi.
ChangeLog | 4 ++++
lib/nl_langinfo.c | 2 +-
m4/nl_langinfo.m4 | 31 +++++++++++++++++++++++++++++--
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c5e4086..7805056 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
2010-12-31 Eric Blake <address@hidden>
+ 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.
+
ftello: avoid compilation failure with SunStudio c89
* lib/ftello.c (ftello): Use lseek, not llseek.
diff --git a/lib/nl_langinfo.c b/lib/nl_langinfo.c
index a3d0d11..a4bde12 100644
--- a/lib/nl_langinfo.c
+++ b/lib/nl_langinfo.c
@@ -97,7 +97,7 @@ rpl_nl_langinfo (nl_item item)
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:
diff --git a/m4/nl_langinfo.m4 b/m4/nl_langinfo.m4
index ad456a2..ff0909c 100644
--- 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_DEFUN([gl_FUNC_NL_LANGINFO],
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
--
1.7.3.4