config.guess revision ec318dbf
1bccedf53Smrg#! /bin/sh
2bccedf53Smrg# Attempt to guess a canonical system name.
3ec318dbfSmrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4bccedf53Smrg
5ec318dbfSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6ec318dbfSmrg
7ec318dbfSmrgtimestamp='2021-06-03'
8bccedf53Smrg
9bccedf53Smrg# This file is free software; you can redistribute it and/or modify it
10bccedf53Smrg# under the terms of the GNU General Public License as published by
1189afc689Smrg# the Free Software Foundation; either version 3 of the License, or
12bccedf53Smrg# (at your option) any later version.
13bccedf53Smrg#
14bccedf53Smrg# This program is distributed in the hope that it will be useful, but
15bccedf53Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16bccedf53Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17bccedf53Smrg# General Public License for more details.
18bccedf53Smrg#
19bccedf53Smrg# You should have received a copy of the GNU General Public License
2089afc689Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21bccedf53Smrg#
22bccedf53Smrg# As a special exception to the GNU General Public License, if you
23bccedf53Smrg# distribute this file as part of a program that contains a
24bccedf53Smrg# configuration script generated by Autoconf, you may include it under
2589afc689Smrg# the same distribution terms that you use for the rest of that
2689afc689Smrg# program.  This Exception is an additional permission under section 7
2789afc689Smrg# of the GNU General Public License, version 3 ("GPLv3").
28bccedf53Smrg#
2989afc689Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30bccedf53Smrg#
31f7ada8ddSmrg# You can get the latest version of this script from:
32ec318dbfSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
3389afc689Smrg#
3489afc689Smrg# Please send patches to <config-patches@gnu.org>.
3589afc689Smrg
36bccedf53Smrg
37ec318dbfSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
38ec318dbfSmrg# about features and limitations of the classic Bourne shell that were
39ec318dbfSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
40ec318dbfSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41ec318dbfSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42ec318dbfSmrg# have a pre-POSIX /bin/sh.
43ec318dbfSmrg
44ec318dbfSmrg
45bccedf53Smrgme=`echo "$0" | sed -e 's,.*/,,'`
46bccedf53Smrg
47bccedf53Smrgusage="\
48bccedf53SmrgUsage: $0 [OPTION]
49bccedf53Smrg
50bccedf53SmrgOutput the configuration name of the system \`$me' is run on.
51bccedf53Smrg
5289afc689SmrgOptions:
53bccedf53Smrg  -h, --help         print this help, then exit
54bccedf53Smrg  -t, --time-stamp   print date of last modification, then exit
55bccedf53Smrg  -v, --version      print version number, then exit
56bccedf53Smrg
57bccedf53SmrgReport bugs and patches to <config-patches@gnu.org>."
58bccedf53Smrg
59bccedf53Smrgversion="\
60bccedf53SmrgGNU config.guess ($timestamp)
61bccedf53Smrg
62bccedf53SmrgOriginally written by Per Bothner.
63ec318dbfSmrgCopyright 1992-2021 Free Software Foundation, Inc.
64bccedf53Smrg
65bccedf53SmrgThis is free software; see the source for copying conditions.  There is NO
66bccedf53Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67bccedf53Smrg
68bccedf53Smrghelp="
69bccedf53SmrgTry \`$me --help' for more information."
70bccedf53Smrg
71bccedf53Smrg# Parse command line
72bccedf53Smrgwhile test $# -gt 0 ; do
73bccedf53Smrg  case $1 in
74bccedf53Smrg    --time-stamp | --time* | -t )
757c5f6000Smrg       echo "$timestamp" ; exit ;;
76bccedf53Smrg    --version | -v )
777c5f6000Smrg       echo "$version" ; exit ;;
78bccedf53Smrg    --help | --h* | -h )
797c5f6000Smrg       echo "$usage"; exit ;;
80bccedf53Smrg    -- )     # Stop option processing
81bccedf53Smrg       shift; break ;;
82bccedf53Smrg    - )	# Use stdin as input.
83bccedf53Smrg       break ;;
84bccedf53Smrg    -* )
85bccedf53Smrg       echo "$me: invalid option $1$help" >&2
86bccedf53Smrg       exit 1 ;;
87bccedf53Smrg    * )
88bccedf53Smrg       break ;;
89bccedf53Smrg  esac
90bccedf53Smrgdone
91bccedf53Smrg
92bccedf53Smrgif test $# != 0; then
93bccedf53Smrg  echo "$me: too many arguments$help" >&2
94bccedf53Smrg  exit 1
95bccedf53Smrgfi
96bccedf53Smrg
97ec318dbfSmrg# Just in case it came from the environment.
98ec318dbfSmrgGUESS=
99bccedf53Smrg
100bccedf53Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101bccedf53Smrg# compiler to aid in system detection is discouraged as it requires
102bccedf53Smrg# temporary files to be created and, as you can see below, it is a
103bccedf53Smrg# headache to deal with in a portable fashion.
104bccedf53Smrg
105bccedf53Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106bccedf53Smrg# use `HOST_CC' if defined, but it is deprecated.
107bccedf53Smrg
108bccedf53Smrg# Portable tmp directory creation inspired by the Autoconf team.
109bccedf53Smrg
110ec318dbfSmrgtmp=
111ec318dbfSmrg# shellcheck disable=SC2172
112ec318dbfSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113ec318dbfSmrg
114ec318dbfSmrgset_cc_for_build() {
115ec318dbfSmrg    # prevent multiple calls if $tmp is already set
116ec318dbfSmrg    test "$tmp" && return 0
117ec318dbfSmrg    : "${TMPDIR=/tmp}"
118ec318dbfSmrg    # shellcheck disable=SC2039,SC3028
119ec318dbfSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120ec318dbfSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121ec318dbfSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122ec318dbfSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123ec318dbfSmrg    dummy=$tmp/dummy
124ec318dbfSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125ec318dbfSmrg	,,)    echo "int x;" > "$dummy.c"
126ec318dbfSmrg	       for driver in cc gcc c89 c99 ; do
127ec318dbfSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128ec318dbfSmrg		       CC_FOR_BUILD=$driver
129ec318dbfSmrg		       break
130ec318dbfSmrg		   fi
131ec318dbfSmrg	       done
132ec318dbfSmrg	       if test x"$CC_FOR_BUILD" = x ; then
133ec318dbfSmrg		   CC_FOR_BUILD=no_compiler_found
134ec318dbfSmrg	       fi
135ec318dbfSmrg	       ;;
136ec318dbfSmrg	,,*)   CC_FOR_BUILD=$CC ;;
137ec318dbfSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138ec318dbfSmrg    esac
139ec318dbfSmrg}
140bccedf53Smrg
141bccedf53Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142bccedf53Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143ec318dbfSmrgif test -f /.attbin/uname ; then
144bccedf53Smrg	PATH=$PATH:/.attbin ; export PATH
145bccedf53Smrgfi
146bccedf53Smrg
147bccedf53SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148bccedf53SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149ec318dbfSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150bccedf53SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151bccedf53Smrg
152ec318dbfSmrgcase $UNAME_SYSTEM in
15389afc689SmrgLinux|GNU|GNU/*)
154ec318dbfSmrg	LIBC=unknown
15589afc689Smrg
156ec318dbfSmrg	set_cc_for_build
15789afc689Smrg	cat <<-EOF > "$dummy.c"
15889afc689Smrg	#include <features.h>
15989afc689Smrg	#if defined(__UCLIBC__)
16089afc689Smrg	LIBC=uclibc
16189afc689Smrg	#elif defined(__dietlibc__)
16289afc689Smrg	LIBC=dietlibc
163ec318dbfSmrg	#elif defined(__GLIBC__)
16489afc689Smrg	LIBC=gnu
165ec318dbfSmrg	#else
166ec318dbfSmrg	#include <stdarg.h>
167ec318dbfSmrg	/* First heuristic to detect musl libc.  */
168ec318dbfSmrg	#ifdef __DEFINED_va_list
169ec318dbfSmrg	LIBC=musl
170ec318dbfSmrg	#endif
17189afc689Smrg	#endif
17289afc689Smrg	EOF
173ec318dbfSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174ec318dbfSmrg	eval "$cc_set_libc"
17589afc689Smrg
176ec318dbfSmrg	# Second heuristic to detect musl libc.
177ec318dbfSmrg	if [ "$LIBC" = unknown ] &&
178ec318dbfSmrg	   command -v ldd >/dev/null &&
179ec318dbfSmrg	   ldd --version 2>&1 | grep -q ^musl; then
180ec318dbfSmrg		LIBC=musl
181ec318dbfSmrg	fi
182ec318dbfSmrg
183ec318dbfSmrg	# If the system lacks a compiler, then just pick glibc.
184ec318dbfSmrg	# We could probably try harder.
185ec318dbfSmrg	if [ "$LIBC" = unknown ]; then
186ec318dbfSmrg		LIBC=gnu
18789afc689Smrg	fi
18889afc689Smrg	;;
18989afc689Smrgesac
19089afc689Smrg
191bccedf53Smrg# Note: order is significant - the case branches are not exclusive.
192bccedf53Smrg
193ec318dbfSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194bccedf53Smrg    *:NetBSD:*:*)
195bccedf53Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
19689afc689Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197bccedf53Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198bccedf53Smrg	# switched to ELF, *-*-netbsd* would select the old
199bccedf53Smrg	# object file format.  This provides both forward
200bccedf53Smrg	# compatibility and a consistent mechanism for selecting the
201bccedf53Smrg	# object file format.
202bccedf53Smrg	#
203bccedf53Smrg	# Note: NetBSD doesn't particularly care about the vendor
204bccedf53Smrg	# portion of the name.  We always set it to "unknown".
20589afc689Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206ec318dbfSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207ec318dbfSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20889afc689Smrg	    echo unknown)`
209ec318dbfSmrg	case $UNAME_MACHINE_ARCH in
210ec318dbfSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
211bccedf53Smrg	    armeb) machine=armeb-unknown ;;
212bccedf53Smrg	    arm*) machine=arm-unknown ;;
213bccedf53Smrg	    sh3el) machine=shl-unknown ;;
214bccedf53Smrg	    sh3eb) machine=sh-unknown ;;
2157c5f6000Smrg	    sh5el) machine=sh5le-unknown ;;
21689afc689Smrg	    earmv*)
21789afc689Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
21889afc689Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219ec318dbfSmrg		machine=${arch}${endian}-unknown
22089afc689Smrg		;;
221ec318dbfSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222bccedf53Smrg	esac
223bccedf53Smrg	# The Operating System including object format, if it has switched
22489afc689Smrg	# to ELF recently (or will in the future) and ABI.
225ec318dbfSmrg	case $UNAME_MACHINE_ARCH in
22689afc689Smrg	    earm*)
22789afc689Smrg		os=netbsdelf
22889afc689Smrg		;;
229bccedf53Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230ec318dbfSmrg		set_cc_for_build
231bccedf53Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232f7ada8ddSmrg			| grep -q __ELF__
233bccedf53Smrg		then
234bccedf53Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235bccedf53Smrg		    # Return netbsd for either.  FIX?
236bccedf53Smrg		    os=netbsd
237bccedf53Smrg		else
238bccedf53Smrg		    os=netbsdelf
239bccedf53Smrg		fi
240bccedf53Smrg		;;
241bccedf53Smrg	    *)
2421b1389eeSmrg		os=netbsd
243bccedf53Smrg		;;
244bccedf53Smrg	esac
24589afc689Smrg	# Determine ABI tags.
246ec318dbfSmrg	case $UNAME_MACHINE_ARCH in
24789afc689Smrg	    earm*)
24889afc689Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
24989afc689Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
25089afc689Smrg		;;
25189afc689Smrg	esac
252bccedf53Smrg	# The OS release
253bccedf53Smrg	# Debian GNU/NetBSD machines have a different userland, and
254bccedf53Smrg	# thus, need a distinct triplet. However, they do not need
255bccedf53Smrg	# kernel version information, so it can be replaced with a
256bccedf53Smrg	# suitable tag, in the style of linux-gnu.
257ec318dbfSmrg	case $UNAME_VERSION in
258bccedf53Smrg	    Debian*)
259bccedf53Smrg		release='-gnu'
260bccedf53Smrg		;;
261bccedf53Smrg	    *)
26289afc689Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263bccedf53Smrg		;;
264bccedf53Smrg	esac
265bccedf53Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266bccedf53Smrg	# contains redundant information, the shorter form:
267bccedf53Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268ec318dbfSmrg	GUESS=$machine-${os}${release}${abi-}
269ec318dbfSmrg	;;
27089afc689Smrg    *:Bitrig:*:*)
27189afc689Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272ec318dbfSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273ec318dbfSmrg	;;
274bccedf53Smrg    *:OpenBSD:*:*)
2757c5f6000Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276ec318dbfSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277ec318dbfSmrg	;;
278ec318dbfSmrg    *:SecBSD:*:*)
279ec318dbfSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280ec318dbfSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281ec318dbfSmrg	;;
28289afc689Smrg    *:LibertyBSD:*:*)
28389afc689Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284ec318dbfSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285ec318dbfSmrg	;;
28689afc689Smrg    *:MidnightBSD:*:*)
287ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288ec318dbfSmrg	;;
2897c5f6000Smrg    *:ekkoBSD:*:*)
290ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291ec318dbfSmrg	;;
2927c5f6000Smrg    *:SolidBSD:*:*)
293ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294ec318dbfSmrg	;;
295ec318dbfSmrg    *:OS108:*:*)
296ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297ec318dbfSmrg	;;
2987c5f6000Smrg    macppc:MirBSD:*:*)
299ec318dbfSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300ec318dbfSmrg	;;
3017c5f6000Smrg    *:MirBSD:*:*)
302ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303ec318dbfSmrg	;;
30489afc689Smrg    *:Sortix:*:*)
305ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
306ec318dbfSmrg	;;
307ec318dbfSmrg    *:Twizzler:*:*)
308ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309ec318dbfSmrg	;;
31089afc689Smrg    *:Redox:*:*)
311ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-redox
312ec318dbfSmrg	;;
31389afc689Smrg    mips:OSF1:*.*)
314ec318dbfSmrg	GUESS=mips-dec-osf1
315ec318dbfSmrg	;;
316bccedf53Smrg    alpha:OSF1:*:*)
317ec318dbfSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318ec318dbfSmrg	trap '' 0
3197c5f6000Smrg	case $UNAME_RELEASE in
3207c5f6000Smrg	*4.0)
321bccedf53Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3227c5f6000Smrg		;;
3237c5f6000Smrg	*5.*)
3241b1389eeSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3257c5f6000Smrg		;;
3267c5f6000Smrg	esac
327bccedf53Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328bccedf53Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329bccedf53Smrg	# covers most systems running today.  This code pipes the CPU
330bccedf53Smrg	# types through head -n 1, so we only detect the type of CPU 0.
331bccedf53Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332ec318dbfSmrg	case $ALPHA_CPU_TYPE in
333bccedf53Smrg	    "EV4 (21064)")
33489afc689Smrg		UNAME_MACHINE=alpha ;;
335bccedf53Smrg	    "EV4.5 (21064)")
33689afc689Smrg		UNAME_MACHINE=alpha ;;
337bccedf53Smrg	    "LCA4 (21066/21068)")
33889afc689Smrg		UNAME_MACHINE=alpha ;;
339bccedf53Smrg	    "EV5 (21164)")
34089afc689Smrg		UNAME_MACHINE=alphaev5 ;;
341bccedf53Smrg	    "EV5.6 (21164A)")
34289afc689Smrg		UNAME_MACHINE=alphaev56 ;;
343bccedf53Smrg	    "EV5.6 (21164PC)")
34489afc689Smrg		UNAME_MACHINE=alphapca56 ;;
345bccedf53Smrg	    "EV5.7 (21164PC)")
34689afc689Smrg		UNAME_MACHINE=alphapca57 ;;
347bccedf53Smrg	    "EV6 (21264)")
34889afc689Smrg		UNAME_MACHINE=alphaev6 ;;
349bccedf53Smrg	    "EV6.7 (21264A)")
35089afc689Smrg		UNAME_MACHINE=alphaev67 ;;
351bccedf53Smrg	    "EV6.8CB (21264C)")
35289afc689Smrg		UNAME_MACHINE=alphaev68 ;;
353bccedf53Smrg	    "EV6.8AL (21264B)")
35489afc689Smrg		UNAME_MACHINE=alphaev68 ;;
355bccedf53Smrg	    "EV6.8CX (21264D)")
35689afc689Smrg		UNAME_MACHINE=alphaev68 ;;
357bccedf53Smrg	    "EV6.9A (21264/EV69A)")
35889afc689Smrg		UNAME_MACHINE=alphaev69 ;;
359bccedf53Smrg	    "EV7 (21364)")
36089afc689Smrg		UNAME_MACHINE=alphaev7 ;;
361bccedf53Smrg	    "EV7.9 (21364A)")
36289afc689Smrg		UNAME_MACHINE=alphaev79 ;;
363bccedf53Smrg	esac
3647c5f6000Smrg	# A Pn.n version is a patched version.
365bccedf53Smrg	# A Vn.n version is a released version.
366bccedf53Smrg	# A Tn.n version is a released field test version.
367bccedf53Smrg	# A Xn.n version is an unreleased experimental baselevel.
368bccedf53Smrg	# 1.2 uses "1.2" for uname -r.
369ec318dbfSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370ec318dbfSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371ec318dbfSmrg	;;
372bccedf53Smrg    Amiga*:UNIX_System_V:4.0:*)
373ec318dbfSmrg	GUESS=m68k-unknown-sysv4
374ec318dbfSmrg	;;
375bccedf53Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377ec318dbfSmrg	;;
378bccedf53Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
380ec318dbfSmrg	;;
381bccedf53Smrg    *:OS/390:*:*)
382ec318dbfSmrg	GUESS=i370-ibm-openedition
383ec318dbfSmrg	;;
3847c5f6000Smrg    *:z/VM:*:*)
385ec318dbfSmrg	GUESS=s390-ibm-zvmoe
386ec318dbfSmrg	;;
3877c5f6000Smrg    *:OS400:*:*)
388ec318dbfSmrg	GUESS=powerpc-ibm-os400
389ec318dbfSmrg	;;
390bccedf53Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391ec318dbfSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392ec318dbfSmrg	;;
39389afc689Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394ec318dbfSmrg	GUESS=arm-unknown-riscos
395ec318dbfSmrg	;;
396bccedf53Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397ec318dbfSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
398ec318dbfSmrg	;;
399bccedf53Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400bccedf53Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401ec318dbfSmrg	case `(/bin/universe) 2>/dev/null` in
402ec318dbfSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403ec318dbfSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404ec318dbfSmrg	esac
405ec318dbfSmrg	;;
406bccedf53Smrg    NILE*:*:*:dcosx)
407ec318dbfSmrg	GUESS=pyramid-pyramid-svr4
408ec318dbfSmrg	;;
409bccedf53Smrg    DRS?6000:unix:4.0:6*)
410ec318dbfSmrg	GUESS=sparc-icl-nx6
411ec318dbfSmrg	;;
4127c5f6000Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413bccedf53Smrg	case `/usr/bin/uname -p` in
414ec318dbfSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
415ec318dbfSmrg	esac
416ec318dbfSmrg	;;
4177c5f6000Smrg    s390x:SunOS:*:*)
418ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419ec318dbfSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420ec318dbfSmrg	;;
421bccedf53Smrg    sun4H:SunOS:5.*:*)
422ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423ec318dbfSmrg	GUESS=sparc-hal-solaris2$SUN_REL
424ec318dbfSmrg	;;
425bccedf53Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427ec318dbfSmrg	GUESS=sparc-sun-solaris2$SUN_REL
428ec318dbfSmrg	;;
429f7ada8ddSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430ec318dbfSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431ec318dbfSmrg	;;
4327c5f6000Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433ec318dbfSmrg	set_cc_for_build
43489afc689Smrg	SUN_ARCH=i386
4357c5f6000Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
4367c5f6000Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4377c5f6000Smrg	# This test works for both compilers.
438ec318dbfSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
4397c5f6000Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
44089afc689Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
4417c5f6000Smrg		grep IS_64BIT_ARCH >/dev/null
4427c5f6000Smrg	    then
44389afc689Smrg		SUN_ARCH=x86_64
4447c5f6000Smrg	    fi
4457c5f6000Smrg	fi
446ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447ec318dbfSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448ec318dbfSmrg	;;
449bccedf53Smrg    sun4*:SunOS:6*:*)
450bccedf53Smrg	# According to config.sub, this is the proper way to canonicalize
451bccedf53Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452bccedf53Smrg	# it's likely to be more like Solaris than SunOS4.
453ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454ec318dbfSmrg	GUESS=sparc-sun-solaris3$SUN_REL
455ec318dbfSmrg	;;
456bccedf53Smrg    sun4*:SunOS:*:*)
457ec318dbfSmrg	case `/usr/bin/arch -k` in
458bccedf53Smrg	    Series*|S4*)
459bccedf53Smrg		UNAME_RELEASE=`uname -v`
460bccedf53Smrg		;;
461bccedf53Smrg	esac
462bccedf53Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464ec318dbfSmrg	GUESS=sparc-sun-sunos$SUN_REL
465ec318dbfSmrg	;;
466bccedf53Smrg    sun3*:SunOS:*:*)
467ec318dbfSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468ec318dbfSmrg	;;
469bccedf53Smrg    sun*:*:4.2BSD:*)
470bccedf53Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
47189afc689Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472ec318dbfSmrg	case `/bin/arch` in
473bccedf53Smrg	    sun3)
474ec318dbfSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475bccedf53Smrg		;;
476bccedf53Smrg	    sun4)
477ec318dbfSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478bccedf53Smrg		;;
479bccedf53Smrg	esac
480ec318dbfSmrg	;;
481bccedf53Smrg    aushp:SunOS:*:*)
482ec318dbfSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483ec318dbfSmrg	;;
484bccedf53Smrg    # The situation for MiNT is a little confusing.  The machine name
485bccedf53Smrg    # can be virtually everything (everything which is not
486bccedf53Smrg    # "atarist" or "atariste" at least should have a processor
487bccedf53Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488bccedf53Smrg    # to the lowercase version "mint" (or "freemint").  Finally
489bccedf53Smrg    # the system name "TOS" denotes a system which is actually not
490bccedf53Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491bccedf53Smrg    # be no problem.
492bccedf53Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493ec318dbfSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494ec318dbfSmrg	;;
495bccedf53Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496ec318dbfSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497ec318dbfSmrg	;;
498bccedf53Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499ec318dbfSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500ec318dbfSmrg	;;
501bccedf53Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502ec318dbfSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503ec318dbfSmrg	;;
504bccedf53Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505ec318dbfSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506ec318dbfSmrg	;;
507bccedf53Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508ec318dbfSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509ec318dbfSmrg	;;
5107c5f6000Smrg    m68k:machten:*:*)
511ec318dbfSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512ec318dbfSmrg	;;
513bccedf53Smrg    powerpc:machten:*:*)
514ec318dbfSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515ec318dbfSmrg	;;
516bccedf53Smrg    RISC*:Mach:*:*)
517ec318dbfSmrg	GUESS=mips-dec-mach_bsd4.3
518ec318dbfSmrg	;;
519bccedf53Smrg    RISC*:ULTRIX:*:*)
520ec318dbfSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521ec318dbfSmrg	;;
522bccedf53Smrg    VAX*:ULTRIX*:*:*)
523ec318dbfSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524ec318dbfSmrg	;;
525bccedf53Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526ec318dbfSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527ec318dbfSmrg	;;
528bccedf53Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529ec318dbfSmrg	set_cc_for_build
53089afc689Smrg	sed 's/^	//' << EOF > "$dummy.c"
531bccedf53Smrg#ifdef __cplusplus
532bccedf53Smrg#include <stdio.h>  /* for printf() prototype */
533bccedf53Smrg	int main (int argc, char *argv[]) {
534bccedf53Smrg#else
535bccedf53Smrg	int main (argc, argv) int argc; char *argv[]; {
536bccedf53Smrg#endif
537bccedf53Smrg	#if defined (host_mips) && defined (MIPSEB)
538bccedf53Smrg	#if defined (SYSTYPE_SYSV)
53989afc689Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540bccedf53Smrg	#endif
541bccedf53Smrg	#if defined (SYSTYPE_SVR4)
54289afc689Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543bccedf53Smrg	#endif
544bccedf53Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
54589afc689Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546bccedf53Smrg	#endif
547bccedf53Smrg	#endif
548bccedf53Smrg	  exit (-1);
549bccedf53Smrg	}
550bccedf53SmrgEOF
55189afc689Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
55289afc689Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
55389afc689Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5547c5f6000Smrg	    { echo "$SYSTEM_NAME"; exit; }
555ec318dbfSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556ec318dbfSmrg	;;
557bccedf53Smrg    Motorola:PowerMAX_OS:*:*)
558ec318dbfSmrg	GUESS=powerpc-motorola-powermax
559ec318dbfSmrg	;;
560bccedf53Smrg    Motorola:*:4.3:PL8-*)
561ec318dbfSmrg	GUESS=powerpc-harris-powermax
562ec318dbfSmrg	;;
563bccedf53Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564ec318dbfSmrg	GUESS=powerpc-harris-powermax
565ec318dbfSmrg	;;
566bccedf53Smrg    Night_Hawk:Power_UNIX:*:*)
567ec318dbfSmrg	GUESS=powerpc-harris-powerunix
568ec318dbfSmrg	;;
569bccedf53Smrg    m88k:CX/UX:7*:*)
570ec318dbfSmrg	GUESS=m88k-harris-cxux7
571ec318dbfSmrg	;;
572bccedf53Smrg    m88k:*:4*:R4*)
573ec318dbfSmrg	GUESS=m88k-motorola-sysv4
574ec318dbfSmrg	;;
575bccedf53Smrg    m88k:*:3*:R3*)
576ec318dbfSmrg	GUESS=m88k-motorola-sysv3
577ec318dbfSmrg	;;
578bccedf53Smrg    AViiON:dgux:*:*)
5791b1389eeSmrg	# DG/UX returns AViiON for all architectures
5801b1389eeSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581ec318dbfSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582bccedf53Smrg	then
583ec318dbfSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584ec318dbfSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
585bccedf53Smrg	    then
586ec318dbfSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587bccedf53Smrg	    else
588ec318dbfSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589bccedf53Smrg	    fi
590bccedf53Smrg	else
591ec318dbfSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592bccedf53Smrg	fi
593ec318dbfSmrg	;;
594bccedf53Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595ec318dbfSmrg	GUESS=m88k-dolphin-sysv3
596ec318dbfSmrg	;;
597bccedf53Smrg    M88*:*:R3*:*)
598bccedf53Smrg	# Delta 88k system running SVR3
599ec318dbfSmrg	GUESS=m88k-motorola-sysv3
600ec318dbfSmrg	;;
601bccedf53Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602ec318dbfSmrg	GUESS=m88k-tektronix-sysv3
603ec318dbfSmrg	;;
604bccedf53Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605ec318dbfSmrg	GUESS=m68k-tektronix-bsd
606ec318dbfSmrg	;;
607bccedf53Smrg    *:IRIX*:*:*)
608ec318dbfSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609ec318dbfSmrg	GUESS=mips-sgi-irix$IRIX_REL
610ec318dbfSmrg	;;
611bccedf53Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612ec318dbfSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613ec318dbfSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614bccedf53Smrg    i*86:AIX:*:*)
615ec318dbfSmrg	GUESS=i386-ibm-aix
616ec318dbfSmrg	;;
617bccedf53Smrg    ia64:AIX:*:*)
618ec318dbfSmrg	if test -x /usr/bin/oslevel ; then
619bccedf53Smrg		IBM_REV=`/usr/bin/oslevel`
620bccedf53Smrg	else
621ec318dbfSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622bccedf53Smrg	fi
623ec318dbfSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624ec318dbfSmrg	;;
625bccedf53Smrg    *:AIX:2:3)
626bccedf53Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627ec318dbfSmrg		set_cc_for_build
62889afc689Smrg		sed 's/^		//' << EOF > "$dummy.c"
629bccedf53Smrg		#include <sys/systemcfg.h>
630bccedf53Smrg
631bccedf53Smrg		main()
632bccedf53Smrg			{
633bccedf53Smrg			if (!__power_pc())
634bccedf53Smrg				exit(1);
635bccedf53Smrg			puts("powerpc-ibm-aix3.2.5");
636bccedf53Smrg			exit(0);
637bccedf53Smrg			}
638bccedf53SmrgEOF
63989afc689Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6407c5f6000Smrg		then
641ec318dbfSmrg			GUESS=$SYSTEM_NAME
6427c5f6000Smrg		else
643ec318dbfSmrg			GUESS=rs6000-ibm-aix3.2.5
6447c5f6000Smrg		fi
645bccedf53Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646ec318dbfSmrg		GUESS=rs6000-ibm-aix3.2.4
647bccedf53Smrg	else
648ec318dbfSmrg		GUESS=rs6000-ibm-aix3.2
649bccedf53Smrg	fi
650ec318dbfSmrg	;;
651f7ada8ddSmrg    *:AIX:*:[4567])
652bccedf53Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
65389afc689Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654bccedf53Smrg		IBM_ARCH=rs6000
655bccedf53Smrg	else
656bccedf53Smrg		IBM_ARCH=powerpc
657bccedf53Smrg	fi
658ec318dbfSmrg	if test -x /usr/bin/lslpp ; then
659ec318dbfSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
66089afc689Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661bccedf53Smrg	else
662ec318dbfSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663bccedf53Smrg	fi
664ec318dbfSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665ec318dbfSmrg	;;
666bccedf53Smrg    *:AIX:*:*)
667ec318dbfSmrg	GUESS=rs6000-ibm-aix
668ec318dbfSmrg	;;
66989afc689Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670ec318dbfSmrg	GUESS=romp-ibm-bsd4.4
671ec318dbfSmrg	;;
672bccedf53Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673ec318dbfSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674ec318dbfSmrg	;;                                  # report: romp-ibm BSD 4.3
675bccedf53Smrg    *:BOSX:*:*)
676ec318dbfSmrg	GUESS=rs6000-bull-bosx
677ec318dbfSmrg	;;
678bccedf53Smrg    DPX/2?00:B.O.S.:*:*)
679ec318dbfSmrg	GUESS=m68k-bull-sysv3
680ec318dbfSmrg	;;
681bccedf53Smrg    9000/[34]??:4.3bsd:1.*:*)
682ec318dbfSmrg	GUESS=m68k-hp-bsd
683ec318dbfSmrg	;;
684bccedf53Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685ec318dbfSmrg	GUESS=m68k-hp-bsd4.4
686ec318dbfSmrg	;;
687bccedf53Smrg    9000/[34678]??:HP-UX:*:*)
688ec318dbfSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689ec318dbfSmrg	case $UNAME_MACHINE in
69089afc689Smrg	    9000/31?)            HP_ARCH=m68000 ;;
69189afc689Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
692bccedf53Smrg	    9000/[678][0-9][0-9])
693ec318dbfSmrg		if test -x /usr/bin/getconf; then
694bccedf53Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6951b1389eeSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696ec318dbfSmrg		    case $sc_cpu_version in
69789afc689Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
69889afc689Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6991b1389eeSmrg		      532)                      # CPU_PA_RISC2_0
700ec318dbfSmrg			case $sc_kernel_bits in
70189afc689Smrg			  32) HP_ARCH=hppa2.0n ;;
70289afc689Smrg			  64) HP_ARCH=hppa2.0w ;;
70389afc689Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7041b1389eeSmrg			esac ;;
7051b1389eeSmrg		    esac
706bccedf53Smrg		fi
707ec318dbfSmrg		if test "$HP_ARCH" = ""; then
708ec318dbfSmrg		    set_cc_for_build
70989afc689Smrg		    sed 's/^		//' << EOF > "$dummy.c"
710bccedf53Smrg
7111b1389eeSmrg		#define _HPUX_SOURCE
7121b1389eeSmrg		#include <stdlib.h>
7131b1389eeSmrg		#include <unistd.h>
714bccedf53Smrg
7151b1389eeSmrg		int main ()
7161b1389eeSmrg		{
7171b1389eeSmrg		#if defined(_SC_KERNEL_BITS)
7181b1389eeSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
7191b1389eeSmrg		#endif
7201b1389eeSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721bccedf53Smrg
7221b1389eeSmrg		    switch (cpu)
7231b1389eeSmrg			{
7241b1389eeSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7251b1389eeSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7261b1389eeSmrg			case CPU_PA_RISC2_0:
7271b1389eeSmrg		#if defined(_SC_KERNEL_BITS)
7281b1389eeSmrg			    switch (bits)
7291b1389eeSmrg				{
7301b1389eeSmrg				case 64: puts ("hppa2.0w"); break;
7311b1389eeSmrg				case 32: puts ("hppa2.0n"); break;
7321b1389eeSmrg				default: puts ("hppa2.0"); break;
7331b1389eeSmrg				} break;
7341b1389eeSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
7351b1389eeSmrg			    puts ("hppa2.0"); break;
7361b1389eeSmrg		#endif
7371b1389eeSmrg			default: puts ("hppa1.0"); break;
7381b1389eeSmrg			}
7391b1389eeSmrg		    exit (0);
7401b1389eeSmrg		}
741bccedf53SmrgEOF
74289afc689Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743bccedf53Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744bccedf53Smrg		fi ;;
745bccedf53Smrg	esac
746ec318dbfSmrg	if test "$HP_ARCH" = hppa2.0w
747bccedf53Smrg	then
748ec318dbfSmrg	    set_cc_for_build
7497c5f6000Smrg
7507c5f6000Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7517c5f6000Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7527c5f6000Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7537c5f6000Smrg	    #
7547c5f6000Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
7557c5f6000Smrg	    # => hppa2.0w-hp-hpux11.23
7567c5f6000Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7577c5f6000Smrg	    # => hppa64-hp-hpux11.23
7587c5f6000Smrg
75989afc689Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760f7ada8ddSmrg		grep -q __LP64__
761bccedf53Smrg	    then
76289afc689Smrg		HP_ARCH=hppa2.0w
763bccedf53Smrg	    else
76489afc689Smrg		HP_ARCH=hppa64
765bccedf53Smrg	    fi
766bccedf53Smrg	fi
767ec318dbfSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768ec318dbfSmrg	;;
769bccedf53Smrg    ia64:HP-UX:*:*)
770ec318dbfSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771ec318dbfSmrg	GUESS=ia64-hp-hpux$HPUX_REV
772ec318dbfSmrg	;;
773bccedf53Smrg    3050*:HI-UX:*:*)
774ec318dbfSmrg	set_cc_for_build
77589afc689Smrg	sed 's/^	//' << EOF > "$dummy.c"
776bccedf53Smrg	#include <unistd.h>
777bccedf53Smrg	int
778bccedf53Smrg	main ()
779bccedf53Smrg	{
780bccedf53Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
781bccedf53Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782bccedf53Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783bccedf53Smrg	     results, however.  */
784bccedf53Smrg	  if (CPU_IS_PA_RISC (cpu))
785bccedf53Smrg	    {
786bccedf53Smrg	      switch (cpu)
787bccedf53Smrg		{
788bccedf53Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789bccedf53Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790bccedf53Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791bccedf53Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792bccedf53Smrg		}
793bccedf53Smrg	    }
794bccedf53Smrg	  else if (CPU_IS_HP_MC68K (cpu))
795bccedf53Smrg	    puts ("m68k-hitachi-hiuxwe2");
796bccedf53Smrg	  else puts ("unknown-hitachi-hiuxwe2");
797bccedf53Smrg	  exit (0);
798bccedf53Smrg	}
799bccedf53SmrgEOF
80089afc689Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8017c5f6000Smrg		{ echo "$SYSTEM_NAME"; exit; }
802ec318dbfSmrg	GUESS=unknown-hitachi-hiuxwe2
803ec318dbfSmrg	;;
80489afc689Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805ec318dbfSmrg	GUESS=hppa1.1-hp-bsd
806ec318dbfSmrg	;;
807bccedf53Smrg    9000/8??:4.3bsd:*:*)
808ec318dbfSmrg	GUESS=hppa1.0-hp-bsd
809ec318dbfSmrg	;;
810bccedf53Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811ec318dbfSmrg	GUESS=hppa1.0-hp-mpeix
812ec318dbfSmrg	;;
81389afc689Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814ec318dbfSmrg	GUESS=hppa1.1-hp-osf
815ec318dbfSmrg	;;
816bccedf53Smrg    hp8??:OSF1:*:*)
817ec318dbfSmrg	GUESS=hppa1.0-hp-osf
818ec318dbfSmrg	;;
819bccedf53Smrg    i*86:OSF1:*:*)
820ec318dbfSmrg	if test -x /usr/sbin/sysversion ; then
821ec318dbfSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822bccedf53Smrg	else
823ec318dbfSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824bccedf53Smrg	fi
825ec318dbfSmrg	;;
826bccedf53Smrg    parisc*:Lites*:*:*)
827ec318dbfSmrg	GUESS=hppa1.1-hp-lites
828ec318dbfSmrg	;;
829bccedf53Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830ec318dbfSmrg	GUESS=c1-convex-bsd
831ec318dbfSmrg	;;
832bccedf53Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833bccedf53Smrg	if getsysinfo -f scalar_acc
834bccedf53Smrg	then echo c32-convex-bsd
835bccedf53Smrg	else echo c2-convex-bsd
836bccedf53Smrg	fi
8371b1389eeSmrg	exit ;;
838bccedf53Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839ec318dbfSmrg	GUESS=c34-convex-bsd
840ec318dbfSmrg	;;
841bccedf53Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842ec318dbfSmrg	GUESS=c38-convex-bsd
843ec318dbfSmrg	;;
844bccedf53Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845ec318dbfSmrg	GUESS=c4-convex-bsd
846ec318dbfSmrg	;;
847bccedf53Smrg    CRAY*Y-MP:*:*:*)
848ec318dbfSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849ec318dbfSmrg	GUESS=ymp-cray-unicos$CRAY_REL
850ec318dbfSmrg	;;
851bccedf53Smrg    CRAY*[A-Z]90:*:*:*)
85289afc689Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853bccedf53Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854bccedf53Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855bccedf53Smrg	      -e 's/\.[^.]*$/.X/'
8567c5f6000Smrg	exit ;;
857bccedf53Smrg    CRAY*TS:*:*:*)
858ec318dbfSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859ec318dbfSmrg	GUESS=t90-cray-unicos$CRAY_REL
860ec318dbfSmrg	;;
861bccedf53Smrg    CRAY*T3E:*:*:*)
862ec318dbfSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863ec318dbfSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864ec318dbfSmrg	;;
865bccedf53Smrg    CRAY*SV1:*:*:*)
866ec318dbfSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867ec318dbfSmrg	GUESS=sv1-cray-unicos$CRAY_REL
868ec318dbfSmrg	;;
869bccedf53Smrg    *:UNICOS/mp:*:*)
870ec318dbfSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871ec318dbfSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872ec318dbfSmrg	;;
873bccedf53Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
87489afc689Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
87589afc689Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
87689afc689Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877ec318dbfSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878ec318dbfSmrg	;;
8797c5f6000Smrg    5000:UNIX_System_V:4.*:*)
88089afc689Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
88189afc689Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882ec318dbfSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883ec318dbfSmrg	;;
884bccedf53Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886ec318dbfSmrg	;;
887bccedf53Smrg    sparc*:BSD/OS:*:*)
888ec318dbfSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889ec318dbfSmrg	;;
890bccedf53Smrg    *:BSD/OS:*:*)
891ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892ec318dbfSmrg	;;
893ec318dbfSmrg    arm:FreeBSD:*:*)
894ec318dbfSmrg	UNAME_PROCESSOR=`uname -p`
895ec318dbfSmrg	set_cc_for_build
896ec318dbfSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897ec318dbfSmrg	    | grep -q __ARM_PCS_VFP
898ec318dbfSmrg	then
899ec318dbfSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900ec318dbfSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901ec318dbfSmrg	else
902ec318dbfSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903ec318dbfSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904ec318dbfSmrg	fi
905ec318dbfSmrg	;;
9067c5f6000Smrg    *:FreeBSD:*:*)
9071b1389eeSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908ec318dbfSmrg	case $UNAME_PROCESSOR in
9097c5f6000Smrg	    amd64)
91089afc689Smrg		UNAME_PROCESSOR=x86_64 ;;
91189afc689Smrg	    i386)
91289afc689Smrg		UNAME_PROCESSOR=i586 ;;
9137c5f6000Smrg	esac
914ec318dbfSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915ec318dbfSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916ec318dbfSmrg	;;
917bccedf53Smrg    i*:CYGWIN*:*)
918ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
919ec318dbfSmrg	;;
92089afc689Smrg    *:MINGW64*:*)
921ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
922ec318dbfSmrg	;;
92389afc689Smrg    *:MINGW*:*)
924ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
925ec318dbfSmrg	;;
92689afc689Smrg    *:MSYS*:*)
927ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-msys
928ec318dbfSmrg	;;
929bccedf53Smrg    i*:PW*:*)
930ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-pw32
931ec318dbfSmrg	;;
932f7ada8ddSmrg    *:Interix*:*)
933ec318dbfSmrg	case $UNAME_MACHINE in
9347c5f6000Smrg	    x86)
935ec318dbfSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
936ec318dbfSmrg		;;
937f7ada8ddSmrg	    authenticamd | genuineintel | EM64T)
938ec318dbfSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
939ec318dbfSmrg		;;
9407c5f6000Smrg	    IA64)
941ec318dbfSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
942ec318dbfSmrg		;;
9437c5f6000Smrg	esac ;;
944bccedf53Smrg    i*:UWIN*:*)
945ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-uwin
946ec318dbfSmrg	;;
9477c5f6000Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948ec318dbfSmrg	GUESS=x86_64-pc-cygwin
949ec318dbfSmrg	;;
950bccedf53Smrg    prep*:SunOS:5.*:*)
951ec318dbfSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952ec318dbfSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
953ec318dbfSmrg	;;
954bccedf53Smrg    *:GNU:*:*)
9557c5f6000Smrg	# the GNU system
956ec318dbfSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957ec318dbfSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958ec318dbfSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959ec318dbfSmrg	;;
9607c5f6000Smrg    *:GNU/*:*:*)
9617c5f6000Smrg	# other systems with GNU libc and userland
962ec318dbfSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963ec318dbfSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965ec318dbfSmrg	;;
966ec318dbfSmrg    *:Minix:*:*)
967ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-minix
968ec318dbfSmrg	;;
96989afc689Smrg    aarch64:Linux:*:*)
970ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971ec318dbfSmrg	;;
97289afc689Smrg    aarch64_be:Linux:*:*)
97389afc689Smrg	UNAME_MACHINE=aarch64_be
974ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975ec318dbfSmrg	;;
976f7ada8ddSmrg    alpha:Linux:*:*)
977ec318dbfSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978f7ada8ddSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979f7ada8ddSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980f7ada8ddSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981f7ada8ddSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982f7ada8ddSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983f7ada8ddSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984f7ada8ddSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9851b1389eeSmrg	esac
986f7ada8ddSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
98789afc689Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989ec318dbfSmrg	;;
990ec318dbfSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992ec318dbfSmrg	;;
993bccedf53Smrg    arm*:Linux:*:*)
994ec318dbfSmrg	set_cc_for_build
9957c5f6000Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9967c5f6000Smrg	    | grep -q __ARM_EABI__
9977c5f6000Smrg	then
998ec318dbfSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
9997c5f6000Smrg	else
10001b1389eeSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10011b1389eeSmrg		| grep -q __ARM_PCS_VFP
10021b1389eeSmrg	    then
1003ec318dbfSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10041b1389eeSmrg	    else
1005ec318dbfSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10061b1389eeSmrg	    fi
10077c5f6000Smrg	fi
1008ec318dbfSmrg	;;
10097c5f6000Smrg    avr32*:Linux:*:*)
1010ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011ec318dbfSmrg	;;
1012bccedf53Smrg    cris:Linux:*:*)
1013ec318dbfSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014ec318dbfSmrg	;;
10157c5f6000Smrg    crisv32:Linux:*:*)
1016ec318dbfSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017ec318dbfSmrg	;;
101889afc689Smrg    e2k:Linux:*:*)
1019ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020ec318dbfSmrg	;;
10217c5f6000Smrg    frv:Linux:*:*)
1022ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023ec318dbfSmrg	;;
10241b1389eeSmrg    hexagon:Linux:*:*)
1025ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026ec318dbfSmrg	;;
1027f7ada8ddSmrg    i*86:Linux:*:*)
1028ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029ec318dbfSmrg	;;
1030bccedf53Smrg    ia64:Linux:*:*)
1031ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032ec318dbfSmrg	;;
103389afc689Smrg    k1om:Linux:*:*)
1034ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035ec318dbfSmrg	;;
1036ec318dbfSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038ec318dbfSmrg	;;
10397c5f6000Smrg    m32r*:Linux:*:*)
1040ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041ec318dbfSmrg	;;
1042bccedf53Smrg    m68*:Linux:*:*)
1043ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044ec318dbfSmrg	;;
1045f7ada8ddSmrg    mips:Linux:*:* | mips64:Linux:*:*)
1046ec318dbfSmrg	set_cc_for_build
1047ec318dbfSmrg	IS_GLIBC=0
1048ec318dbfSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
104989afc689Smrg	sed 's/^	//' << EOF > "$dummy.c"
1050bccedf53Smrg	#undef CPU
1051ec318dbfSmrg	#undef mips
1052ec318dbfSmrg	#undef mipsel
1053ec318dbfSmrg	#undef mips64
1054ec318dbfSmrg	#undef mips64el
1055ec318dbfSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1056ec318dbfSmrg	LIBCABI=gnuabi64
1057ec318dbfSmrg	#else
1058ec318dbfSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1059ec318dbfSmrg	LIBCABI=gnuabin32
1060ec318dbfSmrg	#else
1061ec318dbfSmrg	LIBCABI=${LIBC}
1062ec318dbfSmrg	#endif
1063ec318dbfSmrg	#endif
1064ec318dbfSmrg
1065ec318dbfSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1066ec318dbfSmrg	CPU=mipsisa64r6
1067ec318dbfSmrg	#else
1068ec318dbfSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069ec318dbfSmrg	CPU=mipsisa32r6
1070ec318dbfSmrg	#else
1071ec318dbfSmrg	#if defined(__mips64)
1072ec318dbfSmrg	CPU=mips64
1073ec318dbfSmrg	#else
1074ec318dbfSmrg	CPU=mips
1075ec318dbfSmrg	#endif
1076ec318dbfSmrg	#endif
1077ec318dbfSmrg	#endif
1078ec318dbfSmrg
1079bccedf53Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1080ec318dbfSmrg	MIPS_ENDIAN=el
1081bccedf53Smrg	#else
1082bccedf53Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1083ec318dbfSmrg	MIPS_ENDIAN=
1084bccedf53Smrg	#else
1085ec318dbfSmrg	MIPS_ENDIAN=
1086bccedf53Smrg	#endif
1087bccedf53Smrg	#endif
1088bccedf53SmrgEOF
1089ec318dbfSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090ec318dbfSmrg	eval "$cc_set_vars"
1091ec318dbfSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092bccedf53Smrg	;;
109389afc689Smrg    mips64el:Linux:*:*)
1094ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1095ec318dbfSmrg	;;
109689afc689Smrg    openrisc*:Linux:*:*)
1097ec318dbfSmrg	GUESS=or1k-unknown-linux-$LIBC
1098ec318dbfSmrg	;;
109989afc689Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1100ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1101ec318dbfSmrg	;;
11027c5f6000Smrg    padre:Linux:*:*)
1103ec318dbfSmrg	GUESS=sparc-unknown-linux-$LIBC
1104ec318dbfSmrg	;;
1105f7ada8ddSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106ec318dbfSmrg	GUESS=hppa64-unknown-linux-$LIBC
1107ec318dbfSmrg	;;
1108bccedf53Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
1109bccedf53Smrg	# Look for CPU level
1110bccedf53Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111ec318dbfSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112ec318dbfSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113ec318dbfSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1114bccedf53Smrg	esac
1115ec318dbfSmrg	;;
1116f7ada8ddSmrg    ppc64:Linux:*:*)
1117ec318dbfSmrg	GUESS=powerpc64-unknown-linux-$LIBC
1118ec318dbfSmrg	;;
1119f7ada8ddSmrg    ppc:Linux:*:*)
1120ec318dbfSmrg	GUESS=powerpc-unknown-linux-$LIBC
1121ec318dbfSmrg	;;
112289afc689Smrg    ppc64le:Linux:*:*)
1123ec318dbfSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
1124ec318dbfSmrg	;;
112589afc689Smrg    ppcle:Linux:*:*)
1126ec318dbfSmrg	GUESS=powerpcle-unknown-linux-$LIBC
1127ec318dbfSmrg	;;
1128ec318dbfSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130ec318dbfSmrg	;;
1131bccedf53Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1132ec318dbfSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133ec318dbfSmrg	;;
1134bccedf53Smrg    sh64*:Linux:*:*)
1135ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136ec318dbfSmrg	;;
1137bccedf53Smrg    sh*:Linux:*:*)
1138ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139ec318dbfSmrg	;;
1140bccedf53Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1141ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142ec318dbfSmrg	;;
1143f7ada8ddSmrg    tile*:Linux:*:*)
1144ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145ec318dbfSmrg	;;
11467c5f6000Smrg    vax:Linux:*:*)
1147ec318dbfSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148ec318dbfSmrg	;;
1149bccedf53Smrg    x86_64:Linux:*:*)
1150ec318dbfSmrg	set_cc_for_build
1151ec318dbfSmrg	LIBCABI=$LIBC
1152ec318dbfSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1153ec318dbfSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1154ec318dbfSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1155ec318dbfSmrg		grep IS_X32 >/dev/null
1156ec318dbfSmrg	    then
1157ec318dbfSmrg		LIBCABI=${LIBC}x32
1158ec318dbfSmrg	    fi
1159ec318dbfSmrg	fi
1160ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161ec318dbfSmrg	;;
11627c5f6000Smrg    xtensa*:Linux:*:*)
1163ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164ec318dbfSmrg	;;
1165bccedf53Smrg    i*86:DYNIX/ptx:4*:*)
1166bccedf53Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1167bccedf53Smrg	# earlier versions are messed up and put the nodename in both
1168bccedf53Smrg	# sysname and nodename.
1169ec318dbfSmrg	GUESS=i386-sequent-sysv4
1170ec318dbfSmrg	;;
1171bccedf53Smrg    i*86:UNIX_SV:4.2MP:2.*)
11721b1389eeSmrg	# Unixware is an offshoot of SVR4, but it has its own version
11731b1389eeSmrg	# number series starting with 2...
11741b1389eeSmrg	# I am not positive that other SVR4 systems won't match this,
1175bccedf53Smrg	# I just have to hope.  -- rms.
11761b1389eeSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1177ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178ec318dbfSmrg	;;
1179bccedf53Smrg    i*86:OS/2:*:*)
1180bccedf53Smrg	# If we were able to find `uname', then EMX Unix compatibility
1181bccedf53Smrg	# is probably installed.
1182ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1183ec318dbfSmrg	;;
1184bccedf53Smrg    i*86:XTS-300:*:STOP)
1185ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-stop
1186ec318dbfSmrg	;;
1187bccedf53Smrg    i*86:atheos:*:*)
1188ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
1189ec318dbfSmrg	;;
11907c5f6000Smrg    i*86:syllable:*:*)
1191ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-syllable
1192ec318dbfSmrg	;;
1193f7ada8ddSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194ec318dbfSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195ec318dbfSmrg	;;
1196bccedf53Smrg    i*86:*DOS:*:*)
1197ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198ec318dbfSmrg	;;
119989afc689Smrg    i*86:*:4.*:*)
120089afc689Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1201bccedf53Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202ec318dbfSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1203bccedf53Smrg	else
1204ec318dbfSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1205bccedf53Smrg	fi
1206ec318dbfSmrg	;;
12077c5f6000Smrg    i*86:*:5:[678]*)
12081b1389eeSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1209bccedf53Smrg	case `/bin/uname -X | grep "^Machine"` in
1210bccedf53Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1211bccedf53Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1212bccedf53Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1213bccedf53Smrg	esac
1214ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215ec318dbfSmrg	;;
1216bccedf53Smrg    i*86:*:3.2:*)
1217bccedf53Smrg	if test -f /usr/options/cb.name; then
1218bccedf53Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219ec318dbfSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1220bccedf53Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1221bccedf53Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1222bccedf53Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1223bccedf53Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1224bccedf53Smrg			&& UNAME_MACHINE=i586
1225bccedf53Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1226bccedf53Smrg			&& UNAME_MACHINE=i686
1227bccedf53Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1228bccedf53Smrg			&& UNAME_MACHINE=i686
1229ec318dbfSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1230bccedf53Smrg	else
1231ec318dbfSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
1232bccedf53Smrg	fi
1233ec318dbfSmrg	;;
1234bccedf53Smrg    pc:*:*:*)
1235bccedf53Smrg	# Left here for compatibility:
12361b1389eeSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12371b1389eeSmrg	# the processor, so we play safe by assuming i586.
12387c5f6000Smrg	# Note: whatever this is, it MUST be the same as what config.sub
123989afc689Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
12407c5f6000Smrg	# this is a cross-build.
1241ec318dbfSmrg	GUESS=i586-pc-msdosdjgpp
1242ec318dbfSmrg	;;
1243bccedf53Smrg    Intel:Mach:3*:*)
1244ec318dbfSmrg	GUESS=i386-pc-mach3
1245ec318dbfSmrg	;;
1246bccedf53Smrg    paragon:*:*:*)
1247ec318dbfSmrg	GUESS=i860-intel-osf1
1248ec318dbfSmrg	;;
1249bccedf53Smrg    i860:*:4.*:*) # i860-SVR4
1250bccedf53Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251ec318dbfSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1252bccedf53Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1253ec318dbfSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1254bccedf53Smrg	fi
1255ec318dbfSmrg	;;
1256bccedf53Smrg    mini*:CTIX:SYS*5:*)
1257bccedf53Smrg	# "miniframe"
1258ec318dbfSmrg	GUESS=m68010-convergent-sysv
1259ec318dbfSmrg	;;
1260bccedf53Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1261ec318dbfSmrg	GUESS=m68k-convergent-sysv
1262ec318dbfSmrg	;;
1263bccedf53Smrg    M680?0:D-NIX:5.3:*)
1264ec318dbfSmrg	GUESS=m68k-diab-dnix
1265ec318dbfSmrg	;;
12667c5f6000Smrg    M68*:*:R3V[5678]*:*)
12677c5f6000Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12687c5f6000Smrg    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)
1269bccedf53Smrg	OS_REL=''
1270bccedf53Smrg	test -r /etc/.relid \
1271bccedf53Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1272bccedf53Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
127389afc689Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1274bccedf53Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
127589afc689Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1276bccedf53Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12771b1389eeSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12781b1389eeSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
12797c5f6000Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
12807c5f6000Smrg	OS_REL='.3'
12817c5f6000Smrg	test -r /etc/.relid \
12827c5f6000Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12837c5f6000Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
128489afc689Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12857c5f6000Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
128689afc689Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
12877c5f6000Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
128889afc689Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1289bccedf53Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290ec318dbfSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291ec318dbfSmrg	;;
1292bccedf53Smrg    mc68030:UNIX_System_V:4.*:*)
1293ec318dbfSmrg	GUESS=m68k-atari-sysv4
1294ec318dbfSmrg	;;
1295bccedf53Smrg    TSUNAMI:LynxOS:2.*:*)
1296ec318dbfSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297ec318dbfSmrg	;;
1298bccedf53Smrg    rs6000:LynxOS:2.*:*)
1299ec318dbfSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300ec318dbfSmrg	;;
1301f7ada8ddSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302ec318dbfSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303ec318dbfSmrg	;;
1304bccedf53Smrg    SM[BE]S:UNIX_SV:*:*)
1305ec318dbfSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1306ec318dbfSmrg	;;
1307bccedf53Smrg    RM*:ReliantUNIX-*:*:*)
1308ec318dbfSmrg	GUESS=mips-sni-sysv4
1309ec318dbfSmrg	;;
1310bccedf53Smrg    RM*:SINIX-*:*:*)
1311ec318dbfSmrg	GUESS=mips-sni-sysv4
1312ec318dbfSmrg	;;
1313bccedf53Smrg    *:SINIX-*:*:*)
1314bccedf53Smrg	if uname -p 2>/dev/null >/dev/null ; then
1315bccedf53Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316ec318dbfSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
1317bccedf53Smrg	else
1318ec318dbfSmrg		GUESS=ns32k-sni-sysv
1319bccedf53Smrg	fi
1320ec318dbfSmrg	;;
13211b1389eeSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13221b1389eeSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1323ec318dbfSmrg	GUESS=i586-unisys-sysv4
1324ec318dbfSmrg	;;
1325bccedf53Smrg    *:UNIX_System_V:4*:FTX*)
1326bccedf53Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1327bccedf53Smrg	# How about differentiating between stratus architectures? -djm
1328ec318dbfSmrg	GUESS=hppa1.1-stratus-sysv4
1329ec318dbfSmrg	;;
1330bccedf53Smrg    *:*:*:FTX*)
1331bccedf53Smrg	# From seanf@swdc.stratus.com.
1332ec318dbfSmrg	GUESS=i860-stratus-sysv4
1333ec318dbfSmrg	;;
13347c5f6000Smrg    i*86:VOS:*:*)
13357c5f6000Smrg	# From Paul.Green@stratus.com.
1336ec318dbfSmrg	GUESS=$UNAME_MACHINE-stratus-vos
1337ec318dbfSmrg	;;
1338bccedf53Smrg    *:VOS:*:*)
1339bccedf53Smrg	# From Paul.Green@stratus.com.
1340ec318dbfSmrg	GUESS=hppa1.1-stratus-vos
1341ec318dbfSmrg	;;
1342bccedf53Smrg    mc68*:A/UX:*:*)
1343ec318dbfSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1344ec318dbfSmrg	;;
1345bccedf53Smrg    news*:NEWS-OS:6*:*)
1346ec318dbfSmrg	GUESS=mips-sony-newsos6
1347ec318dbfSmrg	;;
1348bccedf53Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1349ec318dbfSmrg	if test -d /usr/nec; then
1350ec318dbfSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1351bccedf53Smrg	else
1352ec318dbfSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1353bccedf53Smrg	fi
1354ec318dbfSmrg	;;
1355bccedf53Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1356ec318dbfSmrg	GUESS=powerpc-be-beos
1357ec318dbfSmrg	;;
1358bccedf53Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1359ec318dbfSmrg	GUESS=powerpc-apple-beos
1360ec318dbfSmrg	;;
1361bccedf53Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1362ec318dbfSmrg	GUESS=i586-pc-beos
1363ec318dbfSmrg	;;
13647c5f6000Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1365ec318dbfSmrg	GUESS=i586-pc-haiku
1366ec318dbfSmrg	;;
136789afc689Smrg    x86_64:Haiku:*:*)
1368ec318dbfSmrg	GUESS=x86_64-unknown-haiku
1369ec318dbfSmrg	;;
1370bccedf53Smrg    SX-4:SUPER-UX:*:*)
1371ec318dbfSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1372ec318dbfSmrg	;;
1373bccedf53Smrg    SX-5:SUPER-UX:*:*)
1374ec318dbfSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1375ec318dbfSmrg	;;
1376bccedf53Smrg    SX-6:SUPER-UX:*:*)
1377ec318dbfSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1378ec318dbfSmrg	;;
13797c5f6000Smrg    SX-7:SUPER-UX:*:*)
1380ec318dbfSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1381ec318dbfSmrg	;;
13827c5f6000Smrg    SX-8:SUPER-UX:*:*)
1383ec318dbfSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1384ec318dbfSmrg	;;
13857c5f6000Smrg    SX-8R:SUPER-UX:*:*)
1386ec318dbfSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1387ec318dbfSmrg	;;
138889afc689Smrg    SX-ACE:SUPER-UX:*:*)
1389ec318dbfSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1390ec318dbfSmrg	;;
1391bccedf53Smrg    Power*:Rhapsody:*:*)
1392ec318dbfSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393ec318dbfSmrg	;;
1394bccedf53Smrg    *:Rhapsody:*:*)
1395ec318dbfSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396ec318dbfSmrg	;;
1397ec318dbfSmrg    arm64:Darwin:*:*)
1398ec318dbfSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399ec318dbfSmrg	;;
1400bccedf53Smrg    *:Darwin:*:*)
1401ec318dbfSmrg	UNAME_PROCESSOR=`uname -p`
1402ec318dbfSmrg	case $UNAME_PROCESSOR in
1403ec318dbfSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1404ec318dbfSmrg	esac
1405ec318dbfSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1406ec318dbfSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407ec318dbfSmrg	    # Avoid executing cc if there is no toolchain installed as
1408ec318dbfSmrg	    # cc will be a stub that puts up a graphical alert
1409ec318dbfSmrg	    # prompting the user to install developer tools.
1410ec318dbfSmrg	    CC_FOR_BUILD=no_compiler_found
1411ec318dbfSmrg	else
1412ec318dbfSmrg	    set_cc_for_build
141389afc689Smrg	fi
1414ec318dbfSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1415ec318dbfSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416ec318dbfSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417ec318dbfSmrg		   grep IS_64BIT_ARCH >/dev/null
1418ec318dbfSmrg	    then
1419ec318dbfSmrg		case $UNAME_PROCESSOR in
1420ec318dbfSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1421ec318dbfSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1422ec318dbfSmrg		esac
1423ec318dbfSmrg	    fi
1424ec318dbfSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425ec318dbfSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426ec318dbfSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427ec318dbfSmrg		   grep IS_PPC >/dev/null
1428ec318dbfSmrg	    then
1429ec318dbfSmrg		UNAME_PROCESSOR=powerpc
143089afc689Smrg	    fi
143189afc689Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1432ec318dbfSmrg	    # uname -m returns i386 or x86_64
1433ec318dbfSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
143489afc689Smrg	fi
1435ec318dbfSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436ec318dbfSmrg	;;
1437bccedf53Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1438bccedf53Smrg	UNAME_PROCESSOR=`uname -p`
143989afc689Smrg	if test "$UNAME_PROCESSOR" = x86; then
1440bccedf53Smrg		UNAME_PROCESSOR=i386
1441bccedf53Smrg		UNAME_MACHINE=pc
1442bccedf53Smrg	fi
1443ec318dbfSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444ec318dbfSmrg	;;
1445bccedf53Smrg    *:QNX:*:4*)
1446ec318dbfSmrg	GUESS=i386-pc-qnx
1447ec318dbfSmrg	;;
144889afc689Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1449ec318dbfSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1450ec318dbfSmrg	;;
145189afc689Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1452ec318dbfSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1453ec318dbfSmrg	;;
145489afc689Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1455ec318dbfSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456ec318dbfSmrg	;;
145789afc689Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1458ec318dbfSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459ec318dbfSmrg	;;
146089afc689Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1461ec318dbfSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462ec318dbfSmrg	;;
1463bccedf53Smrg    *:NonStop-UX:*:*)
1464ec318dbfSmrg	GUESS=mips-compaq-nonstopux
1465ec318dbfSmrg	;;
1466bccedf53Smrg    BS2000:POSIX*:*:*)
1467ec318dbfSmrg	GUESS=bs2000-siemens-sysv
1468ec318dbfSmrg	;;
1469bccedf53Smrg    DS/*:UNIX_System_V:*:*)
1470ec318dbfSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471ec318dbfSmrg	;;
1472bccedf53Smrg    *:Plan9:*:*)
1473bccedf53Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1474bccedf53Smrg	# is converted to i386 for consistency with other x86
1475bccedf53Smrg	# operating systems.
1476ec318dbfSmrg	if test "${cputype-}" = 386; then
1477bccedf53Smrg	    UNAME_MACHINE=i386
1478ec318dbfSmrg	elif test "x${cputype-}" != x; then
1479ec318dbfSmrg	    UNAME_MACHINE=$cputype
1480bccedf53Smrg	fi
1481ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
1482ec318dbfSmrg	;;
1483bccedf53Smrg    *:TOPS-10:*:*)
1484ec318dbfSmrg	GUESS=pdp10-unknown-tops10
1485ec318dbfSmrg	;;
1486bccedf53Smrg    *:TENEX:*:*)
1487ec318dbfSmrg	GUESS=pdp10-unknown-tenex
1488ec318dbfSmrg	;;
1489bccedf53Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490ec318dbfSmrg	GUESS=pdp10-dec-tops20
1491ec318dbfSmrg	;;
1492bccedf53Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493ec318dbfSmrg	GUESS=pdp10-xkl-tops20
1494ec318dbfSmrg	;;
1495bccedf53Smrg    *:TOPS-20:*:*)
1496ec318dbfSmrg	GUESS=pdp10-unknown-tops20
1497ec318dbfSmrg	;;
1498bccedf53Smrg    *:ITS:*:*)
1499ec318dbfSmrg	GUESS=pdp10-unknown-its
1500ec318dbfSmrg	;;
1501bccedf53Smrg    SEI:*:*:SEIUX)
1502ec318dbfSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1503ec318dbfSmrg	;;
15047c5f6000Smrg    *:DragonFly:*:*)
1505ec318dbfSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507ec318dbfSmrg	;;
15087c5f6000Smrg    *:*VMS:*:*)
15091b1389eeSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510ec318dbfSmrg	case $UNAME_MACHINE in
1511ec318dbfSmrg	    A*) GUESS=alpha-dec-vms ;;
1512ec318dbfSmrg	    I*) GUESS=ia64-dec-vms ;;
1513ec318dbfSmrg	    V*) GUESS=vax-dec-vms ;;
15147c5f6000Smrg	esac ;;
15157c5f6000Smrg    *:XENIX:*:SysV)
1516ec318dbfSmrg	GUESS=i386-pc-xenix
1517ec318dbfSmrg	;;
15187c5f6000Smrg    i*86:skyos:*:*)
1519ec318dbfSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521ec318dbfSmrg	;;
15227c5f6000Smrg    i*86:rdos:*:*)
1523ec318dbfSmrg	GUESS=$UNAME_MACHINE-pc-rdos
1524ec318dbfSmrg	;;
1525ec318dbfSmrg    *:AROS:*:*)
1526ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-aros
1527ec318dbfSmrg	;;
152889afc689Smrg    x86_64:VMkernel:*:*)
1529ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-esx
1530ec318dbfSmrg	;;
153189afc689Smrg    amd64:Isilon\ OneFS:*:*)
1532ec318dbfSmrg	GUESS=x86_64-unknown-onefs
1533ec318dbfSmrg	;;
1534ec318dbfSmrg    *:Unleashed:*:*)
1535ec318dbfSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1536ec318dbfSmrg	;;
1537bccedf53Smrgesac
1538bccedf53Smrg
1539ec318dbfSmrg# Do we have a guess based on uname results?
1540ec318dbfSmrgif test "x$GUESS" != x; then
1541ec318dbfSmrg    echo "$GUESS"
1542ec318dbfSmrg    exit
1543ec318dbfSmrgfi
1544ec318dbfSmrg
1545ec318dbfSmrg# No uname command or uname output not recognized.
1546ec318dbfSmrgset_cc_for_build
1547ec318dbfSmrgcat > "$dummy.c" <<EOF
1548ec318dbfSmrg#ifdef _SEQUENT_
1549ec318dbfSmrg#include <sys/types.h>
1550ec318dbfSmrg#include <sys/utsname.h>
1551ec318dbfSmrg#endif
1552ec318dbfSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1553ec318dbfSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1554ec318dbfSmrg#include <signal.h>
1555ec318dbfSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1556ec318dbfSmrg#include <sys/utsname.h>
1557ec318dbfSmrg#endif
1558ec318dbfSmrg#endif
1559ec318dbfSmrg#endif
1560ec318dbfSmrgmain ()
1561ec318dbfSmrg{
1562ec318dbfSmrg#if defined (sony)
1563ec318dbfSmrg#if defined (MIPSEB)
1564ec318dbfSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1565ec318dbfSmrg     I don't know....  */
1566ec318dbfSmrg  printf ("mips-sony-bsd\n"); exit (0);
1567ec318dbfSmrg#else
1568ec318dbfSmrg#include <sys/param.h>
1569ec318dbfSmrg  printf ("m68k-sony-newsos%s\n",
1570ec318dbfSmrg#ifdef NEWSOS4
1571ec318dbfSmrg  "4"
1572ec318dbfSmrg#else
1573ec318dbfSmrg  ""
1574ec318dbfSmrg#endif
1575ec318dbfSmrg  ); exit (0);
1576ec318dbfSmrg#endif
1577ec318dbfSmrg#endif
1578ec318dbfSmrg
1579ec318dbfSmrg#if defined (NeXT)
1580ec318dbfSmrg#if !defined (__ARCHITECTURE__)
1581ec318dbfSmrg#define __ARCHITECTURE__ "m68k"
1582ec318dbfSmrg#endif
1583ec318dbfSmrg  int version;
1584ec318dbfSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1585ec318dbfSmrg  if (version < 4)
1586ec318dbfSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1587ec318dbfSmrg  else
1588ec318dbfSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1589ec318dbfSmrg  exit (0);
1590ec318dbfSmrg#endif
1591ec318dbfSmrg
1592ec318dbfSmrg#if defined (MULTIMAX) || defined (n16)
1593ec318dbfSmrg#if defined (UMAXV)
1594ec318dbfSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
1595ec318dbfSmrg#else
1596ec318dbfSmrg#if defined (CMU)
1597ec318dbfSmrg  printf ("ns32k-encore-mach\n"); exit (0);
1598ec318dbfSmrg#else
1599ec318dbfSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
1600ec318dbfSmrg#endif
1601ec318dbfSmrg#endif
1602ec318dbfSmrg#endif
1603ec318dbfSmrg
1604ec318dbfSmrg#if defined (__386BSD__)
1605ec318dbfSmrg  printf ("i386-pc-bsd\n"); exit (0);
1606ec318dbfSmrg#endif
1607ec318dbfSmrg
1608ec318dbfSmrg#if defined (sequent)
1609ec318dbfSmrg#if defined (i386)
1610ec318dbfSmrg  printf ("i386-sequent-dynix\n"); exit (0);
1611ec318dbfSmrg#endif
1612ec318dbfSmrg#if defined (ns32000)
1613ec318dbfSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1614ec318dbfSmrg#endif
1615ec318dbfSmrg#endif
1616ec318dbfSmrg
1617ec318dbfSmrg#if defined (_SEQUENT_)
1618ec318dbfSmrg  struct utsname un;
1619ec318dbfSmrg
1620ec318dbfSmrg  uname(&un);
1621ec318dbfSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1622ec318dbfSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1623ec318dbfSmrg  }
1624ec318dbfSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1625ec318dbfSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1626ec318dbfSmrg  }
1627ec318dbfSmrg  printf ("i386-sequent-ptx\n"); exit (0);
1628ec318dbfSmrg#endif
1629ec318dbfSmrg
1630ec318dbfSmrg#if defined (vax)
1631ec318dbfSmrg#if !defined (ultrix)
1632ec318dbfSmrg#include <sys/param.h>
1633ec318dbfSmrg#if defined (BSD)
1634ec318dbfSmrg#if BSD == 43
1635ec318dbfSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1636ec318dbfSmrg#else
1637ec318dbfSmrg#if BSD == 199006
1638ec318dbfSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1639ec318dbfSmrg#else
1640ec318dbfSmrg  printf ("vax-dec-bsd\n"); exit (0);
1641ec318dbfSmrg#endif
1642ec318dbfSmrg#endif
1643ec318dbfSmrg#else
1644ec318dbfSmrg  printf ("vax-dec-bsd\n"); exit (0);
1645ec318dbfSmrg#endif
1646ec318dbfSmrg#else
1647ec318dbfSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1648ec318dbfSmrg  struct utsname un;
1649ec318dbfSmrg  uname (&un);
1650ec318dbfSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1651ec318dbfSmrg#else
1652ec318dbfSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1653ec318dbfSmrg#endif
1654ec318dbfSmrg#endif
1655ec318dbfSmrg#endif
1656ec318dbfSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1657ec318dbfSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1658ec318dbfSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1659ec318dbfSmrg  struct utsname *un;
1660ec318dbfSmrg  uname (&un);
1661ec318dbfSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1662ec318dbfSmrg#else
1663ec318dbfSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1664ec318dbfSmrg#endif
1665ec318dbfSmrg#endif
1666ec318dbfSmrg#endif
1667ec318dbfSmrg
1668ec318dbfSmrg#if defined (alliant) && defined (i860)
1669ec318dbfSmrg  printf ("i860-alliant-bsd\n"); exit (0);
1670ec318dbfSmrg#endif
1671ec318dbfSmrg
1672ec318dbfSmrg  exit (1);
1673ec318dbfSmrg}
1674ec318dbfSmrgEOF
1675ec318dbfSmrg
1676ec318dbfSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1677ec318dbfSmrg	{ echo "$SYSTEM_NAME"; exit; }
1678ec318dbfSmrg
1679ec318dbfSmrg# Apollos put the system type in the environment.
1680ec318dbfSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1681ec318dbfSmrg
168289afc689Smrgecho "$0: unable to guess system type" >&2
1683bccedf53Smrg
1684ec318dbfSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
168589afc689Smrg    mips:Linux | mips64:Linux)
168689afc689Smrg	# If we got here on MIPS GNU/Linux, output extra information.
168789afc689Smrg	cat >&2 <<EOF
1688bccedf53Smrg
168989afc689SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
169089afc689Smrgthe system type. Please install a C compiler and try again.
1691bccedf53SmrgEOF
169289afc689Smrg	;;
169389afc689Smrgesac
1694bccedf53Smrg
1695bccedf53Smrgcat >&2 <<EOF
1696bccedf53Smrg
169789afc689SmrgThis script (version $timestamp), has failed to recognize the
169889afc689Smrgoperating system you are using. If your script is old, overwrite *all*
169989afc689Smrgcopies of config.guess and config.sub with the latest versions from:
1700bccedf53Smrg
1701ec318dbfSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17027c5f6000Smrgand
1703ec318dbfSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1704ec318dbfSmrgEOF
1705ec318dbfSmrg
1706ec318dbfSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
1707ec318dbfSmrgthisyear=`date +%Y`
1708ec318dbfSmrg# shellcheck disable=SC2003
1709ec318dbfSmrgscript_age=`expr "$thisyear" - "$our_year"`
1710ec318dbfSmrgif test "$script_age" -lt 3 ; then
1711ec318dbfSmrg   cat >&2 <<EOF
1712bccedf53Smrg
171389afc689SmrgIf $0 has already been updated, send the following data and any
171489afc689Smrginformation you think might be pertinent to config-patches@gnu.org to
171589afc689Smrgprovide the necessary information to handle your system.
1716bccedf53Smrg
1717bccedf53Smrgconfig.guess timestamp = $timestamp
1718bccedf53Smrg
1719bccedf53Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1720bccedf53Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1721bccedf53Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1722bccedf53Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1723bccedf53Smrg
1724bccedf53Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1725bccedf53Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1726bccedf53Smrg
1727bccedf53Smrghostinfo               = `(hostinfo) 2>/dev/null`
1728bccedf53Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1729bccedf53Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1730bccedf53Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1731bccedf53Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1732bccedf53Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1733bccedf53Smrg
173489afc689SmrgUNAME_MACHINE = "$UNAME_MACHINE"
173589afc689SmrgUNAME_RELEASE = "$UNAME_RELEASE"
173689afc689SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
173789afc689SmrgUNAME_VERSION = "$UNAME_VERSION"
1738bccedf53SmrgEOF
1739ec318dbfSmrgfi
1740bccedf53Smrg
1741bccedf53Smrgexit 1
1742bccedf53Smrg
1743bccedf53Smrg# Local variables:
1744ec318dbfSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
1745bccedf53Smrg# time-stamp-start: "timestamp='"
1746bccedf53Smrg# time-stamp-format: "%:y-%02m-%02d"
1747bccedf53Smrg# time-stamp-end: "'"
1748bccedf53Smrg# End:
1749