xref: /freebsd/contrib/tcpdump/config.guess (revision ee67461e56828dd1f8de165947ba83f6d9148a87)
14edb46e9SPaul Traina#! /bin/sh
24edb46e9SPaul Traina# Attempt to guess a canonical system name.
3*ee67461eSJoseph Mingrone#   Copyright 1992-2023 Free Software Foundation, Inc.
4685295f4SBill Fenner
5*ee67461eSJoseph Mingrone# shellcheck disable=SC2006,SC2268 # see below for rationale
6*ee67461eSJoseph Mingrone
7*ee67461eSJoseph Mingronetimestamp='2023-01-01'
8685295f4SBill Fenner
94edb46e9SPaul Traina# This file is free software; you can redistribute it and/or modify it
104edb46e9SPaul Traina# under the terms of the GNU General Public License as published by
11*ee67461eSJoseph Mingrone# the Free Software Foundation, either version 3 of the License, or
124edb46e9SPaul Traina# (at your option) any later version.
134edb46e9SPaul Traina#
144edb46e9SPaul Traina# This program is distributed in the hope that it will be useful, but
154edb46e9SPaul Traina# WITHOUT ANY WARRANTY; without even the implied warranty of
164edb46e9SPaul Traina# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
174edb46e9SPaul Traina# General Public License for more details.
184edb46e9SPaul Traina#
194edb46e9SPaul Traina# You should have received a copy of the GNU General Public License
2039e421e8SCy Schubert# along with this program; if not, see <https://www.gnu.org/licenses/>.
214edb46e9SPaul Traina#
224edb46e9SPaul Traina# As a special exception to the GNU General Public License, if you
234edb46e9SPaul Traina# distribute this file as part of a program that contains a
244edb46e9SPaul Traina# configuration script generated by Autoconf, you may include it under
258bdc5a62SPatrick Kelsey# the same distribution terms that you use for the rest of that
268bdc5a62SPatrick Kelsey# program.  This Exception is an additional permission under section 7
278bdc5a62SPatrick Kelsey# of the GNU General Public License, version 3 ("GPLv3").
284edb46e9SPaul Traina#
298bdc5a62SPatrick Kelsey# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
304edb46e9SPaul Traina#
3127df3f5dSRui Paulo# You can get the latest version of this script from:
32*ee67461eSJoseph Mingrone# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
338bdc5a62SPatrick Kelsey#
348bdc5a62SPatrick Kelsey# Please send patches to <config-patches@gnu.org>.
358bdc5a62SPatrick Kelsey
364edb46e9SPaul Traina
37*ee67461eSJoseph Mingrone# The "shellcheck disable" line above the timestamp inhibits complaints
38*ee67461eSJoseph Mingrone# about features and limitations of the classic Bourne shell that were
39*ee67461eSJoseph Mingrone# superseded or lifted in POSIX.  However, this script identifies a wide
40*ee67461eSJoseph Mingrone# variety of pre-POSIX systems that do not have POSIX shells at all, and
41*ee67461eSJoseph Mingrone# even some reasonably current systems (Solaris 10 as case-in-point) still
42*ee67461eSJoseph Mingrone# have a pre-POSIX /bin/sh.
43*ee67461eSJoseph Mingrone
44*ee67461eSJoseph Mingrone
45685295f4SBill Fennerme=`echo "$0" | sed -e 's,.*/,,'`
46685295f4SBill Fenner
47685295f4SBill Fennerusage="\
48685295f4SBill FennerUsage: $0 [OPTION]
49685295f4SBill Fenner
50685295f4SBill FennerOutput the configuration name of the system \`$me' is run on.
51685295f4SBill Fenner
5239e421e8SCy SchubertOptions:
53685295f4SBill Fenner  -h, --help         print this help, then exit
54685295f4SBill Fenner  -t, --time-stamp   print date of last modification, then exit
55685295f4SBill Fenner  -v, --version      print version number, then exit
56685295f4SBill Fenner
57685295f4SBill FennerReport bugs and patches to <config-patches@gnu.org>."
58685295f4SBill Fenner
59685295f4SBill Fennerversion="\
60685295f4SBill FennerGNU config.guess ($timestamp)
61685295f4SBill Fenner
62685295f4SBill FennerOriginally written by Per Bothner.
63*ee67461eSJoseph MingroneCopyright 1992-2023 Free Software Foundation, Inc.
64685295f4SBill Fenner
65685295f4SBill FennerThis is free software; see the source for copying conditions.  There is NO
66685295f4SBill Fennerwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
67685295f4SBill Fenner
68685295f4SBill Fennerhelp="
69685295f4SBill FennerTry \`$me --help' for more information."
70685295f4SBill Fenner
71685295f4SBill Fenner# Parse command line
72685295f4SBill Fennerwhile test $# -gt 0 ; do
73685295f4SBill Fenner  case $1 in
74685295f4SBill Fenner    --time-stamp | --time* | -t )
7527df3f5dSRui Paulo       echo "$timestamp" ; exit ;;
76685295f4SBill Fenner    --version | -v )
7727df3f5dSRui Paulo       echo "$version" ; exit ;;
78685295f4SBill Fenner    --help | --h* | -h )
7927df3f5dSRui Paulo       echo "$usage"; exit ;;
80685295f4SBill Fenner    -- )     # Stop option processing
81685295f4SBill Fenner       shift; break ;;
82685295f4SBill Fenner    - )	# Use stdin as input.
83685295f4SBill Fenner       break ;;
84685295f4SBill Fenner    -* )
85685295f4SBill Fenner       echo "$me: invalid option $1$help" >&2
86685295f4SBill Fenner       exit 1 ;;
87685295f4SBill Fenner    * )
88685295f4SBill Fenner       break ;;
89685295f4SBill Fenner  esac
90685295f4SBill Fennerdone
91685295f4SBill Fenner
92685295f4SBill Fennerif test $# != 0; then
93685295f4SBill Fenner  echo "$me: too many arguments$help" >&2
94685295f4SBill Fenner  exit 1
95685295f4SBill Fennerfi
96685295f4SBill Fenner
97*ee67461eSJoseph Mingrone# Just in case it came from the environment.
98*ee67461eSJoseph MingroneGUESS=
99685295f4SBill Fenner
1005b0fe478SBruce M Simpson# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1015b0fe478SBruce M Simpson# compiler to aid in system detection is discouraged as it requires
1025b0fe478SBruce M Simpson# temporary files to be created and, as you can see below, it is a
1035b0fe478SBruce M Simpson# headache to deal with in a portable fashion.
104685295f4SBill Fenner
105685295f4SBill Fenner# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
106685295f4SBill Fenner# use `HOST_CC' if defined, but it is deprecated.
107685295f4SBill Fenner
1085b0fe478SBruce M Simpson# Portable tmp directory creation inspired by the Autoconf team.
1095b0fe478SBruce M Simpson
110*ee67461eSJoseph Mingronetmp=
111*ee67461eSJoseph Mingrone# shellcheck disable=SC2172
112*ee67461eSJoseph Mingronetrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113*ee67461eSJoseph Mingrone
114*ee67461eSJoseph Mingroneset_cc_for_build() {
115*ee67461eSJoseph Mingrone    # prevent multiple calls if $tmp is already set
116*ee67461eSJoseph Mingrone    test "$tmp" && return 0
117*ee67461eSJoseph Mingrone    : "${TMPDIR=/tmp}"
118*ee67461eSJoseph Mingrone    # shellcheck disable=SC2039,SC3028
11927df3f5dSRui Paulo    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120*ee67461eSJoseph Mingrone	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121*ee67461eSJoseph Mingrone	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122*ee67461eSJoseph Mingrone	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123*ee67461eSJoseph Mingrone    dummy=$tmp/dummy
12439e421e8SCy Schubert    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125*ee67461eSJoseph Mingrone	,,)    echo "int x;" > "$dummy.c"
126*ee67461eSJoseph Mingrone	       for driver in cc gcc c89 c99 ; do
127*ee67461eSJoseph Mingrone		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128*ee67461eSJoseph Mingrone		       CC_FOR_BUILD=$driver
129*ee67461eSJoseph Mingrone		       break
130*ee67461eSJoseph Mingrone		   fi
131*ee67461eSJoseph Mingrone	       done
132685295f4SBill Fenner	       if test x"$CC_FOR_BUILD" = x ; then
133*ee67461eSJoseph Mingrone		   CC_FOR_BUILD=no_compiler_found
134685295f4SBill Fenner	       fi
135685295f4SBill Fenner	       ;;
136685295f4SBill Fenner	,,*)   CC_FOR_BUILD=$CC ;;
137685295f4SBill Fenner	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138*ee67461eSJoseph Mingrone    esac
139*ee67461eSJoseph Mingrone}
140685295f4SBill Fenner
1414edb46e9SPaul Traina# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1425b0fe478SBruce M Simpson# (ghazi@noc.rutgers.edu 1994-08-24)
143*ee67461eSJoseph Mingroneif test -f /.attbin/uname ; then
1444edb46e9SPaul Traina	PATH=$PATH:/.attbin ; export PATH
1454edb46e9SPaul Trainafi
1464edb46e9SPaul Traina
1474edb46e9SPaul TrainaUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1484edb46e9SPaul TrainaUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1494edb46e9SPaul TrainaUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1504edb46e9SPaul TrainaUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1514edb46e9SPaul Traina
152*ee67461eSJoseph Mingronecase $UNAME_SYSTEM in
1538bdc5a62SPatrick KelseyLinux|GNU|GNU/*)
154*ee67461eSJoseph Mingrone	LIBC=unknown
1558bdc5a62SPatrick Kelsey
156*ee67461eSJoseph Mingrone	set_cc_for_build
15739e421e8SCy Schubert	cat <<-EOF > "$dummy.c"
1588bdc5a62SPatrick Kelsey	#include <features.h>
1598bdc5a62SPatrick Kelsey	#if defined(__UCLIBC__)
1608bdc5a62SPatrick Kelsey	LIBC=uclibc
1618bdc5a62SPatrick Kelsey	#elif defined(__dietlibc__)
1628bdc5a62SPatrick Kelsey	LIBC=dietlibc
163*ee67461eSJoseph Mingrone	#elif defined(__GLIBC__)
1648bdc5a62SPatrick Kelsey	LIBC=gnu
165*ee67461eSJoseph Mingrone	#else
166*ee67461eSJoseph Mingrone	#include <stdarg.h>
167*ee67461eSJoseph Mingrone	/* First heuristic to detect musl libc.  */
168*ee67461eSJoseph Mingrone	#ifdef __DEFINED_va_list
169*ee67461eSJoseph Mingrone	LIBC=musl
170*ee67461eSJoseph Mingrone	#endif
1718bdc5a62SPatrick Kelsey	#endif
1728bdc5a62SPatrick Kelsey	EOF
173*ee67461eSJoseph Mingrone	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174*ee67461eSJoseph Mingrone	eval "$cc_set_libc"
17539e421e8SCy Schubert
176*ee67461eSJoseph Mingrone	# Second heuristic to detect musl libc.
177*ee67461eSJoseph Mingrone	if [ "$LIBC" = unknown ] &&
178*ee67461eSJoseph Mingrone	   command -v ldd >/dev/null &&
179*ee67461eSJoseph Mingrone	   ldd --version 2>&1 | grep -q ^musl; then
18039e421e8SCy Schubert		LIBC=musl
18139e421e8SCy Schubert	fi
182*ee67461eSJoseph Mingrone
183*ee67461eSJoseph Mingrone	# If the system lacks a compiler, then just pick glibc.
184*ee67461eSJoseph Mingrone	# We could probably try harder.
185*ee67461eSJoseph Mingrone	if [ "$LIBC" = unknown ]; then
186*ee67461eSJoseph Mingrone		LIBC=gnu
187*ee67461eSJoseph Mingrone	fi
1888bdc5a62SPatrick Kelsey	;;
1898bdc5a62SPatrick Kelseyesac
1908bdc5a62SPatrick Kelsey
1914edb46e9SPaul Traina# Note: order is significant - the case branches are not exclusive.
1924edb46e9SPaul Traina
193*ee67461eSJoseph Mingronecase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
194685295f4SBill Fenner    *:NetBSD:*:*)
1955b0fe478SBruce M Simpson	# NetBSD (nbsd) targets should (where applicable) match one or
1963c602fabSXin LI	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
197685295f4SBill Fenner	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
198685295f4SBill Fenner	# switched to ELF, *-*-netbsd* would select the old
199685295f4SBill Fenner	# object file format.  This provides both forward
200685295f4SBill Fenner	# compatibility and a consistent mechanism for selecting the
201685295f4SBill Fenner	# object file format.
2025b0fe478SBruce M Simpson	#
2035b0fe478SBruce M Simpson	# Note: NetBSD doesn't particularly care about the vendor
2045b0fe478SBruce M Simpson	# portion of the name.  We always set it to "unknown".
2058bdc5a62SPatrick Kelsey	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206*ee67461eSJoseph Mingrone	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207*ee67461eSJoseph Mingrone	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
2088bdc5a62SPatrick Kelsey	    echo unknown)`
209*ee67461eSJoseph Mingrone	case $UNAME_MACHINE_ARCH in
210*ee67461eSJoseph Mingrone	    aarch64eb) machine=aarch64_be-unknown ;;
2115b0fe478SBruce M Simpson	    armeb) machine=armeb-unknown ;;
2125b0fe478SBruce M Simpson	    arm*) machine=arm-unknown ;;
2135b0fe478SBruce M Simpson	    sh3el) machine=shl-unknown ;;
2145b0fe478SBruce M Simpson	    sh3eb) machine=sh-unknown ;;
21527df3f5dSRui Paulo	    sh5el) machine=sh5le-unknown ;;
2168bdc5a62SPatrick Kelsey	    earmv*)
21739e421e8SCy Schubert		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
21839e421e8SCy Schubert		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219*ee67461eSJoseph Mingrone		machine=${arch}${endian}-unknown
2208bdc5a62SPatrick Kelsey		;;
221*ee67461eSJoseph Mingrone	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
222685295f4SBill Fenner	esac
223685295f4SBill Fenner	# The Operating System including object format, if it has switched
22439e421e8SCy Schubert	# to ELF recently (or will in the future) and ABI.
225*ee67461eSJoseph Mingrone	case $UNAME_MACHINE_ARCH in
22639e421e8SCy Schubert	    earm*)
22739e421e8SCy Schubert		os=netbsdelf
22839e421e8SCy Schubert		;;
22939e421e8SCy Schubert	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230*ee67461eSJoseph Mingrone		set_cc_for_build
231685295f4SBill Fenner		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
23227df3f5dSRui Paulo			| grep -q __ELF__
233685295f4SBill Fenner		then
234685295f4SBill Fenner		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
235685295f4SBill Fenner		    # Return netbsd for either.  FIX?
236685295f4SBill Fenner		    os=netbsd
237685295f4SBill Fenner		else
238685295f4SBill Fenner		    os=netbsdelf
239685295f4SBill Fenner		fi
240685295f4SBill Fenner		;;
241685295f4SBill Fenner	    *)
242685295f4SBill Fenner		os=netbsd
243685295f4SBill Fenner		;;
244685295f4SBill Fenner	esac
2458bdc5a62SPatrick Kelsey	# Determine ABI tags.
246*ee67461eSJoseph Mingrone	case $UNAME_MACHINE_ARCH in
2478bdc5a62SPatrick Kelsey	    earm*)
2488bdc5a62SPatrick Kelsey		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
24939e421e8SCy Schubert		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2508bdc5a62SPatrick Kelsey		;;
2518bdc5a62SPatrick Kelsey	esac
252685295f4SBill Fenner	# The OS release
2535b0fe478SBruce M Simpson	# Debian GNU/NetBSD machines have a different userland, and
2545b0fe478SBruce M Simpson	# thus, need a distinct triplet. However, they do not need
2555b0fe478SBruce M Simpson	# kernel version information, so it can be replaced with a
2565b0fe478SBruce M Simpson	# suitable tag, in the style of linux-gnu.
257*ee67461eSJoseph Mingrone	case $UNAME_VERSION in
2585b0fe478SBruce M Simpson	    Debian*)
2595b0fe478SBruce M Simpson		release='-gnu'
2605b0fe478SBruce M Simpson		;;
2615b0fe478SBruce M Simpson	    *)
26239e421e8SCy Schubert		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2635b0fe478SBruce M Simpson		;;
2645b0fe478SBruce M Simpson	esac
265685295f4SBill Fenner	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
266685295f4SBill Fenner	# contains redundant information, the shorter form:
267685295f4SBill Fenner	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268*ee67461eSJoseph Mingrone	GUESS=$machine-${os}${release}${abi-}
269*ee67461eSJoseph Mingrone	;;
2708bdc5a62SPatrick Kelsey    *:Bitrig:*:*)
2718bdc5a62SPatrick Kelsey	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273*ee67461eSJoseph Mingrone	;;
2745b0fe478SBruce M Simpson    *:OpenBSD:*:*)
27527df3f5dSRui Paulo	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277*ee67461eSJoseph Mingrone	;;
278*ee67461eSJoseph Mingrone    *:SecBSD:*:*)
279*ee67461eSJoseph Mingrone	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281*ee67461eSJoseph Mingrone	;;
28239e421e8SCy Schubert    *:LibertyBSD:*:*)
28339e421e8SCy Schubert	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285*ee67461eSJoseph Mingrone	;;
28639e421e8SCy Schubert    *:MidnightBSD:*:*)
287*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288*ee67461eSJoseph Mingrone	;;
28927df3f5dSRui Paulo    *:ekkoBSD:*:*)
290*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291*ee67461eSJoseph Mingrone	;;
29227df3f5dSRui Paulo    *:SolidBSD:*:*)
293*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294*ee67461eSJoseph Mingrone	;;
295*ee67461eSJoseph Mingrone    *:OS108:*:*)
296*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297*ee67461eSJoseph Mingrone	;;
29827df3f5dSRui Paulo    macppc:MirBSD:*:*)
299*ee67461eSJoseph Mingrone	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300*ee67461eSJoseph Mingrone	;;
30127df3f5dSRui Paulo    *:MirBSD:*:*)
302*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303*ee67461eSJoseph Mingrone	;;
30439e421e8SCy Schubert    *:Sortix:*:*)
305*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-sortix
306*ee67461eSJoseph Mingrone	;;
307*ee67461eSJoseph Mingrone    *:Twizzler:*:*)
308*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-twizzler
309*ee67461eSJoseph Mingrone	;;
31039e421e8SCy Schubert    *:Redox:*:*)
311*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-redox
312*ee67461eSJoseph Mingrone	;;
31339e421e8SCy Schubert    mips:OSF1:*.*)
314*ee67461eSJoseph Mingrone	GUESS=mips-dec-osf1
315*ee67461eSJoseph Mingrone	;;
3164edb46e9SPaul Traina    alpha:OSF1:*:*)
317*ee67461eSJoseph Mingrone	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318*ee67461eSJoseph Mingrone	trap '' 0
31927df3f5dSRui Paulo	case $UNAME_RELEASE in
32027df3f5dSRui Paulo	*4.0)
321685295f4SBill Fenner		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
32227df3f5dSRui Paulo		;;
32327df3f5dSRui Paulo	*5.*)
32427df3f5dSRui Paulo		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
32527df3f5dSRui Paulo		;;
32627df3f5dSRui Paulo	esac
3275b0fe478SBruce M Simpson	# According to Compaq, /usr/sbin/psrinfo has been available on
3285b0fe478SBruce M Simpson	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3295b0fe478SBruce M Simpson	# covers most systems running today.  This code pipes the CPU
3305b0fe478SBruce M Simpson	# types through head -n 1, so we only detect the type of CPU 0.
3315b0fe478SBruce M Simpson	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332*ee67461eSJoseph Mingrone	case $ALPHA_CPU_TYPE in
3335b0fe478SBruce M Simpson	    "EV4 (21064)")
33439e421e8SCy Schubert		UNAME_MACHINE=alpha ;;
3355b0fe478SBruce M Simpson	    "EV4.5 (21064)")
33639e421e8SCy Schubert		UNAME_MACHINE=alpha ;;
3375b0fe478SBruce M Simpson	    "LCA4 (21066/21068)")
33839e421e8SCy Schubert		UNAME_MACHINE=alpha ;;
3395b0fe478SBruce M Simpson	    "EV5 (21164)")
34039e421e8SCy Schubert		UNAME_MACHINE=alphaev5 ;;
3415b0fe478SBruce M Simpson	    "EV5.6 (21164A)")
34239e421e8SCy Schubert		UNAME_MACHINE=alphaev56 ;;
3435b0fe478SBruce M Simpson	    "EV5.6 (21164PC)")
34439e421e8SCy Schubert		UNAME_MACHINE=alphapca56 ;;
3455b0fe478SBruce M Simpson	    "EV5.7 (21164PC)")
34639e421e8SCy Schubert		UNAME_MACHINE=alphapca57 ;;
3475b0fe478SBruce M Simpson	    "EV6 (21264)")
34839e421e8SCy Schubert		UNAME_MACHINE=alphaev6 ;;
3495b0fe478SBruce M Simpson	    "EV6.7 (21264A)")
35039e421e8SCy Schubert		UNAME_MACHINE=alphaev67 ;;
3515b0fe478SBruce M Simpson	    "EV6.8CB (21264C)")
35239e421e8SCy Schubert		UNAME_MACHINE=alphaev68 ;;
3535b0fe478SBruce M Simpson	    "EV6.8AL (21264B)")
35439e421e8SCy Schubert		UNAME_MACHINE=alphaev68 ;;
3555b0fe478SBruce M Simpson	    "EV6.8CX (21264D)")
35639e421e8SCy Schubert		UNAME_MACHINE=alphaev68 ;;
3575b0fe478SBruce M Simpson	    "EV6.9A (21264/EV69A)")
35839e421e8SCy Schubert		UNAME_MACHINE=alphaev69 ;;
3595b0fe478SBruce M Simpson	    "EV7 (21364)")
36039e421e8SCy Schubert		UNAME_MACHINE=alphaev7 ;;
3615b0fe478SBruce M Simpson	    "EV7.9 (21364A)")
36239e421e8SCy Schubert		UNAME_MACHINE=alphaev79 ;;
3635b0fe478SBruce M Simpson	esac
36427df3f5dSRui Paulo	# A Pn.n version is a patched version.
3654edb46e9SPaul Traina	# A Vn.n version is a released version.
3664edb46e9SPaul Traina	# A Tn.n version is a released field test version.
3674edb46e9SPaul Traina	# A Xn.n version is an unreleased experimental baselevel.
3684edb46e9SPaul Traina	# 1.2 uses "1.2" for uname -r.
369*ee67461eSJoseph Mingrone	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371*ee67461eSJoseph Mingrone	;;
3724edb46e9SPaul Traina    Amiga*:UNIX_System_V:4.0:*)
373*ee67461eSJoseph Mingrone	GUESS=m68k-unknown-sysv4
374*ee67461eSJoseph Mingrone	;;
375685295f4SBill Fenner    *:[Aa]miga[Oo][Ss]:*:*)
376*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-amigaos
377*ee67461eSJoseph Mingrone	;;
3785b0fe478SBruce M Simpson    *:[Mm]orph[Oo][Ss]:*:*)
379*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-morphos
380*ee67461eSJoseph Mingrone	;;
381685295f4SBill Fenner    *:OS/390:*:*)
382*ee67461eSJoseph Mingrone	GUESS=i370-ibm-openedition
383*ee67461eSJoseph Mingrone	;;
38427df3f5dSRui Paulo    *:z/VM:*:*)
385*ee67461eSJoseph Mingrone	GUESS=s390-ibm-zvmoe
386*ee67461eSJoseph Mingrone	;;
3875b0fe478SBruce M Simpson    *:OS400:*:*)
388*ee67461eSJoseph Mingrone	GUESS=powerpc-ibm-os400
389*ee67461eSJoseph Mingrone	;;
3904edb46e9SPaul Traina    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391*ee67461eSJoseph Mingrone	GUESS=arm-acorn-riscix$UNAME_RELEASE
392*ee67461eSJoseph Mingrone	;;
3938bdc5a62SPatrick Kelsey    arm*:riscos:*:*|arm*:RISCOS:*:*)
394*ee67461eSJoseph Mingrone	GUESS=arm-unknown-riscos
395*ee67461eSJoseph Mingrone	;;
396a90e161bSBill Fenner    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397*ee67461eSJoseph Mingrone	GUESS=hppa1.1-hitachi-hiuxmpp
398*ee67461eSJoseph Mingrone	;;
399685295f4SBill Fenner    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4004de76e31SBill Fenner	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401*ee67461eSJoseph Mingrone	case `(/bin/universe) 2>/dev/null` in
402*ee67461eSJoseph Mingrone	    att) GUESS=pyramid-pyramid-sysv3 ;;
403*ee67461eSJoseph Mingrone	    *)   GUESS=pyramid-pyramid-bsd   ;;
404*ee67461eSJoseph Mingrone	esac
405*ee67461eSJoseph Mingrone	;;
406685295f4SBill Fenner    NILE*:*:*:dcosx)
407*ee67461eSJoseph Mingrone	GUESS=pyramid-pyramid-svr4
408*ee67461eSJoseph Mingrone	;;
4095b0fe478SBruce M Simpson    DRS?6000:unix:4.0:6*)
410*ee67461eSJoseph Mingrone	GUESS=sparc-icl-nx6
411*ee67461eSJoseph Mingrone	;;
41227df3f5dSRui Paulo    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4135b0fe478SBruce M Simpson	case `/usr/bin/uname -p` in
414*ee67461eSJoseph Mingrone	    sparc) GUESS=sparc-icl-nx7 ;;
415*ee67461eSJoseph Mingrone	esac
416*ee67461eSJoseph Mingrone	;;
41727df3f5dSRui Paulo    s390x:SunOS:*:*)
418*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420*ee67461eSJoseph Mingrone	;;
421685295f4SBill Fenner    sun4H:SunOS:5.*:*)
422*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423*ee67461eSJoseph Mingrone	GUESS=sparc-hal-solaris2$SUN_REL
424*ee67461eSJoseph Mingrone	;;
4254de76e31SBill Fenner    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427*ee67461eSJoseph Mingrone	GUESS=sparc-sun-solaris2$SUN_REL
428*ee67461eSJoseph Mingrone	;;
42927df3f5dSRui Paulo    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430*ee67461eSJoseph Mingrone	GUESS=i386-pc-auroraux$UNAME_RELEASE
431*ee67461eSJoseph Mingrone	;;
43227df3f5dSRui Paulo    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433*ee67461eSJoseph Mingrone	set_cc_for_build
43439e421e8SCy Schubert	SUN_ARCH=i386
43527df3f5dSRui Paulo	# If there is a compiler, see if it is configured for 64-bit objects.
43627df3f5dSRui Paulo	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
43727df3f5dSRui Paulo	# This test works for both compilers.
438*ee67461eSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
43927df3f5dSRui Paulo	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440*ee67461eSJoseph Mingrone		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
44127df3f5dSRui Paulo		grep IS_64BIT_ARCH >/dev/null
44227df3f5dSRui Paulo	    then
44339e421e8SCy Schubert		SUN_ARCH=x86_64
44427df3f5dSRui Paulo	    fi
44527df3f5dSRui Paulo	fi
446*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447*ee67461eSJoseph Mingrone	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448*ee67461eSJoseph Mingrone	;;
4494edb46e9SPaul Traina    sun4*:SunOS:6*:*)
4504edb46e9SPaul Traina	# According to config.sub, this is the proper way to canonicalize
4514edb46e9SPaul Traina	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4524edb46e9SPaul Traina	# it's likely to be more like Solaris than SunOS4.
453*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454*ee67461eSJoseph Mingrone	GUESS=sparc-sun-solaris3$SUN_REL
455*ee67461eSJoseph Mingrone	;;
4564edb46e9SPaul Traina    sun4*:SunOS:*:*)
457*ee67461eSJoseph Mingrone	case `/usr/bin/arch -k` in
4584edb46e9SPaul Traina	    Series*|S4*)
4594edb46e9SPaul Traina		UNAME_RELEASE=`uname -v`
4604edb46e9SPaul Traina		;;
4614edb46e9SPaul Traina	esac
4624edb46e9SPaul Traina	# Japanese Language versions have a version number like `4.1.3-JL'.
463*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464*ee67461eSJoseph Mingrone	GUESS=sparc-sun-sunos$SUN_REL
465*ee67461eSJoseph Mingrone	;;
4664edb46e9SPaul Traina    sun3*:SunOS:*:*)
467*ee67461eSJoseph Mingrone	GUESS=m68k-sun-sunos$UNAME_RELEASE
468*ee67461eSJoseph Mingrone	;;
469685295f4SBill Fenner    sun*:*:4.2BSD:*)
4705b0fe478SBruce M Simpson	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
47139e421e8SCy Schubert	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472*ee67461eSJoseph Mingrone	case `/bin/arch` in
473685295f4SBill Fenner	    sun3)
474*ee67461eSJoseph Mingrone		GUESS=m68k-sun-sunos$UNAME_RELEASE
475685295f4SBill Fenner		;;
476685295f4SBill Fenner	    sun4)
477*ee67461eSJoseph Mingrone		GUESS=sparc-sun-sunos$UNAME_RELEASE
478685295f4SBill Fenner		;;
479685295f4SBill Fenner	esac
480*ee67461eSJoseph Mingrone	;;
4814de76e31SBill Fenner    aushp:SunOS:*:*)
482*ee67461eSJoseph Mingrone	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483*ee67461eSJoseph Mingrone	;;
484685295f4SBill Fenner    # The situation for MiNT is a little confusing.  The machine name
485685295f4SBill Fenner    # can be virtually everything (everything which is not
486685295f4SBill Fenner    # "atarist" or "atariste" at least should have a processor
487685295f4SBill Fenner    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
488685295f4SBill Fenner    # to the lowercase version "mint" (or "freemint").  Finally
489685295f4SBill Fenner    # the system name "TOS" denotes a system which is actually not
490685295f4SBill Fenner    # MiNT.  But MiNT is downward compatible to TOS, so this should
491685295f4SBill Fenner    # be no problem.
492685295f4SBill Fenner    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493*ee67461eSJoseph Mingrone	GUESS=m68k-atari-mint$UNAME_RELEASE
494*ee67461eSJoseph Mingrone	;;
495685295f4SBill Fenner    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496*ee67461eSJoseph Mingrone	GUESS=m68k-atari-mint$UNAME_RELEASE
497*ee67461eSJoseph Mingrone	;;
498685295f4SBill Fenner    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499*ee67461eSJoseph Mingrone	GUESS=m68k-atari-mint$UNAME_RELEASE
500*ee67461eSJoseph Mingrone	;;
501685295f4SBill Fenner    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502*ee67461eSJoseph Mingrone	GUESS=m68k-milan-mint$UNAME_RELEASE
503*ee67461eSJoseph Mingrone	;;
504685295f4SBill Fenner    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505*ee67461eSJoseph Mingrone	GUESS=m68k-hades-mint$UNAME_RELEASE
506*ee67461eSJoseph Mingrone	;;
507685295f4SBill Fenner    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508*ee67461eSJoseph Mingrone	GUESS=m68k-unknown-mint$UNAME_RELEASE
509*ee67461eSJoseph Mingrone	;;
51027df3f5dSRui Paulo    m68k:machten:*:*)
511*ee67461eSJoseph Mingrone	GUESS=m68k-apple-machten$UNAME_RELEASE
512*ee67461eSJoseph Mingrone	;;
5134de76e31SBill Fenner    powerpc:machten:*:*)
514*ee67461eSJoseph Mingrone	GUESS=powerpc-apple-machten$UNAME_RELEASE
515*ee67461eSJoseph Mingrone	;;
5164de76e31SBill Fenner    RISC*:Mach:*:*)
517*ee67461eSJoseph Mingrone	GUESS=mips-dec-mach_bsd4.3
518*ee67461eSJoseph Mingrone	;;
5194edb46e9SPaul Traina    RISC*:ULTRIX:*:*)
520*ee67461eSJoseph Mingrone	GUESS=mips-dec-ultrix$UNAME_RELEASE
521*ee67461eSJoseph Mingrone	;;
5224edb46e9SPaul Traina    VAX*:ULTRIX*:*:*)
523*ee67461eSJoseph Mingrone	GUESS=vax-dec-ultrix$UNAME_RELEASE
524*ee67461eSJoseph Mingrone	;;
525685295f4SBill Fenner    2020:CLIX:*:* | 2430:CLIX:*:*)
526*ee67461eSJoseph Mingrone	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527*ee67461eSJoseph Mingrone	;;
5284de76e31SBill Fenner    mips:*:*:UMIPS | mips:*:*:RISCos)
529*ee67461eSJoseph Mingrone	set_cc_for_build
53039e421e8SCy Schubert	sed 's/^	//' << EOF > "$dummy.c"
531685295f4SBill Fenner#ifdef __cplusplus
532685295f4SBill Fenner#include <stdio.h>  /* for printf() prototype */
533685295f4SBill Fenner	int main (int argc, char *argv[]) {
534685295f4SBill Fenner#else
535685295f4SBill Fenner	int main (argc, argv) int argc; char *argv[]; {
536685295f4SBill Fenner#endif
5374de76e31SBill Fenner	#if defined (host_mips) && defined (MIPSEB)
5384de76e31SBill Fenner	#if defined (SYSTYPE_SYSV)
53939e421e8SCy Schubert	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5404de76e31SBill Fenner	#endif
5414de76e31SBill Fenner	#if defined (SYSTYPE_SVR4)
54239e421e8SCy Schubert	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5434de76e31SBill Fenner	#endif
5444de76e31SBill Fenner	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
54539e421e8SCy Schubert	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5464de76e31SBill Fenner	#endif
5474de76e31SBill Fenner	#endif
5484de76e31SBill Fenner	  exit (-1);
5494de76e31SBill Fenner	}
5504de76e31SBill FennerEOF
55139e421e8SCy Schubert	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
55239e421e8SCy Schubert	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
55339e421e8SCy Schubert	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55427df3f5dSRui Paulo	    { echo "$SYSTEM_NAME"; exit; }
555*ee67461eSJoseph Mingrone	GUESS=mips-mips-riscos$UNAME_RELEASE
556*ee67461eSJoseph Mingrone	;;
557a90e161bSBill Fenner    Motorola:PowerMAX_OS:*:*)
558*ee67461eSJoseph Mingrone	GUESS=powerpc-motorola-powermax
559*ee67461eSJoseph Mingrone	;;
5605b0fe478SBruce M Simpson    Motorola:*:4.3:PL8-*)
561*ee67461eSJoseph Mingrone	GUESS=powerpc-harris-powermax
562*ee67461eSJoseph Mingrone	;;
5635b0fe478SBruce M Simpson    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564*ee67461eSJoseph Mingrone	GUESS=powerpc-harris-powermax
565*ee67461eSJoseph Mingrone	;;
5664edb46e9SPaul Traina    Night_Hawk:Power_UNIX:*:*)
567*ee67461eSJoseph Mingrone	GUESS=powerpc-harris-powerunix
568*ee67461eSJoseph Mingrone	;;
5694edb46e9SPaul Traina    m88k:CX/UX:7*:*)
570*ee67461eSJoseph Mingrone	GUESS=m88k-harris-cxux7
571*ee67461eSJoseph Mingrone	;;
5724edb46e9SPaul Traina    m88k:*:4*:R4*)
573*ee67461eSJoseph Mingrone	GUESS=m88k-motorola-sysv4
574*ee67461eSJoseph Mingrone	;;
5754edb46e9SPaul Traina    m88k:*:3*:R3*)
576*ee67461eSJoseph Mingrone	GUESS=m88k-motorola-sysv3
577*ee67461eSJoseph Mingrone	;;
5784edb46e9SPaul Traina    AViiON:dgux:*:*)
5794edb46e9SPaul Traina	# DG/UX returns AViiON for all architectures
5804edb46e9SPaul Traina	UNAME_PROCESSOR=`/usr/bin/uname -p`
581*ee67461eSJoseph Mingrone	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
582685295f4SBill Fenner	then
583*ee67461eSJoseph Mingrone	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584*ee67461eSJoseph Mingrone	       test "$TARGET_BINARY_INTERFACE"x = x
585685295f4SBill Fenner	    then
586*ee67461eSJoseph Mingrone		GUESS=m88k-dg-dgux$UNAME_RELEASE
5874edb46e9SPaul Traina	    else
588*ee67461eSJoseph Mingrone		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5894edb46e9SPaul Traina	    fi
590685295f4SBill Fenner	else
591*ee67461eSJoseph Mingrone	    GUESS=i586-dg-dgux$UNAME_RELEASE
5924edb46e9SPaul Traina	fi
593*ee67461eSJoseph Mingrone	;;
5944edb46e9SPaul Traina    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595*ee67461eSJoseph Mingrone	GUESS=m88k-dolphin-sysv3
596*ee67461eSJoseph Mingrone	;;
5974edb46e9SPaul Traina    M88*:*:R3*:*)
5984edb46e9SPaul Traina	# Delta 88k system running SVR3
599*ee67461eSJoseph Mingrone	GUESS=m88k-motorola-sysv3
600*ee67461eSJoseph Mingrone	;;
6014edb46e9SPaul Traina    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602*ee67461eSJoseph Mingrone	GUESS=m88k-tektronix-sysv3
603*ee67461eSJoseph Mingrone	;;
6044edb46e9SPaul Traina    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605*ee67461eSJoseph Mingrone	GUESS=m68k-tektronix-bsd
606*ee67461eSJoseph Mingrone	;;
6074edb46e9SPaul Traina    *:IRIX*:*:*)
608*ee67461eSJoseph Mingrone	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609*ee67461eSJoseph Mingrone	GUESS=mips-sgi-irix$IRIX_REL
610*ee67461eSJoseph Mingrone	;;
6114edb46e9SPaul Traina    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612*ee67461eSJoseph Mingrone	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613*ee67461eSJoseph Mingrone	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
614a90e161bSBill Fenner    i*86:AIX:*:*)
615*ee67461eSJoseph Mingrone	GUESS=i386-ibm-aix
616*ee67461eSJoseph Mingrone	;;
617a90e161bSBill Fenner    ia64:AIX:*:*)
618*ee67461eSJoseph Mingrone	if test -x /usr/bin/oslevel ; then
619a90e161bSBill Fenner		IBM_REV=`/usr/bin/oslevel`
620a90e161bSBill Fenner	else
621*ee67461eSJoseph Mingrone		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
622a90e161bSBill Fenner	fi
623*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624*ee67461eSJoseph Mingrone	;;
6254edb46e9SPaul Traina    *:AIX:2:3)
6264edb46e9SPaul Traina	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627*ee67461eSJoseph Mingrone		set_cc_for_build
62839e421e8SCy Schubert		sed 's/^		//' << EOF > "$dummy.c"
6294edb46e9SPaul Traina		#include <sys/systemcfg.h>
6304edb46e9SPaul Traina
6314edb46e9SPaul Traina		main()
6324edb46e9SPaul Traina			{
6334edb46e9SPaul Traina			if (!__power_pc())
6344edb46e9SPaul Traina				exit(1);
6354edb46e9SPaul Traina			puts("powerpc-ibm-aix3.2.5");
6364edb46e9SPaul Traina			exit(0);
6374edb46e9SPaul Traina			}
6384edb46e9SPaul TrainaEOF
63939e421e8SCy Schubert		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64027df3f5dSRui Paulo		then
641*ee67461eSJoseph Mingrone			GUESS=$SYSTEM_NAME
64227df3f5dSRui Paulo		else
643*ee67461eSJoseph Mingrone			GUESS=rs6000-ibm-aix3.2.5
64427df3f5dSRui Paulo		fi
6454edb46e9SPaul Traina	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646*ee67461eSJoseph Mingrone		GUESS=rs6000-ibm-aix3.2.4
6474edb46e9SPaul Traina	else
648*ee67461eSJoseph Mingrone		GUESS=rs6000-ibm-aix3.2
6494edb46e9SPaul Traina	fi
650*ee67461eSJoseph Mingrone	;;
6513c602fabSXin LI    *:AIX:*:[4567])
6525b0fe478SBruce M Simpson	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
65339e421e8SCy Schubert	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6544edb46e9SPaul Traina		IBM_ARCH=rs6000
6554edb46e9SPaul Traina	else
6564edb46e9SPaul Traina		IBM_ARCH=powerpc
6574edb46e9SPaul Traina	fi
658*ee67461eSJoseph Mingrone	if test -x /usr/bin/lslpp ; then
659*ee67461eSJoseph Mingrone		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
6608bdc5a62SPatrick Kelsey			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6614edb46e9SPaul Traina	else
662*ee67461eSJoseph Mingrone		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6634edb46e9SPaul Traina	fi
664*ee67461eSJoseph Mingrone	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665*ee67461eSJoseph Mingrone	;;
6664edb46e9SPaul Traina    *:AIX:*:*)
667*ee67461eSJoseph Mingrone	GUESS=rs6000-ibm-aix
668*ee67461eSJoseph Mingrone	;;
66939e421e8SCy Schubert    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670*ee67461eSJoseph Mingrone	GUESS=romp-ibm-bsd4.4
671*ee67461eSJoseph Mingrone	;;
672685295f4SBill Fenner    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673*ee67461eSJoseph Mingrone	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674*ee67461eSJoseph Mingrone	;;                                  # report: romp-ibm BSD 4.3
6754edb46e9SPaul Traina    *:BOSX:*:*)
676*ee67461eSJoseph Mingrone	GUESS=rs6000-bull-bosx
677*ee67461eSJoseph Mingrone	;;
6784edb46e9SPaul Traina    DPX/2?00:B.O.S.:*:*)
679*ee67461eSJoseph Mingrone	GUESS=m68k-bull-sysv3
680*ee67461eSJoseph Mingrone	;;
6814edb46e9SPaul Traina    9000/[34]??:4.3bsd:1.*:*)
682*ee67461eSJoseph Mingrone	GUESS=m68k-hp-bsd
683*ee67461eSJoseph Mingrone	;;
6844edb46e9SPaul Traina    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685*ee67461eSJoseph Mingrone	GUESS=m68k-hp-bsd4.4
686*ee67461eSJoseph Mingrone	;;
687685295f4SBill Fenner    9000/[34678]??:HP-UX:*:*)
68839e421e8SCy Schubert	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689*ee67461eSJoseph Mingrone	case $UNAME_MACHINE in
6904edb46e9SPaul Traina	    9000/31?)            HP_ARCH=m68000 ;;
6914edb46e9SPaul Traina	    9000/[34]??)         HP_ARCH=m68k ;;
692685295f4SBill Fenner	    9000/[678][0-9][0-9])
693*ee67461eSJoseph Mingrone		if test -x /usr/bin/getconf; then
694685295f4SBill Fenner		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695685295f4SBill Fenner		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696*ee67461eSJoseph Mingrone		    case $sc_cpu_version in
69739e421e8SCy Schubert		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
69839e421e8SCy Schubert		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699685295f4SBill Fenner		      532)                      # CPU_PA_RISC2_0
700*ee67461eSJoseph Mingrone			case $sc_kernel_bits in
70139e421e8SCy Schubert			  32) HP_ARCH=hppa2.0n ;;
70239e421e8SCy Schubert			  64) HP_ARCH=hppa2.0w ;;
70339e421e8SCy Schubert			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704685295f4SBill Fenner			esac ;;
7054edb46e9SPaul Traina		    esac
7065b0fe478SBruce M Simpson		fi
707*ee67461eSJoseph Mingrone		if test "$HP_ARCH" = ""; then
708*ee67461eSJoseph Mingrone		    set_cc_for_build
70939e421e8SCy Schubert		    sed 's/^		//' << EOF > "$dummy.c"
710685295f4SBill Fenner
711685295f4SBill Fenner		#define _HPUX_SOURCE
712685295f4SBill Fenner		#include <stdlib.h>
713685295f4SBill Fenner		#include <unistd.h>
714685295f4SBill Fenner
715685295f4SBill Fenner		int main ()
716685295f4SBill Fenner		{
717685295f4SBill Fenner		#if defined(_SC_KERNEL_BITS)
718685295f4SBill Fenner		    long bits = sysconf(_SC_KERNEL_BITS);
719685295f4SBill Fenner		#endif
720685295f4SBill Fenner		    long cpu  = sysconf (_SC_CPU_VERSION);
721685295f4SBill Fenner
722685295f4SBill Fenner		    switch (cpu)
723685295f4SBill Fenner			{
724685295f4SBill Fenner			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725685295f4SBill Fenner			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726685295f4SBill Fenner			case CPU_PA_RISC2_0:
727685295f4SBill Fenner		#if defined(_SC_KERNEL_BITS)
728685295f4SBill Fenner			    switch (bits)
729685295f4SBill Fenner				{
730685295f4SBill Fenner				case 64: puts ("hppa2.0w"); break;
731685295f4SBill Fenner				case 32: puts ("hppa2.0n"); break;
732685295f4SBill Fenner				default: puts ("hppa2.0"); break;
733685295f4SBill Fenner				} break;
734685295f4SBill Fenner		#else  /* !defined(_SC_KERNEL_BITS) */
735685295f4SBill Fenner			    puts ("hppa2.0"); break;
736685295f4SBill Fenner		#endif
737685295f4SBill Fenner			default: puts ("hppa1.0"); break;
738685295f4SBill Fenner			}
739685295f4SBill Fenner		    exit (0);
740685295f4SBill Fenner		}
741685295f4SBill FennerEOF
74239e421e8SCy Schubert		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7435b0fe478SBruce M Simpson		    test -z "$HP_ARCH" && HP_ARCH=hppa
744685295f4SBill Fenner		fi ;;
745685295f4SBill Fenner	esac
746*ee67461eSJoseph Mingrone	if test "$HP_ARCH" = hppa2.0w
7475b0fe478SBruce M Simpson	then
748*ee67461eSJoseph Mingrone	    set_cc_for_build
74927df3f5dSRui Paulo
75027df3f5dSRui Paulo	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75127df3f5dSRui Paulo	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75227df3f5dSRui Paulo	    # generating 64-bit code.  GNU and HP use different nomenclature:
75327df3f5dSRui Paulo	    #
75427df3f5dSRui Paulo	    # $ CC_FOR_BUILD=cc ./config.guess
75527df3f5dSRui Paulo	    # => hppa2.0w-hp-hpux11.23
75627df3f5dSRui Paulo	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75727df3f5dSRui Paulo	    # => hppa64-hp-hpux11.23
75827df3f5dSRui Paulo
75939e421e8SCy Schubert	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
76027df3f5dSRui Paulo		grep -q __LP64__
7615b0fe478SBruce M Simpson	    then
76239e421e8SCy Schubert		HP_ARCH=hppa2.0w
7635b0fe478SBruce M Simpson	    else
76439e421e8SCy Schubert		HP_ARCH=hppa64
7655b0fe478SBruce M Simpson	    fi
7665b0fe478SBruce M Simpson	fi
767*ee67461eSJoseph Mingrone	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768*ee67461eSJoseph Mingrone	;;
769a90e161bSBill Fenner    ia64:HP-UX:*:*)
77039e421e8SCy Schubert	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771*ee67461eSJoseph Mingrone	GUESS=ia64-hp-hpux$HPUX_REV
772*ee67461eSJoseph Mingrone	;;
7734edb46e9SPaul Traina    3050*:HI-UX:*:*)
774*ee67461eSJoseph Mingrone	set_cc_for_build
77539e421e8SCy Schubert	sed 's/^	//' << EOF > "$dummy.c"
7764edb46e9SPaul Traina	#include <unistd.h>
7774edb46e9SPaul Traina	int
7784edb46e9SPaul Traina	main ()
7794edb46e9SPaul Traina	{
7804edb46e9SPaul Traina	  long cpu = sysconf (_SC_CPU_VERSION);
7814edb46e9SPaul Traina	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7824edb46e9SPaul Traina	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7834edb46e9SPaul Traina	     results, however.  */
7844edb46e9SPaul Traina	  if (CPU_IS_PA_RISC (cpu))
7854edb46e9SPaul Traina	    {
7864edb46e9SPaul Traina	      switch (cpu)
7874edb46e9SPaul Traina		{
7884edb46e9SPaul Traina		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7894edb46e9SPaul Traina		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7904edb46e9SPaul Traina		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7914edb46e9SPaul Traina		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7924edb46e9SPaul Traina		}
7934edb46e9SPaul Traina	    }
7944edb46e9SPaul Traina	  else if (CPU_IS_HP_MC68K (cpu))
7954edb46e9SPaul Traina	    puts ("m68k-hitachi-hiuxwe2");
7964edb46e9SPaul Traina	  else puts ("unknown-hitachi-hiuxwe2");
7974edb46e9SPaul Traina	  exit (0);
7984edb46e9SPaul Traina	}
7994edb46e9SPaul TrainaEOF
80039e421e8SCy Schubert	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80127df3f5dSRui Paulo		{ echo "$SYSTEM_NAME"; exit; }
802*ee67461eSJoseph Mingrone	GUESS=unknown-hitachi-hiuxwe2
803*ee67461eSJoseph Mingrone	;;
8044edb46e9SPaul Traina    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805*ee67461eSJoseph Mingrone	GUESS=hppa1.1-hp-bsd
806*ee67461eSJoseph Mingrone	;;
8074edb46e9SPaul Traina    9000/8??:4.3bsd:*:*)
808*ee67461eSJoseph Mingrone	GUESS=hppa1.0-hp-bsd
809*ee67461eSJoseph Mingrone	;;
8105b0fe478SBruce M Simpson    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811*ee67461eSJoseph Mingrone	GUESS=hppa1.0-hp-mpeix
812*ee67461eSJoseph Mingrone	;;
8134edb46e9SPaul Traina    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814*ee67461eSJoseph Mingrone	GUESS=hppa1.1-hp-osf
815*ee67461eSJoseph Mingrone	;;
8164edb46e9SPaul Traina    hp8??:OSF1:*:*)
817*ee67461eSJoseph Mingrone	GUESS=hppa1.0-hp-osf
818*ee67461eSJoseph Mingrone	;;
819a90e161bSBill Fenner    i*86:OSF1:*:*)
820*ee67461eSJoseph Mingrone	if test -x /usr/sbin/sysversion ; then
821*ee67461eSJoseph Mingrone	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8224de76e31SBill Fenner	else
823*ee67461eSJoseph Mingrone	    GUESS=$UNAME_MACHINE-unknown-osf1
8244de76e31SBill Fenner	fi
825*ee67461eSJoseph Mingrone	;;
8264edb46e9SPaul Traina    parisc*:Lites*:*:*)
827*ee67461eSJoseph Mingrone	GUESS=hppa1.1-hp-lites
828*ee67461eSJoseph Mingrone	;;
8294edb46e9SPaul Traina    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830*ee67461eSJoseph Mingrone	GUESS=c1-convex-bsd
831*ee67461eSJoseph Mingrone	;;
8324edb46e9SPaul Traina    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8334edb46e9SPaul Traina	if getsysinfo -f scalar_acc
8344edb46e9SPaul Traina	then echo c32-convex-bsd
8354edb46e9SPaul Traina	else echo c2-convex-bsd
8364edb46e9SPaul Traina	fi
83727df3f5dSRui Paulo	exit ;;
8384edb46e9SPaul Traina    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839*ee67461eSJoseph Mingrone	GUESS=c34-convex-bsd
840*ee67461eSJoseph Mingrone	;;
8414edb46e9SPaul Traina    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842*ee67461eSJoseph Mingrone	GUESS=c38-convex-bsd
843*ee67461eSJoseph Mingrone	;;
8444edb46e9SPaul Traina    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845*ee67461eSJoseph Mingrone	GUESS=c4-convex-bsd
846*ee67461eSJoseph Mingrone	;;
8474edb46e9SPaul Traina    CRAY*Y-MP:*:*:*)
848*ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849*ee67461eSJoseph Mingrone	GUESS=ymp-cray-unicos$CRAY_REL
850*ee67461eSJoseph Mingrone	;;
8514de76e31SBill Fenner    CRAY*[A-Z]90:*:*:*)
85239e421e8SCy Schubert	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8534de76e31SBill Fenner	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8545b0fe478SBruce M Simpson	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8555b0fe478SBruce M Simpson	      -e 's/\.[^.]*$/.X/'
85627df3f5dSRui Paulo	exit ;;
8574de76e31SBill Fenner    CRAY*TS:*:*:*)
858*ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859*ee67461eSJoseph Mingrone	GUESS=t90-cray-unicos$CRAY_REL
860*ee67461eSJoseph Mingrone	;;
861685295f4SBill Fenner    CRAY*T3E:*:*:*)
862*ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863*ee67461eSJoseph Mingrone	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864*ee67461eSJoseph Mingrone	;;
865685295f4SBill Fenner    CRAY*SV1:*:*:*)
866*ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867*ee67461eSJoseph Mingrone	GUESS=sv1-cray-unicos$CRAY_REL
868*ee67461eSJoseph Mingrone	;;
8695b0fe478SBruce M Simpson    *:UNICOS/mp:*:*)
870*ee67461eSJoseph Mingrone	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871*ee67461eSJoseph Mingrone	GUESS=craynv-cray-unicosmp$CRAY_REL
872*ee67461eSJoseph Mingrone	;;
873a90e161bSBill Fenner    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
87439e421e8SCy Schubert	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
87539e421e8SCy Schubert	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
87639e421e8SCy Schubert	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877*ee67461eSJoseph Mingrone	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878*ee67461eSJoseph Mingrone	;;
8795b0fe478SBruce M Simpson    5000:UNIX_System_V:4.*:*)
88039e421e8SCy Schubert	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
88139e421e8SCy Schubert	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882*ee67461eSJoseph Mingrone	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883*ee67461eSJoseph Mingrone	;;
884a90e161bSBill Fenner    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886*ee67461eSJoseph Mingrone	;;
887685295f4SBill Fenner    sparc*:BSD/OS:*:*)
888*ee67461eSJoseph Mingrone	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889*ee67461eSJoseph Mingrone	;;
890685295f4SBill Fenner    *:BSD/OS:*:*)
891*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892*ee67461eSJoseph Mingrone	;;
893*ee67461eSJoseph Mingrone    arm:FreeBSD:*:*)
894*ee67461eSJoseph Mingrone	UNAME_PROCESSOR=`uname -p`
895*ee67461eSJoseph Mingrone	set_cc_for_build
896*ee67461eSJoseph Mingrone	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897*ee67461eSJoseph Mingrone	    | grep -q __ARM_PCS_VFP
898*ee67461eSJoseph Mingrone	then
899*ee67461eSJoseph Mingrone	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900*ee67461eSJoseph Mingrone	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901*ee67461eSJoseph Mingrone	else
902*ee67461eSJoseph Mingrone	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903*ee67461eSJoseph Mingrone	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904*ee67461eSJoseph Mingrone	fi
905*ee67461eSJoseph Mingrone	;;
9064edb46e9SPaul Traina    *:FreeBSD:*:*)
9073c602fabSXin LI	UNAME_PROCESSOR=`/usr/bin/uname -p`
908*ee67461eSJoseph Mingrone	case $UNAME_PROCESSOR in
90927df3f5dSRui Paulo	    amd64)
91039e421e8SCy Schubert		UNAME_PROCESSOR=x86_64 ;;
91139e421e8SCy Schubert	    i386)
91239e421e8SCy Schubert		UNAME_PROCESSOR=i586 ;;
91327df3f5dSRui Paulo	esac
914*ee67461eSJoseph Mingrone	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915*ee67461eSJoseph Mingrone	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916*ee67461eSJoseph Mingrone	;;
9174edb46e9SPaul Traina    i*:CYGWIN*:*)
918*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-cygwin
919*ee67461eSJoseph Mingrone	;;
9208bdc5a62SPatrick Kelsey    *:MINGW64*:*)
921*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-mingw64
922*ee67461eSJoseph Mingrone	;;
92327df3f5dSRui Paulo    *:MINGW*:*)
924*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-mingw32
925*ee67461eSJoseph Mingrone	;;
9268bdc5a62SPatrick Kelsey    *:MSYS*:*)
927*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-msys
928*ee67461eSJoseph Mingrone	;;
929685295f4SBill Fenner    i*:PW*:*)
930*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-pw32
931*ee67461eSJoseph Mingrone	;;
932*ee67461eSJoseph Mingrone    *:SerenityOS:*:*)
933*ee67461eSJoseph Mingrone        GUESS=$UNAME_MACHINE-pc-serenity
934*ee67461eSJoseph Mingrone        ;;
93527df3f5dSRui Paulo    *:Interix*:*)
936*ee67461eSJoseph Mingrone	case $UNAME_MACHINE in
93727df3f5dSRui Paulo	    x86)
938*ee67461eSJoseph Mingrone		GUESS=i586-pc-interix$UNAME_RELEASE
939*ee67461eSJoseph Mingrone		;;
94027df3f5dSRui Paulo	    authenticamd | genuineintel | EM64T)
941*ee67461eSJoseph Mingrone		GUESS=x86_64-unknown-interix$UNAME_RELEASE
942*ee67461eSJoseph Mingrone		;;
94327df3f5dSRui Paulo	    IA64)
944*ee67461eSJoseph Mingrone		GUESS=ia64-unknown-interix$UNAME_RELEASE
945*ee67461eSJoseph Mingrone		;;
94627df3f5dSRui Paulo	esac ;;
947685295f4SBill Fenner    i*:UWIN*:*)
948*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-uwin
949*ee67461eSJoseph Mingrone	;;
95027df3f5dSRui Paulo    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
951*ee67461eSJoseph Mingrone	GUESS=x86_64-pc-cygwin
952*ee67461eSJoseph Mingrone	;;
9534edb46e9SPaul Traina    prep*:SunOS:5.*:*)
954*ee67461eSJoseph Mingrone	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
955*ee67461eSJoseph Mingrone	GUESS=powerpcle-unknown-solaris2$SUN_REL
956*ee67461eSJoseph Mingrone	;;
9574edb46e9SPaul Traina    *:GNU:*:*)
9585b0fe478SBruce M Simpson	# the GNU system
959*ee67461eSJoseph Mingrone	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
960*ee67461eSJoseph Mingrone	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
961*ee67461eSJoseph Mingrone	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
962*ee67461eSJoseph Mingrone	;;
9635b0fe478SBruce M Simpson    *:GNU/*:*:*)
9645b0fe478SBruce M Simpson	# other systems with GNU libc and userland
965*ee67461eSJoseph Mingrone	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
966*ee67461eSJoseph Mingrone	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
967*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
968*ee67461eSJoseph Mingrone	;;
969*ee67461eSJoseph Mingrone    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
970*ee67461eSJoseph Mingrone	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
971*ee67461eSJoseph Mingrone	;;
972*ee67461eSJoseph Mingrone    *:[Mm]anagarm:*:*)
973*ee67461eSJoseph Mingrone	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
974*ee67461eSJoseph Mingrone	;;
97539e421e8SCy Schubert    *:Minix:*:*)
976*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-minix
977*ee67461eSJoseph Mingrone	;;
9783c602fabSXin LI    aarch64:Linux:*:*)
979*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
980*ee67461eSJoseph Mingrone	;;
9813c602fabSXin LI    aarch64_be:Linux:*:*)
9823c602fabSXin LI	UNAME_MACHINE=aarch64_be
983*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
984*ee67461eSJoseph Mingrone	;;
985a90e161bSBill Fenner    alpha:Linux:*:*)
986*ee67461eSJoseph Mingrone	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
9875b0fe478SBruce M Simpson	  EV5)   UNAME_MACHINE=alphaev5 ;;
9885b0fe478SBruce M Simpson	  EV56)  UNAME_MACHINE=alphaev56 ;;
9895b0fe478SBruce M Simpson	  PCA56) UNAME_MACHINE=alphapca56 ;;
9905b0fe478SBruce M Simpson	  PCA57) UNAME_MACHINE=alphapca56 ;;
9915b0fe478SBruce M Simpson	  EV6)   UNAME_MACHINE=alphaev6 ;;
9925b0fe478SBruce M Simpson	  EV67)  UNAME_MACHINE=alphaev67 ;;
9935b0fe478SBruce M Simpson	  EV68*) UNAME_MACHINE=alphaev68 ;;
994685295f4SBill Fenner	esac
99527df3f5dSRui Paulo	objdump --private-headers /bin/sh | grep -q ld.so.1
99639e421e8SCy Schubert	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
997*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
998*ee67461eSJoseph Mingrone	;;
999*ee67461eSJoseph Mingrone    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1000*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1001*ee67461eSJoseph Mingrone	;;
100227df3f5dSRui Paulo    arm*:Linux:*:*)
1003*ee67461eSJoseph Mingrone	set_cc_for_build
100427df3f5dSRui Paulo	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
100527df3f5dSRui Paulo	    | grep -q __ARM_EABI__
100627df3f5dSRui Paulo	then
1007*ee67461eSJoseph Mingrone	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
100827df3f5dSRui Paulo	else
10093c602fabSXin LI	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10103c602fabSXin LI		| grep -q __ARM_PCS_VFP
10113c602fabSXin LI	    then
1012*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10133c602fabSXin LI	    else
1014*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10153c602fabSXin LI	    fi
101627df3f5dSRui Paulo	fi
1017*ee67461eSJoseph Mingrone	;;
101827df3f5dSRui Paulo    avr32*:Linux:*:*)
1019*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020*ee67461eSJoseph Mingrone	;;
102127df3f5dSRui Paulo    cris:Linux:*:*)
1022*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1023*ee67461eSJoseph Mingrone	;;
102427df3f5dSRui Paulo    crisv32:Linux:*:*)
1025*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1026*ee67461eSJoseph Mingrone	;;
102739e421e8SCy Schubert    e2k:Linux:*:*)
1028*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1029*ee67461eSJoseph Mingrone	;;
103027df3f5dSRui Paulo    frv:Linux:*:*)
1031*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032*ee67461eSJoseph Mingrone	;;
10333c602fabSXin LI    hexagon:Linux:*:*)
1034*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035*ee67461eSJoseph Mingrone	;;
103627df3f5dSRui Paulo    i*86:Linux:*:*)
1037*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1038*ee67461eSJoseph Mingrone	;;
103927df3f5dSRui Paulo    ia64:Linux:*:*)
1040*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041*ee67461eSJoseph Mingrone	;;
104239e421e8SCy Schubert    k1om:Linux:*:*)
1043*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044*ee67461eSJoseph Mingrone	;;
1045*ee67461eSJoseph Mingrone    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1046*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1047*ee67461eSJoseph Mingrone	;;
104827df3f5dSRui Paulo    m32r*:Linux:*:*)
1049*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1050*ee67461eSJoseph Mingrone	;;
105127df3f5dSRui Paulo    m68*:Linux:*:*)
1052*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1053*ee67461eSJoseph Mingrone	;;
105427df3f5dSRui Paulo    mips:Linux:*:* | mips64:Linux:*:*)
1055*ee67461eSJoseph Mingrone	set_cc_for_build
1056*ee67461eSJoseph Mingrone	IS_GLIBC=0
1057*ee67461eSJoseph Mingrone	test x"${LIBC}" = xgnu && IS_GLIBC=1
105839e421e8SCy Schubert	sed 's/^	//' << EOF > "$dummy.c"
105927df3f5dSRui Paulo	#undef CPU
1060*ee67461eSJoseph Mingrone	#undef mips
1061*ee67461eSJoseph Mingrone	#undef mipsel
1062*ee67461eSJoseph Mingrone	#undef mips64
1063*ee67461eSJoseph Mingrone	#undef mips64el
1064*ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && defined(_ABI64)
1065*ee67461eSJoseph Mingrone	LIBCABI=gnuabi64
1066*ee67461eSJoseph Mingrone	#else
1067*ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && defined(_ABIN32)
1068*ee67461eSJoseph Mingrone	LIBCABI=gnuabin32
1069*ee67461eSJoseph Mingrone	#else
1070*ee67461eSJoseph Mingrone	LIBCABI=${LIBC}
1071*ee67461eSJoseph Mingrone	#endif
1072*ee67461eSJoseph Mingrone	#endif
1073*ee67461eSJoseph Mingrone
1074*ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1075*ee67461eSJoseph Mingrone	CPU=mipsisa64r6
1076*ee67461eSJoseph Mingrone	#else
1077*ee67461eSJoseph Mingrone	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1078*ee67461eSJoseph Mingrone	CPU=mipsisa32r6
1079*ee67461eSJoseph Mingrone	#else
1080*ee67461eSJoseph Mingrone	#if defined(__mips64)
1081*ee67461eSJoseph Mingrone	CPU=mips64
1082*ee67461eSJoseph Mingrone	#else
1083*ee67461eSJoseph Mingrone	CPU=mips
1084*ee67461eSJoseph Mingrone	#endif
1085*ee67461eSJoseph Mingrone	#endif
1086*ee67461eSJoseph Mingrone	#endif
1087*ee67461eSJoseph Mingrone
108827df3f5dSRui Paulo	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1089*ee67461eSJoseph Mingrone	MIPS_ENDIAN=el
109027df3f5dSRui Paulo	#else
109127df3f5dSRui Paulo	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1092*ee67461eSJoseph Mingrone	MIPS_ENDIAN=
109327df3f5dSRui Paulo	#else
1094*ee67461eSJoseph Mingrone	MIPS_ENDIAN=
109527df3f5dSRui Paulo	#endif
109627df3f5dSRui Paulo	#endif
109727df3f5dSRui PauloEOF
1098*ee67461eSJoseph Mingrone	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1099*ee67461eSJoseph Mingrone	eval "$cc_set_vars"
1100*ee67461eSJoseph Mingrone	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
110127df3f5dSRui Paulo	;;
110239e421e8SCy Schubert    mips64el:Linux:*:*)
1103*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1104*ee67461eSJoseph Mingrone	;;
11058bdc5a62SPatrick Kelsey    openrisc*:Linux:*:*)
1106*ee67461eSJoseph Mingrone	GUESS=or1k-unknown-linux-$LIBC
1107*ee67461eSJoseph Mingrone	;;
11088bdc5a62SPatrick Kelsey    or32:Linux:*:* | or1k*:Linux:*:*)
1109*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1110*ee67461eSJoseph Mingrone	;;
111127df3f5dSRui Paulo    padre:Linux:*:*)
1112*ee67461eSJoseph Mingrone	GUESS=sparc-unknown-linux-$LIBC
1113*ee67461eSJoseph Mingrone	;;
111427df3f5dSRui Paulo    parisc64:Linux:*:* | hppa64:Linux:*:*)
1115*ee67461eSJoseph Mingrone	GUESS=hppa64-unknown-linux-$LIBC
1116*ee67461eSJoseph Mingrone	;;
1117a90e161bSBill Fenner    parisc:Linux:*:* | hppa:Linux:*:*)
1118685295f4SBill Fenner	# Look for CPU level
1119685295f4SBill Fenner	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1120*ee67461eSJoseph Mingrone	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1121*ee67461eSJoseph Mingrone	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1122*ee67461eSJoseph Mingrone	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
1123a90e161bSBill Fenner	esac
1124*ee67461eSJoseph Mingrone	;;
112527df3f5dSRui Paulo    ppc64:Linux:*:*)
1126*ee67461eSJoseph Mingrone	GUESS=powerpc64-unknown-linux-$LIBC
1127*ee67461eSJoseph Mingrone	;;
112827df3f5dSRui Paulo    ppc:Linux:*:*)
1129*ee67461eSJoseph Mingrone	GUESS=powerpc-unknown-linux-$LIBC
1130*ee67461eSJoseph Mingrone	;;
11318bdc5a62SPatrick Kelsey    ppc64le:Linux:*:*)
1132*ee67461eSJoseph Mingrone	GUESS=powerpc64le-unknown-linux-$LIBC
1133*ee67461eSJoseph Mingrone	;;
11348bdc5a62SPatrick Kelsey    ppcle:Linux:*:*)
1135*ee67461eSJoseph Mingrone	GUESS=powerpcle-unknown-linux-$LIBC
1136*ee67461eSJoseph Mingrone	;;
1137*ee67461eSJoseph Mingrone    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1138*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139*ee67461eSJoseph Mingrone	;;
1140a90e161bSBill Fenner    s390:Linux:*:* | s390x:Linux:*:*)
1141*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1142*ee67461eSJoseph Mingrone	;;
11435b0fe478SBruce M Simpson    sh64*:Linux:*:*)
1144*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145*ee67461eSJoseph Mingrone	;;
1146a90e161bSBill Fenner    sh*:Linux:*:*)
1147*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1148*ee67461eSJoseph Mingrone	;;
1149a90e161bSBill Fenner    sparc:Linux:*:* | sparc64:Linux:*:*)
1150*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1151*ee67461eSJoseph Mingrone	;;
11523c602fabSXin LI    tile*:Linux:*:*)
1153*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1154*ee67461eSJoseph Mingrone	;;
115527df3f5dSRui Paulo    vax:Linux:*:*)
1156*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1157*ee67461eSJoseph Mingrone	;;
1158a90e161bSBill Fenner    x86_64:Linux:*:*)
1159*ee67461eSJoseph Mingrone	set_cc_for_build
1160*ee67461eSJoseph Mingrone	CPU=$UNAME_MACHINE
1161*ee67461eSJoseph Mingrone	LIBCABI=$LIBC
1162*ee67461eSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
1163*ee67461eSJoseph Mingrone	    ABI=64
1164*ee67461eSJoseph Mingrone	    sed 's/^	    //' << EOF > "$dummy.c"
1165*ee67461eSJoseph Mingrone	    #ifdef __i386__
1166*ee67461eSJoseph Mingrone	    ABI=x86
1167*ee67461eSJoseph Mingrone	    #else
1168*ee67461eSJoseph Mingrone	    #ifdef __ILP32__
1169*ee67461eSJoseph Mingrone	    ABI=x32
1170*ee67461eSJoseph Mingrone	    #endif
1171*ee67461eSJoseph Mingrone	    #endif
1172*ee67461eSJoseph MingroneEOF
1173*ee67461eSJoseph Mingrone	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1174*ee67461eSJoseph Mingrone	    eval "$cc_set_abi"
1175*ee67461eSJoseph Mingrone	    case $ABI in
1176*ee67461eSJoseph Mingrone		x86) CPU=i686 ;;
1177*ee67461eSJoseph Mingrone		x32) LIBCABI=${LIBC}x32 ;;
1178*ee67461eSJoseph Mingrone	    esac
1179*ee67461eSJoseph Mingrone	fi
1180*ee67461eSJoseph Mingrone	GUESS=$CPU-pc-linux-$LIBCABI
1181*ee67461eSJoseph Mingrone	;;
118227df3f5dSRui Paulo    xtensa*:Linux:*:*)
1183*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1184*ee67461eSJoseph Mingrone	;;
1185a90e161bSBill Fenner    i*86:DYNIX/ptx:4*:*)
11865b0fe478SBruce M Simpson	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11875b0fe478SBruce M Simpson	# earlier versions are messed up and put the nodename in both
11885b0fe478SBruce M Simpson	# sysname and nodename.
1189*ee67461eSJoseph Mingrone	GUESS=i386-sequent-sysv4
1190*ee67461eSJoseph Mingrone	;;
1191a90e161bSBill Fenner    i*86:UNIX_SV:4.2MP:2.*)
1192685295f4SBill Fenner	# Unixware is an offshoot of SVR4, but it has its own version
1193685295f4SBill Fenner	# number series starting with 2...
1194685295f4SBill Fenner	# I am not positive that other SVR4 systems won't match this,
1195685295f4SBill Fenner	# I just have to hope.  -- rms.
1196685295f4SBill Fenner	# Use sysv4.2uw... so that sysv4* matches it.
1197*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1198*ee67461eSJoseph Mingrone	;;
11995b0fe478SBruce M Simpson    i*86:OS/2:*:*)
12005b0fe478SBruce M Simpson	# If we were able to find `uname', then EMX Unix compatibility
12015b0fe478SBruce M Simpson	# is probably installed.
1202*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-os2-emx
1203*ee67461eSJoseph Mingrone	;;
12045b0fe478SBruce M Simpson    i*86:XTS-300:*:STOP)
1205*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-stop
1206*ee67461eSJoseph Mingrone	;;
12075b0fe478SBruce M Simpson    i*86:atheos:*:*)
1208*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-atheos
1209*ee67461eSJoseph Mingrone	;;
121027df3f5dSRui Paulo    i*86:syllable:*:*)
1211*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-syllable
1212*ee67461eSJoseph Mingrone	;;
121327df3f5dSRui Paulo    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1214*ee67461eSJoseph Mingrone	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1215*ee67461eSJoseph Mingrone	;;
12165b0fe478SBruce M Simpson    i*86:*DOS:*:*)
1217*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1218*ee67461eSJoseph Mingrone	;;
121939e421e8SCy Schubert    i*86:*:4.*:*)
122039e421e8SCy Schubert	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12214edb46e9SPaul Traina	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1222*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
1223685295f4SBill Fenner	else
1224*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
1225685295f4SBill Fenner	fi
1226*ee67461eSJoseph Mingrone	;;
122727df3f5dSRui Paulo    i*86:*:5:[678]*)
122827df3f5dSRui Paulo	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12295b0fe478SBruce M Simpson	case `/bin/uname -X | grep "^Machine"` in
12305b0fe478SBruce M Simpson	    *486*)	     UNAME_MACHINE=i486 ;;
12315b0fe478SBruce M Simpson	    *Pentium)	     UNAME_MACHINE=i586 ;;
12325b0fe478SBruce M Simpson	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12335b0fe478SBruce M Simpson	esac
1234*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1235*ee67461eSJoseph Mingrone	;;
1236a90e161bSBill Fenner    i*86:*:3.2:*)
12374edb46e9SPaul Traina	if test -f /usr/options/cb.name; then
12384edb46e9SPaul Traina		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1239*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12404edb46e9SPaul Traina	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12415b0fe478SBruce M Simpson		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12425b0fe478SBruce M Simpson		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12435b0fe478SBruce M Simpson		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12444edb46e9SPaul Traina			&& UNAME_MACHINE=i586
12455b0fe478SBruce M Simpson		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1246685295f4SBill Fenner			&& UNAME_MACHINE=i686
12475b0fe478SBruce M Simpson		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1248685295f4SBill Fenner			&& UNAME_MACHINE=i686
1249*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12504edb46e9SPaul Traina	else
1251*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-pc-sysv32
12524edb46e9SPaul Traina	fi
1253*ee67461eSJoseph Mingrone	;;
1254685295f4SBill Fenner    pc:*:*:*)
1255685295f4SBill Fenner	# Left here for compatibility:
1256685295f4SBill Fenner	# uname -m prints for DJGPP always 'pc', but it prints nothing about
125727df3f5dSRui Paulo	# the processor, so we play safe by assuming i586.
125827df3f5dSRui Paulo	# Note: whatever this is, it MUST be the same as what config.sub
125939e421e8SCy Schubert	# prints for the "djgpp" host, or else GDB configure will decide that
126027df3f5dSRui Paulo	# this is a cross-build.
1261*ee67461eSJoseph Mingrone	GUESS=i586-pc-msdosdjgpp
1262*ee67461eSJoseph Mingrone	;;
12634edb46e9SPaul Traina    Intel:Mach:3*:*)
1264*ee67461eSJoseph Mingrone	GUESS=i386-pc-mach3
1265*ee67461eSJoseph Mingrone	;;
12664edb46e9SPaul Traina    paragon:*:*:*)
1267*ee67461eSJoseph Mingrone	GUESS=i860-intel-osf1
1268*ee67461eSJoseph Mingrone	;;
12694edb46e9SPaul Traina    i860:*:4.*:*) # i860-SVR4
12704edb46e9SPaul Traina	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1271*ee67461eSJoseph Mingrone	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12724edb46e9SPaul Traina	else # Add other i860-SVR4 vendors below as they are discovered.
1273*ee67461eSJoseph Mingrone	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12744edb46e9SPaul Traina	fi
1275*ee67461eSJoseph Mingrone	;;
12764edb46e9SPaul Traina    mini*:CTIX:SYS*5:*)
12774edb46e9SPaul Traina	# "miniframe"
1278*ee67461eSJoseph Mingrone	GUESS=m68010-convergent-sysv
1279*ee67461eSJoseph Mingrone	;;
12805b0fe478SBruce M Simpson    mc68k:UNIX:SYSTEM5:3.51m)
1281*ee67461eSJoseph Mingrone	GUESS=m68k-convergent-sysv
1282*ee67461eSJoseph Mingrone	;;
12835b0fe478SBruce M Simpson    M680?0:D-NIX:5.3:*)
1284*ee67461eSJoseph Mingrone	GUESS=m68k-diab-dnix
1285*ee67461eSJoseph Mingrone	;;
128627df3f5dSRui Paulo    M68*:*:R3V[5678]*:*)
128727df3f5dSRui Paulo	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
128827df3f5dSRui Paulo    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)
12894de76e31SBill Fenner	OS_REL=''
12904de76e31SBill Fenner	test -r /etc/.relid \
12914de76e31SBill Fenner	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12924de76e31SBill Fenner	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
129339e421e8SCy Schubert	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12944de76e31SBill Fenner	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
129539e421e8SCy Schubert	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12964edb46e9SPaul Traina    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12974de76e31SBill Fenner	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
129827df3f5dSRui Paulo	  && { echo i486-ncr-sysv4; exit; } ;;
129927df3f5dSRui Paulo    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
130027df3f5dSRui Paulo	OS_REL='.3'
130127df3f5dSRui Paulo	test -r /etc/.relid \
130227df3f5dSRui Paulo	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
130327df3f5dSRui Paulo	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
130439e421e8SCy Schubert	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
130527df3f5dSRui Paulo	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
130639e421e8SCy Schubert	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
130727df3f5dSRui Paulo	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
130839e421e8SCy Schubert	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1309a90e161bSBill Fenner    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1310*ee67461eSJoseph Mingrone	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1311*ee67461eSJoseph Mingrone	;;
13124edb46e9SPaul Traina    mc68030:UNIX_System_V:4.*:*)
1313*ee67461eSJoseph Mingrone	GUESS=m68k-atari-sysv4
1314*ee67461eSJoseph Mingrone	;;
13154de76e31SBill Fenner    TSUNAMI:LynxOS:2.*:*)
1316*ee67461eSJoseph Mingrone	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1317*ee67461eSJoseph Mingrone	;;
1318a90e161bSBill Fenner    rs6000:LynxOS:2.*:*)
1319*ee67461eSJoseph Mingrone	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1320*ee67461eSJoseph Mingrone	;;
132127df3f5dSRui Paulo    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1322*ee67461eSJoseph Mingrone	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1323*ee67461eSJoseph Mingrone	;;
13244de76e31SBill Fenner    SM[BE]S:UNIX_SV:*:*)
1325*ee67461eSJoseph Mingrone	GUESS=mips-dde-sysv$UNAME_RELEASE
1326*ee67461eSJoseph Mingrone	;;
1327685295f4SBill Fenner    RM*:ReliantUNIX-*:*:*)
1328*ee67461eSJoseph Mingrone	GUESS=mips-sni-sysv4
1329*ee67461eSJoseph Mingrone	;;
13304edb46e9SPaul Traina    RM*:SINIX-*:*:*)
1331*ee67461eSJoseph Mingrone	GUESS=mips-sni-sysv4
1332*ee67461eSJoseph Mingrone	;;
13334edb46e9SPaul Traina    *:SINIX-*:*:*)
13344edb46e9SPaul Traina	if uname -p 2>/dev/null >/dev/null ; then
13354edb46e9SPaul Traina		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1336*ee67461eSJoseph Mingrone		GUESS=$UNAME_MACHINE-sni-sysv4
13374edb46e9SPaul Traina	else
1338*ee67461eSJoseph Mingrone		GUESS=ns32k-sni-sysv
13394edb46e9SPaul Traina	fi
1340*ee67461eSJoseph Mingrone	;;
13415b0fe478SBruce M Simpson    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1342685295f4SBill Fenner			# says <Richard.M.Bartel@ccMail.Census.GOV>
1343*ee67461eSJoseph Mingrone	GUESS=i586-unisys-sysv4
1344*ee67461eSJoseph Mingrone	;;
13454de76e31SBill Fenner    *:UNIX_System_V:4*:FTX*)
13464de76e31SBill Fenner	# From Gerald Hewes <hewes@openmarket.com>.
13474de76e31SBill Fenner	# How about differentiating between stratus architectures? -djm
1348*ee67461eSJoseph Mingrone	GUESS=hppa1.1-stratus-sysv4
1349*ee67461eSJoseph Mingrone	;;
13504de76e31SBill Fenner    *:*:*:FTX*)
13514de76e31SBill Fenner	# From seanf@swdc.stratus.com.
1352*ee67461eSJoseph Mingrone	GUESS=i860-stratus-sysv4
1353*ee67461eSJoseph Mingrone	;;
135427df3f5dSRui Paulo    i*86:VOS:*:*)
135527df3f5dSRui Paulo	# From Paul.Green@stratus.com.
1356*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-stratus-vos
1357*ee67461eSJoseph Mingrone	;;
13585b0fe478SBruce M Simpson    *:VOS:*:*)
13595b0fe478SBruce M Simpson	# From Paul.Green@stratus.com.
1360*ee67461eSJoseph Mingrone	GUESS=hppa1.1-stratus-vos
1361*ee67461eSJoseph Mingrone	;;
13624edb46e9SPaul Traina    mc68*:A/UX:*:*)
1363*ee67461eSJoseph Mingrone	GUESS=m68k-apple-aux$UNAME_RELEASE
1364*ee67461eSJoseph Mingrone	;;
1365685295f4SBill Fenner    news*:NEWS-OS:6*:*)
1366*ee67461eSJoseph Mingrone	GUESS=mips-sony-newsos6
1367*ee67461eSJoseph Mingrone	;;
1368685295f4SBill Fenner    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1369*ee67461eSJoseph Mingrone	if test -d /usr/nec; then
1370*ee67461eSJoseph Mingrone		GUESS=mips-nec-sysv$UNAME_RELEASE
13714edb46e9SPaul Traina	else
1372*ee67461eSJoseph Mingrone		GUESS=mips-unknown-sysv$UNAME_RELEASE
13734edb46e9SPaul Traina	fi
1374*ee67461eSJoseph Mingrone	;;
1375685295f4SBill Fenner    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1376*ee67461eSJoseph Mingrone	GUESS=powerpc-be-beos
1377*ee67461eSJoseph Mingrone	;;
1378685295f4SBill Fenner    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1379*ee67461eSJoseph Mingrone	GUESS=powerpc-apple-beos
1380*ee67461eSJoseph Mingrone	;;
1381685295f4SBill Fenner    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1382*ee67461eSJoseph Mingrone	GUESS=i586-pc-beos
1383*ee67461eSJoseph Mingrone	;;
138427df3f5dSRui Paulo    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1385*ee67461eSJoseph Mingrone	GUESS=i586-pc-haiku
1386*ee67461eSJoseph Mingrone	;;
1387*ee67461eSJoseph Mingrone    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1388*ee67461eSJoseph Mingrone	GUESS=powerpc-apple-haiku
1389*ee67461eSJoseph Mingrone	;;
1390*ee67461eSJoseph Mingrone    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1391*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-haiku
1392*ee67461eSJoseph Mingrone	;;
1393685295f4SBill Fenner    SX-4:SUPER-UX:*:*)
1394*ee67461eSJoseph Mingrone	GUESS=sx4-nec-superux$UNAME_RELEASE
1395*ee67461eSJoseph Mingrone	;;
1396685295f4SBill Fenner    SX-5:SUPER-UX:*:*)
1397*ee67461eSJoseph Mingrone	GUESS=sx5-nec-superux$UNAME_RELEASE
1398*ee67461eSJoseph Mingrone	;;
13995b0fe478SBruce M Simpson    SX-6:SUPER-UX:*:*)
1400*ee67461eSJoseph Mingrone	GUESS=sx6-nec-superux$UNAME_RELEASE
1401*ee67461eSJoseph Mingrone	;;
140227df3f5dSRui Paulo    SX-7:SUPER-UX:*:*)
1403*ee67461eSJoseph Mingrone	GUESS=sx7-nec-superux$UNAME_RELEASE
1404*ee67461eSJoseph Mingrone	;;
140527df3f5dSRui Paulo    SX-8:SUPER-UX:*:*)
1406*ee67461eSJoseph Mingrone	GUESS=sx8-nec-superux$UNAME_RELEASE
1407*ee67461eSJoseph Mingrone	;;
140827df3f5dSRui Paulo    SX-8R:SUPER-UX:*:*)
1409*ee67461eSJoseph Mingrone	GUESS=sx8r-nec-superux$UNAME_RELEASE
1410*ee67461eSJoseph Mingrone	;;
141139e421e8SCy Schubert    SX-ACE:SUPER-UX:*:*)
1412*ee67461eSJoseph Mingrone	GUESS=sxace-nec-superux$UNAME_RELEASE
1413*ee67461eSJoseph Mingrone	;;
1414685295f4SBill Fenner    Power*:Rhapsody:*:*)
1415*ee67461eSJoseph Mingrone	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1416*ee67461eSJoseph Mingrone	;;
1417685295f4SBill Fenner    *:Rhapsody:*:*)
1418*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1419*ee67461eSJoseph Mingrone	;;
1420*ee67461eSJoseph Mingrone    arm64:Darwin:*:*)
1421*ee67461eSJoseph Mingrone	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1422*ee67461eSJoseph Mingrone	;;
1423685295f4SBill Fenner    *:Darwin:*:*)
1424*ee67461eSJoseph Mingrone	UNAME_PROCESSOR=`uname -p`
1425*ee67461eSJoseph Mingrone	case $UNAME_PROCESSOR in
1426*ee67461eSJoseph Mingrone	    unknown) UNAME_PROCESSOR=powerpc ;;
1427*ee67461eSJoseph Mingrone	esac
1428*ee67461eSJoseph Mingrone	if command -v xcode-select > /dev/null 2> /dev/null && \
1429*ee67461eSJoseph Mingrone		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1430*ee67461eSJoseph Mingrone	    # Avoid executing cc if there is no toolchain installed as
1431*ee67461eSJoseph Mingrone	    # cc will be a stub that puts up a graphical alert
1432*ee67461eSJoseph Mingrone	    # prompting the user to install developer tools.
1433*ee67461eSJoseph Mingrone	    CC_FOR_BUILD=no_compiler_found
1434*ee67461eSJoseph Mingrone	else
1435*ee67461eSJoseph Mingrone	    set_cc_for_build
14368bdc5a62SPatrick Kelsey	fi
1437*ee67461eSJoseph Mingrone	if test "$CC_FOR_BUILD" != no_compiler_found; then
143827df3f5dSRui Paulo	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
143939e421e8SCy Schubert		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
144027df3f5dSRui Paulo		   grep IS_64BIT_ARCH >/dev/null
144127df3f5dSRui Paulo	    then
14428bdc5a62SPatrick Kelsey		case $UNAME_PROCESSOR in
14438bdc5a62SPatrick Kelsey		    i386) UNAME_PROCESSOR=x86_64 ;;
14448bdc5a62SPatrick Kelsey		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
14455b0fe478SBruce M Simpson		esac
14468bdc5a62SPatrick Kelsey	    fi
144739e421e8SCy Schubert	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
144839e421e8SCy Schubert	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
144939e421e8SCy Schubert		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
145039e421e8SCy Schubert		   grep IS_PPC >/dev/null
145139e421e8SCy Schubert	    then
145239e421e8SCy Schubert		UNAME_PROCESSOR=powerpc
145339e421e8SCy Schubert	    fi
14548bdc5a62SPatrick Kelsey	elif test "$UNAME_PROCESSOR" = i386 ; then
1455*ee67461eSJoseph Mingrone	    # uname -m returns i386 or x86_64
1456*ee67461eSJoseph Mingrone	    UNAME_PROCESSOR=$UNAME_MACHINE
14578bdc5a62SPatrick Kelsey	fi
1458*ee67461eSJoseph Mingrone	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1459*ee67461eSJoseph Mingrone	;;
1460685295f4SBill Fenner    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14615b0fe478SBruce M Simpson	UNAME_PROCESSOR=`uname -p`
146239e421e8SCy Schubert	if test "$UNAME_PROCESSOR" = x86; then
14635b0fe478SBruce M Simpson		UNAME_PROCESSOR=i386
1464685295f4SBill Fenner		UNAME_MACHINE=pc
1465685295f4SBill Fenner	fi
1466*ee67461eSJoseph Mingrone	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1467*ee67461eSJoseph Mingrone	;;
1468685295f4SBill Fenner    *:QNX:*:4*)
1469*ee67461eSJoseph Mingrone	GUESS=i386-pc-qnx
1470*ee67461eSJoseph Mingrone	;;
147139e421e8SCy Schubert    NEO-*:NONSTOP_KERNEL:*:*)
1472*ee67461eSJoseph Mingrone	GUESS=neo-tandem-nsk$UNAME_RELEASE
1473*ee67461eSJoseph Mingrone	;;
14748bdc5a62SPatrick Kelsey    NSE-*:NONSTOP_KERNEL:*:*)
1475*ee67461eSJoseph Mingrone	GUESS=nse-tandem-nsk$UNAME_RELEASE
1476*ee67461eSJoseph Mingrone	;;
147739e421e8SCy Schubert    NSR-*:NONSTOP_KERNEL:*:*)
1478*ee67461eSJoseph Mingrone	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1479*ee67461eSJoseph Mingrone	;;
148039e421e8SCy Schubert    NSV-*:NONSTOP_KERNEL:*:*)
1481*ee67461eSJoseph Mingrone	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1482*ee67461eSJoseph Mingrone	;;
148339e421e8SCy Schubert    NSX-*:NONSTOP_KERNEL:*:*)
1484*ee67461eSJoseph Mingrone	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1485*ee67461eSJoseph Mingrone	;;
1486685295f4SBill Fenner    *:NonStop-UX:*:*)
1487*ee67461eSJoseph Mingrone	GUESS=mips-compaq-nonstopux
1488*ee67461eSJoseph Mingrone	;;
1489685295f4SBill Fenner    BS2000:POSIX*:*:*)
1490*ee67461eSJoseph Mingrone	GUESS=bs2000-siemens-sysv
1491*ee67461eSJoseph Mingrone	;;
1492685295f4SBill Fenner    DS/*:UNIX_System_V:*:*)
1493*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1494*ee67461eSJoseph Mingrone	;;
1495685295f4SBill Fenner    *:Plan9:*:*)
1496685295f4SBill Fenner	# "uname -m" is not consistent, so use $cputype instead. 386
1497685295f4SBill Fenner	# is converted to i386 for consistency with other x86
1498685295f4SBill Fenner	# operating systems.
1499*ee67461eSJoseph Mingrone	if test "${cputype-}" = 386; then
1500685295f4SBill Fenner	    UNAME_MACHINE=i386
1501*ee67461eSJoseph Mingrone	elif test "x${cputype-}" != x; then
1502*ee67461eSJoseph Mingrone	    UNAME_MACHINE=$cputype
1503685295f4SBill Fenner	fi
1504*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-plan9
1505*ee67461eSJoseph Mingrone	;;
1506a90e161bSBill Fenner    *:TOPS-10:*:*)
1507*ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-tops10
1508*ee67461eSJoseph Mingrone	;;
1509a90e161bSBill Fenner    *:TENEX:*:*)
1510*ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-tenex
1511*ee67461eSJoseph Mingrone	;;
1512a90e161bSBill Fenner    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1513*ee67461eSJoseph Mingrone	GUESS=pdp10-dec-tops20
1514*ee67461eSJoseph Mingrone	;;
1515a90e161bSBill Fenner    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1516*ee67461eSJoseph Mingrone	GUESS=pdp10-xkl-tops20
1517*ee67461eSJoseph Mingrone	;;
1518a90e161bSBill Fenner    *:TOPS-20:*:*)
1519*ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-tops20
1520*ee67461eSJoseph Mingrone	;;
1521a90e161bSBill Fenner    *:ITS:*:*)
1522*ee67461eSJoseph Mingrone	GUESS=pdp10-unknown-its
1523*ee67461eSJoseph Mingrone	;;
15245b0fe478SBruce M Simpson    SEI:*:*:SEIUX)
1525*ee67461eSJoseph Mingrone	GUESS=mips-sei-seiux$UNAME_RELEASE
1526*ee67461eSJoseph Mingrone	;;
152727df3f5dSRui Paulo    *:DragonFly:*:*)
1528*ee67461eSJoseph Mingrone	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1529*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1530*ee67461eSJoseph Mingrone	;;
153127df3f5dSRui Paulo    *:*VMS:*:*)
153227df3f5dSRui Paulo	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1533*ee67461eSJoseph Mingrone	case $UNAME_MACHINE in
1534*ee67461eSJoseph Mingrone	    A*) GUESS=alpha-dec-vms ;;
1535*ee67461eSJoseph Mingrone	    I*) GUESS=ia64-dec-vms ;;
1536*ee67461eSJoseph Mingrone	    V*) GUESS=vax-dec-vms ;;
153727df3f5dSRui Paulo	esac ;;
153827df3f5dSRui Paulo    *:XENIX:*:SysV)
1539*ee67461eSJoseph Mingrone	GUESS=i386-pc-xenix
1540*ee67461eSJoseph Mingrone	;;
154127df3f5dSRui Paulo    i*86:skyos:*:*)
1542*ee67461eSJoseph Mingrone	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1543*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1544*ee67461eSJoseph Mingrone	;;
154527df3f5dSRui Paulo    i*86:rdos:*:*)
1546*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-rdos
1547*ee67461eSJoseph Mingrone	;;
1548*ee67461eSJoseph Mingrone    i*86:Fiwix:*:*)
1549*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-pc-fiwix
1550*ee67461eSJoseph Mingrone	;;
1551*ee67461eSJoseph Mingrone    *:AROS:*:*)
1552*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-aros
1553*ee67461eSJoseph Mingrone	;;
15543c602fabSXin LI    x86_64:VMkernel:*:*)
1555*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-esx
1556*ee67461eSJoseph Mingrone	;;
155739e421e8SCy Schubert    amd64:Isilon\ OneFS:*:*)
1558*ee67461eSJoseph Mingrone	GUESS=x86_64-unknown-onefs
1559*ee67461eSJoseph Mingrone	;;
1560*ee67461eSJoseph Mingrone    *:Unleashed:*:*)
1561*ee67461eSJoseph Mingrone	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1562*ee67461eSJoseph Mingrone	;;
15634edb46e9SPaul Trainaesac
15644edb46e9SPaul Traina
1565*ee67461eSJoseph Mingrone# Do we have a guess based on uname results?
1566*ee67461eSJoseph Mingroneif test "x$GUESS" != x; then
1567*ee67461eSJoseph Mingrone    echo "$GUESS"
1568*ee67461eSJoseph Mingrone    exit
1569*ee67461eSJoseph Mingronefi
1570*ee67461eSJoseph Mingrone
1571*ee67461eSJoseph Mingrone# No uname command or uname output not recognized.
1572*ee67461eSJoseph Mingroneset_cc_for_build
1573*ee67461eSJoseph Mingronecat > "$dummy.c" <<EOF
1574*ee67461eSJoseph Mingrone#ifdef _SEQUENT_
1575*ee67461eSJoseph Mingrone#include <sys/types.h>
1576*ee67461eSJoseph Mingrone#include <sys/utsname.h>
1577*ee67461eSJoseph Mingrone#endif
1578*ee67461eSJoseph Mingrone#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1579*ee67461eSJoseph Mingrone#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1580*ee67461eSJoseph Mingrone#include <signal.h>
1581*ee67461eSJoseph Mingrone#if defined(_SIZE_T_) || defined(SIGLOST)
1582*ee67461eSJoseph Mingrone#include <sys/utsname.h>
1583*ee67461eSJoseph Mingrone#endif
1584*ee67461eSJoseph Mingrone#endif
1585*ee67461eSJoseph Mingrone#endif
1586*ee67461eSJoseph Mingronemain ()
1587*ee67461eSJoseph Mingrone{
1588*ee67461eSJoseph Mingrone#if defined (sony)
1589*ee67461eSJoseph Mingrone#if defined (MIPSEB)
1590*ee67461eSJoseph Mingrone  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1591*ee67461eSJoseph Mingrone     I don't know....  */
1592*ee67461eSJoseph Mingrone  printf ("mips-sony-bsd\n"); exit (0);
1593*ee67461eSJoseph Mingrone#else
1594*ee67461eSJoseph Mingrone#include <sys/param.h>
1595*ee67461eSJoseph Mingrone  printf ("m68k-sony-newsos%s\n",
1596*ee67461eSJoseph Mingrone#ifdef NEWSOS4
1597*ee67461eSJoseph Mingrone  "4"
1598*ee67461eSJoseph Mingrone#else
1599*ee67461eSJoseph Mingrone  ""
1600*ee67461eSJoseph Mingrone#endif
1601*ee67461eSJoseph Mingrone  ); exit (0);
1602*ee67461eSJoseph Mingrone#endif
1603*ee67461eSJoseph Mingrone#endif
1604*ee67461eSJoseph Mingrone
1605*ee67461eSJoseph Mingrone#if defined (NeXT)
1606*ee67461eSJoseph Mingrone#if !defined (__ARCHITECTURE__)
1607*ee67461eSJoseph Mingrone#define __ARCHITECTURE__ "m68k"
1608*ee67461eSJoseph Mingrone#endif
1609*ee67461eSJoseph Mingrone  int version;
1610*ee67461eSJoseph Mingrone  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1611*ee67461eSJoseph Mingrone  if (version < 4)
1612*ee67461eSJoseph Mingrone    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1613*ee67461eSJoseph Mingrone  else
1614*ee67461eSJoseph Mingrone    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1615*ee67461eSJoseph Mingrone  exit (0);
1616*ee67461eSJoseph Mingrone#endif
1617*ee67461eSJoseph Mingrone
1618*ee67461eSJoseph Mingrone#if defined (MULTIMAX) || defined (n16)
1619*ee67461eSJoseph Mingrone#if defined (UMAXV)
1620*ee67461eSJoseph Mingrone  printf ("ns32k-encore-sysv\n"); exit (0);
1621*ee67461eSJoseph Mingrone#else
1622*ee67461eSJoseph Mingrone#if defined (CMU)
1623*ee67461eSJoseph Mingrone  printf ("ns32k-encore-mach\n"); exit (0);
1624*ee67461eSJoseph Mingrone#else
1625*ee67461eSJoseph Mingrone  printf ("ns32k-encore-bsd\n"); exit (0);
1626*ee67461eSJoseph Mingrone#endif
1627*ee67461eSJoseph Mingrone#endif
1628*ee67461eSJoseph Mingrone#endif
1629*ee67461eSJoseph Mingrone
1630*ee67461eSJoseph Mingrone#if defined (__386BSD__)
1631*ee67461eSJoseph Mingrone  printf ("i386-pc-bsd\n"); exit (0);
1632*ee67461eSJoseph Mingrone#endif
1633*ee67461eSJoseph Mingrone
1634*ee67461eSJoseph Mingrone#if defined (sequent)
1635*ee67461eSJoseph Mingrone#if defined (i386)
1636*ee67461eSJoseph Mingrone  printf ("i386-sequent-dynix\n"); exit (0);
1637*ee67461eSJoseph Mingrone#endif
1638*ee67461eSJoseph Mingrone#if defined (ns32000)
1639*ee67461eSJoseph Mingrone  printf ("ns32k-sequent-dynix\n"); exit (0);
1640*ee67461eSJoseph Mingrone#endif
1641*ee67461eSJoseph Mingrone#endif
1642*ee67461eSJoseph Mingrone
1643*ee67461eSJoseph Mingrone#if defined (_SEQUENT_)
1644*ee67461eSJoseph Mingrone  struct utsname un;
1645*ee67461eSJoseph Mingrone
1646*ee67461eSJoseph Mingrone  uname(&un);
1647*ee67461eSJoseph Mingrone  if (strncmp(un.version, "V2", 2) == 0) {
1648*ee67461eSJoseph Mingrone    printf ("i386-sequent-ptx2\n"); exit (0);
1649*ee67461eSJoseph Mingrone  }
1650*ee67461eSJoseph Mingrone  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1651*ee67461eSJoseph Mingrone    printf ("i386-sequent-ptx1\n"); exit (0);
1652*ee67461eSJoseph Mingrone  }
1653*ee67461eSJoseph Mingrone  printf ("i386-sequent-ptx\n"); exit (0);
1654*ee67461eSJoseph Mingrone#endif
1655*ee67461eSJoseph Mingrone
1656*ee67461eSJoseph Mingrone#if defined (vax)
1657*ee67461eSJoseph Mingrone#if !defined (ultrix)
1658*ee67461eSJoseph Mingrone#include <sys/param.h>
1659*ee67461eSJoseph Mingrone#if defined (BSD)
1660*ee67461eSJoseph Mingrone#if BSD == 43
1661*ee67461eSJoseph Mingrone  printf ("vax-dec-bsd4.3\n"); exit (0);
1662*ee67461eSJoseph Mingrone#else
1663*ee67461eSJoseph Mingrone#if BSD == 199006
1664*ee67461eSJoseph Mingrone  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1665*ee67461eSJoseph Mingrone#else
1666*ee67461eSJoseph Mingrone  printf ("vax-dec-bsd\n"); exit (0);
1667*ee67461eSJoseph Mingrone#endif
1668*ee67461eSJoseph Mingrone#endif
1669*ee67461eSJoseph Mingrone#else
1670*ee67461eSJoseph Mingrone  printf ("vax-dec-bsd\n"); exit (0);
1671*ee67461eSJoseph Mingrone#endif
1672*ee67461eSJoseph Mingrone#else
1673*ee67461eSJoseph Mingrone#if defined(_SIZE_T_) || defined(SIGLOST)
1674*ee67461eSJoseph Mingrone  struct utsname un;
1675*ee67461eSJoseph Mingrone  uname (&un);
1676*ee67461eSJoseph Mingrone  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1677*ee67461eSJoseph Mingrone#else
1678*ee67461eSJoseph Mingrone  printf ("vax-dec-ultrix\n"); exit (0);
1679*ee67461eSJoseph Mingrone#endif
1680*ee67461eSJoseph Mingrone#endif
1681*ee67461eSJoseph Mingrone#endif
1682*ee67461eSJoseph Mingrone#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1683*ee67461eSJoseph Mingrone#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1684*ee67461eSJoseph Mingrone#if defined(_SIZE_T_) || defined(SIGLOST)
1685*ee67461eSJoseph Mingrone  struct utsname *un;
1686*ee67461eSJoseph Mingrone  uname (&un);
1687*ee67461eSJoseph Mingrone  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1688*ee67461eSJoseph Mingrone#else
1689*ee67461eSJoseph Mingrone  printf ("mips-dec-ultrix\n"); exit (0);
1690*ee67461eSJoseph Mingrone#endif
1691*ee67461eSJoseph Mingrone#endif
1692*ee67461eSJoseph Mingrone#endif
1693*ee67461eSJoseph Mingrone
1694*ee67461eSJoseph Mingrone#if defined (alliant) && defined (i860)
1695*ee67461eSJoseph Mingrone  printf ("i860-alliant-bsd\n"); exit (0);
1696*ee67461eSJoseph Mingrone#endif
1697*ee67461eSJoseph Mingrone
1698*ee67461eSJoseph Mingrone  exit (1);
1699*ee67461eSJoseph Mingrone}
1700*ee67461eSJoseph MingroneEOF
1701*ee67461eSJoseph Mingrone
1702*ee67461eSJoseph Mingrone$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1703*ee67461eSJoseph Mingrone	{ echo "$SYSTEM_NAME"; exit; }
1704*ee67461eSJoseph Mingrone
1705*ee67461eSJoseph Mingrone# Apollos put the system type in the environment.
1706*ee67461eSJoseph Mingronetest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1707*ee67461eSJoseph Mingrone
170839e421e8SCy Schubertecho "$0: unable to guess system type" >&2
170939e421e8SCy Schubert
1710*ee67461eSJoseph Mingronecase $UNAME_MACHINE:$UNAME_SYSTEM in
171139e421e8SCy Schubert    mips:Linux | mips64:Linux)
171239e421e8SCy Schubert	# If we got here on MIPS GNU/Linux, output extra information.
1713685295f4SBill Fenner	cat >&2 <<EOF
1714685295f4SBill Fenner
171539e421e8SCy SchubertNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
171639e421e8SCy Schubertthe system type. Please install a C compiler and try again.
171739e421e8SCy SchubertEOF
171839e421e8SCy Schubert	;;
171939e421e8SCy Schubertesac
1720685295f4SBill Fenner
172139e421e8SCy Schubertcat >&2 <<EOF
172239e421e8SCy Schubert
172339e421e8SCy SchubertThis script (version $timestamp), has failed to recognize the
172439e421e8SCy Schubertoperating system you are using. If your script is old, overwrite *all*
172539e421e8SCy Schubertcopies of config.guess and config.sub with the latest versions from:
172639e421e8SCy Schubert
1727*ee67461eSJoseph Mingrone  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
172827df3f5dSRui Pauloand
1729*ee67461eSJoseph Mingrone  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1730*ee67461eSJoseph MingroneEOF
1731*ee67461eSJoseph Mingrone
1732*ee67461eSJoseph Mingroneour_year=`echo $timestamp | sed 's,-.*,,'`
1733*ee67461eSJoseph Mingronethisyear=`date +%Y`
1734*ee67461eSJoseph Mingrone# shellcheck disable=SC2003
1735*ee67461eSJoseph Mingronescript_age=`expr "$thisyear" - "$our_year"`
1736*ee67461eSJoseph Mingroneif test "$script_age" -lt 3 ; then
1737*ee67461eSJoseph Mingrone   cat >&2 <<EOF
1738685295f4SBill Fenner
173939e421e8SCy SchubertIf $0 has already been updated, send the following data and any
174039e421e8SCy Schubertinformation you think might be pertinent to config-patches@gnu.org to
174139e421e8SCy Schubertprovide the necessary information to handle your system.
1742685295f4SBill Fenner
1743a90e161bSBill Fennerconfig.guess timestamp = $timestamp
1744685295f4SBill Fenner
1745685295f4SBill Fenneruname -m = `(uname -m) 2>/dev/null || echo unknown`
1746685295f4SBill Fenneruname -r = `(uname -r) 2>/dev/null || echo unknown`
1747685295f4SBill Fenneruname -s = `(uname -s) 2>/dev/null || echo unknown`
1748685295f4SBill Fenneruname -v = `(uname -v) 2>/dev/null || echo unknown`
1749685295f4SBill Fenner
1750685295f4SBill Fenner/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1751685295f4SBill Fenner/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1752685295f4SBill Fenner
1753685295f4SBill Fennerhostinfo               = `(hostinfo) 2>/dev/null`
1754685295f4SBill Fenner/bin/universe          = `(/bin/universe) 2>/dev/null`
1755685295f4SBill Fenner/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1756685295f4SBill Fenner/bin/arch              = `(/bin/arch) 2>/dev/null`
1757685295f4SBill Fenner/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1758685295f4SBill Fenner/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1759685295f4SBill Fenner
176039e421e8SCy SchubertUNAME_MACHINE = "$UNAME_MACHINE"
176139e421e8SCy SchubertUNAME_RELEASE = "$UNAME_RELEASE"
176239e421e8SCy SchubertUNAME_SYSTEM  = "$UNAME_SYSTEM"
176339e421e8SCy SchubertUNAME_VERSION = "$UNAME_VERSION"
1764685295f4SBill FennerEOF
1765*ee67461eSJoseph Mingronefi
17664edb46e9SPaul Traina
17674edb46e9SPaul Trainaexit 1
1768685295f4SBill Fenner
1769685295f4SBill Fenner# Local variables:
177039e421e8SCy Schubert# eval: (add-hook 'before-save-hook 'time-stamp)
1771685295f4SBill Fenner# time-stamp-start: "timestamp='"
1772685295f4SBill Fenner# time-stamp-format: "%:y-%02m-%02d"
1773685295f4SBill Fenner# time-stamp-end: "'"
1774685295f4SBill Fenner# End:
1775