bug-gnulib
[Top][All Lists]
Advanced

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

wcwidth on mingw


From: Bruno Haible
Subject: wcwidth on mingw
Date: Sun, 4 Apr 2010 01:41:45 +0100
User-agent: KMail/1.9.9

Similarly for wcwidth, I'm seeing this error:

  ../gllib/wchar.h:678: error: `wcwidth' was not declared in this scope

Here too the problem is that gnulib defines a function rpl_wcwidth, although
wcwidth does not exist on mingw. gnulib could just define wcwidth instead.

This fixes it:


2010-04-03  Bruno Haible  <address@hidden>

        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.

--- ChangeLog.orig      Sun Apr  4 02:41:12 2010
+++ ChangeLog   Sun Apr  4 02:40:53 2010
@@ -1,5 +1,12 @@
 2010-04-03  Bruno Haible  <address@hidden>
 
+       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  <address@hidden>
+
        nanosleep: Fix C++ test error on mingw.
        * lib/nanosleep.c (nanosleep): Renamed from rpl_nanosleep.
        * lib/time.in.h (nanosleep): Use modern idiom.
--- lib/wcwidth.c.orig  Sun Apr  4 02:41:12 2010
+++ lib/wcwidth.c       Sun Apr  4 02:24:44 2010
@@ -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 ();
--- m4/wcwidth.m4.orig  Sun Apr  4 02:41:12 2010
+++ m4/wcwidth.m4       Sun Apr  4 02:41:06 2010
@@ -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 @@
     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 @@
       *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.
 ])




reply via email to

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