Initial revision
[openwrt.git] / toolchain / gcc / 3.4.1 / 200-uclibc-locale.patch
1 diff -urN gcc-3.4.1-dist/libstdc++-v3/acinclude.m4 gcc-3.4.1/libstdc++-v3/acinclude.m4
2 --- gcc-3.4.1-dist/libstdc++-v3/acinclude.m4    2004-05-14 05:53:11.000000000 -0500
3 +++ gcc-3.4.1/libstdc++-v3/acinclude.m4 2004-08-12 15:54:48.000000000 -0500
4 @@ -996,7 +996,7 @@
5    AC_MSG_CHECKING([for C locale to use])
6    GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
7      [use MODEL for target locale package],
8 -    [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
9 +    [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
10    
11    # If they didn't use this option switch, or if they specified --enable
12    # with no specific model, we'll have to look for one.  If they
13 @@ -1012,6 +1012,9 @@
14    # Default to "generic".
15    if test $enable_clocale_flag = auto; then
16      case x${target_os} in
17 +      x*-uclibc*)
18 +        enable_clocale_flag=uclibc
19 +        ;;
20        xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
21          AC_EGREP_CPP([_GLIBCXX_ok], [
22          #include <features.h>
23 @@ -1138,6 +1141,41 @@
24        CTIME_CC=config/locale/generic/time_members.cc
25        CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
26        ;;
27 +    uclibc)
28 +      AC_MSG_RESULT(uclibc)
29 +
30 +      # Declare intention to use gettext, and add support for specific
31 +      # languages.
32 +      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
33 +      ALL_LINGUAS="de fr"
34 +
35 +      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
36 +      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
37 +      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
38 +        USE_NLS=yes
39 +      fi
40 +      # Export the build objects.
41 +      for ling in $ALL_LINGUAS; do \
42 +        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
43 +        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
44 +      done
45 +      AC_SUBST(glibcxx_MOFILES)
46 +      AC_SUBST(glibcxx_POFILES)
47 +
48 +      CLOCALE_H=config/locale/uclibc/c_locale.h
49 +      CLOCALE_CC=config/locale/uclibc/c_locale.cc
50 +      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
51 +      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
52 +      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
53 +      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
54 +      CMESSAGES_H=config/locale/uclibc/messages_members.h
55 +      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
56 +      CMONEY_CC=config/locale/uclibc/monetary_members.cc
57 +      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
58 +      CTIME_H=config/locale/uclibc/time_members.h
59 +      CTIME_CC=config/locale/uclibc/time_members.cc
60 +      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
61 +      ;;
62    esac
63  
64    # This is where the testsuite looks for locale catalogs, using the
65 diff -urN gcc-3.4.1-dist/libstdc++-v3/aclocal.m4 gcc-3.4.1/libstdc++-v3/aclocal.m4
66 --- gcc-3.4.1-dist/libstdc++-v3/aclocal.m4      2004-05-15 15:43:59.000000000 -0500
67 +++ gcc-3.4.1/libstdc++-v3/aclocal.m4   2004-08-12 16:14:37.000000000 -0500
68 @@ -1025,6 +1025,9 @@
69    # Default to "generic".
70    if test $enable_clocale_flag = auto; then
71      case x${target_os} in
72 +      x*-uclibc*)
73 +       enable_clocale_flag=uclibc
74 +       ;;
75        xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
76          AC_EGREP_CPP([_GLIBCXX_ok], [
77          #include <features.h>
78 @@ -1151,6 +1154,41 @@
79        CTIME_CC=config/locale/generic/time_members.cc
80        CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
81        ;;
82 +    uclibc)
83 +      AC_MSG_RESULT(uclibc)
84 +
85 +      # Declare intention to use gettext, and add support for specific
86 +      # languages.
87 +      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
88 +      ALL_LINGUAS="de fr"
89 +
90 +      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
91 +      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
92 +      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
93 +        USE_NLS=yes
94 +      fi
95 +      # Export the build objects.
96 +      for ling in $ALL_LINGUAS; do \
97 +        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
98 +        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
99 +      done
100 +      AC_SUBST(glibcxx_MOFILES)
101 +      AC_SUBST(glibcxx_POFILES)
102 +
103 +      CLOCALE_H=config/locale/uclibc/c_locale.h
104 +      CLOCALE_CC=config/locale/uclibc/c_locale.cc
105 +      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
106 +      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
107 +      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
108 +      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
109 +      CMESSAGES_H=config/locale/uclibc/messages_members.h
110 +      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
111 +      CMONEY_CC=config/locale/uclibc/monetary_members.cc
112 +      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
113 +      CTIME_H=config/locale/uclibc/time_members.h
114 +      CTIME_CC=config/locale/uclibc/time_members.cc
115 +      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
116 +      ;;
117    esac
118  
119    # This is where the testsuite looks for locale catalogs, using the
120 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-3.4.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
121 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/c++locale_internal.h       1969-12-31 18:00:00.000000000 -0600
122 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/c++locale_internal.h    2004-08-12 15:54:48.000000000 -0500
123 @@ -0,0 +1,59 @@
124 +// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
125 +
126 +// Copyright (C) 2002, 2004 Free Software Foundation, Inc.
127 +//
128 +// This file is part of the GNU ISO C++ Library.  This library is free
129 +// software; you can redistribute it and/or modify it under the
130 +// terms of the GNU General Public License as published by the
131 +// Free Software Foundation; either version 2, or (at your option)
132 +// any later version.
133 +
134 +// This library is distributed in the hope that it will be useful,
135 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
136 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
137 +// GNU General Public License for more details.
138 +
139 +// You should have received a copy of the GNU General Public License along
140 +// with this library; see the file COPYING.  If not, write to the Free
141 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
142 +// USA.
143 +
144 +// As a special exception, you may use this file as part of a free software
145 +// library without restriction.  Specifically, if other files instantiate
146 +// templates or use macros or inline functions from this file, or you compile
147 +// this file and link it with other files to produce an executable, this
148 +// file does not by itself cause the resulting executable to be covered by
149 +// the GNU General Public License.  This exception does not however
150 +// invalidate any other reasons why the executable file might be covered by
151 +// the GNU General Public License.
152 +
153 +// Written by Jakub Jelinek <jakub@redhat.com>
154 +
155 +#include <clocale>
156 +
157 +#ifdef __UCLIBC_MJN3_ONLY__
158 +#warning clean this up
159 +#endif
160 +
161 +#ifdef __UCLIBC_HAS_XLOCALE__
162 +                                                  
163 +extern "C" __typeof(iswctype_l) __iswctype_l;
164 +extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
165 +extern "C" __typeof(strcoll_l) __strcoll_l;
166 +extern "C" __typeof(strftime_l) __strftime_l;
167 +extern "C" __typeof(strtod_l) __strtod_l;
168 +extern "C" __typeof(strtof_l) __strtof_l;
169 +extern "C" __typeof(strtold_l) __strtold_l;
170 +extern "C" __typeof(strxfrm_l) __strxfrm_l;
171 +extern "C" __typeof(towlower_l) __towlower_l;
172 +extern "C" __typeof(towupper_l) __towupper_l;
173 +extern "C" __typeof(wcscoll_l) __wcscoll_l;
174 +extern "C" __typeof(wcsftime_l) __wcsftime_l;
175 +extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
176 +extern "C" __typeof(wctype_l) __wctype_l;
177 +extern "C" __typeof(newlocale) __newlocale;
178 +extern "C" __typeof(freelocale) __freelocale;
179 +extern "C" __typeof(duplocale) __duplocale;
180 +extern "C" __typeof(uselocale) __uselocale;
181 +
182 +#endif // GLIBC 2.3 and later
183 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/c_locale.cc
184 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/c_locale.cc        1969-12-31 18:00:00.000000000 -0600
185 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/c_locale.cc     2004-08-12 15:54:48.000000000 -0500
186 @@ -0,0 +1,160 @@
187 +// Wrapper for underlying C-language localization -*- C++ -*-
188 +
189 +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
190 +//
191 +// This file is part of the GNU ISO C++ Library.  This library is free
192 +// software; you can redistribute it and/or modify it under the
193 +// terms of the GNU General Public License as published by the
194 +// Free Software Foundation; either version 2, or (at your option)
195 +// any later version.
196 +
197 +// This library is distributed in the hope that it will be useful,
198 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
199 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
200 +// GNU General Public License for more details.
201 +
202 +// You should have received a copy of the GNU General Public License along
203 +// with this library; see the file COPYING.  If not, write to the Free
204 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
205 +// USA.
206 +
207 +// As a special exception, you may use this file as part of a free software
208 +// library without restriction.  Specifically, if other files instantiate
209 +// templates or use macros or inline functions from this file, or you compile
210 +// this file and link it with other files to produce an executable, this
211 +// file does not by itself cause the resulting executable to be covered by
212 +// the GNU General Public License.  This exception does not however
213 +// invalidate any other reasons why the executable file might be covered by
214 +// the GNU General Public License.
215 +
216 +//
217 +// ISO C++ 14882: 22.8  Standard locale categories.
218 +//
219 +
220 +// Written by Benjamin Kosnik <bkoz@redhat.com>
221 +
222 +#include <cerrno>  // For errno
223 +#include <locale>
224 +#include <stdexcept>
225 +#include <langinfo.h>
226 +#include <bits/c++locale_internal.h>
227 +
228 +#ifndef __UCLIBC_HAS_XLOCALE__
229 +#define __strtol_l(S, E, B, L)      strtol((S), (E), (B))
230 +#define __strtoul_l(S, E, B, L)     strtoul((S), (E), (B))
231 +#define __strtoll_l(S, E, B, L)     strtoll((S), (E), (B))
232 +#define __strtoull_l(S, E, B, L)    strtoull((S), (E), (B))
233 +#define __strtof_l(S, E, L)         strtof((S), (E))
234 +#define __strtod_l(S, E, L)         strtod((S), (E))
235 +#define __strtold_l(S, E, L)        strtold((S), (E))
236 +#warning should dummy __newlocale check for C|POSIX ?
237 +#define __newlocale(a, b, c)        NULL
238 +#define __freelocale(a)             ((void)0)
239 +#define __duplocale(a)              __c_locale()
240 +#endif
241 +
242 +namespace std 
243 +{
244 +  template<>
245 +    void
246 +    __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err, 
247 +                  const __c_locale& __cloc)
248 +    {
249 +      if (!(__err & ios_base::failbit))
250 +       {
251 +         char* __sanity;
252 +         errno = 0;
253 +         float __f = __strtof_l(__s, &__sanity, __cloc);
254 +          if (__sanity != __s && errno != ERANGE)
255 +           __v = __f;
256 +         else
257 +           __err |= ios_base::failbit;
258 +       }
259 +    }
260 +
261 +  template<>
262 +    void
263 +    __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err, 
264 +                  const __c_locale& __cloc)
265 +    {
266 +      if (!(__err & ios_base::failbit))
267 +       {
268 +         char* __sanity;
269 +         errno = 0;
270 +         double __d = __strtod_l(__s, &__sanity, __cloc);
271 +          if (__sanity != __s && errno != ERANGE)
272 +           __v = __d;
273 +         else
274 +           __err |= ios_base::failbit;
275 +       }
276 +    }
277 +
278 +  template<>
279 +    void
280 +    __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
281 +                  const __c_locale& __cloc)
282 +    {
283 +      if (!(__err & ios_base::failbit))
284 +       {
285 +         char* __sanity;
286 +         errno = 0;
287 +         long double __ld = __strtold_l(__s, &__sanity, __cloc);
288 +          if (__sanity != __s && errno != ERANGE)
289 +           __v = __ld;
290 +         else
291 +           __err |= ios_base::failbit;
292 +       }
293 +    }
294 +
295 +  void
296 +  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, 
297 +                                   __c_locale __old)
298 +  {
299 +    __cloc = __newlocale(1 << LC_ALL, __s, __old);
300 +#ifdef __UCLIBC_HAS_XLOCALE__
301 +    if (!__cloc)
302 +      {
303 +       // This named locale is not supported by the underlying OS.
304 +       __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
305 +                             "name not valid"));
306 +      }
307 +#endif
308 +  }
309 +  
310 +  void
311 +  locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
312 +  {
313 +    if (_S_get_c_locale() != __cloc)
314 +      __freelocale(__cloc); 
315 +  }
316 +
317 +  __c_locale
318 +  locale::facet::_S_clone_c_locale(__c_locale& __cloc)
319 +  { return __duplocale(__cloc); }
320 +} // namespace std
321 +
322 +namespace __gnu_cxx
323 +{
324 +  const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
325 +    {
326 +      "LC_CTYPE", 
327 +      "LC_NUMERIC",
328 +      "LC_TIME", 
329 +      "LC_COLLATE", 
330 +      "LC_MONETARY",
331 +      "LC_MESSAGES", 
332 +#if _GLIBCXX_NUM_CATEGORIES != 0
333 +      "LC_PAPER", 
334 +      "LC_NAME", 
335 +      "LC_ADDRESS",
336 +      "LC_TELEPHONE", 
337 +      "LC_MEASUREMENT", 
338 +      "LC_IDENTIFICATION" 
339 +#endif
340 +    };
341 +}
342 +
343 +namespace std
344 +{
345 +  const char* const* const locale::_S_categories = __gnu_cxx::category_names;
346 +}  // namespace std
347 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-3.4.1/libstdc++-v3/config/locale/uclibc/c_locale.h
348 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 18:00:00.000000000 -0600
349 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/c_locale.h      2004-08-12 15:54:48.000000000 -0500
350 @@ -0,0 +1,119 @@
351 +// Wrapper for underlying C-language localization -*- C++ -*-
352 +
353 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
354 +//
355 +// This file is part of the GNU ISO C++ Library.  This library is free
356 +// software; you can redistribute it and/or modify it under the
357 +// terms of the GNU General Public License as published by the
358 +// Free Software Foundation; either version 2, or (at your option)
359 +// any later version.
360 +
361 +// This library is distributed in the hope that it will be useful,
362 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
363 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
364 +// GNU General Public License for more details.
365 +
366 +// You should have received a copy of the GNU General Public License along
367 +// with this library; see the file COPYING.  If not, write to the Free
368 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
369 +// USA.
370 +
371 +// As a special exception, you may use this file as part of a free software
372 +// library without restriction.  Specifically, if other files instantiate
373 +// templates or use macros or inline functions from this file, or you compile
374 +// this file and link it with other files to produce an executable, this
375 +// file does not by itself cause the resulting executable to be covered by
376 +// the GNU General Public License.  This exception does not however
377 +// invalidate any other reasons why the executable file might be covered by
378 +// the GNU General Public License.
379 +
380 +//
381 +// ISO C++ 14882: 22.8  Standard locale categories.
382 +//
383 +
384 +// Written by Benjamin Kosnik <bkoz@redhat.com>
385 +
386 +#ifndef _C_LOCALE_H
387 +#define _C_LOCALE_H 1
388 +
389 +#pragma GCC system_header
390 +
391 +#include <cstring>              // get std::strlen
392 +#include <cstdio>               // get std::snprintf or std::sprintf
393 +#include <clocale>
394 +#include <langinfo.h>          // For codecvt
395 +#ifdef __UCLIBC_MJN3_ONLY__
396 +#warning fix this
397 +#endif
398 +#ifdef __UCLIBC_HAS_LOCALE__
399 +#include <iconv.h>             // For codecvt using iconv, iconv_t
400 +#endif
401 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
402 +#include <libintl.h>           // For messages
403 +#endif
404 +
405 +#ifdef __UCLIBC_MJN3_ONLY__
406 +#warning what is _GLIBCXX_C_LOCALE_GNU for
407 +#endif
408 +#define _GLIBCXX_C_LOCALE_GNU 1
409 +
410 +#ifdef __UCLIBC_MJN3_ONLY__
411 +#warning fix categories
412 +#endif
413 +// #define _GLIBCXX_NUM_CATEGORIES 6
414 +#define _GLIBCXX_NUM_CATEGORIES 0
415
416 +#ifdef __UCLIBC_HAS_XLOCALE__
417 +namespace __gnu_cxx
418 +{
419 +  extern "C" __typeof(uselocale) __uselocale;
420 +}
421 +#endif
422 +
423 +namespace std
424 +{
425 +#ifdef __UCLIBC_HAS_XLOCALE__
426 +  typedef __locale_t           __c_locale;
427 +#else
428 +  typedef int*                 __c_locale;
429 +#endif
430 +
431 +  // Convert numeric value of type _Tv to string and return length of
432 +  // string.  If snprintf is available use it, otherwise fall back to
433 +  // the unsafe sprintf which, in general, can be dangerous and should
434 +  // be avoided.
435 +  template<typename _Tv>
436 +    int
437 +    __convert_from_v(char* __out, const int __size, const char* __fmt,
438 +#ifdef __UCLIBC_HAS_XLOCALE__
439 +                    _Tv __v, const __c_locale& __cloc, int __prec = -1)
440 +    {
441 +      __c_locale __old = __gnu_cxx::__uselocale(__cloc);
442 +#else
443 +                    _Tv __v, const __c_locale&, int __prec = -1)
444 +    {
445 +# ifdef __UCLIBC_HAS_LOCALE__
446 +      char* __old = std::setlocale(LC_ALL, NULL);
447 +      char* __sav = new char[std::strlen(__old) + 1];
448 +      std::strcpy(__sav, __old);
449 +      std::setlocale(LC_ALL, "C");
450 +# endif
451 +#endif
452 +
453 +      int __ret;
454 +      if (__prec >= 0)
455 +        __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
456 +      else
457 +        __ret = std::snprintf(__out, __size, __fmt, __v);
458 +
459 +#ifdef __UCLIBC_HAS_XLOCALE__
460 +      __gnu_cxx::__uselocale(__old);
461 +#elif defined __UCLIBC_HAS_LOCALE__
462 +      std::setlocale(LC_ALL, __sav);
463 +      delete [] __sav;
464 +#endif
465 +      return __ret;
466 +    }
467 +}
468 +
469 +#endif
470 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
471 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 18:00:00.000000000 -0600
472 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/codecvt_members.cc      2004-08-12 15:54:48.000000000 -0500
473 @@ -0,0 +1,306 @@
474 +// std::codecvt implementation details, GNU version -*- C++ -*-
475 +
476 +// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
477 +//
478 +// This file is part of the GNU ISO C++ Library.  This library is free
479 +// software; you can redistribute it and/or modify it under the
480 +// terms of the GNU General Public License as published by the
481 +// Free Software Foundation; either version 2, or (at your option)
482 +// any later version.
483 +
484 +// This library is distributed in the hope that it will be useful,
485 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
486 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
487 +// GNU General Public License for more details.
488 +
489 +// You should have received a copy of the GNU General Public License along
490 +// with this library; see the file COPYING.  If not, write to the Free
491 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
492 +// USA.
493 +
494 +// As a special exception, you may use this file as part of a free software
495 +// library without restriction.  Specifically, if other files instantiate
496 +// templates or use macros or inline functions from this file, or you compile
497 +// this file and link it with other files to produce an executable, this
498 +// file does not by itself cause the resulting executable to be covered by
499 +// the GNU General Public License.  This exception does not however
500 +// invalidate any other reasons why the executable file might be covered by
501 +// the GNU General Public License.
502 +
503 +//
504 +// ISO C++ 14882: 22.2.1.5 - Template class codecvt
505 +//
506 +
507 +// Written by Benjamin Kosnik <bkoz@redhat.com>
508 +
509 +#include <locale>
510 +#include <bits/c++locale_internal.h>
511 +
512 +namespace std
513 +{
514 +  // Specializations.
515 +#ifdef _GLIBCXX_USE_WCHAR_T
516 +  codecvt_base::result
517 +  codecvt<wchar_t, char, mbstate_t>::
518 +  do_out(state_type& __state, const intern_type* __from, 
519 +        const intern_type* __from_end, const intern_type*& __from_next,
520 +        extern_type* __to, extern_type* __to_end,
521 +        extern_type*& __to_next) const
522 +  {
523 +    result __ret = ok;
524 +    state_type __tmp_state(__state);
525 +
526 +#ifdef __UCLIBC_HAS_XLOCALE__
527 +    __c_locale __old = __uselocale(_M_c_locale_codecvt);
528 +#endif
529 +
530 +    // wcsnrtombs is *very* fast but stops if encounters NUL characters:
531 +    // in case we fall back to wcrtomb and then continue, in a loop.
532 +    // NB: wcsnrtombs is a GNU extension
533 +    for (__from_next = __from, __to_next = __to;
534 +        __from_next < __from_end && __to_next < __to_end
535 +        && __ret == ok;)
536 +      {
537 +       const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
538 +                                                     __from_end - __from_next);
539 +       if (!__from_chunk_end)
540 +         __from_chunk_end = __from_end;
541 +
542 +       __from = __from_next;
543 +       const size_t __conv = wcsnrtombs(__to_next, &__from_next,
544 +                                        __from_chunk_end - __from_next,
545 +                                        __to_end - __to_next, &__state);
546 +       if (__conv == static_cast<size_t>(-1))
547 +         {
548 +           // In case of error, in order to stop at the exact place we
549 +           // have to start again from the beginning with a series of
550 +           // wcrtomb.
551 +           for (; __from < __from_next; ++__from)
552 +             __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
553 +           __state = __tmp_state;
554 +           __ret = error;
555 +         }
556 +       else if (__from_next && __from_next < __from_chunk_end)
557 +         {
558 +           __to_next += __conv;
559 +           __ret = partial;
560 +         }
561 +       else
562 +         {
563 +           __from_next = __from_chunk_end;
564 +           __to_next += __conv;
565 +         }
566 +
567 +       if (__from_next < __from_end && __ret == ok)
568 +         {
569 +           extern_type __buf[MB_LEN_MAX];
570 +           __tmp_state = __state;
571 +           const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
572 +           if (__conv > static_cast<size_t>(__to_end - __to_next))
573 +             __ret = partial;
574 +           else
575 +             {
576 +               memcpy(__to_next, __buf, __conv);
577 +               __state = __tmp_state;
578 +               __to_next += __conv;
579 +               ++__from_next;
580 +             }
581 +         }
582 +      }
583 +
584 +#ifdef __UCLIBC_HAS_XLOCALE__
585 +    __uselocale(__old);
586 +#endif
587 +
588 +    return __ret; 
589 +  }
590 +  
591 +  codecvt_base::result
592 +  codecvt<wchar_t, char, mbstate_t>::
593 +  do_in(state_type& __state, const extern_type* __from, 
594 +       const extern_type* __from_end, const extern_type*& __from_next,
595 +       intern_type* __to, intern_type* __to_end,
596 +       intern_type*& __to_next) const
597 +  {
598 +    result __ret = ok;
599 +    state_type __tmp_state(__state);
600 +
601 +#ifdef __UCLIBC_HAS_XLOCALE__
602 +    __c_locale __old = __uselocale(_M_c_locale_codecvt);
603 +#endif
604 +
605 +    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
606 +    // in case we store a L'\0' and then continue, in a loop.
607 +    // NB: mbsnrtowcs is a GNU extension
608 +    for (__from_next = __from, __to_next = __to;
609 +        __from_next < __from_end && __to_next < __to_end
610 +        && __ret == ok;)
611 +      {
612 +       const extern_type* __from_chunk_end;
613 +       __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
614 +                                                                 __from_end
615 +                                                                 - __from_next));
616 +       if (!__from_chunk_end)
617 +         __from_chunk_end = __from_end;
618 +
619 +       __from = __from_next;
620 +       size_t __conv = mbsnrtowcs(__to_next, &__from_next,
621 +                                  __from_chunk_end - __from_next,
622 +                                  __to_end - __to_next, &__state);
623 +       if (__conv == static_cast<size_t>(-1))
624 +         {
625 +           // In case of error, in order to stop at the exact place we
626 +           // have to start again from the beginning with a series of
627 +           // mbrtowc.
628 +           for (;; ++__to_next, __from += __conv)
629 +             {
630 +               __conv = mbrtowc(__to_next, __from, __from_end - __from,
631 +                                &__tmp_state);
632 +               if (__conv == static_cast<size_t>(-1)
633 +                   || __conv == static_cast<size_t>(-2))
634 +                 break;
635 +             }
636 +           __from_next = __from;
637 +           __state = __tmp_state;          
638 +           __ret = error;
639 +         }
640 +       else if (__from_next && __from_next < __from_chunk_end)
641 +         {
642 +           // It is unclear what to return in this case (see DR 382). 
643 +           __to_next += __conv;
644 +           __ret = partial;
645 +         }
646 +       else
647 +         {
648 +           __from_next = __from_chunk_end;
649 +           __to_next += __conv;
650 +         }
651 +
652 +       if (__from_next < __from_end && __ret == ok)
653 +         {
654 +           if (__to_next < __to_end)
655 +             {
656 +               // XXX Probably wrong for stateful encodings
657 +               __tmp_state = __state;          
658 +               ++__from_next;
659 +               *__to_next++ = L'\0';
660 +             }
661 +           else
662 +             __ret = partial;
663 +         }
664 +      }
665 +
666 +#ifdef __UCLIBC_HAS_XLOCALE__
667 +    __uselocale(__old);
668 +#endif
669 +
670 +    return __ret; 
671 +  }
672 +
673 +  int 
674 +  codecvt<wchar_t, char, mbstate_t>::
675 +  do_encoding() const throw()
676 +  {
677 +    // XXX This implementation assumes that the encoding is
678 +    // stateless and is either single-byte or variable-width.
679 +    int __ret = 0;
680 +#ifdef __UCLIBC_HAS_XLOCALE__
681 +    __c_locale __old = __uselocale(_M_c_locale_codecvt);
682 +#endif
683 +    if (MB_CUR_MAX == 1)
684 +      __ret = 1;
685 +#ifdef __UCLIBC_HAS_XLOCALE__
686 +    __uselocale(__old);
687 +#endif
688 +    return __ret;
689 +  }  
690 +
691 +  int 
692 +  codecvt<wchar_t, char, mbstate_t>::
693 +  do_max_length() const throw()
694 +  {
695 +#ifdef __UCLIBC_HAS_XLOCALE__
696 +    __c_locale __old = __uselocale(_M_c_locale_codecvt);
697 +#endif
698 +    // XXX Probably wrong for stateful encodings.
699 +    int __ret = MB_CUR_MAX;
700 +#ifdef __UCLIBC_HAS_XLOCALE__
701 +    __uselocale(__old);
702 +#endif
703 +    return __ret;
704 +  }
705 +  
706 +  int 
707 +  codecvt<wchar_t, char, mbstate_t>::
708 +  do_length(state_type& __state, const extern_type* __from,
709 +           const extern_type* __end, size_t __max) const
710 +  {
711 +    int __ret = 0;
712 +    state_type __tmp_state(__state);
713 +
714 +#ifdef __UCLIBC_HAS_XLOCALE__
715 +    __c_locale __old = __uselocale(_M_c_locale_codecvt);
716 +#endif
717 +
718 +    // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
719 +    // in case we advance past it and then continue, in a loop.
720 +    // NB: mbsnrtowcs is a GNU extension
721 +  
722 +    // A dummy internal buffer is needed in order for mbsnrtocws to consider
723 +    // its fourth parameter (it wouldn't with NULL as first parameter).
724 +    wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t) 
725 +                                                          * __max));
726 +    while (__from < __end && __max)
727 +      {
728 +       const extern_type* __from_chunk_end;
729 +       __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
730 +                                                                 __end
731 +                                                                 - __from));
732 +       if (!__from_chunk_end)
733 +         __from_chunk_end = __end;
734 +
735 +       const extern_type* __tmp_from = __from;
736 +       size_t __conv = mbsnrtowcs(__to, &__from,
737 +                                  __from_chunk_end - __from,
738 +                                  __max, &__state);
739 +       if (__conv == static_cast<size_t>(-1))
740 +         {
741 +           // In case of error, in order to stop at the exact place we
742 +           // have to start again from the beginning with a series of
743 +           // mbrtowc.
744 +           for (__from = __tmp_from;; __from += __conv)
745 +             {
746 +               __conv = mbrtowc(NULL, __from, __end - __from,
747 +                                &__tmp_state);
748 +               if (__conv == static_cast<size_t>(-1)
749 +                   || __conv == static_cast<size_t>(-2))
750 +                 break;
751 +             }
752 +           __state = __tmp_state;
753 +           __ret += __from - __tmp_from;
754 +           break;
755 +         }
756 +       if (!__from)
757 +         __from = __from_chunk_end;
758 +       
759 +       __ret += __from - __tmp_from;
760 +       __max -= __conv;
761 +
762 +       if (__from < __end && __max)
763 +         {
764 +           // XXX Probably wrong for stateful encodings
765 +           __tmp_state = __state;
766 +           ++__from;
767 +           ++__ret;
768 +           --__max;
769 +         }
770 +      }
771 +
772 +#ifdef __UCLIBC_HAS_XLOCALE__
773 +    __uselocale(__old);
774 +#endif
775 +
776 +    return __ret; 
777 +  }
778 +#endif
779 +}
780 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/collate_members.cc
781 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 18:00:00.000000000 -0600
782 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/collate_members.cc      2004-08-12 15:54:48.000000000 -0500
783 @@ -0,0 +1,80 @@
784 +// std::collate implementation details, GNU version -*- C++ -*-
785 +
786 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
787 +//
788 +// This file is part of the GNU ISO C++ Library.  This library is free
789 +// software; you can redistribute it and/or modify it under the
790 +// terms of the GNU General Public License as published by the
791 +// Free Software Foundation; either version 2, or (at your option)
792 +// any later version.
793 +
794 +// This library is distributed in the hope that it will be useful,
795 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
796 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
797 +// GNU General Public License for more details.
798 +
799 +// You should have received a copy of the GNU General Public License along
800 +// with this library; see the file COPYING.  If not, write to the Free
801 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
802 +// USA.
803 +
804 +// As a special exception, you may use this file as part of a free software
805 +// library without restriction.  Specifically, if other files instantiate
806 +// templates or use macros or inline functions from this file, or you compile
807 +// this file and link it with other files to produce an executable, this
808 +// file does not by itself cause the resulting executable to be covered by
809 +// the GNU General Public License.  This exception does not however
810 +// invalidate any other reasons why the executable file might be covered by
811 +// the GNU General Public License.
812 +
813 +//
814 +// ISO C++ 14882: 22.2.4.1.2  collate virtual functions
815 +//
816 +
817 +// Written by Benjamin Kosnik <bkoz@redhat.com>
818 +
819 +#include <locale>
820 +#include <bits/c++locale_internal.h>
821 +
822 +#ifndef __UCLIBC_HAS_XLOCALE__
823 +#define __strcoll_l(S1, S2, L)      strcoll((S1), (S2))
824 +#define __strxfrm_l(S1, S2, N, L)   strxfrm((S1), (S2), (N))
825 +#define __wcscoll_l(S1, S2, L)      wcscoll((S1), (S2))
826 +#define __wcsxfrm_l(S1, S2, N, L)   wcsxfrm((S1), (S2), (N))
827 +#endif
828 +
829 +namespace std
830 +{
831 +  // These are basically extensions to char_traits, and perhaps should
832 +  // be put there instead of here.
833 +  template<>
834 +    int 
835 +    collate<char>::_M_compare(const char* __one, const char* __two) const
836 +    { 
837 +      int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
838 +      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
839 +    }
840 +  
841 +  template<>
842 +    size_t
843 +    collate<char>::_M_transform(char* __to, const char* __from, 
844 +                               size_t __n) const 
845 +    { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
846 +
847 +#ifdef _GLIBCXX_USE_WCHAR_T
848 +  template<>
849 +    int 
850 +    collate<wchar_t>::_M_compare(const wchar_t* __one, 
851 +                                const wchar_t* __two) const
852 +    {
853 +      int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
854 +      return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
855 +    }
856 +  
857 +  template<>
858 +    size_t
859 +    collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
860 +                                  size_t __n) const
861 +    { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
862 +#endif
863 +}
864 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc
865 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/ctype_members.cc   1969-12-31 18:00:00.000000000 -0600
866 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/ctype_members.cc        2004-08-12 15:54:48.000000000 -0500
867 @@ -0,0 +1,300 @@
868 +// std::ctype implementation details, GNU version -*- C++ -*-
869 +
870 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
871 +//
872 +// This file is part of the GNU ISO C++ Library.  This library is free
873 +// software; you can redistribute it and/or modify it under the
874 +// terms of the GNU General Public License as published by the
875 +// Free Software Foundation; either version 2, or (at your option)
876 +// any later version.
877 +
878 +// This library is distributed in the hope that it will be useful,
879 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
880 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
881 +// GNU General Public License for more details.
882 +
883 +// You should have received a copy of the GNU General Public License along
884 +// with this library; see the file COPYING.  If not, write to the Free
885 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
886 +// USA.
887 +
888 +// As a special exception, you may use this file as part of a free software
889 +// library without restriction.  Specifically, if other files instantiate
890 +// templates or use macros or inline functions from this file, or you compile
891 +// this file and link it with other files to produce an executable, this
892 +// file does not by itself cause the resulting executable to be covered by
893 +// the GNU General Public License.  This exception does not however
894 +// invalidate any other reasons why the executable file might be covered by
895 +// the GNU General Public License.
896 +
897 +//
898 +// ISO C++ 14882: 22.2.1.1.2  ctype virtual functions.
899 +//
900 +
901 +// Written by Benjamin Kosnik <bkoz@redhat.com>
902 +
903 +#define _LIBC
904 +#include <locale>
905 +#undef _LIBC
906 +#include <bits/c++locale_internal.h>
907 +
908 +#ifndef __UCLIBC_HAS_XLOCALE__
909 +#define __wctype_l(S, L)           wctype((S))
910 +#define __towupper_l(C, L)         towupper((C))
911 +#define __towlower_l(C, L)         towlower((C))
912 +#define __iswctype_l(C, M, L)      iswctype((C), (M))
913 +#endif
914 +
915 +namespace std
916 +{
917 +  // NB: The other ctype<char> specializations are in src/locale.cc and
918 +  // various /config/os/* files.
919 +  template<>
920 +    ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
921 +    : ctype<char>(0, false, __refs) 
922 +    {          
923 +      if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
924 +       {
925 +         this->_S_destroy_c_locale(this->_M_c_locale_ctype);
926 +         this->_S_create_c_locale(this->_M_c_locale_ctype, __s); 
927 +#ifdef __UCLIBC_HAS_XLOCALE__
928 +         this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
929 +         this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
930 +         this->_M_table = this->_M_c_locale_ctype->__ctype_b;
931 +#endif
932 +       }
933 +    }
934 +
935 +#ifdef _GLIBCXX_USE_WCHAR_T  
936 +  ctype<wchar_t>::__wmask_type
937 +  ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
938 +  {
939 +    __wmask_type __ret;
940 +    switch (__m)
941 +      {
942 +      case space:
943 +       __ret = __wctype_l("space", _M_c_locale_ctype);
944 +       break;
945 +      case print:
946 +       __ret = __wctype_l("print", _M_c_locale_ctype);
947 +       break;
948 +      case cntrl:
949 +       __ret = __wctype_l("cntrl", _M_c_locale_ctype);
950 +       break;
951 +      case upper:
952 +       __ret = __wctype_l("upper", _M_c_locale_ctype);
953 +       break;
954 +      case lower:
955 +       __ret = __wctype_l("lower", _M_c_locale_ctype);
956 +       break;
957 +      case alpha:
958 +       __ret = __wctype_l("alpha", _M_c_locale_ctype);
959 +       break;
960 +      case digit:
961 +       __ret = __wctype_l("digit", _M_c_locale_ctype);
962 +       break;
963 +      case punct:
964 +       __ret = __wctype_l("punct", _M_c_locale_ctype);
965 +       break;
966 +      case xdigit:
967 +       __ret = __wctype_l("xdigit", _M_c_locale_ctype);
968 +       break;
969 +      case alnum:
970 +       __ret = __wctype_l("alnum", _M_c_locale_ctype);
971 +       break;
972 +      case graph:
973 +       __ret = __wctype_l("graph", _M_c_locale_ctype);
974 +       break;
975 +      default:
976 +       __ret = 0;
977 +      }
978 +    return __ret;
979 +  }
980 +  
981 +  wchar_t
982 +  ctype<wchar_t>::do_toupper(wchar_t __c) const
983 +  { return __towupper_l(__c, _M_c_locale_ctype); }
984 +
985 +  const wchar_t*
986 +  ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
987 +  {
988 +    while (__lo < __hi)
989 +      {
990 +        *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
991 +        ++__lo;
992 +      }
993 +    return __hi;
994 +  }
995 +  
996 +  wchar_t
997 +  ctype<wchar_t>::do_tolower(wchar_t __c) const
998 +  { return __towlower_l(__c, _M_c_locale_ctype); }
999 +  
1000 +  const wchar_t*
1001 +  ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
1002 +  {
1003 +    while (__lo < __hi)
1004 +      {
1005 +        *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
1006 +        ++__lo;
1007 +      }
1008 +    return __hi;
1009 +  }
1010 +
1011 +  bool
1012 +  ctype<wchar_t>::
1013 +  do_is(mask __m, wchar_t __c) const
1014 +  { 
1015 +    // Highest bitmask in ctype_base == 10, but extra in "C"
1016 +    // library for blank.
1017 +    bool __ret = false;
1018 +    const size_t __bitmasksize = 11; 
1019 +    for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1020 +      if (__m & _M_bit[__bitcur]
1021 +         && __iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1022 +       {
1023 +         __ret = true;
1024 +         break;
1025 +       }
1026 +    return __ret;    
1027 +  }
1028 +  
1029 +  const wchar_t* 
1030 +  ctype<wchar_t>::
1031 +  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1032 +  {
1033 +    for (; __lo < __hi; ++__vec, ++__lo)
1034 +      {
1035 +       // Highest bitmask in ctype_base == 10, but extra in "C"
1036 +       // library for blank.
1037 +       const size_t __bitmasksize = 11; 
1038 +       mask __m = 0;
1039 +       for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1040 +         if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1041 +           __m |= _M_bit[__bitcur];
1042 +       *__vec = __m;
1043 +      }
1044 +    return __hi;
1045 +  }
1046 +  
1047 +  const wchar_t* 
1048 +  ctype<wchar_t>::
1049 +  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1050 +  {
1051 +    while (__lo < __hi && !this->do_is(__m, *__lo))
1052 +      ++__lo;
1053 +    return __lo;
1054 +  }
1055 +
1056 +  const wchar_t*
1057 +  ctype<wchar_t>::
1058 +  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1059 +  {
1060 +    while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1061 +      ++__lo;
1062 +    return __lo;
1063 +  }
1064 +
1065 +  wchar_t
1066 +  ctype<wchar_t>::
1067 +  do_widen(char __c) const
1068 +  { return _M_widen[static_cast<unsigned char>(__c)]; }
1069 +
1070 +  const char* 
1071 +  ctype<wchar_t>::
1072 +  do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1073 +  {
1074 +    while (__lo < __hi)
1075 +      {
1076 +       *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1077 +       ++__lo;
1078 +       ++__dest;
1079 +      }
1080 +    return __hi;
1081 +  }
1082 +
1083 +  char
1084 +  ctype<wchar_t>::
1085 +  do_narrow(wchar_t __wc, char __dfault) const
1086 +  {
1087 +    if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1088 +      return _M_narrow[__wc];
1089 +#ifdef __UCLIBC_HAS_XLOCALE__
1090 +    __c_locale __old = __uselocale(_M_c_locale_ctype);
1091 +#endif
1092 +    const int __c = wctob(__wc);
1093 +#ifdef __UCLIBC_HAS_XLOCALE__
1094 +    __uselocale(__old);
1095 +#endif
1096 +    return (__c == EOF ? __dfault : static_cast<char>(__c)); 
1097 +  }
1098 +
1099 +  const wchar_t*
1100 +  ctype<wchar_t>::
1101 +  do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault, 
1102 +           char* __dest) const
1103 +  {
1104 +#ifdef __UCLIBC_HAS_XLOCALE__
1105 +    __c_locale __old = __uselocale(_M_c_locale_ctype);
1106 +#endif
1107 +    if (_M_narrow_ok)
1108 +      while (__lo < __hi)
1109 +       {
1110 +         if (*__lo >= 0 && *__lo < 128)
1111 +           *__dest = _M_narrow[*__lo];
1112 +         else
1113 +           {
1114 +             const int __c = wctob(*__lo);
1115 +             *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1116 +           }
1117 +         ++__lo;
1118 +         ++__dest;
1119 +       }
1120 +    else
1121 +      while (__lo < __hi)
1122 +       {
1123 +         const int __c = wctob(*__lo);
1124 +         *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1125 +         ++__lo;
1126 +         ++__dest;
1127 +       }
1128 +#ifdef __UCLIBC_HAS_XLOCALE__
1129 +    __uselocale(__old);
1130 +#endif
1131 +    return __hi;
1132 +  }
1133 +
1134 +  void
1135 +  ctype<wchar_t>::_M_initialize_ctype()
1136 +  {
1137 +#ifdef __UCLIBC_HAS_XLOCALE__
1138 +    __c_locale __old = __uselocale(_M_c_locale_ctype);
1139 +#endif
1140 +    wint_t __i;
1141 +    for (__i = 0; __i < 128; ++__i)
1142 +      {
1143 +       const int __c = wctob(__i);
1144 +       if (__c == EOF)
1145 +         break;
1146 +       else
1147 +         _M_narrow[__i] = static_cast<char>(__c);
1148 +      }
1149 +    if (__i == 128)
1150 +      _M_narrow_ok = true;
1151 +    else
1152 +      _M_narrow_ok = false;
1153 +    for (size_t __j = 0;
1154 +        __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1155 +      _M_widen[__j] = btowc(__j);
1156 +
1157 +    for (size_t __k = 0; __k <= 11; ++__k)
1158 +      { 
1159 +       _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1160 +       _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1161 +      }
1162 +#ifdef __UCLIBC_HAS_XLOCALE__
1163 +    __uselocale(__old);
1164 +#endif
1165 +  }
1166 +#endif //  _GLIBCXX_USE_WCHAR_T
1167 +}
1168 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/messages_members.cc
1169 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/messages_members.cc        1969-12-31 18:00:00.000000000 -0600
1170 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/messages_members.cc     2004-08-12 15:54:48.000000000 -0500
1171 @@ -0,0 +1,100 @@
1172 +// std::messages implementation details, GNU version -*- C++ -*-
1173 +
1174 +// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1175 +//
1176 +// This file is part of the GNU ISO C++ Library.  This library is free
1177 +// software; you can redistribute it and/or modify it under the
1178 +// terms of the GNU General Public License as published by the
1179 +// Free Software Foundation; either version 2, or (at your option)
1180 +// any later version.
1181 +
1182 +// This library is distributed in the hope that it will be useful,
1183 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1184 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1185 +// GNU General Public License for more details.
1186 +
1187 +// You should have received a copy of the GNU General Public License along
1188 +// with this library; see the file COPYING.  If not, write to the Free
1189 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1190 +// USA.
1191 +
1192 +// As a special exception, you may use this file as part of a free software
1193 +// library without restriction.  Specifically, if other files instantiate
1194 +// templates or use macros or inline functions from this file, or you compile
1195 +// this file and link it with other files to produce an executable, this
1196 +// file does not by itself cause the resulting executable to be covered by
1197 +// the GNU General Public License.  This exception does not however
1198 +// invalidate any other reasons why the executable file might be covered by
1199 +// the GNU General Public License.
1200 +
1201 +//
1202 +// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
1203 +//
1204 +
1205 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1206 +
1207 +#include <locale>
1208 +#include <bits/c++locale_internal.h>
1209 +
1210 +#ifdef __UCLIBC_MJN3_ONLY__
1211 +#warning fix gettext stuff
1212 +#endif
1213 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1214 +extern "C" char *__dcgettext(const char *domainname,
1215 +                            const char *msgid, int category);
1216 +#undef gettext
1217 +#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1218 +#else
1219 +#undef gettext
1220 +#define gettext(msgid) (msgid)
1221 +#endif
1222 +
1223 +namespace std
1224 +{
1225 +  // Specializations.
1226 +  template<>
1227 +    string
1228 +    messages<char>::do_get(catalog, int, int, const string& __dfault) const
1229 +    {
1230 +#ifdef __UCLIBC_HAS_XLOCALE__
1231 +      __c_locale __old = __uselocale(_M_c_locale_messages);
1232 +      const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1233 +      __uselocale(__old);
1234 +      return string(__msg);
1235 +#elif defined __UCLIBC_HAS_LOCALE__
1236 +      char* __old = strdup(setlocale(LC_ALL, NULL));
1237 +      setlocale(LC_ALL, _M_name_messages);
1238 +      const char* __msg = gettext(__dfault.c_str());
1239 +      setlocale(LC_ALL, __old);
1240 +      free(__old);
1241 +      return string(__msg);
1242 +#else
1243 +      const char* __msg = gettext(__dfault.c_str());
1244 +      return string(__msg);
1245 +#endif
1246 +    }
1247 +
1248 +#ifdef _GLIBCXX_USE_WCHAR_T
1249 +  template<>
1250 +    wstring
1251 +    messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1252 +    {
1253 +# ifdef __UCLIBC_HAS_XLOCALE__
1254 +      __c_locale __old = __uselocale(_M_c_locale_messages);
1255 +      char* __msg = gettext(_M_convert_to_char(__dfault));
1256 +      __uselocale(__old);
1257 +      return _M_convert_from_char(__msg);
1258 +# elif defined __UCLIBC_HAS_LOCALE__
1259 +      char* __old = strdup(setlocale(LC_ALL, NULL));
1260 +      setlocale(LC_ALL, _M_name_messages);
1261 +      char* __msg = gettext(_M_convert_to_char(__dfault));
1262 +      setlocale(LC_ALL, __old);
1263 +      free(__old);
1264 +      return _M_convert_from_char(__msg);
1265 +# else
1266 +      char* __msg = gettext(_M_convert_to_char(__dfault));
1267 +      return _M_convert_from_char(__msg);
1268 +# endif
1269 +    }
1270 +#endif
1271 +}
1272 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-3.4.1/libstdc++-v3/config/locale/uclibc/messages_members.h
1273 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 18:00:00.000000000 -0600
1274 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/messages_members.h      2004-08-12 15:54:48.000000000 -0500
1275 @@ -0,0 +1,118 @@
1276 +// std::messages implementation details, GNU version -*- C++ -*-
1277 +
1278 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1279 +//
1280 +// This file is part of the GNU ISO C++ Library.  This library is free
1281 +// software; you can redistribute it and/or modify it under the
1282 +// terms of the GNU General Public License as published by the
1283 +// Free Software Foundation; either version 2, or (at your option)
1284 +// any later version.
1285 +
1286 +// This library is distributed in the hope that it will be useful,
1287 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1288 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1289 +// GNU General Public License for more details.
1290 +
1291 +// You should have received a copy of the GNU General Public License along
1292 +// with this library; see the file COPYING.  If not, write to the Free
1293 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1294 +// USA.
1295 +
1296 +// As a special exception, you may use this file as part of a free software
1297 +// library without restriction.  Specifically, if other files instantiate
1298 +// templates or use macros or inline functions from this file, or you compile
1299 +// this file and link it with other files to produce an executable, this
1300 +// file does not by itself cause the resulting executable to be covered by
1301 +// the GNU General Public License.  This exception does not however
1302 +// invalidate any other reasons why the executable file might be covered by
1303 +// the GNU General Public License.
1304 +
1305 +//
1306 +// ISO C++ 14882: 22.2.7.1.2  messages functions
1307 +//
1308 +
1309 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1310 +
1311 +#ifdef __UCLIBC_MJN3_ONLY__
1312 +#warning fix prototypes for *textdomain funcs
1313 +#endif
1314 +#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1315 +extern "C" char *__textdomain(const char *domainname);
1316 +extern "C" char *__bindtextdomain(const char *domainname,
1317 +                                 const char *dirname);
1318 +#else
1319 +#undef __textdomain
1320 +#undef __bindtextdomain
1321 +#define __textdomain(D)           ((void)0)
1322 +#define __bindtextdomain(D,P)     ((void)0)
1323 +#endif
1324 +
1325 +  // Non-virtual member functions.
1326 +  template<typename _CharT>
1327 +     messages<_CharT>::messages(size_t __refs)
1328 +     : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), 
1329 +     _M_name_messages(_S_get_c_name())
1330 +     { }
1331 +
1332 +  template<typename _CharT>
1333 +     messages<_CharT>::messages(__c_locale __cloc, const char* __s, 
1334 +                               size_t __refs) 
1335 +     : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
1336 +     _M_name_messages(__s)
1337 +     {
1338 +       char* __tmp = new char[std::strlen(__s) + 1];
1339 +       std::strcpy(__tmp, __s);
1340 +       _M_name_messages = __tmp;
1341 +     }
1342 +
1343 +  template<typename _CharT>
1344 +    typename messages<_CharT>::catalog 
1345 +    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
1346 +                          const char* __dir) const
1347 +    { 
1348 +      __bindtextdomain(__s.c_str(), __dir);
1349 +      return this->do_open(__s, __loc); 
1350 +    }
1351 +
1352 +  // Virtual member functions.
1353 +  template<typename _CharT>
1354 +    messages<_CharT>::~messages()
1355 +    { 
1356 +      if (_M_name_messages != _S_get_c_name())
1357 +       delete [] _M_name_messages;
1358 +      _S_destroy_c_locale(_M_c_locale_messages); 
1359 +    }
1360 +
1361 +  template<typename _CharT>
1362 +    typename messages<_CharT>::catalog 
1363 +    messages<_CharT>::do_open(const basic_string<char>& __s, 
1364 +                             const locale&) const
1365 +    { 
1366 +      // No error checking is done, assume the catalog exists and can
1367 +      // be used.
1368 +      __textdomain(__s.c_str());
1369 +      return 0;
1370 +    }
1371 +
1372 +  template<typename _CharT>
1373 +    void    
1374 +    messages<_CharT>::do_close(catalog) const 
1375 +    { }
1376 +
1377 +   // messages_byname
1378 +   template<typename _CharT>
1379 +     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1380 +     : messages<_CharT>(__refs) 
1381 +     { 
1382 +       if (this->_M_name_messages != locale::facet::_S_get_c_name())
1383 +        delete [] this->_M_name_messages;
1384 +       char* __tmp = new char[std::strlen(__s) + 1];
1385 +       std::strcpy(__tmp, __s);
1386 +       this->_M_name_messages = __tmp;
1387 +
1388 +       if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1389 +        {
1390 +          this->_S_destroy_c_locale(this->_M_c_locale_messages);
1391 +          this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
1392 +        }
1393 +     }
1394 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1395 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/monetary_members.cc        1969-12-31 18:00:00.000000000 -0600
1396 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/monetary_members.cc     2004-08-12 15:54:48.000000000 -0500
1397 @@ -0,0 +1,698 @@
1398 +// std::moneypunct implementation details, GNU version -*- C++ -*-
1399 +
1400 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1401 +//
1402 +// This file is part of the GNU ISO C++ Library.  This library is free
1403 +// software; you can redistribute it and/or modify it under the
1404 +// terms of the GNU General Public License as published by the
1405 +// Free Software Foundation; either version 2, or (at your option)
1406 +// any later version.
1407 +
1408 +// This library is distributed in the hope that it will be useful,
1409 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1410 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1411 +// GNU General Public License for more details.
1412 +
1413 +// You should have received a copy of the GNU General Public License along
1414 +// with this library; see the file COPYING.  If not, write to the Free
1415 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
1416 +// USA.
1417 +
1418 +// As a special exception, you may use this file as part of a free software
1419 +// library without restriction.  Specifically, if other files instantiate
1420 +// templates or use macros or inline functions from this file, or you compile
1421 +// this file and link it with other files to produce an executable, this
1422 +// file does not by itself cause the resulting executable to be covered by
1423 +// the GNU General Public License.  This exception does not however
1424 +// invalidate any other reasons why the executable file might be covered by
1425 +// the GNU General Public License.
1426 +
1427 +//
1428 +// ISO C++ 14882: 22.2.6.3.2  moneypunct virtual functions
1429 +//
1430 +
1431 +// Written by Benjamin Kosnik <bkoz@redhat.com>
1432 +
1433 +#define _LIBC
1434 +#include <locale>
1435 +#undef _LIBC
1436 +#include <bits/c++locale_internal.h>
1437 +
1438 +#ifdef __UCLIBC_MJN3_ONLY__
1439 +#warning optimize this for uclibc
1440 +#warning tailor for stub locale support
1441 +#endif
1442 +
1443 +#ifndef __UCLIBC_HAS_XLOCALE__
1444 +#define __nl_langinfo_l(N, L)         nl_langinfo((N))
1445 +#endif
1446 +
1447 +namespace std
1448 +{
1449 +  // Construct and return valid pattern consisting of some combination of:
1450 +  // space none symbol sign value
1451 +  money_base::pattern
1452 +  money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
1453 +  { 
1454 +    pattern __ret;
1455 +
1456 +    // This insanely complicated routine attempts to construct a valid
1457 +    // pattern for use with monyepunct. A couple of invariants:
1458 +
1459 +    // if (__precedes) symbol -> value
1460 +    // else value -> symbol
1461 +    
1462 +    // if (__space) space
1463 +    // else none
1464 +
1465 +    // none == never first
1466 +    // space never first or last
1467 +
1468 +    // Any elegant implementations of this are welcome.
1469 +    switch (__posn)
1470 +      {
1471 +      case 0:
1472 +      case 1:
1473 +       // 1 The sign precedes the value and symbol.
1474 +       __ret.field[0] = sign;
1475 +       if (__space)
1476 +         {
1477 +           // Pattern starts with sign.
1478 +           if (__precedes)
1479 +             {
1480 +               __ret.field[1] = symbol;
1481 +               __ret.field[3] = value;
1482 +             }
1483 +           else
1484 +             {
1485 +               __ret.field[1] = value;
1486 +               __ret.field[3] = symbol;
1487 +             }
1488 +           __ret.field[2] = space;
1489 +         }
1490 +       else
1491 +         {
1492 +           // Pattern starts with sign and ends with none.
1493 +           if (__precedes)
1494 +             {
1495 +               __ret.field[1] = symbol;
1496 +               __ret.field[2] = value;
1497 +             }
1498 +           else
1499 +             {
1500 +               __ret.field[1] = value;
1501 +               __ret.field[2] = symbol;
1502 +             }
1503 +           __ret.field[3] = none;
1504 +         }
1505 +       break;
1506 +      case 2:
1507 +       // 2 The sign follows the value and symbol.
1508 +       if (__space)
1509 +         {
1510 +           // Pattern either ends with sign.
1511 +           if (__precedes)
1512 +             {
1513 +               __ret.field[0] = symbol;
1514 +               __ret.field[2] = value;
1515 +             }
1516 +           else
1517 +             {
1518 +               __ret.field[0] = value;
1519 +               __ret.field[2] = symbol;
1520 +             }
1521 +           __ret.field[1] = space;
1522 +           __ret.field[3] = sign;
1523 +         }
1524 +       else
1525 +         {
1526 +           // Pattern ends with sign then none.
1527 +           if (__precedes)
1528 +             {
1529 +               __ret.field[0] = symbol;
1530 +               __ret.field[1] = value;
1531 +             }
1532 +           else
1533 +             {
1534 +               __ret.field[0] = value;
1535 +               __ret.field[1] = symbol;
1536 +             }
1537 +           __ret.field[2] = sign;
1538 +           __ret.field[3] = none;
1539 +         }
1540 +       break;
1541 +      case 3:
1542 +       // 3 The sign immediately precedes the symbol.
1543 +       if (__precedes)
1544 +         {
1545 +           __ret.field[0] = sign;
1546 +           __ret.field[1] = symbol;        
1547 +           if (__space)
1548 +             {
1549 +               __ret.field[2] = space;
1550 +               __ret.field[3] = value;
1551 +             }
1552 +           else
1553 +             {
1554 +               __ret.field[2] = value;         
1555 +               __ret.field[3] = none;
1556 +             }
1557 +         }
1558 +       else
1559 +         {
1560 +           __ret.field[0] = value;
1561 +           if (__space)
1562 +             {
1563 +               __ret.field[1] = space;
1564 +               __ret.field[2] = sign;
1565 +               __ret.field[3] = symbol;
1566 +             }
1567 +           else
1568 +             {
1569 +               __ret.field[1] = sign;
1570 +               __ret.field[2] = symbol;
1571 +               __ret.field[3] = none;
1572 +             }
1573 +         }
1574 +       break;
1575 +      case 4:
1576 +       // 4 The sign immediately follows the symbol.
1577 +       if (__precedes)
1578 +         {
1579 +           __ret.field[0] = symbol;
1580 +           __ret.field[1] = sign;
1581 +           if (__space)
1582 +             {
1583 +               __ret.field[2] = space;
1584 +               __ret.field[3] = value;
1585 +             }
1586 +           else
1587 +             {
1588 +               __ret.field[2] = value;
1589 +               __ret.field[3] = none;
1590 +             }
1591 +         }
1592 +       else
1593 +         {
1594 +           __ret.field[0] = value;
1595 +           if (__space)
1596 +             {
1597 +               __ret.field[1] = space;
1598 +               __ret.field[2] = symbol;
1599 +               __ret.field[3] = sign;
1600 +             }
1601 +           else
1602 +             {
1603 +               __ret.field[1] = symbol;
1604 +               __ret.field[2] = sign;
1605 +               __ret.field[3] = none;
1606 +             }
1607 +         }
1608 +       break;
1609 +      default:
1610 +       ;
1611 +      }
1612 +    return __ret;
1613 +  }
1614 +
1615 +  template<> 
1616 +    void
1617 +    moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc, 
1618 +                                                    const char*)
1619 +    {
1620 +      if (!_M_data)
1621 +       _M_data = new __moneypunct_cache<char, true>;
1622 +
1623 +      if (!__cloc)
1624 +       {
1625 +         // "C" locale
1626 +         _M_data->_M_decimal_point = '.';
1627 +         _M_data->_M_thousands_sep = ',';
1628 +         _M_data->_M_grouping = "";
1629 +         _M_data->_M_grouping_size = 0;
1630 +         _M_data->_M_curr_symbol = "";
1631 +         _M_data->_M_curr_symbol_size = 0;
1632 +         _M_data->_M_positive_sign = "";
1633 +         _M_data->_M_positive_sign_size = 0;
1634 +         _M_data->_M_negative_sign = "";
1635 +         _M_data->_M_negative_sign_size = 0;
1636 +         _M_data->_M_frac_digits = 0;
1637 +         _M_data->_M_pos_format = money_base::_S_default_pattern;
1638 +         _M_data->_M_neg_format = money_base::_S_default_pattern;
1639 +
1640 +         for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1641 +           _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1642 +       }
1643 +      else
1644 +       {
1645 +         // Named locale.
1646 +         _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, 
1647 +                                                       __cloc));
1648 +         _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, 
1649 +                                                       __cloc));
1650 +         _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1651 +         _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1652 +         _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1653 +         _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1654 +
1655 +         char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1656 +         if (!__nposn)
1657 +           _M_data->_M_negative_sign = "()";
1658 +         else
1659 +           _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN, 
1660 +                                                       __cloc);
1661 +         _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1662 +
1663 +         // _Intl == true
1664 +         _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1665 +         _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1666 +         _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, 
1667 +                                                     __cloc));
1668 +         char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1669 +         char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1670 +         char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1671 +         _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
1672 +                                                       __pposn);
1673 +         char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1674 +         char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1675 +         _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
1676 +                                                       __nposn);
1677 +       }
1678 +    }
1679 +
1680 +  template<> 
1681 +    void
1682 +    moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc, 
1683 +                                                     const char*)
1684 +    {
1685 +      if (!_M_data)
1686 +       _M_data = new __moneypunct_cache<char, false>;
1687 +
1688 +      if (!__cloc)
1689 +       {
1690 +         // "C" locale
1691 +         _M_data->_M_decimal_point = '.';
1692 +         _M_data->_M_thousands_sep = ',';
1693 +         _M_data->_M_grouping = "";
1694 +         _M_data->_M_grouping_size = 0;
1695 +         _M_data->_M_curr_symbol = "";
1696 +         _M_data->_M_curr_symbol_size = 0;
1697 +         _M_data->_M_positive_sign = "";
1698 +         _M_data->_M_positive_sign_size = 0;
1699 +         _M_data->_M_negative_sign = "";
1700 +         _M_data->_M_negative_sign_size = 0;
1701 +         _M_data->_M_frac_digits = 0;
1702 +         _M_data->_M_pos_format = money_base::_S_default_pattern;
1703 +         _M_data->_M_neg_format = money_base::_S_default_pattern;
1704 +
1705 +         for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1706 +           _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
1707 +       }
1708 +      else
1709 +       {
1710 +         // Named locale.
1711 +         _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT, 
1712 +                                                       __cloc));
1713 +         _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP, 
1714 +                                                       __cloc));
1715 +         _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1716 +         _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1717 +         _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1718 +         _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
1719 +
1720 +         char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1721 +         if (!__nposn)
1722 +           _M_data->_M_negative_sign = "()";
1723 +         else
1724 +           _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
1725 +                                                       __cloc);
1726 +         _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
1727 +
1728 +         // _Intl == false
1729 +         _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1730 +         _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
1731 +         _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
1732 +         char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
1733 +         char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
1734 +         char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
1735 +         _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
1736 +                                                       __pposn);
1737 +         char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
1738 +         char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
1739 +         _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
1740 +                                                       __nposn);
1741 +       }
1742 +    }
1743 +
1744 +  template<> 
1745 +    moneypunct<char, true>::~moneypunct()
1746 +    { delete _M_data; }
1747 +
1748 +  template<> 
1749 +    moneypunct<char, false>::~moneypunct()
1750 +    { delete _M_data; }
1751 +
1752 +#ifdef _GLIBCXX_USE_WCHAR_T
1753 +  template<> 
1754 +    void
1755 +    moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc, 
1756 +#ifdef __UCLIBC_HAS_XLOCALE__
1757 +                                                       const char*)
1758 +#else
1759 +                                                       const char* __name)
1760 +#endif
1761 +    {
1762 +      if (!_M_data)
1763 +       _M_data = new __moneypunct_cache<wchar_t, true>;
1764 +
1765 +      if (!__cloc)
1766 +       {
1767 +         // "C" locale
1768 +         _M_data->_M_decimal_point = L'.';
1769 +         _M_data->_M_thousands_sep = L',';
1770 +         _M_data->_M_grouping = "";
1771 +         _M_data->_M_grouping_size = 0;
1772 +         _M_data->_M_curr_symbol = L"";
1773 +         _M_data->_M_curr_symbol_size = 0;
1774 +         _M_data->_M_positive_sign = L"";
1775 +         _M_data->_M_positive_sign_size = 0;
1776 +         _M_data->_M_negative_sign = L"";
1777 +         _M_data->_M_negative_sign_size = 0;
1778 +         _M_data->_M_frac_digits = 0;
1779 +         _M_data->_M_pos_format = money_base::_S_default_pattern;
1780 +         _M_data->_M_neg_format = money_base::_S_default_pattern;
1781 +
1782 +         // Use ctype::widen code without the facet...
1783 +         unsigned char uc;
1784 +         for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1785 +           {
1786 +             uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
1787 +             _M_data->_M_atoms[__i] = btowc(uc);
1788 +           }
1789 +       }
1790 +      else
1791 +       {
1792 +         // Named locale.
1793 +#ifdef __UCLIBC_HAS_XLOCALE__
1794 +         __c_locale __old = __uselocale(__cloc);
1795 +#else
1796 +         // Switch to named locale so that mbsrtowcs will work.
1797 +         char* __old = strdup(setlocale(LC_ALL, NULL));
1798 +         setlocale(LC_ALL, __name);
1799 +#endif
1800 +
1801 +#ifdef __UCLIBC_MJN3_ONLY__
1802 +#warning fix this... should be monetary
1803 +#endif
1804 +#ifdef __UCLIBC__
1805 +# ifdef __UCLIBC_HAS_XLOCALE__
1806 +         _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1807 +         _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1808 +# else
1809 +         _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1810 +         _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1811 +# endif
1812 +#else
1813 +         union __s_and_w { const char *__s; unsigned int __w; } __u;
1814 +         __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1815 +         _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
1816 +
1817 +         __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1818 +         _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
1819 +#endif
1820 +         _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1821 +         _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1822 +
1823 +         const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1824 +         const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1825 +         const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
1826 +
1827 +         wchar_t* __wcs_ps = 0;
1828 +         wchar_t* __wcs_ns = 0;
1829 +         const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
1830 +         try
1831 +           {
1832 +             mbstate_t __state;
1833 +             size_t __len = strlen(__cpossign);
1834 +             if (__len)
1835 +               {
1836 +                 ++__len;
1837 +                 memset(&__state, 0, sizeof(mbstate_t));
1838 +                 __wcs_ps = new wchar_t[__len];
1839 +                 mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1840 +                 _M_data->_M_positive_sign = __wcs_ps;
1841 +               }
1842 +             else
1843 +               _M_data->_M_positive_sign = L"";
1844 +             _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
1845 +             
1846 +             __len = strlen(__cnegsign);
1847 +             if (!__nposn)
1848 +               _M_data->_M_negative_sign = L"()";
1849 +             else if (__len)
1850 +               { 
1851 +                 ++__len;
1852 +                 memset(&__state, 0, sizeof(mbstate_t));
1853 +                 __wcs_ns = new wchar_t[__len];
1854 +                 mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
1855 +                 _M_data->_M_negative_sign = __wcs_ns;
1856 +               }
1857 +             else
1858 +               _M_data->_M_negative_sign = L"";
1859 +             _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
1860 +             
1861 +             // _Intl == true.
1862 +             __len = strlen(__ccurr);
1863 +             if (__len)
1864 +               {
1865 +                 ++__len;
1866 +                 memset(&__state, 0, sizeof(mbstate_t));
1867 +                 wchar_t* __wcs = new wchar_t[__len];
1868 +                 mbsrtowcs(__wcs, &__ccurr, __len, &__state);
1869 +                 _M_data->_M_curr_symbol = __wcs;
1870 +               }
1871 +             else
1872 +               _M_data->_M_curr_symbol = L"";
1873 +             _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
1874 +           }
1875 +         catch (...)
1876 +           {
1877 +             delete _M_data;
1878 +             _M_data = 0;
1879 +             delete __wcs_ps;
1880 +             delete __wcs_ns;        
1881 +#ifdef __UCLIBC_HAS_XLOCALE__
1882 +             __uselocale(__old);
1883 +#else
1884 +             setlocale(LC_ALL, __old);
1885 +             free(__old);
1886 +#endif
1887 +             __throw_exception_again;
1888 +           } 
1889 +         
1890 +         _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS, 
1891 +                                                     __cloc));
1892 +         char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
1893 +         char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
1894 +         char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
1895 +         _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
1896 +                                                       __pposn);
1897 +         char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
1898 +         char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
1899 +         _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
1900 +                                                       __nposn);
1901 +
1902 +#ifdef __UCLIBC_HAS_XLOCALE__
1903 +         __uselocale(__old);
1904 +#else
1905 +         setlocale(LC_ALL, __old);
1906 +         free(__old);
1907 +#endif
1908 +       }
1909 +    }
1910 +
1911 +  template<> 
1912 +  void
1913 +  moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
1914 +#ifdef __UCLIBC_HAS_XLOCALE__
1915 +                                                      const char*)
1916 +#else
1917 +                                                       const char* __name)
1918 +#endif
1919 +  {
1920 +    if (!_M_data)
1921 +      _M_data = new __moneypunct_cache<wchar_t, false>;
1922 +
1923 +    if (!__cloc)
1924 +       {
1925 +         // "C" locale
1926 +         _M_data->_M_decimal_point = L'.';
1927 +         _M_data->_M_thousands_sep = L',';
1928 +         _M_data->_M_grouping = "";
1929 +          _M_data->_M_grouping_size = 0;
1930 +         _M_data->_M_curr_symbol = L"";
1931 +         _M_data->_M_curr_symbol_size = 0;
1932 +         _M_data->_M_positive_sign = L"";
1933 +         _M_data->_M_positive_sign_size = 0;
1934 +         _M_data->_M_negative_sign = L"";
1935 +         _M_data->_M_negative_sign_size = 0;
1936 +         _M_data->_M_frac_digits = 0;
1937 +         _M_data->_M_pos_format = money_base::_S_default_pattern;
1938 +         _M_data->_M_neg_format = money_base::_S_default_pattern;
1939 +
1940 +         // Use ctype::widen code without the facet...
1941 +         unsigned char uc;
1942 +         for (size_t __i = 0; __i < money_base::_S_end; ++__i)
1943 +           {
1944 +             uc = static_cast<unsigned char>(money_base::_S_atoms[__i]);
1945 +             _M_data->_M_atoms[__i] = btowc(uc);
1946 +           }
1947 +       }
1948 +      else
1949 +       {
1950 +         // Named locale.
1951 +#ifdef __UCLIBC_HAS_XLOCALE__
1952 +         __c_locale __old = __uselocale(__cloc);
1953 +#else
1954 +         // Switch to named locale so that mbsrtowcs will work.
1955 +         char* __old = strdup(setlocale(LC_ALL, NULL));
1956 +         setlocale(LC_ALL, __name);
1957 +#endif
1958 +
1959 +#ifdef __UCLIBC_MJN3_ONLY__
1960 +#warning fix this... should be monetary
1961 +#endif
1962 +#ifdef __UCLIBC__
1963 +# ifdef __UCLIBC_HAS_XLOCALE__
1964 +         _M_data->_M_decimal_point = __cloc->decimal_point_wc;
1965 +         _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
1966 +# else
1967 +         _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
1968 +         _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
1969 +# endif
1970 +#else
1971 +         union __s_and_w { const char *__s; unsigned int __w; } __u;
1972 +         __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
1973 +         _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
1974 +
1975 +         __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
1976 +         _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
1977 +#endif
1978 +         _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
1979 +          _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
1980 +
1981 +         const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
1982 +         const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
1983 +         const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
1984 +
1985 +         wchar_t* __wcs_ps = 0;
1986 +         wchar_t* __wcs_ns = 0;
1987 +         const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
1988 +         try
1989 +            {
1990 +              mbstate_t __state;
1991 +              size_t __len;
1992 +              __len = strlen(__cpossign);
1993 +              if (__len)
1994 +                {
1995 +                 ++__len;
1996 +                 memset(&__state, 0, sizeof(mbstate_t));
1997 +                 __wcs_ps = new wchar_t[__len];
1998 +                 mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
1999 +                 _M_data->_M_positive_sign = __wcs_ps;
2000 +               }
2001 +             else
2002 +               _M_data->_M_positive_sign = L"";
2003 +              _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
2004 +             
2005 +             __len = strlen(__cnegsign);
2006 +             if (!__nposn)
2007 +               _M_data->_M_negative_sign = L"()";
2008 +             else if (__len)
2009 +               { 
2010 +                 ++__len;
2011 +                 memset(&__state, 0, sizeof(mbstate_t));
2012 +                 __wcs_ns = new wchar_t[__len];
2013 +                 mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2014 +                 _M_data->_M_negative_sign = __wcs_ns;
2015 +               }
2016 +             else
2017 +               _M_data->_M_negative_sign = L"";
2018 +              _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2019 +
2020 +             // _Intl == true.
2021 +             __len = strlen(__ccurr);
2022 +             if (__len)
2023 +               {
2024 +                 ++__len;
2025 +                 memset(&__state, 0, sizeof(mbstate_t));
2026 +                 wchar_t* __wcs = new wchar_t[__len];
2027 +                 mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2028 +                 _M_data->_M_curr_symbol = __wcs;
2029 +               }
2030 +             else
2031 +               _M_data->_M_curr_symbol = L"";
2032 +              _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2033 +           }
2034 +          catch (...)
2035 +           {
2036 +             delete _M_data;
2037 +              _M_data = 0;
2038 +             delete __wcs_ps;
2039 +             delete __wcs_ns;        
2040 +#ifdef __UCLIBC_HAS_XLOCALE__
2041 +             __uselocale(__old);
2042 +#else
2043 +             setlocale(LC_ALL, __old);
2044 +             free(__old);
2045 +#endif
2046 +              __throw_exception_again;
2047 +           }
2048 +
2049 +         _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2050 +         char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2051 +         char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2052 +         char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2053 +         _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace, 
2054 +                                                       __pposn);
2055 +         char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2056 +         char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2057 +         _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace, 
2058 +                                                       __nposn);
2059 +
2060 +#ifdef __UCLIBC_HAS_XLOCALE__
2061 +         __uselocale(__old);
2062 +#else
2063 +         setlocale(LC_ALL, __old);
2064 +         free(__old);
2065 +#endif
2066 +       }
2067 +    }
2068 +
2069 +  template<> 
2070 +    moneypunct<wchar_t, true>::~moneypunct()
2071 +    {
2072 +      if (_M_data->_M_positive_sign_size)
2073 +       delete [] _M_data->_M_positive_sign;
2074 +      if (_M_data->_M_negative_sign_size
2075 +          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2076 +       delete [] _M_data->_M_negative_sign;
2077 +      if (_M_data->_M_curr_symbol_size)
2078 +       delete [] _M_data->_M_curr_symbol;
2079 +      delete _M_data;
2080 +    }
2081 +
2082 +  template<> 
2083 +    moneypunct<wchar_t, false>::~moneypunct()
2084 +    {
2085 +      if (_M_data->_M_positive_sign_size)
2086 +       delete [] _M_data->_M_positive_sign;
2087 +      if (_M_data->_M_negative_sign_size
2088 +          && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2089 +       delete [] _M_data->_M_negative_sign;
2090 +      if (_M_data->_M_curr_symbol_size)
2091 +       delete [] _M_data->_M_curr_symbol;
2092 +      delete _M_data;
2093 +    }
2094 +#endif
2095 +}
2096 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2097 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 18:00:00.000000000 -0600
2098 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/numeric_members.cc      2004-08-12 16:13:31.000000000 -0500
2099 @@ -0,0 +1,183 @@
2100 +// std::numpunct implementation details, GNU version -*- C++ -*-
2101 +
2102 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2103 +//
2104 +// This file is part of the GNU ISO C++ Library.  This library is free
2105 +// software; you can redistribute it and/or modify it under the
2106 +// terms of the GNU General Public License as published by the
2107 +// Free Software Foundation; either version 2, or (at your option)
2108 +// any later version.
2109 +
2110 +// This library is distributed in the hope that it will be useful,
2111 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2112 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2113 +// GNU General Public License for more details.
2114 +
2115 +// You should have received a copy of the GNU General Public License along
2116 +// with this library; see the file COPYING.  If not, write to the Free
2117 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2118 +// USA.
2119 +
2120 +// As a special exception, you may use this file as part of a free software
2121 +// library without restriction.  Specifically, if other files instantiate
2122 +// templates or use macros or inline functions from this file, or you compile
2123 +// this file and link it with other files to produce an executable, this
2124 +// file does not by itself cause the resulting executable to be covered by
2125 +// the GNU General Public License.  This exception does not however
2126 +// invalidate any other reasons why the executable file might be covered by
2127 +// the GNU General Public License.
2128 +
2129 +//
2130 +// ISO C++ 14882: 22.2.3.1.2  numpunct virtual functions
2131 +//
2132 +
2133 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2134 +
2135 +#define _LIBC
2136 +#include <locale>
2137 +#undef _LIBC
2138 +#include <bits/c++locale_internal.h>
2139 +
2140 +#ifdef __UCLIBC_MJN3_ONLY__
2141 +#warning tailor for stub locale support
2142 +#endif
2143 +#ifndef __UCLIBC_HAS_XLOCALE__
2144 +#define __nl_langinfo_l(N, L)         nl_langinfo((N))
2145 +#endif
2146 +
2147 +namespace std
2148 +{
2149 +  template<> 
2150 +    void
2151 +    numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2152 +    {
2153 +      if (!_M_data)
2154 +       _M_data = new __numpunct_cache<char>;
2155 +
2156 +      if (!__cloc)
2157 +       {
2158 +         // "C" locale
2159 +         _M_data->_M_grouping = "";
2160 +         _M_data->_M_grouping_size = 0;
2161 +         _M_data->_M_use_grouping = false;
2162 +
2163 +         _M_data->_M_decimal_point = '.';
2164 +         _M_data->_M_thousands_sep = ',';
2165 +
2166 +         for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2167 +           _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2168 +
2169 +         for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2170 +           _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2171 +       }
2172 +      else
2173 +       {
2174 +         // Named locale.
2175 +         _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT, 
2176 +                                                       __cloc));
2177 +         _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP, 
2178 +                                                       __cloc));
2179 +
2180 +         // Check for NULL, which implies no grouping.
2181 +         if (_M_data->_M_thousands_sep == '\0')
2182 +           _M_data->_M_grouping = "";
2183 +         else
2184 +           _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2185 +         _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2186 +       }
2187 +
2188 +      // NB: There is no way to extact this info from posix locales.
2189 +      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2190 +      _M_data->_M_truename = "true";
2191 +      _M_data->_M_truename_size = strlen(_M_data->_M_truename);
2192 +      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2193 +      _M_data->_M_falsename = "false";
2194 +      _M_data->_M_falsename_size = strlen(_M_data->_M_falsename);
2195 +    }
2196
2197 +  template<> 
2198 +    numpunct<char>::~numpunct()
2199 +    { delete _M_data; }
2200 +   
2201 +#ifdef _GLIBCXX_USE_WCHAR_T
2202 +  template<> 
2203 +    void
2204 +    numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2205 +    {
2206 +      if (!_M_data)
2207 +       _M_data = new __numpunct_cache<wchar_t>;
2208 +
2209 +      if (!__cloc)
2210 +       {
2211 +         // "C" locale
2212 +         _M_data->_M_grouping = "";
2213 +         _M_data->_M_grouping_size = 0;
2214 +         _M_data->_M_use_grouping = false;
2215 +
2216 +         _M_data->_M_decimal_point = L'.';
2217 +         _M_data->_M_thousands_sep = L',';
2218 +
2219 +#ifdef __UCLIBC_HAS_XLOCALE__
2220 +         __c_locale __old = __uselocale(_S_get_c_locale());
2221 +#endif
2222 +         // Use ctype::widen code without the facet...
2223 +         unsigned char uc;
2224 +         for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2225 +           {
2226 +             uc = static_cast<unsigned char>(__num_base::_S_atoms_out[__i]);
2227 +             _M_data->_M_atoms_out[__i] = btowc(uc);
2228 +           }
2229 +
2230 +         for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2231 +           {
2232 +             uc = static_cast<unsigned char>(__num_base::_S_atoms_in[__j]);
2233 +             _M_data->_M_atoms_in[__j] = btowc(uc);
2234 +           }
2235 +#ifdef __UCLIBC_HAS_XLOCALE__
2236 +         __uselocale(__old);
2237 +#endif
2238 +       }
2239 +      else
2240 +       {
2241 +         // Named locale.
2242 +#ifdef __UCLIBC_MJN3_ONLY__
2243 +#warning fix this
2244 +#endif
2245 +#ifdef __UCLIBC__
2246 +# ifdef __UCLIBC_HAS_XLOCALE__
2247 +         _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2248 +         _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2249 +# else
2250 +         _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2251 +         _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2252 +# endif
2253 +#else
2254 +         union __s_and_w { const char *__s; unsigned int __w; } __u;
2255 +         __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2256 +         _M_data->_M_decimal_point = static_cast<wchar_t>(__u.__w);
2257 +
2258 +         __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2259 +         _M_data->_M_thousands_sep = static_cast<wchar_t>(__u.__w);
2260 +#endif
2261 +
2262 +         if (_M_data->_M_thousands_sep == L'\0')
2263 +           _M_data->_M_grouping = "";
2264 +         else
2265 +           _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2266 +         _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2267 +       }
2268 +
2269 +      // NB: There is no way to extact this info from posix locales.
2270 +      // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2271 +      _M_data->_M_truename = L"true";
2272 +      _M_data->_M_truename_size = wcslen(_M_data->_M_truename);
2273 +      // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2274 +      _M_data->_M_falsename = L"false";
2275 +      _M_data->_M_falsename_size = wcslen(_M_data->_M_falsename);
2276 +    }
2277 +
2278 +  template<> 
2279 +    numpunct<wchar_t>::~numpunct()
2280 +    { delete _M_data; }
2281 + #endif
2282 +}
2283 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-3.4.1/libstdc++-v3/config/locale/uclibc/time_members.cc
2284 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/time_members.cc    1969-12-31 18:00:00.000000000 -0600
2285 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/time_members.cc 2004-08-12 15:54:48.000000000 -0500
2286 @@ -0,0 +1,347 @@
2287 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2288 +
2289 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2290 +//
2291 +// This file is part of the GNU ISO C++ Library.  This library is free
2292 +// software; you can redistribute it and/or modify it under the
2293 +// terms of the GNU General Public License as published by the
2294 +// Free Software Foundation; either version 2, or (at your option)
2295 +// any later version.
2296 +
2297 +// This library is distributed in the hope that it will be useful,
2298 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2299 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2300 +// GNU General Public License for more details.
2301 +
2302 +// You should have received a copy of the GNU General Public License along
2303 +// with this library; see the file COPYING.  If not, write to the Free
2304 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2305 +// USA.
2306 +
2307 +// As a special exception, you may use this file as part of a free software
2308 +// library without restriction.  Specifically, if other files instantiate
2309 +// templates or use macros or inline functions from this file, or you compile
2310 +// this file and link it with other files to produce an executable, this
2311 +// file does not by itself cause the resulting executable to be covered by
2312 +// the GNU General Public License.  This exception does not however
2313 +// invalidate any other reasons why the executable file might be covered by
2314 +// the GNU General Public License.
2315 +
2316 +//
2317 +// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2318 +// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2319 +//
2320 +
2321 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2322 +
2323 +#include <locale>
2324 +#include <bits/c++locale_internal.h>
2325 +
2326 +#ifdef __UCLIBC_MJN3_ONLY__
2327 +#warning tailor for stub locale support
2328 +#endif
2329 +#ifndef __UCLIBC_HAS_XLOCALE__
2330 +#define __nl_langinfo_l(N, L)         nl_langinfo((N))
2331 +#endif
2332 +
2333 +namespace std
2334 +{
2335 +  template<>
2336 +    void
2337 +    __timepunct<char>::
2338 +    _M_put(char* __s, size_t __maxlen, const char* __format, 
2339 +          const tm* __tm) const
2340 +    {
2341 +#ifdef __UCLIBC_HAS_XLOCALE__
2342 +      __strftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2343 +#else
2344 +      char* __old = strdup(setlocale(LC_ALL, NULL));
2345 +      setlocale(LC_ALL, _M_name_timepunct);
2346 +      strftime(__s, __maxlen, __format, __tm);
2347 +      setlocale(LC_ALL, __old);
2348 +      free(__old);
2349 +#endif
2350 +    }
2351 +
2352 +  template<> 
2353 +    void
2354 +    __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2355 +    {
2356 +      if (!_M_data)
2357 +       _M_data = new __timepunct_cache<char>;
2358 +
2359 +      if (!__cloc)
2360 +       {
2361 +         // "C" locale
2362 +         _M_c_locale_timepunct = _S_get_c_locale();
2363 +
2364 +         _M_data->_M_date_format = "%m/%d/%y";
2365 +         _M_data->_M_date_era_format = "%m/%d/%y";
2366 +         _M_data->_M_time_format = "%H:%M:%S";
2367 +         _M_data->_M_time_era_format = "%H:%M:%S";
2368 +         _M_data->_M_date_time_format = "";
2369 +         _M_data->_M_date_time_era_format = "";
2370 +         _M_data->_M_am = "AM";
2371 +         _M_data->_M_pm = "PM";
2372 +         _M_data->_M_am_pm_format = "";
2373 +
2374 +         // Day names, starting with "C"'s Sunday.
2375 +         _M_data->_M_day1 = "Sunday";
2376 +         _M_data->_M_day2 = "Monday";
2377 +         _M_data->_M_day3 = "Tuesday";
2378 +         _M_data->_M_day4 = "Wednesday";
2379 +         _M_data->_M_day5 = "Thursday";
2380 +         _M_data->_M_day6 = "Friday";
2381 +         _M_data->_M_day7 = "Saturday";
2382 +
2383 +         // Abbreviated day names, starting with "C"'s Sun.
2384 +         _M_data->_M_aday1 = "Sun";
2385 +         _M_data->_M_aday2 = "Mon";
2386 +         _M_data->_M_aday3 = "Tue";
2387 +         _M_data->_M_aday4 = "Wed";
2388 +         _M_data->_M_aday5 = "Thu";
2389 +         _M_data->_M_aday6 = "Fri";
2390 +         _M_data->_M_aday7 = "Sat";
2391 +
2392 +         // Month names, starting with "C"'s January.
2393 +         _M_data->_M_month01 = "January";
2394 +         _M_data->_M_month02 = "February";
2395 +         _M_data->_M_month03 = "March";
2396 +         _M_data->_M_month04 = "April";
2397 +         _M_data->_M_month05 = "May";
2398 +         _M_data->_M_month06 = "June";
2399 +         _M_data->_M_month07 = "July";
2400 +         _M_data->_M_month08 = "August";
2401 +         _M_data->_M_month09 = "September";
2402 +         _M_data->_M_month10 = "October";
2403 +         _M_data->_M_month11 = "November";
2404 +         _M_data->_M_month12 = "December";
2405 +
2406 +         // Abbreviated month names, starting with "C"'s Jan.
2407 +         _M_data->_M_amonth01 = "Jan";
2408 +         _M_data->_M_amonth02 = "Feb";
2409 +         _M_data->_M_amonth03 = "Mar";
2410 +         _M_data->_M_amonth04 = "Apr";
2411 +         _M_data->_M_amonth05 = "May";
2412 +         _M_data->_M_amonth06 = "Jun";
2413 +         _M_data->_M_amonth07 = "Jul";
2414 +         _M_data->_M_amonth08 = "Aug";
2415 +         _M_data->_M_amonth09 = "Sep";
2416 +         _M_data->_M_amonth10 = "Oct";
2417 +         _M_data->_M_amonth11 = "Nov";
2418 +         _M_data->_M_amonth12 = "Dec";
2419 +       }
2420 +      else
2421 +       {
2422 +         _M_c_locale_timepunct = _S_clone_c_locale(__cloc); 
2423 +
2424 +         _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2425 +         _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2426 +         _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2427 +         _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2428 +         _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
2429 +         _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT, __cloc);
2430 +         _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
2431 +         _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
2432 +         _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
2433 +
2434 +         // Day names, starting with "C"'s Sunday.
2435 +         _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
2436 +         _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
2437 +         _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
2438 +         _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
2439 +         _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
2440 +         _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
2441 +         _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
2442 +
2443 +         // Abbreviated day names, starting with "C"'s Sun.
2444 +         _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
2445 +         _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
2446 +         _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
2447 +         _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
2448 +         _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
2449 +         _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
2450 +         _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
2451 +
2452 +         // Month names, starting with "C"'s January.
2453 +         _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
2454 +         _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
2455 +         _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
2456 +         _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
2457 +         _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
2458 +         _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
2459 +         _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
2460 +         _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
2461 +         _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
2462 +         _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
2463 +         _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
2464 +         _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
2465 +
2466 +         // Abbreviated month names, starting with "C"'s Jan.
2467 +         _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
2468 +         _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
2469 +         _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
2470 +         _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
2471 +         _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
2472 +         _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
2473 +         _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
2474 +         _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
2475 +         _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
2476 +         _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
2477 +         _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
2478 +         _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
2479 +       }
2480 +    }
2481 +
2482 +#ifdef _GLIBCXX_USE_WCHAR_T
2483 +  template<>
2484 +    void
2485 +    __timepunct<wchar_t>::
2486 +    _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format, 
2487 +          const tm* __tm) const
2488 +    {
2489 +#ifdef __UCLIBC_HAS_XLOCALE__
2490 +      __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
2491 +#else
2492 +      char* __old = strdup(setlocale(LC_ALL, NULL));
2493 +      setlocale(LC_ALL, _M_name_timepunct);
2494 +      wcsftime(__s, __maxlen, __format, __tm);
2495 +      setlocale(LC_ALL, __old);
2496 +      free(__old);
2497 +#endif
2498 +    }
2499 +
2500 +  template<> 
2501 +    void
2502 +    __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
2503 +    {
2504 +      if (!_M_data)
2505 +       _M_data = new __timepunct_cache<wchar_t>;
2506 +
2507 +#warning wide time stuff
2508 +//       if (!__cloc)
2509 +       {
2510 +         // "C" locale
2511 +         _M_c_locale_timepunct = _S_get_c_locale();
2512 +
2513 +         _M_data->_M_date_format = L"%m/%d/%y";
2514 +         _M_data->_M_date_era_format = L"%m/%d/%y";
2515 +         _M_data->_M_time_format = L"%H:%M:%S";
2516 +         _M_data->_M_time_era_format = L"%H:%M:%S";
2517 +         _M_data->_M_date_time_format = L"";
2518 +         _M_data->_M_date_time_era_format = L"";
2519 +         _M_data->_M_am = L"AM";
2520 +         _M_data->_M_pm = L"PM";
2521 +         _M_data->_M_am_pm_format = L"";
2522 +
2523 +         // Day names, starting with "C"'s Sunday.
2524 +         _M_data->_M_day1 = L"Sunday";
2525 +         _M_data->_M_day2 = L"Monday";
2526 +         _M_data->_M_day3 = L"Tuesday";
2527 +         _M_data->_M_day4 = L"Wednesday";
2528 +         _M_data->_M_day5 = L"Thursday";
2529 +         _M_data->_M_day6 = L"Friday";
2530 +         _M_data->_M_day7 = L"Saturday";
2531 +
2532 +         // Abbreviated day names, starting with "C"'s Sun.
2533 +         _M_data->_M_aday1 = L"Sun";
2534 +         _M_data->_M_aday2 = L"Mon";
2535 +         _M_data->_M_aday3 = L"Tue";
2536 +         _M_data->_M_aday4 = L"Wed";
2537 +         _M_data->_M_aday5 = L"Thu";
2538 +         _M_data->_M_aday6 = L"Fri";
2539 +         _M_data->_M_aday7 = L"Sat";
2540 +
2541 +         // Month names, starting with "C"'s January.
2542 +         _M_data->_M_month01 = L"January";
2543 +         _M_data->_M_month02 = L"February";
2544 +         _M_data->_M_month03 = L"March";
2545 +         _M_data->_M_month04 = L"April";
2546 +         _M_data->_M_month05 = L"May";
2547 +         _M_data->_M_month06 = L"June";
2548 +         _M_data->_M_month07 = L"July";
2549 +         _M_data->_M_month08 = L"August";
2550 +         _M_data->_M_month09 = L"September";
2551 +         _M_data->_M_month10 = L"October";
2552 +         _M_data->_M_month11 = L"November";
2553 +         _M_data->_M_month12 = L"December";
2554 +
2555 +         // Abbreviated month names, starting with "C"'s Jan.
2556 +         _M_data->_M_amonth01 = L"Jan";
2557 +         _M_data->_M_amonth02 = L"Feb";
2558 +         _M_data->_M_amonth03 = L"Mar";
2559 +         _M_data->_M_amonth04 = L"Apr";
2560 +         _M_data->_M_amonth05 = L"May";
2561 +         _M_data->_M_amonth06 = L"Jun";
2562 +         _M_data->_M_amonth07 = L"Jul";
2563 +         _M_data->_M_amonth08 = L"Aug";
2564 +         _M_data->_M_amonth09 = L"Sep";
2565 +         _M_data->_M_amonth10 = L"Oct";
2566 +         _M_data->_M_amonth11 = L"Nov";
2567 +         _M_data->_M_amonth12 = L"Dec";
2568 +       }
2569 +#if 0
2570 +      else
2571 +       {
2572 +         _M_c_locale_timepunct = _S_clone_c_locale(__cloc); 
2573 +
2574 +         _M_data->_M_date_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_FMT, __cloc));
2575 +         _M_data->_M_date_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_FMT, __cloc));
2576 +         _M_data->_M_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT, __cloc));
2577 +         _M_data->_M_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_T_FMT, __cloc));
2578 +         _M_data->_M_date_time_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WD_T_FMT, __cloc));
2579 +         _M_data->_M_date_time_era_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc));
2580 +         _M_data->_M_am = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WAM_STR, __cloc));
2581 +         _M_data->_M_pm = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WPM_STR, __cloc));
2582 +         _M_data->_M_am_pm_format = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc));
2583 +
2584 +         // Day names, starting with "C"'s Sunday.
2585 +         _M_data->_M_day1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_1, __cloc));
2586 +         _M_data->_M_day2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_2, __cloc));
2587 +         _M_data->_M_day3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_3, __cloc));
2588 +         _M_data->_M_day4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_4, __cloc));
2589 +         _M_data->_M_day5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_5, __cloc));
2590 +         _M_data->_M_day6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_6, __cloc));
2591 +         _M_data->_M_day7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WDAY_7, __cloc));
2592 +
2593 +         // Abbreviated day names, starting with "C"'s Sun.
2594 +         _M_data->_M_aday1 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_1, __cloc));
2595 +         _M_data->_M_aday2 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_2, __cloc));
2596 +         _M_data->_M_aday3 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_3, __cloc));
2597 +         _M_data->_M_aday4 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_4, __cloc));
2598 +         _M_data->_M_aday5 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_5, __cloc));
2599 +         _M_data->_M_aday6 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_6, __cloc));
2600 +         _M_data->_M_aday7 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABDAY_7, __cloc));
2601 +
2602 +         // Month names, starting with "C"'s January.
2603 +         _M_data->_M_month01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_1, __cloc));
2604 +         _M_data->_M_month02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_2, __cloc));
2605 +         _M_data->_M_month03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_3, __cloc));
2606 +         _M_data->_M_month04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_4, __cloc));
2607 +         _M_data->_M_month05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_5, __cloc));
2608 +         _M_data->_M_month06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_6, __cloc));
2609 +         _M_data->_M_month07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_7, __cloc));
2610 +         _M_data->_M_month08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_8, __cloc));
2611 +         _M_data->_M_month09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_9, __cloc));
2612 +         _M_data->_M_month10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_10, __cloc));
2613 +         _M_data->_M_month11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_11, __cloc));
2614 +         _M_data->_M_month12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WMON_12, __cloc));
2615 +
2616 +         // Abbreviated month names, starting with "C"'s Jan.
2617 +         _M_data->_M_amonth01 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_1, __cloc));
2618 +         _M_data->_M_amonth02 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_2, __cloc));
2619 +         _M_data->_M_amonth03 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_3, __cloc));
2620 +         _M_data->_M_amonth04 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_4, __cloc));
2621 +         _M_data->_M_amonth05 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_5, __cloc));
2622 +         _M_data->_M_amonth06 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_6, __cloc));
2623 +         _M_data->_M_amonth07 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_7, __cloc));
2624 +         _M_data->_M_amonth08 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_8, __cloc));
2625 +         _M_data->_M_amonth09 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_9, __cloc));
2626 +         _M_data->_M_amonth10 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_10, __cloc));
2627 +         _M_data->_M_amonth11 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_11, __cloc));
2628 +         _M_data->_M_amonth12 = reinterpret_cast<wchar_t*>(__nl_langinfo_l(_NL_WABMON_12, __cloc));
2629 +       }
2630 +#endif // 0
2631 +    }
2632 +#endif
2633 +}
2634 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/time_members.h gcc-3.4.1/libstdc++-v3/config/locale/uclibc/time_members.h
2635 --- gcc-3.4.1-dist/libstdc++-v3/config/locale/uclibc/time_members.h     1969-12-31 18:00:00.000000000 -0600
2636 +++ gcc-3.4.1/libstdc++-v3/config/locale/uclibc/time_members.h  2004-08-12 15:54:48.000000000 -0500
2637 @@ -0,0 +1,68 @@
2638 +// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2639 +
2640 +// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2641 +//
2642 +// This file is part of the GNU ISO C++ Library.  This library is free
2643 +// software; you can redistribute it and/or modify it under the
2644 +// terms of the GNU General Public License as published by the
2645 +// Free Software Foundation; either version 2, or (at your option)
2646 +// any later version.
2647 +
2648 +// This library is distributed in the hope that it will be useful,
2649 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2650 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2651 +// GNU General Public License for more details.
2652 +
2653 +// You should have received a copy of the GNU General Public License along
2654 +// with this library; see the file COPYING.  If not, write to the Free
2655 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2656 +// USA.
2657 +
2658 +// As a special exception, you may use this file as part of a free software
2659 +// library without restriction.  Specifically, if other files instantiate
2660 +// templates or use macros or inline functions from this file, or you compile
2661 +// this file and link it with other files to produce an executable, this
2662 +// file does not by itself cause the resulting executable to be covered by
2663 +// the GNU General Public License.  This exception does not however
2664 +// invalidate any other reasons why the executable file might be covered by
2665 +// the GNU General Public License.
2666 +
2667 +//
2668 +// ISO C++ 14882: 22.2.5.1.2 - time_get functions
2669 +// ISO C++ 14882: 22.2.5.3.2 - time_put functions
2670 +//
2671 +
2672 +// Written by Benjamin Kosnik <bkoz@redhat.com>
2673 +
2674 +  template<typename _CharT>
2675 +    __timepunct<_CharT>::__timepunct(size_t __refs) 
2676 +    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), 
2677 +    _M_name_timepunct(_S_get_c_name())
2678 +    { _M_initialize_timepunct(); }
2679 +
2680 +  template<typename _CharT>
2681 +    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) 
2682 +    : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL), 
2683 +    _M_name_timepunct(_S_get_c_name())
2684 +    { _M_initialize_timepunct(); }
2685 +
2686 +  template<typename _CharT>
2687 +    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
2688 +                                    size_t __refs) 
2689 +    : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), 
2690 +    _M_name_timepunct(__s)
2691 +    { 
2692 +      char* __tmp = new char[std::strlen(__s) + 1];
2693 +      std::strcpy(__tmp, __s);
2694 +      _M_name_timepunct = __tmp;
2695 +      _M_initialize_timepunct(__cloc); 
2696 +    }
2697 +
2698 +  template<typename _CharT>
2699 +    __timepunct<_CharT>::~__timepunct()
2700 +    { 
2701 +      if (_M_name_timepunct != _S_get_c_name())
2702 +       delete [] _M_name_timepunct;
2703 +      delete _M_data; 
2704 +      _S_destroy_c_locale(_M_c_locale_timepunct); 
2705 +    }
2706 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-3.4.1/libstdc++-v3/config/os/uclibc/ctype_base.h
2707 --- gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/ctype_base.h   1969-12-31 18:00:00.000000000 -0600
2708 +++ gcc-3.4.1/libstdc++-v3/config/os/uclibc/ctype_base.h        2004-08-12 15:54:48.000000000 -0500
2709 @@ -0,0 +1,58 @@
2710 +// Locale support -*- C++ -*-
2711 +
2712 +// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003
2713 +// Free Software Foundation, Inc.
2714 +//
2715 +// This file is part of the GNU ISO C++ Library.  This library is free
2716 +// software; you can redistribute it and/or modify it under the
2717 +// terms of the GNU General Public License as published by the
2718 +// Free Software Foundation; either version 2, or (at your option)
2719 +// any later version.
2720 +
2721 +// This library is distributed in the hope that it will be useful,
2722 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2723 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2724 +// GNU General Public License for more details.
2725 +
2726 +// You should have received a copy of the GNU General Public License along
2727 +// with this library; see the file COPYING.  If not, write to the Free
2728 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2729 +// USA.
2730 +
2731 +// As a special exception, you may use this file as part of a free software
2732 +// library without restriction.  Specifically, if other files instantiate
2733 +// templates or use macros or inline functions from this file, or you compile
2734 +// this file and link it with other files to produce an executable, this
2735 +// file does not by itself cause the resulting executable to be covered by
2736 +// the GNU General Public License.  This exception does not however
2737 +// invalidate any other reasons why the executable file might be covered by
2738 +// the GNU General Public License.
2739 +
2740 +//
2741 +// ISO C++ 14882: 22.1  Locales
2742 +//
2743 +  
2744 +// Information as gleaned from /usr/include/ctype.h
2745 +  
2746 +  struct ctype_base
2747 +  {
2748 +    // Note: In uClibc, the following two types depend on configuration.
2749
2750 +    // Non-standard typedefs.
2751 +    typedef const __ctype_touplow_t* __to_type;
2752 +
2753 +    // NB: Offsets into ctype<char>::_M_table force a particular size
2754 +    // on the mask type. Because of this, we don't use an enum.
2755 +    typedef __ctype_mask_t     mask;   
2756 +    static const mask upper            = _ISupper;
2757 +    static const mask lower    = _ISlower;
2758 +    static const mask alpha    = _ISalpha;
2759 +    static const mask digit    = _ISdigit;
2760 +    static const mask xdigit   = _ISxdigit;
2761 +    static const mask space    = _ISspace;
2762 +    static const mask print    = _ISprint;
2763 +    static const mask graph    = _ISalpha | _ISdigit | _ISpunct;
2764 +    static const mask cntrl    = _IScntrl;
2765 +    static const mask punct    = _ISpunct;
2766 +    static const mask alnum    = _ISalpha | _ISdigit;
2767 +  };
2768 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-3.4.1/libstdc++-v3/config/os/uclibc/ctype_inline.h
2769 --- gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 18:00:00.000000000 -0600
2770 +++ gcc-3.4.1/libstdc++-v3/config/os/uclibc/ctype_inline.h      2004-08-12 15:54:48.000000000 -0500
2771 @@ -0,0 +1,69 @@
2772 +// Locale support -*- C++ -*-
2773 +
2774 +// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
2775 +//
2776 +// This file is part of the GNU ISO C++ Library.  This library is free
2777 +// software; you can redistribute it and/or modify it under the
2778 +// terms of the GNU General Public License as published by the
2779 +// Free Software Foundation; either version 2, or (at your option)
2780 +// any later version.
2781 +
2782 +// This library is distributed in the hope that it will be useful,
2783 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2784 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2785 +// GNU General Public License for more details.
2786 +
2787 +// You should have received a copy of the GNU General Public License along
2788 +// with this library; see the file COPYING.  If not, write to the Free
2789 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2790 +// USA.
2791 +
2792 +// As a special exception, you may use this file as part of a free software
2793 +// library without restriction.  Specifically, if other files instantiate
2794 +// templates or use macros or inline functions from this file, or you compile
2795 +// this file and link it with other files to produce an executable, this
2796 +// file does not by itself cause the resulting executable to be covered by
2797 +// the GNU General Public License.  This exception does not however
2798 +// invalidate any other reasons why the executable file might be covered by
2799 +// the GNU General Public License.
2800 +
2801 +//
2802 +// ISO C++ 14882: 22.1  Locales
2803 +//
2804 +  
2805 +// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
2806 +// functions go in ctype.cc
2807 +  
2808 +  bool
2809 +  ctype<char>::
2810 +  is(mask __m, char __c) const
2811 +  { return _M_table[static_cast<unsigned char>(__c)] & __m; }
2812 +
2813 +  const char*
2814 +  ctype<char>::
2815 +  is(const char* __low, const char* __high, mask* __vec) const
2816 +  {
2817 +    while (__low < __high)
2818 +      *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
2819 +    return __high;
2820 +  }
2821 +
2822 +  const char*
2823 +  ctype<char>::
2824 +  scan_is(mask __m, const char* __low, const char* __high) const
2825 +  {
2826 +    while (__low < __high 
2827 +          && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
2828 +      ++__low;
2829 +    return __low;
2830 +  }
2831 +
2832 +  const char*
2833 +  ctype<char>::
2834 +  scan_not(mask __m, const char* __low, const char* __high) const
2835 +  {
2836 +    while (__low < __high 
2837 +          && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
2838 +      ++__low;
2839 +    return __low;
2840 +  }
2841 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-3.4.1/libstdc++-v3/config/os/uclibc/ctype_noninline.h
2842 --- gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/ctype_noninline.h      1969-12-31 18:00:00.000000000 -0600
2843 +++ gcc-3.4.1/libstdc++-v3/config/os/uclibc/ctype_noninline.h   2004-08-12 15:54:48.000000000 -0500
2844 @@ -0,0 +1,92 @@
2845 +// Locale support -*- C++ -*-
2846 +
2847 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
2848 +// Free Software Foundation, Inc.
2849 +//
2850 +// This file is part of the GNU ISO C++ Library.  This library is free
2851 +// software; you can redistribute it and/or modify it under the
2852 +// terms of the GNU General Public License as published by the
2853 +// Free Software Foundation; either version 2, or (at your option)
2854 +// any later version.
2855 +
2856 +// This library is distributed in the hope that it will be useful,
2857 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2858 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2859 +// GNU General Public License for more details.
2860 +
2861 +// You should have received a copy of the GNU General Public License along
2862 +// with this library; see the file COPYING.  If not, write to the Free
2863 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2864 +// USA.
2865 +
2866 +// As a special exception, you may use this file as part of a free software
2867 +// library without restriction.  Specifically, if other files instantiate
2868 +// templates or use macros or inline functions from this file, or you compile
2869 +// this file and link it with other files to produce an executable, this
2870 +// file does not by itself cause the resulting executable to be covered by
2871 +// the GNU General Public License.  This exception does not however
2872 +// invalidate any other reasons why the executable file might be covered by
2873 +// the GNU General Public License.
2874 +
2875 +//
2876 +// ISO C++ 14882: 22.1  Locales
2877 +//
2878 +  
2879 +// Information as gleaned from /usr/include/ctype.h
2880 +
2881 +  const ctype_base::mask*
2882 +  ctype<char>::classic_table() throw()
2883 +  { return __C_ctype_b; }
2884 +
2885 +  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 
2886 +                    size_t __refs) 
2887 +  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
2888 +  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2889 +  {
2890 +    _M_toupper = __C_ctype_toupper;
2891 +    _M_tolower = __C_ctype_tolower;
2892 +    _M_table = __table ? __table : __C_ctype_b;
2893 +    memset(_M_widen, 0, sizeof(_M_widen));
2894 +    memset(_M_narrow, 0, sizeof(_M_narrow));
2895 +  }
2896 +
2897 +  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
2898 +  : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()), 
2899 +  _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
2900 +  {
2901 +    _M_toupper = __C_ctype_toupper;
2902 +    _M_tolower = __C_ctype_tolower;
2903 +    _M_table = __table ? __table : __C_ctype_b;
2904 +    memset(_M_widen, 0, sizeof(_M_widen));
2905 +    memset(_M_narrow, 0, sizeof(_M_narrow));
2906 +  }
2907 +
2908 +  char
2909 +  ctype<char>::do_toupper(char __c) const
2910 +  { return _M_toupper[static_cast<unsigned char>(__c)]; }
2911 +
2912 +  const char*
2913 +  ctype<char>::do_toupper(char* __low, const char* __high) const
2914 +  {
2915 +    while (__low < __high)
2916 +      {
2917 +       *__low = _M_toupper[static_cast<unsigned char>(*__low)];
2918 +       ++__low;
2919 +      }
2920 +    return __high;
2921 +  }
2922 +
2923 +  char
2924 +  ctype<char>::do_tolower(char __c) const
2925 +  { return _M_tolower[static_cast<unsigned char>(__c)]; }
2926 +
2927 +  const char* 
2928 +  ctype<char>::do_tolower(char* __low, const char* __high) const
2929 +  {
2930 +    while (__low < __high)
2931 +      {
2932 +       *__low = _M_tolower[static_cast<unsigned char>(*__low)];
2933 +       ++__low;
2934 +      }
2935 +    return __high;
2936 +  }
2937 diff -urN gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/os_defines.h gcc-3.4.1/libstdc++-v3/config/os/uclibc/os_defines.h
2938 --- gcc-3.4.1-dist/libstdc++-v3/config/os/uclibc/os_defines.h   1969-12-31 18:00:00.000000000 -0600
2939 +++ gcc-3.4.1/libstdc++-v3/config/os/uclibc/os_defines.h        2004-08-12 15:54:48.000000000 -0500
2940 @@ -0,0 +1,44 @@
2941 +// Specific definitions for GNU/Linux  -*- C++ -*-
2942 +
2943 +// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2944 +//
2945 +// This file is part of the GNU ISO C++ Library.  This library is free
2946 +// software; you can redistribute it and/or modify it under the
2947 +// terms of the GNU General Public License as published by the
2948 +// Free Software Foundation; either version 2, or (at your option)
2949 +// any later version.
2950 +
2951 +// This library is distributed in the hope that it will be useful,
2952 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
2953 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2954 +// GNU General Public License for more details.
2955 +
2956 +// You should have received a copy of the GNU General Public License along
2957 +// with this library; see the file COPYING.  If not, write to the Free
2958 +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2959 +// USA.
2960 +
2961 +// As a special exception, you may use this file as part of a free software
2962 +// library without restriction.  Specifically, if other files instantiate
2963 +// templates or use macros or inline functions from this file, or you compile
2964 +// this file and link it with other files to produce an executable, this
2965 +// file does not by itself cause the resulting executable to be covered by
2966 +// the GNU General Public License.  This exception does not however
2967 +// invalidate any other reasons why the executable file might be covered by
2968 +// the GNU General Public License.
2969 +
2970 +#ifndef _GLIBCXX_OS_DEFINES
2971 +#define _GLIBCXX_OS_DEFINES 1
2972 +
2973 +// System-specific #define, typedefs, corrections, etc, go here.  This
2974 +// file will come before all others.
2975 +
2976 +// This keeps isanum, et al from being propagated as macros.
2977 +#define __NO_CTYPE 1
2978 +
2979 +#include <features.h>
2980 +
2981 +// We must not see the optimized string functions GNU libc defines.
2982 +#define __NO_STRING_INLINES
2983 +
2984 +#endif
2985 diff -urN gcc-3.4.1-dist/libstdc++-v3/configure gcc-3.4.1/libstdc++-v3/configure
2986 --- gcc-3.4.1-dist/libstdc++-v3/configure       2004-06-25 17:02:47.000000000 -0500
2987 +++ gcc-3.4.1/libstdc++-v3/configure    2004-08-12 16:20:43.000000000 -0500
2988 @@ -3878,6 +3878,11 @@
2989    lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
2990    ;;
2991  
2992 +linux-uclibc*)
2993 +  lt_cv_deplibs_check_method=pass_all
2994 +  lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
2995 +  ;;
2996 +
2997  netbsd*)
2998    if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
2999      lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
3000 @@ -5545,6 +5550,9 @@
3001    # Default to "generic".
3002    if test $enable_clocale_flag = auto; then
3003      case x${target_os} in
3004 +      xlinux-uclibc*)
3005 +       enable_clocale_flag=uclibc
3006 +       ;;
3007        xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
3008          cat >conftest.$ac_ext <<_ACEOF
3009  #line $LINENO "configure"
3010 @@ -5759,6 +5767,77 @@
3011        CTIME_CC=config/locale/generic/time_members.cc
3012        CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3013        ;;
3014 +    uclibc)
3015 +      echo "$as_me:$LINENO: result: uclibc" >&5
3016 +echo "${ECHO_T}uclibc" >&6
3017 +
3018 +      # Declare intention to use gettext, and add support for specific
3019 +      # languages.
3020 +      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3021 +      ALL_LINGUAS="de fr"
3022 +
3023 +      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3024 +      # Extract the first word of "msgfmt", so it can be a program name with args.
3025 +set dummy msgfmt; ac_word=$2
3026 +echo "$as_me:$LINENO: checking for $ac_word" >&5
3027 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3028 +if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3029 +  echo $ECHO_N "(cached) $ECHO_C" >&6
3030 +else
3031 +  if test -n "$check_msgfmt"; then
3032 +  ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3033 +else
3034 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3035 +for as_dir in $PATH
3036 +do
3037 +  IFS=$as_save_IFS
3038 +  test -z "$as_dir" && as_dir=.
3039 +  for ac_exec_ext in '' $ac_executable_extensions; do
3040 +  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3041 +    ac_cv_prog_check_msgfmt="yes"
3042 +    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3043 +    break 2
3044 +  fi
3045 +done
3046 +done
3047 +
3048 +  test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3049 +fi
3050 +fi
3051 +check_msgfmt=$ac_cv_prog_check_msgfmt
3052 +if test -n "$check_msgfmt"; then
3053 +  echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3054 +echo "${ECHO_T}$check_msgfmt" >&6
3055 +else
3056 +  echo "$as_me:$LINENO: result: no" >&5
3057 +echo "${ECHO_T}no" >&6
3058 +fi
3059 +
3060 +      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3061 +        USE_NLS=yes
3062 +      fi
3063 +      # Export the build objects.
3064 +      for ling in $ALL_LINGUAS; do \
3065 +        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3066 +        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3067 +      done
3068 +
3069 +
3070 +
3071 +      CLOCALE_H=config/locale/uclibc/c_locale.h
3072 +      CLOCALE_CC=config/locale/uclibc/c_locale.cc
3073 +      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
3074 +      CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3075 +      CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3076 +      CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3077 +      CMESSAGES_H=config/locale/uclibc/messages_members.h
3078 +      CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3079 +      CMONEY_CC=config/locale/uclibc/monetary_members.cc
3080 +      CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3081 +      CTIME_H=config/locale/uclibc/time_members.h
3082 +      CTIME_CC=config/locale/uclibc/time_members.cc
3083 +      CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3084 +      ;;
3085    esac
3086  
3087    # This is where the testsuite looks for locale catalogs, using the
3088 diff -urN gcc-3.4.1-dist/libstdc++-v3/configure.host gcc-3.4.1/libstdc++-v3/configure.host
3089 --- gcc-3.4.1-dist/libstdc++-v3/configure.host  2004-03-18 11:36:12.000000000 -0600
3090 +++ gcc-3.4.1/libstdc++-v3/configure.host       2004-08-12 15:54:48.000000000 -0500
3091 @@ -217,6 +217,12 @@
3092      ;;
3093  esac
3094  
3095 +# Override for uClibc since linux-uclibc gets mishandled above.
3096 +case "${host_os}" in
3097 +  *-uclibc*)
3098 +    os_include_dir="os/uclibc"
3099 +    ;;
3100 +esac
3101  
3102  # Set any OS-dependent and CPU-dependent bits.
3103  # THIS TABLE IS SORTED.  KEEP IT THAT WAY.
3104 diff -urN gcc-3.4.1-dist/libstdc++-v3/crossconfig.m4 gcc-3.4.1/libstdc++-v3/crossconfig.m4
3105 --- gcc-3.4.1-dist/libstdc++-v3/crossconfig.m4  2004-06-10 12:12:14.000000000 -0500
3106 +++ gcc-3.4.1/libstdc++-v3/crossconfig.m4       2004-08-12 15:54:48.000000000 -0500
3107 @@ -122,6 +122,99 @@
3108         ;;
3109      esac
3110      ;;
3111 +  *-uclibc*)
3112 +# Temporary hack until we implement the float versions of the libm funcs
3113 +    AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3114 +      machine/endian.h machine/param.h sys/machine.h sys/types.h \
3115 +      fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3116 +    SECTION_FLAGS='-ffunction-sections -fdata-sections'
3117 +    AC_SUBST(SECTION_FLAGS)
3118 +    GLIBCXX_CHECK_LINKER_FEATURES
3119 +    GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3120 +    GLIBCXX_CHECK_WCHAR_T_SUPPORT
3121 +
3122 +    # For LFS.
3123 +    AC_DEFINE(HAVE_INT64_T)
3124 +    case "$target" in
3125 +      *-uclinux*)
3126 +        # Don't enable LFS with uClinux
3127 +        ;;
3128 +      *)
3129 +        AC_DEFINE(_GLIBCXX_USE_LFS)
3130 +    esac
3131 +
3132 +    # For showmanyc_helper().
3133 +    AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3134 +    GLIBCXX_CHECK_POLL
3135 +    GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3136 +
3137 +    # For xsputn_2().
3138 +    AC_CHECK_HEADERS(sys/uio.h)
3139 +    GLIBCXX_CHECK_WRITEV
3140 +
3141 +#     AC_DEFINE(HAVE_ACOSF)
3142 +#     AC_DEFINE(HAVE_ASINF)
3143 +#     AC_DEFINE(HAVE_ATANF)
3144 +#     AC_DEFINE(HAVE_ATAN2F)
3145 +    AC_DEFINE(HAVE_CEILF)
3146 +    AC_DEFINE(HAVE_COPYSIGN)
3147 +#     AC_DEFINE(HAVE_COPYSIGNF)
3148 +#     AC_DEFINE(HAVE_COSF)
3149 +#     AC_DEFINE(HAVE_COSHF)
3150 +#     AC_DEFINE(HAVE_EXPF)
3151 +#     AC_DEFINE(HAVE_FABSF)
3152 +    AC_DEFINE(HAVE_FINITE)
3153 +    AC_DEFINE(HAVE_FINITEF)
3154 +    AC_DEFINE(HAVE_FLOORF)
3155 +#     AC_DEFINE(HAVE_FMODF)
3156 +#     AC_DEFINE(HAVE_FREXPF)
3157 +    AC_DEFINE(HAVE_HYPOT)
3158 +#     AC_DEFINE(HAVE_HYPOTF)
3159 +    AC_DEFINE(HAVE_ISINF)
3160 +    AC_DEFINE(HAVE_ISINFF)
3161 +    AC_DEFINE(HAVE_ISNAN)
3162 +    AC_DEFINE(HAVE_ISNANF)
3163 +#     AC_DEFINE(HAVE_LOGF)
3164 +#     AC_DEFINE(HAVE_LOG10F)
3165 +#     AC_DEFINE(HAVE_MODFF)
3166 +#     AC_DEFINE(HAVE_SINF)
3167 +#     AC_DEFINE(HAVE_SINHF)
3168 +#     AC_DEFINE(HAVE_SINCOS)
3169 +#     AC_DEFINE(HAVE_SINCOSF)
3170 +    AC_DEFINE(HAVE_SQRTF)
3171 +#     AC_DEFINE(HAVE_TANF)
3172 +#     AC_DEFINE(HAVE_TANHF)
3173 +    if test x"long_double_math_on_this_cpu" = x"yes"; then
3174 +      AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
3175 +#       AC_DEFINE(HAVE_ACOSL)
3176 +#       AC_DEFINE(HAVE_ASINL)
3177 +#       AC_DEFINE(HAVE_ATANL)
3178 +#       AC_DEFINE(HAVE_ATAN2L)
3179 +#       AC_DEFINE(HAVE_CEILL)
3180 +#       AC_DEFINE(HAVE_COPYSIGNL)
3181 +#       AC_DEFINE(HAVE_COSL)
3182 +#       AC_DEFINE(HAVE_COSHL)
3183 +#       AC_DEFINE(HAVE_EXPL)
3184 +#       AC_DEFINE(HAVE_FABSL)
3185 +#       AC_DEFINE(HAVE_FINITEL)
3186 +#       AC_DEFINE(HAVE_FLOORL)
3187 +#       AC_DEFINE(HAVE_FMODL)
3188 +#       AC_DEFINE(HAVE_FREXPL)
3189 +#       AC_DEFINE(HAVE_HYPOTL)
3190 +#       AC_DEFINE(HAVE_ISINFL)
3191 +#       AC_DEFINE(HAVE_ISNANL)
3192 +#       AC_DEFINE(HAVE_LOGL)
3193 +#       AC_DEFINE(HAVE_LOG10L)
3194 +#       AC_DEFINE(HAVE_MODFL)
3195 +#       AC_DEFINE(HAVE_POWL)
3196 +#       AC_DEFINE(HAVE_SINL)
3197 +#       AC_DEFINE(HAVE_SINHL)
3198 +#       AC_DEFINE(HAVE_SINCOSL)
3199 +#       AC_DEFINE(HAVE_SQRTL)
3200 +#       AC_DEFINE(HAVE_TANL)
3201 +#       AC_DEFINE(HAVE_TANHL)
3202 +    fi
3203 +    ;;
3204    *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3205      AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3206        machine/endian.h machine/param.h sys/machine.h sys/types.h \
3207 @@ -136,7 +229,7 @@
3208      AC_DEFINE(HAVE_INT64_T)
3209      case "$target" in
3210        *-uclinux*)
3211 -        # Don't enable LFS with uClibc
3212 +        # Don't enable LFS with uClinux
3213          ;;
3214        *)
3215          AC_DEFINE(_GLIBCXX_USE_LFS)
3216 diff -urN gcc-3.4.1-dist/libstdc++-v3/include/c_compatibility/wchar.h gcc-3.4.1/libstdc++-v3/include/c_compatibility/wchar.h
3217 --- gcc-3.4.1-dist/libstdc++-v3/include/c_compatibility/wchar.h 2003-12-08 21:51:45.000000000 -0600
3218 +++ gcc-3.4.1/libstdc++-v3/include/c_compatibility/wchar.h      2004-08-12 16:14:07.000000000 -0500
3219 @@ -101,7 +101,9 @@
3220  using std::wmemcpy;
3221  using std::wmemmove;
3222  using std::wmemset;
3223 +#if _GLIBCXX_HAVE_WCSFTIME
3224  using std::wcsftime;
3225 +#endif
3226  
3227  #if _GLIBCXX_USE_C99
3228  using std::wcstold;
3229 diff -urN gcc-3.4.1-dist/libstdc++-v3/include/c_std/std_cwchar.h gcc-3.4.1/libstdc++-v3/include/c_std/std_cwchar.h
3230 --- gcc-3.4.1-dist/libstdc++-v3/include/c_std/std_cwchar.h      2003-12-08 21:44:35.000000000 -0600
3231 +++ gcc-3.4.1/libstdc++-v3/include/c_std/std_cwchar.h   2004-08-12 15:54:48.000000000 -0500
3232 @@ -179,7 +179,9 @@
3233    using ::wcscoll;
3234    using ::wcscpy;
3235    using ::wcscspn;
3236 +#if _GLIBCXX_HAVE_WCSFTIME
3237    using ::wcsftime;
3238 +#endif
3239    using ::wcslen;
3240    using ::wcsncat;
3241    using ::wcsncmp;