wcwidth: Fix C++ test error on mingw.
authorBruno Haible <bruno@clisp.org>
Sun, 4 Apr 2010 00:42:00 +0000 (02:42 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 4 Apr 2010 00:42:00 +0000 (02:42 +0200)
ChangeLog
lib/wcwidth.c
m4/wcwidth.m4

index efb42c53cbe0052e8c6b0e7f5c98c119c3d324ca..b80dfea29da8bb4bdeecfb4e4545f8f3f0c3f3ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-03  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        nanosleep: Fix C++ test error on mingw.
index 7341b66c67628b5d9e64ca5e394417fd161433e5..66b5b15e0ba83f8203c6b4f170a37ecc96dacb29 100644 (file)
@@ -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
 #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 ();
index ef5404eab99703b9df2b7a36c30eee8be5a3f493..acceba5477ce7f1cb271896edade66821a36866b 100644 (file)
@@ -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.
 ])