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