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