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