Initial import from FreeBSD RELENG_4:
[games.git] / contrib / libreadline / support / config.guess
1 #! /bin/sh
2 # Attempt to guess a canonical system name.
3 #   Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
4 #
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #
19 # As a special exception to the GNU General Public License, if you
20 # distribute this file as part of a program that contains a
21 # configuration script generated by Autoconf, you may include it under
22 # the same distribution terms that you use for the rest of that program.
23
24 # Written by Per Bothner <bothner@cygnus.com>.
25 # The master version of this file is at the FSF in /home/gd/gnu/lib.
26 #
27 # This script attempts to guess a canonical system name similar to
28 # config.sub.  If it succeeds, it prints the system name on stdout, and
29 # exits with 0.  Otherwise, it exits with 1.
30 #
31 # The plan is that this can be called by configure scripts if you
32 # don't specify an explicit system type (host/target name).
33 #
34 # Only a few systems have been added to this list; please add others
35 # (but try to keep the structure clean).
36 #
37
38 # Use $HOST_CC if defined. $CC may point to a cross-compiler
39 if test x"$CC_FOR_BUILD" = x; then
40   if test x"$HOST_CC" != x; then
41     CC_FOR_BUILD="$HOST_CC"
42   else
43     if test x"$CC" != x; then
44       CC_FOR_BUILD="$CC"
45     else
46       CC_FOR_BUILD=cc
47     fi
48   fi
49 fi
50
51 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
52 # (ghazi@noc.rutgers.edu 8/24/94.)
53 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
54         PATH=$PATH:/.attbin ; export PATH
55 elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
56         PATH=$PATH:/usr/5bin
57 fi
58
59 UNAME=`(uname) 2>/dev/null` || UNAME=unknown
60 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
61 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
62 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
63 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
64
65 RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
66 case "$RELEASE" in
67 "")     RELEASE=0 ;;
68 *)      RELEASE=`expr "$RELEASE" + 0` ;;
69 esac
70 REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'`    # 1
71 REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
72
73 dummy=dummy-$$
74 trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
75
76 # Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
77 # is contrary to all other versions of uname
78 if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
79         UNAME=UNIX_SV
80 fi
81
82 # Note: order is significant - the case branches are not exclusive.
83
84 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
85     # Begin cases added for Bash
86     alpha:NetBSD:*:*)
87         echo alpha-dec-netbsd${UNAME_RELEASE}
88         exit 0 ;;
89     alpha:OpenBSD:*:*)
90         echo alpha-dec-openbsd${UNAME_RELEASE}
91         exit 0 ;;
92     i?86:NetBSD:*:*)
93         echo ${UNAME_MACHINE}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
94         exit 0 ;;
95     i?86:OpenBSD:*:*)
96         echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
97         exit 0 ;;
98     sparc:NetBSD:*:*)
99         echo sparc-unknown-netbsd${UNAME_RELEASE}
100         exit 0 ;;
101     sparc:OpenBSD:*:*)
102         echo sparc-unknown-openbsd${UNAME_RELEASE}
103         exit 0 ;;
104     vax:NetBSD:*:*)
105         echo vax-dec-netbsd${UNAME_RELEASE}
106         exit 0 ;;
107     vax:OpenBSD:*:*)
108         echo vax-dec-openbsd${UNAME_RELEASE}
109         exit 0 ;;
110     mac68k:machten:*:*)
111         echo mac68k-apple-machten${UNAME_RELEASE}
112         exit 0 ;;
113     concurrent*:*:*:*)
114         if test "`(/bin/universe) 2>/dev/null`" = att ; then
115                 echo concurrent-concurrent-sysv3
116         else
117                 echo concurrent-concurrent-bsd
118         fi
119         exit 0 ;;
120     ppc*:SunOS:5.*:*)
121         echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
122         exit 0 ;;
123     sparc:UNIX_SV:4.*:*)
124         echo sparc-unknown-sysv${UNAME_RELEASE}
125         exit 0 ;;
126     mips:UNIX_SV:4.*:*)
127         echo mips-mips-sysv${UNAME_RELEASE}
128         exit 0 ;;
129     mips:OSF*1:*:*)
130         echo mips-mips-osf1
131         exit 0 ;;
132     mips:4.4BSD:*:*)
133         echo mips-mips-bsd4.4
134         exit 0 ;;
135     MIServer-S:SMP_DC.OSx:*:dcosx)
136         echo mips-pyramid-sysv4
137         exit 0 ;;
138     news*:NEWS*:*:*)
139         echo mips-sony-newsos${UNAME_RELEASE}
140         exit 0 ;;
141     i?86:NEXTSTEP:*:*)
142         echo i386-next-nextstep${RELEASE}
143         exit 0 ;;
144     *680?0:NEXTSTEP:*:*)
145         echo m68k-next-nextstep${RELEASE}
146         exit 0 ;;    
147     *370:AIX:*:*)
148         echo ibm370-ibm-aix
149         exit 0 ;;
150     ksr1:OSF*1:*:*)
151         echo ksr1-ksr-osf1
152         exit 0 ;;
153     esa:OSF*1:*:* | ESA:OSF*:*:*)
154         echo esa-ibm-osf1
155         exit 0 ;;
156     DNP*:DNIX:*:*)
157         echo m68k-dnix-sysv
158         exit 0 ;;
159     *3b2*:*:*:*)
160         echo we32k-att-sysv3
161         exit 0 ;;
162     *:QNX:*:42*)
163         echo i386-qssl-qnx`echo ${UNAME_VERSION}`
164         exit 0 ;;
165     Alpha*:Windows:NT:*:SP*)
166         echo alpha-pc-opennt
167         exit 0 ;;
168     *:Windows:NT:*:SP*)
169         echo intel-pc-opennt
170         exit 0 ;;
171     # end cases added for Bash
172     alpha:OSF1:*:*)
173         if test $UNAME_RELEASE = "V4.0"; then
174                 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
175         fi
176         # A Vn.n version is a released version.
177         # A Tn.n version is a released field test version.
178         # A Xn.n version is an unreleased experimental baselevel.
179         # 1.2 uses "1.2" for uname -r.
180         cat <<EOF >$dummy.s
181         .globl main
182         .ent main
183 main:
184         .frame \$30,0,\$26,0
185         .prologue 0
186         .long 0x47e03d80 # implver $0
187         lda \$2,259
188         .long 0x47e20c21 # amask $2,$1
189         srl \$1,8,\$2
190         sll \$2,2,\$2
191         sll \$0,3,\$0
192         addl \$1,\$0,\$0
193         addl \$2,\$0,\$0
194         ret \$31,(\$26),1
195         .end main
196 EOF
197         $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
198         if test "$?" = 0 ; then
199                 ./$dummy
200                 case "$?" in
201                         7)
202                                 UNAME_MACHINE="alpha"
203                                 ;;
204                         15)
205                                 UNAME_MACHINE="alphaev5"
206                                 ;;
207                         14)
208                                 UNAME_MACHINE="alphaev56"
209                                 ;;
210                         10)
211                                 UNAME_MACHINE="alphapca56"
212                                 ;;
213                         16)
214                                 UNAME_MACHINE="alphaev6"
215                                 ;;
216                 esac
217         fi
218         rm -f $dummy.s $dummy
219         echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
220         exit 0 ;;
221     Alpha\ *:Windows_NT*:*)
222         # How do we know it's Interix rather than the generic POSIX subsystem?
223         # Should we change UNAME_MACHINE based on the output of uname instead
224         # of the specific Alpha model?
225         echo alpha-pc-interix
226         exit 0 ;;
227     21064:Windows_NT:50:3)
228         echo alpha-dec-winnt3.5
229         exit 0 ;;
230     Amiga*:UNIX_System_V:4.0:*)
231         echo m68k-cbm-sysv4
232         exit 0;;
233     amiga:NetBSD:*:*)
234         echo m68k-cbm-netbsd${UNAME_RELEASE}
235         exit 0 ;;
236     amiga:OpenBSD:*:*)
237         echo m68k-cbm-openbsd${UNAME_RELEASE}
238         exit 0 ;;
239     *:[Aa]miga[Oo][Ss]:*:*)
240         echo ${UNAME_MACHINE}-unknown-amigaos
241         exit 0 ;;
242     arc64:OpenBSD:*:*)
243         echo mips64el-unknown-openbsd${UNAME_RELEASE}
244         exit 0 ;;
245     arc:OpenBSD:*:*)
246         echo mipsel-unknown-openbsd${UNAME_RELEASE}
247         exit 0 ;;
248     hkmips:OpenBSD:*:*)
249         echo mips-unknown-openbsd${UNAME_RELEASE}
250         exit 0 ;;
251     pmax:OpenBSD:*:*)
252         echo mipsel-unknown-openbsd${UNAME_RELEASE}
253         exit 0 ;;
254     sgi:OpenBSD:*:*)
255         echo mips-unknown-openbsd${UNAME_RELEASE}
256         exit 0 ;;
257     wgrisc:OpenBSD:*:*)
258         echo mipsel-unknown-openbsd${UNAME_RELEASE}
259         exit 0 ;;
260     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
261         echo arm-acorn-riscix${UNAME_RELEASE}
262         exit 0;;
263     arm32:NetBSD:*:*)
264         echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
265         exit 0 ;;
266     SR2?01:HI-UX/MPP:*:*)
267         echo hppa1.1-hitachi-hiuxmpp
268         exit 0;;
269     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
270         # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
271         if test "`(/bin/universe) 2>/dev/null`" = att ; then
272                 echo pyramid-pyramid-sysv3
273         else
274                 echo pyramid-pyramid-bsd
275         fi
276         exit 0 ;;
277     NILE:*:*:*:dcosx)
278         echo pyramid-pyramid-svr4
279         exit 0 ;;
280     sun4H:SunOS:5.*:*)
281         echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
282         exit 0 ;;
283     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
284         echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
285         exit 0 ;;
286     i86pc:SunOS:5.*:*)
287         echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
288         exit 0 ;;
289     sun4*:SunOS:6*:*)
290         # According to config.sub, this is the proper way to canonicalize
291         # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
292         # it's likely to be more like Solaris than SunOS4.
293         echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
294         exit 0 ;;
295     sun4*:SunOS:*:*)
296         case "`/usr/bin/arch -k`" in
297             Series*|S4*)
298                 UNAME_RELEASE=`uname -v`
299                 ;;
300         esac
301         # Japanese Language versions have a version number like `4.1.3-JL'.
302         echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
303         exit 0 ;;
304     sun3*:SunOS:*:*)
305         echo m68k-sun-sunos${UNAME_RELEASE}
306         exit 0 ;;
307     sun*:*:4.2BSD:*)
308         UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
309         test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
310         case "`/bin/arch`" in
311             sun3)
312                 echo m68k-sun-sunos${UNAME_RELEASE}
313                 ;;
314             sun4)
315                 echo sparc-sun-sunos${UNAME_RELEASE}
316                 ;;
317         esac
318         exit 0 ;;
319     aushp:SunOS:*:*)
320         echo sparc-auspex-sunos${UNAME_RELEASE}
321         exit 0 ;;
322     atari*:NetBSD:*:*)
323         echo m68k-atari-netbsd${UNAME_RELEASE}
324         exit 0 ;;
325     atari*:OpenBSD:*:*)
326         echo m68k-unknown-openbsd${UNAME_RELEASE}
327         exit 0 ;;
328     # The situation for MiNT is a little confusing.  The machine name
329     # can be virtually everything (everything which is not
330     # "atarist" or "atariste" at least should have a processor 
331     # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
332     # to the lowercase version "mint" (or "freemint").  Finally
333     # the system name "TOS" denotes a system which is actually not
334     # MiNT.  But MiNT is downward compatible to TOS, so this should
335     # be no problem.
336     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
337        echo m68k-atari-mint${UNAME_RELEASE}
338        exit 0 ;;
339     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
340        echo m68k-atari-mint${UNAME_RELEASE}
341        exit 0 ;;
342     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
343        echo m68k-atari-mint${UNAME_RELEASE}
344        exit 0 ;;
345     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
346         echo m68k-milan-mint${UNAME_RELEASE}
347         exit 0 ;;
348     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
349         echo m68k-hades-mint${UNAME_RELEASE}
350         exit 0 ;;
351     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
352         echo m68k-unknown-mint${UNAME_RELEASE}
353         exit 0 ;;
354     sun3*:NetBSD:*:*)
355         echo m68k-sun-netbsd${UNAME_RELEASE}
356         exit 0 ;;
357     sun3*:OpenBSD:*:*)
358         echo m68k-unknown-openbsd${UNAME_RELEASE}
359         exit 0 ;;
360     mac68k:NetBSD:*:*)
361         echo m68k-apple-netbsd${UNAME_RELEASE}
362         exit 0 ;;
363     mac68k:OpenBSD:*:*)
364         echo m68k-unknown-openbsd${UNAME_RELEASE}
365         exit 0 ;;
366     mvme68k:OpenBSD:*:*)
367         echo m68k-unknown-openbsd${UNAME_RELEASE}
368         exit 0 ;;
369     mvme88k:OpenBSD:*:*)
370         echo m88k-unknown-openbsd${UNAME_RELEASE}
371         exit 0 ;;
372     *:"Mac OS":*:*)
373         echo `uname -p`-apple-macos${UNAME_RELEASE}
374         exit 0 ;;
375     powerpc:machten:*:*)
376         echo powerpc-apple-machten${UNAME_RELEASE}
377         exit 0 ;;
378     macppc:NetBSD:*:*)
379         echo powerpc-apple-netbsd${UNAME_RELEASE}
380         exit 0 ;;
381     RISC*:Mach:*:*)
382         echo mips-dec-mach_bsd4.3
383         exit 0 ;;
384     RISC*:ULTRIX:*:*)
385         echo mips-dec-ultrix${UNAME_RELEASE}
386         exit 0 ;;
387     VAX*:ULTRIX*:*:*)
388         echo vax-dec-ultrix${UNAME_RELEASE}
389         exit 0 ;;
390     2020:CLIX:*:* | 2430:CLIX:*:*)
391         echo clipper-intergraph-clix${UNAME_RELEASE}
392         exit 0 ;;
393     mips:*:*:UMIPS | mips:*:*:RISCos)
394         sed 's/^        //' << EOF >$dummy.c
395 #ifdef __cplusplus
396         int main (int argc, char *argv[]) {
397 #else
398         int main (argc, argv) int argc; char *argv[]; {
399 #endif
400         #if defined (host_mips) && defined (MIPSEB)
401         #if defined (SYSTYPE_SYSV)
402           printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
403         #endif
404         #if defined (SYSTYPE_SVR4)
405           printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
406         #endif
407         #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
408           printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
409         #endif
410         #endif
411           exit (-1);
412         }
413 EOF
414         $CC_FOR_BUILD $dummy.c -o $dummy \
415           && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
416           && rm $dummy.c $dummy && exit 0
417         rm -f $dummy.c $dummy
418         echo mips-mips-riscos${UNAME_RELEASE}
419         exit 0 ;;
420     Night_Hawk:Power_UNIX:*:*)
421         echo powerpc-harris-powerunix
422         exit 0 ;;
423     m88k:CX/UX:7*:*)
424         echo m88k-harris-cxux7
425         exit 0 ;;
426     m88k:*:4*:R4*)
427         echo m88k-motorola-sysv4
428         exit 0 ;;
429     m88k:*:3*:R3*)
430         echo m88k-motorola-sysv3
431         exit 0 ;;
432     AViiON:dgux:*:*)
433         # DG/UX returns AViiON for all architectures
434         UNAME_PROCESSOR=`/usr/bin/uname -p`
435         if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
436           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
437              -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
438                 echo m88k-dg-dgux${UNAME_RELEASE}
439           else
440                 echo m88k-dg-dguxbcs${UNAME_RELEASE}
441           fi
442         else
443           echo i586-dg-dgux${UNAME_RELEASE}
444         fi
445         exit 0 ;;
446     M88*:DolphinOS:*:*) # DolphinOS (SVR3)
447         echo m88k-dolphin-sysv3
448         exit 0 ;;
449     M88*:*:R3*:*)
450         # Delta 88k system running SVR3
451         echo m88k-motorola-sysv3
452         exit 0 ;;
453     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
454         echo m88k-tektronix-sysv3
455         exit 0 ;;
456     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
457         echo m68k-tektronix-bsd
458         exit 0 ;;
459     *:IRIX*:*:*)
460         echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
461         exit 0 ;;
462     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
463         echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
464         exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
465     i?86:AIX:*:*)
466         echo i386-ibm-aix
467         exit 0 ;;
468     *:AIX:2:3)
469         if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
470                 sed 's/^                //' << EOF >$dummy.c
471                 #include <sys/systemcfg.h>
472
473                 main()
474                         {
475                         if (!__power_pc())
476                                 exit(1);
477                         puts("powerpc-ibm-aix3.2.5");
478                         exit(0);
479                         }
480 EOF
481                 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
482                 rm -f $dummy.c $dummy
483                 echo rs6000-ibm-aix3.2.5
484         elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
485                 echo rs6000-ibm-aix3.2.4
486         else
487                 echo rs6000-ibm-aix3.2
488         fi
489         exit 0 ;;
490     *:AIX:*:4)
491         IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
492         if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
493                 IBM_ARCH=rs6000
494         else
495                 IBM_ARCH=powerpc
496         fi
497         if [ -x /usr/bin/oslevel ] ; then
498                 IBM_REV=`/usr/bin/oslevel`
499         elif grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
500                 IBM_REV=4.1
501         elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
502                 IBM_REV=4.1.1
503         else
504                 IBM_REV=4.${UNAME_RELEASE}
505         fi
506         echo ${IBM_ARCH}-ibm-aix${IBM_REV}
507         exit 0 ;;
508     *:AIX:*:*)
509         echo rs6000-ibm-aix
510         exit 0 ;;
511     ibmrt:4.4BSD:*|romp-ibm:BSD:*)
512         echo romp-ibm-bsd4.4
513         exit 0 ;;
514     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
515         echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
516         exit 0 ;;                           # report: romp-ibm BSD 4.3
517     *:BOSX:*:*)
518         echo rs6000-bull-bosx
519         exit 0 ;;
520     DPX/2?00:B.O.S.:*:*)
521         echo m68k-bull-sysv3
522         exit 0 ;;
523     9000/[34]??:4.3bsd:1.*:*)
524         echo m68k-hp-bsd
525         exit 0 ;;
526     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
527         echo m68k-hp-bsd4.4
528         exit 0 ;;
529     9000/[34678]??:HP-UX:*:*)
530         case "${UNAME_MACHINE}" in
531             9000/31? )          HP_ARCH=m68000 ;;
532             9000/[34]?? )       HP_ARCH=m68k ;;
533             9000/[678][0-9][0-9])
534               sed 's/^              //' << EOF >$dummy.c
535               #include <stdlib.h>
536               #include <unistd.h>
537
538               int main ()
539               {
540               #if defined(_SC_KERNEL_BITS)
541                   long bits = sysconf(_SC_KERNEL_BITS);
542               #endif
543                   long cpu  = sysconf (_SC_CPU_VERSION);
544
545                   switch (cpu)
546                 {
547                 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
548                 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
549                 case CPU_PA_RISC2_0:
550               #if defined(_SC_KERNEL_BITS)
551                     switch (bits)
552                         {
553                         case 64: puts ("hppa2.0w"); break;
554                         case 32: puts ("hppa2.0n"); break;
555                         default: puts ("hppa2.0"); break;
556                         } break;
557               #else  /* !defined(_SC_KERNEL_BITS) */
558                     puts ("hppa2.0"); break;
559               #endif
560                 default: puts ("hppa1.0"); break;
561                 }
562                   exit (0);
563               }
564 EOF
565         ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
566         rm -f $dummy.c $dummy
567         esac
568         HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
569         echo ${HP_ARCH}-hp-hpux${HPUX_REV}
570         exit 0 ;;
571     3050*:HI-UX:*:*)
572         sed 's/^        //' << EOF >$dummy.c
573         #include <unistd.h>
574         int
575         main ()
576         {
577           long cpu = sysconf (_SC_CPU_VERSION);
578           /* The order matters, because CPU_IS_HP_MC68K erroneously returns
579              true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
580              results, however.  */
581           if (CPU_IS_PA_RISC (cpu))
582             {
583               switch (cpu)
584                 {
585                   case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
586                   case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
587                   case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
588                   default: puts ("hppa-hitachi-hiuxwe2"); break;
589                 }
590             }
591           else if (CPU_IS_HP_MC68K (cpu))
592             puts ("m68k-hitachi-hiuxwe2");
593           else puts ("unknown-hitachi-hiuxwe2");
594           exit (0);
595         }
596 EOF
597         $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
598         rm -f $dummy.c $dummy
599         echo unknown-hitachi-hiuxwe2
600         exit 0 ;;
601     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
602         echo hppa1.1-hp-bsd
603         exit 0 ;;
604     9000/8??:4.3bsd:*:*)
605         echo hppa1.0-hp-bsd
606         exit 0 ;;
607     *9??*:MPE/iX:*:*)
608         echo hppa1.0-hp-mpeix
609         exit 0 ;;
610     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
611         echo hppa1.1-hp-osf
612         exit 0 ;;
613     hp8??:OSF1:*:*)
614         echo hppa1.0-hp-osf
615         exit 0 ;;
616     i?86:OSF1:*:*)
617         if [ -x /usr/sbin/sysversion ] ; then
618             echo ${UNAME_MACHINE}-unknown-osf1mk
619         else
620             echo ${UNAME_MACHINE}-unknown-osf1
621         fi
622         exit 0 ;;
623     parisc*:Lites*:*:*)
624         echo hppa1.1-hp-lites
625         exit 0 ;;
626     hppa*:OpenBSD:*:*)
627         echo hppa-unknown-openbsd
628         exit 0 ;;
629     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
630         echo c1-convex-bsd
631         exit 0 ;;
632     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
633         if getsysinfo -f scalar_acc
634         then echo c32-convex-bsd
635         else echo c2-convex-bsd
636         fi
637         exit 0 ;;
638     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
639         echo c34-convex-bsd
640         exit 0 ;;
641     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
642         echo c38-convex-bsd
643         exit 0 ;;
644     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
645         echo c4-convex-bsd
646         exit 0 ;;
647     CRAY*X-MP:*:*:*)
648         echo xmp-cray-unicos
649         exit 0 ;;
650     CRAY*Y-MP:*:*:*)
651         echo ymp-cray-unicos${UNAME_RELEASE}
652         exit 0 ;;
653     CRAY*[A-Z]90:*:*:*)
654         echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
655         | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
656               -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
657         exit 0 ;;
658     CRAY*TS:*:*:*)
659         echo t90-cray-unicos${UNAME_RELEASE}
660         exit 0 ;;
661     CRAY*T3E:*:*:*)
662         echo alpha-cray-unicosmk${UNAME_RELEASE}
663         exit 0 ;;
664     CRAY-2:*:*:*)
665         echo cray2-cray-unicos
666         exit 0 ;;
667     F300:UNIX_System_V:*:*)
668         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
669         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
670         echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
671         exit 0 ;;
672     F301:UNIX_System_V:*:*)
673         echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
674         exit 0 ;;
675     hp3[0-9][05]:NetBSD:*:*)
676         echo m68k-hp-netbsd${UNAME_RELEASE}
677         exit 0 ;;
678     hp300:OpenBSD:*:*)
679         echo m68k-unknown-openbsd${UNAME_RELEASE}
680         exit 0 ;;
681     i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
682         echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
683         exit 0 ;;
684     sparc*:BSD/OS:*:*)
685         echo sparc-unknown-bsdi${UNAME_RELEASE}
686         exit 0 ;;
687     *:BSD/OS:*:*)
688         echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
689         exit 0 ;;
690     *:FreeBSD:*:*)
691         if test -x /usr/bin/objformat; then
692             if test "elf" = "`/usr/bin/objformat`"; then
693                 echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
694                 exit 0
695             fi
696         fi
697         echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-=(].*//'`
698         exit 0 ;;
699     *:NetBSD:*:*)
700         echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
701         exit 0 ;;
702     *:OpenBSD:*:*)
703         echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
704         exit 0 ;;
705     i*:CYGWIN*:*)
706         echo ${UNAME_MACHINE}-pc-cygwin32
707         exit 0 ;;
708     i*:MINGW*:*)
709         echo ${UNAME_MACHINE}-pc-mingw32
710         exit 0 ;;
711     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
712         # How do we know it's Interix rather than the generic POSIX subsystem?
713         # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
714         # UNAME_MACHINE based on the output of uname instead of i386?
715         echo i386-pc-interix
716         exit 0 ;;
717     i*:UWIN*:*)
718         echo ${UNAME_MACHINE}-pc-uwin
719         exit 0 ;;
720     p*:CYGWIN*:*)
721         echo powerpcle-unknown-cygwin
722         exit 0 ;;    
723     prep*:SunOS:5.*:*)
724         echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
725         exit 0 ;;
726     *:GNU:*:*)
727         echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
728         exit 0 ;;
729     *:Linux:*:*)
730         # uname on the ARM produces all sorts of strangeness, and we need to
731         # filter it out.
732         case "$UNAME_MACHINE" in
733           armv*)                      UNAME_MACHINE=$UNAME_MACHINE ;;
734           arm* | sa110*)              UNAME_MACHINE="arm" ;;
735         esac
736
737         # The BFD linker knows what the default object file format is, so
738         # first see if it will tell us.  cd to the root directory to prevent
739         # problems with other programs or directories called `ld' in the path.
740         ld_help_string=`cd /; ld --help 2>&1`
741         ld_supported_emulations=`echo $ld_help_string \
742                          | sed -ne '/supported emulations:/!d
743                                     s/[         ][      ]*/ /g
744                                     s/.*supported emulations: *//
745                                     s/ .*//
746                                     p'`
747         case "$ld_supported_emulations" in
748           *ia64)      echo "${UNAME_MACHINE}-unknown-linux"         ; exit 0 ;;
749           i?86linux)  echo "${UNAME_MACHINE}-pc-linux-gnuaout"      ; exit 0 ;;
750           i?86coff)   echo "${UNAME_MACHINE}-pc-linux-gnucoff"      ; exit 0 ;;
751           sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
752           armlinux)   echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
753           m68klinux)  echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
754           elf32ppc | elf32ppclinux)
755                 # Determine Lib Version
756                 cat >$dummy.c <<EOF
757 #include <features.h>
758 #if defined(__GLIBC__)
759 extern char __libc_version[];
760 extern char __libc_release[];
761 #endif
762 main(argc, argv)
763      int argc;
764      char *argv[];
765 {
766 #if defined(__GLIBC__)
767   printf("%s %s\n", __libc_version, __libc_release);
768 #else
769   printf("unkown\n");
770 #endif
771   return 0;
772 }
773 EOF
774                 LIBC=""
775                 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
776                 if test "$?" = 0 ; then
777                         ./$dummy | grep 1\.99 > /dev/null
778                         if test "$?" = 0 ; then
779                                 LIBC="libc1"
780                         fi
781                 fi      
782                 rm -f $dummy.c $dummy
783                 echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
784         esac
785
786         if test "${UNAME_MACHINE}" = "alpha" ; then
787                 sed 's/^        //'  <<EOF >$dummy.s
788                 .globl main
789                 .ent main
790         main:
791                 .frame \$30,0,\$26,0
792                 .prologue 0
793                 .long 0x47e03d80 # implver $0
794                 lda \$2,259
795                 .long 0x47e20c21 # amask $2,$1
796                 srl \$1,8,\$2
797                 sll \$2,2,\$2
798                 sll \$0,3,\$0
799                 addl \$1,\$0,\$0
800                 addl \$2,\$0,\$0
801                 ret \$31,(\$26),1
802                 .end main
803 EOF
804                 LIBC=""
805                 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
806                 if test "$?" = 0 ; then
807                         ./$dummy
808                         case "$?" in
809                         7)
810                                 UNAME_MACHINE="alpha"
811                                 ;;
812                         15)
813                                 UNAME_MACHINE="alphaev5"
814                                 ;;
815                         14)
816                                 UNAME_MACHINE="alphaev56"
817                                 ;;
818                         10)
819                                 UNAME_MACHINE="alphapca56"
820                                 ;;
821                         16)
822                                 UNAME_MACHINE="alphaev6"
823                                 ;;
824                         esac
825
826                         objdump --private-headers $dummy | \
827                           grep ld.so.1 > /dev/null
828                         if test "$?" = 0 ; then
829                                 LIBC="libc1"
830                         fi
831                 fi
832                 rm -f $dummy.s $dummy
833                 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
834         elif test "${UNAME_MACHINE}" = "mips" ; then
835           cat >$dummy.c <<EOF
836 #ifdef __cplusplus
837 int main (int argc, char *argv[]) {
838 #else
839 int main (argc, argv) int argc; char *argv[]; {
840 #endif
841 #ifdef __MIPSEB__
842   printf ("%s-unknown-linux-gnu\n", argv[1]);
843 #endif
844 #ifdef __MIPSEL__
845   printf ("%sel-unknown-linux-gnu\n", argv[1]);
846 #endif
847   return 0;
848 }
849 EOF
850           $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
851           rm -f $dummy.c $dummy
852         else
853           # Either a pre-BFD a.out linker (linux-gnuoldld)
854           # or one that does not give us useful --help.
855           # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
856           # If ld does not provide *any* "supported emulations:"
857           # that means it is gnuoldld.
858           echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
859           test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
860
861           case "${UNAME_MACHINE}" in
862           i?86)
863             VENDOR=pc;
864             ;;
865           *)
866             VENDOR=unknown;
867             ;;
868           esac
869           # Determine whether the default compiler is a.out or elf
870           cat >$dummy.c <<EOF
871 #include <features.h>
872 #ifdef __cplusplus
873         int main (int argc, char *argv[]) {
874 #else
875         int main (argc, argv) int argc; char *argv[]; {
876 #endif
877 #ifdef __ELF__
878 # ifdef __GLIBC__
879 #  if __GLIBC__ >= 2
880     printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
881 #  else
882     printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
883 #  endif
884 # else
885    printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
886 # endif
887 #else
888   printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
889 #endif
890   return 0;
891 }
892 EOF
893           ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
894           rm -f $dummy.c $dummy
895         fi ;;
896 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
897 # are messed up and put the nodename in both sysname and nodename.
898     i?86:DYNIX/ptx:4*:*)
899         echo i386-sequent-sysv4
900         exit 0 ;;
901 # added by chet for bash based on usenet posting from <hops@sco.com> and
902 # documentation on SCO's web site -- UnixWare 7 (SVR5)
903 #    i?86:UnixWare:5*:*)
904 #       echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
905 #       exit 0 ;;
906     i?86:UNIX_SV:4.2MP:2.*)
907         # Unixware is an offshoot of SVR4, but it has its own version
908         # number series starting with 2...
909         # I am not positive that other SVR4 systems won't match this,
910         # I just have to hope.  -- rms.
911         # Use sysv4.2uw... so that sysv4* matches it.
912         echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
913         exit 0 ;;
914     i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i?86:UNIX_SV:4.*:*)
915         if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
916                 echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
917         else
918                 echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
919         fi
920         exit 0 ;;
921     i?86:*:5:7*)
922         UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
923         (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
924         (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
925         (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
926         (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
927         echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
928         exit 0 ;;
929     i?86:*:3.2:*)
930         if test -f /usr/options/cb.name; then
931                 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
932                 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
933         elif /bin/uname -X 2>/dev/null >/dev/null ; then
934                 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
935                 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
936                 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
937                         && UNAME_MACHINE=i586
938                 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
939                         && UNAME_MACHINE=i686
940                 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
941                         && UNAME_MACHINE=i686
942                 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
943         else
944                 echo ${UNAME_MACHINE}-pc-sysv32
945         fi
946         exit 0 ;;
947     pc:*:*:*)
948         # uname -m prints for DJGPP always 'pc', but it prints nothing about
949         # the processor, so we play safe by assuming i386.
950         echo i386-pc-msdosdjgpp
951         exit 0 ;;
952     Intel:Mach:3*:*)
953         echo i386-pc-mach3
954         exit 0 ;;
955     paragon:*:*:*)
956         echo i860-intel-osf1
957         exit 0 ;;
958     i860:*:4.*:*) # i860-SVR4
959         if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
960           echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
961         else # Add other i860-SVR4 vendors below as they are discovered.
962           echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
963         fi
964         exit 0 ;;
965     mini*:CTIX:SYS*5:*)
966         # "miniframe"
967         echo m68010-convergent-sysv
968         exit 0 ;;
969     M68*:*:R3V[567]*:*)
970         test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
971     3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
972         OS_REL=''
973         test -r /etc/.relid \
974         && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
975         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
976           && echo i486-ncr-sysv4.3${OS_REL} && exit 0
977         /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
978           && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
979     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
980         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
981           && echo i486-ncr-sysv4 && exit 0 ;;
982     mc68030:UNIX_System_V:4.*:*)
983         echo m68k-atari-sysv4
984         exit 0 ;;
985     m68*:LynxOS:2.*:*)
986         echo m68k-unknown-lynxos${UNAME_RELEASE}
987         exit 0 ;;
988     i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
989         echo i386-pc-lynxos${UNAME_RELEASE}
990         exit 0 ;;
991     TSUNAMI:LynxOS:2.*:*)
992         echo sparc-unknown-lynxos${UNAME_RELEASE}
993         exit 0 ;;
994     rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
995         echo rs6000-unknown-lynxos${UNAME_RELEASE}
996         exit 0 ;;
997     *:LynxOS:*:*)
998         echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
999         exit 0 ;;
1000     SM[BE]S:UNIX_SV:*:*)
1001         echo mips-dde-sysv${UNAME_RELEASE}
1002         exit 0 ;;
1003     RM*:SINIX-*:*:* | RM*:ReliantUNIX-*:*:*)
1004         echo mips-sni-sysv4
1005         exit 0 ;;
1006     *:SINIX-*:*:*)
1007         if uname -p 2>/dev/null >/dev/null ; then
1008                 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1009                 echo ${UNAME_MACHINE}-sni-sysv4
1010         else
1011                 echo ns32k-sni-sysv
1012         fi
1013         exit 0 ;;
1014     PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1015                            # says <Richard.M.Bartel@ccMail.Census.GOV>
1016         echo i586-unisys-sysv4
1017         exit 0 ;;
1018     *:UNIX_System_V:4*:FTX*)
1019         # From Gerald Hewes <hewes@openmarket.com>.
1020         # How about differentiating between stratus architectures? -djm
1021         echo hppa1.1-stratus-sysv4
1022         exit 0 ;;
1023     *:*:*:FTX*)
1024         # From seanf@swdc.stratus.com.
1025         echo i860-stratus-sysv4
1026         exit 0 ;;              
1027     mc68*:A/UX:*:*)
1028         echo m68k-apple-aux${UNAME_RELEASE}
1029         exit 0 ;;
1030     news*:NEWS-OS:*:6*)
1031         echo mips-sony-newsos6
1032         exit 0 ;;
1033     R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1034         if [ -d /usr/nec ]; then
1035                 echo mips-nec-sysv${UNAME_RELEASE}
1036         else
1037                 echo mips-unknown-sysv${UNAME_RELEASE}
1038         fi
1039         exit 0 ;;
1040     BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
1041         echo powerpc-apple-beos
1042         exit 0 ;;
1043     BeMac:BeOS:*:*)
1044         echo powerpc-apple-beos
1045         exit 0 ;;
1046     BePC:BeOS:*:*)
1047         echo i586-pc-beos
1048         exit 0 ;;
1049     SX-4:SUPER-UX:*:*)
1050         echo sx4-nec-superux${UNAME_RELEASE}
1051         exit 0 ;;
1052     SX-5:SUPER-UX:*:*)
1053         echo sx5-nec-superux${UNAME_RELEASE}
1054         exit 0 ;;
1055     Power*:Rhapsody:*:*)
1056         echo powerpc-apple-rhapsody${UNAME_RELEASE}
1057         exit 0 ;;
1058     *:Rhapsody:*:*)
1059         echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1060         exit 0 ;;
1061 esac
1062
1063 #echo '(No uname command or uname output not recognized.)' 1>&2
1064 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1065
1066 cat >$dummy.c <<EOF
1067 #ifdef _SEQUENT_
1068 # include <sys/types.h>
1069 # include <sys/utsname.h>
1070 #endif
1071 main ()
1072 {
1073 #if defined (sony)
1074 #if defined (MIPSEB)
1075   /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1076      I don't know....  */
1077   printf ("mips-sony-bsd\n"); exit (0);
1078 #else
1079 #include <sys/param.h>
1080   printf ("m68k-sony-newsos%s\n",
1081 #ifdef NEWSOS4
1082           "4"
1083 #else
1084           ""
1085 #endif
1086          ); exit (0);
1087 #endif
1088 #endif
1089
1090 #if defined (__arm) && defined (__acorn) && defined (__unix)
1091   printf ("arm-acorn-riscix\n"); exit (0);
1092 #endif
1093
1094 #if defined (hp9000) && !defined (hpux)
1095   printf ("m68k-hp-bsd\n"); exit (0);
1096 #endif
1097
1098 #if defined (hp300) && !defined (hpux)
1099   printf ("m68k-hp-bsd\n"); exit (0);
1100 #endif
1101
1102 #if defined (NeXT)
1103 #if !defined (__ARCHITECTURE__)
1104 #define __ARCHITECTURE__ "m68k"
1105 #endif
1106   int version;
1107   version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1108   if (version < 4)
1109     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1110   else
1111     printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1112   exit (0);
1113 #endif
1114
1115 #if defined (MULTIMAX) || defined (n16)
1116 #if defined (UMAXV)
1117   printf ("ns32k-encore-sysv\n"); exit (0);
1118 #else
1119 #if defined (CMU)
1120   printf ("ns32k-encore-mach\n"); exit (0);
1121 #else
1122   printf ("ns32k-encore-bsd\n"); exit (0);
1123 #endif
1124 #endif
1125 #endif
1126
1127 #if defined (__386BSD__)
1128   printf ("i386-pc-bsd\n"); exit (0);
1129 #endif
1130
1131 #if defined (sequent)
1132 #if defined (i386)
1133   printf ("i386-sequent-dynix\n"); exit (0);
1134 #endif
1135 #if defined (ns32000)
1136   printf ("ns32k-sequent-dynix\n"); exit (0);
1137 #endif
1138 #endif
1139
1140 #if defined (_SEQUENT_)
1141     struct utsname un;
1142
1143     uname(&un);
1144
1145     if (strncmp(un.version, "V2", 2) == 0) {
1146         printf ("i386-sequent-ptx2\n"); exit (0);
1147     }
1148     if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1149         printf ("i386-sequent-ptx1\n"); exit (0);
1150     }
1151     printf ("i386-sequent-ptx\n"); exit (0);
1152
1153 #endif
1154
1155 #if defined (vax)
1156 #if !defined (ultrix)
1157   printf ("vax-dec-bsd\n"); exit (0);
1158 #else
1159   printf ("vax-dec-ultrix\n"); exit (0);
1160 #endif
1161 #endif
1162
1163 #if defined (alliant) && defined (i860)
1164   printf ("i860-alliant-bsd\n"); exit (0);
1165 #endif
1166
1167 /* Begin cases added for Bash */
1168 #if defined (tahoe)
1169   printf ("tahoe-cci-bsd\n"); exit (0);
1170 #endif
1171
1172 #if defined (nec_ews)
1173 #  if defined (SYSTYPE_SYSV)
1174   printf ("ews4800-nec-sysv4\n"); exit 0;
1175 #  else
1176   printf ("ews4800-nec-bsd\n"); exit (0);
1177 #  endif
1178 #endif
1179
1180 #if defined (sony)
1181 #  if defined (SYSTYPE_SYSV)
1182   printf ("mips-sony-sysv4\n"); exit 0;
1183 #  else
1184   printf ("mips-sony-bsd\n"); exit (0);
1185 #  endif
1186 #endif
1187
1188 #if defined (ardent)
1189   printf ("titan-ardent-bsd\n"); exit (0);
1190 #endif
1191
1192 #if defined (stardent)
1193   printf ("stardent-stardent-sysv\n"); exit (0);
1194 #endif
1195
1196 #if defined (ibm032)
1197   printf ("ibmrt-ibm-bsd4.3\n"); exit (0);
1198 #endif
1199
1200 #if defined (sequent) && defined (i386)
1201   printf ("i386-sequent-bsd\n"); exit (0);
1202 #endif
1203
1204 #if defined (qnx) && defined (i386)
1205   printf ("i386-pc-qnx\n"); exit (0);
1206 #endif
1207
1208 #if defined (gould)
1209   printf ("gould-gould-bsd\n"); exit (0);
1210 #endif
1211
1212 #if defined (unixpc)
1213   printf ("unixpc-att-sysv\n"); exit (0);
1214 #endif
1215
1216 #if defined (att386)
1217   printf ("i386-att-sysv3\n"); exit (0);
1218 #endif
1219
1220 #if defined (__m88k) && defined (__UMAXV__)
1221   printf ("m88k-encore-sysv3\n"); exit (0);
1222 #endif
1223
1224 #if defined (drs6000)
1225   printf ("drs6000-icl-sysv4.2\n"); exit (0);
1226 #endif
1227
1228 #if defined (clipper)
1229   printf ("clipper-orion-bsd\n"); exit (0);
1230 #endif
1231
1232 #if defined (is68k)
1233   printf ("m68k-isi-bsd\n"); exit (0);
1234 #endif
1235
1236 #if defined (luna88k)
1237   printf ("luna88k-omron-bsd\n"); exit (0);
1238 #endif
1239
1240 #if defined (butterfly) && defined (BFLY1)
1241   printf ("butterfly-bbn-mach\n"); exit (0);
1242 #endif
1243
1244 #if defined (tower32)
1245   printf ("tower32-ncr-sysv4\n"); exit (0);
1246 #endif
1247
1248 #if defined (MagicStation)
1249   printf ("magicstation-unknown-bsd\n"); exit (0);
1250 #endif
1251
1252 #if defined (scs)
1253   printf ("symmetric-scs-bsd4.2\n"); exit (0);
1254 #endif
1255
1256 #if defined (tandem)
1257   printf ("tandem-tandem-sysv\n"); exit (0);
1258 #endif
1259
1260 #if defined (cadmus)
1261   printf ("cadmus-pcs-sysv\n"); exit (0);
1262 #endif
1263
1264 #if defined (masscomp)
1265   printf ("masscomp-masscomp-sysv3\n"); exit (0);
1266 #endif
1267
1268 #if defined (hbullx20)
1269   printf ("hbullx20-bull-sysv3\n"); exit (0);
1270 #endif
1271
1272 /* End cases added for Bash */
1273
1274   exit (1);
1275 }
1276 EOF
1277
1278 ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
1279 rm -f $dummy.c $dummy
1280
1281 # Apollos put the system type in the environment.
1282
1283 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1284
1285 # Convex versions that predate uname can use getsysinfo(1)
1286
1287 if [ -x /usr/convex/getsysinfo ]
1288 then
1289     case `getsysinfo -f cpu_type` in
1290     c1*)
1291         echo c1-convex-bsd
1292         exit 0 ;;
1293     c2*)
1294         if getsysinfo -f scalar_acc
1295         then echo c32-convex-bsd
1296         else echo c2-convex-bsd
1297         fi
1298         exit 0 ;;
1299     c34*)
1300         echo c34-convex-bsd
1301         exit 0 ;;
1302     c38*)
1303         echo c38-convex-bsd
1304         exit 0 ;;
1305     c4*)
1306         echo c4-convex-bsd
1307         exit 0 ;;
1308     esac
1309 fi
1310
1311 # Begin cases added for Bash
1312 case "$UNAME" in
1313 uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
1314 esac
1315
1316 if [ -d /usr/amiga ]; then
1317         echo m68k-cbm-sysv${UNAME_RELEASE}; exit 0;
1318 fi
1319
1320 if [ -f /bin/fxc.info ]; then
1321         echo fxc-alliant-concentrix
1322         exit 0
1323 fi
1324 # end cases added for Bash
1325
1326 #echo '(Unable to guess system type)' 1>&2
1327
1328 exit 1