bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] Tru64 UNIX patches for gnulib mbswidth.h


From: Paul Eggert
Subject: [Bug-gnulib] Tru64 UNIX patches for gnulib mbswidth.h
Date: 17 Mar 2004 15:51:23 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Albert Chin-A-Young <address@hidden> writes:

> Tru64 UNIX with the Desktop Toolkit compiler (the commercial C
> compiler, needs <stdio> before <wchar.h>).

Thanks.  Also, I noticed that the quotearg.c source code says BSD/OS
4.1 requires that <stdio.h> and <time.h> must both be included before
<wchar.h> on that platform.  What a pain.

How about this gnulib patch instead?  It avoids the <wchar.h> porting
mess, at least for mbswidth.h.

Index: lib/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/ChangeLog,v
retrieving revision 1.643
diff -p -u -r1.643 ChangeLog
--- lib/ChangeLog       15 Mar 2004 23:44:51 -0000      1.643
+++ lib/ChangeLog       17 Mar 2004 23:50:09 -0000
@@ -1,3 +1,10 @@
+2004-03-17  Paul Eggert  <address@hidden>
+
+       * mbswidth.h: Include <wchar.h> only if
+       HAVE_INCOMPATIBLE_WCHAR_H_MBSWIDTH.
+       (mbswidth): Define to gnu_mbswidth
+       only if HAVE_INCOMPATIBLE_WCHAR_H_MBSWIDTH.
+
 2004-03-09  Paul Eggert  <address@hidden>
 
        * argp-parse.c, getopt.c, getopt.h, getopt1.c:
Index: lib/mbswidth.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/mbswidth.h,v
retrieving revision 1.10
diff -p -u -r1.10 mbswidth.h
--- lib/mbswidth.h      3 Mar 2003 17:24:09 -0000       1.10
+++ lib/mbswidth.h      17 Mar 2004 23:50:09 -0000
@@ -1,5 +1,5 @@
 /* Determine the number of screen columns needed for a string.
-   Copyright (C) 2000-2003 Free Software Foundation, Inc.
+   Copyright (C) 2000-2004 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
@@ -18,10 +18,10 @@
 #include <stddef.h>
 
 /* Avoid a clash of our mbswidth() with a function of the same name defined
-   in UnixWare 7.1.1 <wchar.h>.  We need this #include before the #define
-   below.  */
-#if HAVE_WCHAR_H
+   in UnixWare 7.1.1 <wchar.h>.  */
+#if HAVE_INCOMPATIBLE_WCHAR_H_MBSWIDTH
 # include <wchar.h>
+# define mbswidth gnu_mbswidth
 #endif
 
 
@@ -38,7 +38,6 @@
 
 
 /* Returns the number of screen columns needed for STRING.  */
-#define mbswidth gnu_mbswidth  /* avoid clash with UnixWare 7.1.1 function */
 extern int mbswidth (const char *string, int flags);
 
 /* Returns the number of screen columns needed for the NBYTES bytes
Index: m4/ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/ChangeLog,v
retrieving revision 1.531
diff -p -u -r1.531 ChangeLog
--- m4/ChangeLog        7 Mar 2004 23:51:10 -0000       1.531
+++ m4/ChangeLog        17 Mar 2004 23:50:10 -0000
@@ -1,3 +1,7 @@
+2004-03-17  Paul Eggert  <address@hidden>
+
+       * mbswidth.m4 (gl_MBSWIDTH): Define HAVE_INCOMPATIBLE_WCHAR_H_MBSWIDTH.
+
 2004-03-07  Paul Eggert  <address@hidden>
 
        * c-stack.m4 (gl_PREREQ_C_STACK): Renamed from jm_PREREQ_C_STACK.
Index: m4/mbswidth.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/mbswidth.m4,v
retrieving revision 1.10
diff -p -u -r1.10 mbswidth.m4
--- m4/mbswidth.m4      31 Dec 2002 13:43:06 -0000      1.10
+++ m4/mbswidth.m4      17 Mar 2004 23:50:11 -0000
@@ -1,14 +1,31 @@
-#serial 9
+#serial 10
 
 dnl autoconf tests required for use of mbswidth.c
 dnl From Bruno Haible.
 
 AC_DEFUN([gl_MBSWIDTH],
 [
+  AC_REQUIRE([AC_C_CONST])
   AC_CHECK_HEADERS_ONCE(wchar.h wctype.h)
   AC_CHECK_FUNCS_ONCE(isascii iswprint mbsinit)
   AC_CHECK_FUNCS(iswcntrl wcwidth)
   jm_FUNC_MBRTOWC
+
+  AC_CACHE_CHECK([whether wchar.h declares an incompatible wcwidth],
+    ac_cv_have_incompatible_wchar_h_mbswidth,
+    [AC_TRY_COMPILE([
+#if HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+int mbswidth (const char *, int);
+],
+       [],
+       ac_cv_have_incompatible_wchar_h_mbswidth=no,
+       ac_cv_have_incompatible_wchar_h_mbswidth=yes)])
+  if test $ac_cv_have_incompatible_wchar_h_mbswidth = yes; then
+    AC_DEFINE(HAVE_INCOMPATIBLE_WCHAR_H_MBSWIDTH, 1,
+      [Define to 1 if <wchar.h> defines an mbswidth incompatible with ours.])
+  fi
 
   AC_CACHE_CHECK([whether wcwidth is declared], ac_cv_have_decl_wcwidth,
     [AC_TRY_COMPILE([




reply via email to

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