source: clfs-embedded/patches/gcc-4.1.2-uclibc-1.patch@ 9642843

Last change on this file since 9642843 was 0602db2, checked in by Jim Gifford <clfs@…>, 18 years ago

Updated to GCC 4.1.2

  • Property mode set to 100644
File size: 138.4 KB
RevLine 
[841271e]1Submitted By: Jim Gifford (patches at jg555 dot com)
[0602db2]2Date: 2007-02-13
[841271e]3Initial Package Version: 4.1.1
4Origin: uClibc and Buildroot
5Upstream Status: uClibc Specific
6Description: Makes GCC uClibc Friendly
7
[0602db2]8diff -Naur gcc-4.1.2.orig/boehm-gc/configure gcc-4.1.2/boehm-gc/configure
9--- gcc-4.1.2.orig/boehm-gc/configure 2007-02-13 21:17:22.000000000 -0800
10+++ gcc-4.1.2/boehm-gc/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]11@@ -4320,6 +4320,11 @@
12 lt_cv_deplibs_check_method=pass_all
13 ;;
14
15+linux-uclibc*)
16+ lt_cv_deplibs_check_method=pass_all
17+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
18+ ;;
19+
20 netbsd* | knetbsd*-gnu)
21 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
22 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]23diff -Naur gcc-4.1.2.orig/boehm-gc/include/gc.h gcc-4.1.2/boehm-gc/include/gc.h
24--- gcc-4.1.2.orig/boehm-gc/include/gc.h 2005-01-01 19:35:57.000000000 -0800
25+++ gcc-4.1.2/boehm-gc/include/gc.h 2007-02-14 07:57:37.000000000 -0800
[841271e]26@@ -500,7 +500,7 @@
27 #ifdef __linux__
28 # include <features.h>
29 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
30- && !defined(__ia64__)
31+ && !defined(__ia64__) && !defined(__UCLIBC__)
32 # ifndef GC_HAVE_BUILTIN_BACKTRACE
33 # define GC_HAVE_BUILTIN_BACKTRACE
34 # endif
[0602db2]35diff -Naur gcc-4.1.2.orig/configure gcc-4.1.2/configure
36--- gcc-4.1.2.orig/configure 2006-11-21 09:48:36.000000000 -0800
37+++ gcc-4.1.2/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]38@@ -1133,7 +1133,7 @@
39 ;;
40 "")
41 case "${target}" in
42- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
43+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
44 # Enable libmudflap by default in GNU and friends.
45 ;;
46 *-*-freebsd*)
[0602db2]47diff -Naur gcc-4.1.2.orig/configure.in gcc-4.1.2/configure.in
48--- gcc-4.1.2.orig/configure.in 2006-11-21 09:48:36.000000000 -0800
49+++ gcc-4.1.2/configure.in 2007-02-14 07:57:37.000000000 -0800
[841271e]50@@ -341,7 +341,7 @@
51 ;;
52 "")
53 case "${target}" in
54- *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu)
55+ *-*-linux*-gnu | *-*-gnu* | *-*-k*bsd*-gnu | *-*-linux-uclibc*)
56 # Enable libmudflap by default in GNU and friends.
57 ;;
58 *-*-freebsd*)
[0602db2]59diff -Naur gcc-4.1.2.orig/contrib/regression/objs-gcc.sh gcc-4.1.2/contrib/regression/objs-gcc.sh
60--- gcc-4.1.2.orig/contrib/regression/objs-gcc.sh 2005-08-14 17:41:31.000000000 -0700
61+++ gcc-4.1.2/contrib/regression/objs-gcc.sh 2007-02-14 07:57:37.000000000 -0800
[841271e]62@@ -105,6 +105,10 @@
63 then
64 make all-gdb all-dejagnu all-ld || exit 1
65 make install-gdb install-dejagnu install-ld || exit 1
66+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
67+ then
68+ make all-gdb all-dejagnu all-ld || exit 1
69+ make install-gdb install-dejagnu install-ld || exit 1
70 elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
71 make bootstrap || exit 1
72 make install || exit 1
[0602db2]73diff -Naur gcc-4.1.2.orig/gcc/config/alpha/linux-elf.h gcc-4.1.2/gcc/config/alpha/linux-elf.h
74--- gcc-4.1.2.orig/gcc/config/alpha/linux-elf.h 2005-06-24 18:22:41.000000000 -0700
75+++ gcc-4.1.2/gcc/config/alpha/linux-elf.h 2007-02-14 07:57:37.000000000 -0800
[841271e]76@@ -27,7 +27,11 @@
77 #define SUBTARGET_EXTRA_SPECS \
78 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
79
80+#if defined USE_UCLIBC
81+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
82+#else
83 #define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
84+#endif
85
86 #define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
87 %{O*:-O3} %{!O*:-O1} \
[0602db2]88diff -Naur gcc-4.1.2.orig/gcc/config/arm/linux-eabi.h gcc-4.1.2/gcc/config/arm/linux-eabi.h
89--- gcc-4.1.2.orig/gcc/config/arm/linux-eabi.h 2005-11-15 06:32:13.000000000 -0800
90+++ gcc-4.1.2/gcc/config/arm/linux-eabi.h 2007-02-14 07:57:37.000000000 -0800
[841271e]91@@ -53,7 +53,11 @@
92 /* Use ld-linux.so.3 so that it will be possible to run "classic"
93 GNU/Linux binaries on an EABI system. */
94 #undef LINUX_TARGET_INTERPRETER
95+#ifdef USE_UCLIBC
96+#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
97+#else
98 #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.3"
99+#endif
100
101 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
102 use the GNU/Linux version, not the generic BPABI version. */
[0602db2]103diff -Naur gcc-4.1.2.orig/gcc/config/arm/linux-elf.h gcc-4.1.2/gcc/config/arm/linux-elf.h
104--- gcc-4.1.2.orig/gcc/config/arm/linux-elf.h 2005-10-09 18:04:31.000000000 -0700
105+++ gcc-4.1.2/gcc/config/arm/linux-elf.h 2007-02-14 07:57:37.000000000 -0800
[841271e]106@@ -28,19 +28,33 @@
107 #undef TARGET_VERSION
108 #define TARGET_VERSION fputs (" (ARM GNU/Linux with ELF)", stderr);
109
110+/*
111+ * 'config.gcc' defines TARGET_BIG_ENDIAN_DEFAULT as 1 for arm*b-*
112+ * (big endian) configurations.
113+ */
114+#if TARGET_BIG_ENDIAN_DEFAULT
115+#define TARGET_ENDIAN_DEFAULT MASK_BIG_END
116+#define TARGET_ENDIAN_OPTION "mbig-endian"
117+#define TARGET_LINKER_EMULATION "armelfb_linux"
118+#else
119+#define TARGET_ENDIAN_DEFAULT 0
120+#define TARGET_ENDIAN_OPTION "mlittle-endian"
121+#define TARGET_LINKER_EMULATION "armelf_linux"
122+#endif
123+
124 #undef TARGET_DEFAULT_FLOAT_ABI
125 #define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
126
127 #undef TARGET_DEFAULT
128-#define TARGET_DEFAULT (0)
129+#define TARGET_DEFAULT (TARGET_ENDIAN_DEFAULT)
130
131 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
132
133-#define SUBTARGET_EXTRA_LINK_SPEC " -m armelf_linux -p"
134+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
135
136 #undef MULTILIB_DEFAULTS
137 #define MULTILIB_DEFAULTS \
138- { "marm", "mlittle-endian", "mhard-float", "mno-thumb-interwork" }
139+ { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mno-thumb-interwork" }
140
141 /* Now we define the strings used to build the spec file. */
142 #undef LIB_SPEC
143@@ -51,7 +65,11 @@
144
145 #define LIBGCC_SPEC "%{msoft-float:-lfloat} %{mfloat-abi=soft*:-lfloat} -lgcc"
146
147+#ifdef USE_UCLIBC
148+#define LINUX_TARGET_INTERPRETER "/lib/ld-uClibc.so.0"
149+#else
150 #define LINUX_TARGET_INTERPRETER "/lib/ld-linux.so.2"
151+#endif
152
153 #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v} \
154 %{b} \
155@@ -61,7 +79,7 @@
156 %{rdynamic:-export-dynamic} \
157 %{!dynamic-linker:-dynamic-linker " LINUX_TARGET_INTERPRETER "} \
158 -X \
159- %{mbig-endian:-EB}" \
160+ %{mbig-endian:-EB} %{mlittle-endian:-EL}" \
161 SUBTARGET_EXTRA_LINK_SPEC
162
163 #undef LINK_SPEC
[0602db2]164diff -Naur gcc-4.1.2.orig/gcc/config/cris/linux.h gcc-4.1.2/gcc/config/cris/linux.h
165--- gcc-4.1.2.orig/gcc/config/cris/linux.h 2005-06-24 18:22:41.000000000 -0700
166+++ gcc-4.1.2/gcc/config/cris/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]167@@ -73,6 +73,25 @@
168 #undef CRIS_DEFAULT_CPU_VERSION
169 #define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_NG
170
171+#ifdef USE_UCLIBC
172+
173+#undef CRIS_SUBTARGET_VERSION
174+#define CRIS_SUBTARGET_VERSION " - cris-axis-linux-uclibc"
175+
176+#undef CRIS_LINK_SUBTARGET_SPEC
177+#define CRIS_LINK_SUBTARGET_SPEC \
178+ "-mcrislinux\
179+ -rpath-link include/asm/../..%s\
180+ %{shared} %{static}\
181+ %{symbolic:-Bdynamic} %{shlib:-Bdynamic} %{static:-Bstatic}\
182+ %{!shared: \
183+ %{!static: \
184+ %{rdynamic:-export-dynamic} \
185+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}} \
186+ %{!r:%{O2|O3: --gc-sections}}"
187+
188+#else /* USE_UCLIBC */
189+
190 #undef CRIS_SUBTARGET_VERSION
191 #define CRIS_SUBTARGET_VERSION " - cris-axis-linux-gnu"
192
193@@ -87,6 +106,8 @@
194 %{!shared:%{!static:%{rdynamic:-export-dynamic}}}\
195 %{!r:%{O2|O3: --gc-sections}}"
196
197+#endif /* USE_UCLIBC */
198+
199
200 /* Node: Run-time Target */
201
[0602db2]202diff -Naur gcc-4.1.2.orig/gcc/config/i386/linux.h gcc-4.1.2/gcc/config/i386/linux.h
203--- gcc-4.1.2.orig/gcc/config/i386/linux.h 2005-08-10 10:53:01.000000000 -0700
204+++ gcc-4.1.2/gcc/config/i386/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]205@@ -107,6 +107,11 @@
206 #define LINK_EMULATION "elf_i386"
207 #define DYNAMIC_LINKER "/lib/ld-linux.so.2"
208
209+#if defined USE_UCLIBC
210+#undef DYNAMIC_LINKER
211+#define DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
212+#endif
213+
214 #undef SUBTARGET_EXTRA_SPECS
215 #define SUBTARGET_EXTRA_SPECS \
216 { "link_emulation", LINK_EMULATION },\
[0602db2]217diff -Naur gcc-4.1.2.orig/gcc/config/i386/linux64.h gcc-4.1.2/gcc/config/i386/linux64.h
218--- gcc-4.1.2.orig/gcc/config/i386/linux64.h 2005-08-10 10:53:01.000000000 -0700
219+++ gcc-4.1.2/gcc/config/i386/linux64.h 2007-02-14 07:57:37.000000000 -0800
[841271e]220@@ -54,14 +54,21 @@
221 When the -shared link option is used a final link is not being
222 done. */
223
224+#ifdef USE_UCLIBC
225+#define ELF32_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
226+#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
227+#else
228+#define ELF32_DYNAMIC_LINKER "/lib/ld-linux.so.2"
229+#define ELF64_DYNAMIC_LINKER "/lib64/ld-linux-x86-64.so.2"
230+#endif
231 #undef LINK_SPEC
232 #define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
233 %{shared:-shared} \
234 %{!shared: \
235 %{!static: \
236 %{rdynamic:-export-dynamic} \
237- %{m32:%{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
238- %{!m32:%{!dynamic-linker:-dynamic-linker /lib64/ld-linux-x86-64.so.2}}} \
239+ %{m32:%{!dynamic-linker:-dynamic-linker " ELF32_DYNAMIC_LINKER "}} \
240+ %{!m32:%{!dynamic-linker:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}} \
241 %{static:-static}}"
242
243 /* Similar to standard Linux, but adding -ffast-math support. */
[0602db2]244diff -Naur gcc-4.1.2.orig/gcc/config/ia64/linux.h gcc-4.1.2/gcc/config/ia64/linux.h
245--- gcc-4.1.2.orig/gcc/config/ia64/linux.h 2006-12-12 07:24:07.000000000 -0800
246+++ gcc-4.1.2/gcc/config/ia64/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]247@@ -37,13 +37,18 @@
248 /* Define this for shared library support because it isn't in the main
249 linux.h file. */
250
251+#ifdef USE_UCLIBC
252+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
253+#else
254+#define ELF_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
255+#endif
256 #undef LINK_SPEC
257 #define LINK_SPEC "\
258 %{shared:-shared} \
259 %{!shared: \
260 %{!static: \
261 %{rdynamic:-export-dynamic} \
262- %{!dynamic-linker:-dynamic-linker /lib/ld-linux-ia64.so.2}} \
263+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
264 %{static:-static}}"
265
[0602db2]266 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
267diff -Naur gcc-4.1.2.orig/gcc/config/m68k/linux.h gcc-4.1.2/gcc/config/m68k/linux.h
268--- gcc-4.1.2.orig/gcc/config/m68k/linux.h 2005-06-24 18:22:41.000000000 -0700
269+++ gcc-4.1.2/gcc/config/m68k/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]270@@ -123,12 +123,17 @@
271
272 /* If ELF is the default format, we should not use /lib/elf. */
273
274+#ifdef USE_UCLIBC
275+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
276+#else
277+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
278+#endif
279 #undef LINK_SPEC
280 #define LINK_SPEC "-m m68kelf %{shared} \
281 %{!shared: \
282 %{!static: \
283 %{rdynamic:-export-dynamic} \
284- %{!dynamic-linker*:-dynamic-linker /lib/ld.so.1}} \
285+ %{!dynamic-linker*:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
286 %{static}}"
287
288 /* For compatibility with linux/a.out */
[0602db2]289diff -Naur gcc-4.1.2.orig/gcc/config/mips/linux.h gcc-4.1.2/gcc/config/mips/linux.h
290--- gcc-4.1.2.orig/gcc/config/mips/linux.h 2006-12-17 05:57:31.000000000 -0800
291+++ gcc-4.1.2/gcc/config/mips/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]292@@ -105,6 +105,11 @@
293
294 /* Borrowed from sparc/linux.h */
295 #undef LINK_SPEC
296+#ifdef USE_UCLIBC
297+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
298+#else
299+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
300+#endif
301 #define LINK_SPEC \
302 "%(endian_spec) \
303 %{shared:-shared} \
304@@ -112,7 +117,7 @@
305 %{!ibcs: \
306 %{!static: \
307 %{rdynamic:-export-dynamic} \
308- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
309+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
310 %{static:-static}}}"
311
312 #undef SUBTARGET_ASM_SPEC
[0602db2]313diff -Naur gcc-4.1.2.orig/gcc/config/pa/pa-linux.h gcc-4.1.2/gcc/config/pa/pa-linux.h
314--- gcc-4.1.2.orig/gcc/config/pa/pa-linux.h 2007-01-11 18:23:38.000000000 -0800
315+++ gcc-4.1.2/gcc/config/pa/pa-linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]316@@ -49,13 +49,18 @@
317 /* Define this for shared library support because it isn't in the main
318 linux.h file. */
319
320+#ifdef USE_UCLIBC
321+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
322+#else
323+#define ELF_DYNAMIC_LINKER "/lib/ld.so.1"
324+#endif
325 #undef LINK_SPEC
326 #define LINK_SPEC "\
327 %{shared:-shared} \
328 %{!shared: \
329 %{!static: \
330 %{rdynamic:-export-dynamic} \
331- %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
332+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
333 %{static:-static}}"
334
335 /* glibc's profiling functions don't need gcc to allocate counters. */
[0602db2]336diff -Naur gcc-4.1.2.orig/gcc/config/rs6000/linux.h gcc-4.1.2/gcc/config/rs6000/linux.h
337--- gcc-4.1.2.orig/gcc/config/rs6000/linux.h 2006-02-10 12:58:33.000000000 -0800
338+++ gcc-4.1.2/gcc/config/rs6000/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]339@@ -72,7 +72,11 @@
340 #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
341
342 #undef LINK_OS_DEFAULT_SPEC
343+#ifdef USE_UCLIBC
344+#define LINK_OS_DEFAULT_SPEC "%(link_os_linux_uclibc)"
345+#else
346 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
347+#endif
348
349 #define LINK_GCC_C_SEQUENCE_SPEC \
350 "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}"
[0602db2]351diff -Naur gcc-4.1.2.orig/gcc/config/rs6000/sysv4.h gcc-4.1.2/gcc/config/rs6000/sysv4.h
352--- gcc-4.1.2.orig/gcc/config/rs6000/sysv4.h 2006-02-10 12:58:33.000000000 -0800
353+++ gcc-4.1.2/gcc/config/rs6000/sysv4.h 2007-02-14 07:57:37.000000000 -0800
[841271e]354@@ -866,6 +866,7 @@
355 mcall-linux : %(link_os_linux) ; \
356 mcall-gnu : %(link_os_gnu) ; \
357 mcall-netbsd : %(link_os_netbsd) ; \
358+ mcall-linux-uclibc : %(link_os_linux_uclibc); \
359 mcall-openbsd: %(link_os_openbsd) ; \
360 : %(link_os_default) }"
361
362@@ -1043,6 +1044,10 @@
363 %{rdynamic:-export-dynamic} \
364 %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}"
365
366+#define LINK_OS_LINUX_UCLIBC_SPEC "-m elf32ppclinux %{!shared: %{!static: \
367+ %{rdynamic:-export-dynamic} \
368+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}}}"
369+
370 #if defined(HAVE_LD_EH_FRAME_HDR)
371 # define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
372 #endif
373@@ -1209,6 +1214,7 @@
374 { "link_os_sim", LINK_OS_SIM_SPEC }, \
375 { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
376 { "link_os_linux", LINK_OS_LINUX_SPEC }, \
377+ { "link_os_linux_uclibc", LINK_OS_LINUX_UCLIBC_SPEC }, \
378 { "link_os_gnu", LINK_OS_GNU_SPEC }, \
379 { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
380 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
[0602db2]381diff -Naur gcc-4.1.2.orig/gcc/config/s390/linux.h gcc-4.1.2/gcc/config/s390/linux.h
382--- gcc-4.1.2.orig/gcc/config/s390/linux.h 2006-12-12 07:24:07.000000000 -0800
383+++ gcc-4.1.2/gcc/config/s390/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]384@@ -77,6 +77,13 @@
385 #define MULTILIB_DEFAULTS { "m31" }
386 #endif
387
388+#ifdef USE_UCLIBC
389+#define ELF31_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
390+#define ELF64_DYNAMIC_LINKER "/lib/ld64-uClibc.so.0"
391+#else
392+#define ELF31_DYNAMIC_LINKER "/lib/ld.so.1"
393+#define ELF64_DYNAMIC_LINKER "/lib/ld64.so.1"
394+#endif
395 #undef LINK_SPEC
396 #define LINK_SPEC \
397 "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
398@@ -86,8 +93,8 @@
399 %{!static: \
400 %{rdynamic:-export-dynamic} \
401 %{!dynamic-linker: \
402- %{m31:-dynamic-linker /lib/ld.so.1} \
403- %{m64:-dynamic-linker /lib/ld64.so.1}}}}"
404+ %{m31:-dynamic-linker " ELF31_DYNAMIC_LINKER "} \
405+ %{m64:-dynamic-linker " ELF64_DYNAMIC_LINKER "}}}}"
406
[0602db2]407 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
[841271e]408
[0602db2]409diff -Naur gcc-4.1.2.orig/gcc/config/sh/linux.h gcc-4.1.2/gcc/config/sh/linux.h
410--- gcc-4.1.2.orig/gcc/config/sh/linux.h 2005-06-24 18:22:41.000000000 -0700
411+++ gcc-4.1.2/gcc/config/sh/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]412@@ -56,12 +56,21 @@
413 #undef SUBTARGET_LINK_EMUL_SUFFIX
414 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
415 #undef SUBTARGET_LINK_SPEC
416+#ifdef USE_UCLIBC
417+#define SUBTARGET_LINK_SPEC \
418+ "%{shared:-shared} \
419+ %{!static: \
420+ %{rdynamic:-export-dynamic} \
421+ %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
422+ %{static:-static}"
423+#else
424 #define SUBTARGET_LINK_SPEC \
425 "%{shared:-shared} \
426 %{!static: \
427 %{rdynamic:-export-dynamic} \
428 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
429 %{static:-static}"
430+#endif
431
432 /* Output assembler code to STREAM to call the profiler. */
433
[0602db2]434diff -Naur gcc-4.1.2.orig/gcc/config/sparc/linux.h gcc-4.1.2/gcc/config/sparc/linux.h
435--- gcc-4.1.2.orig/gcc/config/sparc/linux.h 2006-02-11 00:38:51.000000000 -0800
436+++ gcc-4.1.2/gcc/config/sparc/linux.h 2007-02-14 07:57:37.000000000 -0800
[841271e]437@@ -125,6 +125,11 @@
438
439 /* If ELF is the default format, we should not use /lib/elf. */
440
441+#ifdef USE_UCLIBC
442+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
443+#else
444+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
445+#endif
446 #undef LINK_SPEC
447 #define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
448 %{!mno-relax:%{!r:-relax}} \
449@@ -132,7 +137,7 @@
450 %{!ibcs: \
451 %{!static: \
452 %{rdynamic:-export-dynamic} \
453- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
454+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
455 %{static:-static}}}"
456
457 /* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
[0602db2]458diff -Naur gcc-4.1.2.orig/gcc/config/sparc/linux64.h gcc-4.1.2/gcc/config/sparc/linux64.h
459--- gcc-4.1.2.orig/gcc/config/sparc/linux64.h 2006-02-11 00:38:51.000000000 -0800
460+++ gcc-4.1.2/gcc/config/sparc/linux64.h 2007-02-14 07:57:37.000000000 -0800
[841271e]461@@ -162,12 +162,17 @@
462 { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
463 { "link_arch", LINK_ARCH_SPEC },
464
465+#ifdef USE_UCLIBC
466+#define ELF_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
467+#else
468+#define ELF_DYNAMIC_LINKER "/lib/ld-linux.so.2"
469+#endif
470 #define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
471 %{!shared: \
472 %{!ibcs: \
473 %{!static: \
474 %{rdynamic:-export-dynamic} \
475- %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
476+ %{!dynamic-linker:-dynamic-linker " ELF_DYNAMIC_LINKER "}} \
477 %{static:-static}}} \
478 "
479
[0602db2]480diff -Naur gcc-4.1.2.orig/gcc/config/t-linux-uclibc gcc-4.1.2/gcc/config/t-linux-uclibc
481--- gcc-4.1.2.orig/gcc/config/t-linux-uclibc 1969-12-31 16:00:00.000000000 -0800
482+++ gcc-4.1.2/gcc/config/t-linux-uclibc 2007-02-14 07:57:37.000000000 -0800
[841271e]483@@ -0,0 +1,5 @@
484+# Remove glibc specific files added in t-linux
485+SHLIB_MAPFILES := $(filter-out $(srcdir)/config/libgcc-glibc.ver, $(SHLIB_MAPFILES))
486+
487+# Use unwind-dw2-fde instead of unwind-dw2-fde-glibc
488+LIB2ADDEH := $(subst unwind-dw2-fde-glibc.c,unwind-dw2-fde.c,$(LIB2ADDEH))
[0602db2]489diff -Naur gcc-4.1.2.orig/gcc/config.gcc gcc-4.1.2/gcc/config.gcc
490--- gcc-4.1.2.orig/gcc/config.gcc 2006-10-15 16:12:23.000000000 -0700
491+++ gcc-4.1.2/gcc/config.gcc 2007-02-14 07:57:37.000000000 -0800
[841271e]492@@ -672,9 +672,14 @@
493 ;;
494 arm*-*-linux*) # ARM GNU/Linux with ELF
495 tm_file="dbxelf.h elfos.h linux.h arm/elf.h arm/linux-gas.h arm/linux-elf.h"
496+ case $target in
497+ arm*b-*)
498+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
499+ ;;
500+ esac
501 tmake_file="${tmake_file} t-linux arm/t-arm"
502 case ${target} in
503- arm*-*-linux-gnueabi)
504+ arm*-*-linux-gnueabi | arm*-*-linux-uclibcgnueabi)
505 tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
506 tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
507 # The BPABI long long divmod functions return a 128-bit value in
508@@ -1884,7 +1889,7 @@
509 ;;
510 sh-*-elf* | sh[12346l]*-*-elf* | sh*-*-kaos* | \
511 sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
512- sh-*-linux* | sh[346lbe]*-*-linux* | \
513+ sh*-*-linux* | sh[346lbe]*-*-linux* | \
514 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
515 sh64-*-netbsd* | sh64l*-*-netbsd*)
516 tmake_file="${tmake_file} sh/t-sh sh/t-elf"
517@@ -2338,6 +2343,12 @@
518 ;;
519 esac
520
521+# Rather than hook into each target, just do it after all the linux
522+# targets have been processed
523+case ${target} in
524+*-linux-uclibc*) tm_defines="${tm_defines} USE_UCLIBC" ; tmake_file="${tmake_file} t-linux-uclibc"
525+esac
526+
527 case ${target} in
528 i[34567]86-*-linux*aout* | i[34567]86-*-linux*libc1)
529 tmake_file="${tmake_file} i386/t-gmm_malloc"
[0602db2]530diff -Naur gcc-4.1.2.orig/gcc/configure gcc-4.1.2/gcc/configure
531--- gcc-4.1.2.orig/gcc/configure 2006-11-13 14:09:55.000000000 -0800
532+++ gcc-4.1.2/gcc/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]533@@ -14762,7 +14762,7 @@
534 tls_first_minor=14
535 tls_as_opt="-m64 -Aesame --fatal-warnings"
536 ;;
537- sh-*-* | sh[34]-*-*)
538+ sh-*-* | sh[34]*-*-*)
539 conftest_s='
540 .section ".tdata","awT",@progbits
541 foo: .long 25
[0602db2]542diff -Naur gcc-4.1.2.orig/gcc/configure.ac gcc-4.1.2/gcc/configure.ac
543--- gcc-4.1.2.orig/gcc/configure.ac 2006-11-13 14:09:55.000000000 -0800
544+++ gcc-4.1.2/gcc/configure.ac 2007-02-14 07:57:37.000000000 -0800
[841271e]545@@ -2435,7 +2435,7 @@
546 tls_first_minor=14
547 tls_as_opt="-m64 -Aesame --fatal-warnings"
548 ;;
549- sh-*-* | sh[34]-*-*)
550+ sh-*-* | sh[34]*-*-*)
551 conftest_s='
552 .section ".tdata","awT",@progbits
553 foo: .long 25
[0602db2]554diff -Naur gcc-4.1.2.orig/libffi/configure gcc-4.1.2/libffi/configure
555--- gcc-4.1.2.orig/libffi/configure 2007-02-13 21:17:22.000000000 -0800
556+++ gcc-4.1.2/libffi/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]557@@ -3457,6 +3457,11 @@
558 lt_cv_deplibs_check_method=pass_all
559 ;;
560
561+linux-uclibc*)
562+ lt_cv_deplibs_check_method=pass_all
563+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
564+ ;;
565+
566 netbsd* | knetbsd*-gnu)
567 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
568 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]569diff -Naur gcc-4.1.2.orig/libgfortran/configure gcc-4.1.2/libgfortran/configure
570--- gcc-4.1.2.orig/libgfortran/configure 2006-12-06 02:55:37.000000000 -0800
571+++ gcc-4.1.2/libgfortran/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]572@@ -3699,6 +3699,11 @@
573 lt_cv_deplibs_check_method=pass_all
574 ;;
575
576+linux-uclibc*)
577+ lt_cv_deplibs_check_method=pass_all
578+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
579+ ;;
580+
581 netbsd* | knetbsd*-gnu)
582 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
583 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]584diff -Naur gcc-4.1.2.orig/libjava/configure gcc-4.1.2/libjava/configure
585--- gcc-4.1.2.orig/libjava/configure 2007-02-13 21:17:22.000000000 -0800
586+++ gcc-4.1.2/libjava/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]587@@ -5137,6 +5137,11 @@
588 lt_cv_deplibs_check_method=pass_all
589 ;;
590
591+linux-uclibc*)
592+ lt_cv_deplibs_check_method=pass_all
593+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
594+ ;;
595+
596 netbsd* | knetbsd*-gnu)
597 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
598 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]599diff -Naur gcc-4.1.2.orig/libmudflap/configure gcc-4.1.2/libmudflap/configure
600--- gcc-4.1.2.orig/libmudflap/configure 2005-10-04 16:54:38.000000000 -0700
601+++ gcc-4.1.2/libmudflap/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]602@@ -5382,6 +5382,11 @@
603 lt_cv_deplibs_check_method=pass_all
604 ;;
605
606+linux-uclibc*)
607+ lt_cv_deplibs_check_method=pass_all
608+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
609+ ;;
610+
611 netbsd* | knetbsd*-gnu)
612 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
613 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]614diff -Naur gcc-4.1.2.orig/libobjc/configure gcc-4.1.2/libobjc/configure
615--- gcc-4.1.2.orig/libobjc/configure 2007-02-13 21:17:22.000000000 -0800
616+++ gcc-4.1.2/libobjc/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]617@@ -3312,6 +3312,11 @@
618 lt_cv_deplibs_check_method=pass_all
619 ;;
620
621+linux-uclibc*)
622+ lt_cv_deplibs_check_method=pass_all
623+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
624+ ;;
625+
626 netbsd* | knetbsd*-gnu)
627 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
628 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]629diff -Naur gcc-4.1.2.orig/libstdc++-v3/acinclude.m4 gcc-4.1.2/libstdc++-v3/acinclude.m4
630--- gcc-4.1.2.orig/libstdc++-v3/acinclude.m4 2007-01-29 02:51:01.000000000 -0800
631+++ gcc-4.1.2/libstdc++-v3/acinclude.m4 2007-02-14 07:57:37.000000000 -0800
632@@ -1003,7 +1003,7 @@
[841271e]633 AC_MSG_CHECKING([for C locale to use])
634 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
635 [use MODEL for target locale package],
636- [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
637+ [permit generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto])
638
639 # If they didn't use this option switch, or if they specified --enable
640 # with no specific model, we'll have to look for one. If they
[0602db2]641@@ -1019,6 +1019,9 @@
[841271e]642 # Default to "generic".
643 if test $enable_clocale_flag = auto; then
644 case ${target_os} in
645+ *-uclibc*)
646+ enable_clocale_flag=uclibc
647+ ;;
648 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
649 AC_EGREP_CPP([_GLIBCXX_ok], [
650 #include <features.h>
[0602db2]651@@ -1162,6 +1165,40 @@
[841271e]652 CTIME_CC=config/locale/generic/time_members.cc
653 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
654 ;;
655+ uclibc)
656+ AC_MSG_RESULT(uclibc)
657+
658+ # Declare intention to use gettext, and add support for specific
659+ # languages.
660+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
661+ ALL_LINGUAS="de fr"
662+
663+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
664+ AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
665+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
666+ USE_NLS=yes
667+ fi
668+ # Export the build objects.
669+ for ling in $ALL_LINGUAS; do \
670+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
671+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
672+ done
673+ AC_SUBST(glibcxx_MOFILES)
674+ AC_SUBST(glibcxx_POFILES)
675+
676+ CLOCALE_H=config/locale/uclibc/c_locale.h
677+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
678+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
679+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
680+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
681+ CMESSAGES_H=config/locale/uclibc/messages_members.h
682+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
683+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
684+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
685+ CTIME_H=config/locale/uclibc/time_members.h
686+ CTIME_CC=config/locale/uclibc/time_members.cc
687+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
688+ ;;
689 esac
690
691 # This is where the testsuite looks for locale catalogs, using the
[0602db2]692diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h
693--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 1969-12-31 16:00:00.000000000 -0800
694+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c++locale_internal.h 2007-02-14 07:57:37.000000000 -0800
[841271e]695@@ -0,0 +1,63 @@
696+// Prototypes for GLIBC thread locale __-prefixed functions -*- C++ -*-
697+
698+// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
699+//
700+// This file is part of the GNU ISO C++ Library. This library is free
701+// software; you can redistribute it and/or modify it under the
702+// terms of the GNU General Public License as published by the
703+// Free Software Foundation; either version 2, or (at your option)
704+// any later version.
705+
706+// This library is distributed in the hope that it will be useful,
707+// but WITHOUT ANY WARRANTY; without even the implied warranty of
708+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
709+// GNU General Public License for more details.
710+
711+// You should have received a copy of the GNU General Public License along
712+// with this library; see the file COPYING. If not, write to the Free
713+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
714+// USA.
715+
716+// As a special exception, you may use this file as part of a free software
717+// library without restriction. Specifically, if other files instantiate
718+// templates or use macros or inline functions from this file, or you compile
719+// this file and link it with other files to produce an executable, this
720+// file does not by itself cause the resulting executable to be covered by
721+// the GNU General Public License. This exception does not however
722+// invalidate any other reasons why the executable file might be covered by
723+// the GNU General Public License.
724+
725+// Written by Jakub Jelinek <jakub@redhat.com>
726+
727+#include <bits/c++config.h>
728+#include <clocale>
729+
730+#ifdef __UCLIBC_MJN3_ONLY__
731+#warning clean this up
732+#endif
733+
734+#ifdef __UCLIBC_HAS_XLOCALE__
735+
736+extern "C" __typeof(nl_langinfo_l) __nl_langinfo_l;
737+extern "C" __typeof(strcoll_l) __strcoll_l;
738+extern "C" __typeof(strftime_l) __strftime_l;
739+extern "C" __typeof(strtod_l) __strtod_l;
740+extern "C" __typeof(strtof_l) __strtof_l;
741+extern "C" __typeof(strtold_l) __strtold_l;
742+extern "C" __typeof(strxfrm_l) __strxfrm_l;
743+extern "C" __typeof(newlocale) __newlocale;
744+extern "C" __typeof(freelocale) __freelocale;
745+extern "C" __typeof(duplocale) __duplocale;
746+extern "C" __typeof(uselocale) __uselocale;
747+
748+#ifdef _GLIBCXX_USE_WCHAR_T
749+extern "C" __typeof(iswctype_l) __iswctype_l;
750+extern "C" __typeof(towlower_l) __towlower_l;
751+extern "C" __typeof(towupper_l) __towupper_l;
752+extern "C" __typeof(wcscoll_l) __wcscoll_l;
753+extern "C" __typeof(wcsftime_l) __wcsftime_l;
754+extern "C" __typeof(wcsxfrm_l) __wcsxfrm_l;
755+extern "C" __typeof(wctype_l) __wctype_l;
756+#endif
757+
758+#endif // GLIBC 2.3 and later
[0602db2]759diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.cc
760--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.cc 1969-12-31 16:00:00.000000000 -0800
761+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]762@@ -0,0 +1,152 @@
763+// Wrapper for underlying C-language localization -*- C++ -*-
764+
765+// Copyright (C) 2001, 2002, 2003, 2004, 2005
766+// Free Software Foundation, Inc.
767+//
768+// This file is part of the GNU ISO C++ Library. This library is free
769+// software; you can redistribute it and/or modify it under the
770+// terms of the GNU General Public License as published by the
771+// Free Software Foundation; either version 2, or (at your option)
772+// any later version.
773+
774+// This library is distributed in the hope that it will be useful,
775+// but WITHOUT ANY WARRANTY; without even the implied warranty of
776+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
777+// GNU General Public License for more details.
778+
779+// You should have received a copy of the GNU General Public License along
780+// with this library; see the file COPYING. If not, write to the Free
781+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
782+// USA.
783+
784+// As a special exception, you may use this file as part of a free software
785+// library without restriction. Specifically, if other files instantiate
786+// templates or use macros or inline functions from this file, or you compile
787+// this file and link it with other files to produce an executable, this
788+// file does not by itself cause the resulting executable to be covered by
789+// the GNU General Public License. This exception does not however
790+// invalidate any other reasons why the executable file might be covered by
791+// the GNU General Public License.
792+
793+//
794+// ISO C++ 14882: 22.8 Standard locale categories.
795+//
796+
797+// Written by Benjamin Kosnik <bkoz@redhat.com>
798+
799+#include <cerrno> // For errno
800+#include <locale>
801+#include <stdexcept>
802+#include <langinfo.h>
803+#include <bits/c++locale_internal.h>
804+
805+#ifndef __UCLIBC_HAS_XLOCALE__
806+#define __strtol_l(S, E, B, L) strtol((S), (E), (B))
807+#define __strtoul_l(S, E, B, L) strtoul((S), (E), (B))
808+#define __strtoll_l(S, E, B, L) strtoll((S), (E), (B))
809+#define __strtoull_l(S, E, B, L) strtoull((S), (E), (B))
810+#define __strtof_l(S, E, L) strtof((S), (E))
811+#define __strtod_l(S, E, L) strtod((S), (E))
812+#define __strtold_l(S, E, L) strtold((S), (E))
813+#warning should dummy __newlocale check for C|POSIX ?
814+#define __newlocale(a, b, c) NULL
815+#define __freelocale(a) ((void)0)
816+#define __duplocale(a) __c_locale()
817+#endif
818+
819+namespace std
820+{
821+ template<>
822+ void
823+ __convert_to_v(const char* __s, float& __v, ios_base::iostate& __err,
824+ const __c_locale& __cloc)
825+ {
826+ char* __sanity;
827+ errno = 0;
828+ float __f = __strtof_l(__s, &__sanity, __cloc);
829+ if (__sanity != __s && errno != ERANGE)
830+ __v = __f;
831+ else
832+ __err |= ios_base::failbit;
833+ }
834+
835+ template<>
836+ void
837+ __convert_to_v(const char* __s, double& __v, ios_base::iostate& __err,
838+ const __c_locale& __cloc)
839+ {
840+ char* __sanity;
841+ errno = 0;
842+ double __d = __strtod_l(__s, &__sanity, __cloc);
843+ if (__sanity != __s && errno != ERANGE)
844+ __v = __d;
845+ else
846+ __err |= ios_base::failbit;
847+ }
848+
849+ template<>
850+ void
851+ __convert_to_v(const char* __s, long double& __v, ios_base::iostate& __err,
852+ const __c_locale& __cloc)
853+ {
854+ char* __sanity;
855+ errno = 0;
856+ long double __ld = __strtold_l(__s, &__sanity, __cloc);
857+ if (__sanity != __s && errno != ERANGE)
858+ __v = __ld;
859+ else
860+ __err |= ios_base::failbit;
861+ }
862+
863+ void
864+ locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s,
865+ __c_locale __old)
866+ {
867+ __cloc = __newlocale(1 << LC_ALL, __s, __old);
868+#ifdef __UCLIBC_HAS_XLOCALE__
869+ if (!__cloc)
870+ {
871+ // This named locale is not supported by the underlying OS.
872+ __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
873+ "name not valid"));
874+ }
875+#endif
876+ }
877+
878+ void
879+ locale::facet::_S_destroy_c_locale(__c_locale& __cloc)
880+ {
881+ if (__cloc && _S_get_c_locale() != __cloc)
882+ __freelocale(__cloc);
883+ }
884+
885+ __c_locale
886+ locale::facet::_S_clone_c_locale(__c_locale& __cloc)
887+ { return __duplocale(__cloc); }
888+} // namespace std
889+
890+namespace __gnu_cxx
891+{
892+ const char* const category_names[6 + _GLIBCXX_NUM_CATEGORIES] =
893+ {
894+ "LC_CTYPE",
895+ "LC_NUMERIC",
896+ "LC_TIME",
897+ "LC_COLLATE",
898+ "LC_MONETARY",
899+ "LC_MESSAGES",
900+#if _GLIBCXX_NUM_CATEGORIES != 0
901+ "LC_PAPER",
902+ "LC_NAME",
903+ "LC_ADDRESS",
904+ "LC_TELEPHONE",
905+ "LC_MEASUREMENT",
906+ "LC_IDENTIFICATION"
907+#endif
908+ };
909+}
910+
911+namespace std
912+{
913+ const char* const* const locale::_S_categories = __gnu_cxx::category_names;
914+} // namespace std
[0602db2]915diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.h gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.h
916--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/c_locale.h 1969-12-31 16:00:00.000000000 -0800
917+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/c_locale.h 2007-02-14 07:57:37.000000000 -0800
[841271e]918@@ -0,0 +1,117 @@
919+// Wrapper for underlying C-language localization -*- C++ -*-
920+
921+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
922+//
923+// This file is part of the GNU ISO C++ Library. This library is free
924+// software; you can redistribute it and/or modify it under the
925+// terms of the GNU General Public License as published by the
926+// Free Software Foundation; either version 2, or (at your option)
927+// any later version.
928+
929+// This library is distributed in the hope that it will be useful,
930+// but WITHOUT ANY WARRANTY; without even the implied warranty of
931+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
932+// GNU General Public License for more details.
933+
934+// You should have received a copy of the GNU General Public License along
935+// with this library; see the file COPYING. If not, write to the Free
936+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
937+// USA.
938+
939+// As a special exception, you may use this file as part of a free software
940+// library without restriction. Specifically, if other files instantiate
941+// templates or use macros or inline functions from this file, or you compile
942+// this file and link it with other files to produce an executable, this
943+// file does not by itself cause the resulting executable to be covered by
944+// the GNU General Public License. This exception does not however
945+// invalidate any other reasons why the executable file might be covered by
946+// the GNU General Public License.
947+
948+//
949+// ISO C++ 14882: 22.8 Standard locale categories.
950+//
951+
952+// Written by Benjamin Kosnik <bkoz@redhat.com>
953+
954+#ifndef _C_LOCALE_H
955+#define _C_LOCALE_H 1
956+
957+#pragma GCC system_header
958+
959+#include <cstring> // get std::strlen
960+#include <cstdio> // get std::snprintf or std::sprintf
961+#include <clocale>
962+#include <langinfo.h> // For codecvt
963+#ifdef __UCLIBC_MJN3_ONLY__
964+#warning fix this
965+#endif
966+#ifdef __UCLIBC_HAS_LOCALE__
967+#include <iconv.h> // For codecvt using iconv, iconv_t
968+#endif
969+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
970+#include <libintl.h> // For messages
971+#endif
972+
973+#ifdef __UCLIBC_MJN3_ONLY__
974+#warning what is _GLIBCXX_C_LOCALE_GNU for
975+#endif
976+#define _GLIBCXX_C_LOCALE_GNU 1
977+
978+#ifdef __UCLIBC_MJN3_ONLY__
979+#warning fix categories
980+#endif
981+// #define _GLIBCXX_NUM_CATEGORIES 6
982+#define _GLIBCXX_NUM_CATEGORIES 0
983+
984+#ifdef __UCLIBC_HAS_XLOCALE__
985+namespace __gnu_cxx
986+{
987+ extern "C" __typeof(uselocale) __uselocale;
988+}
989+#endif
990+
991+namespace std
992+{
993+#ifdef __UCLIBC_HAS_XLOCALE__
994+ typedef __locale_t __c_locale;
995+#else
996+ typedef int* __c_locale;
997+#endif
998+
999+ // Convert numeric value of type _Tv to string and return length of
1000+ // string. If snprintf is available use it, otherwise fall back to
1001+ // the unsafe sprintf which, in general, can be dangerous and should
1002+ // be avoided.
1003+ template<typename _Tv>
1004+ int
1005+ __convert_from_v(char* __out,
1006+ const int __size __attribute__ ((__unused__)),
1007+ const char* __fmt,
1008+#ifdef __UCLIBC_HAS_XLOCALE__
1009+ _Tv __v, const __c_locale& __cloc, int __prec)
1010+ {
1011+ __c_locale __old = __gnu_cxx::__uselocale(__cloc);
1012+#else
1013+ _Tv __v, const __c_locale&, int __prec)
1014+ {
1015+# ifdef __UCLIBC_HAS_LOCALE__
1016+ char* __old = std::setlocale(LC_ALL, NULL);
1017+ char* __sav = new char[std::strlen(__old) + 1];
1018+ std::strcpy(__sav, __old);
1019+ std::setlocale(LC_ALL, "C");
1020+# endif
1021+#endif
1022+
1023+ const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
1024+
1025+#ifdef __UCLIBC_HAS_XLOCALE__
1026+ __gnu_cxx::__uselocale(__old);
1027+#elif defined __UCLIBC_HAS_LOCALE__
1028+ std::setlocale(LC_ALL, __sav);
1029+ delete [] __sav;
1030+#endif
1031+ return __ret;
1032+ }
1033+}
1034+
1035+#endif
[0602db2]1036diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc
1037--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 1969-12-31 16:00:00.000000000 -0800
1038+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/codecvt_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]1039@@ -0,0 +1,306 @@
1040+// std::codecvt implementation details, GNU version -*- C++ -*-
1041+
1042+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
1043+//
1044+// This file is part of the GNU ISO C++ Library. This library is free
1045+// software; you can redistribute it and/or modify it under the
1046+// terms of the GNU General Public License as published by the
1047+// Free Software Foundation; either version 2, or (at your option)
1048+// any later version.
1049+
1050+// This library is distributed in the hope that it will be useful,
1051+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1052+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1053+// GNU General Public License for more details.
1054+
1055+// You should have received a copy of the GNU General Public License along
1056+// with this library; see the file COPYING. If not, write to the Free
1057+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1058+// USA.
1059+
1060+// As a special exception, you may use this file as part of a free software
1061+// library without restriction. Specifically, if other files instantiate
1062+// templates or use macros or inline functions from this file, or you compile
1063+// this file and link it with other files to produce an executable, this
1064+// file does not by itself cause the resulting executable to be covered by
1065+// the GNU General Public License. This exception does not however
1066+// invalidate any other reasons why the executable file might be covered by
1067+// the GNU General Public License.
1068+
1069+//
1070+// ISO C++ 14882: 22.2.1.5 - Template class codecvt
1071+//
1072+
1073+// Written by Benjamin Kosnik <bkoz@redhat.com>
1074+
1075+#include <locale>
1076+#include <bits/c++locale_internal.h>
1077+
1078+namespace std
1079+{
1080+ // Specializations.
1081+#ifdef _GLIBCXX_USE_WCHAR_T
1082+ codecvt_base::result
1083+ codecvt<wchar_t, char, mbstate_t>::
1084+ do_out(state_type& __state, const intern_type* __from,
1085+ const intern_type* __from_end, const intern_type*& __from_next,
1086+ extern_type* __to, extern_type* __to_end,
1087+ extern_type*& __to_next) const
1088+ {
1089+ result __ret = ok;
1090+ state_type __tmp_state(__state);
1091+
1092+#ifdef __UCLIBC_HAS_XLOCALE__
1093+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
1094+#endif
1095+
1096+ // wcsnrtombs is *very* fast but stops if encounters NUL characters:
1097+ // in case we fall back to wcrtomb and then continue, in a loop.
1098+ // NB: wcsnrtombs is a GNU extension
1099+ for (__from_next = __from, __to_next = __to;
1100+ __from_next < __from_end && __to_next < __to_end
1101+ && __ret == ok;)
1102+ {
1103+ const intern_type* __from_chunk_end = wmemchr(__from_next, L'\0',
1104+ __from_end - __from_next);
1105+ if (!__from_chunk_end)
1106+ __from_chunk_end = __from_end;
1107+
1108+ __from = __from_next;
1109+ const size_t __conv = wcsnrtombs(__to_next, &__from_next,
1110+ __from_chunk_end - __from_next,
1111+ __to_end - __to_next, &__state);
1112+ if (__conv == static_cast<size_t>(-1))
1113+ {
1114+ // In case of error, in order to stop at the exact place we
1115+ // have to start again from the beginning with a series of
1116+ // wcrtomb.
1117+ for (; __from < __from_next; ++__from)
1118+ __to_next += wcrtomb(__to_next, *__from, &__tmp_state);
1119+ __state = __tmp_state;
1120+ __ret = error;
1121+ }
1122+ else if (__from_next && __from_next < __from_chunk_end)
1123+ {
1124+ __to_next += __conv;
1125+ __ret = partial;
1126+ }
1127+ else
1128+ {
1129+ __from_next = __from_chunk_end;
1130+ __to_next += __conv;
1131+ }
1132+
1133+ if (__from_next < __from_end && __ret == ok)
1134+ {
1135+ extern_type __buf[MB_LEN_MAX];
1136+ __tmp_state = __state;
1137+ const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state);
1138+ if (__conv > static_cast<size_t>(__to_end - __to_next))
1139+ __ret = partial;
1140+ else
1141+ {
1142+ memcpy(__to_next, __buf, __conv);
1143+ __state = __tmp_state;
1144+ __to_next += __conv;
1145+ ++__from_next;
1146+ }
1147+ }
1148+ }
1149+
1150+#ifdef __UCLIBC_HAS_XLOCALE__
1151+ __uselocale(__old);
1152+#endif
1153+
1154+ return __ret;
1155+ }
1156+
1157+ codecvt_base::result
1158+ codecvt<wchar_t, char, mbstate_t>::
1159+ do_in(state_type& __state, const extern_type* __from,
1160+ const extern_type* __from_end, const extern_type*& __from_next,
1161+ intern_type* __to, intern_type* __to_end,
1162+ intern_type*& __to_next) const
1163+ {
1164+ result __ret = ok;
1165+ state_type __tmp_state(__state);
1166+
1167+#ifdef __UCLIBC_HAS_XLOCALE__
1168+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
1169+#endif
1170+
1171+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
1172+ // in case we store a L'\0' and then continue, in a loop.
1173+ // NB: mbsnrtowcs is a GNU extension
1174+ for (__from_next = __from, __to_next = __to;
1175+ __from_next < __from_end && __to_next < __to_end
1176+ && __ret == ok;)
1177+ {
1178+ const extern_type* __from_chunk_end;
1179+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from_next, '\0',
1180+ __from_end
1181+ - __from_next));
1182+ if (!__from_chunk_end)
1183+ __from_chunk_end = __from_end;
1184+
1185+ __from = __from_next;
1186+ size_t __conv = mbsnrtowcs(__to_next, &__from_next,
1187+ __from_chunk_end - __from_next,
1188+ __to_end - __to_next, &__state);
1189+ if (__conv == static_cast<size_t>(-1))
1190+ {
1191+ // In case of error, in order to stop at the exact place we
1192+ // have to start again from the beginning with a series of
1193+ // mbrtowc.
1194+ for (;; ++__to_next, __from += __conv)
1195+ {
1196+ __conv = mbrtowc(__to_next, __from, __from_end - __from,
1197+ &__tmp_state);
1198+ if (__conv == static_cast<size_t>(-1)
1199+ || __conv == static_cast<size_t>(-2))
1200+ break;
1201+ }
1202+ __from_next = __from;
1203+ __state = __tmp_state;
1204+ __ret = error;
1205+ }
1206+ else if (__from_next && __from_next < __from_chunk_end)
1207+ {
1208+ // It is unclear what to return in this case (see DR 382).
1209+ __to_next += __conv;
1210+ __ret = partial;
1211+ }
1212+ else
1213+ {
1214+ __from_next = __from_chunk_end;
1215+ __to_next += __conv;
1216+ }
1217+
1218+ if (__from_next < __from_end && __ret == ok)
1219+ {
1220+ if (__to_next < __to_end)
1221+ {
1222+ // XXX Probably wrong for stateful encodings
1223+ __tmp_state = __state;
1224+ ++__from_next;
1225+ *__to_next++ = L'\0';
1226+ }
1227+ else
1228+ __ret = partial;
1229+ }
1230+ }
1231+
1232+#ifdef __UCLIBC_HAS_XLOCALE__
1233+ __uselocale(__old);
1234+#endif
1235+
1236+ return __ret;
1237+ }
1238+
1239+ int
1240+ codecvt<wchar_t, char, mbstate_t>::
1241+ do_encoding() const throw()
1242+ {
1243+ // XXX This implementation assumes that the encoding is
1244+ // stateless and is either single-byte or variable-width.
1245+ int __ret = 0;
1246+#ifdef __UCLIBC_HAS_XLOCALE__
1247+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
1248+#endif
1249+ if (MB_CUR_MAX == 1)
1250+ __ret = 1;
1251+#ifdef __UCLIBC_HAS_XLOCALE__
1252+ __uselocale(__old);
1253+#endif
1254+ return __ret;
1255+ }
1256+
1257+ int
1258+ codecvt<wchar_t, char, mbstate_t>::
1259+ do_max_length() const throw()
1260+ {
1261+#ifdef __UCLIBC_HAS_XLOCALE__
1262+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
1263+#endif
1264+ // XXX Probably wrong for stateful encodings.
1265+ int __ret = MB_CUR_MAX;
1266+#ifdef __UCLIBC_HAS_XLOCALE__
1267+ __uselocale(__old);
1268+#endif
1269+ return __ret;
1270+ }
1271+
1272+ int
1273+ codecvt<wchar_t, char, mbstate_t>::
1274+ do_length(state_type& __state, const extern_type* __from,
1275+ const extern_type* __end, size_t __max) const
1276+ {
1277+ int __ret = 0;
1278+ state_type __tmp_state(__state);
1279+
1280+#ifdef __UCLIBC_HAS_XLOCALE__
1281+ __c_locale __old = __uselocale(_M_c_locale_codecvt);
1282+#endif
1283+
1284+ // mbsnrtowcs is *very* fast but stops if encounters NUL characters:
1285+ // in case we advance past it and then continue, in a loop.
1286+ // NB: mbsnrtowcs is a GNU extension
1287+
1288+ // A dummy internal buffer is needed in order for mbsnrtocws to consider
1289+ // its fourth parameter (it wouldn't with NULL as first parameter).
1290+ wchar_t* __to = static_cast<wchar_t*>(__builtin_alloca(sizeof(wchar_t)
1291+ * __max));
1292+ while (__from < __end && __max)
1293+ {
1294+ const extern_type* __from_chunk_end;
1295+ __from_chunk_end = static_cast<const extern_type*>(memchr(__from, '\0',
1296+ __end
1297+ - __from));
1298+ if (!__from_chunk_end)
1299+ __from_chunk_end = __end;
1300+
1301+ const extern_type* __tmp_from = __from;
1302+ size_t __conv = mbsnrtowcs(__to, &__from,
1303+ __from_chunk_end - __from,
1304+ __max, &__state);
1305+ if (__conv == static_cast<size_t>(-1))
1306+ {
1307+ // In case of error, in order to stop at the exact place we
1308+ // have to start again from the beginning with a series of
1309+ // mbrtowc.
1310+ for (__from = __tmp_from;; __from += __conv)
1311+ {
1312+ __conv = mbrtowc(NULL, __from, __end - __from,
1313+ &__tmp_state);
1314+ if (__conv == static_cast<size_t>(-1)
1315+ || __conv == static_cast<size_t>(-2))
1316+ break;
1317+ }
1318+ __state = __tmp_state;
1319+ __ret += __from - __tmp_from;
1320+ break;
1321+ }
1322+ if (!__from)
1323+ __from = __from_chunk_end;
1324+
1325+ __ret += __from - __tmp_from;
1326+ __max -= __conv;
1327+
1328+ if (__from < __end && __max)
1329+ {
1330+ // XXX Probably wrong for stateful encodings
1331+ __tmp_state = __state;
1332+ ++__from;
1333+ ++__ret;
1334+ --__max;
1335+ }
1336+ }
1337+
1338+#ifdef __UCLIBC_HAS_XLOCALE__
1339+ __uselocale(__old);
1340+#endif
1341+
1342+ return __ret;
1343+ }
1344+#endif
1345+}
[0602db2]1346diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/collate_members.cc
1347--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/collate_members.cc 1969-12-31 16:00:00.000000000 -0800
1348+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/collate_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]1349@@ -0,0 +1,80 @@
1350+// std::collate implementation details, GNU version -*- C++ -*-
1351+
1352+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1353+//
1354+// This file is part of the GNU ISO C++ Library. This library is free
1355+// software; you can redistribute it and/or modify it under the
1356+// terms of the GNU General Public License as published by the
1357+// Free Software Foundation; either version 2, or (at your option)
1358+// any later version.
1359+
1360+// This library is distributed in the hope that it will be useful,
1361+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1362+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1363+// GNU General Public License for more details.
1364+
1365+// You should have received a copy of the GNU General Public License along
1366+// with this library; see the file COPYING. If not, write to the Free
1367+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1368+// USA.
1369+
1370+// As a special exception, you may use this file as part of a free software
1371+// library without restriction. Specifically, if other files instantiate
1372+// templates or use macros or inline functions from this file, or you compile
1373+// this file and link it with other files to produce an executable, this
1374+// file does not by itself cause the resulting executable to be covered by
1375+// the GNU General Public License. This exception does not however
1376+// invalidate any other reasons why the executable file might be covered by
1377+// the GNU General Public License.
1378+
1379+//
1380+// ISO C++ 14882: 22.2.4.1.2 collate virtual functions
1381+//
1382+
1383+// Written by Benjamin Kosnik <bkoz@redhat.com>
1384+
1385+#include <locale>
1386+#include <bits/c++locale_internal.h>
1387+
1388+#ifndef __UCLIBC_HAS_XLOCALE__
1389+#define __strcoll_l(S1, S2, L) strcoll((S1), (S2))
1390+#define __strxfrm_l(S1, S2, N, L) strxfrm((S1), (S2), (N))
1391+#define __wcscoll_l(S1, S2, L) wcscoll((S1), (S2))
1392+#define __wcsxfrm_l(S1, S2, N, L) wcsxfrm((S1), (S2), (N))
1393+#endif
1394+
1395+namespace std
1396+{
1397+ // These are basically extensions to char_traits, and perhaps should
1398+ // be put there instead of here.
1399+ template<>
1400+ int
1401+ collate<char>::_M_compare(const char* __one, const char* __two) const
1402+ {
1403+ int __cmp = __strcoll_l(__one, __two, _M_c_locale_collate);
1404+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
1405+ }
1406+
1407+ template<>
1408+ size_t
1409+ collate<char>::_M_transform(char* __to, const char* __from,
1410+ size_t __n) const
1411+ { return __strxfrm_l(__to, __from, __n, _M_c_locale_collate); }
1412+
1413+#ifdef _GLIBCXX_USE_WCHAR_T
1414+ template<>
1415+ int
1416+ collate<wchar_t>::_M_compare(const wchar_t* __one,
1417+ const wchar_t* __two) const
1418+ {
1419+ int __cmp = __wcscoll_l(__one, __two, _M_c_locale_collate);
1420+ return (__cmp >> (8 * sizeof (int) - 2)) | (__cmp != 0);
1421+ }
1422+
1423+ template<>
1424+ size_t
1425+ collate<wchar_t>::_M_transform(wchar_t* __to, const wchar_t* __from,
1426+ size_t __n) const
1427+ { return __wcsxfrm_l(__to, __from, __n, _M_c_locale_collate); }
1428+#endif
1429+}
[0602db2]1430diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc
1431--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/ctype_members.cc 1969-12-31 16:00:00.000000000 -0800
1432+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/ctype_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]1433@@ -0,0 +1,314 @@
1434+// std::ctype implementation details, GNU version -*- C++ -*-
1435+
1436+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1437+//
1438+// This file is part of the GNU ISO C++ Library. This library is free
1439+// software; you can redistribute it and/or modify it under the
1440+// terms of the GNU General Public License as published by the
1441+// Free Software Foundation; either version 2, or (at your option)
1442+// any later version.
1443+
1444+// This library is distributed in the hope that it will be useful,
1445+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1446+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1447+// GNU General Public License for more details.
1448+
1449+// You should have received a copy of the GNU General Public License along
1450+// with this library; see the file COPYING. If not, write to the Free
1451+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1452+// USA.
1453+
1454+// As a special exception, you may use this file as part of a free software
1455+// library without restriction. Specifically, if other files instantiate
1456+// templates or use macros or inline functions from this file, or you compile
1457+// this file and link it with other files to produce an executable, this
1458+// file does not by itself cause the resulting executable to be covered by
1459+// the GNU General Public License. This exception does not however
1460+// invalidate any other reasons why the executable file might be covered by
1461+// the GNU General Public License.
1462+
1463+//
1464+// ISO C++ 14882: 22.2.1.1.2 ctype virtual functions.
1465+//
1466+
1467+// Written by Benjamin Kosnik <bkoz@redhat.com>
1468+
1469+#define _LIBC
1470+#include <locale>
1471+#undef _LIBC
1472+#include <bits/c++locale_internal.h>
1473+
1474+#ifndef __UCLIBC_HAS_XLOCALE__
1475+#define __wctype_l(S, L) wctype((S))
1476+#define __towupper_l(C, L) towupper((C))
1477+#define __towlower_l(C, L) towlower((C))
1478+#define __iswctype_l(C, M, L) iswctype((C), (M))
1479+#endif
1480+
1481+namespace std
1482+{
1483+ // NB: The other ctype<char> specializations are in src/locale.cc and
1484+ // various /config/os/* files.
1485+ template<>
1486+ ctype_byname<char>::ctype_byname(const char* __s, size_t __refs)
1487+ : ctype<char>(0, false, __refs)
1488+ {
1489+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1490+ {
1491+ this->_S_destroy_c_locale(this->_M_c_locale_ctype);
1492+ this->_S_create_c_locale(this->_M_c_locale_ctype, __s);
1493+#ifdef __UCLIBC_HAS_XLOCALE__
1494+ this->_M_toupper = this->_M_c_locale_ctype->__ctype_toupper;
1495+ this->_M_tolower = this->_M_c_locale_ctype->__ctype_tolower;
1496+ this->_M_table = this->_M_c_locale_ctype->__ctype_b;
1497+#endif
1498+ }
1499+ }
1500+
1501+#ifdef _GLIBCXX_USE_WCHAR_T
1502+ ctype<wchar_t>::__wmask_type
1503+ ctype<wchar_t>::_M_convert_to_wmask(const mask __m) const
1504+ {
1505+ __wmask_type __ret;
1506+ switch (__m)
1507+ {
1508+ case space:
1509+ __ret = __wctype_l("space", _M_c_locale_ctype);
1510+ break;
1511+ case print:
1512+ __ret = __wctype_l("print", _M_c_locale_ctype);
1513+ break;
1514+ case cntrl:
1515+ __ret = __wctype_l("cntrl", _M_c_locale_ctype);
1516+ break;
1517+ case upper:
1518+ __ret = __wctype_l("upper", _M_c_locale_ctype);
1519+ break;
1520+ case lower:
1521+ __ret = __wctype_l("lower", _M_c_locale_ctype);
1522+ break;
1523+ case alpha:
1524+ __ret = __wctype_l("alpha", _M_c_locale_ctype);
1525+ break;
1526+ case digit:
1527+ __ret = __wctype_l("digit", _M_c_locale_ctype);
1528+ break;
1529+ case punct:
1530+ __ret = __wctype_l("punct", _M_c_locale_ctype);
1531+ break;
1532+ case xdigit:
1533+ __ret = __wctype_l("xdigit", _M_c_locale_ctype);
1534+ break;
1535+ case alnum:
1536+ __ret = __wctype_l("alnum", _M_c_locale_ctype);
1537+ break;
1538+ case graph:
1539+ __ret = __wctype_l("graph", _M_c_locale_ctype);
1540+ break;
1541+ default:
1542+ __ret = __wmask_type();
1543+ }
1544+ return __ret;
1545+ }
1546+
1547+ wchar_t
1548+ ctype<wchar_t>::do_toupper(wchar_t __c) const
1549+ { return __towupper_l(__c, _M_c_locale_ctype); }
1550+
1551+ const wchar_t*
1552+ ctype<wchar_t>::do_toupper(wchar_t* __lo, const wchar_t* __hi) const
1553+ {
1554+ while (__lo < __hi)
1555+ {
1556+ *__lo = __towupper_l(*__lo, _M_c_locale_ctype);
1557+ ++__lo;
1558+ }
1559+ return __hi;
1560+ }
1561+
1562+ wchar_t
1563+ ctype<wchar_t>::do_tolower(wchar_t __c) const
1564+ { return __towlower_l(__c, _M_c_locale_ctype); }
1565+
1566+ const wchar_t*
1567+ ctype<wchar_t>::do_tolower(wchar_t* __lo, const wchar_t* __hi) const
1568+ {
1569+ while (__lo < __hi)
1570+ {
1571+ *__lo = __towlower_l(*__lo, _M_c_locale_ctype);
1572+ ++__lo;
1573+ }
1574+ return __hi;
1575+ }
1576+
1577+ bool
1578+ ctype<wchar_t>::
1579+ do_is(mask __m, wchar_t __c) const
1580+ {
1581+ // The case of __m == ctype_base::space is particularly important,
1582+ // due to its use in many istream functions. Therefore we deal with
1583+ // it first, exploiting the knowledge that on GNU systems _M_bit[5]
1584+ // is the mask corresponding to ctype_base::space. NB: an encoding
1585+ // change would not affect correctness!
1586+ bool __ret = false;
1587+ if (__m == _M_bit[5])
1588+ __ret = __iswctype_l(__c, _M_wmask[5], _M_c_locale_ctype);
1589+ else
1590+ {
1591+ // Highest bitmask in ctype_base == 10, but extra in "C"
1592+ // library for blank.
1593+ const size_t __bitmasksize = 11;
1594+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1595+ if (__m & _M_bit[__bitcur])
1596+ {
1597+ if (__iswctype_l(__c, _M_wmask[__bitcur], _M_c_locale_ctype))
1598+ {
1599+ __ret = true;
1600+ break;
1601+ }
1602+ else if (__m == _M_bit[__bitcur])
1603+ break;
1604+ }
1605+ }
1606+ return __ret;
1607+ }
1608+
1609+ const wchar_t*
1610+ ctype<wchar_t>::
1611+ do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const
1612+ {
1613+ for (; __lo < __hi; ++__vec, ++__lo)
1614+ {
1615+ // Highest bitmask in ctype_base == 10, but extra in "C"
1616+ // library for blank.
1617+ const size_t __bitmasksize = 11;
1618+ mask __m = 0;
1619+ for (size_t __bitcur = 0; __bitcur <= __bitmasksize; ++__bitcur)
1620+ if (__iswctype_l(*__lo, _M_wmask[__bitcur], _M_c_locale_ctype))
1621+ __m |= _M_bit[__bitcur];
1622+ *__vec = __m;
1623+ }
1624+ return __hi;
1625+ }
1626+
1627+ const wchar_t*
1628+ ctype<wchar_t>::
1629+ do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const
1630+ {
1631+ while (__lo < __hi && !this->do_is(__m, *__lo))
1632+ ++__lo;
1633+ return __lo;
1634+ }
1635+
1636+ const wchar_t*
1637+ ctype<wchar_t>::
1638+ do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
1639+ {
1640+ while (__lo < __hi && this->do_is(__m, *__lo) != 0)
1641+ ++__lo;
1642+ return __lo;
1643+ }
1644+
1645+ wchar_t
1646+ ctype<wchar_t>::
1647+ do_widen(char __c) const
1648+ { return _M_widen[static_cast<unsigned char>(__c)]; }
1649+
1650+ const char*
1651+ ctype<wchar_t>::
1652+ do_widen(const char* __lo, const char* __hi, wchar_t* __dest) const
1653+ {
1654+ while (__lo < __hi)
1655+ {
1656+ *__dest = _M_widen[static_cast<unsigned char>(*__lo)];
1657+ ++__lo;
1658+ ++__dest;
1659+ }
1660+ return __hi;
1661+ }
1662+
1663+ char
1664+ ctype<wchar_t>::
1665+ do_narrow(wchar_t __wc, char __dfault) const
1666+ {
1667+ if (__wc >= 0 && __wc < 128 && _M_narrow_ok)
1668+ return _M_narrow[__wc];
1669+#ifdef __UCLIBC_HAS_XLOCALE__
1670+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1671+#endif
1672+ const int __c = wctob(__wc);
1673+#ifdef __UCLIBC_HAS_XLOCALE__
1674+ __uselocale(__old);
1675+#endif
1676+ return (__c == EOF ? __dfault : static_cast<char>(__c));
1677+ }
1678+
1679+ const wchar_t*
1680+ ctype<wchar_t>::
1681+ do_narrow(const wchar_t* __lo, const wchar_t* __hi, char __dfault,
1682+ char* __dest) const
1683+ {
1684+#ifdef __UCLIBC_HAS_XLOCALE__
1685+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1686+#endif
1687+ if (_M_narrow_ok)
1688+ while (__lo < __hi)
1689+ {
1690+ if (*__lo >= 0 && *__lo < 128)
1691+ *__dest = _M_narrow[*__lo];
1692+ else
1693+ {
1694+ const int __c = wctob(*__lo);
1695+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1696+ }
1697+ ++__lo;
1698+ ++__dest;
1699+ }
1700+ else
1701+ while (__lo < __hi)
1702+ {
1703+ const int __c = wctob(*__lo);
1704+ *__dest = (__c == EOF ? __dfault : static_cast<char>(__c));
1705+ ++__lo;
1706+ ++__dest;
1707+ }
1708+#ifdef __UCLIBC_HAS_XLOCALE__
1709+ __uselocale(__old);
1710+#endif
1711+ return __hi;
1712+ }
1713+
1714+ void
1715+ ctype<wchar_t>::_M_initialize_ctype()
1716+ {
1717+#ifdef __UCLIBC_HAS_XLOCALE__
1718+ __c_locale __old = __uselocale(_M_c_locale_ctype);
1719+#endif
1720+ wint_t __i;
1721+ for (__i = 0; __i < 128; ++__i)
1722+ {
1723+ const int __c = wctob(__i);
1724+ if (__c == EOF)
1725+ break;
1726+ else
1727+ _M_narrow[__i] = static_cast<char>(__c);
1728+ }
1729+ if (__i == 128)
1730+ _M_narrow_ok = true;
1731+ else
1732+ _M_narrow_ok = false;
1733+ for (size_t __j = 0;
1734+ __j < sizeof(_M_widen) / sizeof(wint_t); ++__j)
1735+ _M_widen[__j] = btowc(__j);
1736+
1737+ for (size_t __k = 0; __k <= 11; ++__k)
1738+ {
1739+ _M_bit[__k] = static_cast<mask>(_ISbit(__k));
1740+ _M_wmask[__k] = _M_convert_to_wmask(_M_bit[__k]);
1741+ }
1742+#ifdef __UCLIBC_HAS_XLOCALE__
1743+ __uselocale(__old);
1744+#endif
1745+ }
1746+#endif // _GLIBCXX_USE_WCHAR_T
1747+}
[0602db2]1748diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.cc
1749--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.cc 1969-12-31 16:00:00.000000000 -0800
1750+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]1751@@ -0,0 +1,100 @@
1752+// std::messages implementation details, GNU version -*- C++ -*-
1753+
1754+// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
1755+//
1756+// This file is part of the GNU ISO C++ Library. This library is free
1757+// software; you can redistribute it and/or modify it under the
1758+// terms of the GNU General Public License as published by the
1759+// Free Software Foundation; either version 2, or (at your option)
1760+// any later version.
1761+
1762+// This library is distributed in the hope that it will be useful,
1763+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1764+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1765+// GNU General Public License for more details.
1766+
1767+// You should have received a copy of the GNU General Public License along
1768+// with this library; see the file COPYING. If not, write to the Free
1769+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1770+// USA.
1771+
1772+// As a special exception, you may use this file as part of a free software
1773+// library without restriction. Specifically, if other files instantiate
1774+// templates or use macros or inline functions from this file, or you compile
1775+// this file and link it with other files to produce an executable, this
1776+// file does not by itself cause the resulting executable to be covered by
1777+// the GNU General Public License. This exception does not however
1778+// invalidate any other reasons why the executable file might be covered by
1779+// the GNU General Public License.
1780+
1781+//
1782+// ISO C++ 14882: 22.2.7.1.2 messages virtual functions
1783+//
1784+
1785+// Written by Benjamin Kosnik <bkoz@redhat.com>
1786+
1787+#include <locale>
1788+#include <bits/c++locale_internal.h>
1789+
1790+#ifdef __UCLIBC_MJN3_ONLY__
1791+#warning fix gettext stuff
1792+#endif
1793+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1794+extern "C" char *__dcgettext(const char *domainname,
1795+ const char *msgid, int category);
1796+#undef gettext
1797+#define gettext(msgid) __dcgettext(NULL, msgid, LC_MESSAGES)
1798+#else
1799+#undef gettext
1800+#define gettext(msgid) (msgid)
1801+#endif
1802+
1803+namespace std
1804+{
1805+ // Specializations.
1806+ template<>
1807+ string
1808+ messages<char>::do_get(catalog, int, int, const string& __dfault) const
1809+ {
1810+#ifdef __UCLIBC_HAS_XLOCALE__
1811+ __c_locale __old = __uselocale(_M_c_locale_messages);
1812+ const char* __msg = const_cast<const char*>(gettext(__dfault.c_str()));
1813+ __uselocale(__old);
1814+ return string(__msg);
1815+#elif defined __UCLIBC_HAS_LOCALE__
1816+ char* __old = strdup(setlocale(LC_ALL, NULL));
1817+ setlocale(LC_ALL, _M_name_messages);
1818+ const char* __msg = gettext(__dfault.c_str());
1819+ setlocale(LC_ALL, __old);
1820+ free(__old);
1821+ return string(__msg);
1822+#else
1823+ const char* __msg = gettext(__dfault.c_str());
1824+ return string(__msg);
1825+#endif
1826+ }
1827+
1828+#ifdef _GLIBCXX_USE_WCHAR_T
1829+ template<>
1830+ wstring
1831+ messages<wchar_t>::do_get(catalog, int, int, const wstring& __dfault) const
1832+ {
1833+# ifdef __UCLIBC_HAS_XLOCALE__
1834+ __c_locale __old = __uselocale(_M_c_locale_messages);
1835+ char* __msg = gettext(_M_convert_to_char(__dfault));
1836+ __uselocale(__old);
1837+ return _M_convert_from_char(__msg);
1838+# elif defined __UCLIBC_HAS_LOCALE__
1839+ char* __old = strdup(setlocale(LC_ALL, NULL));
1840+ setlocale(LC_ALL, _M_name_messages);
1841+ char* __msg = gettext(_M_convert_to_char(__dfault));
1842+ setlocale(LC_ALL, __old);
1843+ free(__old);
1844+ return _M_convert_from_char(__msg);
1845+# else
1846+ char* __msg = gettext(_M_convert_to_char(__dfault));
1847+ return _M_convert_from_char(__msg);
1848+# endif
1849+ }
1850+#endif
1851+}
[0602db2]1852diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.h
1853--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 1969-12-31 16:00:00.000000000 -0800
1854+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2007-02-14 07:57:37.000000000 -0800
[841271e]1855@@ -0,0 +1,121 @@
1856+// std::messages implementation details, GNU version -*- C++ -*-
1857+
1858+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1859+//
1860+// This file is part of the GNU ISO C++ Library. This library is free
1861+// software; you can redistribute it and/or modify it under the
1862+// terms of the GNU General Public License as published by the
1863+// Free Software Foundation; either version 2, or (at your option)
1864+// any later version.
1865+
1866+// This library is distributed in the hope that it will be useful,
1867+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1868+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1869+// GNU General Public License for more details.
1870+
1871+// You should have received a copy of the GNU General Public License along
1872+// with this library; see the file COPYING. If not, write to the Free
1873+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1874+// USA.
1875+
1876+// As a special exception, you may use this file as part of a free software
1877+// library without restriction. Specifically, if other files instantiate
1878+// templates or use macros or inline functions from this file, or you compile
1879+// this file and link it with other files to produce an executable, this
1880+// file does not by itself cause the resulting executable to be covered by
1881+// the GNU General Public License. This exception does not however
1882+// invalidate any other reasons why the executable file might be covered by
1883+// the GNU General Public License.
1884+
1885+//
1886+// ISO C++ 14882: 22.2.7.1.2 messages functions
1887+//
1888+
1889+// Written by Benjamin Kosnik <bkoz@redhat.com>
1890+
1891+#ifdef __UCLIBC_MJN3_ONLY__
1892+#warning fix prototypes for *textdomain funcs
1893+#endif
1894+#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
1895+extern "C" char *__textdomain(const char *domainname);
1896+extern "C" char *__bindtextdomain(const char *domainname,
1897+ const char *dirname);
1898+#else
1899+#undef __textdomain
1900+#undef __bindtextdomain
1901+#define __textdomain(D) ((void)0)
1902+#define __bindtextdomain(D,P) ((void)0)
1903+#endif
1904+
1905+ // Non-virtual member functions.
1906+ template<typename _CharT>
1907+ messages<_CharT>::messages(size_t __refs)
1908+ : facet(__refs), _M_c_locale_messages(_S_get_c_locale()),
1909+ _M_name_messages(_S_get_c_name())
1910+ { }
1911+
1912+ template<typename _CharT>
1913+ messages<_CharT>::messages(__c_locale __cloc, const char* __s,
1914+ size_t __refs)
1915+ : facet(__refs), _M_c_locale_messages(NULL), _M_name_messages(NULL)
1916+ {
1917+ const size_t __len = std::strlen(__s) + 1;
1918+ char* __tmp = new char[__len];
1919+ std::memcpy(__tmp, __s, __len);
1920+ _M_name_messages = __tmp;
1921+
1922+ // Last to avoid leaking memory if new throws.
1923+ _M_c_locale_messages = _S_clone_c_locale(__cloc);
1924+ }
1925+
1926+ template<typename _CharT>
1927+ typename messages<_CharT>::catalog
1928+ messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
1929+ const char* __dir) const
1930+ {
1931+ __bindtextdomain(__s.c_str(), __dir);
1932+ return this->do_open(__s, __loc);
1933+ }
1934+
1935+ // Virtual member functions.
1936+ template<typename _CharT>
1937+ messages<_CharT>::~messages()
1938+ {
1939+ if (_M_name_messages != _S_get_c_name())
1940+ delete [] _M_name_messages;
1941+ _S_destroy_c_locale(_M_c_locale_messages);
1942+ }
1943+
1944+ template<typename _CharT>
1945+ typename messages<_CharT>::catalog
1946+ messages<_CharT>::do_open(const basic_string<char>& __s,
1947+ const locale&) const
1948+ {
1949+ // No error checking is done, assume the catalog exists and can
1950+ // be used.
1951+ __textdomain(__s.c_str());
1952+ return 0;
1953+ }
1954+
1955+ template<typename _CharT>
1956+ void
1957+ messages<_CharT>::do_close(catalog) const
1958+ { }
1959+
1960+ // messages_byname
1961+ template<typename _CharT>
1962+ messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
1963+ : messages<_CharT>(__refs)
1964+ {
1965+ if (this->_M_name_messages != locale::facet::_S_get_c_name())
1966+ delete [] this->_M_name_messages;
1967+ char* __tmp = new char[std::strlen(__s) + 1];
1968+ std::strcpy(__tmp, __s);
1969+ this->_M_name_messages = __tmp;
1970+
1971+ if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
1972+ {
1973+ this->_S_destroy_c_locale(this->_M_c_locale_messages);
1974+ this->_S_create_c_locale(this->_M_c_locale_messages, __s);
1975+ }
1976+ }
[0602db2]1977diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc
1978--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/monetary_members.cc 1969-12-31 16:00:00.000000000 -0800
1979+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/monetary_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]1980@@ -0,0 +1,692 @@
1981+// std::moneypunct implementation details, GNU version -*- C++ -*-
1982+
1983+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
1984+//
1985+// This file is part of the GNU ISO C++ Library. This library is free
1986+// software; you can redistribute it and/or modify it under the
1987+// terms of the GNU General Public License as published by the
1988+// Free Software Foundation; either version 2, or (at your option)
1989+// any later version.
1990+
1991+// This library is distributed in the hope that it will be useful,
1992+// but WITHOUT ANY WARRANTY; without even the implied warranty of
1993+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1994+// GNU General Public License for more details.
1995+
1996+// You should have received a copy of the GNU General Public License along
1997+// with this library; see the file COPYING. If not, write to the Free
1998+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
1999+// USA.
2000+
2001+// As a special exception, you may use this file as part of a free software
2002+// library without restriction. Specifically, if other files instantiate
2003+// templates or use macros or inline functions from this file, or you compile
2004+// this file and link it with other files to produce an executable, this
2005+// file does not by itself cause the resulting executable to be covered by
2006+// the GNU General Public License. This exception does not however
2007+// invalidate any other reasons why the executable file might be covered by
2008+// the GNU General Public License.
2009+
2010+//
2011+// ISO C++ 14882: 22.2.6.3.2 moneypunct virtual functions
2012+//
2013+
2014+// Written by Benjamin Kosnik <bkoz@redhat.com>
2015+
2016+#define _LIBC
2017+#include <locale>
2018+#undef _LIBC
2019+#include <bits/c++locale_internal.h>
2020+
2021+#ifdef __UCLIBC_MJN3_ONLY__
2022+#warning optimize this for uclibc
2023+#warning tailor for stub locale support
2024+#endif
2025+
2026+#ifndef __UCLIBC_HAS_XLOCALE__
2027+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2028+#endif
2029+
2030+namespace std
2031+{
2032+ // Construct and return valid pattern consisting of some combination of:
2033+ // space none symbol sign value
2034+ money_base::pattern
2035+ money_base::_S_construct_pattern(char __precedes, char __space, char __posn)
2036+ {
2037+ pattern __ret;
2038+
2039+ // This insanely complicated routine attempts to construct a valid
2040+ // pattern for use with monyepunct. A couple of invariants:
2041+
2042+ // if (__precedes) symbol -> value
2043+ // else value -> symbol
2044+
2045+ // if (__space) space
2046+ // else none
2047+
2048+ // none == never first
2049+ // space never first or last
2050+
2051+ // Any elegant implementations of this are welcome.
2052+ switch (__posn)
2053+ {
2054+ case 0:
2055+ case 1:
2056+ // 1 The sign precedes the value and symbol.
2057+ __ret.field[0] = sign;
2058+ if (__space)
2059+ {
2060+ // Pattern starts with sign.
2061+ if (__precedes)
2062+ {
2063+ __ret.field[1] = symbol;
2064+ __ret.field[3] = value;
2065+ }
2066+ else
2067+ {
2068+ __ret.field[1] = value;
2069+ __ret.field[3] = symbol;
2070+ }
2071+ __ret.field[2] = space;
2072+ }
2073+ else
2074+ {
2075+ // Pattern starts with sign and ends with none.
2076+ if (__precedes)
2077+ {
2078+ __ret.field[1] = symbol;
2079+ __ret.field[2] = value;
2080+ }
2081+ else
2082+ {
2083+ __ret.field[1] = value;
2084+ __ret.field[2] = symbol;
2085+ }
2086+ __ret.field[3] = none;
2087+ }
2088+ break;
2089+ case 2:
2090+ // 2 The sign follows the value and symbol.
2091+ if (__space)
2092+ {
2093+ // Pattern either ends with sign.
2094+ if (__precedes)
2095+ {
2096+ __ret.field[0] = symbol;
2097+ __ret.field[2] = value;
2098+ }
2099+ else
2100+ {
2101+ __ret.field[0] = value;
2102+ __ret.field[2] = symbol;
2103+ }
2104+ __ret.field[1] = space;
2105+ __ret.field[3] = sign;
2106+ }
2107+ else
2108+ {
2109+ // Pattern ends with sign then none.
2110+ if (__precedes)
2111+ {
2112+ __ret.field[0] = symbol;
2113+ __ret.field[1] = value;
2114+ }
2115+ else
2116+ {
2117+ __ret.field[0] = value;
2118+ __ret.field[1] = symbol;
2119+ }
2120+ __ret.field[2] = sign;
2121+ __ret.field[3] = none;
2122+ }
2123+ break;
2124+ case 3:
2125+ // 3 The sign immediately precedes the symbol.
2126+ if (__precedes)
2127+ {
2128+ __ret.field[0] = sign;
2129+ __ret.field[1] = symbol;
2130+ if (__space)
2131+ {
2132+ __ret.field[2] = space;
2133+ __ret.field[3] = value;
2134+ }
2135+ else
2136+ {
2137+ __ret.field[2] = value;
2138+ __ret.field[3] = none;
2139+ }
2140+ }
2141+ else
2142+ {
2143+ __ret.field[0] = value;
2144+ if (__space)
2145+ {
2146+ __ret.field[1] = space;
2147+ __ret.field[2] = sign;
2148+ __ret.field[3] = symbol;
2149+ }
2150+ else
2151+ {
2152+ __ret.field[1] = sign;
2153+ __ret.field[2] = symbol;
2154+ __ret.field[3] = none;
2155+ }
2156+ }
2157+ break;
2158+ case 4:
2159+ // 4 The sign immediately follows the symbol.
2160+ if (__precedes)
2161+ {
2162+ __ret.field[0] = symbol;
2163+ __ret.field[1] = sign;
2164+ if (__space)
2165+ {
2166+ __ret.field[2] = space;
2167+ __ret.field[3] = value;
2168+ }
2169+ else
2170+ {
2171+ __ret.field[2] = value;
2172+ __ret.field[3] = none;
2173+ }
2174+ }
2175+ else
2176+ {
2177+ __ret.field[0] = value;
2178+ if (__space)
2179+ {
2180+ __ret.field[1] = space;
2181+ __ret.field[2] = symbol;
2182+ __ret.field[3] = sign;
2183+ }
2184+ else
2185+ {
2186+ __ret.field[1] = symbol;
2187+ __ret.field[2] = sign;
2188+ __ret.field[3] = none;
2189+ }
2190+ }
2191+ break;
2192+ default:
2193+ __ret = pattern();
2194+ }
2195+ return __ret;
2196+ }
2197+
2198+ template<>
2199+ void
2200+ moneypunct<char, true>::_M_initialize_moneypunct(__c_locale __cloc,
2201+ const char*)
2202+ {
2203+ if (!_M_data)
2204+ _M_data = new __moneypunct_cache<char, true>;
2205+
2206+ if (!__cloc)
2207+ {
2208+ // "C" locale
2209+ _M_data->_M_decimal_point = '.';
2210+ _M_data->_M_thousands_sep = ',';
2211+ _M_data->_M_grouping = "";
2212+ _M_data->_M_grouping_size = 0;
2213+ _M_data->_M_curr_symbol = "";
2214+ _M_data->_M_curr_symbol_size = 0;
2215+ _M_data->_M_positive_sign = "";
2216+ _M_data->_M_positive_sign_size = 0;
2217+ _M_data->_M_negative_sign = "";
2218+ _M_data->_M_negative_sign_size = 0;
2219+ _M_data->_M_frac_digits = 0;
2220+ _M_data->_M_pos_format = money_base::_S_default_pattern;
2221+ _M_data->_M_neg_format = money_base::_S_default_pattern;
2222+
2223+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
2224+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
2225+ }
2226+ else
2227+ {
2228+ // Named locale.
2229+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
2230+ __cloc));
2231+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
2232+ __cloc));
2233+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
2234+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2235+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
2236+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
2237+
2238+ char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
2239+ if (!__nposn)
2240+ _M_data->_M_negative_sign = "()";
2241+ else
2242+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
2243+ __cloc);
2244+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
2245+
2246+ // _Intl == true
2247+ _M_data->_M_curr_symbol = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
2248+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
2249+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
2250+ __cloc));
2251+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
2252+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
2253+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
2254+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2255+ __pposn);
2256+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
2257+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
2258+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2259+ __nposn);
2260+ }
2261+ }
2262+
2263+ template<>
2264+ void
2265+ moneypunct<char, false>::_M_initialize_moneypunct(__c_locale __cloc,
2266+ const char*)
2267+ {
2268+ if (!_M_data)
2269+ _M_data = new __moneypunct_cache<char, false>;
2270+
2271+ if (!__cloc)
2272+ {
2273+ // "C" locale
2274+ _M_data->_M_decimal_point = '.';
2275+ _M_data->_M_thousands_sep = ',';
2276+ _M_data->_M_grouping = "";
2277+ _M_data->_M_grouping_size = 0;
2278+ _M_data->_M_curr_symbol = "";
2279+ _M_data->_M_curr_symbol_size = 0;
2280+ _M_data->_M_positive_sign = "";
2281+ _M_data->_M_positive_sign_size = 0;
2282+ _M_data->_M_negative_sign = "";
2283+ _M_data->_M_negative_sign_size = 0;
2284+ _M_data->_M_frac_digits = 0;
2285+ _M_data->_M_pos_format = money_base::_S_default_pattern;
2286+ _M_data->_M_neg_format = money_base::_S_default_pattern;
2287+
2288+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
2289+ _M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
2290+ }
2291+ else
2292+ {
2293+ // Named locale.
2294+ _M_data->_M_decimal_point = *(__nl_langinfo_l(__MON_DECIMAL_POINT,
2295+ __cloc));
2296+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(__MON_THOUSANDS_SEP,
2297+ __cloc));
2298+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
2299+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2300+ _M_data->_M_positive_sign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
2301+ _M_data->_M_positive_sign_size = strlen(_M_data->_M_positive_sign);
2302+
2303+ char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
2304+ if (!__nposn)
2305+ _M_data->_M_negative_sign = "()";
2306+ else
2307+ _M_data->_M_negative_sign = __nl_langinfo_l(__NEGATIVE_SIGN,
2308+ __cloc);
2309+ _M_data->_M_negative_sign_size = strlen(_M_data->_M_negative_sign);
2310+
2311+ // _Intl == false
2312+ _M_data->_M_curr_symbol = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
2313+ _M_data->_M_curr_symbol_size = strlen(_M_data->_M_curr_symbol);
2314+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2315+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2316+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2317+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2318+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2319+ __pposn);
2320+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2321+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2322+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2323+ __nposn);
2324+ }
2325+ }
2326+
2327+ template<>
2328+ moneypunct<char, true>::~moneypunct()
2329+ { delete _M_data; }
2330+
2331+ template<>
2332+ moneypunct<char, false>::~moneypunct()
2333+ { delete _M_data; }
2334+
2335+#ifdef _GLIBCXX_USE_WCHAR_T
2336+ template<>
2337+ void
2338+ moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale __cloc,
2339+#ifdef __UCLIBC_HAS_XLOCALE__
2340+ const char*)
2341+#else
2342+ const char* __name)
2343+#endif
2344+ {
2345+ if (!_M_data)
2346+ _M_data = new __moneypunct_cache<wchar_t, true>;
2347+
2348+ if (!__cloc)
2349+ {
2350+ // "C" locale
2351+ _M_data->_M_decimal_point = L'.';
2352+ _M_data->_M_thousands_sep = L',';
2353+ _M_data->_M_grouping = "";
2354+ _M_data->_M_grouping_size = 0;
2355+ _M_data->_M_curr_symbol = L"";
2356+ _M_data->_M_curr_symbol_size = 0;
2357+ _M_data->_M_positive_sign = L"";
2358+ _M_data->_M_positive_sign_size = 0;
2359+ _M_data->_M_negative_sign = L"";
2360+ _M_data->_M_negative_sign_size = 0;
2361+ _M_data->_M_frac_digits = 0;
2362+ _M_data->_M_pos_format = money_base::_S_default_pattern;
2363+ _M_data->_M_neg_format = money_base::_S_default_pattern;
2364+
2365+ // Use ctype::widen code without the facet...
2366+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
2367+ _M_data->_M_atoms[__i] =
2368+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
2369+ }
2370+ else
2371+ {
2372+ // Named locale.
2373+#ifdef __UCLIBC_HAS_XLOCALE__
2374+ __c_locale __old = __uselocale(__cloc);
2375+#else
2376+ // Switch to named locale so that mbsrtowcs will work.
2377+ char* __old = strdup(setlocale(LC_ALL, NULL));
2378+ setlocale(LC_ALL, __name);
2379+#endif
2380+
2381+#ifdef __UCLIBC_MJN3_ONLY__
2382+#warning fix this... should be monetary
2383+#endif
2384+#ifdef __UCLIBC__
2385+# ifdef __UCLIBC_HAS_XLOCALE__
2386+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2387+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2388+# elif defined __UCLIBC_HAS_LOCALE__
2389+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2390+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2391+# endif
2392+#else
2393+ union { char *__s; wchar_t __w; } __u;
2394+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
2395+ _M_data->_M_decimal_point = __u.__w;
2396+
2397+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
2398+ _M_data->_M_thousands_sep = __u.__w;
2399+#endif
2400+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
2401+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2402+
2403+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
2404+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
2405+ const char* __ccurr = __nl_langinfo_l(__INT_CURR_SYMBOL, __cloc);
2406+
2407+ wchar_t* __wcs_ps = 0;
2408+ wchar_t* __wcs_ns = 0;
2409+ const char __nposn = *(__nl_langinfo_l(__INT_N_SIGN_POSN, __cloc));
2410+ try
2411+ {
2412+ mbstate_t __state;
2413+ size_t __len = strlen(__cpossign);
2414+ if (__len)
2415+ {
2416+ ++__len;
2417+ memset(&__state, 0, sizeof(mbstate_t));
2418+ __wcs_ps = new wchar_t[__len];
2419+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
2420+ _M_data->_M_positive_sign = __wcs_ps;
2421+ }
2422+ else
2423+ _M_data->_M_positive_sign = L"";
2424+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
2425+
2426+ __len = strlen(__cnegsign);
2427+ if (!__nposn)
2428+ _M_data->_M_negative_sign = L"()";
2429+ else if (__len)
2430+ {
2431+ ++__len;
2432+ memset(&__state, 0, sizeof(mbstate_t));
2433+ __wcs_ns = new wchar_t[__len];
2434+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2435+ _M_data->_M_negative_sign = __wcs_ns;
2436+ }
2437+ else
2438+ _M_data->_M_negative_sign = L"";
2439+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2440+
2441+ // _Intl == true.
2442+ __len = strlen(__ccurr);
2443+ if (__len)
2444+ {
2445+ ++__len;
2446+ memset(&__state, 0, sizeof(mbstate_t));
2447+ wchar_t* __wcs = new wchar_t[__len];
2448+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2449+ _M_data->_M_curr_symbol = __wcs;
2450+ }
2451+ else
2452+ _M_data->_M_curr_symbol = L"";
2453+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2454+ }
2455+ catch (...)
2456+ {
2457+ delete _M_data;
2458+ _M_data = 0;
2459+ delete __wcs_ps;
2460+ delete __wcs_ns;
2461+#ifdef __UCLIBC_HAS_XLOCALE__
2462+ __uselocale(__old);
2463+#else
2464+ setlocale(LC_ALL, __old);
2465+ free(__old);
2466+#endif
2467+ __throw_exception_again;
2468+ }
2469+
2470+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__INT_FRAC_DIGITS,
2471+ __cloc));
2472+ char __pprecedes = *(__nl_langinfo_l(__INT_P_CS_PRECEDES, __cloc));
2473+ char __pspace = *(__nl_langinfo_l(__INT_P_SEP_BY_SPACE, __cloc));
2474+ char __pposn = *(__nl_langinfo_l(__INT_P_SIGN_POSN, __cloc));
2475+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2476+ __pposn);
2477+ char __nprecedes = *(__nl_langinfo_l(__INT_N_CS_PRECEDES, __cloc));
2478+ char __nspace = *(__nl_langinfo_l(__INT_N_SEP_BY_SPACE, __cloc));
2479+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2480+ __nposn);
2481+
2482+#ifdef __UCLIBC_HAS_XLOCALE__
2483+ __uselocale(__old);
2484+#else
2485+ setlocale(LC_ALL, __old);
2486+ free(__old);
2487+#endif
2488+ }
2489+ }
2490+
2491+ template<>
2492+ void
2493+ moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale __cloc,
2494+#ifdef __UCLIBC_HAS_XLOCALE__
2495+ const char*)
2496+#else
2497+ const char* __name)
2498+#endif
2499+ {
2500+ if (!_M_data)
2501+ _M_data = new __moneypunct_cache<wchar_t, false>;
2502+
2503+ if (!__cloc)
2504+ {
2505+ // "C" locale
2506+ _M_data->_M_decimal_point = L'.';
2507+ _M_data->_M_thousands_sep = L',';
2508+ _M_data->_M_grouping = "";
2509+ _M_data->_M_grouping_size = 0;
2510+ _M_data->_M_curr_symbol = L"";
2511+ _M_data->_M_curr_symbol_size = 0;
2512+ _M_data->_M_positive_sign = L"";
2513+ _M_data->_M_positive_sign_size = 0;
2514+ _M_data->_M_negative_sign = L"";
2515+ _M_data->_M_negative_sign_size = 0;
2516+ _M_data->_M_frac_digits = 0;
2517+ _M_data->_M_pos_format = money_base::_S_default_pattern;
2518+ _M_data->_M_neg_format = money_base::_S_default_pattern;
2519+
2520+ // Use ctype::widen code without the facet...
2521+ for (size_t __i = 0; __i < money_base::_S_end; ++__i)
2522+ _M_data->_M_atoms[__i] =
2523+ static_cast<wchar_t>(money_base::_S_atoms[__i]);
2524+ }
2525+ else
2526+ {
2527+ // Named locale.
2528+#ifdef __UCLIBC_HAS_XLOCALE__
2529+ __c_locale __old = __uselocale(__cloc);
2530+#else
2531+ // Switch to named locale so that mbsrtowcs will work.
2532+ char* __old = strdup(setlocale(LC_ALL, NULL));
2533+ setlocale(LC_ALL, __name);
2534+#endif
2535+
2536+#ifdef __UCLIBC_MJN3_ONLY__
2537+#warning fix this... should be monetary
2538+#endif
2539+#ifdef __UCLIBC__
2540+# ifdef __UCLIBC_HAS_XLOCALE__
2541+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2542+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2543+# elif defined __UCLIBC_HAS_LOCALE__
2544+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2545+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2546+# endif
2547+#else
2548+ union { char *__s; wchar_t __w; } __u;
2549+ __u.__s = __nl_langinfo_l(_NL_MONETARY_DECIMAL_POINT_WC, __cloc);
2550+ _M_data->_M_decimal_point = __u.__w;
2551+
2552+ __u.__s = __nl_langinfo_l(_NL_MONETARY_THOUSANDS_SEP_WC, __cloc);
2553+ _M_data->_M_thousands_sep = __u.__w;
2554+#endif
2555+ _M_data->_M_grouping = __nl_langinfo_l(__MON_GROUPING, __cloc);
2556+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2557+
2558+ const char* __cpossign = __nl_langinfo_l(__POSITIVE_SIGN, __cloc);
2559+ const char* __cnegsign = __nl_langinfo_l(__NEGATIVE_SIGN, __cloc);
2560+ const char* __ccurr = __nl_langinfo_l(__CURRENCY_SYMBOL, __cloc);
2561+
2562+ wchar_t* __wcs_ps = 0;
2563+ wchar_t* __wcs_ns = 0;
2564+ const char __nposn = *(__nl_langinfo_l(__N_SIGN_POSN, __cloc));
2565+ try
2566+ {
2567+ mbstate_t __state;
2568+ size_t __len;
2569+ __len = strlen(__cpossign);
2570+ if (__len)
2571+ {
2572+ ++__len;
2573+ memset(&__state, 0, sizeof(mbstate_t));
2574+ __wcs_ps = new wchar_t[__len];
2575+ mbsrtowcs(__wcs_ps, &__cpossign, __len, &__state);
2576+ _M_data->_M_positive_sign = __wcs_ps;
2577+ }
2578+ else
2579+ _M_data->_M_positive_sign = L"";
2580+ _M_data->_M_positive_sign_size = wcslen(_M_data->_M_positive_sign);
2581+
2582+ __len = strlen(__cnegsign);
2583+ if (!__nposn)
2584+ _M_data->_M_negative_sign = L"()";
2585+ else if (__len)
2586+ {
2587+ ++__len;
2588+ memset(&__state, 0, sizeof(mbstate_t));
2589+ __wcs_ns = new wchar_t[__len];
2590+ mbsrtowcs(__wcs_ns, &__cnegsign, __len, &__state);
2591+ _M_data->_M_negative_sign = __wcs_ns;
2592+ }
2593+ else
2594+ _M_data->_M_negative_sign = L"";
2595+ _M_data->_M_negative_sign_size = wcslen(_M_data->_M_negative_sign);
2596+
2597+ // _Intl == true.
2598+ __len = strlen(__ccurr);
2599+ if (__len)
2600+ {
2601+ ++__len;
2602+ memset(&__state, 0, sizeof(mbstate_t));
2603+ wchar_t* __wcs = new wchar_t[__len];
2604+ mbsrtowcs(__wcs, &__ccurr, __len, &__state);
2605+ _M_data->_M_curr_symbol = __wcs;
2606+ }
2607+ else
2608+ _M_data->_M_curr_symbol = L"";
2609+ _M_data->_M_curr_symbol_size = wcslen(_M_data->_M_curr_symbol);
2610+ }
2611+ catch (...)
2612+ {
2613+ delete _M_data;
2614+ _M_data = 0;
2615+ delete __wcs_ps;
2616+ delete __wcs_ns;
2617+#ifdef __UCLIBC_HAS_XLOCALE__
2618+ __uselocale(__old);
2619+#else
2620+ setlocale(LC_ALL, __old);
2621+ free(__old);
2622+#endif
2623+ __throw_exception_again;
2624+ }
2625+
2626+ _M_data->_M_frac_digits = *(__nl_langinfo_l(__FRAC_DIGITS, __cloc));
2627+ char __pprecedes = *(__nl_langinfo_l(__P_CS_PRECEDES, __cloc));
2628+ char __pspace = *(__nl_langinfo_l(__P_SEP_BY_SPACE, __cloc));
2629+ char __pposn = *(__nl_langinfo_l(__P_SIGN_POSN, __cloc));
2630+ _M_data->_M_pos_format = _S_construct_pattern(__pprecedes, __pspace,
2631+ __pposn);
2632+ char __nprecedes = *(__nl_langinfo_l(__N_CS_PRECEDES, __cloc));
2633+ char __nspace = *(__nl_langinfo_l(__N_SEP_BY_SPACE, __cloc));
2634+ _M_data->_M_neg_format = _S_construct_pattern(__nprecedes, __nspace,
2635+ __nposn);
2636+
2637+#ifdef __UCLIBC_HAS_XLOCALE__
2638+ __uselocale(__old);
2639+#else
2640+ setlocale(LC_ALL, __old);
2641+ free(__old);
2642+#endif
2643+ }
2644+ }
2645+
2646+ template<>
2647+ moneypunct<wchar_t, true>::~moneypunct()
2648+ {
2649+ if (_M_data->_M_positive_sign_size)
2650+ delete [] _M_data->_M_positive_sign;
2651+ if (_M_data->_M_negative_sign_size
2652+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2653+ delete [] _M_data->_M_negative_sign;
2654+ if (_M_data->_M_curr_symbol_size)
2655+ delete [] _M_data->_M_curr_symbol;
2656+ delete _M_data;
2657+ }
2658+
2659+ template<>
2660+ moneypunct<wchar_t, false>::~moneypunct()
2661+ {
2662+ if (_M_data->_M_positive_sign_size)
2663+ delete [] _M_data->_M_positive_sign;
2664+ if (_M_data->_M_negative_sign_size
2665+ && wcscmp(_M_data->_M_negative_sign, L"()") != 0)
2666+ delete [] _M_data->_M_negative_sign;
2667+ if (_M_data->_M_curr_symbol_size)
2668+ delete [] _M_data->_M_curr_symbol;
2669+ delete _M_data;
2670+ }
2671+#endif
2672+}
[0602db2]2673diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc
2674--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/numeric_members.cc 1969-12-31 16:00:00.000000000 -0800
2675+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/numeric_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]2676@@ -0,0 +1,173 @@
2677+// std::numpunct implementation details, GNU version -*- C++ -*-
2678+
2679+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2680+//
2681+// This file is part of the GNU ISO C++ Library. This library is free
2682+// software; you can redistribute it and/or modify it under the
2683+// terms of the GNU General Public License as published by the
2684+// Free Software Foundation; either version 2, or (at your option)
2685+// any later version.
2686+
2687+// This library is distributed in the hope that it will be useful,
2688+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2689+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2690+// GNU General Public License for more details.
2691+
2692+// You should have received a copy of the GNU General Public License along
2693+// with this library; see the file COPYING. If not, write to the Free
2694+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2695+// USA.
2696+
2697+// As a special exception, you may use this file as part of a free software
2698+// library without restriction. Specifically, if other files instantiate
2699+// templates or use macros or inline functions from this file, or you compile
2700+// this file and link it with other files to produce an executable, this
2701+// file does not by itself cause the resulting executable to be covered by
2702+// the GNU General Public License. This exception does not however
2703+// invalidate any other reasons why the executable file might be covered by
2704+// the GNU General Public License.
2705+
2706+//
2707+// ISO C++ 14882: 22.2.3.1.2 numpunct virtual functions
2708+//
2709+
2710+// Written by Benjamin Kosnik <bkoz@redhat.com>
2711+
2712+#define _LIBC
2713+#include <locale>
2714+#undef _LIBC
2715+#include <bits/c++locale_internal.h>
2716+
2717+#ifdef __UCLIBC_MJN3_ONLY__
2718+#warning tailor for stub locale support
2719+#endif
2720+#ifndef __UCLIBC_HAS_XLOCALE__
2721+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2722+#endif
2723+
2724+namespace std
2725+{
2726+ template<>
2727+ void
2728+ numpunct<char>::_M_initialize_numpunct(__c_locale __cloc)
2729+ {
2730+ if (!_M_data)
2731+ _M_data = new __numpunct_cache<char>;
2732+
2733+ if (!__cloc)
2734+ {
2735+ // "C" locale
2736+ _M_data->_M_grouping = "";
2737+ _M_data->_M_grouping_size = 0;
2738+ _M_data->_M_use_grouping = false;
2739+
2740+ _M_data->_M_decimal_point = '.';
2741+ _M_data->_M_thousands_sep = ',';
2742+
2743+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2744+ _M_data->_M_atoms_out[__i] = __num_base::_S_atoms_out[__i];
2745+
2746+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2747+ _M_data->_M_atoms_in[__j] = __num_base::_S_atoms_in[__j];
2748+ }
2749+ else
2750+ {
2751+ // Named locale.
2752+ _M_data->_M_decimal_point = *(__nl_langinfo_l(DECIMAL_POINT,
2753+ __cloc));
2754+ _M_data->_M_thousands_sep = *(__nl_langinfo_l(THOUSANDS_SEP,
2755+ __cloc));
2756+
2757+ // Check for NULL, which implies no grouping.
2758+ if (_M_data->_M_thousands_sep == '\0')
2759+ _M_data->_M_grouping = "";
2760+ else
2761+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2762+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2763+ }
2764+
2765+ // NB: There is no way to extact this info from posix locales.
2766+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2767+ _M_data->_M_truename = "true";
2768+ _M_data->_M_truename_size = 4;
2769+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2770+ _M_data->_M_falsename = "false";
2771+ _M_data->_M_falsename_size = 5;
2772+ }
2773+
2774+ template<>
2775+ numpunct<char>::~numpunct()
2776+ { delete _M_data; }
2777+
2778+#ifdef _GLIBCXX_USE_WCHAR_T
2779+ template<>
2780+ void
2781+ numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc)
2782+ {
2783+ if (!_M_data)
2784+ _M_data = new __numpunct_cache<wchar_t>;
2785+
2786+ if (!__cloc)
2787+ {
2788+ // "C" locale
2789+ _M_data->_M_grouping = "";
2790+ _M_data->_M_grouping_size = 0;
2791+ _M_data->_M_use_grouping = false;
2792+
2793+ _M_data->_M_decimal_point = L'.';
2794+ _M_data->_M_thousands_sep = L',';
2795+
2796+ // Use ctype::widen code without the facet...
2797+ for (size_t __i = 0; __i < __num_base::_S_oend; ++__i)
2798+ _M_data->_M_atoms_out[__i] =
2799+ static_cast<wchar_t>(__num_base::_S_atoms_out[__i]);
2800+
2801+ for (size_t __j = 0; __j < __num_base::_S_iend; ++__j)
2802+ _M_data->_M_atoms_in[__j] =
2803+ static_cast<wchar_t>(__num_base::_S_atoms_in[__j]);
2804+ }
2805+ else
2806+ {
2807+ // Named locale.
2808+ // NB: In the GNU model wchar_t is always 32 bit wide.
2809+#ifdef __UCLIBC_MJN3_ONLY__
2810+#warning fix this
2811+#endif
2812+#ifdef __UCLIBC__
2813+# ifdef __UCLIBC_HAS_XLOCALE__
2814+ _M_data->_M_decimal_point = __cloc->decimal_point_wc;
2815+ _M_data->_M_thousands_sep = __cloc->thousands_sep_wc;
2816+# elif defined __UCLIBC_HAS_LOCALE__
2817+ _M_data->_M_decimal_point = __global_locale->decimal_point_wc;
2818+ _M_data->_M_thousands_sep = __global_locale->thousands_sep_wc;
2819+# endif
2820+#else
2821+ union { char *__s; wchar_t __w; } __u;
2822+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc);
2823+ _M_data->_M_decimal_point = __u.__w;
2824+
2825+ __u.__s = __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc);
2826+ _M_data->_M_thousands_sep = __u.__w;
2827+#endif
2828+
2829+ if (_M_data->_M_thousands_sep == L'\0')
2830+ _M_data->_M_grouping = "";
2831+ else
2832+ _M_data->_M_grouping = __nl_langinfo_l(GROUPING, __cloc);
2833+ _M_data->_M_grouping_size = strlen(_M_data->_M_grouping);
2834+ }
2835+
2836+ // NB: There is no way to extact this info from posix locales.
2837+ // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
2838+ _M_data->_M_truename = L"true";
2839+ _M_data->_M_truename_size = 4;
2840+ // _M_falsename = __nl_langinfo_l(NOSTR, __cloc);
2841+ _M_data->_M_falsename = L"false";
2842+ _M_data->_M_falsename_size = 5;
2843+ }
2844+
2845+ template<>
2846+ numpunct<wchar_t>::~numpunct()
2847+ { delete _M_data; }
2848+ #endif
2849+}
[0602db2]2850diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.cc gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.cc
2851--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.cc 1969-12-31 16:00:00.000000000 -0800
2852+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.cc 2007-02-14 07:57:37.000000000 -0800
[841271e]2853@@ -0,0 +1,406 @@
2854+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
2855+
2856+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
2857+//
2858+// This file is part of the GNU ISO C++ Library. This library is free
2859+// software; you can redistribute it and/or modify it under the
2860+// terms of the GNU General Public License as published by the
2861+// Free Software Foundation; either version 2, or (at your option)
2862+// any later version.
2863+
2864+// This library is distributed in the hope that it will be useful,
2865+// but WITHOUT ANY WARRANTY; without even the implied warranty of
2866+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2867+// GNU General Public License for more details.
2868+
2869+// You should have received a copy of the GNU General Public License along
2870+// with this library; see the file COPYING. If not, write to the Free
2871+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2872+// USA.
2873+
2874+// As a special exception, you may use this file as part of a free software
2875+// library without restriction. Specifically, if other files instantiate
2876+// templates or use macros or inline functions from this file, or you compile
2877+// this file and link it with other files to produce an executable, this
2878+// file does not by itself cause the resulting executable to be covered by
2879+// the GNU General Public License. This exception does not however
2880+// invalidate any other reasons why the executable file might be covered by
2881+// the GNU General Public License.
2882+
2883+//
2884+// ISO C++ 14882: 22.2.5.1.2 - time_get virtual functions
2885+// ISO C++ 14882: 22.2.5.3.2 - time_put virtual functions
2886+//
2887+
2888+// Written by Benjamin Kosnik <bkoz@redhat.com>
2889+
2890+#include <locale>
2891+#include <bits/c++locale_internal.h>
2892+
2893+#ifdef __UCLIBC_MJN3_ONLY__
2894+#warning tailor for stub locale support
2895+#endif
2896+#ifndef __UCLIBC_HAS_XLOCALE__
2897+#define __nl_langinfo_l(N, L) nl_langinfo((N))
2898+#endif
2899+
2900+namespace std
2901+{
2902+ template<>
2903+ void
2904+ __timepunct<char>::
2905+ _M_put(char* __s, size_t __maxlen, const char* __format,
2906+ const tm* __tm) const
2907+ {
2908+#ifdef __UCLIBC_HAS_XLOCALE__
2909+ const size_t __len = __strftime_l(__s, __maxlen, __format, __tm,
2910+ _M_c_locale_timepunct);
2911+#else
2912+ char* __old = strdup(setlocale(LC_ALL, NULL));
2913+ setlocale(LC_ALL, _M_name_timepunct);
2914+ const size_t __len = strftime(__s, __maxlen, __format, __tm);
2915+ setlocale(LC_ALL, __old);
2916+ free(__old);
2917+#endif
2918+ // Make sure __s is null terminated.
2919+ if (__len == 0)
2920+ __s[0] = '\0';
2921+ }
2922+
2923+ template<>
2924+ void
2925+ __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc)
2926+ {
2927+ if (!_M_data)
2928+ _M_data = new __timepunct_cache<char>;
2929+
2930+ if (!__cloc)
2931+ {
2932+ // "C" locale
2933+ _M_c_locale_timepunct = _S_get_c_locale();
2934+
2935+ _M_data->_M_date_format = "%m/%d/%y";
2936+ _M_data->_M_date_era_format = "%m/%d/%y";
2937+ _M_data->_M_time_format = "%H:%M:%S";
2938+ _M_data->_M_time_era_format = "%H:%M:%S";
2939+ _M_data->_M_date_time_format = "";
2940+ _M_data->_M_date_time_era_format = "";
2941+ _M_data->_M_am = "AM";
2942+ _M_data->_M_pm = "PM";
2943+ _M_data->_M_am_pm_format = "";
2944+
2945+ // Day names, starting with "C"'s Sunday.
2946+ _M_data->_M_day1 = "Sunday";
2947+ _M_data->_M_day2 = "Monday";
2948+ _M_data->_M_day3 = "Tuesday";
2949+ _M_data->_M_day4 = "Wednesday";
2950+ _M_data->_M_day5 = "Thursday";
2951+ _M_data->_M_day6 = "Friday";
2952+ _M_data->_M_day7 = "Saturday";
2953+
2954+ // Abbreviated day names, starting with "C"'s Sun.
2955+ _M_data->_M_aday1 = "Sun";
2956+ _M_data->_M_aday2 = "Mon";
2957+ _M_data->_M_aday3 = "Tue";
2958+ _M_data->_M_aday4 = "Wed";
2959+ _M_data->_M_aday5 = "Thu";
2960+ _M_data->_M_aday6 = "Fri";
2961+ _M_data->_M_aday7 = "Sat";
2962+
2963+ // Month names, starting with "C"'s January.
2964+ _M_data->_M_month01 = "January";
2965+ _M_data->_M_month02 = "February";
2966+ _M_data->_M_month03 = "March";
2967+ _M_data->_M_month04 = "April";
2968+ _M_data->_M_month05 = "May";
2969+ _M_data->_M_month06 = "June";
2970+ _M_data->_M_month07 = "July";
2971+ _M_data->_M_month08 = "August";
2972+ _M_data->_M_month09 = "September";
2973+ _M_data->_M_month10 = "October";
2974+ _M_data->_M_month11 = "November";
2975+ _M_data->_M_month12 = "December";
2976+
2977+ // Abbreviated month names, starting with "C"'s Jan.
2978+ _M_data->_M_amonth01 = "Jan";
2979+ _M_data->_M_amonth02 = "Feb";
2980+ _M_data->_M_amonth03 = "Mar";
2981+ _M_data->_M_amonth04 = "Apr";
2982+ _M_data->_M_amonth05 = "May";
2983+ _M_data->_M_amonth06 = "Jun";
2984+ _M_data->_M_amonth07 = "Jul";
2985+ _M_data->_M_amonth08 = "Aug";
2986+ _M_data->_M_amonth09 = "Sep";
2987+ _M_data->_M_amonth10 = "Oct";
2988+ _M_data->_M_amonth11 = "Nov";
2989+ _M_data->_M_amonth12 = "Dec";
2990+ }
2991+ else
2992+ {
2993+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
2994+
2995+ _M_data->_M_date_format = __nl_langinfo_l(D_FMT, __cloc);
2996+ _M_data->_M_date_era_format = __nl_langinfo_l(ERA_D_FMT, __cloc);
2997+ _M_data->_M_time_format = __nl_langinfo_l(T_FMT, __cloc);
2998+ _M_data->_M_time_era_format = __nl_langinfo_l(ERA_T_FMT, __cloc);
2999+ _M_data->_M_date_time_format = __nl_langinfo_l(D_T_FMT, __cloc);
3000+ _M_data->_M_date_time_era_format = __nl_langinfo_l(ERA_D_T_FMT,
3001+ __cloc);
3002+ _M_data->_M_am = __nl_langinfo_l(AM_STR, __cloc);
3003+ _M_data->_M_pm = __nl_langinfo_l(PM_STR, __cloc);
3004+ _M_data->_M_am_pm_format = __nl_langinfo_l(T_FMT_AMPM, __cloc);
3005+
3006+ // Day names, starting with "C"'s Sunday.
3007+ _M_data->_M_day1 = __nl_langinfo_l(DAY_1, __cloc);
3008+ _M_data->_M_day2 = __nl_langinfo_l(DAY_2, __cloc);
3009+ _M_data->_M_day3 = __nl_langinfo_l(DAY_3, __cloc);
3010+ _M_data->_M_day4 = __nl_langinfo_l(DAY_4, __cloc);
3011+ _M_data->_M_day5 = __nl_langinfo_l(DAY_5, __cloc);
3012+ _M_data->_M_day6 = __nl_langinfo_l(DAY_6, __cloc);
3013+ _M_data->_M_day7 = __nl_langinfo_l(DAY_7, __cloc);
3014+
3015+ // Abbreviated day names, starting with "C"'s Sun.
3016+ _M_data->_M_aday1 = __nl_langinfo_l(ABDAY_1, __cloc);
3017+ _M_data->_M_aday2 = __nl_langinfo_l(ABDAY_2, __cloc);
3018+ _M_data->_M_aday3 = __nl_langinfo_l(ABDAY_3, __cloc);
3019+ _M_data->_M_aday4 = __nl_langinfo_l(ABDAY_4, __cloc);
3020+ _M_data->_M_aday5 = __nl_langinfo_l(ABDAY_5, __cloc);
3021+ _M_data->_M_aday6 = __nl_langinfo_l(ABDAY_6, __cloc);
3022+ _M_data->_M_aday7 = __nl_langinfo_l(ABDAY_7, __cloc);
3023+
3024+ // Month names, starting with "C"'s January.
3025+ _M_data->_M_month01 = __nl_langinfo_l(MON_1, __cloc);
3026+ _M_data->_M_month02 = __nl_langinfo_l(MON_2, __cloc);
3027+ _M_data->_M_month03 = __nl_langinfo_l(MON_3, __cloc);
3028+ _M_data->_M_month04 = __nl_langinfo_l(MON_4, __cloc);
3029+ _M_data->_M_month05 = __nl_langinfo_l(MON_5, __cloc);
3030+ _M_data->_M_month06 = __nl_langinfo_l(MON_6, __cloc);
3031+ _M_data->_M_month07 = __nl_langinfo_l(MON_7, __cloc);
3032+ _M_data->_M_month08 = __nl_langinfo_l(MON_8, __cloc);
3033+ _M_data->_M_month09 = __nl_langinfo_l(MON_9, __cloc);
3034+ _M_data->_M_month10 = __nl_langinfo_l(MON_10, __cloc);
3035+ _M_data->_M_month11 = __nl_langinfo_l(MON_11, __cloc);
3036+ _M_data->_M_month12 = __nl_langinfo_l(MON_12, __cloc);
3037+
3038+ // Abbreviated month names, starting with "C"'s Jan.
3039+ _M_data->_M_amonth01 = __nl_langinfo_l(ABMON_1, __cloc);
3040+ _M_data->_M_amonth02 = __nl_langinfo_l(ABMON_2, __cloc);
3041+ _M_data->_M_amonth03 = __nl_langinfo_l(ABMON_3, __cloc);
3042+ _M_data->_M_amonth04 = __nl_langinfo_l(ABMON_4, __cloc);
3043+ _M_data->_M_amonth05 = __nl_langinfo_l(ABMON_5, __cloc);
3044+ _M_data->_M_amonth06 = __nl_langinfo_l(ABMON_6, __cloc);
3045+ _M_data->_M_amonth07 = __nl_langinfo_l(ABMON_7, __cloc);
3046+ _M_data->_M_amonth08 = __nl_langinfo_l(ABMON_8, __cloc);
3047+ _M_data->_M_amonth09 = __nl_langinfo_l(ABMON_9, __cloc);
3048+ _M_data->_M_amonth10 = __nl_langinfo_l(ABMON_10, __cloc);
3049+ _M_data->_M_amonth11 = __nl_langinfo_l(ABMON_11, __cloc);
3050+ _M_data->_M_amonth12 = __nl_langinfo_l(ABMON_12, __cloc);
3051+ }
3052+ }
3053+
3054+#ifdef _GLIBCXX_USE_WCHAR_T
3055+ template<>
3056+ void
3057+ __timepunct<wchar_t>::
3058+ _M_put(wchar_t* __s, size_t __maxlen, const wchar_t* __format,
3059+ const tm* __tm) const
3060+ {
3061+#ifdef __UCLIBC_HAS_XLOCALE__
3062+ __wcsftime_l(__s, __maxlen, __format, __tm, _M_c_locale_timepunct);
3063+ const size_t __len = __wcsftime_l(__s, __maxlen, __format, __tm,
3064+ _M_c_locale_timepunct);
3065+#else
3066+ char* __old = strdup(setlocale(LC_ALL, NULL));
3067+ setlocale(LC_ALL, _M_name_timepunct);
3068+ const size_t __len = wcsftime(__s, __maxlen, __format, __tm);
3069+ setlocale(LC_ALL, __old);
3070+ free(__old);
3071+#endif
3072+ // Make sure __s is null terminated.
3073+ if (__len == 0)
3074+ __s[0] = L'\0';
3075+ }
3076+
3077+ template<>
3078+ void
3079+ __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc)
3080+ {
3081+ if (!_M_data)
3082+ _M_data = new __timepunct_cache<wchar_t>;
3083+
3084+#warning wide time stuff
3085+// if (!__cloc)
3086+ {
3087+ // "C" locale
3088+ _M_c_locale_timepunct = _S_get_c_locale();
3089+
3090+ _M_data->_M_date_format = L"%m/%d/%y";
3091+ _M_data->_M_date_era_format = L"%m/%d/%y";
3092+ _M_data->_M_time_format = L"%H:%M:%S";
3093+ _M_data->_M_time_era_format = L"%H:%M:%S";
3094+ _M_data->_M_date_time_format = L"";
3095+ _M_data->_M_date_time_era_format = L"";
3096+ _M_data->_M_am = L"AM";
3097+ _M_data->_M_pm = L"PM";
3098+ _M_data->_M_am_pm_format = L"";
3099+
3100+ // Day names, starting with "C"'s Sunday.
3101+ _M_data->_M_day1 = L"Sunday";
3102+ _M_data->_M_day2 = L"Monday";
3103+ _M_data->_M_day3 = L"Tuesday";
3104+ _M_data->_M_day4 = L"Wednesday";
3105+ _M_data->_M_day5 = L"Thursday";
3106+ _M_data->_M_day6 = L"Friday";
3107+ _M_data->_M_day7 = L"Saturday";
3108+
3109+ // Abbreviated day names, starting with "C"'s Sun.
3110+ _M_data->_M_aday1 = L"Sun";
3111+ _M_data->_M_aday2 = L"Mon";
3112+ _M_data->_M_aday3 = L"Tue";
3113+ _M_data->_M_aday4 = L"Wed";
3114+ _M_data->_M_aday5 = L"Thu";
3115+ _M_data->_M_aday6 = L"Fri";
3116+ _M_data->_M_aday7 = L"Sat";
3117+
3118+ // Month names, starting with "C"'s January.
3119+ _M_data->_M_month01 = L"January";
3120+ _M_data->_M_month02 = L"February";
3121+ _M_data->_M_month03 = L"March";
3122+ _M_data->_M_month04 = L"April";
3123+ _M_data->_M_month05 = L"May";
3124+ _M_data->_M_month06 = L"June";
3125+ _M_data->_M_month07 = L"July";
3126+ _M_data->_M_month08 = L"August";
3127+ _M_data->_M_month09 = L"September";
3128+ _M_data->_M_month10 = L"October";
3129+ _M_data->_M_month11 = L"November";
3130+ _M_data->_M_month12 = L"December";
3131+
3132+ // Abbreviated month names, starting with "C"'s Jan.
3133+ _M_data->_M_amonth01 = L"Jan";
3134+ _M_data->_M_amonth02 = L"Feb";
3135+ _M_data->_M_amonth03 = L"Mar";
3136+ _M_data->_M_amonth04 = L"Apr";
3137+ _M_data->_M_amonth05 = L"May";
3138+ _M_data->_M_amonth06 = L"Jun";
3139+ _M_data->_M_amonth07 = L"Jul";
3140+ _M_data->_M_amonth08 = L"Aug";
3141+ _M_data->_M_amonth09 = L"Sep";
3142+ _M_data->_M_amonth10 = L"Oct";
3143+ _M_data->_M_amonth11 = L"Nov";
3144+ _M_data->_M_amonth12 = L"Dec";
3145+ }
3146+#if 0
3147+ else
3148+ {
3149+ _M_c_locale_timepunct = _S_clone_c_locale(__cloc);
3150+
3151+ union { char *__s; wchar_t *__w; } __u;
3152+
3153+ __u.__s = __nl_langinfo_l(_NL_WD_FMT, __cloc);
3154+ _M_data->_M_date_format = __u.__w;
3155+ __u.__s = __nl_langinfo_l(_NL_WERA_D_FMT, __cloc);
3156+ _M_data->_M_date_era_format = __u.__w;
3157+ __u.__s = __nl_langinfo_l(_NL_WT_FMT, __cloc);
3158+ _M_data->_M_time_format = __u.__w;
3159+ __u.__s = __nl_langinfo_l(_NL_WERA_T_FMT, __cloc);
3160+ _M_data->_M_time_era_format = __u.__w;
3161+ __u.__s = __nl_langinfo_l(_NL_WD_T_FMT, __cloc);
3162+ _M_data->_M_date_time_format = __u.__w;
3163+ __u.__s = __nl_langinfo_l(_NL_WERA_D_T_FMT, __cloc);
3164+ _M_data->_M_date_time_era_format = __u.__w;
3165+ __u.__s = __nl_langinfo_l(_NL_WAM_STR, __cloc);
3166+ _M_data->_M_am = __u.__w;
3167+ __u.__s = __nl_langinfo_l(_NL_WPM_STR, __cloc);
3168+ _M_data->_M_pm = __u.__w;
3169+ __u.__s = __nl_langinfo_l(_NL_WT_FMT_AMPM, __cloc);
3170+ _M_data->_M_am_pm_format = __u.__w;
3171+
3172+ // Day names, starting with "C"'s Sunday.
3173+ __u.__s = __nl_langinfo_l(_NL_WDAY_1, __cloc);
3174+ _M_data->_M_day1 = __u.__w;
3175+ __u.__s = __nl_langinfo_l(_NL_WDAY_2, __cloc);
3176+ _M_data->_M_day2 = __u.__w;
3177+ __u.__s = __nl_langinfo_l(_NL_WDAY_3, __cloc);
3178+ _M_data->_M_day3 = __u.__w;
3179+ __u.__s = __nl_langinfo_l(_NL_WDAY_4, __cloc);
3180+ _M_data->_M_day4 = __u.__w;
3181+ __u.__s = __nl_langinfo_l(_NL_WDAY_5, __cloc);
3182+ _M_data->_M_day5 = __u.__w;
3183+ __u.__s = __nl_langinfo_l(_NL_WDAY_6, __cloc);
3184+ _M_data->_M_day6 = __u.__w;
3185+ __u.__s = __nl_langinfo_l(_NL_WDAY_7, __cloc);
3186+ _M_data->_M_day7 = __u.__w;
3187+
3188+ // Abbreviated day names, starting with "C"'s Sun.
3189+ __u.__s = __nl_langinfo_l(_NL_WABDAY_1, __cloc);
3190+ _M_data->_M_aday1 = __u.__w;
3191+ __u.__s = __nl_langinfo_l(_NL_WABDAY_2, __cloc);
3192+ _M_data->_M_aday2 = __u.__w;
3193+ __u.__s = __nl_langinfo_l(_NL_WABDAY_3, __cloc);
3194+ _M_data->_M_aday3 = __u.__w;
3195+ __u.__s = __nl_langinfo_l(_NL_WABDAY_4, __cloc);
3196+ _M_data->_M_aday4 = __u.__w;
3197+ __u.__s = __nl_langinfo_l(_NL_WABDAY_5, __cloc);
3198+ _M_data->_M_aday5 = __u.__w;
3199+ __u.__s = __nl_langinfo_l(_NL_WABDAY_6, __cloc);
3200+ _M_data->_M_aday6 = __u.__w;
3201+ __u.__s = __nl_langinfo_l(_NL_WABDAY_7, __cloc);
3202+ _M_data->_M_aday7 = __u.__w;
3203+
3204+ // Month names, starting with "C"'s January.
3205+ __u.__s = __nl_langinfo_l(_NL_WMON_1, __cloc);
3206+ _M_data->_M_month01 = __u.__w;
3207+ __u.__s = __nl_langinfo_l(_NL_WMON_2, __cloc);
3208+ _M_data->_M_month02 = __u.__w;
3209+ __u.__s = __nl_langinfo_l(_NL_WMON_3, __cloc);
3210+ _M_data->_M_month03 = __u.__w;
3211+ __u.__s = __nl_langinfo_l(_NL_WMON_4, __cloc);
3212+ _M_data->_M_month04 = __u.__w;
3213+ __u.__s = __nl_langinfo_l(_NL_WMON_5, __cloc);
3214+ _M_data->_M_month05 = __u.__w;
3215+ __u.__s = __nl_langinfo_l(_NL_WMON_6, __cloc);
3216+ _M_data->_M_month06 = __u.__w;
3217+ __u.__s = __nl_langinfo_l(_NL_WMON_7, __cloc);
3218+ _M_data->_M_month07 = __u.__w;
3219+ __u.__s = __nl_langinfo_l(_NL_WMON_8, __cloc);
3220+ _M_data->_M_month08 = __u.__w;
3221+ __u.__s = __nl_langinfo_l(_NL_WMON_9, __cloc);
3222+ _M_data->_M_month09 = __u.__w;
3223+ __u.__s = __nl_langinfo_l(_NL_WMON_10, __cloc);
3224+ _M_data->_M_month10 = __u.__w;
3225+ __u.__s = __nl_langinfo_l(_NL_WMON_11, __cloc);
3226+ _M_data->_M_month11 = __u.__w;
3227+ __u.__s = __nl_langinfo_l(_NL_WMON_12, __cloc);
3228+ _M_data->_M_month12 = __u.__w;
3229+
3230+ // Abbreviated month names, starting with "C"'s Jan.
3231+ __u.__s = __nl_langinfo_l(_NL_WABMON_1, __cloc);
3232+ _M_data->_M_amonth01 = __u.__w;
3233+ __u.__s = __nl_langinfo_l(_NL_WABMON_2, __cloc);
3234+ _M_data->_M_amonth02 = __u.__w;
3235+ __u.__s = __nl_langinfo_l(_NL_WABMON_3, __cloc);
3236+ _M_data->_M_amonth03 = __u.__w;
3237+ __u.__s = __nl_langinfo_l(_NL_WABMON_4, __cloc);
3238+ _M_data->_M_amonth04 = __u.__w;
3239+ __u.__s = __nl_langinfo_l(_NL_WABMON_5, __cloc);
3240+ _M_data->_M_amonth05 = __u.__w;
3241+ __u.__s = __nl_langinfo_l(_NL_WABMON_6, __cloc);
3242+ _M_data->_M_amonth06 = __u.__w;
3243+ __u.__s = __nl_langinfo_l(_NL_WABMON_7, __cloc);
3244+ _M_data->_M_amonth07 = __u.__w;
3245+ __u.__s = __nl_langinfo_l(_NL_WABMON_8, __cloc);
3246+ _M_data->_M_amonth08 = __u.__w;
3247+ __u.__s = __nl_langinfo_l(_NL_WABMON_9, __cloc);
3248+ _M_data->_M_amonth09 = __u.__w;
3249+ __u.__s = __nl_langinfo_l(_NL_WABMON_10, __cloc);
3250+ _M_data->_M_amonth10 = __u.__w;
3251+ __u.__s = __nl_langinfo_l(_NL_WABMON_11, __cloc);
3252+ _M_data->_M_amonth11 = __u.__w;
3253+ __u.__s = __nl_langinfo_l(_NL_WABMON_12, __cloc);
3254+ _M_data->_M_amonth12 = __u.__w;
3255+ }
3256+#endif // 0
3257+ }
3258+#endif
3259+}
[0602db2]3260diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.h
3261--- gcc-4.1.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 1969-12-31 16:00:00.000000000 -0800
3262+++ gcc-4.1.2/libstdc++-v3/config/locale/uclibc/time_members.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3263@@ -0,0 +1,76 @@
3264+// std::time_get, std::time_put implementation, GNU version -*- C++ -*-
3265+
3266+// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3267+//
3268+// This file is part of the GNU ISO C++ Library. This library is free
3269+// software; you can redistribute it and/or modify it under the
3270+// terms of the GNU General Public License as published by the
3271+// Free Software Foundation; either version 2, or (at your option)
3272+// any later version.
3273+
3274+// This library is distributed in the hope that it will be useful,
3275+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3276+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3277+// GNU General Public License for more details.
3278+
3279+// You should have received a copy of the GNU General Public License along
3280+// with this library; see the file COPYING. If not, write to the Free
3281+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
3282+// USA.
3283+
3284+// As a special exception, you may use this file as part of a free software
3285+// library without restriction. Specifically, if other files instantiate
3286+// templates or use macros or inline functions from this file, or you compile
3287+// this file and link it with other files to produce an executable, this
3288+// file does not by itself cause the resulting executable to be covered by
3289+// the GNU General Public License. This exception does not however
3290+// invalidate any other reasons why the executable file might be covered by
3291+// the GNU General Public License.
3292+
3293+//
3294+// ISO C++ 14882: 22.2.5.1.2 - time_get functions
3295+// ISO C++ 14882: 22.2.5.3.2 - time_put functions
3296+//
3297+
3298+// Written by Benjamin Kosnik <bkoz@redhat.com>
3299+
3300+ template<typename _CharT>
3301+ __timepunct<_CharT>::__timepunct(size_t __refs)
3302+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
3303+ _M_name_timepunct(_S_get_c_name())
3304+ { _M_initialize_timepunct(); }
3305+
3306+ template<typename _CharT>
3307+ __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
3308+ : facet(__refs), _M_data(__cache), _M_c_locale_timepunct(NULL),
3309+ _M_name_timepunct(_S_get_c_name())
3310+ { _M_initialize_timepunct(); }
3311+
3312+ template<typename _CharT>
3313+ __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
3314+ size_t __refs)
3315+ : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL),
3316+ _M_name_timepunct(NULL)
3317+ {
3318+ const size_t __len = std::strlen(__s) + 1;
3319+ char* __tmp = new char[__len];
3320+ std::memcpy(__tmp, __s, __len);
3321+ _M_name_timepunct = __tmp;
3322+
3323+ try
3324+ { _M_initialize_timepunct(__cloc); }
3325+ catch(...)
3326+ {
3327+ delete [] _M_name_timepunct;
3328+ __throw_exception_again;
3329+ }
3330+ }
3331+
3332+ template<typename _CharT>
3333+ __timepunct<_CharT>::~__timepunct()
3334+ {
3335+ if (_M_name_timepunct != _S_get_c_name())
3336+ delete [] _M_name_timepunct;
3337+ delete _M_data;
3338+ _S_destroy_c_locale(_M_c_locale_timepunct);
3339+ }
[0602db2]3340diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_base.h gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_base.h
3341--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_base.h 1969-12-31 16:00:00.000000000 -0800
3342+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_base.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3343@@ -0,0 +1,64 @@
3344+// Locale support -*- C++ -*-
3345+
3346+// Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
3347+// Free Software Foundation, Inc.
3348+//
3349+// This file is part of the GNU ISO C++ Library. This library is free
3350+// software; you can redistribute it and/or modify it under the
3351+// terms of the GNU General Public License as published by the
3352+// Free Software Foundation; either version 2, or (at your option)
3353+// any later version.
3354+
3355+// This library is distributed in the hope that it will be useful,
3356+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3357+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3358+// GNU General Public License for more details.
3359+
3360+// You should have received a copy of the GNU General Public License along
3361+// with this library; see the file COPYING. If not, write to the Free
3362+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3363+// USA.
3364+
3365+// As a special exception, you may use this file as part of a free software
3366+// library without restriction. Specifically, if other files instantiate
3367+// templates or use macros or inline functions from this file, or you compile
3368+// this file and link it with other files to produce an executable, this
3369+// file does not by itself cause the resulting executable to be covered by
3370+// the GNU General Public License. This exception does not however
3371+// invalidate any other reasons why the executable file might be covered by
3372+// the GNU General Public License.
3373+
3374+//
3375+// ISO C++ 14882: 22.1 Locales
3376+//
3377+
3378+/** @file ctype_base.h
3379+ * This is an internal header file, included by other library headers.
3380+ * You should not attempt to use it directly.
3381+ */
3382+
3383+// Information as gleaned from /usr/include/ctype.h
3384+
3385+ /// @brief Base class for ctype.
3386+ struct ctype_base
3387+ {
3388+ // Note: In uClibc, the following two types depend on configuration.
3389+
3390+ // Non-standard typedefs.
3391+ typedef const __ctype_touplow_t* __to_type;
3392+
3393+ // NB: Offsets into ctype<char>::_M_table force a particular size
3394+ // on the mask type. Because of this, we don't use an enum.
3395+ typedef __ctype_mask_t mask;
3396+ static const mask upper = _ISupper;
3397+ static const mask lower = _ISlower;
3398+ static const mask alpha = _ISalpha;
3399+ static const mask digit = _ISdigit;
3400+ static const mask xdigit = _ISxdigit;
3401+ static const mask space = _ISspace;
3402+ static const mask print = _ISprint;
3403+ static const mask graph = _ISalpha | _ISdigit | _ISpunct;
3404+ static const mask cntrl = _IScntrl;
3405+ static const mask punct = _ISpunct;
3406+ static const mask alnum = _ISalpha | _ISdigit;
3407+ };
[0602db2]3408diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_inline.h
3409--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_inline.h 1969-12-31 16:00:00.000000000 -0800
3410+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_inline.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3411@@ -0,0 +1,69 @@
3412+// Locale support -*- C++ -*-
3413+
3414+// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
3415+//
3416+// This file is part of the GNU ISO C++ Library. This library is free
3417+// software; you can redistribute it and/or modify it under the
3418+// terms of the GNU General Public License as published by the
3419+// Free Software Foundation; either version 2, or (at your option)
3420+// any later version.
3421+
3422+// This library is distributed in the hope that it will be useful,
3423+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3424+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3425+// GNU General Public License for more details.
3426+
3427+// You should have received a copy of the GNU General Public License along
3428+// with this library; see the file COPYING. If not, write to the Free
3429+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3430+// USA.
3431+
3432+// As a special exception, you may use this file as part of a free software
3433+// library without restriction. Specifically, if other files instantiate
3434+// templates or use macros or inline functions from this file, or you compile
3435+// this file and link it with other files to produce an executable, this
3436+// file does not by itself cause the resulting executable to be covered by
3437+// the GNU General Public License. This exception does not however
3438+// invalidate any other reasons why the executable file might be covered by
3439+// the GNU General Public License.
3440+
3441+//
3442+// ISO C++ 14882: 22.1 Locales
3443+//
3444+
3445+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
3446+// functions go in ctype.cc
3447+
3448+ bool
3449+ ctype<char>::
3450+ is(mask __m, char __c) const
3451+ { return _M_table[static_cast<unsigned char>(__c)] & __m; }
3452+
3453+ const char*
3454+ ctype<char>::
3455+ is(const char* __low, const char* __high, mask* __vec) const
3456+ {
3457+ while (__low < __high)
3458+ *__vec++ = _M_table[static_cast<unsigned char>(*__low++)];
3459+ return __high;
3460+ }
3461+
3462+ const char*
3463+ ctype<char>::
3464+ scan_is(mask __m, const char* __low, const char* __high) const
3465+ {
3466+ while (__low < __high
3467+ && !(_M_table[static_cast<unsigned char>(*__low)] & __m))
3468+ ++__low;
3469+ return __low;
3470+ }
3471+
3472+ const char*
3473+ ctype<char>::
3474+ scan_not(mask __m, const char* __low, const char* __high) const
3475+ {
3476+ while (__low < __high
3477+ && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)
3478+ ++__low;
3479+ return __low;
3480+ }
[0602db2]3481diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h
3482--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/ctype_noninline.h 1969-12-31 16:00:00.000000000 -0800
3483+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/ctype_noninline.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3484@@ -0,0 +1,92 @@
3485+// Locale support -*- C++ -*-
3486+
3487+// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004
3488+// Free Software Foundation, Inc.
3489+//
3490+// This file is part of the GNU ISO C++ Library. This library is free
3491+// software; you can redistribute it and/or modify it under the
3492+// terms of the GNU General Public License as published by the
3493+// Free Software Foundation; either version 2, or (at your option)
3494+// any later version.
3495+
3496+// This library is distributed in the hope that it will be useful,
3497+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3498+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3499+// GNU General Public License for more details.
3500+
3501+// You should have received a copy of the GNU General Public License along
3502+// with this library; see the file COPYING. If not, write to the Free
3503+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3504+// USA.
3505+
3506+// As a special exception, you may use this file as part of a free software
3507+// library without restriction. Specifically, if other files instantiate
3508+// templates or use macros or inline functions from this file, or you compile
3509+// this file and link it with other files to produce an executable, this
3510+// file does not by itself cause the resulting executable to be covered by
3511+// the GNU General Public License. This exception does not however
3512+// invalidate any other reasons why the executable file might be covered by
3513+// the GNU General Public License.
3514+
3515+//
3516+// ISO C++ 14882: 22.1 Locales
3517+//
3518+
3519+// Information as gleaned from /usr/include/ctype.h
3520+
3521+ const ctype_base::mask*
3522+ ctype<char>::classic_table() throw()
3523+ { return __C_ctype_b; }
3524+
3525+ ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
3526+ size_t __refs)
3527+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
3528+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
3529+ {
3530+ _M_toupper = __C_ctype_toupper;
3531+ _M_tolower = __C_ctype_tolower;
3532+ _M_table = __table ? __table : __C_ctype_b;
3533+ memset(_M_widen, 0, sizeof(_M_widen));
3534+ memset(_M_narrow, 0, sizeof(_M_narrow));
3535+ }
3536+
3537+ ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
3538+ : facet(__refs), _M_c_locale_ctype(_S_get_c_locale()),
3539+ _M_del(__table != 0 && __del), _M_widen_ok(0), _M_narrow_ok(0)
3540+ {
3541+ _M_toupper = __C_ctype_toupper;
3542+ _M_tolower = __C_ctype_tolower;
3543+ _M_table = __table ? __table : __C_ctype_b;
3544+ memset(_M_widen, 0, sizeof(_M_widen));
3545+ memset(_M_narrow, 0, sizeof(_M_narrow));
3546+ }
3547+
3548+ char
3549+ ctype<char>::do_toupper(char __c) const
3550+ { return _M_toupper[static_cast<unsigned char>(__c)]; }
3551+
3552+ const char*
3553+ ctype<char>::do_toupper(char* __low, const char* __high) const
3554+ {
3555+ while (__low < __high)
3556+ {
3557+ *__low = _M_toupper[static_cast<unsigned char>(*__low)];
3558+ ++__low;
3559+ }
3560+ return __high;
3561+ }
3562+
3563+ char
3564+ ctype<char>::do_tolower(char __c) const
3565+ { return _M_tolower[static_cast<unsigned char>(__c)]; }
3566+
3567+ const char*
3568+ ctype<char>::do_tolower(char* __low, const char* __high) const
3569+ {
3570+ while (__low < __high)
3571+ {
3572+ *__low = _M_tolower[static_cast<unsigned char>(*__low)];
3573+ ++__low;
3574+ }
3575+ return __high;
3576+ }
[0602db2]3577diff -Naur gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/os_defines.h gcc-4.1.2/libstdc++-v3/config/os/uclibc/os_defines.h
3578--- gcc-4.1.2.orig/libstdc++-v3/config/os/uclibc/os_defines.h 1969-12-31 16:00:00.000000000 -0800
3579+++ gcc-4.1.2/libstdc++-v3/config/os/uclibc/os_defines.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3580@@ -0,0 +1,44 @@
3581+// Specific definitions for GNU/Linux -*- C++ -*-
3582+
3583+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
3584+//
3585+// This file is part of the GNU ISO C++ Library. This library is free
3586+// software; you can redistribute it and/or modify it under the
3587+// terms of the GNU General Public License as published by the
3588+// Free Software Foundation; either version 2, or (at your option)
3589+// any later version.
3590+
3591+// This library is distributed in the hope that it will be useful,
3592+// but WITHOUT ANY WARRANTY; without even the implied warranty of
3593+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3594+// GNU General Public License for more details.
3595+
3596+// You should have received a copy of the GNU General Public License along
3597+// with this library; see the file COPYING. If not, write to the Free
3598+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
3599+// USA.
3600+
3601+// As a special exception, you may use this file as part of a free software
3602+// library without restriction. Specifically, if other files instantiate
3603+// templates or use macros or inline functions from this file, or you compile
3604+// this file and link it with other files to produce an executable, this
3605+// file does not by itself cause the resulting executable to be covered by
3606+// the GNU General Public License. This exception does not however
3607+// invalidate any other reasons why the executable file might be covered by
3608+// the GNU General Public License.
3609+
3610+#ifndef _GLIBCXX_OS_DEFINES
3611+#define _GLIBCXX_OS_DEFINES 1
3612+
3613+// System-specific #define, typedefs, corrections, etc, go here. This
3614+// file will come before all others.
3615+
3616+// This keeps isanum, et al from being propagated as macros.
3617+#define __NO_CTYPE 1
3618+
3619+#include <features.h>
3620+
3621+// We must not see the optimized string functions GNU libc defines.
3622+#define __NO_STRING_INLINES
3623+
3624+#endif
[0602db2]3625diff -Naur gcc-4.1.2.orig/libstdc++-v3/configure gcc-4.1.2/libstdc++-v3/configure
3626--- gcc-4.1.2.orig/libstdc++-v3/configure 2007-01-29 02:51:01.000000000 -0800
3627+++ gcc-4.1.2/libstdc++-v3/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]3628@@ -4005,6 +4005,11 @@
3629 lt_cv_deplibs_check_method=pass_all
3630 ;;
3631
3632+linux-uclibc*)
3633+ lt_cv_deplibs_check_method=pass_all
3634+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
3635+ ;;
3636+
3637 netbsd* | knetbsd*-gnu)
3638 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
3639 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
3640@@ -5740,7 +5745,7 @@
3641 enableval="$enable_clocale"
3642
3643 case "$enableval" in
3644- generic|gnu|ieee_1003.1-2001|yes|no|auto) ;;
3645+ generic|gnu|ieee_1003.1-2001|uclibc|yes|no|auto) ;;
3646 *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clocale" >&5
3647 echo "$as_me: error: Unknown argument to enable/disable clocale" >&2;}
3648 { (exit 1); exit 1; }; } ;;
3649@@ -5765,6 +5770,9 @@
3650 # Default to "generic".
3651 if test $enable_clocale_flag = auto; then
3652 case ${target_os} in
3653+ linux-uclibc*)
3654+ enable_clocale_flag=uclibc
3655+ ;;
3656 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
3657 cat >conftest.$ac_ext <<_ACEOF
3658 /* confdefs.h. */
3659@@ -5995,6 +6003,76 @@
3660 CTIME_CC=config/locale/generic/time_members.cc
3661 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
3662 ;;
3663+ uclibc)
3664+ echo "$as_me:$LINENO: result: uclibc" >&5
3665+echo "${ECHO_T}uclibc" >&6
3666+
3667+ # Declare intention to use gettext, and add support for specific
3668+ # languages.
3669+ # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
3670+ ALL_LINGUAS="de fr"
3671+
3672+ # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
3673+ # Extract the first word of "msgfmt", so it can be a program name with args.
3674+set dummy msgfmt; ac_word=$2
3675+echo "$as_me:$LINENO: checking for $ac_word" >&5
3676+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
3677+if test "${ac_cv_prog_check_msgfmt+set}" = set; then
3678+ echo $ECHO_N "(cached) $ECHO_C" >&6
3679+else
3680+ if test -n "$check_msgfmt"; then
3681+ ac_cv_prog_check_msgfmt="$check_msgfmt" # Let the user override the test.
3682+else
3683+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3684+for as_dir in $PATH
3685+do
3686+ IFS=$as_save_IFS
3687+ test -z "$as_dir" && as_dir=.
3688+ for ac_exec_ext in '' $ac_executable_extensions; do
3689+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
3690+ ac_cv_prog_check_msgfmt="yes"
3691+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
3692+ break 2
3693+ fi
3694+done
3695+done
3696+
3697+ test -z "$ac_cv_prog_check_msgfmt" && ac_cv_prog_check_msgfmt="no"
3698+fi
3699+fi
3700+check_msgfmt=$ac_cv_prog_check_msgfmt
3701+if test -n "$check_msgfmt"; then
3702+ echo "$as_me:$LINENO: result: $check_msgfmt" >&5
3703+echo "${ECHO_T}$check_msgfmt" >&6
3704+else
3705+ echo "$as_me:$LINENO: result: no" >&5
3706+echo "${ECHO_T}no" >&6
3707+fi
3708+
3709+ if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
3710+ USE_NLS=yes
3711+ fi
3712+ # Export the build objects.
3713+ for ling in $ALL_LINGUAS; do \
3714+ glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
3715+ glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
3716+ done
3717+
3718+
3719+
3720+ CLOCALE_H=config/locale/uclibc/c_locale.h
3721+ CLOCALE_CC=config/locale/uclibc/c_locale.cc
3722+ CCODECVT_CC=config/locale/uclibc/codecvt_members.cc
3723+ CCOLLATE_CC=config/locale/uclibc/collate_members.cc
3724+ CCTYPE_CC=config/locale/uclibc/ctype_members.cc
3725+ CMESSAGES_H=config/locale/uclibc/messages_members.h
3726+ CMESSAGES_CC=config/locale/uclibc/messages_members.cc
3727+ CMONEY_CC=config/locale/uclibc/monetary_members.cc
3728+ CNUMERIC_CC=config/locale/uclibc/numeric_members.cc
3729+ CTIME_H=config/locale/uclibc/time_members.h
3730+ CTIME_CC=config/locale/uclibc/time_members.cc
3731+ CLOCALE_INTERNAL_H=config/locale/uclibc/c++locale_internal.h
3732+ ;;
3733 esac
3734
3735 # This is where the testsuite looks for locale catalogs, using the
3736@@ -7246,6 +7324,9 @@
3737 cat >>conftest.$ac_ext <<_ACEOF
3738 /* end confdefs.h. */
3739 #include <complex.h>
3740+#ifdef __UCLIBC__
3741+#error ugly hack to make sure configure test fails here for cross until uClibc supports the complex funcs
3742+#endif
3743 int
3744 main ()
3745 {
[0602db2]3746diff -Naur gcc-4.1.2.orig/libstdc++-v3/configure.host gcc-4.1.2/libstdc++-v3/configure.host
3747--- gcc-4.1.2.orig/libstdc++-v3/configure.host 2007-01-28 12:12:40.000000000 -0800
3748+++ gcc-4.1.2/libstdc++-v3/configure.host 2007-02-14 07:57:37.000000000 -0800
3749@@ -270,6 +270,12 @@
[841271e]3750 ;;
3751 esac
3752
3753+# Override for uClibc since linux-uclibc gets mishandled above.
3754+case "${host_os}" in
3755+ *-uclibc*)
3756+ os_include_dir="os/uclibc"
3757+ ;;
3758+esac
3759
3760 # Set any OS-dependent and CPU-dependent bits.
3761 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
[0602db2]3762diff -Naur gcc-4.1.2.orig/libstdc++-v3/crossconfig.m4 gcc-4.1.2/libstdc++-v3/crossconfig.m4
3763--- gcc-4.1.2.orig/libstdc++-v3/crossconfig.m4 2006-12-12 06:18:36.000000000 -0800
3764+++ gcc-4.1.2/libstdc++-v3/crossconfig.m4 2007-02-14 07:57:37.000000000 -0800
[841271e]3765@@ -143,6 +143,99 @@
3766 ;;
3767 esac
3768 ;;
3769+ *-uclibc*)
3770+# Temporary hack until we implement the float versions of the libm funcs
3771+ AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3772+ machine/endian.h machine/param.h sys/machine.h sys/types.h \
3773+ fp.h float.h endian.h inttypes.h locale.h float.h stdint.h])
3774+ SECTION_FLAGS='-ffunction-sections -fdata-sections'
3775+ AC_SUBST(SECTION_FLAGS)
3776+ GLIBCXX_CHECK_LINKER_FEATURES
3777+ GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
3778+ GLIBCXX_CHECK_WCHAR_T_SUPPORT
3779+
3780+ # For LFS.
3781+ AC_DEFINE(HAVE_INT64_T)
3782+ case "$target" in
3783+ *-uclinux*)
3784+ # Don't enable LFS with uClinux
3785+ ;;
3786+ *)
3787+ AC_DEFINE(_GLIBCXX_USE_LFS)
3788+ esac
3789+
3790+ # For showmanyc_helper().
3791+ AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
3792+ GLIBCXX_CHECK_POLL
3793+ GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
3794+
3795+ # For xsputn_2().
3796+ AC_CHECK_HEADERS(sys/uio.h)
3797+ GLIBCXX_CHECK_WRITEV
3798+
3799+# AC_DEFINE(HAVE_ACOSF)
3800+# AC_DEFINE(HAVE_ASINF)
3801+# AC_DEFINE(HAVE_ATANF)
3802+# AC_DEFINE(HAVE_ATAN2F)
3803+ AC_DEFINE(HAVE_CEILF)
3804+ AC_DEFINE(HAVE_COPYSIGN)
3805+# AC_DEFINE(HAVE_COPYSIGNF)
3806+# AC_DEFINE(HAVE_COSF)
3807+# AC_DEFINE(HAVE_COSHF)
3808+# AC_DEFINE(HAVE_EXPF)
3809+# AC_DEFINE(HAVE_FABSF)
3810+ AC_DEFINE(HAVE_FINITE)
3811+ AC_DEFINE(HAVE_FINITEF)
3812+ AC_DEFINE(HAVE_FLOORF)
3813+# AC_DEFINE(HAVE_FMODF)
3814+# AC_DEFINE(HAVE_FREXPF)
3815+ AC_DEFINE(HAVE_HYPOT)
3816+# AC_DEFINE(HAVE_HYPOTF)
3817+ AC_DEFINE(HAVE_ISINF)
3818+ AC_DEFINE(HAVE_ISINFF)
3819+ AC_DEFINE(HAVE_ISNAN)
3820+ AC_DEFINE(HAVE_ISNANF)
3821+# AC_DEFINE(HAVE_LOGF)
3822+# AC_DEFINE(HAVE_LOG10F)
3823+# AC_DEFINE(HAVE_MODFF)
3824+# AC_DEFINE(HAVE_SINF)
3825+# AC_DEFINE(HAVE_SINHF)
3826+# AC_DEFINE(HAVE_SINCOS)
3827+# AC_DEFINE(HAVE_SINCOSF)
3828+ AC_DEFINE(HAVE_SQRTF)
3829+# AC_DEFINE(HAVE_TANF)
3830+# AC_DEFINE(HAVE_TANHF)
3831+ if test x"long_double_math_on_this_cpu" = x"yes"; then
3832+ AC_MSG_ERROR([long_double_math_on_this_cpu is yes!])
3833+# AC_DEFINE(HAVE_ACOSL)
3834+# AC_DEFINE(HAVE_ASINL)
3835+# AC_DEFINE(HAVE_ATANL)
3836+# AC_DEFINE(HAVE_ATAN2L)
3837+# AC_DEFINE(HAVE_CEILL)
3838+# AC_DEFINE(HAVE_COPYSIGNL)
3839+# AC_DEFINE(HAVE_COSL)
3840+# AC_DEFINE(HAVE_COSHL)
3841+# AC_DEFINE(HAVE_EXPL)
3842+# AC_DEFINE(HAVE_FABSL)
3843+# AC_DEFINE(HAVE_FINITEL)
3844+# AC_DEFINE(HAVE_FLOORL)
3845+# AC_DEFINE(HAVE_FMODL)
3846+# AC_DEFINE(HAVE_FREXPL)
3847+# AC_DEFINE(HAVE_HYPOTL)
3848+# AC_DEFINE(HAVE_ISINFL)
3849+# AC_DEFINE(HAVE_ISNANL)
3850+# AC_DEFINE(HAVE_LOGL)
3851+# AC_DEFINE(HAVE_LOG10L)
3852+# AC_DEFINE(HAVE_MODFL)
3853+# AC_DEFINE(HAVE_POWL)
3854+# AC_DEFINE(HAVE_SINL)
3855+# AC_DEFINE(HAVE_SINHL)
3856+# AC_DEFINE(HAVE_SINCOSL)
3857+# AC_DEFINE(HAVE_SQRTL)
3858+# AC_DEFINE(HAVE_TANL)
3859+# AC_DEFINE(HAVE_TANHL)
3860+ fi
3861+ ;;
3862 *-linux* | *-uclinux* | *-gnu* | *-kfreebsd*-gnu | *-knetbsd*-gnu)
3863 AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
3864 machine/endian.h machine/param.h sys/machine.h sys/types.h \
3865@@ -157,7 +250,7 @@
3866 AC_DEFINE(HAVE_INT64_T)
3867 case "$target" in
3868 *-uclinux*)
3869- # Don't enable LFS with uClibc
3870+ # Don't enable LFS with uClinux
3871 ;;
3872 *)
3873 AC_DEFINE(_GLIBCXX_USE_LFS)
[0602db2]3874diff -Naur gcc-4.1.2.orig/libstdc++-v3/include/c_compatibility/wchar.h gcc-4.1.2/libstdc++-v3/include/c_compatibility/wchar.h
3875--- gcc-4.1.2.orig/libstdc++-v3/include/c_compatibility/wchar.h 2005-08-16 19:28:44.000000000 -0700
3876+++ gcc-4.1.2/libstdc++-v3/include/c_compatibility/wchar.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3877@@ -101,7 +101,9 @@
3878 using std::wmemcpy;
3879 using std::wmemmove;
3880 using std::wmemset;
3881+#if _GLIBCXX_HAVE_WCSFTIME
3882 using std::wcsftime;
3883+#endif
3884
3885 #if _GLIBCXX_USE_C99
3886 using std::wcstold;
[0602db2]3887diff -Naur gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cstdio.h gcc-4.1.2/libstdc++-v3/include/c_std/std_cstdio.h
3888--- gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cstdio.h 2005-10-30 14:21:50.000000000 -0800
3889+++ gcc-4.1.2/libstdc++-v3/include/c_std/std_cstdio.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3890@@ -143,7 +143,7 @@
3891 using ::vsprintf;
3892 }
3893
3894-#if _GLIBCXX_USE_C99
3895+#if _GLIBCXX_USE_C99 || defined(__UCLIBC__)
3896
3897 #undef snprintf
3898 #undef vfscanf
[0602db2]3899diff -Naur gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cwchar.h gcc-4.1.2/libstdc++-v3/include/c_std/std_cwchar.h
3900--- gcc-4.1.2.orig/libstdc++-v3/include/c_std/std_cwchar.h 2005-10-30 14:21:50.000000000 -0800
3901+++ gcc-4.1.2/libstdc++-v3/include/c_std/std_cwchar.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3902@@ -180,7 +180,9 @@
3903 using ::wcscoll;
3904 using ::wcscpy;
3905 using ::wcscspn;
3906+#if _GLIBCXX_HAVE_WCSFTIME
3907 using ::wcsftime;
3908+#endif
3909 using ::wcslen;
3910 using ::wcsncat;
3911 using ::wcsncmp;
[0602db2]3912diff -Naur gcc-4.1.2.orig/libstdc++-v3/include/ext/rope gcc-4.1.2/libstdc++-v3/include/ext/rope
3913--- gcc-4.1.2.orig/libstdc++-v3/include/ext/rope 2005-08-16 19:28:44.000000000 -0700
3914+++ gcc-4.1.2/libstdc++-v3/include/ext/rope 2007-02-14 07:57:37.000000000 -0800
[841271e]3915@@ -57,6 +57,9 @@
3916 #include <bits/allocator.h>
3917 #include <ext/hash_fun.h>
3918
3919+/* cope w/ index defined as macro, SuSv3 proposal */
3920+#undef index
3921+
3922 # ifdef __GC
3923 # define __GC_CONST const
3924 # else
[0602db2]3925diff -Naur gcc-4.1.2.orig/libstdc++-v3/include/ext/ropeimpl.h gcc-4.1.2/libstdc++-v3/include/ext/ropeimpl.h
3926--- gcc-4.1.2.orig/libstdc++-v3/include/ext/ropeimpl.h 2005-08-16 19:28:44.000000000 -0700
3927+++ gcc-4.1.2/libstdc++-v3/include/ext/ropeimpl.h 2007-02-14 07:57:37.000000000 -0800
[841271e]3928@@ -53,6 +53,9 @@
3929 #include <ext/memory> // For uninitialized_copy_n
3930 #include <ext/numeric> // For power
3931
3932+/* cope w/ index defined as macro, SuSv3 proposal */
3933+#undef index
3934+
3935 namespace __gnu_cxx
3936 {
3937 using std::size_t;
[0602db2]3938diff -Naur gcc-4.1.2.orig/libstdc++-v3/src/Makefile.am gcc-4.1.2/libstdc++-v3/src/Makefile.am
3939--- gcc-4.1.2.orig/libstdc++-v3/src/Makefile.am 2006-01-09 20:01:00.000000000 -0800
3940+++ gcc-4.1.2/libstdc++-v3/src/Makefile.am 2007-02-14 07:57:37.000000000 -0800
[841271e]3941@@ -234,6 +234,12 @@
3942 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
3943
3944
3945+install-exec-local:
3946+ifeq ($(enable_shared),yes)
3947+ $(AR) cru libstdc++_pic.a .libs/*.o $(top_builddir)/libsupc++/*.o
3948+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
3949+endif
3950+
3951 # Added bits to build debug library.
3952 if GLIBCXX_BUILD_DEBUG
3953 all-local: build_debug
[0602db2]3954diff -Naur gcc-4.1.2.orig/libstdc++-v3/src/Makefile.in gcc-4.1.2/libstdc++-v3/src/Makefile.in
3955--- gcc-4.1.2.orig/libstdc++-v3/src/Makefile.in 2006-01-10 09:14:00.000000000 -0800
3956+++ gcc-4.1.2/libstdc++-v3/src/Makefile.in 2007-02-14 07:57:37.000000000 -0800
[841271e]3957@@ -627,7 +627,7 @@
3958
3959 install-data-am: install-data-local
3960
3961-install-exec-am: install-toolexeclibLTLIBRARIES
3962+install-exec-am: install-toolexeclibLTLIBRARIES install-exec-local
3963
3964 install-info: install-info-am
3965
3966@@ -660,6 +660,7 @@
3967 distclean-libtool distclean-tags distdir dvi dvi-am html \
3968 html-am info info-am install install-am install-data \
3969 install-data-am install-data-local install-exec \
3970+ install-exec-local \
3971 install-exec-am install-info install-info-am install-man \
3972 install-strip install-toolexeclibLTLIBRARIES installcheck \
3973 installcheck-am installdirs maintainer-clean \
3974@@ -760,6 +761,13 @@
3975 install_debug:
3976 (cd ${debugdir} && $(MAKE) \
3977 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
3978+
3979+install-exec-local:
3980+ifeq ($(enable_shared),yes)
3981+ $(AR) cru libstdc++_pic.a *.o $(top_builddir)/libsupc++/*.o
3982+ $(INSTALL_DATA) libstdc++_pic.a $(DESTDIR)$(toolexeclibdir)
3983+endif
3984+
3985 # Tell versions [3.59,3.63) of GNU make to not export all variables.
3986 # Otherwise a system limit (for SysV at least) may be exceeded.
3987 .NOEXPORT:
[0602db2]3988diff -Naur gcc-4.1.2.orig/libtool.m4 gcc-4.1.2/libtool.m4
3989--- gcc-4.1.2.orig/libtool.m4 2005-07-15 19:30:53.000000000 -0700
3990+++ gcc-4.1.2/libtool.m4 2007-02-14 07:57:37.000000000 -0800
[841271e]3991@@ -743,6 +743,11 @@
3992 lt_cv_deplibs_check_method=pass_all
3993 ;;
3994
3995+linux-uclibc*)
3996+ lt_cv_deplibs_check_method=pass_all
3997+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
3998+ ;;
3999+
4000 netbsd* | knetbsd*-gnu)
4001 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
4002 [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
[0602db2]4003diff -Naur gcc-4.1.2.orig/ltconfig gcc-4.1.2/ltconfig
4004--- gcc-4.1.2.orig/ltconfig 2006-07-04 13:30:34.000000000 -0700
4005+++ gcc-4.1.2/ltconfig 2007-02-14 07:57:37.000000000 -0800
[841271e]4006@@ -603,6 +603,7 @@
4007
4008 # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
4009 case $host_os in
4010+linux-uclibc*) ;;
4011 linux-gnu*) ;;
4012 linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
4013 esac
4014@@ -1274,6 +1275,23 @@
4015 dynamic_linker='GNU/Linux ld.so'
4016 ;;
4017
4018+linux-uclibc*)
4019+ version_type=linux
4020+ need_lib_prefix=no
4021+ need_version=no
4022+ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
4023+ soname_spec='${libname}${release}.so$major'
4024+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
4025+ shlibpath_var=LD_LIBRARY_PATH
4026+ shlibpath_overrides_runpath=no
4027+ # This implies no fast_install, which is unacceptable.
4028+ # Some rework will be needed to allow for fast_install
4029+ # before this can be enabled.
4030+ hardcode_into_libs=yes
4031+ # Assume using the uClibc dynamic linker.
4032+ dynamic_linker="uClibc ld.so"
4033+ ;;
4034+
4035 netbsd*)
4036 need_lib_prefix=no
4037 need_version=no
[0602db2]4038diff -Naur gcc-4.1.2.orig/zlib/configure gcc-4.1.2/zlib/configure
4039--- gcc-4.1.2.orig/zlib/configure 2005-09-12 10:02:07.000000000 -0700
4040+++ gcc-4.1.2/zlib/configure 2007-02-14 07:57:37.000000000 -0800
[841271e]4041@@ -3426,6 +3426,11 @@
4042 lt_cv_deplibs_check_method=pass_all
4043 ;;
4044
4045+linux-uclibc*)
4046+ lt_cv_deplibs_check_method=pass_all
4047+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
4048+ ;;
4049+
4050 netbsd* | knetbsd*-gnu)
4051 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
4052 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
[0602db2]4053
Note: See TracBrowser for help on using the repository browser.