[PATCH] New *-*-solaris2.x cross configury, including looser wchar_t requirements for all targets

Brad Spencer spencer@infointeractive.com
Wed Jul 23 20:45:00 GMT 2003


I noticed that neither the native or cross compiled libstdc++-v3
packaged with gcc-3.3 have been detecting C99 wchar_t support when
configured for a sparc-sun-solaris2.8 target.  AFIAK, this version of
Solaris is complaint enough to work.

I tracked this down to a few missing wide character functions which
are only used to inject names into the std namespace (i.e. they are
never called by libstdc++).  I figured it seemed quite safe to simply
not inject them if they aren't there in the first place, and thus this
patch.

For cross targets, I've had to expand the set of AC_DEFINE macros I
submitted earlier (which Benjamin polished in
http://gcc.gnu.org/ml/libstdc++/2003-05/msg00255.html).  I suppose
this could almost be split into two separate patches, but a large
number of these definitions are needed to make the cross compiler
support wchar_t properly anyway.  As a result, this patch needs to be
applied to stock gcc-3.3/libstdc++-v3 after that one.

Caveats:

 - I'm not 100% sure that the AC_DEFINE macros will work on all
   supported versions of Solaris.  As such, I have added them under
   the 2.7, 2.8, and 2.9 support rule, but even that might be a
   stretch.  I don't have any 2.7 or 2.9 machine handy on which to
   test. 

 - The HAVE___BUILTIN* definitions don't seem to be appropriate for
   non-SPARC targets.  These didn't seem to be checked-for in a cross
   configure, so I threw them in where it looked "safe" to do so.
   Perhaps I am being to agressive with these?

Please let me know if there is a better way to do this.  Thanks.
        
-- 
------------------------------------------------------------------
Brad Spencer - spencer@infointeractive.com - "It's quite nice..."
Systems Architect | InfoInterActive Corp. | A Canadian AOL Company
-------------- next part --------------
*** ./config/io/basic_file_stdio.cc.orig	Wed Jul 23 12:04:06 2003
--- ./config/io/basic_file_stdio.cc	Wed Jul 23 12:08:08 2003
***************
*** 34,39 ****
--- 34,44 ----
  #include <bits/basic_file.h>
  #include <fcntl.h>
  
+ #ifdef _GLIBCPP_HAVE_UNISTD_H
+ // Pick up ioctl on Solaris 2.8
+ #include <unistd.h>
+ #endif
+ 
  #ifdef _GLIBCPP_HAVE_SYS_IOCTL_H
  #define BSD_COMP /* Get FIONREAD on Solaris2. */
  #include <sys/ioctl.h>
*** ./include/c_compatibility/wchar.h.orig	Wed Jul 23 10:16:07 2003
--- ./include/c_compatibility/wchar.h	Wed Jul 23 12:10:15 2003
***************
*** 50,60 ****
--- 50,66 ----
  using std::swprintf;
  using std::swscanf;
  using std::vfwprintf;
+ #if _GLIBCPP_HAVE_VFWSCANF
  using std::vfwscanf;
+ #endif // _GLIBCPP_HAVE_VFWSCANF
  using std::vswprintf;
+ #if _GLIBCPP_HAVE_VSWSCANF
  using std::vswscanf;
+ #endif // _GLIBCPP_HAVE_VSWSCANF
  using std::vwprintf;
+ #if _GLIBCPP_HAVE_VWSCANF
  using std::vwscanf;
+ #endif // _GLIBCPP_HAVE_VWSCANF
  using std::wprintf;
  using std::wscanf;
  using std::getwc;
***************
*** 69,75 ****
--- 75,83 ----
  using std::ungetwc;
  using std::wcrtomb;
  using std::wcstod;
+ #if _GLIBCPP_HAVE_WCSTOF
  using std::wcstof;
+ #endif // _GLIBCPP_HAVE_WCSTOF
  using std::wcstol;
  using std::wcstoul;
  using std::wcscpy;
*** ./include/c_std/std_cwchar.h.orig	Wed Jul 23 10:16:11 2003
--- ./include/c_std/std_cwchar.h	Wed Jul 23 12:09:46 2003
***************
*** 92,102 ****
--- 92,108 ----
  #undef swscanf
  #undef ungetwc
  #undef vfwprintf
+ #if _GLIBCPP_HAVE_VFWSCANF
  #undef vfwscanf
+ #endif // _GLIBCPP_HAVE_VFWSCANF
  #undef vswprintf
+ #if _GLIBCPP_HAVE_VSWSCANF
  #undef vswscanf
+ #endif // _GLIBCPP_HAVE_VSWSCANF
  #undef vwprintf
+ #if _GLIBCPP_HAVE_VWSCANF
  #undef vwscanf
+ #endif // _GLIBCPP_HAVE_VWSCANF
  #undef wcrtomb
  #undef wcscat
  #undef wcschr
***************
*** 115,121 ****
--- 121,129 ----
  #undef wcsspn
  #undef wcsstr
  #undef wcstod
+ #if _GLIBCPP_HAVE_WCSTOF
  #undef wcstof
+ #endif // _GLIBCPP_HAVE_WCSTOF
  #undef wcstok
  #undef wcstol
  #undef wcstoul
***************
*** 154,164 ****
--- 162,178 ----
    using ::swscanf;
    using ::ungetwc;
    using ::vfwprintf;
+ #if _GLIBCPP_HAVE_VFWSCANF
    using ::vfwscanf;
+ #endif // _GLIBCPP_HAVE_VFWSCANF
    using ::vswprintf;
+ #if _GLIBCPP_HAVE_VSWSCANF
    using ::vswscanf;
+ #endif // _GLIBCPP_HAVE_VWSCANF
    using ::vwprintf;
+ #if _GLIBCPP_HAVE_VWSCANF
    using ::vwscanf;
+ #endif // _GLIBCPP_HAVE_VWSCANF
    using ::wcrtomb;
    using ::wcscat;
    using ::wcscmp;
***************
*** 173,179 ****
--- 187,195 ----
    using ::wcsrtombs;
    using ::wcsspn;
    using ::wcstod;
+ #if _GLIBCPP_HAVE_WCSTOF
    using ::wcstof;
+ #endif // _GLIBCPP_HAVE_WCSTOF
    using ::wcstok;
    using ::wcstol;
    using ::wcstoul;
*** ./include/c_std/std_cwctype.h.orig	Wed Jul 23 11:47:59 2003
--- ./include/c_std/std_cwctype.h	Wed Jul 23 12:57:57 2003
***************
*** 55,61 ****
--- 55,63 ----
  // Get rid of those macros defined in <wctype.h> in lieu of real functions.
  #undef iswalnum
  #undef iswalpha
+ #if _GLIBCPP_HAVE_ISWBLANK
  #undef iswblank
+ #endif // _GLIBCPP_HAVE_ISWBLANK
  #undef iswcntrl
  #undef iswdigit
  #undef iswgraph
***************
*** 83,89 ****
--- 85,93 ----
  
    using ::iswalnum;
    using ::iswalpha;
+ #if _GLIBCPP_HAVE_ISWBLANK
    using ::iswblank;
+ #endif // _GLIBCPP_HAVE_ISWBLANK
    using ::iswcntrl;
    using ::iswdigit;
    using ::iswgraph;
No differences encountered
*** ./acinclude.m4.orig	Wed Jul 23 11:42:02 2003
--- ./acinclude.m4	Wed Jul 23 11:45:38 2003
***************
*** 988,1000 ****
    
      dnl Checks for names injected into std:: by the c_std headers.
      AC_CHECK_FUNCS(btowc wctob fgetwc fgetws fputwc fputws fwide \
!     fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
!     vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
!     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
      wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
      wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
      ac_wfuncs=no)
  
      AC_MSG_CHECKING([for ISO C99 wchar_t support])
      if test x"$has_weof" = xyes &&
         test x"$has_wchar_minmax" = xyes &&
--- 988,1005 ----
    
      dnl Checks for names injected into std:: by the c_std headers.
      AC_CHECK_FUNCS(btowc wctob fgetwc fgetws fputwc fputws fwide \
!     fwprintf fwscanf swprintf swscanf vfwprintf vswprintf \
!     vwprintf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
!     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstol \
      wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
      wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
      ac_wfuncs=no)
  
+     dnl Checks for non-required wide character functions that are not required
+     dnl for basic wchar_t support.  Don't disable support if they are missing.
+     dnl Injection of these is wrapped with guard macros.
+     AC_CHECK_FUNCS(vfwscanf vswscanf vwscanf wcstof iswblank,,)
+ 
      AC_MSG_CHECKING([for ISO C99 wchar_t support])
      if test x"$has_weof" = xyes &&
         test x"$has_wchar_minmax" = xyes &&
*** ./config.h.in.orig	Wed Jul 23 11:46:21 2003
--- ./config.h.in	Wed Jul 23 11:46:10 2003
***************
*** 716,721 ****
--- 716,724 ----
  /* Define if you have the wscanf function.  */
  #undef HAVE_WSCANF
  
+ /* Define if you have the iswblank function.  */
+ #undef HAVE_ISWBLANK
+ 
  /* Define if you have the <endian.h> header file.  */
  #undef HAVE_ENDIAN_H
  
*** ./configure.in.orig	Wed Jul 23 13:19:35 2003
--- ./configure.in	Wed Jul 23 14:22:19 2003
***************
*** 292,299 ****
            ;;
          *-solaris2.7 | *-solaris2.8 | *-solaris2.9)
  	  os_include_dir="os/solaris/solaris2.7"
!           ;;
        esac
        AC_DEFINE(HAVE_STRTOF)
        AC_DEFINE(HAVE_STRTOLD)
        AC_DEFINE(HAVE_MMAP) 
--- 292,400 ----
            ;;
          *-solaris2.7 | *-solaris2.8 | *-solaris2.9)
  	  os_include_dir="os/solaris/solaris2.7"
!           AC_DEFINE(HAVE_GETPAGESIZE)
!           AC_DEFINE(HAVE_SIGSETJMP)
!           AC_DEFINE(HAVE_MBSTATE_T)
!           AC_DEFINE(HAVE_POLL)
!           AC_DEFINE(HAVE_S_ISREG)
!           AC_DEFINE(HAVE_LC_MESSAGES)
!           AC_DEFINE(HAVE_BTOWC)
!           AC_DEFINE(HAVE_DRAND48)
!           AC_DEFINE(HAVE_FGETWC)
!           AC_DEFINE(HAVE_FGETWS)
!           AC_DEFINE(HAVE_FINITE)
!           AC_DEFINE(HAVE_FPCLASS)
!           AC_DEFINE(HAVE_FPUTWC)
!           AC_DEFINE(HAVE_FPUTWS)
!           AC_DEFINE(HAVE_FWIDE)
!           AC_DEFINE(HAVE_FWPRINTF)
!           AC_DEFINE(HAVE_FWSCANF)
!           AC_DEFINE(HAVE_GETPAGESIZE)
!           AC_DEFINE(HAVE_GETWC)
!           AC_DEFINE(HAVE_GETWCHAR)
!           AC_DEFINE(HAVE_ISATTY)
!           AC_DEFINE(HAVE_MBRLEN)
!           AC_DEFINE(HAVE_MBRTOWC)
!           AC_DEFINE(HAVE_MBSINIT)
!           AC_DEFINE(HAVE_MBSRTOWCS)
!           AC_DEFINE(HAVE_NL_LANGINFO)
!           AC_DEFINE(HAVE_PUTWC)
!           AC_DEFINE(HAVE_PUTWCHAR)
!           AC_DEFINE(HAVE_SWPRINTF)
!           AC_DEFINE(HAVE_SWSCANF)
!           AC_DEFINE(HAVE_UNGETWC)
!           AC_DEFINE(HAVE_VFWPRINTF)
!           AC_DEFINE(HAVE_VSWPRINTF)
!           AC_DEFINE(HAVE_VWPRINTF)
!           AC_DEFINE(HAVE_WCRTOMB)
!           AC_DEFINE(HAVE_WCSCAT)
!           AC_DEFINE(HAVE_WCSCHR)
!           AC_DEFINE(HAVE_WCSCMP)
!           AC_DEFINE(HAVE_WCSCOLL)
!           AC_DEFINE(HAVE_WCSCPY)
!           AC_DEFINE(HAVE_WCSCSPN)
!           AC_DEFINE(HAVE_WCSFTIME)
!           AC_DEFINE(HAVE_WCSLEN)
!           AC_DEFINE(HAVE_WCSNCAT)
!           AC_DEFINE(HAVE_WCSNCMP)
!           AC_DEFINE(HAVE_WCSNCPY)
!           AC_DEFINE(HAVE_WCSPBRK)
!           AC_DEFINE(HAVE_WCSRCHR)
!           AC_DEFINE(HAVE_WCSRTOMBS)
!           AC_DEFINE(HAVE_WCSSPN)
!           AC_DEFINE(HAVE_WCSSTR)
!           AC_DEFINE(HAVE_WCSTOD)
!           AC_DEFINE(HAVE_WCSTOK)
!           AC_DEFINE(HAVE_WCSTOL)
!           AC_DEFINE(HAVE_WCSTOUL)
!           AC_DEFINE(HAVE_WCSXFRM)
!           AC_DEFINE(HAVE_WCTOB)
!           AC_DEFINE(HAVE_WMEMCHR)
!           AC_DEFINE(HAVE_WMEMCMP)
!           AC_DEFINE(HAVE_WMEMCPY)
!           AC_DEFINE(HAVE_WMEMMOVE)
!           AC_DEFINE(HAVE_WMEMSET)
!           AC_DEFINE(HAVE_WPRINTF)
!           AC_DEFINE(HAVE_WSCANF)
!           AC_DEFINE(HAVE_ICONV)
!           AC_DEFINE(HAVE_ICONV_CLOSE)
!           AC_DEFINE(HAVE_ICONV_OPEN)
!           # All of the dependencies for wide character support are here, so
!           # turn it on.  This requires some syncronization with the
!           # GLIBCPP_CHECK_WCHAR_T_SUPPORT in acinclude.m4
!           AC_DEFINE(_GLIBCPP_USE_WCHAR_T) 
!           # Are these tested for even when cross?
!           AC_DEFINE(HAVE_FLOAT_H)
!           AC_DEFINE(HAVE_IEEEFP_H)
!           AC_DEFINE(HAVE_INTTYPES_H)
!           AC_DEFINE(HAVE_LOCALE_H)
!           AC_DEFINE(HAVE_NAN_H)
!           AC_DEFINE(HAVE_SYS_FILIO_H)
!           AC_DEFINE(HAVE_SYS_IOCTL_H)
!           AC_DEFINE(HAVE_SYS_ISA_DEFS_H)
!           AC_DEFINE(HAVE_SYS_RESOURCE_H)
!           AC_DEFINE(HAVE_SYS_TIME_H)
!           AC_DEFINE(HAVE_SYS_TYPES_H)
!           AC_DEFINE(HAVE_UNISTD_H)
!           AC_DEFINE(HAVE_WCHAR_H)
!           AC_DEFINE(HAVE_WCTYPE_H)
!           AC_DEFINE(HAVE_LIBM)
!          ;;
        esac
+       case "$target" in
+         sparc*-*-solaris2.8 | sparc*-*-solaris2.9)
+           # I saw these on sparc-sun-solaris2.8, but not 2.6, and not on i386
+           AC_DEFINE(HAVE___BUILTIN_ABS)
+           AC_DEFINE(HAVE___BUILTIN_LABS)
+           AC_DEFINE(HAVE___BUILTIN_FABS)
+           AC_DEFINE(HAVE___BUILTIN_FABSF)
+           AC_DEFINE(HAVE___BUILTIN_FABSL)
+           AC_DEFINE(HAVE___BUILTIN_COS)
+           AC_DEFINE(HAVE___BUILTIN_COSF)
+           AC_DEFINE(HAVE___BUILTIN_SIN)
+           AC_DEFINE(HAVE___BUILTIN_SINF)
+          ;;
+       esac
        AC_DEFINE(HAVE_STRTOF)
        AC_DEFINE(HAVE_STRTOLD)
        AC_DEFINE(HAVE_MMAP) 


More information about the Libstdc++ mailing list