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