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