1--- misc/libtextcat-2.2/configure	Thu May 22 13:39:55 2003
2+++ misc/build/libtextcat-2.2/configure	Mon Mar 31 11:29:14 2008
3@@ -3451,7 +3451,7 @@
4   ;;
5
6 # This must be Linux ELF.
7-linux-gnu*)
8+linux-gnu*|k*bsd*-gnu*)
9   case $host_cpu in
10   alpha* | hppa* | i*86 | mips | mipsel | powerpc* | sparc* | ia64*)
11     lt_cv_deplibs_check_method=pass_all ;;
12@@ -5391,7 +5391,8 @@
13 allow_undefined_flag=
14 no_undefined_flag=
15 need_lib_prefix=unknown
16-need_version=unknown
17+#need_version=unknown
18+need_version=no
19 # when you set need_version to no, make sure it does not cause -set_version
20 # flags to be left without arguments
21 archive_cmds=
22@@ -5785,7 +5786,7 @@
23     #        cross-compilation, but unfortunately the echo tests do not
24     #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
25     #	     `"' quotes if we put them in here... so don't!
26-    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
27+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$compiler_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)'
28     # We need to add '_' to the symbols in $export_symbols first
29     #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
30     hardcode_direct=yes
31@@ -6280,7 +6281,7 @@
32   ;;
33
34 freebsd*)
35-  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
36+  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
37   version_type=freebsd-$objformat
38   case $version_type in
39     freebsd-elf*)
40@@ -6365,7 +6365,7 @@
41   ;;
42
43 # This must be Linux ELF.
44-linux-gnu*)
45+linux-gnu*|k*bsd*-gnu*)
46   version_type=linux
47   need_lib_prefix=no
48   need_version=no
49--- misc/libtextcat-2.2/src/Makefile.in	Thu May 22 13:39:52 2003
50+++ misc/build/libtextcat-2.2/src/Makefile.in	Mon Mar 31 11:29:14 2008
51@@ -124,20 +124,20 @@
52 target_vendor = @target_vendor@
53 AUTOMAKE_OPTIONS = 1.4 foreign
54
55-WARNS = -W -Wall -Wshadow -Wpointer-arith
56-IFLAGS =
57-FLAGS = -g -O3 -funroll-loops -D_THREAD_SAFE -D_GNU_SOURCE
58+#WARNS = -W -Wall -Wshadow -Wpointer-arith
59+IFLAGS =
60+#FLAGS = -g -O3 -funroll-loops -D_THREAD_SAFE -D_GNU_SOURCE
61 VERBOSE = -DVERBOSE
62 AM_CFLAGS = $(IFLAGS) $(VERBOSE) $(WARNS) $(FLAGS)
63 AM_LDFLAGS = -g
64
65 noinst_HEADERS = \
66-	common.h constants.h fingerprint.h textcat.h wg_mempool.h
67+        common.h constants.h fingerprint.h textcat.h wg_mempool.h utf8misc.h
68
69
70 lib_LTLIBRARIES = libtextcat.la
71 libtextcat_la_SOURCES = \
72-	common.c fingerprint.c textcat.c wg_mempool.c
73+        common.c fingerprint.c textcat.c wg_mempool.c utf8misc.c
74
75
76 bin_PROGRAMS = createfp
77@@ -156,7 +156,7 @@
78 libtextcat_la_LDFLAGS =
79 libtextcat_la_LIBADD =
80 am_libtextcat_la_OBJECTS = common.lo fingerprint.lo textcat.lo \
81-	wg_mempool.lo
82+        wg_mempool.lo utf8misc.lo
83 libtextcat_la_OBJECTS = $(am_libtextcat_la_OBJECTS)
84 bin_PROGRAMS = createfp$(EXEEXT)
85 noinst_PROGRAMS = testtextcat$(EXEEXT)
86@@ -177,7 +177,8 @@
87 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/common.Plo ./$(DEPDIR)/createfp.Po \
88 @AMDEP_TRUE@	./$(DEPDIR)/fingerprint.Plo \
89 @AMDEP_TRUE@	./$(DEPDIR)/testtextcat.Po ./$(DEPDIR)/textcat.Plo \
90-@AMDEP_TRUE@	./$(DEPDIR)/wg_mempool.Plo
91+@AMDEP_TRUE@    ./$(DEPDIR)/wg_mempool.Plo \
92+@AMDEP_TRUE@    ./$(DEPDIR)/utf8misc.Plo
93 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
94 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
95 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
96@@ -213,7 +214,7 @@
97 	@rm -f stamp-h1
98 	cd $(top_builddir) && $(SHELL) ./config.status src/config.h
99
100-$(srcdir)/config.h.in:  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
101+$(srcdir)/config.h.in:  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
102 	cd $(top_srcdir) && $(AUTOHEADER)
103 	touch $(srcdir)/config.h.in
104
105@@ -247,8 +248,8 @@
106 	  echo "rm -f \"$${dir}/so_locations\""; \
107 	  rm -f "$${dir}/so_locations"; \
108 	done
109-libtextcat.la: $(libtextcat_la_OBJECTS) $(libtextcat_la_DEPENDENCIES)
110-	$(LINK) -rpath $(libdir) $(libtextcat_la_LDFLAGS) $(libtextcat_la_OBJECTS) $(libtextcat_la_LIBADD) $(LIBS)
111+libtextcat.la: $(libtextcat_la_OBJECTS) $(libtextcat_la_DEPENDENCIES)
112+	$(LINK) -avoid-version -rpath $(libdir) $(libtextcat_la_LDFLAGS) $(libtextcat_la_OBJECTS) $(libtextcat_la_LIBADD) $(LIBS)
113 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
114 install-binPROGRAMS: $(bin_PROGRAMS)
115 	@$(NORMAL_INSTALL)
116@@ -285,10 +286,10 @@
117 	  echo " rm -f $$p $$f"; \
118 	  rm -f $$p $$f ; \
119 	done
120-createfp$(EXEEXT): $(createfp_OBJECTS) $(createfp_DEPENDENCIES)
121+createfp$(EXEEXT): $(createfp_OBJECTS) $(createfp_DEPENDENCIES)
122 	@rm -f createfp$(EXEEXT)
123 	$(LINK) $(createfp_LDFLAGS) $(createfp_OBJECTS) $(createfp_LDADD) $(LIBS)
124-testtextcat$(EXEEXT): $(testtextcat_OBJECTS) $(testtextcat_DEPENDENCIES)
125+testtextcat$(EXEEXT): $(testtextcat_OBJECTS) $(testtextcat_DEPENDENCIES)
126 	@rm -f testtextcat$(EXEEXT)
127 	$(LINK) $(testtextcat_LDFLAGS) $(testtextcat_OBJECTS) $(testtextcat_LDADD) $(LIBS)
128
129@@ -304,6 +305,7 @@
130 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testtextcat.Po@am__quote@
131 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textcat.Plo@am__quote@
132 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wg_mempool.Plo@am__quote@
133+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8misc.Plo@am__quote@
134
135 distclean-depend:
136 	-rm -rf ./$(DEPDIR)
137--- misc/libtextcat-2.2/src/common.c	Thu May 22 13:32:43 2003
138+++ misc/build/libtextcat-2.2/src/common.c	Mon Mar 31 11:29:14 2008
139@@ -3,23 +3,23 @@
140  *
141  * Copyright (c) 2003, WiseGuys Internet B.V.
142  * All rights reserved.
143- *
144+ *
145  * Redistribution and use in source and binary forms, with or without
146  * modification, are permitted provided that the following conditions
147  * are met:
148- *
149+ *
150  * - Redistributions of source code must retain the above copyright
151  * notice, this list of conditions and the following disclaimer.
152- *
153+ *
154  * - Redistributions in binary form must reproduce the above copyright
155  * notice, this list of conditions and the following disclaimer in the
156  * documentation and/or other materials provided with the
157  * distribution.
158- *
159+ *
160  * - Neither the name of the WiseGuys Internet B.V. nor the names of
161  * its contributors may be used to endorse or promote products derived
162  * from this software without specific prior written permission.
163- *
164+ *
165  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
166  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
167  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
168@@ -114,11 +114,11 @@
169 		wgmem_error( "Error while strduping %u bytes.\n", strlen(s) );
170 	}
171
172-	return( result );
173+	return( result );
174 }
175
176-extern void* wg_realloc( void *ptr, size_t size )
177-{
178+extern void* wg_realloc( void *ptr, size_t size )
179+{
180 	void *result;
181
182 	if (!size) {
183@@ -131,7 +131,7 @@
184 		wgmem_error( "Error while reallocing %u bytes.\n", size );
185 	}
186
187-	return( result );
188+	return( result );
189 }
190
191 extern void wg_free( void *mem )
192@@ -148,12 +148,12 @@
193         if ( fgets(line, size, fp) == NULL ) {
194 		return NULL;
195 	}
196-
197+
198         /** kill term null **/
199         if ( (p = strpbrk( line, "\n\r" )) ) {
200                 *p = '\0';
201-        }
202-
203+        }
204+
205         return line;
206 }
207
208@@ -164,39 +164,39 @@
209  *
210  * ARGUMENTS:
211  * - result:
212- *
213+ *
214  *  After the split, this array contains pointers to the start of each
215  *  detected segment. Must be preallocated and at least as large as
216  *  maxsegments. The pointers point into the dest buffer.
217- *
218- * - dest:
219- *
220+ *
221+ * - dest:
222+ *
223  *  String into which result points as an index. Must be preallocated, and
224  *  at least as big as src. You can use src as dest, but in that case src
225  *  is overwritten!
226- *
227- * - src:
228- *
229+ *
230+ * - src:
231+ *
232  *  The string to split. Sequences of whitespace are treated as separators, unless
233  *  escaped. There are two ways to escape: by using single quotes (anything
234  *  between single quotes is treated as one segment), or by using a backslash
235  *  to escape the next character. The backslash escape works inside quotation
236  *  as well.
237- *
238+ *
239  *  Example:
240- *
241+ *
242  *  "It\'s   very\ easy   'to  use WiseGuys\' wg_split()' function" is split into:
243- *
244+ *
245  *  "It's"
246  *  "very easy"
247  *  "to  use WiseGuys' wg_split()"
248  *  "function"
249- *
250- * - maxsegments:
251- *
252+ *
253+ * - maxsegments:
254+ *
255  *  The maximum number of segments. If the splitter runs out of segments,
256  *  the remainder of the string is stored in the last segment.
257- *
258+ *
259  * RETURN VALUE:
260  * The number of segments found.
261  */
262@@ -218,12 +218,12 @@
263 		switch (state) {
264 		case 0:
265 			/*** Skip spaces ***/
266-			while ( isspace((int) *p) ) {
267+			while ( isspace((unsigned char) *p) ) {
268 				p++;
269 			}
270 			state = 1;
271
272-		case 1:
273+		case 1:
274 			/*** Start segment ***/
275 			result[cnt] = w;
276 			cnt++;
277@@ -232,12 +232,12 @@
278 		case 2:
279 			/*** Unquoted segment ***/
280 			while (*p) {
281-				if ( isspace((int) *p) ) {
282+				if ( isspace((unsigned char) *p) ) {
283 					*w++ = '\0';
284 					p++;
285 					state = 0;
286 					break;
287-				}
288+				}
289 				else if ( *p == '\'' ) {
290 					/*** Start quotation ***/
291 					p++;
292@@ -292,17 +292,17 @@
293 }
294
295
296+#ifdef HAVE_GETTIMEOFDAY    /* TL : no struct timeval under Win32 */
297 extern void wg_timerstart(wgtimer_t *t)
298 {
299-#ifdef HAVE_GETTIMEOFDAY
300         gettimeofday( &(t->start), NULL );
301-#endif
302 }
303+#endif  /* TL : no struct timeval under Win32 */
304
305
306+#ifdef HAVE_GETTIMEOFDAY    /* TL : no struct timeval under Win32 */
307 extern uint4 wg_timerstop(wgtimer_t *t)
308 {
309-#ifdef HAVE_GETTIMEOFDAY
310 	uint4 result;
311         gettimeofday( &(t->stop), NULL );
312         result = (t->stop.tv_sec - t->start.tv_sec) * 1000000 +
313@@ -312,25 +312,23 @@
314 	t->start.tv_usec = t->stop.tv_usec;
315
316 	return result;
317-#else
318-	return 0;
319-#endif
320 }
321+#endif  /* TL : no struct timeval under Win32 */
322
323
324 /**
325  * wg_strgmov -- a guarded strcpy() variation
326- *
327+ *
328  * copies src to dest (including terminating zero), and returns
329  * pointer to position of terminating zero in dest. The function is
330  * guaranteed not to write past destlimit. If the copy couldn't be
331- * finished, the function returns NULL after restoring the first
332- * character in dest for your convenience (since this is usually a zero).
333+ * finished, the function returns NULL after restoring the first
334+ * character in dest for your convenience (since this is usually a zero).
335  */
336 char *wg_strgmov( char *dest, const char *src, const char *destlimit )
337 {
338 	char tmp, *w;
339-
340+
341 	if ( !dest || dest >= destlimit ) {
342 		return NULL;
343 	}
344@@ -355,7 +353,7 @@
345 }
346
347 /*
348- * wg_trim() -- remove whitespace surrounding a string.
349+ * wg_trim() -- remove whitespace surrounding a string.
350  *
351  * Example: "   bla   bla   bla   " becomes "bla   bla   bla" after trimming.
352  *
353@@ -373,12 +371,12 @@
354 	char *lastnonspace = &dest[-1];
355 	const char *p = src;
356 	char *w = dest;
357-
358-	while ( isspace((int)*p) ) {
359+
360+	while ( isspace((unsigned char)*p) ) {
361 		p++;
362 	}
363 	while (*p) {
364-		if ( !isspace((int)*p) ) {
365+		if ( !isspace((unsigned char)*p) ) {
366 			lastnonspace = w;
367 		}
368 		*w++ = *p++;
369--- misc/libtextcat-2.2/src/common.h	Thu May 22 15:02:29 2003
370+++ misc/build/libtextcat-2.2/src/common.h	Mon Mar 31 11:29:14 2008
371@@ -1,28 +1,28 @@
372 #ifndef _COMMON_H_
373 #define _COMMON_H_
374 /**
375- * common.h -- a mixed bag of helper functions
376+ * common.h -- a mixed bag of helper functions
377  *
378  * Copyright (C) 2003 WiseGuys Internet B.V.
379  *
380  * THE BSD LICENSE
381- *
382+ *
383  * Redistribution and use in source and binary forms, with or without
384  * modification, are permitted provided that the following conditions
385  * are met:
386- *
387+ *
388  * - Redistributions of source code must retain the above copyright
389  * notice, this list of conditions and the following disclaimer.
390- *
391+ *
392  * - Redistributions in binary form must reproduce the above copyright
393  * notice, this list of conditions and the following disclaimer in the
394  * documentation and/or other materials provided with the
395  * distribution.
396- *
397+ *
398  * - Neither the name of the WiseGuys Internet B.V. nor the names of
399  * its contributors may be used to endorse or promote products derived
400  * from this software without specific prior written permission.
401- *
402+ *
403  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
404  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
405  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
406@@ -86,10 +86,12 @@
407 typedef char		boole;
408 #endif
409
410+#ifdef HAVE_GETTIMEOFDAY    /* TL : no struct timeval under Win32 */
411 typedef struct wgtimer_s {
412         struct timeval start;
413         struct timeval stop;
414 } wgtimer_t;
415+#endif  /* TL : no struct timeval under Win32 */
416
417
418 extern void *wg_malloc( size_t size );
419@@ -101,13 +103,15 @@
420
421 extern char *wg_getline( char *line, int size, FILE *fp );
422
423+#ifdef HAVE_GETTIMEOFDAY    /* TL : no struct timeval under Win32 */
424 extern void wg_timerstart(wgtimer_t *t);
425 extern uint4 wg_timerstop(wgtimer_t *t);
426+#endif  /* TL : no struct timeval under Win32 */
427
428 extern unsigned int wg_split( char **result, char *dest, char *src, int maxsegments );
429 extern char *wg_strgmov( char *dest, const char *src, const char *destlimit );
430 extern char *wg_trim( char *dest, const char *src );
431
432-
433+
434 #endif
435
436--- misc/libtextcat-2.2/src/constants.h	Thu May 22 13:32:43 2003
437+++ misc/build/libtextcat-2.2/src/constants.h	Mon Mar 31 11:29:14 2008
438@@ -39,6 +39,8 @@
439  */
440 #include <limits.h>
441
442+#define _UTF8_
443+
444 #define DESCRIPTION "out of place"
445
446 /* Reported matches are those fingerprints with a score less than best
447@@ -59,14 +61,21 @@
448 /* Maximum number of n-grams in a fingerprint */
449 #define MAXNGRAMS  400
450
451-/* Maximum size of an n-gram? */
452-#define MAXNGRAMSIZE 5
453+/* Maximum number of character of an n-gram? */
454+#define MAXNGRAMSYMBOL 5
455+
456+/* Maximum size of the string representing an n-gram (must be greater than number of symbol) */
457+#ifdef _UTF8_
458+#define MAXNGRAMSIZE 20
459+#else
460+#define MAXNGRAMSIZE MAXNGRAMSYMBOL
461+#endif
462
463 /* Which characters are not acceptable in n-grams? */
464-#define INVALID(c) (isspace((int)c) || isdigit((int)c))
465+#define INVALID(c) (isspace((unsigned char)c) || isdigit((unsigned char)c))
466
467 /* Minimum size (in characters) for accepting a document */
468-#define MINDOCSIZE  25
469+#define MINDOCSIZE  6
470
471 /* Maximum penalty for missing an n-gram in fingerprint */
472 #define MAXOUTOFPLACE 400
473@@ -75,5 +84,8 @@
474 #define TABLEPOW  13
475
476 #define MAXSCORE  INT_MAX
477+
478+/* where the fingerprints files are stored */
479+#define DEFAULT_FINGERPRINTS_PATH ""
480
481 #endif
482--- misc/libtextcat-2.2/src/fingerprint.c	Thu May 22 13:32:43 2003
483+++ misc/build/libtextcat-2.2/src/fingerprint.c	Mon Mar 31 11:29:14 2008
484@@ -6,23 +6,23 @@
485  * All rights reserved.
486  *
487  * THE BSD LICENSE
488- *
489+ *
490  * Redistribution and use in source and binary forms, with or without
491  * modification, are permitted provided that the following conditions
492  * are met:
493- *
494+ *
495  * - Redistributions of source code must retain the above copyright
496  * notice, this list of conditions and the following disclaimer.
497- *
498+ *
499  * - Redistributions in binary form must reproduce the above copyright
500  * notice, this list of conditions and the following disclaimer in the
501  * documentation and/or other materials provided with the
502  * distribution.
503- *
504+ *
505  * - Neither the name of the WiseGuys Internet B.V. nor the names of
506  * its contributors may be used to endorse or promote products derived
507  * from this software without specific prior written permission.
508- *
509+ *
510  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
511  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
512  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
513@@ -51,7 +51,7 @@
514  * The reason why we go through the trouble of doing a partial
515  * (heap)sort is that a full quicksort behaves horribly on the data:
516  * most n-grams have a very low count, resulting in a data set in
517- * nearly-sorted order. This causes quicksort to behave very badly.
518+ * nearly-sorted order. This causes quicksort to behave very badly.
519  * Heapsort, on the other hand, behaves handsomely: worst case is
520  * Mlog(N) for M n-grams filtered through a N-sized heap.
521  *
522@@ -63,6 +63,10 @@
523  * - put table/heap datastructure in a separate file.
524  */
525
526+#ifndef _UTF8_
527+#define _UTF8_
528+#endif
529+
530 #include "config.h"
531 #include <stdio.h>
532 #ifdef HAVE_STDLIB_H
533@@ -80,10 +84,12 @@
534 #include "wg_mempool.h"
535 #include "constants.h"
536
537+#include "utf8misc.h"
538
539 #define TABLESIZE  (1<<TABLEPOW)
540 #define TABLEMASK  ((TABLESIZE)-1)
541
542+
543 typedef struct {
544
545 	sint2 rank;
546@@ -96,7 +102,7 @@
547 	const char *name;
548 	ngram_t *fprint;
549 	uint4 size;
550-
551+
552 } fp_t;
553
554 typedef struct entry_s {
555@@ -105,13 +111,13 @@
556 	struct entry_s *next;
557 } entry_t;
558
559-typedef struct table_s {
560+typedef struct table_s {
561 	void *pool;
562 	entry_t **table;
563 	entry_t *heap;
564
565 	struct table_s *next;
566-
567+
568 	uint4 heapsize;
569 	uint4 size;
570 } table_t;
571@@ -122,7 +128,7 @@
572  * fast and furious little hash function
573  *
574  * (Note that we could use some kind of rolling checksum, and update it
575- * during n-gram construction)
576+ * during n-gram construction)
577  */
578 static uint4 simplehash( const char *p, int len )
579 {
580@@ -134,29 +140,14 @@
581 }
582
583
584-/* checks if n-gram lex is a prefix of key and of length len */
585-inline int issame( char *lex, char *key, int len )
586-{
587-	int i;
588-	for (i=0; i<len; i++) {
589-		if ( key[i] != lex[i] ) {
590-			return 0;
591-		}
592-	}
593-	if ( lex[i] != 0 ) {
594-		return 0;
595-	}
596-	return 1;
597-}
598-
599
600 /* increases frequency of ngram(p,len) */
601-static inline int increasefreq( table_t *t, char *p, int len )
602-{
603-	uint4 hash = simplehash( p, len ) & TABLEMASK;
604+static int increasefreq( table_t *t, char *p, int len )
605+{
606+	uint4 hash = simplehash( p, len ) & TABLEMASK;
607 	entry_t *entry = t->table[ hash ];
608-
609-	while ( entry ) {
610+
611+	while ( entry ) {
612 		if ( issame( entry->str, p, len ) ) {
613 			/*** Found it! ***/
614 			entry->cnt++;
615@@ -168,7 +159,7 @@
616 	}
617
618 	/*** Not found, so create ***/
619-	entry = wgmempool_alloc( t->pool, sizeof(entry_t) );
620+        entry = (entry_t*)(wgmempool_alloc( t->pool, sizeof(entry_t) ));
621 	strcpy( entry->str, p );
622 	entry->cnt = 1;
623
624@@ -181,12 +172,12 @@
625 #if 0
626
627 /* looks up ngram(p,len) */
628-static entry_t *findfreq( table_t *t, char *p, int len )
629-{
630-	uint4 hash = simplehash( p, len ) & TABLEMASK;
631+static entry_t *findfreq( table_t *t, char *p, int len )
632+{
633+	uint4 hash = simplehash( p, len ) & TABLEMASK;
634 	entry_t *entry = t->table[ hash ];
635-
636-	while ( entry ) {
637+
638+	while ( entry ) {
639 		if ( issame( entry->str, p, len ) ) {
640 			return entry;
641 		}
642@@ -219,7 +210,7 @@
643 #define GREATER(x,y) ((x).cnt > (y).cnt)
644 #define LESS(x,y)    ((x).cnt < (y).cnt)
645
646-inline static void siftup( table_t *t, unsigned int child )
647+static void siftup( table_t *t, unsigned int child )
648 {
649 	entry_t *heap = t->heap;
650 	unsigned int parent = (child-1) >> 1;
651@@ -241,7 +232,7 @@
652 }
653
654
655-inline static void siftdown( table_t *t, unsigned int heapsize, uint4 parent )
656+static void siftdown( table_t *t, unsigned int heapsize, uint4 parent )
657 {
658 	entry_t *heap = t->heap;
659 	unsigned int child = parent*2 + 1;
660@@ -273,7 +264,7 @@
661 	if (t->size < t->heapsize) {
662 		memcpy( &(heap[t->size]), item, sizeof(entry_t));
663 		siftup( t, t->size );
664-		t->size++;
665+		t->size++;
666 		return 0;
667 	}
668
669@@ -316,18 +307,18 @@
670
671 	/*** Fill result heap ***/
672 	for (i=0; i<TABLESIZE; i++) {
673-		entry_t *p = t->table[i];
674+		entry_t *p = t->table[i];
675 		while (p) {
676 			heapinsert(t, p);
677 			p = p->next;
678 		}
679-	}
680+	}
681 	return 1;
682 }
683
684
685 static table_t *inittable(uint4 maxngrams)
686-{
687+{
688 	table_t *result = (table_t *)wg_zalloc( sizeof(table_t) );
689 	result->table = (entry_t **)wg_zalloc( sizeof(entry_t*) * TABLESIZE );
690 	result->pool = wgmempool_Init( 10000, 10 );
691@@ -347,14 +338,14 @@
692 	wgmempool_Done(t->pool);
693 	wg_free(t->table);
694 	wg_free(t->heap);
695-	wg_free(t);
696+	wg_free(t);
697 }
698
699
700 extern void *fp_Init(const char *name)
701 {
702 	fp_t *h = (fp_t *)wg_zalloc( sizeof(fp_t) );
703-
704+
705 	if ( name ) {
706 		h->name = wg_strdup(name);
707 	}
708@@ -458,21 +449,27 @@
709 	return dest;
710 }
711
712-
713+/**
714+* this function extract all n-gram from past buffer and put them into the table "t"
715+* [modified] by Jocelyn Merand to accept utf-8 multi-character symbols to be used in OpenOffice
716+*/
717 static void createngramtable( table_t *t, const char *buf )
718 {
719 	char n[MAXNGRAMSIZE+1];
720 	const char *p = buf;
721 	int i;
722+        int pointer = 0;
723
724 	/*** Get all n-grams where 1<=n<=MAXNGRAMSIZE. Allow underscores only at borders. ***/
725-	for (;;p++) {
726+	while(1) {
727
728-		const char *q = p;
729+     const char *q = &p[pointer];   /*[modified] previously p++ above (for(;;p++)) now, it's pointer wich is increased so we have to get the new pointer on the buffer*/
730 		char *m = n;
731
732 		/*** First char may be an underscore ***/
733-		*m++ = *q++;
734+                int decay = charcopy(q, m); /*[modified] previously *q++ = *m++*/
735+                q = &(p[pointer+decay]);    /*[modified] the old copying method do not manage multi-character symbols*/
736+                m += decay; /*[modified]*/
737 		*m = '\0';
738
739 		increasefreq( t, n, 1 );
740@@ -482,19 +479,22 @@
741 		}
742
743 		/*** Let the compiler unroll this ***/
744-		for ( i=2; i<=MAXNGRAMSIZE; i++) {
745+		for ( i=2; i<=MAXNGRAMSYMBOL; i++) {
746
747-			*m++ = *q;
748+                        decay = charcopy(q, m); /*[modified] like above*/
749+                        m += decay;
750 			*m = '\0';
751
752 			increasefreq( t, n, i );
753
754 			if ( *q == '_' ) break;
755-			q++;
756+                        q += decay;
757 			if ( *q == '\0' ) {
758 				return;
759 			}
760 		}
761+
762+  pointer = nextcharstart(p,pointer);   /*[modified] p[pointer] must point on the next start of symbol, but whith utf next start is not surely next char*/
763 	}
764 	return;
765 }
766@@ -514,7 +514,7 @@
767 {
768 	ngram_t *x = (ngram_t *)a;
769 	ngram_t *y = (ngram_t *)b;
770-
771+
772 	return mystrcmp( x->str, y->str );
773 }
774
775@@ -522,12 +522,12 @@
776 {
777 	ngram_t *x = (ngram_t *)a;
778 	ngram_t *y = (ngram_t *)b;
779-
780+
781 	return x->rank - y->rank;
782 }
783
784 /**
785- * Create a fingerprint:
786+ * Create a fingerprint:
787  * - record the frequency of each unique n-gram in a hash table
788  * - take the most frequent n-grams
789  * - sort them alphabetically, recording their relative rank
790@@ -544,20 +544,21 @@
791 	}
792
793 	/*** Throw out all invalid chars ***/
794-	tmp = prepbuffer( buffer, bufsize );
795+	tmp = prepbuffer( buffer, bufsize );
796+    /*printf("Cleaned buffer : %s\n",tmp);*/
797 	if ( tmp == NULL ) {
798 		return 0;
799 	}
800-
801 	h = (fp_t*)handle;
802 	t = inittable(maxngrams);
803+    /*printf("Table initialized\n");*/
804
805 	/*** Create a hash table containing n-gram counts ***/
806 	createngramtable(t, tmp);
807-
808+    /*printf("Table created\n");*/
809 	/*** Take the top N n-grams and add them to the profile ***/
810-	table2heap(t);
811-	maxngrams = WGMIN( maxngrams, t->size );
812+	table2heap(t);
813+	maxngrams = WGMIN( maxngrams, t->size );
814
815 	h->fprint = (ngram_t *)wg_malloc( sizeof(ngram_t) * maxngrams );
816 	h->size = maxngrams;
817@@ -568,7 +569,7 @@
818 		entry_t tmp2;
819
820 		heapextract(t, &tmp2);
821-
822+
823 		/*** the string and its rank is all we need ***/
824 		strcpy( h->fprint[i].str, tmp2.str );
825 		h->fprint[i].rank = i;
826@@ -578,7 +579,7 @@
827 	wg_free(tmp);
828
829 	/*** Sort n-grams alphabetically, for easy comparison ***/
830-	qsort( h->fprint, h->size, sizeof(ngram_t), ngramcmp_str );
831+	qsort( h->fprint, h->size, sizeof(ngram_t), ngramcmp_str );
832 	return 1;
833 }
834
835@@ -608,7 +609,7 @@
836 #endif
837 		return 0;
838 	}
839-
840+
841 	h->fprint = (ngram_t *)wg_malloc(maxngrams * sizeof(ngram_t));
842
843 	while (cnt < maxngrams && wg_getline(line,1024,fp)) {
844@@ -635,7 +636,7 @@
845 	h->size = cnt;
846
847 	/*** Sort n-grams, for easy comparison later on ***/
848-	qsort( h->fprint, h->size, sizeof(ngram_t), ngramcmp_str );
849+	qsort( h->fprint, h->size, sizeof(ngram_t), ngramcmp_str );
850
851 	fclose(fp);
852
853@@ -648,14 +649,15 @@
854 {
855 	uint4 i;
856 	fp_t *h = (fp_t *)handle;
857-	ngram_t *tmp = wg_malloc( sizeof(ngram_t) * h->size );
858-
859+        ngram_t *tmp = (ngram_t*)wg_malloc( sizeof(ngram_t) * h->size );
860+
861 	/*** Make a temporary and sort it on rank ***/
862 	memcpy( tmp, h->fprint, h->size * sizeof(ngram_t) );
863-	qsort( tmp, h->size, sizeof(ngram_t), ngramcmp_rank );
864+	qsort( tmp, h->size, sizeof(ngram_t), ngramcmp_rank );
865
866 	for (i=0; i<h->size; i++) {
867-		fprintf( fp, "%s\n", tmp[i].str );
868+        /*fprintf( fp, "%s\t%i\n", tmp[i].str, tmp[i].rank );*/
869+                fprintf( fp, "%s\n", tmp[i].str);
870 	}
871 	wg_free( tmp );
872 }
873@@ -669,7 +671,7 @@
874 	uint4 i = 0;
875 	uint4 j = 0;
876 	sint4 sum = 0;
877-
878+
879 	/*** Compare the profiles in mergesort fashion ***/
880 	while ( i < c->size && j < u->size ) {
881
882@@ -705,7 +707,7 @@
883 	}
884
885 	return sum;
886-
887+
888 }
889
890
891--- misc/libtextcat-2.2/src/fingerprint.h	Mon May 19 14:16:31 2003
892+++ misc/build/libtextcat-2.2/src/fingerprint.h	Mon Mar 31 11:29:14 2008
893@@ -41,7 +41,13 @@
894 extern int fp_Read( void *handle, const char *fname, int maxngrams );
895 extern sint4 fp_Compare( void *cat, void *unknown, int cutoff );
896 extern void fp_Show( void *handle );
897+#ifdef __cplusplus
898+extern "C" {
899+#endif
900 extern const char *fp_Name( void *handle );
901+#ifdef __cplusplus
902+}
903+#endif
904 extern void fp_Print( void *handle, FILE *fp );
905
906 #endif
907--- misc/libtextcat-2.2/src/libtextcat.map	Mon Mar 31 11:30:06 2008
908+++ misc/build/libtextcat-2.2/src/libtextcat.map	Mon Mar 31 11:29:14 2008
909@@ -1 +1,40 @@
910-dummy
911+{
912+	global:
913+		charcopy
914+		issame
915+		nextcharstart
916+		utfstrlen
917+		wgmempool_Done
918+		wgmempool_Init
919+		wgmempool_Reset
920+		wgmempool_alloc
921+		wgmempool_getline
922+		wgmempool_strdup
923+		special_textcat_Init
924+		textcat_Classify
925+		textcat_Done
926+		textcat_Init
927+		textcat_Version
928+		fp_Compare
929+		fp_Create
930+		fp_Debug
931+		fp_Done
932+		fp_Init
933+		fp_Name
934+		fp_Print
935+		fp_Read
936+		heapextract
937+		wg_calloc
938+		wg_free
939+		wg_getline
940+		wg_malloc
941+		wg_split
942+		wg_strdup
943+		wg_strgmov
944+		wg_trim
945+		wg_zalloc
946+		wgmem_error
947+
948+	local:
949+		*;
950+}
951--- misc/libtextcat-2.2/src/makefile.mk	Mon Mar 31 11:30:06 2008
952+++ misc/build/libtextcat-2.2/src/makefile.mk	Mon Mar 31 11:29:42 2008
953@@ -1 +1,87 @@
954-dummy
955+#*************************************************************************
956+#
957+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
958+#
959+# Copyright 2000, 2010 Oracle and/or its affiliates.
960+#
961+# OpenOffice.org - a multi-platform office productivity suite
962+#
963+# This file is part of OpenOffice.org.
964+#
965+# OpenOffice.org is free software: you can redistribute it and/or modify
966+# it under the terms of the GNU Lesser General Public License version 3
967+# only, as published by the Free Software Foundation.
968+#
969+# OpenOffice.org is distributed in the hope that it will be useful,
970+# but WITHOUT ANY WARRANTY; without even the implied warranty of
971+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
972+# GNU Lesser General Public License version 3 for more details
973+# (a copy is included in the LICENSE file that accompanied this code).
974+#
975+# You should have received a copy of the GNU Lesser General Public License
976+# version 3 along with OpenOffice.org.  If not, see
977+# <http://www.openoffice.org/license.html>
978+# for a copy of the LGPLv3 License.
979+#
980+#*************************************************************************
981+
982+PRJ = ..$/..$/..$/..$/..
983+
984+PRJNAME = libtextcat
985+TARGET  = libtextcat
986+CFLAGSCALL=gsd
987+
988+USE_DEFFILE=TRUE
989+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
990+UWINAPILIB=
991+
992+.INCLUDE : settings.mk
993+
994+# --- Files --------------------------------------------------------
995+
996+# !! not to be compiled because those belong to a stand alone programs: !!
997+#        $(SLO)$/createfp.obj\
998+#        $(SLO)$/testtextcat.obj
999+
1000+SLOFILES=   \
1001+        $(SLO)$/common.obj\
1002+        $(SLO)$/fingerprint.obj\
1003+        $(SLO)$/textcat.obj\
1004+        $(SLO)$/wg_mempool.obj\
1005+        $(SLO)$/utf8misc.obj
1006+
1007+#SHL1TARGET= $(TARGET)$(UPD)$(DLLPOSTFIX)
1008+SHL1TARGET= $(TARGET)
1009+
1010+SHL1STDLIBS=
1011+
1012+# build DLL
1013+SHL1LIBS=       $(SLB)$/$(TARGET).lib
1014+SHL1IMPLIB=     i$(TARGET)
1015+SHL1DEPN=       $(SHL1LIBS)
1016+SHL1DEF=        $(MISC)$/$(SHL1TARGET).def
1017+
1018+# build DEF file
1019+DEF1NAME=       $(SHL1TARGET)
1020+DEF1DEPN=$(MISC)$/$(SHL1TARGET).flt
1021+
1022+SHL1VERSIONMAP= libtextcat.map
1023+
1024+# --- Targets ------------------------------------------------------
1025+
1026+.INCLUDE : target.mk
1027+
1028+# copy hand supplied configuration file for Win32 builds to the file
1029+# which is included in the source code
1030+$(SLOFILES) : config.h
1031+config.h :
1032+    $(GNUCOPY) $(OUT)$/misc$/build$/libtextcat-2.2$/src$/win32_config.h   $(OUT)$/misc$/build$/libtextcat-2.2$/src$/config.h
1033+
1034+
1035+$(MISC)$/$(SHL1TARGET).flt:  makefile.mk
1036+    @echo ------------------------------
1037+    @echo Making: $@
1038+    @echo Imp>$@
1039+    @echo __CT>>$@
1040+    @echo _real>>$@
1041+    @echo unnamed>>$@
1042--- misc/libtextcat-2.2/src/textcat.c	Thu May 22 13:32:43 2003
1043+++ misc/build/libtextcat-2.2/src/textcat.c	Mon Mar 31 11:29:14 2008
1044@@ -4,23 +4,23 @@
1045  * Copyright (C) 2003 WiseGuys Internet B.V.
1046  *
1047  * THE BSD LICENSE
1048- *
1049+ *
1050  * Redistribution and use in source and binary forms, with or without
1051  * modification, are permitted provided that the following conditions
1052  * are met:
1053- *
1054+ *
1055  * - Redistributions of source code must retain the above copyright
1056  * notice, this list of conditions and the following disclaimer.
1057- *
1058+ *
1059  * - Redistributions in binary form must reproduce the above copyright
1060  * notice, this list of conditions and the following disclaimer in the
1061  * documentation and/or other materials provided with the
1062  * distribution.
1063- *
1064+ *
1065  * - Neither the name of the WiseGuys Internet B.V. nor the names of
1066  * its contributors may be used to endorse or promote products derived
1067  * from this software without specific prior written permission.
1068- *
1069+ *
1070  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1071  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1072  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1073@@ -74,6 +74,7 @@
1074 typedef struct {
1075
1076 	void **fprint;
1077+        char *fprint_disable;
1078 	uint4 size;
1079 	uint4 maxsize;
1080
1081@@ -112,11 +113,21 @@
1082 		fp_Done( h->fprint[i] );
1083 	}
1084 	wg_free( h->fprint );
1085+        wg_free( h->fprint_disable );
1086 	wg_free( h );
1087
1088 }
1089
1090-extern void *textcat_Init( const char *conffile )
1091+/** Replaces older function */
1092+extern void *textcat_Init( const char *conffile ){
1093+    return special_textcat_Init( conffile, DEFAULT_FINGERPRINTS_PATH );
1094+}
1095+
1096+/**
1097+ * Originaly this function had only one parameter (conffile) it has been modified since OOo use
1098+ * Basicaly prefix is the directory path where fingerprints are stored
1099+ */
1100+extern void *special_textcat_Init( const char *conffile, const char *prefix )
1101 {
1102 	textcat_t *h;
1103 	char line[1024];
1104@@ -134,11 +145,13 @@
1105 	h->size = 0;
1106 	h->maxsize = 16;
1107 	h->fprint = (void **)wg_malloc( sizeof(void*) * h->maxsize );
1108+ h->fprint_disable = (char *)wg_malloc( sizeof(char*) * h->maxsize );   /*added to store the state of languages*/
1109
1110 	while ( wg_getline( line, 1024, fp ) ) {
1111 		char *p;
1112 		char *segment[4];
1113-		int res;
1114+                char finger_print_file_name[512];
1115+                int res;
1116
1117 		/*** Skip comments ***/
1118 #ifdef HAVE_STRCHR
1119@@ -156,17 +169,23 @@
1120 		/*** Ensure enough space ***/
1121 		if ( h->size == h->maxsize ) {
1122 			h->maxsize *= 2;
1123-			h->fprint = (void *)wg_realloc( h->fprint, sizeof(void*) * h->maxsize );
1124+			h->fprint = (void **)wg_realloc( h->fprint, sizeof(void*) * h->maxsize );
1125+                        h->fprint_disable = (char *)wg_realloc( h->fprint_disable, sizeof(char*) * h->maxsize );
1126 		}
1127
1128 		/*** Load data ***/
1129 		if ((h->fprint[ h->size ] = fp_Init( segment[1] ))==NULL) {
1130 			goto ERROR;
1131 		}
1132-		if ( fp_Read( h->fprint[h->size], segment[0], 400 ) == 0 ) {
1133+                finger_print_file_name[0] = '\0';
1134+                strcat(finger_print_file_name, prefix);
1135+                strcat(finger_print_file_name, segment[0]);
1136+
1137+                if ( fp_Read( h->fprint[h->size], finger_print_file_name, 400 ) == 0 ) {
1138 			textcat_Done(h);
1139 			goto ERROR;
1140-		}
1141+		}
1142+                h->fprint_disable[h->size] = 0xF0;  /*0xF0 is the code for enabled languages, 0x0F is for disabled*/
1143 		h->size++;
1144 	}
1145
1146@@ -203,11 +222,18 @@
1147 		result = _TEXTCAT_RESULT_SHORT;
1148 		goto READY;
1149 	}
1150-
1151+
1152 	/*** Calculate the score for each category. ***/
1153 	for (i=0; i<h->size; i++) {
1154-		int score = fp_Compare( h->fprint[i], unknown, threshold );
1155-		candidates[i].score = score;
1156+                int score;
1157+                if(h->fprint_disable[i] & 0x0F){    /*if this language is disabled*/
1158+                    score = MAXSCORE;
1159+                }
1160+                else{
1161+                    score = fp_Compare( h->fprint[i], unknown, threshold );
1162+                    /*printf("Score for %s : %i\n", fp_Name(h->fprint[i]), score);*/
1163+                }
1164+                candidates[i].score = score;
1165 		candidates[i].name = fp_Name( h->fprint[i] );
1166 		if ( score < minscore ) {
1167 			minscore = score;
1168@@ -218,7 +244,6 @@
1169 	/*** Find the best performers ***/
1170 	for (i=0; i<h->size; i++) {
1171 		if ( candidates[i].score < threshold ) {
1172-
1173 			if ( ++cnt == MAXCANDIDATES+1 ) {
1174 				break;
1175 			}
1176@@ -235,7 +260,7 @@
1177 	else {
1178 		char *p = result;
1179 		char *plimit = result+MAXOUTPUTSIZE;
1180-
1181+
1182 		qsort( candidates, cnt, sizeof(candidate_t), cmpcandidates );
1183
1184 		*p = '\0';
1185@@ -247,7 +272,7 @@
1186 	}
1187  READY:
1188 	fp_Done(unknown);
1189-#ifdef SHOULD_FREE
1190+#ifdef SHOULD_FREE
1191 	free(candidates);
1192 #undef SHOULD_FREE
1193 #endif
1194--- misc/libtextcat-2.2/src/textcat.h	Mon May 19 14:16:31 2003
1195+++ misc/build/libtextcat-2.2/src/textcat.h	Mon Mar 31 11:29:14 2008
1196@@ -40,6 +40,9 @@
1197 #define _TEXTCAT_RESULT_UNKOWN        "UNKNOWN"
1198 #define _TEXTCAT_RESULT_SHORT         "SHORT"
1199
1200+#ifdef __cplusplus
1201+extern "C" {
1202+#endif
1203
1204 /**
1205  * textcat_Init() - Initialize the text classifier. The textfile
1206@@ -51,10 +54,19 @@
1207  * Returns: handle on success, NULL on error. (At the moment, the
1208  * only way errors can occur, is when the library cannot read the
1209  * conffile, or one of the fingerprint files listed in it.)
1210+ *
1211+ * Replace older function (and has exacly the same behaviour)
1212+ * see below
1213  */
1214 extern void *textcat_Init( const char *conffile );
1215
1216 /**
1217+ * Originaly this function had only one parameter (conffile) it has been modified since OOo must be able to load alternativ DB
1218+ * Basicaly prefix is the directory path where fingerprints are stored
1219+ */
1220+extern void *special_textcat_Init( const char *conffile, const char *prefix );
1221+
1222+/**
1223  * textcat_Done() - Free up resources for handle
1224  */
1225 extern void textcat_Done( void *handle );
1226@@ -77,4 +89,8 @@
1227  * textcat_Version() - Returns a string describing the version of this classifier.
1228  */
1229 extern char *textcat_Version();
1230+
1231+#ifdef __cplusplus
1232+}
1233+#endif
1234 #endif
1235--- misc/libtextcat-2.2/src/utf8misc.c	Mon Mar 31 11:30:06 2008
1236+++ misc/build/libtextcat-2.2/src/utf8misc.c	Mon Mar 31 11:29:14 2008
1237@@ -1 +1,132 @@
1238-dummy
1239+/***************************************************************************
1240+ *   Copyright (C) 2006 by Jocelyn Merand                                  *
1241+ *   joc.mer@gmail.com                                                     *
1242+ *                                                                         *
1243+ * THE BSD LICENSE
1244+ *
1245+ * Redistribution and use in source and binary forms, with or without
1246+ * modification, are permitted provided that the following conditions
1247+ * are met:
1248+ *
1249+ * - Redistributions of source code must retain the above copyright
1250+ * notice, this list of conditions and the following disclaimer.
1251+ *
1252+ * - Redistributions in binary form must reproduce the above copyright
1253+ * notice, this list of conditions and the following disclaimer in the
1254+ * documentation and/or other materials provided with the
1255+ * distribution.
1256+ *
1257+ * - Neither the name of the WiseGuys Internet B.V. nor the names of
1258+ * its contributors may be used to endorse or promote products derived
1259+ * from this software without specific prior written permission.
1260+ *
1261+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1262+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1263+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1264+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1265+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1266+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1267+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1268+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1269+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1270+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1271+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1272+ ***************************************************************************/
1273+
1274+#ifndef _UTF8_MISC_H_
1275+#include "utf8misc.h"
1276+#endif
1277+
1278+
1279+int nextcharstart(const char *str, int position){
1280+    int pointer = position;
1281+
1282+    if(str[pointer] & ESCAPE_MASK){ /*if the first bit of the current char is 1*/
1283+
1284+        /*then str[pointer] is an escape character*/
1285+
1286+    char escape_char = ((str[pointer] & WEIGHT_MASK) << 1); /*and we use it to count (by bit translation) following characters (only the weightest part)*/
1287+
1288+    while(escape_char & ESCAPE_MASK && str[pointer]){/*every step, we move the byte of 1 bit left, when first bit is 0, it's finished*/
1289+        escape_char = escape_char <<1;
1290+        ++pointer;
1291+    }
1292+    }
1293+    if(str[pointer]){   /*finaly, if we are not on the \0 character, we jump to the next character*/
1294+        ++pointer;
1295+    }
1296+    return pointer;
1297+}
1298+
1299+
1300+int charcopy(const char *str, char *dest){
1301+
1302+    int pointer = 0;
1303+    if(str[pointer] & ESCAPE_MASK){ /*if the first bit of the current char is 1*/
1304+
1305+        /*then str[pointer] is an escape character*/
1306+
1307+        char escape_char = ((str[pointer] & WEIGHT_MASK) << 1); /*and we use it to count following characters (only the weightest part)*/
1308+
1309+        while(escape_char & ESCAPE_MASK && str[pointer]){   /*every step, we move the byte of 1 bit left, when first bit is 0, it's finished*/
1310+            dest[pointer] = str[pointer];
1311+            escape_char = escape_char <<1;
1312+            ++pointer;
1313+        }
1314+    }
1315+    if(str[pointer]){
1316+        dest[pointer] = str[pointer];
1317+        ++pointer;
1318+    }
1319+
1320+    return pointer;
1321+}
1322+
1323+
1324+int issame( char *lex, char *key, int len )
1325+{
1326+    /*printf("[%s] prefix of [%s] with length %i", lex, key, len);*/
1327+    int char_counter = 0;
1328+    int pointer = 0;
1329+    while(char_counter < len) {
1330+
1331+        if(key[pointer] & ESCAPE_MASK){ /*if the first bit of the current char is 1*/
1332+
1333+            /*then key[pointer] is an escap character*/
1334+
1335+            char escape_char = ((key[pointer] & WEIGHT_MASK) << 1);     /*and we use it to count (only the weightest part)*/
1336+
1337+            while(escape_char & ESCAPE_MASK && key[pointer] == lex[pointer] ){
1338+                escape_char = escape_char <<1;
1339+                ++pointer;
1340+            }
1341+        }
1342+        ++char_counter; /*and we are on a new utf8 character*/
1343+        if ( key[pointer] != lex[pointer] ) {
1344+            return 0;
1345+            /*printf(" NO\n", lex, key, len);*/
1346+        }
1347+        ++pointer;
1348+    }
1349+    if ( lex[pointer] != '\0' ) {
1350+        return 0;
1351+        /*printf(" NO\n");*/
1352+    }
1353+
1354+    /*printf(" YES\n");*/
1355+
1356+    return 1;
1357+}
1358+
1359+
1360+extern int utfstrlen(const char* str){
1361+    int char_counter = 0;
1362+    int pointer = 0;
1363+    while(str[pointer]) {
1364+        pointer = nextcharstart(str, pointer);
1365+
1366+        ++char_counter; /*and we are on a new utf8 character*/
1367+    }
1368+    return char_counter;
1369+}
1370+
1371--- misc/libtextcat-2.2/src/utf8misc.h	Mon Mar 31 11:30:06 2008
1372+++ misc/build/libtextcat-2.2/src/utf8misc.h	Mon Mar 31 11:29:14 2008
1373@@ -1 +1,88 @@
1374-dummy
1375+/***************************************************************************
1376+ *   Copyright (C) 2006 by Jocelyn Merand                                  *
1377+ *   joc.mer@gmail.com                                                     *
1378+ *                                                                         *
1379+ * THE BSD LICENSE
1380+ *
1381+ * Redistribution and use in source and binary forms, with or without
1382+ * modification, are permitted provided that the following conditions
1383+ * are met:
1384+ *
1385+ * - Redistributions of source code must retain the above copyright
1386+ * notice, this list of conditions and the following disclaimer.
1387+ *
1388+ * - Redistributions in binary form must reproduce the above copyright
1389+ * notice, this list of conditions and the following disclaimer in the
1390+ * documentation and/or other materials provided with the
1391+ * distribution.
1392+ *
1393+ * - Neither the name of the WiseGuys Internet B.V. nor the names of
1394+ * its contributors may be used to endorse or promote products derived
1395+ * from this software without specific prior written permission.
1396+ *
1397+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1398+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1399+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1400+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1401+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1402+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1403+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1404+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1405+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1406+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1407+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1408+ ***************************************************************************/
1409+
1410+#ifndef _UTF8_MISC_H_
1411+#define _UTF8_MISC_H_
1412+
1413+/**
1414+ * These variables are used in character processing functions
1415+ * These have been added to manage utf-8 symbols, particularly escape chars
1416+ */
1417+#ifdef _UTF8_
1418+#define ESCAPE_MASK 0x80
1419+#define WEIGHT_MASK 0xF0
1420+#else
1421+#define ESCAPE_MASK 0xFF
1422+#define WEIGHT_MASK 0x00
1423+#endif
1424+
1425+
1426+/*
1427+ * Is used to jump to the next start of char
1428+ * of course it's only usefull when encoding is utf-8
1429+ * This function have been added by Jocelyn Merand to use libtextcat in OOo
1430+ */
1431+int nextcharstart(const char *str, int position);
1432+
1433+
1434+/*Copy the char in str to dest
1435+ * of course it's only usefull when encoding is utf8 and the symbol is encoded with more than 1 char
1436+ * return the number of char jumped
1437+ * This function have been added by Jocelyn Merand to use libtextcat in OOo
1438+ */
1439+int charcopy(const char *str, char *dest);
1440+
1441+
1442+/* checks if n-gram lex is a prefix of key and of length len
1443+* if _UTF8_ is defined, it uses escap characters and len is not realy the length of lex
1444+* in this case, len is the number of utf-8 char strlen("€") == 3 but len == 1
1445+*/
1446+int issame( char *lex, char *key, int len );
1447+
1448+
1449+/* Counts the number of characters
1450+* if _UTF8_ is defined, it uses escap characters and the result is not realy the length of str
1451+* in this case, the result is the number of utf-8 char strlen("€") == 3 but utfstrlen("€") == 1
1452+*/
1453+#ifdef __cplusplus
1454+extern "C" {
1455+#endif
1456+extern int utfstrlen(const char* str);
1457+#ifdef __cplusplus
1458+}
1459+#endif
1460+
1461+#endif
1462+
1463--- misc/libtextcat-2.2/src/win32_config.h	Mon Mar 31 11:30:06 2008
1464+++ misc/build/libtextcat-2.2/src/win32_config.h	Mon Mar 31 11:29:14 2008
1465@@ -1 +1,136 @@
1466-dummy
1467+/* src/config.h.  Generated by configure.  */
1468+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
1469+
1470+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
1471+   systems. This function is required for `alloca.c' support on those systems.
1472+   */
1473+/* #undef CRAY_STACKSEG_END */
1474+
1475+/* Define to 1 if using `alloca.c'. */
1476+/* #undef C_ALLOCA */
1477+
1478+/* Define to 1 if you have `alloca', as a function or macro. */
1479+/* #undef HAVE_ALLOCA */
1480+
1481+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
1482+   */
1483+/* #undef HAVE_ALLOCA_H */
1484+
1485+/* Define to 1 if you have the <dlfcn.h> header file. */
1486+#define HAVE_DLFCN_H 1
1487+
1488+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
1489+/* #undef HAVE_DOPRNT */
1490+
1491+/* Define to 1 if you have the `gettimeofday' function. */
1492+/* #undef  HAVE_GETTIMEOFDAY */
1493+
1494+/* Define to 1 if you have the <inttypes.h> header file. */
1495+/* #undef  HAVE_INTTYPES_H */
1496+
1497+/* Define to 1 if you have the <limits.h> header file. */
1498+#define HAVE_LIMITS_H 1
1499+
1500+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
1501+   to 0 otherwise. */
1502+#define HAVE_MALLOC 1
1503+
1504+/* Define to 1 if you have the <memory.h> header file. */
1505+#define HAVE_MEMORY_H 1
1506+
1507+/* Define to 1 if you have the `memset' function. */
1508+#define HAVE_MEMSET 1
1509+
1510+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
1511+   and to 0 otherwise. */
1512+#define HAVE_REALLOC 1
1513+
1514+/* Define to 1 if you have the <stdint.h> header file. */
1515+/* #undef  HAVE_STDINT_H */
1516+
1517+/* Define to 1 if you have the <stdlib.h> header file. */
1518+#define HAVE_STDLIB_H 1
1519+
1520+/* Define to 1 if you have the `strchr' function. */
1521+#define HAVE_STRCHR 1
1522+
1523+/* Define to 1 if you have the `strdup' function. */
1524+#define HAVE_STRDUP 1
1525+
1526+/* Define to 1 if you have the <strings.h> header file. */
1527+/* #undef HAVE_STRINGS_H */
1528+
1529+/* Define to 1 if you have the <string.h> header file. */
1530+#define HAVE_STRING_H 1
1531+
1532+/* Define to 1 if you have the `strpbrk' function. */
1533+#define HAVE_STRPBRK 1
1534+
1535+/* Define to 1 if you have the <sys/stat.h> header file. */
1536+#define HAVE_SYS_STAT_H 1
1537+
1538+/* Define to 1 if you have the <sys/time.h> header file. */
1539+/* #undef  HAVE_SYS_TIME_H */
1540+
1541+/* Define to 1 if you have the <sys/types.h> header file. */
1542+#define HAVE_SYS_TYPES_H 1
1543+
1544+/* Define to 1 if you have the <unistd.h> header file. */
1545+#define HAVE_UNISTD_H 1
1546+
1547+/* Define to 1 if you have the `vprintf' function. */
1548+#define HAVE_VPRINTF 1
1549+
1550+/* Name of package */
1551+#define PACKAGE "libtextcat"
1552+
1553+/* Define to the address where bug reports for this package should be sent. */
1554+#define PACKAGE_BUGREPORT ""
1555+
1556+/* Define to the full name of this package. */
1557+#define PACKAGE_NAME "libtextcat"
1558+
1559+/* Define to the full name and version of this package. */
1560+#define PACKAGE_STRING "libtextcat 2.2"
1561+
1562+/* Define to the one symbol short name of this package. */
1563+#define PACKAGE_TARNAME "libtextcat"
1564+
1565+/* Define to the version of this package. */
1566+#define PACKAGE_VERSION "2.2"
1567+
1568+/* If using the C implementation of alloca, define if you know the
1569+   direction of stack growth for your system; otherwise it will be
1570+   automatically deduced at run-time.
1571+        STACK_DIRECTION > 0 => grows toward higher addresses
1572+        STACK_DIRECTION < 0 => grows toward lower addresses
1573+        STACK_DIRECTION = 0 => direction of growth unknown */
1574+/* #undef STACK_DIRECTION */
1575+
1576+/* Define to 1 if you have the ANSI C header files. */
1577+#define STDC_HEADERS 1
1578+
1579+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
1580+#define TIME_WITH_SYS_TIME 1
1581+
1582+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
1583+/* #undef TM_IN_SYS_TIME */
1584+
1585+/* Version number of package */
1586+#define VERSION "2.2"
1587+
1588+/* Define to empty if `const' does not conform to ANSI C. */
1589+/* #undef const */
1590+
1591+/* Define as `__inline' if that's what the C compiler calls it, or to nothing
1592+   if it is not supported. */
1593+/* #undef inline */
1594+
1595+/* Define to rpl_malloc if the replacement function should be used. */
1596+/* #undef malloc */
1597+
1598+/* Define to rpl_realloc if the replacement function should be used. */
1599+/* #undef realloc */
1600+
1601+/* Define to `unsigned' if <sys/types.h> does not define. */
1602+/* #undef size_t */
1603--- misc/libtextcat-2.2/config.guess	2010-04-15 09:20:04.000000000 +0000
1604+++ misc/build/libtextcat-2.2/config.guess	2010-04-15 09:20:41.000000000 +0000
1605@@ -1,9 +1,10 @@
1606 #! /bin/sh
1607 # Attempt to guess a canonical system name.
1608 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
1609-#   2000, 2001, 2002 Free Software Foundation, Inc.
1610+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
1611+#   Free Software Foundation, Inc.
1612
1613-timestamp='2002-10-21'
1614+timestamp='2009-12-30'
1615
1616 # This file is free software; you can redistribute it and/or modify it
1617 # under the terms of the GNU General Public License as published by
1618@@ -17,23 +18,25 @@
1619 #
1620 # You should have received a copy of the GNU General Public License
1621 # along with this program; if not, write to the Free Software
1622-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1623+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
1624+# 02110-1301, USA.
1625 #
1626 # As a special exception to the GNU General Public License, if you
1627 # distribute this file as part of a program that contains a
1628 # configuration script generated by Autoconf, you may include it under
1629 # the same distribution terms that you use for the rest of that program.
1630
1631-# Originally written by Per Bothner <per@bothner.com>.
1632-# Please send patches to <config-patches@gnu.org>.  Submit a context
1633-# diff and a properly formatted ChangeLog entry.
1634+
1635+# Originally written by Per Bothner.  Please send patches (context
1636+# diff format) to <config-patches@gnu.org> and include a ChangeLog
1637+# entry.
1638 #
1639 # This script attempts to guess a canonical system name similar to
1640 # config.sub.  If it succeeds, it prints the system name on stdout, and
1641 # exits with 0.  Otherwise, it exits with 1.
1642 #
1643-# The plan is that this can be called by configure scripts if you
1644-# don't specify an explicit build system type.
1645+# You can get the latest version of this script from:
1646+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1647
1648 me=`echo "$0" | sed -e 's,.*/,,'`
1649
1650@@ -53,8 +56,9 @@
1651 GNU config.guess ($timestamp)
1652
1653 Originally written by Per Bothner.
1654-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
1655-Free Software Foundation, Inc.
1656+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
1657+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
1658+Software Foundation, Inc.
1659
1660 This is free software; see the source for copying conditions.  There is NO
1661 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
1662@@ -66,11 +70,11 @@
1663 while test $# -gt 0 ; do
1664   case $1 in
1665     --time-stamp | --time* | -t )
1666-       echo "$timestamp" ; exit 0 ;;
1667+       echo "$timestamp" ; exit ;;
1668     --version | -v )
1669-       echo "$version" ; exit 0 ;;
1670+       echo "$version" ; exit ;;
1671     --help | --h* | -h )
1672-       echo "$usage"; exit 0 ;;
1673+       echo "$usage"; exit ;;
1674     -- )     # Stop option processing
1675        shift; break ;;
1676     - )	# Use stdin as input.
1677@@ -98,14 +102,18 @@
1678 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1679 # use `HOST_CC' if defined, but it is deprecated.
1680
1681-# This shell variable is my proudest work .. or something. --bje
1682+# Portable tmp directory creation inspired by the Autoconf team.
1683
1684-set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
1685-(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
1686-   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
1687-dummy=$tmpdir/dummy ;
1688-files="$dummy.c $dummy.o $dummy.rel $dummy" ;
1689-trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
1690+set_cc_for_build='
1691+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
1692+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
1693+: ${TMPDIR=/tmp} ;
1694+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1695+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
1696+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1697+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
1698+dummy=$tmp/dummy ;
1699+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
1700 case $CC_FOR_BUILD,$HOST_CC,$CC in
1701  ,,)    echo "int x;" > $dummy.c ;
1702 	for c in cc gcc c89 c99 ; do
1703@@ -113,15 +121,13 @@
1704 	     CC_FOR_BUILD="$c"; break ;
1705 	  fi ;
1706 	done ;
1707-	rm -f $files ;
1708 	if test x"$CC_FOR_BUILD" = x ; then
1709 	  CC_FOR_BUILD=no_compiler_found ;
1710 	fi
1711 	;;
1712  ,,*)   CC_FOR_BUILD=$CC ;;
1713  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1714-esac ;
1715-unset files'
1716+esac ; set_cc_for_build= ;'
1717
1718 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1719 # (ghazi@noc.rutgers.edu 1994-08-24)
1720@@ -156,6 +162,7 @@
1721 	    arm*) machine=arm-unknown ;;
1722 	    sh3el) machine=shl-unknown ;;
1723 	    sh3eb) machine=sh-unknown ;;
1724+	    sh5el) machine=sh5le-unknown ;;
1725 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1726 	esac
1727 	# The Operating System including object format, if it has switched
1728@@ -164,7 +171,7 @@
1729 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1730 		eval $set_cc_for_build
1731 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1732-			| grep __ELF__ >/dev/null
1733+			| grep -q __ELF__
1734 		then
1735 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
1736 		    # Return netbsd for either.  FIX?
1737@@ -178,144 +185,128 @@
1738 		;;
1739 	esac
1740 	# The OS release
1741-	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
1742+	# Debian GNU/NetBSD machines have a different userland, and
1743+	# thus, need a distinct triplet. However, they do not need
1744+	# kernel version information, so it can be replaced with a
1745+	# suitable tag, in the style of linux-gnu.
1746+	case "${UNAME_VERSION}" in
1747+	    Debian*)
1748+		release='-gnu'
1749+		;;
1750+	    *)
1751+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
1752+		;;
1753+	esac
1754 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
1755 	# contains redundant information, the shorter form:
1756 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
1757 	echo "${machine}-${os}${release}"
1758-	exit 0 ;;
1759-    amiga:OpenBSD:*:*)
1760-	echo m68k-unknown-openbsd${UNAME_RELEASE}
1761-	exit 0 ;;
1762-    arc:OpenBSD:*:*)
1763-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
1764-	exit 0 ;;
1765-    hp300:OpenBSD:*:*)
1766-	echo m68k-unknown-openbsd${UNAME_RELEASE}
1767-	exit 0 ;;
1768-    mac68k:OpenBSD:*:*)
1769-	echo m68k-unknown-openbsd${UNAME_RELEASE}
1770-	exit 0 ;;
1771-    macppc:OpenBSD:*:*)
1772-	echo powerpc-unknown-openbsd${UNAME_RELEASE}
1773-	exit 0 ;;
1774-    mvme68k:OpenBSD:*:*)
1775-	echo m68k-unknown-openbsd${UNAME_RELEASE}
1776-	exit 0 ;;
1777-    mvme88k:OpenBSD:*:*)
1778-	echo m88k-unknown-openbsd${UNAME_RELEASE}
1779-	exit 0 ;;
1780-    mvmeppc:OpenBSD:*:*)
1781-	echo powerpc-unknown-openbsd${UNAME_RELEASE}
1782-	exit 0 ;;
1783-    pmax:OpenBSD:*:*)
1784-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
1785-	exit 0 ;;
1786-    sgi:OpenBSD:*:*)
1787-	echo mipseb-unknown-openbsd${UNAME_RELEASE}
1788-	exit 0 ;;
1789-    sun3:OpenBSD:*:*)
1790-	echo m68k-unknown-openbsd${UNAME_RELEASE}
1791-	exit 0 ;;
1792-    wgrisc:OpenBSD:*:*)
1793-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
1794-	exit 0 ;;
1795+	exit ;;
1796     *:OpenBSD:*:*)
1797-	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
1798-	exit 0 ;;
1799+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
1800+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
1801+	exit ;;
1802+    *:ekkoBSD:*:*)
1803+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
1804+	exit ;;
1805+    *:SolidBSD:*:*)
1806+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
1807+	exit ;;
1808+    macppc:MirBSD:*:*)
1809+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
1810+	exit ;;
1811+    *:MirBSD:*:*)
1812+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
1813+	exit ;;
1814     alpha:OSF1:*:*)
1815-	if test $UNAME_RELEASE = "V4.0"; then
1816+	case $UNAME_RELEASE in
1817+	*4.0)
1818 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
1819-	fi
1820+		;;
1821+	*5.*)
1822+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
1823+		;;
1824+	esac
1825+	# According to Compaq, /usr/sbin/psrinfo has been available on
1826+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
1827+	# covers most systems running today.  This code pipes the CPU
1828+	# types through head -n 1, so we only detect the type of CPU 0.
1829+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
1830+	case "$ALPHA_CPU_TYPE" in
1831+	    "EV4 (21064)")
1832+		UNAME_MACHINE="alpha" ;;
1833+	    "EV4.5 (21064)")
1834+		UNAME_MACHINE="alpha" ;;
1835+	    "LCA4 (21066/21068)")
1836+		UNAME_MACHINE="alpha" ;;
1837+	    "EV5 (21164)")
1838+		UNAME_MACHINE="alphaev5" ;;
1839+	    "EV5.6 (21164A)")
1840+		UNAME_MACHINE="alphaev56" ;;
1841+	    "EV5.6 (21164PC)")
1842+		UNAME_MACHINE="alphapca56" ;;
1843+	    "EV5.7 (21164PC)")
1844+		UNAME_MACHINE="alphapca57" ;;
1845+	    "EV6 (21264)")
1846+		UNAME_MACHINE="alphaev6" ;;
1847+	    "EV6.7 (21264A)")
1848+		UNAME_MACHINE="alphaev67" ;;
1849+	    "EV6.8CB (21264C)")
1850+		UNAME_MACHINE="alphaev68" ;;
1851+	    "EV6.8AL (21264B)")
1852+		UNAME_MACHINE="alphaev68" ;;
1853+	    "EV6.8CX (21264D)")
1854+		UNAME_MACHINE="alphaev68" ;;
1855+	    "EV6.9A (21264/EV69A)")
1856+		UNAME_MACHINE="alphaev69" ;;
1857+	    "EV7 (21364)")
1858+		UNAME_MACHINE="alphaev7" ;;
1859+	    "EV7.9 (21364A)")
1860+		UNAME_MACHINE="alphaev79" ;;
1861+	esac
1862+	# A Pn.n version is a patched version.
1863 	# A Vn.n version is a released version.
1864 	# A Tn.n version is a released field test version.
1865 	# A Xn.n version is an unreleased experimental baselevel.
1866 	# 1.2 uses "1.2" for uname -r.
1867-	eval $set_cc_for_build
1868-	cat <<EOF >$dummy.s
1869-	.data
1870-\$Lformat:
1871-	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
1872-
1873-	.text
1874-	.globl main
1875-	.align 4
1876-	.ent main
1877-main:
1878-	.frame \$30,16,\$26,0
1879-	ldgp \$29,0(\$27)
1880-	.prologue 1
1881-	.long 0x47e03d80 # implver \$0
1882-	lda \$2,-1
1883-	.long 0x47e20c21 # amask \$2,\$1
1884-	lda \$16,\$Lformat
1885-	mov \$0,\$17
1886-	not \$1,\$18
1887-	jsr \$26,printf
1888-	ldgp \$29,0(\$26)
1889-	mov 0,\$16
1890-	jsr \$26,exit
1891-	.end main
1892-EOF
1893-	$CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null
1894-	if test "$?" = 0 ; then
1895-		case `$dummy` in
1896-			0-0)
1897-				UNAME_MACHINE="alpha"
1898-				;;
1899-			1-0)
1900-				UNAME_MACHINE="alphaev5"
1901-				;;
1902-			1-1)
1903-				UNAME_MACHINE="alphaev56"
1904-				;;
1905-			1-101)
1906-				UNAME_MACHINE="alphapca56"
1907-				;;
1908-			2-303)
1909-				UNAME_MACHINE="alphaev6"
1910-				;;
1911-			2-307)
1912-				UNAME_MACHINE="alphaev67"
1913-				;;
1914-			2-1307)
1915-				UNAME_MACHINE="alphaev68"
1916-				;;
1917-			3-1307)
1918-				UNAME_MACHINE="alphaev7"
1919-				;;
1920-		esac
1921-	fi
1922-	rm -f $dummy.s $dummy && rmdir $tmpdir
1923-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
1924-	exit 0 ;;
1925+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
1926+	exit ;;
1927     Alpha\ *:Windows_NT*:*)
1928 	# How do we know it's Interix rather than the generic POSIX subsystem?
1929 	# Should we change UNAME_MACHINE based on the output of uname instead
1930 	# of the specific Alpha model?
1931 	echo alpha-pc-interix
1932-	exit 0 ;;
1933+	exit ;;
1934     21064:Windows_NT:50:3)
1935 	echo alpha-dec-winnt3.5
1936-	exit 0 ;;
1937+	exit ;;
1938     Amiga*:UNIX_System_V:4.0:*)
1939 	echo m68k-unknown-sysv4
1940-	exit 0;;
1941+	exit ;;
1942     *:[Aa]miga[Oo][Ss]:*:*)
1943 	echo ${UNAME_MACHINE}-unknown-amigaos
1944-	exit 0 ;;
1945+	exit ;;
1946     *:[Mm]orph[Oo][Ss]:*:*)
1947 	echo ${UNAME_MACHINE}-unknown-morphos
1948-	exit 0 ;;
1949+	exit ;;
1950     *:OS/390:*:*)
1951 	echo i370-ibm-openedition
1952-	exit 0 ;;
1953+	exit ;;
1954+    *:z/VM:*:*)
1955+	echo s390-ibm-zvmoe
1956+	exit ;;
1957+    *:OS400:*:*)
1958+        echo powerpc-ibm-os400
1959+	exit ;;
1960     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
1961 	echo arm-acorn-riscix${UNAME_RELEASE}
1962-	exit 0;;
1963+	exit ;;
1964+    arm:riscos:*:*|arm:RISCOS:*:*)
1965+	echo arm-unknown-riscos
1966+	exit ;;
1967     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
1968 	echo hppa1.1-hitachi-hiuxmpp
1969-	exit 0;;
1970+	exit ;;
1971     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
1972 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
1973 	if test "`(/bin/universe) 2>/dev/null`" = att ; then
1974@@ -323,29 +314,51 @@
1975 	else
1976 		echo pyramid-pyramid-bsd
1977 	fi
1978-	exit 0 ;;
1979+	exit ;;
1980     NILE*:*:*:dcosx)
1981 	echo pyramid-pyramid-svr4
1982-	exit 0 ;;
1983-    DRS?6000:UNIX_SV:4.2*:7*)
1984+	exit ;;
1985+    DRS?6000:unix:4.0:6*)
1986+	echo sparc-icl-nx6
1987+	exit ;;
1988+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
1989 	case `/usr/bin/uname -p` in
1990-	    sparc) echo sparc-icl-nx7 && exit 0 ;;
1991+	    sparc) echo sparc-icl-nx7; exit ;;
1992 	esac ;;
1993+    s390x:SunOS:*:*)
1994+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1995+	exit ;;
1996     sun4H:SunOS:5.*:*)
1997 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1998-	exit 0 ;;
1999+	exit ;;
2000     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
2001 	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2002-	exit 0 ;;
2003-    i86pc:SunOS:5.*:*)
2004-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2005-	exit 0 ;;
2006+	exit ;;
2007+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
2008+	echo i386-pc-auroraux${UNAME_RELEASE}
2009+	exit ;;
2010+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
2011+	eval $set_cc_for_build
2012+	SUN_ARCH="i386"
2013+	# If there is a compiler, see if it is configured for 64-bit objects.
2014+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
2015+	# This test works for both compilers.
2016+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
2017+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
2018+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
2019+		grep IS_64BIT_ARCH >/dev/null
2020+	    then
2021+		SUN_ARCH="x86_64"
2022+	    fi
2023+	fi
2024+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2025+	exit ;;
2026     sun4*:SunOS:6*:*)
2027 	# According to config.sub, this is the proper way to canonicalize
2028 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
2029 	# it's likely to be more like Solaris than SunOS4.
2030 	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2031-	exit 0 ;;
2032+	exit ;;
2033     sun4*:SunOS:*:*)
2034 	case "`/usr/bin/arch -k`" in
2035 	    Series*|S4*)
2036@@ -354,10 +367,10 @@
2037 	esac
2038 	# Japanese Language versions have a version number like `4.1.3-JL'.
2039 	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
2040-	exit 0 ;;
2041+	exit ;;
2042     sun3*:SunOS:*:*)
2043 	echo m68k-sun-sunos${UNAME_RELEASE}
2044-	exit 0 ;;
2045+	exit ;;
2046     sun*:*:4.2BSD:*)
2047 	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
2048 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
2049@@ -369,10 +382,10 @@
2050 		echo sparc-sun-sunos${UNAME_RELEASE}
2051 		;;
2052 	esac
2053-	exit 0 ;;
2054+	exit ;;
2055     aushp:SunOS:*:*)
2056 	echo sparc-auspex-sunos${UNAME_RELEASE}
2057-	exit 0 ;;
2058+	exit ;;
2059     # The situation for MiNT is a little confusing.  The machine name
2060     # can be virtually everything (everything which is not
2061     # "atarist" or "atariste" at least should have a processor
2062@@ -383,37 +396,40 @@
2063     # be no problem.
2064     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
2065         echo m68k-atari-mint${UNAME_RELEASE}
2066-	exit 0 ;;
2067+	exit ;;
2068     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
2069 	echo m68k-atari-mint${UNAME_RELEASE}
2070-        exit 0 ;;
2071+        exit ;;
2072     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
2073         echo m68k-atari-mint${UNAME_RELEASE}
2074-	exit 0 ;;
2075+	exit ;;
2076     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
2077         echo m68k-milan-mint${UNAME_RELEASE}
2078-        exit 0 ;;
2079+        exit ;;
2080     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
2081         echo m68k-hades-mint${UNAME_RELEASE}
2082-        exit 0 ;;
2083+        exit ;;
2084     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
2085         echo m68k-unknown-mint${UNAME_RELEASE}
2086-        exit 0 ;;
2087+        exit ;;
2088+    m68k:machten:*:*)
2089+	echo m68k-apple-machten${UNAME_RELEASE}
2090+	exit ;;
2091     powerpc:machten:*:*)
2092 	echo powerpc-apple-machten${UNAME_RELEASE}
2093-	exit 0 ;;
2094+	exit ;;
2095     RISC*:Mach:*:*)
2096 	echo mips-dec-mach_bsd4.3
2097-	exit 0 ;;
2098+	exit ;;
2099     RISC*:ULTRIX:*:*)
2100 	echo mips-dec-ultrix${UNAME_RELEASE}
2101-	exit 0 ;;
2102+	exit ;;
2103     VAX*:ULTRIX*:*:*)
2104 	echo vax-dec-ultrix${UNAME_RELEASE}
2105-	exit 0 ;;
2106+	exit ;;
2107     2020:CLIX:*:* | 2430:CLIX:*:*)
2108 	echo clipper-intergraph-clix${UNAME_RELEASE}
2109-	exit 0 ;;
2110+	exit ;;
2111     mips:*:*:UMIPS | mips:*:*:RISCos)
2112 	eval $set_cc_for_build
2113 	sed 's/^	//' << EOF >$dummy.c
2114@@ -437,33 +453,33 @@
2115 	  exit (-1);
2116 	}
2117 EOF
2118-	$CC_FOR_BUILD -o $dummy $dummy.c \
2119-	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
2120-	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
2121-	rm -f $dummy.c $dummy && rmdir $tmpdir
2122+	$CC_FOR_BUILD -o $dummy $dummy.c &&
2123+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
2124+	  SYSTEM_NAME=`$dummy $dummyarg` &&
2125+	    { echo "$SYSTEM_NAME"; exit; }
2126 	echo mips-mips-riscos${UNAME_RELEASE}
2127-	exit 0 ;;
2128+	exit ;;
2129     Motorola:PowerMAX_OS:*:*)
2130 	echo powerpc-motorola-powermax
2131-	exit 0 ;;
2132+	exit ;;
2133     Motorola:*:4.3:PL8-*)
2134 	echo powerpc-harris-powermax
2135-	exit 0 ;;
2136-    Night_Hawk:*:*:PowerMAX_OS)
2137+	exit ;;
2138+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
2139 	echo powerpc-harris-powermax
2140-	exit 0 ;;
2141+	exit ;;
2142     Night_Hawk:Power_UNIX:*:*)
2143 	echo powerpc-harris-powerunix
2144-	exit 0 ;;
2145+	exit ;;
2146     m88k:CX/UX:7*:*)
2147 	echo m88k-harris-cxux7
2148-	exit 0 ;;
2149+	exit ;;
2150     m88k:*:4*:R4*)
2151 	echo m88k-motorola-sysv4
2152-	exit 0 ;;
2153+	exit ;;
2154     m88k:*:3*:R3*)
2155 	echo m88k-motorola-sysv3
2156-	exit 0 ;;
2157+	exit ;;
2158     AViiON:dgux:*:*)
2159         # DG/UX returns AViiON for all architectures
2160         UNAME_PROCESSOR=`/usr/bin/uname -p`
2161@@ -479,29 +495,29 @@
2162 	else
2163 	    echo i586-dg-dgux${UNAME_RELEASE}
2164 	fi
2165- 	exit 0 ;;
2166+ 	exit ;;
2167     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
2168 	echo m88k-dolphin-sysv3
2169-	exit 0 ;;
2170+	exit ;;
2171     M88*:*:R3*:*)
2172 	# Delta 88k system running SVR3
2173 	echo m88k-motorola-sysv3
2174-	exit 0 ;;
2175+	exit ;;
2176     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
2177 	echo m88k-tektronix-sysv3
2178-	exit 0 ;;
2179+	exit ;;
2180     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
2181 	echo m68k-tektronix-bsd
2182-	exit 0 ;;
2183+	exit ;;
2184     *:IRIX*:*:*)
2185 	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
2186-	exit 0 ;;
2187+	exit ;;
2188     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
2189-	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
2190-	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
2191+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
2192+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
2193     i*86:AIX:*:*)
2194 	echo i386-ibm-aix
2195-	exit 0 ;;
2196+	exit ;;
2197     ia64:AIX:*:*)
2198 	if [ -x /usr/bin/oslevel ] ; then
2199 		IBM_REV=`/usr/bin/oslevel`
2200@@ -509,7 +525,7 @@
2201 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
2202 	fi
2203 	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
2204-	exit 0 ;;
2205+	exit ;;
2206     *:AIX:2:3)
2207 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
2208 		eval $set_cc_for_build
2209@@ -524,16 +540,19 @@
2210 			exit(0);
2211 			}
2212 EOF
2213-		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
2214-		rm -f $dummy.c $dummy && rmdir $tmpdir
2215-		echo rs6000-ibm-aix3.2.5
2216+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
2217+		then
2218+			echo "$SYSTEM_NAME"
2219+		else
2220+			echo rs6000-ibm-aix3.2.5
2221+		fi
2222 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
2223 		echo rs6000-ibm-aix3.2.4
2224 	else
2225 		echo rs6000-ibm-aix3.2
2226 	fi
2227-	exit 0 ;;
2228-    *:AIX:*:[45])
2229+	exit ;;
2230+    *:AIX:*:[456])
2231 	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
2232 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
2233 		IBM_ARCH=rs6000
2234@@ -546,28 +565,28 @@
2235 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
2236 	fi
2237 	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
2238-	exit 0 ;;
2239+	exit ;;
2240     *:AIX:*:*)
2241 	echo rs6000-ibm-aix
2242-	exit 0 ;;
2243+	exit ;;
2244     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
2245 	echo romp-ibm-bsd4.4
2246-	exit 0 ;;
2247+	exit ;;
2248     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
2249 	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
2250-	exit 0 ;;                           # report: romp-ibm BSD 4.3
2251+	exit ;;                             # report: romp-ibm BSD 4.3
2252     *:BOSX:*:*)
2253 	echo rs6000-bull-bosx
2254-	exit 0 ;;
2255+	exit ;;
2256     DPX/2?00:B.O.S.:*:*)
2257 	echo m68k-bull-sysv3
2258-	exit 0 ;;
2259+	exit ;;
2260     9000/[34]??:4.3bsd:1.*:*)
2261 	echo m68k-hp-bsd
2262-	exit 0 ;;
2263+	exit ;;
2264     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
2265 	echo m68k-hp-bsd4.4
2266-	exit 0 ;;
2267+	exit ;;
2268     9000/[34678]??:HP-UX:*:*)
2269 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
2270 	case "${UNAME_MACHINE}" in
2271@@ -624,16 +643,36 @@
2272               }
2273 EOF
2274 		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
2275-		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
2276-		    rm -f $dummy.c $dummy && rmdir $tmpdir
2277+		    test -z "$HP_ARCH" && HP_ARCH=hppa
2278 		fi ;;
2279 	esac
2280+	if [ ${HP_ARCH} = "hppa2.0w" ]
2281+	then
2282+	    eval $set_cc_for_build
2283+
2284+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
2285+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
2286+	    # generating 64-bit code.  GNU and HP use different nomenclature:
2287+	    #
2288+	    # $ CC_FOR_BUILD=cc ./config.guess
2289+	    # => hppa2.0w-hp-hpux11.23
2290+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
2291+	    # => hppa64-hp-hpux11.23
2292+
2293+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
2294+		grep -q __LP64__
2295+	    then
2296+		HP_ARCH="hppa2.0w"
2297+	    else
2298+		HP_ARCH="hppa64"
2299+	    fi
2300+	fi
2301 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
2302-	exit 0 ;;
2303+	exit ;;
2304     ia64:HP-UX:*:*)
2305 	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
2306 	echo ia64-hp-hpux${HPUX_REV}
2307-	exit 0 ;;
2308+	exit ;;
2309     3050*:HI-UX:*:*)
2310 	eval $set_cc_for_build
2311 	sed 's/^	//' << EOF >$dummy.c
2312@@ -661,186 +700,248 @@
2313 	  exit (0);
2314 	}
2315 EOF
2316-	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
2317-	rm -f $dummy.c $dummy && rmdir $tmpdir
2318+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
2319+		{ echo "$SYSTEM_NAME"; exit; }
2320 	echo unknown-hitachi-hiuxwe2
2321-	exit 0 ;;
2322+	exit ;;
2323     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
2324 	echo hppa1.1-hp-bsd
2325-	exit 0 ;;
2326+	exit ;;
2327     9000/8??:4.3bsd:*:*)
2328 	echo hppa1.0-hp-bsd
2329-	exit 0 ;;
2330+	exit ;;
2331     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
2332 	echo hppa1.0-hp-mpeix
2333-	exit 0 ;;
2334+	exit ;;
2335     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
2336 	echo hppa1.1-hp-osf
2337-	exit 0 ;;
2338+	exit ;;
2339     hp8??:OSF1:*:*)
2340 	echo hppa1.0-hp-osf
2341-	exit 0 ;;
2342+	exit ;;
2343     i*86:OSF1:*:*)
2344 	if [ -x /usr/sbin/sysversion ] ; then
2345 	    echo ${UNAME_MACHINE}-unknown-osf1mk
2346 	else
2347 	    echo ${UNAME_MACHINE}-unknown-osf1
2348 	fi
2349-	exit 0 ;;
2350+	exit ;;
2351     parisc*:Lites*:*:*)
2352 	echo hppa1.1-hp-lites
2353-	exit 0 ;;
2354+	exit ;;
2355     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
2356 	echo c1-convex-bsd
2357-        exit 0 ;;
2358+        exit ;;
2359     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
2360 	if getsysinfo -f scalar_acc
2361 	then echo c32-convex-bsd
2362 	else echo c2-convex-bsd
2363 	fi
2364-        exit 0 ;;
2365+        exit ;;
2366     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
2367 	echo c34-convex-bsd
2368-        exit 0 ;;
2369+        exit ;;
2370     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
2371 	echo c38-convex-bsd
2372-        exit 0 ;;
2373+        exit ;;
2374     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
2375 	echo c4-convex-bsd
2376-        exit 0 ;;
2377+        exit ;;
2378     CRAY*Y-MP:*:*:*)
2379 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2380-	exit 0 ;;
2381+	exit ;;
2382     CRAY*[A-Z]90:*:*:*)
2383 	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
2384 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
2385 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
2386 	      -e 's/\.[^.]*$/.X/'
2387-	exit 0 ;;
2388+	exit ;;
2389     CRAY*TS:*:*:*)
2390 	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2391-	exit 0 ;;
2392-    CRAY*T3D:*:*:*)
2393-	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2394-	exit 0 ;;
2395+	exit ;;
2396     CRAY*T3E:*:*:*)
2397 	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2398-	exit 0 ;;
2399+	exit ;;
2400     CRAY*SV1:*:*:*)
2401 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2402-	exit 0 ;;
2403+	exit ;;
2404+    *:UNICOS/mp:*:*)
2405+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2406+	exit ;;
2407     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
2408 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2409         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
2410         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
2411         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
2412-        exit 0 ;;
2413+        exit ;;
2414+    5000:UNIX_System_V:4.*:*)
2415+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
2416+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
2417+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
2418+	exit ;;
2419     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
2420 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
2421-	exit 0 ;;
2422+	exit ;;
2423     sparc*:BSD/OS:*:*)
2424 	echo sparc-unknown-bsdi${UNAME_RELEASE}
2425-	exit 0 ;;
2426+	exit ;;
2427     *:BSD/OS:*:*)
2428 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
2429-	exit 0 ;;
2430+	exit ;;
2431     *:FreeBSD:*:*)
2432-	# Determine whether the default compiler uses glibc.
2433-	eval $set_cc_for_build
2434-	sed 's/^	//' << EOF >$dummy.c
2435-	#include <features.h>
2436-	#if __GLIBC__ >= 2
2437-	LIBC=gnu
2438-	#else
2439-	LIBC=
2440-	#endif
2441-EOF
2442-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
2443-	rm -f $dummy.c && rmdir $tmpdir
2444-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
2445-	exit 0 ;;
2446+	case ${UNAME_MACHINE} in
2447+	    pc98)
2448+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
2449+	    amd64)
2450+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
2451+	    *)
2452+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
2453+	esac
2454+	exit ;;
2455     i*:CYGWIN*:*)
2456 	echo ${UNAME_MACHINE}-pc-cygwin
2457-	exit 0 ;;
2458-    i*:MINGW*:*)
2459+	exit ;;
2460+    *:MINGW*:*)
2461 	echo ${UNAME_MACHINE}-pc-mingw32
2462-	exit 0 ;;
2463+	exit ;;
2464+    i*:windows32*:*)
2465+    	# uname -m includes "-pc" on this system.
2466+    	echo ${UNAME_MACHINE}-mingw32
2467+	exit ;;
2468     i*:PW*:*)
2469 	echo ${UNAME_MACHINE}-pc-pw32
2470-	exit 0 ;;
2471-    x86:Interix*:3*)
2472-	echo i386-pc-interix3
2473-	exit 0 ;;
2474+	exit ;;
2475+    *:Interix*:*)
2476+    	case ${UNAME_MACHINE} in
2477+	    x86)
2478+		echo i586-pc-interix${UNAME_RELEASE}
2479+		exit ;;
2480+	    authenticamd | genuineintel | EM64T)
2481+		echo x86_64-unknown-interix${UNAME_RELEASE}
2482+		exit ;;
2483+	    IA64)
2484+		echo ia64-unknown-interix${UNAME_RELEASE}
2485+		exit ;;
2486+	esac ;;
2487+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
2488+	echo i${UNAME_MACHINE}-pc-mks
2489+	exit ;;
2490+    8664:Windows_NT:*)
2491+	echo x86_64-pc-mks
2492+	exit ;;
2493     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
2494 	# How do we know it's Interix rather than the generic POSIX subsystem?
2495 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
2496 	# UNAME_MACHINE based on the output of uname instead of i386?
2497-	echo i386-pc-interix
2498-	exit 0 ;;
2499+	echo i586-pc-interix
2500+	exit ;;
2501     i*:UWIN*:*)
2502 	echo ${UNAME_MACHINE}-pc-uwin
2503-	exit 0 ;;
2504+	exit ;;
2505+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
2506+	echo x86_64-unknown-cygwin
2507+	exit ;;
2508     p*:CYGWIN*:*)
2509 	echo powerpcle-unknown-cygwin
2510-	exit 0 ;;
2511+	exit ;;
2512     prep*:SunOS:5.*:*)
2513 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2514-	exit 0 ;;
2515+	exit ;;
2516     *:GNU:*:*)
2517+	# the GNU system
2518 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
2519-	exit 0 ;;
2520+	exit ;;
2521+    *:GNU/*:*:*)
2522+	# other systems with GNU libc and userland
2523+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
2524+	exit ;;
2525     i*86:Minix:*:*)
2526 	echo ${UNAME_MACHINE}-pc-minix
2527-	exit 0 ;;
2528+	exit ;;
2529+    alpha:Linux:*:*)
2530+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
2531+	  EV5)   UNAME_MACHINE=alphaev5 ;;
2532+	  EV56)  UNAME_MACHINE=alphaev56 ;;
2533+	  PCA56) UNAME_MACHINE=alphapca56 ;;
2534+	  PCA57) UNAME_MACHINE=alphapca56 ;;
2535+	  EV6)   UNAME_MACHINE=alphaev6 ;;
2536+	  EV67)  UNAME_MACHINE=alphaev67 ;;
2537+	  EV68*) UNAME_MACHINE=alphaev68 ;;
2538+        esac
2539+	objdump --private-headers /bin/sh | grep -q ld.so.1
2540+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
2541+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
2542+	exit ;;
2543     arm*:Linux:*:*)
2544+	eval $set_cc_for_build
2545+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
2546+	    | grep -q __ARM_EABI__
2547+	then
2548+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
2549+	else
2550+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
2551+	fi
2552+	exit ;;
2553+    avr32*:Linux:*:*)
2554 	echo ${UNAME_MACHINE}-unknown-linux-gnu
2555-	exit 0 ;;
2556+	exit ;;
2557+    cris:Linux:*:*)
2558+	echo cris-axis-linux-gnu
2559+	exit ;;
2560+    crisv32:Linux:*:*)
2561+	echo crisv32-axis-linux-gnu
2562+	exit ;;
2563+    frv:Linux:*:*)
2564+    	echo frv-unknown-linux-gnu
2565+	exit ;;
2566+    i*86:Linux:*:*)
2567+	LIBC=gnu
2568+	eval $set_cc_for_build
2569+	sed 's/^	//' << EOF >$dummy.c
2570+	#ifdef __dietlibc__
2571+	LIBC=dietlibc
2572+	#endif
2573+EOF
2574+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
2575+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
2576+	exit ;;
2577     ia64:Linux:*:*)
2578 	echo ${UNAME_MACHINE}-unknown-linux-gnu
2579-	exit 0 ;;
2580+	exit ;;
2581+    m32r*:Linux:*:*)
2582+	echo ${UNAME_MACHINE}-unknown-linux-gnu
2583+	exit ;;
2584     m68*:Linux:*:*)
2585 	echo ${UNAME_MACHINE}-unknown-linux-gnu
2586-	exit 0 ;;
2587-    mips:Linux:*:*)
2588+	exit ;;
2589+    mips:Linux:*:* | mips64:Linux:*:*)
2590 	eval $set_cc_for_build
2591 	sed 's/^	//' << EOF >$dummy.c
2592 	#undef CPU
2593-	#undef mips
2594-	#undef mipsel
2595+	#undef ${UNAME_MACHINE}
2596+	#undef ${UNAME_MACHINE}el
2597 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
2598-	CPU=mipsel
2599+	CPU=${UNAME_MACHINE}el
2600 	#else
2601 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
2602-	CPU=mips
2603+	CPU=${UNAME_MACHINE}
2604 	#else
2605 	CPU=
2606 	#endif
2607 	#endif
2608 EOF
2609-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
2610-	rm -f $dummy.c && rmdir $tmpdir
2611-	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
2612+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
2613+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
2614 	;;
2615-    ppc:Linux:*:*)
2616-	echo powerpc-unknown-linux-gnu
2617-	exit 0 ;;
2618-    ppc64:Linux:*:*)
2619-	echo powerpc64-unknown-linux-gnu
2620-	exit 0 ;;
2621-    alpha:Linux:*:*)
2622-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
2623-	  EV5)   UNAME_MACHINE=alphaev5 ;;
2624-	  EV56)  UNAME_MACHINE=alphaev56 ;;
2625-	  PCA56) UNAME_MACHINE=alphapca56 ;;
2626-	  PCA57) UNAME_MACHINE=alphapca56 ;;
2627-	  EV6)   UNAME_MACHINE=alphaev6 ;;
2628-	  EV67)  UNAME_MACHINE=alphaev67 ;;
2629-	  EV68*) UNAME_MACHINE=alphaev68 ;;
2630-        esac
2631-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
2632-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
2633-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
2634-	exit 0 ;;
2635+    or32:Linux:*:*)
2636+	echo or32-unknown-linux-gnu
2637+	exit ;;
2638+    padre:Linux:*:*)
2639+	echo sparc-unknown-linux-gnu
2640+	exit ;;
2641+    parisc64:Linux:*:* | hppa64:Linux:*:*)
2642+	echo hppa64-unknown-linux-gnu
2643+	exit ;;
2644     parisc:Linux:*:* | hppa:Linux:*:*)
2645 	# Look for CPU level
2646 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
2647@@ -848,82 +949,40 @@
2648 	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
2649 	  *)    echo hppa-unknown-linux-gnu ;;
2650 	esac
2651-	exit 0 ;;
2652-    parisc64:Linux:*:* | hppa64:Linux:*:*)
2653-	echo hppa64-unknown-linux-gnu
2654-	exit 0 ;;
2655+	exit ;;
2656+    ppc64:Linux:*:*)
2657+	echo powerpc64-unknown-linux-gnu
2658+	exit ;;
2659+    ppc:Linux:*:*)
2660+	echo powerpc-unknown-linux-gnu
2661+	exit ;;
2662     s390:Linux:*:* | s390x:Linux:*:*)
2663 	echo ${UNAME_MACHINE}-ibm-linux
2664-	exit 0 ;;
2665+	exit ;;
2666+    sh64*:Linux:*:*)
2667+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
2668+	exit ;;
2669     sh*:Linux:*:*)
2670 	echo ${UNAME_MACHINE}-unknown-linux-gnu
2671-	exit 0 ;;
2672+	exit ;;
2673     sparc:Linux:*:* | sparc64:Linux:*:*)
2674 	echo ${UNAME_MACHINE}-unknown-linux-gnu
2675-	exit 0 ;;
2676+	exit ;;
2677+    vax:Linux:*:*)
2678+	echo ${UNAME_MACHINE}-dec-linux-gnu
2679+	exit ;;
2680     x86_64:Linux:*:*)
2681 	echo x86_64-unknown-linux-gnu
2682-	exit 0 ;;
2683-    i*86:Linux:*:*)
2684-	# The BFD linker knows what the default object file format is, so
2685-	# first see if it will tell us. cd to the root directory to prevent
2686-	# problems with other programs or directories called `ld' in the path.
2687-	# Set LC_ALL=C to ensure ld outputs messages in English.
2688-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
2689-			 | sed -ne '/supported targets:/!d
2690-				    s/[ 	][ 	]*/ /g
2691-				    s/.*supported targets: *//
2692-				    s/ .*//
2693-				    p'`
2694-        case "$ld_supported_targets" in
2695-	  elf32-i386)
2696-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
2697-		;;
2698-	  a.out-i386-linux)
2699-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
2700-		exit 0 ;;
2701-	  coff-i386)
2702-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
2703-		exit 0 ;;
2704-	  "")
2705-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
2706-		# one that does not give us useful --help.
2707-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
2708-		exit 0 ;;
2709-	esac
2710-	# Determine whether the default compiler is a.out or elf
2711-	eval $set_cc_for_build
2712-	sed 's/^	//' << EOF >$dummy.c
2713-	#include <features.h>
2714-	#ifdef __ELF__
2715-	# ifdef __GLIBC__
2716-	#  if __GLIBC__ >= 2
2717-	LIBC=gnu
2718-	#  else
2719-	LIBC=gnulibc1
2720-	#  endif
2721-	# else
2722-	LIBC=gnulibc1
2723-	# endif
2724-	#else
2725-	#ifdef __INTEL_COMPILER
2726-	LIBC=gnu
2727-	#else
2728-	LIBC=gnuaout
2729-	#endif
2730-	#endif
2731-EOF
2732-	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
2733-	rm -f $dummy.c && rmdir $tmpdir
2734-	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
2735-	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
2736-	;;
2737+	exit ;;
2738+    xtensa*:Linux:*:*)
2739+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
2740+	exit ;;
2741     i*86:DYNIX/ptx:4*:*)
2742 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
2743 	# earlier versions are messed up and put the nodename in both
2744 	# sysname and nodename.
2745 	echo i386-sequent-sysv4
2746-	exit 0 ;;
2747+	exit ;;
2748     i*86:UNIX_SV:4.2MP:2.*)
2749         # Unixware is an offshoot of SVR4, but it has its own version
2750         # number series starting with 2...
2751@@ -931,7 +990,27 @@
2752 	# I just have to hope.  -- rms.
2753         # Use sysv4.2uw... so that sysv4* matches it.
2754 	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
2755-	exit 0 ;;
2756+	exit ;;
2757+    i*86:OS/2:*:*)
2758+	# If we were able to find `uname', then EMX Unix compatibility
2759+	# is probably installed.
2760+	echo ${UNAME_MACHINE}-pc-os2-emx
2761+	exit ;;
2762+    i*86:XTS-300:*:STOP)
2763+	echo ${UNAME_MACHINE}-unknown-stop
2764+	exit ;;
2765+    i*86:atheos:*:*)
2766+	echo ${UNAME_MACHINE}-unknown-atheos
2767+	exit ;;
2768+    i*86:syllable:*:*)
2769+	echo ${UNAME_MACHINE}-pc-syllable
2770+	exit ;;
2771+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
2772+	echo i386-unknown-lynxos${UNAME_RELEASE}
2773+	exit ;;
2774+    i*86:*DOS:*:*)
2775+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
2776+	exit ;;
2777     i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
2778 	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
2779 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
2780@@ -939,15 +1018,16 @@
2781 	else
2782 		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
2783 	fi
2784-	exit 0 ;;
2785-    i*86:*:5:[78]*)
2786+	exit ;;
2787+    i*86:*:5:[678]*)
2788+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
2789 	case `/bin/uname -X | grep "^Machine"` in
2790 	    *486*)	     UNAME_MACHINE=i486 ;;
2791 	    *Pentium)	     UNAME_MACHINE=i586 ;;
2792 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
2793 	esac
2794 	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
2795-	exit 0 ;;
2796+	exit ;;
2797     i*86:*:3.2:*)
2798 	if test -f /usr/options/cb.name; then
2799 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
2800@@ -965,76 +1045,86 @@
2801 	else
2802 		echo ${UNAME_MACHINE}-pc-sysv32
2803 	fi
2804-	exit 0 ;;
2805-    i*86:*DOS:*:*)
2806-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
2807-	exit 0 ;;
2808+	exit ;;
2809     pc:*:*:*)
2810 	# Left here for compatibility:
2811         # uname -m prints for DJGPP always 'pc', but it prints nothing about
2812-        # the processor, so we play safe by assuming i386.
2813-	echo i386-pc-msdosdjgpp
2814-        exit 0 ;;
2815+        # the processor, so we play safe by assuming i586.
2816+	# Note: whatever this is, it MUST be the same as what config.sub
2817+	# prints for the "djgpp" host, or else GDB configury will decide that
2818+	# this is a cross-build.
2819+	echo i586-pc-msdosdjgpp
2820+        exit ;;
2821     Intel:Mach:3*:*)
2822 	echo i386-pc-mach3
2823-	exit 0 ;;
2824+	exit ;;
2825     paragon:*:*:*)
2826 	echo i860-intel-osf1
2827-	exit 0 ;;
2828+	exit ;;
2829     i860:*:4.*:*) # i860-SVR4
2830 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
2831 	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
2832 	else # Add other i860-SVR4 vendors below as they are discovered.
2833 	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
2834 	fi
2835-	exit 0 ;;
2836+	exit ;;
2837     mini*:CTIX:SYS*5:*)
2838 	# "miniframe"
2839 	echo m68010-convergent-sysv
2840-	exit 0 ;;
2841+	exit ;;
2842     mc68k:UNIX:SYSTEM5:3.51m)
2843 	echo m68k-convergent-sysv
2844-	exit 0 ;;
2845-    M68*:*:R3V[567]*:*)
2846-	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
2847-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
2848+	exit ;;
2849+    M680?0:D-NIX:5.3:*)
2850+	echo m68k-diab-dnix
2851+	exit ;;
2852+    M68*:*:R3V[5678]*:*)
2853+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
2854+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
2855 	OS_REL=''
2856 	test -r /etc/.relid \
2857 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
2858 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
2859-	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
2860+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
2861 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
2862-	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
2863+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
2864     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
2865         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
2866-          && echo i486-ncr-sysv4 && exit 0 ;;
2867+          && { echo i486-ncr-sysv4; exit; } ;;
2868+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
2869+	OS_REL='.3'
2870+	test -r /etc/.relid \
2871+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
2872+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
2873+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
2874+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
2875+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
2876+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
2877+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
2878     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
2879 	echo m68k-unknown-lynxos${UNAME_RELEASE}
2880-	exit 0 ;;
2881+	exit ;;
2882     mc68030:UNIX_System_V:4.*:*)
2883 	echo m68k-atari-sysv4
2884-	exit 0 ;;
2885-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
2886-	echo i386-unknown-lynxos${UNAME_RELEASE}
2887-	exit 0 ;;
2888+	exit ;;
2889     TSUNAMI:LynxOS:2.*:*)
2890 	echo sparc-unknown-lynxos${UNAME_RELEASE}
2891-	exit 0 ;;
2892+	exit ;;
2893     rs6000:LynxOS:2.*:*)
2894 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
2895-	exit 0 ;;
2896-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
2897+	exit ;;
2898+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
2899 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
2900-	exit 0 ;;
2901+	exit ;;
2902     SM[BE]S:UNIX_SV:*:*)
2903 	echo mips-dde-sysv${UNAME_RELEASE}
2904-	exit 0 ;;
2905+	exit ;;
2906     RM*:ReliantUNIX-*:*:*)
2907 	echo mips-sni-sysv4
2908-	exit 0 ;;
2909+	exit ;;
2910     RM*:SINIX-*:*:*)
2911 	echo mips-sni-sysv4
2912-	exit 0 ;;
2913+	exit ;;
2914     *:SINIX-*:*:*)
2915 	if uname -p 2>/dev/null >/dev/null ; then
2916 		UNAME_MACHINE=`(uname -p) 2>/dev/null`
2917@@ -1042,64 +1132,94 @@
2918 	else
2919 		echo ns32k-sni-sysv
2920 	fi
2921-	exit 0 ;;
2922+	exit ;;
2923     PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
2924                       # says <Richard.M.Bartel@ccMail.Census.GOV>
2925         echo i586-unisys-sysv4
2926-        exit 0 ;;
2927+        exit ;;
2928     *:UNIX_System_V:4*:FTX*)
2929 	# From Gerald Hewes <hewes@openmarket.com>.
2930 	# How about differentiating between stratus architectures? -djm
2931 	echo hppa1.1-stratus-sysv4
2932-	exit 0 ;;
2933+	exit ;;
2934     *:*:*:FTX*)
2935 	# From seanf@swdc.stratus.com.
2936 	echo i860-stratus-sysv4
2937-	exit 0 ;;
2938+	exit ;;
2939+    i*86:VOS:*:*)
2940+	# From Paul.Green@stratus.com.
2941+	echo ${UNAME_MACHINE}-stratus-vos
2942+	exit ;;
2943     *:VOS:*:*)
2944 	# From Paul.Green@stratus.com.
2945 	echo hppa1.1-stratus-vos
2946-	exit 0 ;;
2947+	exit ;;
2948     mc68*:A/UX:*:*)
2949 	echo m68k-apple-aux${UNAME_RELEASE}
2950-	exit 0 ;;
2951+	exit ;;
2952     news*:NEWS-OS:6*:*)
2953 	echo mips-sony-newsos6
2954-	exit 0 ;;
2955+	exit ;;
2956     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
2957 	if [ -d /usr/nec ]; then
2958 	        echo mips-nec-sysv${UNAME_RELEASE}
2959 	else
2960 	        echo mips-unknown-sysv${UNAME_RELEASE}
2961 	fi
2962-        exit 0 ;;
2963+        exit ;;
2964     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
2965 	echo powerpc-be-beos
2966-	exit 0 ;;
2967+	exit ;;
2968     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
2969 	echo powerpc-apple-beos
2970-	exit 0 ;;
2971+	exit ;;
2972     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
2973 	echo i586-pc-beos
2974-	exit 0 ;;
2975+	exit ;;
2976+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
2977+	echo i586-pc-haiku
2978+	exit ;;
2979     SX-4:SUPER-UX:*:*)
2980 	echo sx4-nec-superux${UNAME_RELEASE}
2981-	exit 0 ;;
2982+	exit ;;
2983     SX-5:SUPER-UX:*:*)
2984 	echo sx5-nec-superux${UNAME_RELEASE}
2985-	exit 0 ;;
2986+	exit ;;
2987     SX-6:SUPER-UX:*:*)
2988 	echo sx6-nec-superux${UNAME_RELEASE}
2989-	exit 0 ;;
2990+	exit ;;
2991+    SX-7:SUPER-UX:*:*)
2992+	echo sx7-nec-superux${UNAME_RELEASE}
2993+	exit ;;
2994+    SX-8:SUPER-UX:*:*)
2995+	echo sx8-nec-superux${UNAME_RELEASE}
2996+	exit ;;
2997+    SX-8R:SUPER-UX:*:*)
2998+	echo sx8r-nec-superux${UNAME_RELEASE}
2999+	exit ;;
3000     Power*:Rhapsody:*:*)
3001 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
3002-	exit 0 ;;
3003+	exit ;;
3004     *:Rhapsody:*:*)
3005 	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
3006-	exit 0 ;;
3007+	exit ;;
3008     *:Darwin:*:*)
3009-	echo `uname -p`-apple-darwin${UNAME_RELEASE}
3010-	exit 0 ;;
3011+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
3012+	case $UNAME_PROCESSOR in
3013+	    i386)
3014+		eval $set_cc_for_build
3015+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
3016+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
3017+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
3018+		      grep IS_64BIT_ARCH >/dev/null
3019+		  then
3020+		      UNAME_PROCESSOR="x86_64"
3021+		  fi
3022+		fi ;;
3023+	    unknown) UNAME_PROCESSOR=powerpc ;;
3024+	esac
3025+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
3026+	exit ;;
3027     *:procnto*:*:* | *:QNX:[0123456789]*:*)
3028 	UNAME_PROCESSOR=`uname -p`
3029 	if test "$UNAME_PROCESSOR" = "x86"; then
3030@@ -1107,22 +1227,25 @@
3031 		UNAME_MACHINE=pc
3032 	fi
3033 	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
3034-	exit 0 ;;
3035+	exit ;;
3036     *:QNX:*:4*)
3037 	echo i386-pc-qnx
3038-	exit 0 ;;
3039-    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
3040+	exit ;;
3041+    NSE-?:NONSTOP_KERNEL:*:*)
3042+	echo nse-tandem-nsk${UNAME_RELEASE}
3043+	exit ;;
3044+    NSR-?:NONSTOP_KERNEL:*:*)
3045 	echo nsr-tandem-nsk${UNAME_RELEASE}
3046-	exit 0 ;;
3047+	exit ;;
3048     *:NonStop-UX:*:*)
3049 	echo mips-compaq-nonstopux
3050-	exit 0 ;;
3051+	exit ;;
3052     BS2000:POSIX*:*:*)
3053 	echo bs2000-siemens-sysv
3054-	exit 0 ;;
3055+	exit ;;
3056     DS/*:UNIX_System_V:*:*)
3057 	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
3058-	exit 0 ;;
3059+	exit ;;
3060     *:Plan9:*:*)
3061 	# "uname -m" is not consistent, so use $cputype instead. 386
3062 	# is converted to i386 for consistency with other x86
3063@@ -1133,36 +1256,50 @@
3064 	    UNAME_MACHINE="$cputype"
3065 	fi
3066 	echo ${UNAME_MACHINE}-unknown-plan9
3067-	exit 0 ;;
3068-    i*86:OS/2:*:*)
3069-	# If we were able to find `uname', then EMX Unix compatibility
3070-	# is probably installed.
3071-	echo ${UNAME_MACHINE}-pc-os2-emx
3072-	exit 0 ;;
3073+	exit ;;
3074     *:TOPS-10:*:*)
3075 	echo pdp10-unknown-tops10
3076-	exit 0 ;;
3077+	exit ;;
3078     *:TENEX:*:*)
3079 	echo pdp10-unknown-tenex
3080-	exit 0 ;;
3081+	exit ;;
3082     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
3083 	echo pdp10-dec-tops20
3084-	exit 0 ;;
3085+	exit ;;
3086     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
3087 	echo pdp10-xkl-tops20
3088-	exit 0 ;;
3089+	exit ;;
3090     *:TOPS-20:*:*)
3091 	echo pdp10-unknown-tops20
3092-	exit 0 ;;
3093+	exit ;;
3094     *:ITS:*:*)
3095 	echo pdp10-unknown-its
3096-	exit 0 ;;
3097-    i*86:XTS-300:*:STOP)
3098-	echo ${UNAME_MACHINE}-unknown-stop
3099-	exit 0 ;;
3100-    i*86:atheos:*:*)
3101-	echo ${UNAME_MACHINE}-unknown-atheos
3102-	exit 0 ;;
3103+	exit ;;
3104+    SEI:*:*:SEIUX)
3105+        echo mips-sei-seiux${UNAME_RELEASE}
3106+	exit ;;
3107+    *:DragonFly:*:*)
3108+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
3109+	exit ;;
3110+    *:*VMS:*:*)
3111+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
3112+	case "${UNAME_MACHINE}" in
3113+	    A*) echo alpha-dec-vms ; exit ;;
3114+	    I*) echo ia64-dec-vms ; exit ;;
3115+	    V*) echo vax-dec-vms ; exit ;;
3116+	esac ;;
3117+    *:XENIX:*:SysV)
3118+	echo i386-pc-xenix
3119+	exit ;;
3120+    i*86:skyos:*:*)
3121+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
3122+	exit ;;
3123+    i*86:rdos:*:*)
3124+	echo ${UNAME_MACHINE}-pc-rdos
3125+	exit ;;
3126+    i*86:AROS:*:*)
3127+	echo ${UNAME_MACHINE}-pc-aros
3128+	exit ;;
3129 esac
3130
3131 #echo '(No uname command or uname output not recognized.)' 1>&2
3132@@ -1194,7 +1331,7 @@
3133 #endif
3134
3135 #if defined (__arm) && defined (__acorn) && defined (__unix)
3136-  printf ("arm-acorn-riscix"); exit (0);
3137+  printf ("arm-acorn-riscix\n"); exit (0);
3138 #endif
3139
3140 #if defined (hp300) && !defined (hpux)
3141@@ -1283,12 +1420,12 @@
3142 }
3143 EOF
3144
3145-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
3146-rm -f $dummy.c $dummy && rmdir $tmpdir
3147+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
3148+	{ echo "$SYSTEM_NAME"; exit; }
3149
3150 # Apollos put the system type in the environment.
3151
3152-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
3153+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
3154
3155 # Convex versions that predate uname can use getsysinfo(1)
3156
3157@@ -1297,22 +1434,22 @@
3158     case `getsysinfo -f cpu_type` in
3159     c1*)
3160 	echo c1-convex-bsd
3161-	exit 0 ;;
3162+	exit ;;
3163     c2*)
3164 	if getsysinfo -f scalar_acc
3165 	then echo c32-convex-bsd
3166 	else echo c2-convex-bsd
3167 	fi
3168-	exit 0 ;;
3169+	exit ;;
3170     c34*)
3171 	echo c34-convex-bsd
3172-	exit 0 ;;
3173+	exit ;;
3174     c38*)
3175 	echo c38-convex-bsd
3176-	exit 0 ;;
3177+	exit ;;
3178     c4*)
3179 	echo c4-convex-bsd
3180-	exit 0 ;;
3181+	exit ;;
3182     esac
3183 fi
3184
3185@@ -1323,7 +1460,9 @@
3186 the operating system you are using. It is advised that you
3187 download the most up to date version of the config scripts from
3188
3189-    ftp://ftp.gnu.org/pub/gnu/config/
3190+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
3191+and
3192+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
3193
3194 If the version you run ($0) is already up to date, please
3195 send the following data and any information you think might be
3196--- misc/libtextcat-2.2/config.sub	2010-04-15 09:20:04.000000000 +0000
3197+++ misc/build/libtextcat-2.2/config.sub	2010-04-15 09:20:41.000000000 +0000
3198@@ -1,9 +1,10 @@
3199 #! /bin/sh
3200 # Configuration validation subroutine script.
3201 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3202-#   2000, 2001, 2002 Free Software Foundation, Inc.
3203+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3204+#   Free Software Foundation, Inc.
3205
3206-timestamp='2002-09-05'
3207+timestamp='2010-01-22'
3208
3209 # This file is (in principle) common to ALL GNU software.
3210 # The presence of a machine in this file suggests that SOME GNU software
3211@@ -21,22 +22,26 @@
3212 #
3213 # You should have received a copy of the GNU General Public License
3214 # along with this program; if not, write to the Free Software
3215-# Foundation, Inc., 59 Temple Place - Suite 330,
3216-# Boston, MA 02111-1307, USA.
3217-
3218+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
3219+# 02110-1301, USA.
3220+#
3221 # As a special exception to the GNU General Public License, if you
3222 # distribute this file as part of a program that contains a
3223 # configuration script generated by Autoconf, you may include it under
3224 # the same distribution terms that you use for the rest of that program.
3225
3226+
3227 # Please send patches to <config-patches@gnu.org>.  Submit a context
3228-# diff and a properly formatted ChangeLog entry.
3229+# diff and a properly formatted GNU ChangeLog entry.
3230 #
3231 # Configuration subroutine to validate and canonicalize a configuration type.
3232 # Supply the specified configuration type as an argument.
3233 # If it is invalid, we print an error message on stderr and exit with code 1.
3234 # Otherwise, we print the canonical config type on stdout and succeed.
3235
3236+# You can get the latest version of this script from:
3237+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
3238+
3239 # This file is supposed to be the same for all GNU packages
3240 # and recognize all the CPU types, system types and aliases
3241 # that are meaningful with *any* GNU software.
3242@@ -70,8 +75,9 @@
3243 version="\
3244 GNU config.sub ($timestamp)
3245
3246-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3247-Free Software Foundation, Inc.
3248+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3249+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
3250+Software Foundation, Inc.
3251
3252 This is free software; see the source for copying conditions.  There is NO
3253 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
3254@@ -83,11 +89,11 @@
3255 while test $# -gt 0 ; do
3256   case $1 in
3257     --time-stamp | --time* | -t )
3258-       echo "$timestamp" ; exit 0 ;;
3259+       echo "$timestamp" ; exit ;;
3260     --version | -v )
3261-       echo "$version" ; exit 0 ;;
3262+       echo "$version" ; exit ;;
3263     --help | --h* | -h )
3264-       echo "$usage"; exit 0 ;;
3265+       echo "$usage"; exit ;;
3266     -- )     # Stop option processing
3267        shift; break ;;
3268     - )	# Use stdin as input.
3269@@ -99,7 +105,7 @@
3270     *local*)
3271        # First pass through any local machine types.
3272        echo $1
3273-       exit 0;;
3274+       exit ;;
3275
3276     * )
3277        break ;;
3278@@ -118,7 +124,10 @@
3279 # Here we must recognize all the valid KERNEL-OS combinations.
3280 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
3281 case $maybe_os in
3282-  nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
3283+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
3284+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
3285+  kopensolaris*-gnu* | \
3286+  storm-chaos* | os2-emx* | rtmk-nova*)
3287     os=-$maybe_os
3288     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
3289     ;;
3290@@ -144,10 +153,13 @@
3291 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
3292 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
3293 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
3294-	-apple | -axis)
3295+	-apple | -axis | -knuth | -cray | -microblaze)
3296 		os=
3297 		basic_machine=$1
3298 		;;
3299+        -bluegene*)
3300+	        os=-cnk
3301+		;;
3302 	-sim | -cisco | -oki | -wec | -winbond)
3303 		os=
3304 		basic_machine=$1
3305@@ -169,6 +181,10 @@
3306 	-hiux*)
3307 		os=-hiuxwe2
3308 		;;
3309+	-sco6)
3310+		os=-sco5v6
3311+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3312+		;;
3313 	-sco5)
3314 		os=-sco3.2v5
3315 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3316@@ -185,6 +201,10 @@
3317 		# Don't forget version if it is 3.2v4 or newer.
3318 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3319 		;;
3320+	-sco5v6*)
3321+		# Don't forget version if it is 3.2v4 or newer.
3322+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3323+		;;
3324 	-sco*)
3325 		os=-sco3.2v2
3326 		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3327@@ -228,51 +248,71 @@
3328 	| a29k \
3329 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
3330 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
3331-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
3332-	| clipper \
3333+	| am33_2.0 \
3334+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
3335+	| bfin \
3336+	| c4x | clipper \
3337 	| d10v | d30v | dlx | dsp16xx \
3338-	| fr30 | frv \
3339+	| fido | fr30 | frv \
3340 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
3341 	| i370 | i860 | i960 | ia64 \
3342-	| ip2k \
3343-	| m32r | m68000 | m68k | m88k | mcore \
3344+	| ip2k | iq2000 \
3345+	| lm32 \
3346+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
3347+	| maxq | mb | microblaze | mcore | mep | metag \
3348 	| mips | mipsbe | mipseb | mipsel | mipsle \
3349 	| mips16 \
3350 	| mips64 | mips64el \
3351-	| mips64vr | mips64vrel \
3352+	| mips64octeon | mips64octeonel \
3353 	| mips64orion | mips64orionel \
3354+	| mips64r5900 | mips64r5900el \
3355+	| mips64vr | mips64vrel \
3356 	| mips64vr4100 | mips64vr4100el \
3357 	| mips64vr4300 | mips64vr4300el \
3358 	| mips64vr5000 | mips64vr5000el \
3359+	| mips64vr5900 | mips64vr5900el \
3360 	| mipsisa32 | mipsisa32el \
3361+	| mipsisa32r2 | mipsisa32r2el \
3362 	| mipsisa64 | mipsisa64el \
3363+	| mipsisa64r2 | mipsisa64r2el \
3364 	| mipsisa64sb1 | mipsisa64sb1el \
3365 	| mipsisa64sr71k | mipsisa64sr71kel \
3366 	| mipstx39 | mipstx39el \
3367 	| mn10200 | mn10300 \
3368+	| moxie \
3369+	| mt \
3370+	| msp430 \
3371+	| nios | nios2 \
3372 	| ns16k | ns32k \
3373-	| openrisc | or32 \
3374+	| or32 \
3375 	| pdp10 | pdp11 | pj | pjl \
3376 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
3377 	| pyramid \
3378-	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
3379+	| rx \
3380+	| score \
3381+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
3382 	| sh64 | sh64le \
3383-	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
3384-	| strongarm \
3385-	| tahoe | thumb | tic80 | tron \
3386+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
3387+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
3388+	| spu | strongarm \
3389+	| tahoe | thumb | tic4x | tic80 | tron \
3390+	| ubicom32 \
3391 	| v850 | v850e \
3392 	| we32k \
3393-	| x86 | xscale | xstormy16 | xtensa \
3394-	| z8k)
3395+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
3396+	| z8k | z80)
3397 		basic_machine=$basic_machine-unknown
3398 		;;
3399-	m6811 | m68hc11 | m6812 | m68hc12)
3400+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
3401 		# Motorola 68HC11/12.
3402 		basic_machine=$basic_machine-unknown
3403 		os=-none
3404 		;;
3405 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
3406 		;;
3407+	ms1)
3408+		basic_machine=mt-unknown
3409+		;;
3410
3411 	# We use `pc' rather than `unknown'
3412 	# because (1) that's what they normally are, and
3413@@ -292,50 +332,69 @@
3414 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
3415 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
3416 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
3417-	| avr-* \
3418-	| bs2000-* \
3419-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
3420-	| clipper-* | cydra-* \
3421+	| avr-* | avr32-* \
3422+	| bfin-* | bs2000-* \
3423+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
3424+	| clipper-* | craynv-* | cydra-* \
3425 	| d10v-* | d30v-* | dlx-* \
3426 	| elxsi-* \
3427-	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
3428+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
3429 	| h8300-* | h8500-* \
3430 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
3431 	| i*86-* | i860-* | i960-* | ia64-* \
3432-	| ip2k-* \
3433-	| m32r-* \
3434+	| ip2k-* | iq2000-* \
3435+	| lm32-* \
3436+	| m32c-* | m32r-* | m32rle-* \
3437 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
3438-	| m88110-* | m88k-* | mcore-* \
3439+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
3440 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
3441 	| mips16-* \
3442 	| mips64-* | mips64el-* \
3443-	| mips64vr-* | mips64vrel-* \
3444+	| mips64octeon-* | mips64octeonel-* \
3445 	| mips64orion-* | mips64orionel-* \
3446+	| mips64r5900-* | mips64r5900el-* \
3447+	| mips64vr-* | mips64vrel-* \
3448 	| mips64vr4100-* | mips64vr4100el-* \
3449 	| mips64vr4300-* | mips64vr4300el-* \
3450 	| mips64vr5000-* | mips64vr5000el-* \
3451+	| mips64vr5900-* | mips64vr5900el-* \
3452 	| mipsisa32-* | mipsisa32el-* \
3453+	| mipsisa32r2-* | mipsisa32r2el-* \
3454 	| mipsisa64-* | mipsisa64el-* \
3455+	| mipsisa64r2-* | mipsisa64r2el-* \
3456 	| mipsisa64sb1-* | mipsisa64sb1el-* \
3457 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
3458-	| mipstx39 | mipstx39el \
3459+	| mipstx39-* | mipstx39el-* \
3460+	| mmix-* \
3461+	| mt-* \
3462+	| msp430-* \
3463+	| nios-* | nios2-* \
3464 	| none-* | np1-* | ns16k-* | ns32k-* \
3465 	| orion-* \
3466 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
3467 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
3468 	| pyramid-* \
3469-	| romp-* | rs6000-* \
3470-	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
3471+	| romp-* | rs6000-* | rx-* \
3472+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
3473 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
3474-	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
3475-	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
3476-	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
3477+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
3478+	| sparclite-* \
3479+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
3480+	| tahoe-* | thumb-* \
3481+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
3482+	| tile-* | tilegx-* \
3483+	| tron-* \
3484+	| ubicom32-* \
3485 	| v850-* | v850e-* | vax-* \
3486 	| we32k-* \
3487-	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
3488-	| xtensa-* \
3489+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
3490+	| xstormy16-* | xtensa*-* \
3491 	| ymp-* \
3492-	| z8k-*)
3493+	| z8k-* | z80-*)
3494+		;;
3495+	# Recognize the basic CPU types without company name, with glob match.
3496+	xtensa*)
3497+		basic_machine=$basic_machine-unknown
3498 		;;
3499 	# Recognize the various machine names and aliases which stand
3500 	# for a CPU type and a company and sometimes even an OS.
3501@@ -353,6 +412,9 @@
3502 		basic_machine=a29k-amd
3503 		os=-udi
3504 		;;
3505+    	abacus)
3506+		basic_machine=abacus-unknown
3507+		;;
3508 	adobe68k)
3509 		basic_machine=m68010-adobe
3510 		os=-scout
3511@@ -367,6 +429,12 @@
3512 		basic_machine=a29k-none
3513 		os=-bsd
3514 		;;
3515+	amd64)
3516+		basic_machine=x86_64-pc
3517+		;;
3518+	amd64-*)
3519+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
3520+		;;
3521 	amdahl)
3522 		basic_machine=580-amdahl
3523 		os=-sysv
3524@@ -390,6 +458,10 @@
3525 		basic_machine=m68k-apollo
3526 		os=-bsd
3527 		;;
3528+	aros)
3529+		basic_machine=i386-pc
3530+		os=-aros
3531+		;;
3532 	aux)
3533 		basic_machine=m68k-apple
3534 		os=-aux
3535@@ -398,10 +470,26 @@
3536 		basic_machine=ns32k-sequent
3537 		os=-dynix
3538 		;;
3539+	blackfin)
3540+		basic_machine=bfin-unknown
3541+		os=-linux
3542+		;;
3543+	blackfin-*)
3544+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
3545+		os=-linux
3546+		;;
3547+	bluegene*)
3548+		basic_machine=powerpc-ibm
3549+		os=-cnk
3550+		;;
3551 	c90)
3552 		basic_machine=c90-cray
3553 		os=-unicos
3554 		;;
3555+        cegcc)
3556+		basic_machine=arm-unknown
3557+		os=-cegcc
3558+		;;
3559 	convex-c1)
3560 		basic_machine=c1-convex
3561 		os=-bsd
3562@@ -426,12 +514,27 @@
3563 		basic_machine=j90-cray
3564 		os=-unicos
3565 		;;
3566+	craynv)
3567+		basic_machine=craynv-cray
3568+		os=-unicosmp
3569+		;;
3570+	cr16)
3571+		basic_machine=cr16-unknown
3572+		os=-elf
3573+		;;
3574 	crds | unos)
3575 		basic_machine=m68k-crds
3576 		;;
3577+	crisv32 | crisv32-* | etraxfs*)
3578+		basic_machine=crisv32-axis
3579+		;;
3580 	cris | cris-* | etrax*)
3581 		basic_machine=cris-axis
3582 		;;
3583+	crx)
3584+		basic_machine=crx-unknown
3585+		os=-elf
3586+		;;
3587 	da30 | da30-*)
3588 		basic_machine=m68k-da30
3589 		;;
3590@@ -454,6 +557,14 @@
3591 		basic_machine=m88k-motorola
3592 		os=-sysv3
3593 		;;
3594+	dicos)
3595+		basic_machine=i686-pc
3596+		os=-dicos
3597+		;;
3598+	djgpp)
3599+		basic_machine=i586-pc
3600+		os=-msdosdjgpp
3601+		;;
3602 	dpx20 | dpx20-*)
3603 		basic_machine=rs6000-bull
3604 		os=-bosx
3605@@ -604,6 +715,14 @@
3606 		basic_machine=m68k-isi
3607 		os=-sysv
3608 		;;
3609+	m68knommu)
3610+		basic_machine=m68k-unknown
3611+		os=-linux
3612+		;;
3613+	m68knommu-*)
3614+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
3615+		os=-linux
3616+		;;
3617 	m88k-omron*)
3618 		basic_machine=m88k-omron
3619 		;;
3620@@ -615,10 +734,17 @@
3621 		basic_machine=ns32k-utek
3622 		os=-sysv
3623 		;;
3624+        microblaze)
3625+		basic_machine=microblaze-xilinx
3626+		;;
3627 	mingw32)
3628 		basic_machine=i386-pc
3629 		os=-mingw32
3630 		;;
3631+	mingw32ce)
3632+		basic_machine=arm-unknown
3633+		os=-mingw32ce
3634+		;;
3635 	miniframe)
3636 		basic_machine=m68000-convergent
3637 		;;
3638@@ -632,10 +758,6 @@
3639 	mips3*)
3640 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
3641 		;;
3642-	mmix*)
3643-		basic_machine=mmix-knuth
3644-		os=-mmixware
3645-		;;
3646 	monitor)
3647 		basic_machine=m68k-rom68k
3648 		os=-coff
3649@@ -648,6 +770,9 @@
3650 		basic_machine=i386-pc
3651 		os=-msdos
3652 		;;
3653+	ms1-*)
3654+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
3655+		;;
3656 	mvs)
3657 		basic_machine=i370-ibm
3658 		os=-mvs
3659@@ -723,9 +848,12 @@
3660 		basic_machine=hppa1.1-oki
3661 		os=-proelf
3662 		;;
3663-	or32 | or32-*)
3664+	openrisc | openrisc-*)
3665 		basic_machine=or32-unknown
3666-		os=-coff
3667+		;;
3668+	os400)
3669+		basic_machine=powerpc-ibm
3670+		os=-os400
3671 		;;
3672 	OSE68000 | ose68000)
3673 		basic_machine=m68000-ericsson
3674@@ -743,6 +871,14 @@
3675 		basic_machine=i860-intel
3676 		os=-osf
3677 		;;
3678+	parisc)
3679+		basic_machine=hppa-unknown
3680+		os=-linux
3681+		;;
3682+	parisc-*)
3683+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
3684+		os=-linux
3685+		;;
3686 	pbd)
3687 		basic_machine=sparc-tti
3688 		;;
3689@@ -752,24 +888,36 @@
3690 	pc532 | pc532-*)
3691 		basic_machine=ns32k-pc532
3692 		;;
3693+	pc98)
3694+		basic_machine=i386-pc
3695+		;;
3696+	pc98-*)
3697+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
3698+		;;
3699 	pentium | p5 | k5 | k6 | nexgen | viac3)
3700 		basic_machine=i586-pc
3701 		;;
3702 	pentiumpro | p6 | 6x86 | athlon | athlon_*)
3703 		basic_machine=i686-pc
3704 		;;
3705-	pentiumii | pentium2)
3706+	pentiumii | pentium2 | pentiumiii | pentium3)
3707 		basic_machine=i686-pc
3708 		;;
3709+	pentium4)
3710+		basic_machine=i786-pc
3711+		;;
3712 	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
3713 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
3714 		;;
3715 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
3716 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
3717 		;;
3718-	pentiumii-* | pentium2-*)
3719+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
3720 		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
3721 		;;
3722+	pentium4-*)
3723+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
3724+		;;
3725 	pn)
3726 		basic_machine=pn-gould
3727 		;;
3728@@ -802,6 +950,10 @@
3729 		basic_machine=i586-unknown
3730 		os=-pw32
3731 		;;
3732+	rdos)
3733+		basic_machine=i386-pc
3734+		os=-rdos
3735+		;;
3736 	rom68k)
3737 		basic_machine=m68k-rom68k
3738 		os=-coff
3739@@ -828,6 +980,14 @@
3740 	sb1el)
3741 		basic_machine=mipsisa64sb1el-unknown
3742 		;;
3743+	sde)
3744+		basic_machine=mipsisa32-sde
3745+		os=-elf
3746+		;;
3747+	sei)
3748+		basic_machine=mips-sei
3749+		os=-seiux
3750+		;;
3751 	sequent)
3752 		basic_machine=i386-sequent
3753 		;;
3754@@ -835,6 +995,12 @@
3755 		basic_machine=sh-hitachi
3756 		os=-hms
3757 		;;
3758+	sh5el)
3759+		basic_machine=sh5le-unknown
3760+		;;
3761+	sh64)
3762+		basic_machine=sh64-unknown
3763+		;;
3764 	sparclite-wrs | simso-wrs)
3765 		basic_machine=sparclite-wrs
3766 		os=-vxworks
3767@@ -901,10 +1067,6 @@
3768 		basic_machine=i386-sequent
3769 		os=-dynix
3770 		;;
3771-	t3d)
3772-		basic_machine=alpha-cray
3773-		os=-unicos
3774-		;;
3775 	t3e)
3776 		basic_machine=alphaev5-cray
3777 		os=-unicos
3778@@ -913,14 +1075,27 @@
3779 		basic_machine=t90-cray
3780 		os=-unicos
3781 		;;
3782-        tic4x | c4x*)
3783-		basic_machine=tic4x-unknown
3784-		os=-coff
3785-		;;
3786 	tic54x | c54x*)
3787 		basic_machine=tic54x-unknown
3788 		os=-coff
3789 		;;
3790+	tic55x | c55x*)
3791+		basic_machine=tic55x-unknown
3792+		os=-coff
3793+		;;
3794+	tic6x | c6x*)
3795+		basic_machine=tic6x-unknown
3796+		os=-coff
3797+		;;
3798+        # This must be matched before tile*.
3799+        tilegx*)
3800+		basic_machine=tilegx-unknown
3801+		os=-linux-gnu
3802+		;;
3803+	tile*)
3804+		basic_machine=tile-unknown
3805+		os=-linux-gnu
3806+		;;
3807 	tx39)
3808 		basic_machine=mipstx39-unknown
3809 		;;
3810@@ -934,6 +1109,10 @@
3811 	tower | tower-32)
3812 		basic_machine=m68k-ncr
3813 		;;
3814+	tpf)
3815+		basic_machine=s390x-ibm
3816+		os=-tpf
3817+		;;
3818 	udi29k)
3819 		basic_machine=a29k-amd
3820 		os=-udi
3821@@ -977,9 +1156,9 @@
3822 		basic_machine=hppa1.1-winbond
3823 		os=-proelf
3824 		;;
3825-	windows32)
3826-		basic_machine=i386-pc
3827-		os=-windows32-msvcrt
3828+	xbox)
3829+		basic_machine=i686-pc
3830+		os=-mingw32
3831 		;;
3832 	xps | xps100)
3833 		basic_machine=xps100-honeywell
3834@@ -992,6 +1171,10 @@
3835 		basic_machine=z8k-unknown
3836 		os=-sim
3837 		;;
3838+	z80-*-coff)
3839+		basic_machine=z80-unknown
3840+		os=-sim
3841+		;;
3842 	none)
3843 		basic_machine=none-none
3844 		os=-none
3845@@ -1011,6 +1194,9 @@
3846 	romp)
3847 		basic_machine=romp-ibm
3848 		;;
3849+	mmix)
3850+		basic_machine=mmix-knuth
3851+		;;
3852 	rs6000)
3853 		basic_machine=rs6000-ibm
3854 		;;
3855@@ -1027,13 +1213,10 @@
3856 	we32k)
3857 		basic_machine=we32k-att
3858 		;;
3859-	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
3860+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
3861 		basic_machine=sh-unknown
3862 		;;
3863-	sh64)
3864-		basic_machine=sh64-unknown
3865-		;;
3866-	sparc | sparcv9 | sparcv9b)
3867+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
3868 		basic_machine=sparc-sun
3869 		;;
3870 	cydra)
3871@@ -1080,6 +1263,9 @@
3872         # First match some system type aliases
3873         # that might get confused with valid system types.
3874 	# -solaris* is a basic system type, with this one exception.
3875+        -auroraux)
3876+	        os=-auroraux
3877+		;;
3878 	-solaris1 | -solaris1.*)
3879 		os=`echo $os | sed -e 's|solaris1|sunos4|'`
3880 		;;
3881@@ -1100,24 +1286,30 @@
3882 	# Each alternative MUST END IN A *, to match a version number.
3883 	# -sysv* is not here because it comes later, after sysvr4.
3884 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
3885-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
3886-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
3887+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
3888+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
3889+	      | -sym* | -kopensolaris* \
3890 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
3891-	      | -aos* \
3892+	      | -aos* | -aros* \
3893 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
3894 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
3895-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
3896-	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
3897+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
3898+	      | -openbsd* | -solidbsd* \
3899+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
3900+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
3901 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
3902 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
3903-	      | -chorusos* | -chorusrdb* \
3904+	      | -chorusos* | -chorusrdb* | -cegcc* \
3905 	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
3906-	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
3907-	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
3908+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
3909+	      | -uxpv* | -beos* | -mpeix* | -udk* \
3910+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
3911 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
3912 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
3913 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
3914-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
3915+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
3916+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
3917+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
3918 	# Remember, each alternative MUST END IN *, to match a version number.
3919 		;;
3920 	-qnx*)
3921@@ -1129,16 +1321,21 @@
3922 			;;
3923 		esac
3924 		;;
3925+	-nto-qnx*)
3926+		;;
3927 	-nto*)
3928-		os=-nto-qnx
3929+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
3930 		;;
3931 	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
3932-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
3933+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
3934 	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
3935 		;;
3936 	-mac*)
3937 		os=`echo $os | sed -e 's|mac|macos|'`
3938 		;;
3939+	-linux-dietlibc)
3940+		os=-linux-dietlibc
3941+		;;
3942 	-linux*)
3943 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
3944 		;;
3945@@ -1151,6 +1348,9 @@
3946 	-opened*)
3947 		os=-openedition
3948 		;;
3949+        -os400*)
3950+		os=-os400
3951+		;;
3952 	-wince*)
3953 		os=-wince
3954 		;;
3955@@ -1172,6 +1372,9 @@
3956 	-atheos*)
3957 		os=-atheos
3958 		;;
3959+	-syllable*)
3960+		os=-syllable
3961+		;;
3962 	-386bsd)
3963 		os=-bsd
3964 		;;
3965@@ -1194,6 +1397,9 @@
3966 	-sinix*)
3967 		os=-sysv4
3968 		;;
3969+        -tpf*)
3970+		os=-tpf
3971+		;;
3972 	-triton*)
3973 		os=-sysv3
3974 		;;
3975@@ -1224,6 +1430,20 @@
3976 	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
3977 		os=-mint
3978 		;;
3979+	-aros*)
3980+		os=-aros
3981+		;;
3982+	-kaos*)
3983+		os=-kaos
3984+		;;
3985+	-zvmoe)
3986+		os=-zvmoe
3987+		;;
3988+	-dicos*)
3989+		os=-dicos
3990+		;;
3991+        -nacl*)
3992+	        ;;
3993 	-none)
3994 		;;
3995 	*)
3996@@ -1246,6 +1466,12 @@
3997 # system, and we'll never get to this point.
3998
3999 case $basic_machine in
4000+        score-*)
4001+		os=-elf
4002+		;;
4003+        spu-*)
4004+		os=-elf
4005+		;;
4006 	*-acorn)
4007 		os=-riscix1.2
4008 		;;
4009@@ -1255,6 +1481,9 @@
4010 	arm*-semi)
4011 		os=-aout
4012 		;;
4013+        c4x-* | tic4x-*)
4014+        	os=-coff
4015+		;;
4016 	# This must come before the *-dec entry.
4017 	pdp10-*)
4018 		os=-tops20
4019@@ -1280,6 +1509,9 @@
4020 	m68*-cisco)
4021 		os=-aout
4022 		;;
4023+        mep-*)
4024+		os=-elf
4025+		;;
4026 	mips*-cisco)
4027 		os=-elf
4028 		;;
4029@@ -1298,9 +1530,15 @@
4030 	*-be)
4031 		os=-beos
4032 		;;
4033+	*-haiku)
4034+		os=-haiku
4035+		;;
4036 	*-ibm)
4037 		os=-aix
4038 		;;
4039+    	*-knuth)
4040+		os=-mmixware
4041+		;;
4042 	*-wec)
4043 		os=-proelf
4044 		;;
4045@@ -1403,7 +1641,7 @@
4046 			-sunos*)
4047 				vendor=sun
4048 				;;
4049-			-aix*)
4050+			-cnk*|-aix*)
4051 				vendor=ibm
4052 				;;
4053 			-beos*)
4054@@ -1433,9 +1671,15 @@
4055 			-mvs* | -opened*)
4056 				vendor=ibm
4057 				;;
4058+			-os400*)
4059+				vendor=ibm
4060+				;;
4061 			-ptx*)
4062 				vendor=sequent
4063 				;;
4064+			-tpf*)
4065+				vendor=ibm
4066+				;;
4067 			-vxsim* | -vxworks* | -windiss*)
4068 				vendor=wrs
4069 				;;
4070@@ -1460,7 +1704,7 @@
4071 esac
4072
4073 echo $basic_machine$os
4074-exit 0
4075+exit
4076
4077 # Local variables:
4078 # eval: (add-hook 'write-file-hooks 'time-stamp)
4079