From ee1e85f8f9f5667aace29d549411e5a78eb86ed1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 4 Apr 2010 02:42:00 +0200 Subject: [PATCH] wcwidth: Fix C++ test error on mingw. --- ChangeLog | 7 +++++++ lib/wcwidth.c | 7 +++---- m4/wcwidth.m4 | 14 +++++++------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index efb42c53cb..b80dfea29d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-03 Bruno Haible + + wcwidth: Fix C++ test error on mingw. + * lib/wcwidth.c (wcwidth): Renamed from rpl_wcwidth. + * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): If the wcwidth function does not + exist, don't set REPLACE_WCWIDTH. Instead, rely on HAVE_DECL_WCWIDTH. + 2010-04-03 Bruno Haible nanosleep: Fix C++ test error on mingw. diff --git a/lib/wcwidth.c b/lib/wcwidth.c index 7341b66c67..66b5b15e0b 100644 --- a/lib/wcwidth.c +++ b/lib/wcwidth.c @@ -1,5 +1,5 @@ /* Determine the number of screen columns needed for a character. - Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,10 +26,9 @@ #include "streq.h" #include "uniwidth.h" -#undef wcwidth - int -rpl_wcwidth (wchar_t wc) +wcwidth (wchar_t wc) +#undef wcwidth { /* In UTF-8 locales, use a Unicode aware width function. */ const char *encoding = locale_charset (); diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4 index ef5404eab9..acceba5477 100644 --- a/m4/wcwidth.m4 +++ b/m4/wcwidth.m4 @@ -1,4 +1,4 @@ -# wcwidth.m4 serial 15 +# wcwidth.m4 serial 16 dnl Copyright (C) 2006-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, @@ -34,9 +34,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH], HAVE_DECL_WCWIDTH=0 fi - if test $ac_cv_func_wcwidth = no; then - REPLACE_WCWIDTH=1 - else + if test $ac_cv_func_wcwidth = yes; then dnl On MacOS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1. dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1. dnl This leads to bugs in 'ls' (coreutils). @@ -84,11 +82,13 @@ changequote([,])dnl *no) REPLACE_WCWIDTH=1 ;; esac fi - if test $REPLACE_WCWIDTH = 1; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1; then AC_LIBOBJ([wcwidth]) fi - - if test $REPLACE_WCWIDTH = 1 || test $HAVE_DECL_WCWIDTH = 0; then + if test $ac_cv_func_wcwidth != yes || test $REPLACE_WCWIDTH = 1 \ + || test $HAVE_DECL_WCWIDTH = 0; then gl_REPLACE_WCHAR_H fi + dnl We don't substitute HAVE_WCWIDTH. We assume that if the system does not + dnl have the wcwidth function, then it does not declare it. ]) -- 2.30.2