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