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