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

Brad Spencer spencer@infointeractive.com
Wed Sep 24 23:05:00 GMT 2003


In this old thread, I promised some new configury for *-*-solaris2.x
to add wchar_t support for native and cross compilers.  Well, I
finally got some moments, and here's a new version of the patch that
works with the trunk cvs sources after all of Phil's hard work :)

The caveats of my original message still apply.  See:

http://gcc.gnu.org/ml/libstdc++/2003-07/msg00424.html

I've tested that this successfully enables the whcar_t specializations
(wstring and so on) in sparc-sun-solaris2.8 targeted cross and native
compilers.  I used autoconf-2.57 and automake-1.7.7.

Thanks for the help!

-- 
------------------------------------------------------------------
Brad Spencer - spencer@infointeractive.com - "It's quite nice..."
Systems Architect | InfoInterActive Corp. | A Canadian AOL Company
-------------- next part --------------
Index: acinclude.m4
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.271
diff -u -p -r1.271 acinclude.m4
--- acinclude.m4	18 Sep 2003 14:27:19 -0000	1.271
+++ acinclude.m4	24 Sep 2003 21:48:39 -0000
@@ -383,12 +383,17 @@ AC_DEFUN(GLIBCXX_CHECK_WCHAR_T_SUPPORT, 
 
     # 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 \
+    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])
+
+    # Checks for non-required wide character functions that are not required
+    # for basic wchar_t support.  Don't disable support if they are missing.
+    # 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 &&
Index: config.h.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/config.h.in,v
retrieving revision 1.71
diff -u -p -r1.71 config.h.in
--- config.h.in	2 Sep 2003 18:46:47 -0000	1.71
+++ config.h.in	24 Sep 2003 21:48:39 -0000
@@ -662,6 +662,9 @@
 /* Define to 1 if you have the `wscanf' function. */
 #undef HAVE_WSCANF
 
+/* Define if you have the `iswblank' function.  */
+#undef HAVE_ISWBLANK
+
 /* Define to 1 if you have the `_acosf' function. */
 #undef HAVE__ACOSF
 
Index: crossconfig.m4
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/crossconfig.m4,v
retrieving revision 1.2
diff -u -p -r1.2 crossconfig.m4
--- crossconfig.m4	20 Aug 2003 03:32:00 -0000	1.2
+++ crossconfig.m4	24 Sep 2003 21:48:39 -0000
@@ -208,17 +208,120 @@ case "${host}" in
     AC_DEFINE(HAVE_SINHL)
     ;;
   *-solaris*)
-    #case "$target" in
+    case "$target" in
     #  *-solaris2.5)
     #    os_include_dir="os/solaris/solaris2.5"
     #    ;;
     #  *-solaris2.6)
     #    os_include_dir="os/solaris/solaris2.6"
     #    ;;
-    #  *-solaris2.7 | *-solaris2.8 | *-solaris2.9)
-    #    os_include_dir="os/solaris/solaris2.7"
-    #    ;;
-    #esac
+      *-solaris2.7 | *-solaris2.8 | *-solaris2.9)
+         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)
+         # Look for the pieces required for wchar_t support in order to
+         # get all the right HAVE_* macros defined.
+         GLIBCXX_CHECK_WCHAR_T_SUPPORT
+         # All of the dependencies for wide character support are here, so
+         # turn it on.  This requires some syncronization with the
+         # GLIBCXX_CHECK_WCHAR_T_SUPPORT in acinclude.m4
+         AC_DEFINE(_GLIBCXX_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) 
Index: config/io/basic_file_stdio.cc
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/config/io/basic_file_stdio.cc,v
retrieving revision 1.19
diff -u -p -r1.19 basic_file_stdio.cc
--- config/io/basic_file_stdio.cc	18 Sep 2003 14:02:46 -0000	1.19
+++ config/io/basic_file_stdio.cc	24 Sep 2003 21:48:39 -0000
@@ -36,6 +36,11 @@
 #include <unistd.h>
 #include <errno.h>
 
+#ifdef _GLIBCXX_HAVE_UNISTD_H
+// Pick up ioctl on Solaris 2.8
+#include <unistd.h>
+#endif
+
 #ifdef _GLIBCXX_HAVE_SYS_IOCTL_H
 #define BSD_COMP /* Get FIONREAD on Solaris2. */
 #include <sys/ioctl.h>
Index: include/c_compatibility/wchar.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/include/c_compatibility/wchar.h,v
retrieving revision 1.2
diff -u -p -r1.2 wchar.h
--- include/c_compatibility/wchar.h	5 Jul 2003 04:05:36 -0000	1.2
+++ include/c_compatibility/wchar.h	24 Sep 2003 21:48:39 -0000
@@ -50,11 +50,17 @@ using std::fwscanf;
 using std::swprintf;
 using std::swscanf;
 using std::vfwprintf;
+#if _GLIBCXX_HAVE_VFWSCANF
 using std::vfwscanf;
+#endif // _GLIBCXX_HAVE_VFWSCANF
 using std::vswprintf;
+#if _GLIBCXX_HAVE_VSWSCANF
 using std::vswscanf;
+#endif // _GLIBCXX_HAVE_VSWSCANF
 using std::vwprintf;
+#if _GLIBCXX_HAVE_VWSCANF
 using std::vwscanf;
+#endif // _GLIBCXX_HAVE_VWSCANF
 using std::wprintf;
 using std::wscanf;
 using std::getwc;
@@ -69,7 +75,9 @@ using std::putwchar;
 using std::ungetwc;
 using std::wcrtomb;
 using std::wcstod;
+#if _GLIBCXX_HAVE_WCSTOF
 using std::wcstof;
+#endif // _GLIBCXX_HAVE_WCSTOF
 using std::wcstol;
 using std::wcstoul;
 using std::wcscpy;
Index: include/c_std/std_cwchar.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/include/c_std/std_cwchar.h,v
retrieving revision 1.7
diff -u -p -r1.7 std_cwchar.h
--- include/c_std/std_cwchar.h	23 Jul 2003 15:28:44 -0000	1.7
+++ include/c_std/std_cwchar.h	24 Sep 2003 21:48:39 -0000
@@ -92,11 +92,17 @@ namespace std 
 #undef swscanf
 #undef ungetwc
 #undef vfwprintf
+#if _GLIBCXX_HAVE_VFWSCANF
 #undef vfwscanf
+#endif // _GLIBCXX_HAVE_VFWSCANF
 #undef vswprintf
+#if _GLIBCXX_HAVE_VSWSCANF
 #undef vswscanf
+#endif // _GLIBCXX_HAVE_VSWSCANF
 #undef vwprintf
+#if _GLIBCXX_HAVE_VWSCANF
 #undef vwscanf
+#endif // _GLIBCXX_HAVE_VWSCANF
 #undef wcrtomb
 #undef wcscat
 #undef wcschr
@@ -115,7 +121,9 @@ namespace std 
 #undef wcsspn
 #undef wcsstr
 #undef wcstod
+#if _GLIBCXX_HAVE_WCSTOF
 #undef wcstof
+#endif // _GLIBCXX_HAVE_WCSTOF
 #undef wcstok
 #undef wcstol
 #undef wcstoul
@@ -154,11 +162,17 @@ namespace std
   using ::swscanf;
   using ::ungetwc;
   using ::vfwprintf;
+#if _GLIBCXX_HAVE_VFWSCANF
   using ::vfwscanf;
+#endif // _GLIBCXX_HAVE_VFWSCANF
   using ::vswprintf;
+#if _GLIBCXX_HAVE_VSWSCANF
   using ::vswscanf;
+#endif // _GLIBCXX_HAVE_VWSCANF
   using ::vwprintf;
+#if _GLIBCXX_HAVE_VWSCANF
   using ::vwscanf;
+#endif // _GLIBCXX_HAVE_VWSCANF
   using ::wcrtomb;
   using ::wcscat;
   using ::wcscmp;
@@ -173,7 +187,9 @@ namespace std
   using ::wcsrtombs;
   using ::wcsspn;
   using ::wcstod;
+#if _GLIBCXX_HAVE_WCSTOF
   using ::wcstof;
+#endif // _GLIBCXX_HAVE_WCSTOF
   using ::wcstok;
   using ::wcstol;
   using ::wcstoul;
Index: include/c_std/std_cwctype.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/include/c_std/std_cwctype.h,v
retrieving revision 1.7
diff -u -p -r1.7 std_cwctype.h
--- include/c_std/std_cwctype.h	23 Jul 2003 15:28:44 -0000	1.7
+++ include/c_std/std_cwctype.h	24 Sep 2003 21:48:39 -0000
@@ -55,7 +55,9 @@
 // Get rid of those macros defined in <wctype.h> in lieu of real functions.
 #undef iswalnum
 #undef iswalpha
+#if _GLIBCXX_HAVE_ISWBLANK
 #undef iswblank
+#endif // _GLIBCXX_HAVE_ISWBLANK
 #undef iswcntrl
 #undef iswdigit
 #undef iswgraph
@@ -83,7 +85,9 @@ namespace std
 
   using ::iswalnum;
   using ::iswalpha;
+#if _GLIBCXX_HAVE_ISWBLANK
   using ::iswblank;
+#endif // _GLIBCXX_HAVE_ISWBLANK
   using ::iswcntrl;
   using ::iswdigit;
   using ::iswgraph;


More information about the Libstdc++ mailing list