svn commit: trunk/buildroot/toolchain/gcc/4.2

Peter S. Mazinger ps.m at gmx.net
Fri Apr 21 12:17:24 UTC 2006


On Tue, 18 Apr 2006, Peter S. Mazinger wrote:

> better to handle in buildroot this as follows (to keep in sync all the 
> time w/ the gcc-gnu provided version):
> 
> 1.
> mkdir libstdc++-v3/config/locale/uclibc
> cp libstdc++-v3/config/locale/gnu/* libstdc++-v3/config/locale/uclibc/
> 
> the part below is needed only for gcc<4.2, the gcc HEAD version does have 
> this directory already (and does not need any patching)
> 
> 2.
> mkdir libstdc++-v3/config/os/uclibc
> cp libstdc++-v3/config/os/gnu-linux/* libstdc++-v3/config/os/uclibc/
> 
> 3. create only the needed difference patches.
> This will allow to keep the patches small, and show what really is needed 
> for uClibc to be properly supported, the current full-blown patches do not 
> tell us anything, unless you do a diff yourself between the gnu and the 
> uclibc version.

Attached are the proposed patches, for gcc-4.2(.0_20060415) only 
- uc-locale.dif is needed (replacing the *locale* patch in buildroot)
- uc-os.dif shows how the other part should look like (for gcc<4.2)

I have used __UCLIBC_HAS_XLOCALE__ only in visible headers, for internal 
purposes I redefined __GLIBC_MINOR__ to 3, keeping the patches minimal.

For all gcc<4.2 there is an additional part that is missing from 
uc-locale.dif to handle configure/autoconf parts related to libm 
features, (gcc>=4.2 does not hardcode the libm features for uclibc, 
because uclibc's features depend on C99_MATH enabled/disabled, so they 
are autodetected)

For config/os/uclibc (uc-os.dif) we could also make use of 
_GLIBCXX_C_LOCALE_GNU (defining it to 0), minimizing that patch as well.

I have built gcc-4.2 w/ LOCALE disabled|enabled, did no test w/ XLOCALE. 
Those needing XLOCALE functionality (I do not use it), please do a build 
and send me the output of readelf -s libstdc++.so.

Thanks, Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2
-------------- next part --------------
--- gcc-4.2-20060415/libstdc++-v3/include/c_std/std_cwchar.h.locale~	2006-04-21 13:22:13 +0200
+++ gcc-4.2-20060415/libstdc++-v3/include/c_std/std_cwchar.h	2006-04-21 13:22:57 +0200
@@ -182,7 +182,9 @@
   using ::wcscoll;
   using ::wcscpy;
   using ::wcscspn;
+#if _GLIBCXX_HAVE_WCSFTIME
   using ::wcsftime;
+#endif
   using ::wcslen;
   using ::wcsncat;
   using ::wcsncmp;
--- gcc-4.2-20060415/libstdc++-v3/include/c_compatibility/wchar.h.locale~	2006-04-21 13:22:13 +0200
+++ gcc-4.2-20060415/libstdc++-v3/include/c_compatibility/wchar.h	2006-04-21 13:22:57 +0200
@@ -101,7 +101,9 @@
 using std::wmemcpy;
 using std::wmemmove;
 using std::wmemset;
+#if _GLIBCXX_HAVE_WCSFTIME
 using std::wcsftime;
+#endif
 
 #if _GLIBCXX_USE_C99
 using std::wcstold;
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/c++locale_internal.h.locale~	2005-08-17 04:28:44 +0200
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/c++locale_internal.h	2006-04-21 13:22:57 +0200
@@ -32,6 +32,15 @@
 #include <bits/c++config.h>
 #include <clocale>
 
+#ifdef __UCLIBC_HAS_XLOCALE__
+# undef __GLIBC_MINOR__
+# define __GLIBC_MINOR__ 3
+#endif
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning clean this up
+#endif
+
 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
                                                   
 extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
@@ -56,4 +65,51 @@
 extern "C" __typeof(wctype_l) __wctype_l;
 #endif 
 
+# define __nl_langinfo_l nl_langinfo_l
+# define __strcoll_l strcoll_l
+# define __strftime_l strftime_l
+# define __strtod_l strtod_l
+# define __strtof_l strtof_l
+# define __strtold_l strtold_l
+# define __strxfrm_l strxfrm_l
+# define __newlocale newlocale
+# define __freelocale freelocale
+# define __duplocale duplocale
+# define __uselocale uselocale
+
+# ifdef _GLIBCXX_USE_WCHAR_T
+#  define __iswctype_l iswctype_l
+#  define __towlower_l towlower_l
+#  define __towupper_l towupper_l
+#  define __wcscoll_l wcscoll_l
+#  define __wcsftime_l wcsftime_l
+#  define __wcsxfrm_l wcsxfrm_l
+#  define __wctype_l wctype_l
+# endif
+
+#else
+# define __nl_langinfo_l(N, L)       nl_langinfo((N))
+# define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
+# define __strtod_l(S, E, L)         strtod((S), (E))
+# define __strtof_l(S, E, L)         strtof((S), (E))
+# define __strtold_l(S, E, L)        strtold((S), (E))
+# define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
+# warning should dummy __newlocale check for C|POSIX ?
+# define __newlocale(a, b, c)        NULL
+# define __freelocale(a)             ((void)0)
+# define __duplocale(a)              __c_locale()
+// should we add a dummy?
+//# define __uselocale ?
+//
+# ifdef _GLIBCXX_USE_WCHAR_T
+#  define __iswctype_l(C, M, L)       iswctype((C), (M))
+#  define __towlower_l(C, L)          towlower((C))
+#  define __towupper_l(C, L)          towupper((C))
+#  define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
+// wcsftime fails on uClibc
+//#  define __wcsftime_l(S, M, F, T, L)  wcsftime((S), (M), (F), (T)) 
+#  define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
+#  define __wctype_l(S, L)            wctype((S))
+# endif
+
 #endif // GLIBC 2.3 and later
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/c_locale.cc.locale~	2006-02-07 23:23:58 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/c_locale.cc	2006-04-21 13:22:57 +0200
@@ -89,12 +89,14 @@
 				    __c_locale __old)
   {
     __cloc = __newlocale(1 << LC_ALL, __s, __old);
+#ifdef __UCLIBC_HAS_XLOCALE__
     if (!__cloc)
       {
 	// This named locale is not supported by the underlying OS.
 	__throw_runtime_error(__N("locale::facet::_S_create_c_locale "
 			      "name not valid"));
       }
+#endif
   }
   
   void
@@ -120,12 +122,14 @@
       "LC_COLLATE", 
       "LC_MONETARY",
       "LC_MESSAGES", 
+#if _GLIBCXX_NUM_CATEGORIES != 0
       "LC_PAPER", 
       "LC_NAME", 
       "LC_ADDRESS",
       "LC_TELEPHONE", 
       "LC_MEASUREMENT", 
       "LC_IDENTIFICATION" 
+#endif
     };
 
 _GLIBCXX_END_NAMESPACE
@@ -137,7 +141,7 @@
 _GLIBCXX_END_NAMESPACE
 
 // XXX GLIBCXX_ABI Deprecated
-#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
+#if 0 /*def _GLIBCXX_LONG_DOUBLE_COMPAT*/
 #define _GLIBCXX_LDBL_COMPAT(dbl, ldbl) \
   extern "C" void ldbl (void) __attribute__ ((alias (#dbl)))
 _GLIBCXX_LDBL_COMPAT(_ZSt14__convert_to_vIdEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct, _ZSt14__convert_to_vIeEvPKcRT_RSt12_Ios_IostateRKP15__locale_struct);
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/c_locale.h.locale~	2005-12-19 01:56:05 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/c_locale.h	2006-04-21 13:38:36 +0200
@@ -42,24 +42,44 @@
 #include <cstdio>               // get std::snprintf or std::sprintf
 #include <clocale>
 #include <langinfo.h>		// For codecvt
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this
+#endif
+#ifdef _GLIBCXX_USE_ICONV
 #include <iconv.h>		// For codecvt using iconv, iconv_t
+#endif
+#ifdef _GLIBCXX_USE_NLS
 #include <libintl.h> 		// For messages
+#endif
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning what is _GLIBCXX_C_LOCALE_GNU for
+#warning fix categories
+#endif
 #define _GLIBCXX_C_LOCALE_GNU 1
 
+#ifndef __UCLIBC__
 #define _GLIBCXX_NUM_CATEGORIES 6
+#else
+#define _GLIBCXX_NUM_CATEGORIES 0
+#endif
 
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+#ifdef __UCLIBC_HAS_XLOCALE__
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
   extern "C" __typeof(uselocale) __uselocale;
+#define __uselocale uselocale
 
 _GLIBCXX_END_NAMESPACE
 #endif
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+#ifdef __UCLIBC_HAS_XLOCALE__
   typedef __locale_t		__c_locale;
+#else
+  typedef int*			__c_locale;
+#endif
 
   // Convert numeric value of type _Tv to string and return length of
   // string.  If snprintf is available use it, otherwise fall back to
@@ -70,7 +90,7 @@
     __convert_from_v(char* __out, 
 		     const int __size __attribute__ ((__unused__)),
 		     const char* __fmt,
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+#ifdef __UCLIBC_HAS_XLOCALE__
 		     _Tv __v, const __c_locale& __cloc, int __prec)
     {
       __c_locale __old = __gnu_cxx::__uselocale(__cloc);
@@ -83,13 +103,13 @@
       std::setlocale(LC_ALL, "C");
 #endif
 
-#ifdef _GLIBCXX_USE_C99
+#ifdef __UCLIBC__
       const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
 #else
       const int __ret = std::sprintf(__out, __fmt, __prec, __v);
 #endif
 
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+#ifdef __UCLIBC_HAS_XLOCALE__
       __gnu_cxx::__uselocale(__old);
 #else
       std::setlocale(LC_ALL, __sav);
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/ctype_members.cc.locale~	2005-12-19 01:56:05 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/ctype_members.cc	2006-04-21 13:52:24 +0200
@@ -33,6 +33,12 @@
 
 // Written by Benjamin Kosnik <bkoz at redhat.com>
 
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
+# define _LIBC
+# include <locale>
+# undef _LIBC
+#endif
 #include <locale>
 #include <bits/c++locale_internal.h>
 
@@ -48,9 +54,11 @@
 	{
 	  this->_S_destroy_c_locale(this->_M_c_locale_ctype);
 	  this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
+#ifdef __UCLIBC_HAS_XLOCALE__
 	  this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
 	  this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
 	  this->_M_table = this->_M_c_locale_ctype->__ctype_b;
+#endif
 	}
     }
 
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/messages_members.cc.locale~	2005-12-19 01:56:05 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/messages_members.cc	2006-04-21 13:22:57 +0200
@@ -36,6 +36,16 @@
 #include <locale>
 #include <bits/c++locale_internal.h>
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix gettext stuff
+#endif
+#undef gettext
+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
+#define gettext(msgid) dcgettext(NULL, msgid, LC_MESSAGES)
+#else
+#define gettext(msgid) (msgid)
+#endif
+
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // Specializations.
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/messages_members.h.locale~	2005-10-21 10:34:06 +0200
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/messages_members.h	2006-04-21 13:22:57 +0200
@@ -33,6 +33,17 @@
 
 // Written by Benjamin Kosnik <bkoz at redhat.com>
 
+#include <features.h>
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix prototypes for *textdomain funcs
+#endif
+#ifndef __UCLIBC_HAS_GETTEXT_AWARENESS__
+#undef textdomain
+#undef bindtextdomain
+#define textdomain(D)           ((void)0)
+#define bindtextdomain(D,P)     ((void)0)
+#endif
+
   // Non-virtual member functions.
   template<typename _CharT>
      messages<_CharT>::messages(size_t __refs)
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/monetary_members.cc.locale~	2005-12-19 01:56:05 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/monetary_members.cc	2006-04-21 13:22:57 +0200
@@ -33,9 +33,20 @@
 
 // Written by Benjamin Kosnik <bkoz at redhat.com>
 
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
+# define _LIBC
+# include <locale>
+# undef _LIBC
+#endif
 #include <locale>
 #include <bits/c++locale_internal.h>
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning optimize this for uclibc
+#warning tailor for stub locale support
+#endif
+
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // Construct and return valid pattern consisting of some combination of:
@@ -387,12 +398,25 @@
 	  setlocale(LC_ALL, __name);
 #endif
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this... should be monetary
+#endif
+#ifdef __UCLIBC__
+# ifdef __UCLIBC_HAS_XLOCALE__
+	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+# elif defined __UCLIBC_HAS_LOCALE__
+	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+# endif
+#else
 	  union { char *__s; wchar_t __w; } __u;
 	  __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
 	  _M_data->_M_decimal_point = __u.__w;
 
 	  __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
 	  _M_data->_M_thousands_sep = __u.__w;
+#endif
 	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
 	  _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
 
@@ -529,12 +553,25 @@
 	  setlocale(LC_ALL, __name);
 #endif
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this... should be monetary
+#endif
+#ifdef __UCLIBC__
+# ifdef __UCLIBC_HAS_XLOCALE__
+	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+# elif defined __UCLIBC_HAS_LOCALE__
+	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+# endif
+#else
           union { char *__s; wchar_t __w; } __u;
 	  __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
 	  _M_data->_M_decimal_point = __u.__w;
 
 	  __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
 	  _M_data->_M_thousands_sep = __u.__w;
+#endif
 	  _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
           _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
 
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/numeric_members.cc.locale~	2005-12-19 01:56:05 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/numeric_members.cc	2006-04-21 13:22:57 +0200
@@ -33,9 +33,19 @@
 
 // Written by Benjamin Kosnik <bkoz at redhat.com>
 
+#include <features.h>
+#ifdef __UCLIBC_HAS_LOCALE__
+# define _LIBC
+# include <locale>
+# undef _LIBC
+#endif
 #include <locale>
 #include <bits/c++locale_internal.h>
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning tailor for stub locale support
+#endif
+
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   template<> 
@@ -121,12 +131,25 @@
 	{
 	  // Named locale.
 	  // NB: In the GNU model wchar_t is always 32 bit wide.
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning fix this... should be numeric
+#endif
+#ifdef __UCLIBC__
+# ifdef __UCLIBC_HAS_XLOCALE__
+	  _M_data->_M_decimal_point = __cloc->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
+# elif defined __UCLIBC_HAS_LOCALE__
+	  _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
+	  _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
+# endif
+#else
 	  union { char *__s; wchar_t __w; } __u;
 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
 	  _M_data->_M_decimal_point = __u.__w;
 
 	  __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
 	  _M_data->_M_thousands_sep = __u.__w;
+#endif
 
 	  if (_M_data->_M_thousands_sep == L'\0')
 	    _M_data->_M_grouping = "";
--- gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/time_members.cc.locale~	2005-12-19 01:56:05 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/locale/uclibc/time_members.cc	2006-04-21 13:22:57 +0200
@@ -37,6 +37,10 @@
 #include <locale>
 #include <bits/c++locale_internal.h>
 
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning tailor for stub locale support
+#endif
+
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
   template<>
@@ -199,6 +203,7 @@
 	   const tm* __tm) const
     {
 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
+      __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
       const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
 					_M_c_locale_timepunct);
 #else
@@ -220,7 +225,8 @@
       if (!_M_data)
 	_M_data = new __timepunct_cache<wchar_t>;
 
-      if (!__cloc)
+#warning wide time stuff
+//      if (!__cloc)
 	{
 	  // "C" locale
 	  _M_c_locale_timepunct = _S_get_c_locale();
@@ -281,6 +287,7 @@
 	  _M_data->_M_amonth11 = L"Nov";
 	  _M_data->_M_amonth12 = L"Dec";
 	}
+#if 0
       else
 	{
 	  _M_c_locale_timepunct = _S_clone_c_locale(__cloc); 
@@ -390,6 +397,7 @@
 	  __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
 	  _M_data->_M_amonth12 = __u.__w;
 	}
+#endif // 0
     }
 #endif
 
--- gcc-4.2-20060415/libstdc++-v3/acinclude.m4.locale~	2006-03-10 14:24:57 +0100
+++ gcc-4.2-20060415/libstdc++-v3/acinclude.m4	2006-04-21 13:22:57 +0200
@@ -1371,7 +1371,7 @@
   AC_MSG_CHECKING([for C locale to use])
   GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
     [use MODEL for target locale package],
-    [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
+    [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
   
   # If they didn't use this option switch, or if they specified --enable
   # with no specific model, we'll have to look for one.  If they
@@ -1387,6 +1387,9 @@
   # Default to "generic".
   if test $enable_clocale_flag = auto; then
     case ${target_os} in
+      *-uclibc*)
+        enable_clocale_flag=uclibc
+        ;;
       linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
         AC_EGREP_CPP([_GLIBCXX_ok], [
         #include <features.h>
@@ -1530,6 +1533,40 @@
       CTIME_CC=config/locale/generic/time_members.cc
       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
       ;;
+    uclibc)
+      AC_MSG_RESULT(uclibc)
+
+      # Declare intention to use gettext, and add support for specific
+      # languages.
+      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
+      ALL_LINGUAS="de fr"
+
+      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
+      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
+      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
+        USE_NLS=yes
+      fi
+      # Export the build objects.
+      for ling in $ALL_LINGUAS; do \
+        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
+        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
+      done
+      AC_SUBST(glibcxx_MOFILES)
+      AC_SUBST(glibcxx_POFILES)
+
+      CLOCALE_H=config/locale/uclibc/c_locale.h
+      CLOCALE_CC=config/locale/uclibc/c_locale.cc
+      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
+      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
+      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
+      CMESSAGES_H=config/locale/uclibc/messages_members.h
+      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
+      CMONEY_CC=config/locale/uclibc/monetary_members.cc
+      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
+      CTIME_H=config/locale/uclibc/time_members.h
+      CTIME_CC=config/locale/uclibc/time_members.cc
+      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
+      ;;
   esac
 
   # This is where the testsuite looks for locale catalogs, using the
--- gcc-4.2-20060415/libstdc++-v3/configure.locale~	2006-03-10 14:24:57 +0100
+++ gcc-4.2-20060415/libstdc++-v3/configure	2006-04-21 13:22:57 +0200
@@ -5764,7 +5764,7 @@
   enableval="$enable_clocale"
 
       case "$enableval" in
-       generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
+       generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
        *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
    { (exit 1); exit 1; }; } ;;
@@ -5789,6 +5789,9 @@
   # Default to "generic".
   if test $enable_clocale_flag = auto; then
     case ${target_os} in
+      linux-uclibc*)
+        enable_clocale_flag=uclibc
+	;;
       linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
         cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6019,6 +6022,76 @@
       CTIME_CC=config/locale/generic/time_members.cc
       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
       ;;
+    uclibc)
+      echo "$as_me:$LINENO: result: uclibc" >&5
+echo "${ECHO_T}uclibc" >&6
+
+      # Declare intention to use gettext, and add support for specific
+      # languages.
+      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
+      ALL_LINGUAS="de fr"
+
+      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
+      # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$check_msgfmt"; then
+  ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_check_msgfmt="yes"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
+fi
+fi
+check_msgfmt=$ac_cv_prog_check_msgfmt
+if test -n "$check_msgfmt"; then
+  echo "$as_me:$LINENO: result: $check_msgfmt" >&5
+echo "${ECHO_T}$check_msgfmt" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
+        USE_NLS=yes
+      fi
+      # Export the build objects.
+      for ling in $ALL_LINGUAS; do \
+        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
+        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
+      done
+
+
+
+      CLOCALE_H=config/locale/uclibc/c_locale.h
+      CLOCALE_CC=config/locale/uclibc/c_locale.cc
+      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
+      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
+      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
+      CMESSAGES_H=config/locale/uclibc/messages_members.h
+      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
+      CMONEY_CC=config/locale/uclibc/monetary_members.cc
+      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
+      CTIME_H=config/locale/uclibc/time_members.h
+      CTIME_CC=config/locale/uclibc/time_members.cc
+      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
+      ;;
   esac
 
   # This is where the testsuite looks for locale catalogs, using the
-------------- next part --------------
diff -uN gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/ctype_base.h gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/ctype_base.h
--- gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/ctype_base.h	2005-08-17 04:28:44 +0200
+++ gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/ctype_base.h	2006-02-17 00:29:10 +0100
@@ -42,12 +42,14 @@
   /// @brief  Base class for ctype.
   struct ctype_base
   {
+    // Note: In uClibc, the following two types depend on configuration.
+ 
     // Non-standard typedefs.
-    typedef const int* 		__to_type;
+    typedef const __ctype_touplow_t* __to_type;
 
     // NB: Offsets into ctype<char>::_M_table force a particular size
     // on the mask type. Because of this, we don't use an enum.
-    typedef unsigned short 	mask;   
+    typedef __ctype_mask_t	mask;   
     static const mask upper    	= _ISupper;
     static const mask lower 	= _ISlower;
     static const mask alpha 	= _ISalpha;
diff -uN gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/ctype_noninline.h
--- gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/ctype_noninline.h	2005-08-17 04:28:44 +0200
+++ gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/ctype_noninline.h	2006-02-17 00:29:10 +0100
@@ -34,99 +34,32 @@
   
 // Information as gleaned from /usr/include/ctype.h
 
-#if _GLIBCXX_C_LOCALE_GNU
   const ctype_base::mask*
   ctype<char>::classic_table() throw()
-  { return _S_get_c_locale()->__ctype_b; }
-#else
-  const ctype_base::mask*
-  ctype<char>::classic_table() throw()
-  {
-    const ctype_base::mask* __ret;
-    char* __old = strdup(setlocale(LC_CTYPE, NULL));
-    setlocale(LC_CTYPE, "C");
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-    __ret = *__ctype_b_loc();
-#else
-    __ret = __ctype_b;
-#endif
-    setlocale(LC_CTYPE, __old);
-    free(__old);
-    return __ret;
-  }
-#endif
+  { return __C_ctype_b; }
 
-#if _GLIBCXX_C_LOCALE_GNU
-  ctype<char>::ctype(__c_locale __cloc, const mask* __table, bool __del, 
-		     size_t __refs) 
-  : facet(__refs), _M_c_locale_ctype(_S_clone_c_locale(__cloc)), 
-  _M_del(__table != 0 && __del), 
-  _M_toupper(_M_c_locale_ctype->__ctype_toupper),  
-  _M_tolower(_M_c_locale_ctype->__ctype_tolower), 
-  _M_table(__table ? __table : _M_c_locale_ctype->__ctype_b), 
-  _M_widen_ok(0), _M_narrow_ok(0) 
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-#else
   ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
 		     size_t __refs) 
   : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
   _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
   {
-    char* __old=strdup(setlocale(LC_CTYPE, NULL));
-    setlocale(LC_CTYPE, "C");
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-    _M_toupper = *__ctype_toupper_loc();
-    _M_tolower = *__ctype_tolower_loc();
-    _M_table = __table ? __table : *__ctype_b_loc();
-#else
-    _M_toupper = __ctype_toupper;
-    _M_tolower = __ctype_tolower;
-    _M_table = __table ? __table : __ctype_b;
-#endif
-    setlocale(LC_CTYPE, __old);
-    free(__old);
+    _M_toupper = __C_ctype_toupper;
+    _M_tolower = __C_ctype_tolower;
+    _M_table = __table ? __table : __C_ctype_b;
     memset(_M_widen, 0, sizeof(_M_widen));
     memset(_M_narrow, 0, sizeof(_M_narrow));
   }
-#endif
 
-#if _GLIBCXX_C_LOCALE_GNU
-  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) 
-  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
-  _M_del(__table != 0 && __del),
-  _M_toupper(_M_c_locale_ctype->__ctype_toupper),  
-  _M_tolower(_M_c_locale_ctype->__ctype_tolower), 
-  _M_table(__table ? __table : _M_c_locale_ctype->__ctype_b), 
-  _M_widen_ok(0), _M_narrow_ok(0) 
-  {
-    memset(_M_widen, 0, sizeof(_M_widen));
-    memset(_M_narrow, 0, sizeof(_M_narrow));
-  }
-#else
   ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
   : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
   _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
   {
-    char* __old=strdup(setlocale(LC_CTYPE, NULL));
-    setlocale(LC_CTYPE, "C");
-#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
-    _M_toupper = *__ctype_toupper_loc();
-    _M_tolower = *__ctype_tolower_loc();
-    _M_table = __table ? __table : *__ctype_b_loc();
-#else
-    _M_toupper = __ctype_toupper;
-    _M_tolower = __ctype_tolower;
-    _M_table = __table ? __table : __ctype_b;
-#endif
-    setlocale(LC_CTYPE, __old);
-    free(__old);
+    _M_toupper = __C_ctype_toupper;
+    _M_tolower = __C_ctype_tolower;
+    _M_table = __table ? __table : __C_ctype_b;
     memset(_M_widen, 0, sizeof(_M_widen));
     memset(_M_narrow, 0, sizeof(_M_narrow));
   }
-#endif
 
   char
   ctype<char>::do_toupper(char __c) const
diff -uN gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/ldbl-extra.ver
--- gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/ldbl-extra.ver	2006-02-07 23:23:58 +0100
+++ gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/ldbl-extra.ver	1970-01-01 01:00:00 +0100
@@ -1,26 +0,0 @@
-# Appended to version file.
-
-GLIBCXX_LDBL_3.4 {
-  _ZNSt14numeric_limitsIg*;
-  _ZNSirsERg;
-  _ZNSolsEg;
-  _ZNSt13basic_istreamIwSt11char_traitsIwEErsERg;
-  _ZNSt13basic_ostreamIwSt11char_traitsIwEElsEg;
-  _ZSt14__convert_to_vIgEvPKcRT_RSt12_Ios_IostateRKP*;
-  _ZStlsIg[cw]St11char_traitsI[cw]EERSt13basic_ostreamIT0_T1_ES6_RKSt7complexIT_E;
-  _ZStrsIg[cw]St11char_traitsI[cw]EERSt13basic_istreamIT0_T1_ES6_RSt7complexIT_E;
-  *__gnu_cxx_ldbl128*;
-};
-
-GLIBCXX_LDBL_3.4.7 {
-  _ZNSi10_M_extractIgEERSiRT_;
-  _ZNSt13basic_istreamIwSt11char_traitsIwEE10_M_extractIgEERS2_RT_;
-  _ZNSo9_M_insertIgEERSoT_;
-  _ZNSt13basic_ostreamIwSt11char_traitsIwEE9_M_insertIgEERS2_T_;
-} GLIBCXX_LDBL_3.4;
-
-CXXABI_LDBL_1.3 {
-  _ZT[IS]g;
-  _ZT[IS]Pg;
-  _ZT[IS]PKg;
-};
diff -uN gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/os_defines.h gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/os_defines.h
--- gcc-4.2-20060415/libstdc++-v3/config/os/gnu-linux/os_defines.h	2005-08-17 04:28:44 +0200
+++ gcc-4.2-20060415/libstdc++-v3/config/os/uclibc/os_defines.h	2006-02-17 00:29:10 +0100
@@ -39,8 +39,6 @@
 #include <features.h>
 
 // We must not see the optimized string functions GNU libc defines.
-#if defined __GLIBC__ && __GLIBC__ >= 2
 #define __NO_STRING_INLINES
-#endif
 
 #endif


More information about the uClibc mailing list