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