bug-gnulib
[Top][All Lists]
Advanced

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

Re: mbchar fails to build on Irix 5.3


From: Bruno Haible
Subject: Re: mbchar fails to build on Irix 5.3
Date: Sat, 20 Sep 2008 14:52:28 +0200
User-agent: KMail/1.5.4

Tom G. Christensen wrote:
> I was trying to build GNU tar 1.20 but got stuck on gnulib mbchar.
> 
> I created a testdir from the latest gnulib mbchar and this is the
> result:
> make[3]: Entering directory `/usr/people/tgc/mbchar.test/mbchar/gllib'
> source='localcharset.c' object='localcharset.o' libtool=no \
>         DEPDIR=.deps depmode=sgi /bin/ksh ../build-aux/depcomp \
>         cc -woff 728 -DHAVE_CONFIG_H -I. -I..     -g -c -o localcharset.o 
> localcharset.c
> source='mbchar.c' object='mbchar.o' libtool=no \
>         DEPDIR=.deps depmode=sgi /bin/ksh ../build-aux/depcomp \
>         cc -woff 728 -DHAVE_CONFIG_H -I. -I..     -g -c -o mbchar.o mbchar.c
> cfe: Error: ./mbchar.h, line 239: Syntax Error
>  mb_width_aux (wint_t wc)
>  ---------------------^

Thanks for reporting this. The problem is apparently that on this platform,
neither <wchar.h> not <wctype.h> defines wint_t. I'm applying the attached
tentative workaround.

When you create a new testdir from latest gnulib mbchar, does it now pass?

Bruno


2008-09-20  Bruno Haible  <address@hidden>

        Ensure that wint_t gets defined on IRIX 5.3.
        * lib/wchar.in.h (wint_t): Define if not defined by the system.
        * lib/wctype.in.h (wint_t): Likewise.
        (__wctype_wint_t): Remove type.
        (isw*): Use wint_t instead of __wctype_wint_t.
        * m4/wchar.m4 (gl_WCHAR_H): Invoke gt_TYPE_WINT_T and set HAVE_WINT_T.
        * modules/wchar (Files): Add m4/wint_t.m4.
        (Makefile.am): Substitute HAVE_WINT_T.
        * tests/test-wchar.c: Check that wchar_t and wint_t are defined.
        * tests/test-wctype.c: Check that wint_t is defined.
        * doc/posix-headers/wchar.texi: Mention the IRIX 5 problem.
        * doc/posix-headers/wctype.texi: Likewise.
        Reported by Tom G. Christensen <address@hidden>.

*** doc/posix-headers/wchar.texi.orig   2008-09-20 14:43:37.000000000 +0200
--- doc/posix-headers/wchar.texi        2008-09-20 14:41:20.000000000 +0200
***************
*** 13,18 ****
--- 13,21 ----
  @item
  This header file is not self-contained on some platforms:
  OSF/1 with Desktop Toolkit C, BSD/OS 4.0.1.
+ @item
+ The type @code{wint_t} is missing on some platforms:
+ IRIX 5.3.
  @end itemize
  
  Portability problems not fixed by Gnulib:
*** doc/posix-headers/wctype.texi.orig  2008-09-20 14:43:37.000000000 +0200
--- doc/posix-headers/wctype.texi       2008-09-20 14:41:21.000000000 +0200
***************
*** 14,19 ****
--- 14,22 ----
  This header file is not self-contained on some platforms:
  Solaris 2.5, OSF/1 with Desktop Toolkit C, BSD/OS 4.0.1.
  @item
+ The type @code{wint_t} is missing on some platforms:
+ IRIX 5.3.
+ @item
  The functions @code{isw*} are missing on some platforms:
  FreeBSD 4.11.
  @item
*** lib/wchar.in.h.orig 2008-09-20 14:43:37.000000000 +0200
--- lib/wchar.in.h      2008-09-20 14:37:08.000000000 +0200
***************
*** 63,68 ****
--- 63,74 ----
  #endif
  
  
+ /* Define wint_t.  (Also done in wctype.in.h.)  */
+ #if address@hidden@ && !defined wint_t
+ # define wint_t int
+ #endif
+ 
+ 
  /* Return the number of screen columns needed for WC.  */
  #if @GNULIB_WCWIDTH@
  # if @REPLACE_WCWIDTH@
*** lib/wctype.in.h.orig        2008-09-20 14:43:37.000000000 +0200
--- lib/wctype.in.h     2008-09-20 14:36:43.000000000 +0200
***************
*** 52,61 ****
  #ifndef _GL_WCTYPE_H
  #define _GL_WCTYPE_H
  
! #if @HAVE_WINT_T@
! typedef wint_t __wctype_wint_t;
! #else
! typedef int __wctype_wint_t;
  #endif
  
  /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
--- 52,60 ----
  #ifndef _GL_WCTYPE_H
  #define _GL_WCTYPE_H
  
! /* Define wint_t.  (Also done in wchar.in.h.)  */
! #if address@hidden@ && !defined wint_t
! # define wint_t int
  #endif
  
  /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
***************
*** 98,153 ****
  #  endif
  
  static inline int
! iswalnum (__wctype_wint_t wc)
  {
    return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
  }
  
  static inline int
! iswalpha (__wctype_wint_t wc)
  {
    return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
  }
  
  static inline int
! iswblank (__wctype_wint_t wc)
  {
    return wc == ' ' || wc == '\t';
  }
  
  static inline int
! iswcntrl (__wctype_wint_t wc)
  {
    return (wc & ~0x1f) == 0 || wc == 0x7f;
  }
  
  static inline int
! iswdigit (__wctype_wint_t wc)
  {
    return wc >= '0' && wc <= '9';
  }
  
  static inline int
! iswgraph (__wctype_wint_t wc)
  {
    return wc >= '!' && wc <= '~';
  }
  
  static inline int
! iswlower (__wctype_wint_t wc)
  {
    return wc >= 'a' && wc <= 'z';
  }
  
  static inline int
! iswprint (__wctype_wint_t wc)
  {
    return wc >= ' ' && wc <= '~';
  }
  
  static inline int
! iswpunct (__wctype_wint_t wc)
  {
    return (wc >= '!' && wc <= '~'
          && !((wc >= '0' && wc <= '9')
--- 97,152 ----
  #  endif
  
  static inline int
! iswalnum (wint_t wc)
  {
    return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
  }
  
  static inline int
! iswalpha (wint_t wc)
  {
    return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
  }
  
  static inline int
! iswblank (wint_t wc)
  {
    return wc == ' ' || wc == '\t';
  }
  
  static inline int
! iswcntrl (wint_t wc)
  {
    return (wc & ~0x1f) == 0 || wc == 0x7f;
  }
  
  static inline int
! iswdigit (wint_t wc)
  {
    return wc >= '0' && wc <= '9';
  }
  
  static inline int
! iswgraph (wint_t wc)
  {
    return wc >= '!' && wc <= '~';
  }
  
  static inline int
! iswlower (wint_t wc)
  {
    return wc >= 'a' && wc <= 'z';
  }
  
  static inline int
! iswprint (wint_t wc)
  {
    return wc >= ' ' && wc <= '~';
  }
  
  static inline int
! iswpunct (wint_t wc)
  {
    return (wc >= '!' && wc <= '~'
          && !((wc >= '0' && wc <= '9')
***************
*** 155,174 ****
  }
  
  static inline int
! iswspace (__wctype_wint_t wc)
  {
    return (wc == ' ' || wc == '\t'
          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
  }
  
  static inline int
! iswupper (__wctype_wint_t wc)
  {
    return wc >= 'A' && wc <= 'Z';
  }
  
  static inline int
! iswxdigit (__wctype_wint_t wc)
  {
    return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
--- 154,173 ----
  }
  
  static inline int
! iswspace (wint_t wc)
  {
    return (wc == ' ' || wc == '\t'
          || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
  }
  
  static inline int
! iswupper (wint_t wc)
  {
    return wc >= 'A' && wc <= 'Z';
  }
  
  static inline int
! iswxdigit (wint_t wc)
  {
    return ((wc >= '0' && wc <= '9')
          || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
*** m4/wchar.m4.orig    2008-09-20 14:43:37.000000000 +0200
--- m4/wchar.m4 2008-09-20 14:34:59.000000000 +0200
***************
*** 1,13 ****
  dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
  
! dnl Copyright (C) 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
  
  dnl Written by Eric Blake.
  
! # wchar.m4 serial 4
  
  AC_DEFUN([gl_WCHAR_H],
  [
--- 1,13 ----
  dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
  
! dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
  
  dnl Written by Eric Blake.
  
! # wchar.m4 serial 5
  
  AC_DEFUN([gl_WCHAR_H],
  [
***************
*** 18,24 ****
  wchar_t w;]],
        [gl_cv_header_wchar_h_standalone=yes],
        [gl_cv_header_wchar_h_standalone=no])])
!   if test $gl_cv_header_wchar_h_standalone != yes; then
      WCHAR_H=wchar.h
    fi
  
--- 18,33 ----
  wchar_t w;]],
        [gl_cv_header_wchar_h_standalone=yes],
        [gl_cv_header_wchar_h_standalone=no])])
! 
!   AC_REQUIRE([gt_TYPE_WINT_T])
!   if test $gt_cv_c_wint_t = yes; then
!     HAVE_WINT_T=1
!   else
!     HAVE_WINT_T=0
!   fi
!   AC_SUBST([HAVE_WINT_T])
! 
!   if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != 
yes; then
      WCHAR_H=wchar.h
    fi
  
*** modules/wchar.orig  2008-09-20 14:43:37.000000000 +0200
--- modules/wchar       2008-09-20 14:37:56.000000000 +0200
***************
*** 4,9 ****
--- 4,10 ----
  Files:
  lib/wchar.in.h
  m4/wchar.m4
+ m4/wint_t.m4
  
  Depends-on:
  include_next
***************
*** 25,30 ****
--- 26,32 ----
              -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
              -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
              -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
+             -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
*** tests/test-wchar.c.orig     2008-09-20 14:43:37.000000000 +0200
--- tests/test-wchar.c  2008-09-20 14:30:29.000000000 +0200
***************
*** 1,5 ****
  /* Test of <wchar.h> substitute.
!    Copyright (C) 2007 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 ----
  /* Test of <wchar.h> substitute.
!    Copyright (C) 2007-2008 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
***************
*** 20,25 ****
--- 20,29 ----
  
  #include <wchar.h>
  
+ /* Check that the types wchar_t and wint_t are defined.  */
+ wchar_t a = 'c';
+ wint_t b = 'x';
+ 
  int
  main ()
  {
*** tests/test-wctype.c.orig    2008-09-20 14:43:37.000000000 +0200
--- tests/test-wctype.c 2008-09-20 14:30:24.000000000 +0200
***************
*** 20,25 ****
--- 20,28 ----
  
  #include <wctype.h>
  
+ /* Check that the type wint_t is defined.  */
+ wint_t a = 'x';
+ 
  int
  main ()
  {





reply via email to

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