[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] Tru64 UNIX patches for gnulib mbswidth.h
From: |
Bruno Haible |
Subject: |
Re: [Bug-gnulib] Tru64 UNIX patches for gnulib mbswidth.h |
Date: |
Thu, 18 Mar 2004 14:31:23 +0100 |
User-agent: |
KMail/1.5 |
Paul Eggert wrote:
> 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.
Ouch.
> How about this gnulib patch instead?
I agree with the direction of the patch, but the way's it's done, Albert
says it doesn't work. Instead I've committed the following patch to gnulib.
Bruno
2004-03-18 Paul Eggert <address@hidden>
Bruno Haible <address@hidden>
* mbswidth.m4 (gl_MBSWIDTH): Also test whether <wchar.h> declares
mbswidth.
2004-03-18 Paul Eggert <address@hidden>
Bruno Haible <address@hidden>
* mbswidth.h: Include <wchar.h> only if HAVE_DECL_MBSWIDTH_IN_WCHAR_H,
not on all platforms that have <wchar.h>.
* mbswidth.c: Include <stdio.h> and <time.h> before <wchar.h>.
*** m4/mbswidth.m4 31 Dec 2002 13:43:06 -0000 1.10
--- m4/mbswidth.m4 18 Mar 2004 13:28:35 -0000
***************
*** 1,4 ****
! #serial 9
dnl autoconf tests required for use of mbswidth.c
dnl From Bruno Haible.
--- 1,4 ----
! #serial 10
dnl autoconf tests required for use of mbswidth.c
dnl From Bruno Haible.
***************
*** 31,36 ****
--- 31,55 ----
fi
AC_DEFINE_UNQUOTED(HAVE_DECL_WCWIDTH, $ac_val,
[Define to 1 if you have the declaration of wcwidth(), and to 0
otherwise.])
+
+ dnl UnixWare 7.1.1 <wchar.h> has a declaration of a function mbswidth()
+ dnl that clashes with ours.
+ AC_CACHE_CHECK([whether mbswidth is declared in <wchar.h>],
+ ac_cv_have_decl_mbswidth,
+ [AC_TRY_COMPILE([
+ #if HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+ ], [
+ char *p = (char *) mbswidth;
+ ], ac_cv_have_decl_mbswidth=yes, ac_cv_have_decl_mbswidth=no)])
+ if test $ac_cv_have_decl_mbswidth = yes; then
+ ac_val=1
+ else
+ ac_val=0
+ fi
+ AC_DEFINE_UNQUOTED(HAVE_DECL_MBSWIDTH_IN_WCHAR_H, $ac_val,
+ [Define to 1 if you have a declaration of mbswidth() in <wchar.h>, and to
0 otherwise.])
AC_TYPE_MBSTATE_T
])
*** lib/mbswidth.h 3 Mar 2003 17:24:09 -0000 1.10
--- lib/mbswidth.h 18 Mar 2004 13:28:35 -0000
***************
*** 1,5 ****
/* Determine the number of screen columns needed for a string.
! Copyright (C) 2000-2003 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
--- 1,5 ----
/* Determine the number of screen columns needed for a string.
! 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
***************
*** 19,26 ****
/* 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
# include <wchar.h>
#endif
--- 19,31 ----
/* 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.
! However, we don't want to #include <wchar.h> on all platforms because
! - Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
! <wchar.h>.
! - BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
! <wchar.h>. */
! #if HAVE_DECL_MBSWIDTH_IN_WCHAR_H
# include <wchar.h>
#endif
*** lib/mbswidth.c 31 Jul 2003 06:27:05 -0000 1.10
--- lib/mbswidth.c 18 Mar 2004 13:28:35 -0000
***************
*** 1,5 ****
/* Determine the number of screen columns needed for a string.
! Copyright (C) 2000-2002 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
--- 1,5 ----
/* Determine the number of screen columns needed for a string.
! 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
***************
*** 34,39 ****
--- 34,45 ----
/* Get mbstate_t, mbrtowc(), mbsinit(), wcwidth(). */
#if HAVE_WCHAR_H
+ /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+ <wchar.h>.
+ BSD/OS 4.1 has a bug: <stdio.h> and <time.h> must be included before
+ <wchar.h>. */
+ # include <stdio.h>
+ # include <time.h>
# include <wchar.h>
#endif