config.guess revision 370b807f
1659607e0Smrg#! /bin/sh
2659607e0Smrg# Attempt to guess a canonical system name.
3370b807fSmrg#   Copyright 1992-2021 Free Software Foundation, Inc.
4659607e0Smrg
5370b807fSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6370b807fSmrg
7370b807fSmrgtimestamp='2021-06-03'
8659607e0Smrg
9659607e0Smrg# This file is free software; you can redistribute it and/or modify it
10659607e0Smrg# under the terms of the GNU General Public License as published by
11370b807fSmrg# the Free Software Foundation; either version 3 of the License, or
12659607e0Smrg# (at your option) any later version.
13659607e0Smrg#
14659607e0Smrg# This program is distributed in the hope that it will be useful, but
15659607e0Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16659607e0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17659607e0Smrg# General Public License for more details.
18659607e0Smrg#
19659607e0Smrg# You should have received a copy of the GNU General Public License
20370b807fSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
21659607e0Smrg#
22659607e0Smrg# As a special exception to the GNU General Public License, if you
23659607e0Smrg# distribute this file as part of a program that contains a
24659607e0Smrg# configuration script generated by Autoconf, you may include it under
25370b807fSmrg# the same distribution terms that you use for the rest of that
26370b807fSmrg# program.  This Exception is an additional permission under section 7
27370b807fSmrg# of the GNU General Public License, version 3 ("GPLv3").
28659607e0Smrg#
29370b807fSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
30659607e0Smrg#
31b73be646Smrg# You can get the latest version of this script from:
32370b807fSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33370b807fSmrg#
34370b807fSmrg# Please send patches to <config-patches@gnu.org>.
35370b807fSmrg
36370b807fSmrg
37370b807fSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
38370b807fSmrg# about features and limitations of the classic Bourne shell that were
39370b807fSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
40370b807fSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41370b807fSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42370b807fSmrg# have a pre-POSIX /bin/sh.
43370b807fSmrg
44659607e0Smrg
45659607e0Smrgme=`echo "$0" | sed -e 's,.*/,,'`
46659607e0Smrg
47659607e0Smrgusage="\
48659607e0SmrgUsage: $0 [OPTION]
49659607e0Smrg
50659607e0SmrgOutput the configuration name of the system \`$me' is run on.
51659607e0Smrg
52370b807fSmrgOptions:
53659607e0Smrg  -h, --help         print this help, then exit
54659607e0Smrg  -t, --time-stamp   print date of last modification, then exit
55659607e0Smrg  -v, --version      print version number, then exit
56659607e0Smrg
57659607e0SmrgReport bugs and patches to <config-patches@gnu.org>."
58659607e0Smrg
59659607e0Smrgversion="\
60659607e0SmrgGNU config.guess ($timestamp)
61659607e0Smrg
62659607e0SmrgOriginally written by Per Bothner.
63370b807fSmrgCopyright 1992-2021 Free Software Foundation, Inc.
64659607e0Smrg
65659607e0SmrgThis is free software; see the source for copying conditions.  There is NO
66659607e0Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67659607e0Smrg
68659607e0Smrghelp="
69659607e0SmrgTry \`$me --help' for more information."
70659607e0Smrg
71659607e0Smrg# Parse command line
72659607e0Smrgwhile test $# -gt 0 ; do
73659607e0Smrg  case $1 in
74659607e0Smrg    --time-stamp | --time* | -t )
75659607e0Smrg       echo "$timestamp" ; exit ;;
76659607e0Smrg    --version | -v )
77659607e0Smrg       echo "$version" ; exit ;;
78659607e0Smrg    --help | --h* | -h )
79659607e0Smrg       echo "$usage"; exit ;;
80659607e0Smrg    -- )     # Stop option processing
81659607e0Smrg       shift; break ;;
82659607e0Smrg    - )	# Use stdin as input.
83659607e0Smrg       break ;;
84659607e0Smrg    -* )
85659607e0Smrg       echo "$me: invalid option $1$help" >&2
86659607e0Smrg       exit 1 ;;
87659607e0Smrg    * )
88659607e0Smrg       break ;;
89659607e0Smrg  esac
90659607e0Smrgdone
91659607e0Smrg
92659607e0Smrgif test $# != 0; then
93659607e0Smrg  echo "$me: too many arguments$help" >&2
94659607e0Smrg  exit 1
95659607e0Smrgfi
96659607e0Smrg
97370b807fSmrg# Just in case it came from the environment.
98370b807fSmrgGUESS=
99659607e0Smrg
100659607e0Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
101659607e0Smrg# compiler to aid in system detection is discouraged as it requires
102659607e0Smrg# temporary files to be created and, as you can see below, it is a
103659607e0Smrg# headache to deal with in a portable fashion.
104659607e0Smrg
105659607e0Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106659607e0Smrg# use `HOST_CC' if defined, but it is deprecated.
107659607e0Smrg
108659607e0Smrg# Portable tmp directory creation inspired by the Autoconf team.
109659607e0Smrg
110370b807fSmrgtmp=
111370b807fSmrg# shellcheck disable=SC2172
112370b807fSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113370b807fSmrg
114370b807fSmrgset_cc_for_build() {
115370b807fSmrg    # prevent multiple calls if $tmp is already set
116370b807fSmrg    test "$tmp" && return 0
117370b807fSmrg    : "${TMPDIR=/tmp}"
118370b807fSmrg    # shellcheck disable=SC2039,SC3028
119370b807fSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120370b807fSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121370b807fSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122370b807fSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123370b807fSmrg    dummy=$tmp/dummy
124370b807fSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125370b807fSmrg	,,)    echo "int x;" > "$dummy.c"
126370b807fSmrg	       for driver in cc gcc c89 c99 ; do
127370b807fSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128370b807fSmrg		       CC_FOR_BUILD=$driver
129370b807fSmrg		       break
130370b807fSmrg		   fi
131370b807fSmrg	       done
132370b807fSmrg	       if test x"$CC_FOR_BUILD" = x ; then
133370b807fSmrg		   CC_FOR_BUILD=no_compiler_found
134370b807fSmrg	       fi
135370b807fSmrg	       ;;
136370b807fSmrg	,,*)   CC_FOR_BUILD=$CC ;;
137370b807fSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138370b807fSmrg    esac
139370b807fSmrg}
140659607e0Smrg
141659607e0Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
142659607e0Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143370b807fSmrgif test -f /.attbin/uname ; then
144659607e0Smrg	PATH=$PATH:/.attbin ; export PATH
145659607e0Smrgfi
146659607e0Smrg
147659607e0SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
148659607e0SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149370b807fSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
150659607e0SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
151659607e0Smrg
152370b807fSmrgcase $UNAME_SYSTEM in
153370b807fSmrgLinux|GNU|GNU/*)
154370b807fSmrg	LIBC=unknown
155370b807fSmrg
156370b807fSmrg	set_cc_for_build
157370b807fSmrg	cat <<-EOF > "$dummy.c"
158370b807fSmrg	#include <features.h>
159370b807fSmrg	#if defined(__UCLIBC__)
160370b807fSmrg	LIBC=uclibc
161370b807fSmrg	#elif defined(__dietlibc__)
162370b807fSmrg	LIBC=dietlibc
163370b807fSmrg	#elif defined(__GLIBC__)
164370b807fSmrg	LIBC=gnu
165370b807fSmrg	#else
166370b807fSmrg	#include <stdarg.h>
167370b807fSmrg	/* First heuristic to detect musl libc.  */
168370b807fSmrg	#ifdef __DEFINED_va_list
169370b807fSmrg	LIBC=musl
170370b807fSmrg	#endif
171370b807fSmrg	#endif
172370b807fSmrg	EOF
173370b807fSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174370b807fSmrg	eval "$cc_set_libc"
175370b807fSmrg
176370b807fSmrg	# Second heuristic to detect musl libc.
177370b807fSmrg	if [ "$LIBC" = unknown ] &&
178370b807fSmrg	   command -v ldd >/dev/null &&
179370b807fSmrg	   ldd --version 2>&1 | grep -q ^musl; then
180370b807fSmrg		LIBC=musl
181370b807fSmrg	fi
182370b807fSmrg
183370b807fSmrg	# If the system lacks a compiler, then just pick glibc.
184370b807fSmrg	# We could probably try harder.
185370b807fSmrg	if [ "$LIBC" = unknown ]; then
186370b807fSmrg		LIBC=gnu
187370b807fSmrg	fi
188370b807fSmrg	;;
189370b807fSmrgesac
190370b807fSmrg
191659607e0Smrg# Note: order is significant - the case branches are not exclusive.
192659607e0Smrg
193370b807fSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194659607e0Smrg    *:NetBSD:*:*)
195659607e0Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196a73597f9Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197659607e0Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198659607e0Smrg	# switched to ELF, *-*-netbsd* would select the old
199659607e0Smrg	# object file format.  This provides both forward
200659607e0Smrg	# compatibility and a consistent mechanism for selecting the
201659607e0Smrg	# object file format.
202659607e0Smrg	#
203659607e0Smrg	# Note: NetBSD doesn't particularly care about the vendor
204659607e0Smrg	# portion of the name.  We always set it to "unknown".
205370b807fSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206370b807fSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207370b807fSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208370b807fSmrg	    echo unknown)`
209370b807fSmrg	case $UNAME_MACHINE_ARCH in
210370b807fSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
211659607e0Smrg	    armeb) machine=armeb-unknown ;;
212659607e0Smrg	    arm*) machine=arm-unknown ;;
213659607e0Smrg	    sh3el) machine=shl-unknown ;;
214659607e0Smrg	    sh3eb) machine=sh-unknown ;;
215fc27e79cSmrg	    sh5el) machine=sh5le-unknown ;;
216370b807fSmrg	    earmv*)
217370b807fSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218370b807fSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219370b807fSmrg		machine=${arch}${endian}-unknown
220370b807fSmrg		;;
221370b807fSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222659607e0Smrg	esac
223659607e0Smrg	# The Operating System including object format, if it has switched
224370b807fSmrg	# to ELF recently (or will in the future) and ABI.
225370b807fSmrg	case $UNAME_MACHINE_ARCH in
226370b807fSmrg	    earm*)
227370b807fSmrg		os=netbsdelf
228370b807fSmrg		;;
229659607e0Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230370b807fSmrg		set_cc_for_build
231659607e0Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232b73be646Smrg			| grep -q __ELF__
233659607e0Smrg		then
234659607e0Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235659607e0Smrg		    # Return netbsd for either.  FIX?
236659607e0Smrg		    os=netbsd
237659607e0Smrg		else
238659607e0Smrg		    os=netbsdelf
239659607e0Smrg		fi
240659607e0Smrg		;;
241659607e0Smrg	    *)
242a73597f9Smrg		os=netbsd
243659607e0Smrg		;;
244659607e0Smrg	esac
245370b807fSmrg	# Determine ABI tags.
246370b807fSmrg	case $UNAME_MACHINE_ARCH in
247370b807fSmrg	    earm*)
248370b807fSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249370b807fSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250370b807fSmrg		;;
251370b807fSmrg	esac
252659607e0Smrg	# The OS release
253659607e0Smrg	# Debian GNU/NetBSD machines have a different userland, and
254659607e0Smrg	# thus, need a distinct triplet. However, they do not need
255659607e0Smrg	# kernel version information, so it can be replaced with a
256659607e0Smrg	# suitable tag, in the style of linux-gnu.
257370b807fSmrg	case $UNAME_VERSION in
258659607e0Smrg	    Debian*)
259659607e0Smrg		release='-gnu'
260659607e0Smrg		;;
261659607e0Smrg	    *)
262370b807fSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263659607e0Smrg		;;
264659607e0Smrg	esac
265659607e0Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266659607e0Smrg	# contains redundant information, the shorter form:
267659607e0Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268370b807fSmrg	GUESS=$machine-${os}${release}${abi-}
269370b807fSmrg	;;
270370b807fSmrg    *:Bitrig:*:*)
271370b807fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272370b807fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273370b807fSmrg	;;
274659607e0Smrg    *:OpenBSD:*:*)
275659607e0Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276370b807fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277370b807fSmrg	;;
278370b807fSmrg    *:SecBSD:*:*)
279370b807fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280370b807fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281370b807fSmrg	;;
282370b807fSmrg    *:LibertyBSD:*:*)
283370b807fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284370b807fSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285370b807fSmrg	;;
286370b807fSmrg    *:MidnightBSD:*:*)
287370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288370b807fSmrg	;;
289659607e0Smrg    *:ekkoBSD:*:*)
290370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291370b807fSmrg	;;
292fc27e79cSmrg    *:SolidBSD:*:*)
293370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294370b807fSmrg	;;
295370b807fSmrg    *:OS108:*:*)
296370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297370b807fSmrg	;;
298659607e0Smrg    macppc:MirBSD:*:*)
299370b807fSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300370b807fSmrg	;;
301659607e0Smrg    *:MirBSD:*:*)
302370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303370b807fSmrg	;;
304370b807fSmrg    *:Sortix:*:*)
305370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
306370b807fSmrg	;;
307370b807fSmrg    *:Twizzler:*:*)
308370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309370b807fSmrg	;;
310370b807fSmrg    *:Redox:*:*)
311370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-redox
312370b807fSmrg	;;
313370b807fSmrg    mips:OSF1:*.*)
314370b807fSmrg	GUESS=mips-dec-osf1
315370b807fSmrg	;;
316659607e0Smrg    alpha:OSF1:*:*)
317370b807fSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318370b807fSmrg	trap '' 0
319659607e0Smrg	case $UNAME_RELEASE in
320659607e0Smrg	*4.0)
321659607e0Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322659607e0Smrg		;;
323659607e0Smrg	*5.*)
324a73597f9Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325659607e0Smrg		;;
326659607e0Smrg	esac
327659607e0Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
328659607e0Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329659607e0Smrg	# covers most systems running today.  This code pipes the CPU
330659607e0Smrg	# types through head -n 1, so we only detect the type of CPU 0.
331659607e0Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332370b807fSmrg	case $ALPHA_CPU_TYPE in
333659607e0Smrg	    "EV4 (21064)")
334370b807fSmrg		UNAME_MACHINE=alpha ;;
335659607e0Smrg	    "EV4.5 (21064)")
336370b807fSmrg		UNAME_MACHINE=alpha ;;
337659607e0Smrg	    "LCA4 (21066/21068)")
338370b807fSmrg		UNAME_MACHINE=alpha ;;
339659607e0Smrg	    "EV5 (21164)")
340370b807fSmrg		UNAME_MACHINE=alphaev5 ;;
341659607e0Smrg	    "EV5.6 (21164A)")
342370b807fSmrg		UNAME_MACHINE=alphaev56 ;;
343659607e0Smrg	    "EV5.6 (21164PC)")
344370b807fSmrg		UNAME_MACHINE=alphapca56 ;;
345659607e0Smrg	    "EV5.7 (21164PC)")
346370b807fSmrg		UNAME_MACHINE=alphapca57 ;;
347659607e0Smrg	    "EV6 (21264)")
348370b807fSmrg		UNAME_MACHINE=alphaev6 ;;
349659607e0Smrg	    "EV6.7 (21264A)")
350370b807fSmrg		UNAME_MACHINE=alphaev67 ;;
351659607e0Smrg	    "EV6.8CB (21264C)")
352370b807fSmrg		UNAME_MACHINE=alphaev68 ;;
353659607e0Smrg	    "EV6.8AL (21264B)")
354370b807fSmrg		UNAME_MACHINE=alphaev68 ;;
355659607e0Smrg	    "EV6.8CX (21264D)")
356370b807fSmrg		UNAME_MACHINE=alphaev68 ;;
357659607e0Smrg	    "EV6.9A (21264/EV69A)")
358370b807fSmrg		UNAME_MACHINE=alphaev69 ;;
359659607e0Smrg	    "EV7 (21364)")
360370b807fSmrg		UNAME_MACHINE=alphaev7 ;;
361659607e0Smrg	    "EV7.9 (21364A)")
362370b807fSmrg		UNAME_MACHINE=alphaev79 ;;
363659607e0Smrg	esac
364659607e0Smrg	# A Pn.n version is a patched version.
365659607e0Smrg	# A Vn.n version is a released version.
366659607e0Smrg	# A Tn.n version is a released field test version.
367659607e0Smrg	# A Xn.n version is an unreleased experimental baselevel.
368659607e0Smrg	# 1.2 uses "1.2" for uname -r.
369370b807fSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370370b807fSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371370b807fSmrg	;;
372659607e0Smrg    Amiga*:UNIX_System_V:4.0:*)
373370b807fSmrg	GUESS=m68k-unknown-sysv4
374370b807fSmrg	;;
375659607e0Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377370b807fSmrg	;;
378659607e0Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
380370b807fSmrg	;;
381659607e0Smrg    *:OS/390:*:*)
382370b807fSmrg	GUESS=i370-ibm-openedition
383370b807fSmrg	;;
384659607e0Smrg    *:z/VM:*:*)
385370b807fSmrg	GUESS=s390-ibm-zvmoe
386370b807fSmrg	;;
387659607e0Smrg    *:OS400:*:*)
388370b807fSmrg	GUESS=powerpc-ibm-os400
389370b807fSmrg	;;
390659607e0Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391370b807fSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392370b807fSmrg	;;
393370b807fSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394370b807fSmrg	GUESS=arm-unknown-riscos
395370b807fSmrg	;;
396659607e0Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397370b807fSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
398370b807fSmrg	;;
399659607e0Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
400659607e0Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401370b807fSmrg	case `(/bin/universe) 2>/dev/null` in
402370b807fSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403370b807fSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404370b807fSmrg	esac
405370b807fSmrg	;;
406659607e0Smrg    NILE*:*:*:dcosx)
407370b807fSmrg	GUESS=pyramid-pyramid-svr4
408370b807fSmrg	;;
409659607e0Smrg    DRS?6000:unix:4.0:6*)
410370b807fSmrg	GUESS=sparc-icl-nx6
411370b807fSmrg	;;
412659607e0Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
413659607e0Smrg	case `/usr/bin/uname -p` in
414370b807fSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
415370b807fSmrg	esac
416370b807fSmrg	;;
417b73be646Smrg    s390x:SunOS:*:*)
418370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419370b807fSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420370b807fSmrg	;;
421659607e0Smrg    sun4H:SunOS:5.*:*)
422370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423370b807fSmrg	GUESS=sparc-hal-solaris2$SUN_REL
424370b807fSmrg	;;
425659607e0Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427370b807fSmrg	GUESS=sparc-sun-solaris2$SUN_REL
428370b807fSmrg	;;
429b73be646Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430370b807fSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431370b807fSmrg	;;
432fc27e79cSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433370b807fSmrg	set_cc_for_build
434370b807fSmrg	SUN_ARCH=i386
435b73be646Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
436b73be646Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437b73be646Smrg	# This test works for both compilers.
438370b807fSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439b73be646Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440370b807fSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
441b73be646Smrg		grep IS_64BIT_ARCH >/dev/null
442b73be646Smrg	    then
443370b807fSmrg		SUN_ARCH=x86_64
444b73be646Smrg	    fi
445b73be646Smrg	fi
446370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447370b807fSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448370b807fSmrg	;;
449659607e0Smrg    sun4*:SunOS:6*:*)
450659607e0Smrg	# According to config.sub, this is the proper way to canonicalize
451659607e0Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
452659607e0Smrg	# it's likely to be more like Solaris than SunOS4.
453370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454370b807fSmrg	GUESS=sparc-sun-solaris3$SUN_REL
455370b807fSmrg	;;
456659607e0Smrg    sun4*:SunOS:*:*)
457370b807fSmrg	case `/usr/bin/arch -k` in
458659607e0Smrg	    Series*|S4*)
459659607e0Smrg		UNAME_RELEASE=`uname -v`
460659607e0Smrg		;;
461659607e0Smrg	esac
462659607e0Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464370b807fSmrg	GUESS=sparc-sun-sunos$SUN_REL
465370b807fSmrg	;;
466659607e0Smrg    sun3*:SunOS:*:*)
467370b807fSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468370b807fSmrg	;;
469659607e0Smrg    sun*:*:4.2BSD:*)
470659607e0Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471370b807fSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472370b807fSmrg	case `/bin/arch` in
473659607e0Smrg	    sun3)
474370b807fSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
475659607e0Smrg		;;
476659607e0Smrg	    sun4)
477370b807fSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
478659607e0Smrg		;;
479659607e0Smrg	esac
480370b807fSmrg	;;
481659607e0Smrg    aushp:SunOS:*:*)
482370b807fSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483370b807fSmrg	;;
484659607e0Smrg    # The situation for MiNT is a little confusing.  The machine name
485659607e0Smrg    # can be virtually everything (everything which is not
486659607e0Smrg    # "atarist" or "atariste" at least should have a processor
487659607e0Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488659607e0Smrg    # to the lowercase version "mint" (or "freemint").  Finally
489659607e0Smrg    # the system name "TOS" denotes a system which is actually not
490659607e0Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
491659607e0Smrg    # be no problem.
492659607e0Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493370b807fSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494370b807fSmrg	;;
495659607e0Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496370b807fSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497370b807fSmrg	;;
498659607e0Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499370b807fSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500370b807fSmrg	;;
501659607e0Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502370b807fSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503370b807fSmrg	;;
504659607e0Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505370b807fSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506370b807fSmrg	;;
507659607e0Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508370b807fSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509370b807fSmrg	;;
510659607e0Smrg    m68k:machten:*:*)
511370b807fSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512370b807fSmrg	;;
513659607e0Smrg    powerpc:machten:*:*)
514370b807fSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515370b807fSmrg	;;
516659607e0Smrg    RISC*:Mach:*:*)
517370b807fSmrg	GUESS=mips-dec-mach_bsd4.3
518370b807fSmrg	;;
519659607e0Smrg    RISC*:ULTRIX:*:*)
520370b807fSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521370b807fSmrg	;;
522659607e0Smrg    VAX*:ULTRIX*:*:*)
523370b807fSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524370b807fSmrg	;;
525659607e0Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526370b807fSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527370b807fSmrg	;;
528659607e0Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529370b807fSmrg	set_cc_for_build
530370b807fSmrg	sed 's/^	//' << EOF > "$dummy.c"
531659607e0Smrg#ifdef __cplusplus
532659607e0Smrg#include <stdio.h>  /* for printf() prototype */
533659607e0Smrg	int main (int argc, char *argv[]) {
534659607e0Smrg#else
535659607e0Smrg	int main (argc, argv) int argc; char *argv[]; {
536659607e0Smrg#endif
537659607e0Smrg	#if defined (host_mips) && defined (MIPSEB)
538659607e0Smrg	#if defined (SYSTYPE_SYSV)
539370b807fSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
540659607e0Smrg	#endif
541659607e0Smrg	#if defined (SYSTYPE_SVR4)
542370b807fSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
543659607e0Smrg	#endif
544659607e0Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545370b807fSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
546659607e0Smrg	#endif
547659607e0Smrg	#endif
548659607e0Smrg	  exit (-1);
549659607e0Smrg	}
550659607e0SmrgEOF
551370b807fSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552370b807fSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553370b807fSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554659607e0Smrg	    { echo "$SYSTEM_NAME"; exit; }
555370b807fSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556370b807fSmrg	;;
557659607e0Smrg    Motorola:PowerMAX_OS:*:*)
558370b807fSmrg	GUESS=powerpc-motorola-powermax
559370b807fSmrg	;;
560659607e0Smrg    Motorola:*:4.3:PL8-*)
561370b807fSmrg	GUESS=powerpc-harris-powermax
562370b807fSmrg	;;
563659607e0Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564370b807fSmrg	GUESS=powerpc-harris-powermax
565370b807fSmrg	;;
566659607e0Smrg    Night_Hawk:Power_UNIX:*:*)
567370b807fSmrg	GUESS=powerpc-harris-powerunix
568370b807fSmrg	;;
569659607e0Smrg    m88k:CX/UX:7*:*)
570370b807fSmrg	GUESS=m88k-harris-cxux7
571370b807fSmrg	;;
572659607e0Smrg    m88k:*:4*:R4*)
573370b807fSmrg	GUESS=m88k-motorola-sysv4
574370b807fSmrg	;;
575659607e0Smrg    m88k:*:3*:R3*)
576370b807fSmrg	GUESS=m88k-motorola-sysv3
577370b807fSmrg	;;
578659607e0Smrg    AViiON:dgux:*:*)
579a73597f9Smrg	# DG/UX returns AViiON for all architectures
580a73597f9Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581370b807fSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582659607e0Smrg	then
583370b807fSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584370b807fSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
585659607e0Smrg	    then
586370b807fSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
587659607e0Smrg	    else
588370b807fSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
589659607e0Smrg	    fi
590659607e0Smrg	else
591370b807fSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
592659607e0Smrg	fi
593370b807fSmrg	;;
594659607e0Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595370b807fSmrg	GUESS=m88k-dolphin-sysv3
596370b807fSmrg	;;
597659607e0Smrg    M88*:*:R3*:*)
598659607e0Smrg	# Delta 88k system running SVR3
599370b807fSmrg	GUESS=m88k-motorola-sysv3
600370b807fSmrg	;;
601659607e0Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602370b807fSmrg	GUESS=m88k-tektronix-sysv3
603370b807fSmrg	;;
604659607e0Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605370b807fSmrg	GUESS=m68k-tektronix-bsd
606370b807fSmrg	;;
607659607e0Smrg    *:IRIX*:*:*)
608370b807fSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609370b807fSmrg	GUESS=mips-sgi-irix$IRIX_REL
610370b807fSmrg	;;
611659607e0Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612370b807fSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613370b807fSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614659607e0Smrg    i*86:AIX:*:*)
615370b807fSmrg	GUESS=i386-ibm-aix
616370b807fSmrg	;;
617659607e0Smrg    ia64:AIX:*:*)
618370b807fSmrg	if test -x /usr/bin/oslevel ; then
619659607e0Smrg		IBM_REV=`/usr/bin/oslevel`
620659607e0Smrg	else
621370b807fSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622659607e0Smrg	fi
623370b807fSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624370b807fSmrg	;;
625659607e0Smrg    *:AIX:2:3)
626659607e0Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627370b807fSmrg		set_cc_for_build
628370b807fSmrg		sed 's/^		//' << EOF > "$dummy.c"
629659607e0Smrg		#include <sys/systemcfg.h>
630659607e0Smrg
631659607e0Smrg		main()
632659607e0Smrg			{
633659607e0Smrg			if (!__power_pc())
634659607e0Smrg				exit(1);
635659607e0Smrg			puts("powerpc-ibm-aix3.2.5");
636659607e0Smrg			exit(0);
637659607e0Smrg			}
638659607e0SmrgEOF
639370b807fSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640659607e0Smrg		then
641370b807fSmrg			GUESS=$SYSTEM_NAME
642659607e0Smrg		else
643370b807fSmrg			GUESS=rs6000-ibm-aix3.2.5
644659607e0Smrg		fi
645659607e0Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646370b807fSmrg		GUESS=rs6000-ibm-aix3.2.4
647659607e0Smrg	else
648370b807fSmrg		GUESS=rs6000-ibm-aix3.2
649659607e0Smrg	fi
650370b807fSmrg	;;
651bd3a1963Smrg    *:AIX:*:[4567])
652659607e0Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653370b807fSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
654659607e0Smrg		IBM_ARCH=rs6000
655659607e0Smrg	else
656659607e0Smrg		IBM_ARCH=powerpc
657659607e0Smrg	fi
658370b807fSmrg	if test -x /usr/bin/lslpp ; then
659370b807fSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660370b807fSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
661659607e0Smrg	else
662370b807fSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
663659607e0Smrg	fi
664370b807fSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665370b807fSmrg	;;
666659607e0Smrg    *:AIX:*:*)
667370b807fSmrg	GUESS=rs6000-ibm-aix
668370b807fSmrg	;;
669370b807fSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670370b807fSmrg	GUESS=romp-ibm-bsd4.4
671370b807fSmrg	;;
672659607e0Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673370b807fSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674370b807fSmrg	;;                                  # report: romp-ibm BSD 4.3
675659607e0Smrg    *:BOSX:*:*)
676370b807fSmrg	GUESS=rs6000-bull-bosx
677370b807fSmrg	;;
678659607e0Smrg    DPX/2?00:B.O.S.:*:*)
679370b807fSmrg	GUESS=m68k-bull-sysv3
680370b807fSmrg	;;
681659607e0Smrg    9000/[34]??:4.3bsd:1.*:*)
682370b807fSmrg	GUESS=m68k-hp-bsd
683370b807fSmrg	;;
684659607e0Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685370b807fSmrg	GUESS=m68k-hp-bsd4.4
686370b807fSmrg	;;
687659607e0Smrg    9000/[34678]??:HP-UX:*:*)
688370b807fSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689370b807fSmrg	case $UNAME_MACHINE in
690370b807fSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691370b807fSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
692659607e0Smrg	    9000/[678][0-9][0-9])
693370b807fSmrg		if test -x /usr/bin/getconf; then
694659607e0Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695a73597f9Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696370b807fSmrg		    case $sc_cpu_version in
697370b807fSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698370b807fSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699a73597f9Smrg		      532)                      # CPU_PA_RISC2_0
700370b807fSmrg			case $sc_kernel_bits in
701370b807fSmrg			  32) HP_ARCH=hppa2.0n ;;
702370b807fSmrg			  64) HP_ARCH=hppa2.0w ;;
703370b807fSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704a73597f9Smrg			esac ;;
705a73597f9Smrg		    esac
706659607e0Smrg		fi
707370b807fSmrg		if test "$HP_ARCH" = ""; then
708370b807fSmrg		    set_cc_for_build
709370b807fSmrg		    sed 's/^		//' << EOF > "$dummy.c"
710659607e0Smrg
711a73597f9Smrg		#define _HPUX_SOURCE
712a73597f9Smrg		#include <stdlib.h>
713a73597f9Smrg		#include <unistd.h>
714659607e0Smrg
715a73597f9Smrg		int main ()
716a73597f9Smrg		{
717a73597f9Smrg		#if defined(_SC_KERNEL_BITS)
718a73597f9Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
719a73597f9Smrg		#endif
720a73597f9Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
721659607e0Smrg
722a73597f9Smrg		    switch (cpu)
723a73597f9Smrg			{
724a73597f9Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725a73597f9Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726a73597f9Smrg			case CPU_PA_RISC2_0:
727a73597f9Smrg		#if defined(_SC_KERNEL_BITS)
728a73597f9Smrg			    switch (bits)
729a73597f9Smrg				{
730a73597f9Smrg				case 64: puts ("hppa2.0w"); break;
731a73597f9Smrg				case 32: puts ("hppa2.0n"); break;
732a73597f9Smrg				default: puts ("hppa2.0"); break;
733a73597f9Smrg				} break;
734a73597f9Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
735a73597f9Smrg			    puts ("hppa2.0"); break;
736a73597f9Smrg		#endif
737a73597f9Smrg			default: puts ("hppa1.0"); break;
738a73597f9Smrg			}
739a73597f9Smrg		    exit (0);
740a73597f9Smrg		}
741659607e0SmrgEOF
742370b807fSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743659607e0Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
744659607e0Smrg		fi ;;
745659607e0Smrg	esac
746370b807fSmrg	if test "$HP_ARCH" = hppa2.0w
747659607e0Smrg	then
748370b807fSmrg	    set_cc_for_build
749659607e0Smrg
750659607e0Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751659607e0Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752659607e0Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753659607e0Smrg	    #
754659607e0Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
755659607e0Smrg	    # => hppa2.0w-hp-hpux11.23
756659607e0Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757659607e0Smrg	    # => hppa64-hp-hpux11.23
758659607e0Smrg
759370b807fSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760b73be646Smrg		grep -q __LP64__
761659607e0Smrg	    then
762370b807fSmrg		HP_ARCH=hppa2.0w
763659607e0Smrg	    else
764370b807fSmrg		HP_ARCH=hppa64
765659607e0Smrg	    fi
766659607e0Smrg	fi
767370b807fSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768370b807fSmrg	;;
769659607e0Smrg    ia64:HP-UX:*:*)
770370b807fSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771370b807fSmrg	GUESS=ia64-hp-hpux$HPUX_REV
772370b807fSmrg	;;
773659607e0Smrg    3050*:HI-UX:*:*)
774370b807fSmrg	set_cc_for_build
775370b807fSmrg	sed 's/^	//' << EOF > "$dummy.c"
776659607e0Smrg	#include <unistd.h>
777659607e0Smrg	int
778659607e0Smrg	main ()
779659607e0Smrg	{
780659607e0Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
781659607e0Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
782659607e0Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
783659607e0Smrg	     results, however.  */
784659607e0Smrg	  if (CPU_IS_PA_RISC (cpu))
785659607e0Smrg	    {
786659607e0Smrg	      switch (cpu)
787659607e0Smrg		{
788659607e0Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
789659607e0Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
790659607e0Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
791659607e0Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
792659607e0Smrg		}
793659607e0Smrg	    }
794659607e0Smrg	  else if (CPU_IS_HP_MC68K (cpu))
795659607e0Smrg	    puts ("m68k-hitachi-hiuxwe2");
796659607e0Smrg	  else puts ("unknown-hitachi-hiuxwe2");
797659607e0Smrg	  exit (0);
798659607e0Smrg	}
799659607e0SmrgEOF
800370b807fSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801659607e0Smrg		{ echo "$SYSTEM_NAME"; exit; }
802370b807fSmrg	GUESS=unknown-hitachi-hiuxwe2
803370b807fSmrg	;;
804370b807fSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805370b807fSmrg	GUESS=hppa1.1-hp-bsd
806370b807fSmrg	;;
807659607e0Smrg    9000/8??:4.3bsd:*:*)
808370b807fSmrg	GUESS=hppa1.0-hp-bsd
809370b807fSmrg	;;
810659607e0Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811370b807fSmrg	GUESS=hppa1.0-hp-mpeix
812370b807fSmrg	;;
813370b807fSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814370b807fSmrg	GUESS=hppa1.1-hp-osf
815370b807fSmrg	;;
816659607e0Smrg    hp8??:OSF1:*:*)
817370b807fSmrg	GUESS=hppa1.0-hp-osf
818370b807fSmrg	;;
819659607e0Smrg    i*86:OSF1:*:*)
820370b807fSmrg	if test -x /usr/sbin/sysversion ; then
821370b807fSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
822659607e0Smrg	else
823370b807fSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
824659607e0Smrg	fi
825370b807fSmrg	;;
826659607e0Smrg    parisc*:Lites*:*:*)
827370b807fSmrg	GUESS=hppa1.1-hp-lites
828370b807fSmrg	;;
829659607e0Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830370b807fSmrg	GUESS=c1-convex-bsd
831370b807fSmrg	;;
832659607e0Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
833659607e0Smrg	if getsysinfo -f scalar_acc
834659607e0Smrg	then echo c32-convex-bsd
835659607e0Smrg	else echo c2-convex-bsd
836659607e0Smrg	fi
837a73597f9Smrg	exit ;;
838659607e0Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839370b807fSmrg	GUESS=c34-convex-bsd
840370b807fSmrg	;;
841659607e0Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842370b807fSmrg	GUESS=c38-convex-bsd
843370b807fSmrg	;;
844659607e0Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845370b807fSmrg	GUESS=c4-convex-bsd
846370b807fSmrg	;;
847659607e0Smrg    CRAY*Y-MP:*:*:*)
848370b807fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849370b807fSmrg	GUESS=ymp-cray-unicos$CRAY_REL
850370b807fSmrg	;;
851659607e0Smrg    CRAY*[A-Z]90:*:*:*)
852370b807fSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
853659607e0Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
854659607e0Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
855659607e0Smrg	      -e 's/\.[^.]*$/.X/'
856659607e0Smrg	exit ;;
857659607e0Smrg    CRAY*TS:*:*:*)
858370b807fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859370b807fSmrg	GUESS=t90-cray-unicos$CRAY_REL
860370b807fSmrg	;;
861659607e0Smrg    CRAY*T3E:*:*:*)
862370b807fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863370b807fSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864370b807fSmrg	;;
865659607e0Smrg    CRAY*SV1:*:*:*)
866370b807fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867370b807fSmrg	GUESS=sv1-cray-unicos$CRAY_REL
868370b807fSmrg	;;
869659607e0Smrg    *:UNICOS/mp:*:*)
870370b807fSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871370b807fSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872370b807fSmrg	;;
873659607e0Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874370b807fSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875370b807fSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876370b807fSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877370b807fSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878370b807fSmrg	;;
879659607e0Smrg    5000:UNIX_System_V:4.*:*)
880370b807fSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881370b807fSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882370b807fSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883370b807fSmrg	;;
884659607e0Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885370b807fSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886370b807fSmrg	;;
887659607e0Smrg    sparc*:BSD/OS:*:*)
888370b807fSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889370b807fSmrg	;;
890659607e0Smrg    *:BSD/OS:*:*)
891370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892370b807fSmrg	;;
893370b807fSmrg    arm:FreeBSD:*:*)
894370b807fSmrg	UNAME_PROCESSOR=`uname -p`
895370b807fSmrg	set_cc_for_build
896370b807fSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897370b807fSmrg	    | grep -q __ARM_PCS_VFP
898370b807fSmrg	then
899370b807fSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900370b807fSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901370b807fSmrg	else
902370b807fSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903370b807fSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904370b807fSmrg	fi
905370b807fSmrg	;;
906659607e0Smrg    *:FreeBSD:*:*)
907a73597f9Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908370b807fSmrg	case $UNAME_PROCESSOR in
909fc27e79cSmrg	    amd64)
910370b807fSmrg		UNAME_PROCESSOR=x86_64 ;;
911370b807fSmrg	    i386)
912370b807fSmrg		UNAME_PROCESSOR=i586 ;;
913fc27e79cSmrg	esac
914370b807fSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915370b807fSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916370b807fSmrg	;;
917659607e0Smrg    i*:CYGWIN*:*)
918370b807fSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
919370b807fSmrg	;;
920370b807fSmrg    *:MINGW64*:*)
921370b807fSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
922370b807fSmrg	;;
923fc27e79cSmrg    *:MINGW*:*)
924370b807fSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
925370b807fSmrg	;;
926370b807fSmrg    *:MSYS*:*)
927370b807fSmrg	GUESS=$UNAME_MACHINE-pc-msys
928370b807fSmrg	;;
929659607e0Smrg    i*:PW*:*)
930370b807fSmrg	GUESS=$UNAME_MACHINE-pc-pw32
931370b807fSmrg	;;
932b73be646Smrg    *:Interix*:*)
933370b807fSmrg	case $UNAME_MACHINE in
934fc27e79cSmrg	    x86)
935370b807fSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
936370b807fSmrg		;;
937b73be646Smrg	    authenticamd | genuineintel | EM64T)
938370b807fSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
939370b807fSmrg		;;
940fc27e79cSmrg	    IA64)
941370b807fSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
942370b807fSmrg		;;
943fc27e79cSmrg	esac ;;
944659607e0Smrg    i*:UWIN*:*)
945370b807fSmrg	GUESS=$UNAME_MACHINE-pc-uwin
946370b807fSmrg	;;
947659607e0Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948370b807fSmrg	GUESS=x86_64-pc-cygwin
949370b807fSmrg	;;
950659607e0Smrg    prep*:SunOS:5.*:*)
951370b807fSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952370b807fSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
953370b807fSmrg	;;
954659607e0Smrg    *:GNU:*:*)
955659607e0Smrg	# the GNU system
956370b807fSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957370b807fSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958370b807fSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959370b807fSmrg	;;
960659607e0Smrg    *:GNU/*:*:*)
961659607e0Smrg	# other systems with GNU libc and userland
962370b807fSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963370b807fSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965370b807fSmrg	;;
966370b807fSmrg    *:Minix:*:*)
967370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-minix
968370b807fSmrg	;;
969a73597f9Smrg    aarch64:Linux:*:*)
970370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971370b807fSmrg	;;
972a73597f9Smrg    aarch64_be:Linux:*:*)
973a73597f9Smrg	UNAME_MACHINE=aarch64_be
974370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975370b807fSmrg	;;
976b73be646Smrg    alpha:Linux:*:*)
977370b807fSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978b73be646Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979b73be646Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980b73be646Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981b73be646Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982b73be646Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983b73be646Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984b73be646Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
985a73597f9Smrg	esac
986b73be646Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
987370b807fSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989370b807fSmrg	;;
990370b807fSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992370b807fSmrg	;;
993659607e0Smrg    arm*:Linux:*:*)
994370b807fSmrg	set_cc_for_build
995fc27e79cSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996fc27e79cSmrg	    | grep -q __ARM_EABI__
997fc27e79cSmrg	then
998370b807fSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999fc27e79cSmrg	else
1000a73597f9Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1001a73597f9Smrg		| grep -q __ARM_PCS_VFP
1002a73597f9Smrg	    then
1003370b807fSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1004a73597f9Smrg	    else
1005370b807fSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1006a73597f9Smrg	    fi
1007fc27e79cSmrg	fi
1008370b807fSmrg	;;
1009fc27e79cSmrg    avr32*:Linux:*:*)
1010370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011370b807fSmrg	;;
1012659607e0Smrg    cris:Linux:*:*)
1013370b807fSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014370b807fSmrg	;;
1015659607e0Smrg    crisv32:Linux:*:*)
1016370b807fSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017370b807fSmrg	;;
1018370b807fSmrg    e2k:Linux:*:*)
1019370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020370b807fSmrg	;;
1021659607e0Smrg    frv:Linux:*:*)
1022370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023370b807fSmrg	;;
1024a73597f9Smrg    hexagon:Linux:*:*)
1025370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026370b807fSmrg	;;
1027b73be646Smrg    i*86:Linux:*:*)
1028370b807fSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029370b807fSmrg	;;
1030659607e0Smrg    ia64:Linux:*:*)
1031370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032370b807fSmrg	;;
1033370b807fSmrg    k1om:Linux:*:*)
1034370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035370b807fSmrg	;;
1036370b807fSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038370b807fSmrg	;;
1039659607e0Smrg    m32r*:Linux:*:*)
1040370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041370b807fSmrg	;;
1042659607e0Smrg    m68*:Linux:*:*)
1043370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044370b807fSmrg	;;
1045b73be646Smrg    mips:Linux:*:* | mips64:Linux:*:*)
1046370b807fSmrg	set_cc_for_build
1047370b807fSmrg	IS_GLIBC=0
1048370b807fSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049370b807fSmrg	sed 's/^	//' << EOF > "$dummy.c"
1050659607e0Smrg	#undef CPU
1051370b807fSmrg	#undef mips
1052370b807fSmrg	#undef mipsel
1053370b807fSmrg	#undef mips64
1054370b807fSmrg	#undef mips64el
1055370b807fSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1056370b807fSmrg	LIBCABI=gnuabi64
1057370b807fSmrg	#else
1058370b807fSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1059370b807fSmrg	LIBCABI=gnuabin32
1060370b807fSmrg	#else
1061370b807fSmrg	LIBCABI=${LIBC}
1062370b807fSmrg	#endif
1063370b807fSmrg	#endif
1064370b807fSmrg
1065370b807fSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1066370b807fSmrg	CPU=mipsisa64r6
1067370b807fSmrg	#else
1068370b807fSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069370b807fSmrg	CPU=mipsisa32r6
1070370b807fSmrg	#else
1071370b807fSmrg	#if defined(__mips64)
1072370b807fSmrg	CPU=mips64
1073370b807fSmrg	#else
1074370b807fSmrg	CPU=mips
1075370b807fSmrg	#endif
1076370b807fSmrg	#endif
1077370b807fSmrg	#endif
1078370b807fSmrg
1079659607e0Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1080370b807fSmrg	MIPS_ENDIAN=el
1081659607e0Smrg	#else
1082659607e0Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1083370b807fSmrg	MIPS_ENDIAN=
1084659607e0Smrg	#else
1085370b807fSmrg	MIPS_ENDIAN=
1086659607e0Smrg	#endif
1087659607e0Smrg	#endif
1088659607e0SmrgEOF
1089370b807fSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090370b807fSmrg	eval "$cc_set_vars"
1091370b807fSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092370b807fSmrg	;;
1093370b807fSmrg    mips64el:Linux:*:*)
1094370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1095370b807fSmrg	;;
1096370b807fSmrg    openrisc*:Linux:*:*)
1097370b807fSmrg	GUESS=or1k-unknown-linux-$LIBC
1098370b807fSmrg	;;
1099370b807fSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1100370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1101659607e0Smrg	;;
1102b73be646Smrg    padre:Linux:*:*)
1103370b807fSmrg	GUESS=sparc-unknown-linux-$LIBC
1104370b807fSmrg	;;
1105b73be646Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106370b807fSmrg	GUESS=hppa64-unknown-linux-$LIBC
1107370b807fSmrg	;;
1108659607e0Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
1109659607e0Smrg	# Look for CPU level
1110659607e0Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111370b807fSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112370b807fSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113370b807fSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1114659607e0Smrg	esac
1115370b807fSmrg	;;
1116b73be646Smrg    ppc64:Linux:*:*)
1117370b807fSmrg	GUESS=powerpc64-unknown-linux-$LIBC
1118370b807fSmrg	;;
1119b73be646Smrg    ppc:Linux:*:*)
1120370b807fSmrg	GUESS=powerpc-unknown-linux-$LIBC
1121370b807fSmrg	;;
1122370b807fSmrg    ppc64le:Linux:*:*)
1123370b807fSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
1124370b807fSmrg	;;
1125370b807fSmrg    ppcle:Linux:*:*)
1126370b807fSmrg	GUESS=powerpcle-unknown-linux-$LIBC
1127370b807fSmrg	;;
1128370b807fSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130370b807fSmrg	;;
1131659607e0Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1132370b807fSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133370b807fSmrg	;;
1134659607e0Smrg    sh64*:Linux:*:*)
1135370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136370b807fSmrg	;;
1137659607e0Smrg    sh*:Linux:*:*)
1138370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139370b807fSmrg	;;
1140659607e0Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1141370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142370b807fSmrg	;;
1143bd3a1963Smrg    tile*:Linux:*:*)
1144370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145370b807fSmrg	;;
1146659607e0Smrg    vax:Linux:*:*)
1147370b807fSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148370b807fSmrg	;;
1149659607e0Smrg    x86_64:Linux:*:*)
1150370b807fSmrg	set_cc_for_build
1151370b807fSmrg	LIBCABI=$LIBC
1152370b807fSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1153370b807fSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1154370b807fSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1155370b807fSmrg		grep IS_X32 >/dev/null
1156370b807fSmrg	    then
1157370b807fSmrg		LIBCABI=${LIBC}x32
1158370b807fSmrg	    fi
1159370b807fSmrg	fi
1160370b807fSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161370b807fSmrg	;;
1162fc27e79cSmrg    xtensa*:Linux:*:*)
1163370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164370b807fSmrg	;;
1165659607e0Smrg    i*86:DYNIX/ptx:4*:*)
1166659607e0Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1167659607e0Smrg	# earlier versions are messed up and put the nodename in both
1168659607e0Smrg	# sysname and nodename.
1169370b807fSmrg	GUESS=i386-sequent-sysv4
1170370b807fSmrg	;;
1171659607e0Smrg    i*86:UNIX_SV:4.2MP:2.*)
1172a73597f9Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1173a73597f9Smrg	# number series starting with 2...
1174a73597f9Smrg	# I am not positive that other SVR4 systems won't match this,
1175659607e0Smrg	# I just have to hope.  -- rms.
1176a73597f9Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1177370b807fSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178370b807fSmrg	;;
1179659607e0Smrg    i*86:OS/2:*:*)
1180659607e0Smrg	# If we were able to find `uname', then EMX Unix compatibility
1181659607e0Smrg	# is probably installed.
1182370b807fSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1183370b807fSmrg	;;
1184659607e0Smrg    i*86:XTS-300:*:STOP)
1185370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-stop
1186370b807fSmrg	;;
1187659607e0Smrg    i*86:atheos:*:*)
1188370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
1189370b807fSmrg	;;
1190659607e0Smrg    i*86:syllable:*:*)
1191370b807fSmrg	GUESS=$UNAME_MACHINE-pc-syllable
1192370b807fSmrg	;;
1193b73be646Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194370b807fSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195370b807fSmrg	;;
1196659607e0Smrg    i*86:*DOS:*:*)
1197370b807fSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198370b807fSmrg	;;
1199370b807fSmrg    i*86:*:4.*:*)
1200370b807fSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1201659607e0Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202370b807fSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1203659607e0Smrg	else
1204370b807fSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1205659607e0Smrg	fi
1206370b807fSmrg	;;
1207659607e0Smrg    i*86:*:5:[678]*)
1208a73597f9Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1209659607e0Smrg	case `/bin/uname -X | grep "^Machine"` in
1210659607e0Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1211659607e0Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1212659607e0Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1213659607e0Smrg	esac
1214370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215370b807fSmrg	;;
1216659607e0Smrg    i*86:*:3.2:*)
1217659607e0Smrg	if test -f /usr/options/cb.name; then
1218659607e0Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219370b807fSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
1220659607e0Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1221659607e0Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1222659607e0Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1223659607e0Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1224659607e0Smrg			&& UNAME_MACHINE=i586
1225659607e0Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1226659607e0Smrg			&& UNAME_MACHINE=i686
1227659607e0Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1228659607e0Smrg			&& UNAME_MACHINE=i686
1229370b807fSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
1230659607e0Smrg	else
1231370b807fSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
1232659607e0Smrg	fi
1233370b807fSmrg	;;
1234659607e0Smrg    pc:*:*:*)
1235659607e0Smrg	# Left here for compatibility:
1236a73597f9Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1237a73597f9Smrg	# the processor, so we play safe by assuming i586.
1238b73be646Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1239370b807fSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1240b73be646Smrg	# this is a cross-build.
1241370b807fSmrg	GUESS=i586-pc-msdosdjgpp
1242370b807fSmrg	;;
1243659607e0Smrg    Intel:Mach:3*:*)
1244370b807fSmrg	GUESS=i386-pc-mach3
1245370b807fSmrg	;;
1246659607e0Smrg    paragon:*:*:*)
1247370b807fSmrg	GUESS=i860-intel-osf1
1248370b807fSmrg	;;
1249659607e0Smrg    i860:*:4.*:*) # i860-SVR4
1250659607e0Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251370b807fSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
1252659607e0Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1253370b807fSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
1254659607e0Smrg	fi
1255370b807fSmrg	;;
1256659607e0Smrg    mini*:CTIX:SYS*5:*)
1257659607e0Smrg	# "miniframe"
1258370b807fSmrg	GUESS=m68010-convergent-sysv
1259370b807fSmrg	;;
1260659607e0Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1261370b807fSmrg	GUESS=m68k-convergent-sysv
1262370b807fSmrg	;;
1263659607e0Smrg    M680?0:D-NIX:5.3:*)
1264370b807fSmrg	GUESS=m68k-diab-dnix
1265370b807fSmrg	;;
1266659607e0Smrg    M68*:*:R3V[5678]*:*)
1267659607e0Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1268659607e0Smrg    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)
1269659607e0Smrg	OS_REL=''
1270659607e0Smrg	test -r /etc/.relid \
1271659607e0Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1272659607e0Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273370b807fSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1274659607e0Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275370b807fSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1276659607e0Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1277a73597f9Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1278a73597f9Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1279b73be646Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280b73be646Smrg	OS_REL='.3'
1281b73be646Smrg	test -r /etc/.relid \
1282b73be646Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283b73be646Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284370b807fSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285b73be646Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286370b807fSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287b73be646Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288370b807fSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1289659607e0Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290370b807fSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291370b807fSmrg	;;
1292659607e0Smrg    mc68030:UNIX_System_V:4.*:*)
1293370b807fSmrg	GUESS=m68k-atari-sysv4
1294370b807fSmrg	;;
1295659607e0Smrg    TSUNAMI:LynxOS:2.*:*)
1296370b807fSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297370b807fSmrg	;;
1298659607e0Smrg    rs6000:LynxOS:2.*:*)
1299370b807fSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300370b807fSmrg	;;
1301b73be646Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302370b807fSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303370b807fSmrg	;;
1304659607e0Smrg    SM[BE]S:UNIX_SV:*:*)
1305370b807fSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1306370b807fSmrg	;;
1307659607e0Smrg    RM*:ReliantUNIX-*:*:*)
1308370b807fSmrg	GUESS=mips-sni-sysv4
1309370b807fSmrg	;;
1310659607e0Smrg    RM*:SINIX-*:*:*)
1311370b807fSmrg	GUESS=mips-sni-sysv4
1312370b807fSmrg	;;
1313659607e0Smrg    *:SINIX-*:*:*)
1314659607e0Smrg	if uname -p 2>/dev/null >/dev/null ; then
1315659607e0Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316370b807fSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
1317659607e0Smrg	else
1318370b807fSmrg		GUESS=ns32k-sni-sysv
1319659607e0Smrg	fi
1320370b807fSmrg	;;
1321a73597f9Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1322a73597f9Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1323370b807fSmrg	GUESS=i586-unisys-sysv4
1324370b807fSmrg	;;
1325659607e0Smrg    *:UNIX_System_V:4*:FTX*)
1326659607e0Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1327659607e0Smrg	# How about differentiating between stratus architectures? -djm
1328370b807fSmrg	GUESS=hppa1.1-stratus-sysv4
1329370b807fSmrg	;;
1330659607e0Smrg    *:*:*:FTX*)
1331659607e0Smrg	# From seanf@swdc.stratus.com.
1332370b807fSmrg	GUESS=i860-stratus-sysv4
1333370b807fSmrg	;;
1334659607e0Smrg    i*86:VOS:*:*)
1335659607e0Smrg	# From Paul.Green@stratus.com.
1336370b807fSmrg	GUESS=$UNAME_MACHINE-stratus-vos
1337370b807fSmrg	;;
1338659607e0Smrg    *:VOS:*:*)
1339659607e0Smrg	# From Paul.Green@stratus.com.
1340370b807fSmrg	GUESS=hppa1.1-stratus-vos
1341370b807fSmrg	;;
1342659607e0Smrg    mc68*:A/UX:*:*)
1343370b807fSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1344370b807fSmrg	;;
1345659607e0Smrg    news*:NEWS-OS:6*:*)
1346370b807fSmrg	GUESS=mips-sony-newsos6
1347370b807fSmrg	;;
1348659607e0Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1349370b807fSmrg	if test -d /usr/nec; then
1350370b807fSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
1351659607e0Smrg	else
1352370b807fSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
1353659607e0Smrg	fi
1354370b807fSmrg	;;
1355659607e0Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1356370b807fSmrg	GUESS=powerpc-be-beos
1357370b807fSmrg	;;
1358659607e0Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1359370b807fSmrg	GUESS=powerpc-apple-beos
1360370b807fSmrg	;;
1361659607e0Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1362370b807fSmrg	GUESS=i586-pc-beos
1363370b807fSmrg	;;
1364b73be646Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1365370b807fSmrg	GUESS=i586-pc-haiku
1366370b807fSmrg	;;
1367370b807fSmrg    x86_64:Haiku:*:*)
1368370b807fSmrg	GUESS=x86_64-unknown-haiku
1369370b807fSmrg	;;
1370659607e0Smrg    SX-4:SUPER-UX:*:*)
1371370b807fSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1372370b807fSmrg	;;
1373659607e0Smrg    SX-5:SUPER-UX:*:*)
1374370b807fSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1375370b807fSmrg	;;
1376659607e0Smrg    SX-6:SUPER-UX:*:*)
1377370b807fSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1378370b807fSmrg	;;
1379fc27e79cSmrg    SX-7:SUPER-UX:*:*)
1380370b807fSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1381370b807fSmrg	;;
1382fc27e79cSmrg    SX-8:SUPER-UX:*:*)
1383370b807fSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1384370b807fSmrg	;;
1385fc27e79cSmrg    SX-8R:SUPER-UX:*:*)
1386370b807fSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1387370b807fSmrg	;;
1388370b807fSmrg    SX-ACE:SUPER-UX:*:*)
1389370b807fSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1390370b807fSmrg	;;
1391659607e0Smrg    Power*:Rhapsody:*:*)
1392370b807fSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393370b807fSmrg	;;
1394659607e0Smrg    *:Rhapsody:*:*)
1395370b807fSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396370b807fSmrg	;;
1397370b807fSmrg    arm64:Darwin:*:*)
1398370b807fSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399370b807fSmrg	;;
1400659607e0Smrg    *:Darwin:*:*)
1401370b807fSmrg	UNAME_PROCESSOR=`uname -p`
1402e4da38afSmrg	case $UNAME_PROCESSOR in
1403e4da38afSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1404e4da38afSmrg	esac
1405370b807fSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1406370b807fSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407370b807fSmrg	    # Avoid executing cc if there is no toolchain installed as
1408370b807fSmrg	    # cc will be a stub that puts up a graphical alert
1409370b807fSmrg	    # prompting the user to install developer tools.
1410370b807fSmrg	    CC_FOR_BUILD=no_compiler_found
1411370b807fSmrg	else
1412370b807fSmrg	    set_cc_for_build
1413370b807fSmrg	fi
1414370b807fSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1415370b807fSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416370b807fSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417370b807fSmrg		   grep IS_64BIT_ARCH >/dev/null
1418370b807fSmrg	    then
1419370b807fSmrg		case $UNAME_PROCESSOR in
1420370b807fSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1421370b807fSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1422370b807fSmrg		esac
1423370b807fSmrg	    fi
1424370b807fSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425370b807fSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426370b807fSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427370b807fSmrg		   grep IS_PPC >/dev/null
1428370b807fSmrg	    then
1429370b807fSmrg		UNAME_PROCESSOR=powerpc
1430370b807fSmrg	    fi
1431370b807fSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1432370b807fSmrg	    # uname -m returns i386 or x86_64
1433370b807fSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1434370b807fSmrg	fi
1435370b807fSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436370b807fSmrg	;;
1437659607e0Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1438659607e0Smrg	UNAME_PROCESSOR=`uname -p`
1439370b807fSmrg	if test "$UNAME_PROCESSOR" = x86; then
1440659607e0Smrg		UNAME_PROCESSOR=i386
1441659607e0Smrg		UNAME_MACHINE=pc
1442659607e0Smrg	fi
1443370b807fSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444370b807fSmrg	;;
1445659607e0Smrg    *:QNX:*:4*)
1446370b807fSmrg	GUESS=i386-pc-qnx
1447370b807fSmrg	;;
1448370b807fSmrg    NEO-*:NONSTOP_KERNEL:*:*)
1449370b807fSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1450370b807fSmrg	;;
1451a73597f9Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1452370b807fSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1453370b807fSmrg	;;
1454370b807fSmrg    NSR-*:NONSTOP_KERNEL:*:*)
1455370b807fSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456370b807fSmrg	;;
1457370b807fSmrg    NSV-*:NONSTOP_KERNEL:*:*)
1458370b807fSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459370b807fSmrg	;;
1460370b807fSmrg    NSX-*:NONSTOP_KERNEL:*:*)
1461370b807fSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462370b807fSmrg	;;
1463659607e0Smrg    *:NonStop-UX:*:*)
1464370b807fSmrg	GUESS=mips-compaq-nonstopux
1465370b807fSmrg	;;
1466659607e0Smrg    BS2000:POSIX*:*:*)
1467370b807fSmrg	GUESS=bs2000-siemens-sysv
1468370b807fSmrg	;;
1469659607e0Smrg    DS/*:UNIX_System_V:*:*)
1470370b807fSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471370b807fSmrg	;;
1472659607e0Smrg    *:Plan9:*:*)
1473659607e0Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1474659607e0Smrg	# is converted to i386 for consistency with other x86
1475659607e0Smrg	# operating systems.
1476370b807fSmrg	if test "${cputype-}" = 386; then
1477659607e0Smrg	    UNAME_MACHINE=i386
1478370b807fSmrg	elif test "x${cputype-}" != x; then
1479370b807fSmrg	    UNAME_MACHINE=$cputype
1480659607e0Smrg	fi
1481370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
1482370b807fSmrg	;;
1483659607e0Smrg    *:TOPS-10:*:*)
1484370b807fSmrg	GUESS=pdp10-unknown-tops10
1485370b807fSmrg	;;
1486659607e0Smrg    *:TENEX:*:*)
1487370b807fSmrg	GUESS=pdp10-unknown-tenex
1488370b807fSmrg	;;
1489659607e0Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490370b807fSmrg	GUESS=pdp10-dec-tops20
1491370b807fSmrg	;;
1492659607e0Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493370b807fSmrg	GUESS=pdp10-xkl-tops20
1494370b807fSmrg	;;
1495659607e0Smrg    *:TOPS-20:*:*)
1496370b807fSmrg	GUESS=pdp10-unknown-tops20
1497370b807fSmrg	;;
1498659607e0Smrg    *:ITS:*:*)
1499370b807fSmrg	GUESS=pdp10-unknown-its
1500370b807fSmrg	;;
1501659607e0Smrg    SEI:*:*:SEIUX)
1502370b807fSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1503370b807fSmrg	;;
1504659607e0Smrg    *:DragonFly:*:*)
1505370b807fSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507370b807fSmrg	;;
1508659607e0Smrg    *:*VMS:*:*)
1509a73597f9Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510370b807fSmrg	case $UNAME_MACHINE in
1511370b807fSmrg	    A*) GUESS=alpha-dec-vms ;;
1512370b807fSmrg	    I*) GUESS=ia64-dec-vms ;;
1513370b807fSmrg	    V*) GUESS=vax-dec-vms ;;
1514659607e0Smrg	esac ;;
1515659607e0Smrg    *:XENIX:*:SysV)
1516370b807fSmrg	GUESS=i386-pc-xenix
1517370b807fSmrg	;;
1518659607e0Smrg    i*86:skyos:*:*)
1519370b807fSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520370b807fSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521370b807fSmrg	;;
1522659607e0Smrg    i*86:rdos:*:*)
1523370b807fSmrg	GUESS=$UNAME_MACHINE-pc-rdos
1524370b807fSmrg	;;
1525370b807fSmrg    *:AROS:*:*)
1526370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-aros
1527370b807fSmrg	;;
1528a73597f9Smrg    x86_64:VMkernel:*:*)
1529370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-esx
1530370b807fSmrg	;;
1531370b807fSmrg    amd64:Isilon\ OneFS:*:*)
1532370b807fSmrg	GUESS=x86_64-unknown-onefs
1533370b807fSmrg	;;
1534370b807fSmrg    *:Unleashed:*:*)
1535370b807fSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1536370b807fSmrg	;;
1537659607e0Smrgesac
1538659607e0Smrg
1539370b807fSmrg# Do we have a guess based on uname results?
1540370b807fSmrgif test "x$GUESS" != x; then
1541370b807fSmrg    echo "$GUESS"
1542370b807fSmrg    exit
1543370b807fSmrgfi
1544e4da38afSmrg
1545370b807fSmrg# No uname command or uname output not recognized.
1546370b807fSmrgset_cc_for_build
1547370b807fSmrgcat > "$dummy.c" <<EOF
1548659607e0Smrg#ifdef _SEQUENT_
1549370b807fSmrg#include <sys/types.h>
1550370b807fSmrg#include <sys/utsname.h>
1551370b807fSmrg#endif
1552370b807fSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1553370b807fSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1554370b807fSmrg#include <signal.h>
1555370b807fSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1556370b807fSmrg#include <sys/utsname.h>
1557370b807fSmrg#endif
1558370b807fSmrg#endif
1559659607e0Smrg#endif
1560659607e0Smrgmain ()
1561659607e0Smrg{
1562659607e0Smrg#if defined (sony)
1563659607e0Smrg#if defined (MIPSEB)
1564659607e0Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1565659607e0Smrg     I don't know....  */
1566659607e0Smrg  printf ("mips-sony-bsd\n"); exit (0);
1567659607e0Smrg#else
1568659607e0Smrg#include <sys/param.h>
1569659607e0Smrg  printf ("m68k-sony-newsos%s\n",
1570659607e0Smrg#ifdef NEWSOS4
1571370b807fSmrg  "4"
1572659607e0Smrg#else
1573370b807fSmrg  ""
1574659607e0Smrg#endif
1575370b807fSmrg  ); exit (0);
1576659607e0Smrg#endif
1577659607e0Smrg#endif
1578659607e0Smrg
1579659607e0Smrg#if defined (NeXT)
1580659607e0Smrg#if !defined (__ARCHITECTURE__)
1581659607e0Smrg#define __ARCHITECTURE__ "m68k"
1582659607e0Smrg#endif
1583659607e0Smrg  int version;
1584659607e0Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1585659607e0Smrg  if (version < 4)
1586659607e0Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1587659607e0Smrg  else
1588659607e0Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1589659607e0Smrg  exit (0);
1590659607e0Smrg#endif
1591659607e0Smrg
1592659607e0Smrg#if defined (MULTIMAX) || defined (n16)
1593659607e0Smrg#if defined (UMAXV)
1594659607e0Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1595659607e0Smrg#else
1596659607e0Smrg#if defined (CMU)
1597659607e0Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1598659607e0Smrg#else
1599659607e0Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1600659607e0Smrg#endif
1601659607e0Smrg#endif
1602659607e0Smrg#endif
1603659607e0Smrg
1604659607e0Smrg#if defined (__386BSD__)
1605659607e0Smrg  printf ("i386-pc-bsd\n"); exit (0);
1606659607e0Smrg#endif
1607659607e0Smrg
1608659607e0Smrg#if defined (sequent)
1609659607e0Smrg#if defined (i386)
1610659607e0Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1611659607e0Smrg#endif
1612659607e0Smrg#if defined (ns32000)
1613659607e0Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1614659607e0Smrg#endif
1615659607e0Smrg#endif
1616659607e0Smrg
1617659607e0Smrg#if defined (_SEQUENT_)
1618370b807fSmrg  struct utsname un;
1619659607e0Smrg
1620370b807fSmrg  uname(&un);
1621370b807fSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1622370b807fSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1623370b807fSmrg  }
1624370b807fSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1625370b807fSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1626370b807fSmrg  }
1627370b807fSmrg  printf ("i386-sequent-ptx\n"); exit (0);
1628659607e0Smrg#endif
1629659607e0Smrg
1630659607e0Smrg#if defined (vax)
1631370b807fSmrg#if !defined (ultrix)
1632370b807fSmrg#include <sys/param.h>
1633370b807fSmrg#if defined (BSD)
1634370b807fSmrg#if BSD == 43
1635370b807fSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1636370b807fSmrg#else
1637370b807fSmrg#if BSD == 199006
1638370b807fSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1639370b807fSmrg#else
1640370b807fSmrg  printf ("vax-dec-bsd\n"); exit (0);
1641370b807fSmrg#endif
1642370b807fSmrg#endif
1643370b807fSmrg#else
1644370b807fSmrg  printf ("vax-dec-bsd\n"); exit (0);
1645370b807fSmrg#endif
1646370b807fSmrg#else
1647370b807fSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1648370b807fSmrg  struct utsname un;
1649370b807fSmrg  uname (&un);
1650370b807fSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1651370b807fSmrg#else
1652370b807fSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1653370b807fSmrg#endif
1654370b807fSmrg#endif
1655370b807fSmrg#endif
1656370b807fSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1657370b807fSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1658370b807fSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1659370b807fSmrg  struct utsname *un;
1660370b807fSmrg  uname (&un);
1661370b807fSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1662370b807fSmrg#else
1663370b807fSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1664370b807fSmrg#endif
1665370b807fSmrg#endif
1666659607e0Smrg#endif
1667659607e0Smrg
1668659607e0Smrg#if defined (alliant) && defined (i860)
1669659607e0Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1670659607e0Smrg#endif
1671659607e0Smrg
1672659607e0Smrg  exit (1);
1673659607e0Smrg}
1674659607e0SmrgEOF
1675659607e0Smrg
1676370b807fSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1677659607e0Smrg	{ echo "$SYSTEM_NAME"; exit; }
1678659607e0Smrg
1679659607e0Smrg# Apollos put the system type in the environment.
1680370b807fSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1681659607e0Smrg
1682370b807fSmrgecho "$0: unable to guess system type" >&2
1683659607e0Smrg
1684370b807fSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685370b807fSmrg    mips:Linux | mips64:Linux)
1686370b807fSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1687370b807fSmrg	cat >&2 <<EOF
1688659607e0Smrg
1689370b807fSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690370b807fSmrgthe system type. Please install a C compiler and try again.
1691370b807fSmrgEOF
1692370b807fSmrg	;;
1693370b807fSmrgesac
1694659607e0Smrg
1695659607e0Smrgcat >&2 <<EOF
1696659607e0Smrg
1697370b807fSmrgThis script (version $timestamp), has failed to recognize the
1698370b807fSmrgoperating system you are using. If your script is old, overwrite *all*
1699370b807fSmrgcopies of config.guess and config.sub with the latest versions from:
1700659607e0Smrg
1701370b807fSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1702659607e0Smrgand
1703370b807fSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1704370b807fSmrgEOF
1705659607e0Smrg
1706370b807fSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
1707370b807fSmrgthisyear=`date +%Y`
1708370b807fSmrg# shellcheck disable=SC2003
1709370b807fSmrgscript_age=`expr "$thisyear" - "$our_year"`
1710370b807fSmrgif test "$script_age" -lt 3 ; then
1711370b807fSmrg   cat >&2 <<EOF
1712370b807fSmrg
1713370b807fSmrgIf $0 has already been updated, send the following data and any
1714370b807fSmrginformation you think might be pertinent to config-patches@gnu.org to
1715370b807fSmrgprovide the necessary information to handle your system.
1716659607e0Smrg
1717659607e0Smrgconfig.guess timestamp = $timestamp
1718659607e0Smrg
1719659607e0Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1720659607e0Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1721659607e0Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1722659607e0Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1723659607e0Smrg
1724659607e0Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1725659607e0Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1726659607e0Smrg
1727659607e0Smrghostinfo               = `(hostinfo) 2>/dev/null`
1728659607e0Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1729659607e0Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1730659607e0Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1731659607e0Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1732659607e0Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1733659607e0Smrg
1734370b807fSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735370b807fSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736370b807fSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737370b807fSmrgUNAME_VERSION = "$UNAME_VERSION"
1738659607e0SmrgEOF
1739370b807fSmrgfi
1740659607e0Smrg
1741659607e0Smrgexit 1
1742659607e0Smrg
1743659607e0Smrg# Local variables:
1744370b807fSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
1745659607e0Smrg# time-stamp-start: "timestamp='"
1746659607e0Smrg# time-stamp-format: "%:y-%02m-%02d"
1747659607e0Smrg# time-stamp-end: "'"
1748659607e0Smrg# End:
1749