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