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