xref: /netbsd-src/external/gpl3/gcc.old/dist/config.guess (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg#! /bin/sh
21debfc3dSmrg# Attempt to guess a canonical system name.
3c0a68be4Smrg#   Copyright 1992-2019 Free Software Foundation, Inc.
41debfc3dSmrg
5*8feb0f0bSmrgtimestamp='2019-07-24'
61debfc3dSmrg
71debfc3dSmrg# This file is free software; you can redistribute it and/or modify it
81debfc3dSmrg# under the terms of the GNU General Public License as published by
91debfc3dSmrg# the Free Software Foundation; either version 3 of the License, or
101debfc3dSmrg# (at your option) any later version.
111debfc3dSmrg#
121debfc3dSmrg# This program is distributed in the hope that it will be useful, but
131debfc3dSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
141debfc3dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
151debfc3dSmrg# General Public License for more details.
161debfc3dSmrg#
171debfc3dSmrg# You should have received a copy of the GNU General Public License
18a2dc1f3fSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
191debfc3dSmrg#
201debfc3dSmrg# As a special exception to the GNU General Public License, if you
211debfc3dSmrg# distribute this file as part of a program that contains a
221debfc3dSmrg# configuration script generated by Autoconf, you may include it under
231debfc3dSmrg# the same distribution terms that you use for the rest of that
241debfc3dSmrg# program.  This Exception is an additional permission under section 7
251debfc3dSmrg# of the GNU General Public License, version 3 ("GPLv3").
261debfc3dSmrg#
271debfc3dSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
281debfc3dSmrg#
291debfc3dSmrg# You can get the latest version of this script from:
30a2dc1f3fSmrg# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
311debfc3dSmrg#
321debfc3dSmrg# Please send patches to <config-patches@gnu.org>.
331debfc3dSmrg
341debfc3dSmrg
351debfc3dSmrgme=`echo "$0" | sed -e 's,.*/,,'`
361debfc3dSmrg
371debfc3dSmrgusage="\
381debfc3dSmrgUsage: $0 [OPTION]
391debfc3dSmrg
401debfc3dSmrgOutput the configuration name of the system \`$me' is run on.
411debfc3dSmrg
42a2dc1f3fSmrgOptions:
431debfc3dSmrg  -h, --help         print this help, then exit
441debfc3dSmrg  -t, --time-stamp   print date of last modification, then exit
451debfc3dSmrg  -v, --version      print version number, then exit
461debfc3dSmrg
471debfc3dSmrgReport bugs and patches to <config-patches@gnu.org>."
481debfc3dSmrg
491debfc3dSmrgversion="\
501debfc3dSmrgGNU config.guess ($timestamp)
511debfc3dSmrg
521debfc3dSmrgOriginally written by Per Bothner.
53c0a68be4SmrgCopyright 1992-2019 Free Software Foundation, Inc.
541debfc3dSmrg
551debfc3dSmrgThis is free software; see the source for copying conditions.  There is NO
561debfc3dSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
571debfc3dSmrg
581debfc3dSmrghelp="
591debfc3dSmrgTry \`$me --help' for more information."
601debfc3dSmrg
611debfc3dSmrg# Parse command line
621debfc3dSmrgwhile test $# -gt 0 ; do
631debfc3dSmrg  case $1 in
641debfc3dSmrg    --time-stamp | --time* | -t )
651debfc3dSmrg       echo "$timestamp" ; exit ;;
661debfc3dSmrg    --version | -v )
671debfc3dSmrg       echo "$version" ; exit ;;
681debfc3dSmrg    --help | --h* | -h )
691debfc3dSmrg       echo "$usage"; exit ;;
701debfc3dSmrg    -- )     # Stop option processing
711debfc3dSmrg       shift; break ;;
721debfc3dSmrg    - )	# Use stdin as input.
731debfc3dSmrg       break ;;
741debfc3dSmrg    -* )
751debfc3dSmrg       echo "$me: invalid option $1$help" >&2
761debfc3dSmrg       exit 1 ;;
771debfc3dSmrg    * )
781debfc3dSmrg       break ;;
791debfc3dSmrg  esac
801debfc3dSmrgdone
811debfc3dSmrg
821debfc3dSmrgif test $# != 0; then
831debfc3dSmrg  echo "$me: too many arguments$help" >&2
841debfc3dSmrg  exit 1
851debfc3dSmrgfi
861debfc3dSmrg
871debfc3dSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
881debfc3dSmrg# compiler to aid in system detection is discouraged as it requires
891debfc3dSmrg# temporary files to be created and, as you can see below, it is a
901debfc3dSmrg# headache to deal with in a portable fashion.
911debfc3dSmrg
921debfc3dSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
931debfc3dSmrg# use `HOST_CC' if defined, but it is deprecated.
941debfc3dSmrg
951debfc3dSmrg# Portable tmp directory creation inspired by the Autoconf team.
961debfc3dSmrg
97c0a68be4Smrgtmp=
98c0a68be4Smrg# shellcheck disable=SC2172
99c0a68be4Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
100c0a68be4Smrg
101c0a68be4Smrgset_cc_for_build() {
102c0a68be4Smrg    : "${TMPDIR=/tmp}"
103c0a68be4Smrg    # shellcheck disable=SC2039
1041debfc3dSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
105c0a68be4Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
106c0a68be4Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
107c0a68be4Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
108c0a68be4Smrg    dummy=$tmp/dummy
109c0a68be4Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
110c0a68be4Smrg	,,)    echo "int x;" > "$dummy.c"
111c0a68be4Smrg	       for driver in cc gcc c89 c99 ; do
112c0a68be4Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
113c0a68be4Smrg		       CC_FOR_BUILD="$driver"
114c0a68be4Smrg		       break
115c0a68be4Smrg		   fi
116c0a68be4Smrg	       done
1171debfc3dSmrg	       if test x"$CC_FOR_BUILD" = x ; then
118c0a68be4Smrg		   CC_FOR_BUILD=no_compiler_found
1191debfc3dSmrg	       fi
1201debfc3dSmrg	       ;;
1211debfc3dSmrg	,,*)   CC_FOR_BUILD=$CC ;;
1221debfc3dSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
123c0a68be4Smrg    esac
124c0a68be4Smrg}
1251debfc3dSmrg
1261debfc3dSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1271debfc3dSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
128c0a68be4Smrgif test -f /.attbin/uname ; then
1291debfc3dSmrg	PATH=$PATH:/.attbin ; export PATH
1301debfc3dSmrgfi
1311debfc3dSmrg
1321debfc3dSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1331debfc3dSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1341debfc3dSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1351debfc3dSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1361debfc3dSmrg
137c0a68be4Smrgcase "$UNAME_SYSTEM" in
1381debfc3dSmrgLinux|GNU|GNU/*)
1391debfc3dSmrg	# If the system lacks a compiler, then just pick glibc.
1401debfc3dSmrg	# We could probably try harder.
1411debfc3dSmrg	LIBC=gnu
1421debfc3dSmrg
143c0a68be4Smrg	set_cc_for_build
144c0a68be4Smrg	cat <<-EOF > "$dummy.c"
1451debfc3dSmrg	#include <features.h>
1461debfc3dSmrg	#if defined(__UCLIBC__)
1471debfc3dSmrg	LIBC=uclibc
1481debfc3dSmrg	#elif defined(__dietlibc__)
1491debfc3dSmrg	LIBC=dietlibc
1501debfc3dSmrg	#else
1511debfc3dSmrg	LIBC=gnu
1521debfc3dSmrg	#endif
1531debfc3dSmrg	EOF
154c0a68be4Smrg	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
155c0a68be4Smrg
156c0a68be4Smrg	# If ldd exists, use it to detect musl libc.
157c0a68be4Smrg	if command -v ldd >/dev/null && \
158c0a68be4Smrg		ldd --version 2>&1 | grep -q ^musl
159c0a68be4Smrg	then
160c0a68be4Smrg	    LIBC=musl
161c0a68be4Smrg	fi
1621debfc3dSmrg	;;
1631debfc3dSmrgesac
1641debfc3dSmrg
1651debfc3dSmrg# Note: order is significant - the case branches are not exclusive.
1661debfc3dSmrg
167c0a68be4Smrgcase "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
1681debfc3dSmrg    *:NetBSD:*:*)
1691debfc3dSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
1701debfc3dSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1711debfc3dSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1721debfc3dSmrg	# switched to ELF, *-*-netbsd* would select the old
1731debfc3dSmrg	# object file format.  This provides both forward
1741debfc3dSmrg	# compatibility and a consistent mechanism for selecting the
1751debfc3dSmrg	# object file format.
1761debfc3dSmrg	#
1771debfc3dSmrg	# Note: NetBSD doesn't particularly care about the vendor
1781debfc3dSmrg	# portion of the name.  We always set it to "unknown".
1791debfc3dSmrg	sysctl="sysctl -n hw.machine_arch"
1801debfc3dSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
181c0a68be4Smrg	    "/sbin/$sysctl" 2>/dev/null || \
182c0a68be4Smrg	    "/usr/sbin/$sysctl" 2>/dev/null || \
1831debfc3dSmrg	    echo unknown)`
184c0a68be4Smrg	case "$UNAME_MACHINE_ARCH" in
185a8c74629Srin	    aarch64eb) machine=aarch64_be-unknown ;;
1861debfc3dSmrg	    armeb) machine=armeb-unknown ;;
1871debfc3dSmrg	    arm*) machine=arm-unknown ;;
1881debfc3dSmrg	    sh3el) machine=shl-unknown ;;
1891debfc3dSmrg	    sh3eb) machine=sh-unknown ;;
1901debfc3dSmrg	    sh5el) machine=sh5le-unknown ;;
1911debfc3dSmrg	    earmv*)
192c0a68be4Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
193c0a68be4Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
194c0a68be4Smrg		machine="${arch}${endian}"-unknown
1951debfc3dSmrg		;;
196c0a68be4Smrg	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
1971debfc3dSmrg	esac
1981debfc3dSmrg	# The Operating System including object format, if it has switched
1991debfc3dSmrg	# to ELF recently (or will in the future) and ABI.
200c0a68be4Smrg	case "$UNAME_MACHINE_ARCH" in
2011debfc3dSmrg	    earm*)
2021debfc3dSmrg		os=netbsdelf
2031debfc3dSmrg		;;
2041debfc3dSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
205c0a68be4Smrg		set_cc_for_build
2061debfc3dSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2071debfc3dSmrg			| grep -q __ELF__
2081debfc3dSmrg		then
2091debfc3dSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2101debfc3dSmrg		    # Return netbsd for either.  FIX?
2111debfc3dSmrg		    os=netbsd
2121debfc3dSmrg		else
2131debfc3dSmrg		    os=netbsdelf
2141debfc3dSmrg		fi
2151debfc3dSmrg		;;
2161debfc3dSmrg	    *)
2171debfc3dSmrg		os=netbsd
2181debfc3dSmrg		;;
2191debfc3dSmrg	esac
2201debfc3dSmrg	# Determine ABI tags.
221c0a68be4Smrg	case "$UNAME_MACHINE_ARCH" in
2221debfc3dSmrg	    earm*)
2231debfc3dSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
224c0a68be4Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2251debfc3dSmrg		;;
2261debfc3dSmrg	esac
2271debfc3dSmrg	# The OS release
2281debfc3dSmrg	# Debian GNU/NetBSD machines have a different userland, and
2291debfc3dSmrg	# thus, need a distinct triplet. However, they do not need
2301debfc3dSmrg	# kernel version information, so it can be replaced with a
2311debfc3dSmrg	# suitable tag, in the style of linux-gnu.
232c0a68be4Smrg	case "$UNAME_VERSION" in
2331debfc3dSmrg	    Debian*)
2341debfc3dSmrg		release='-gnu'
2351debfc3dSmrg		;;
2361debfc3dSmrg	    *)
237c0a68be4Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2381debfc3dSmrg		;;
2391debfc3dSmrg	esac
2401debfc3dSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2411debfc3dSmrg	# contains redundant information, the shorter form:
2421debfc3dSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
243c0a68be4Smrg	echo "$machine-${os}${release}${abi-}"
2441debfc3dSmrg	exit ;;
2451debfc3dSmrg    *:Bitrig:*:*)
2461debfc3dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
247c0a68be4Smrg	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
2481debfc3dSmrg	exit ;;
2491debfc3dSmrg    *:OpenBSD:*:*)
2501debfc3dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
251c0a68be4Smrg	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
2521debfc3dSmrg	exit ;;
2531debfc3dSmrg    *:LibertyBSD:*:*)
2541debfc3dSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
255c0a68be4Smrg	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
2561debfc3dSmrg	exit ;;
257a2dc1f3fSmrg    *:MidnightBSD:*:*)
258c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
259a2dc1f3fSmrg	exit ;;
2601debfc3dSmrg    *:ekkoBSD:*:*)
261c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
2621debfc3dSmrg	exit ;;
2631debfc3dSmrg    *:SolidBSD:*:*)
264c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
2651debfc3dSmrg	exit ;;
266*8feb0f0bSmrg    *:OS108:*:*)
267*8feb0f0bSmrg	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
268*8feb0f0bSmrg	exit ;;
2691debfc3dSmrg    macppc:MirBSD:*:*)
270c0a68be4Smrg	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
2711debfc3dSmrg	exit ;;
2721debfc3dSmrg    *:MirBSD:*:*)
273c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
2741debfc3dSmrg	exit ;;
2751debfc3dSmrg    *:Sortix:*:*)
276c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-sortix
2771debfc3dSmrg	exit ;;
278a2dc1f3fSmrg    *:Redox:*:*)
279c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-redox
280a2dc1f3fSmrg	exit ;;
281a2dc1f3fSmrg    mips:OSF1:*.*)
282a2dc1f3fSmrg	echo mips-dec-osf1
283a2dc1f3fSmrg	exit ;;
2841debfc3dSmrg    alpha:OSF1:*:*)
2851debfc3dSmrg	case $UNAME_RELEASE in
2861debfc3dSmrg	*4.0)
2871debfc3dSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2881debfc3dSmrg		;;
2891debfc3dSmrg	*5.*)
2901debfc3dSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2911debfc3dSmrg		;;
2921debfc3dSmrg	esac
2931debfc3dSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
2941debfc3dSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2951debfc3dSmrg	# covers most systems running today.  This code pipes the CPU
2961debfc3dSmrg	# types through head -n 1, so we only detect the type of CPU 0.
2971debfc3dSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
2981debfc3dSmrg	case "$ALPHA_CPU_TYPE" in
2991debfc3dSmrg	    "EV4 (21064)")
3001debfc3dSmrg		UNAME_MACHINE=alpha ;;
3011debfc3dSmrg	    "EV4.5 (21064)")
3021debfc3dSmrg		UNAME_MACHINE=alpha ;;
3031debfc3dSmrg	    "LCA4 (21066/21068)")
3041debfc3dSmrg		UNAME_MACHINE=alpha ;;
3051debfc3dSmrg	    "EV5 (21164)")
3061debfc3dSmrg		UNAME_MACHINE=alphaev5 ;;
3071debfc3dSmrg	    "EV5.6 (21164A)")
3081debfc3dSmrg		UNAME_MACHINE=alphaev56 ;;
3091debfc3dSmrg	    "EV5.6 (21164PC)")
3101debfc3dSmrg		UNAME_MACHINE=alphapca56 ;;
3111debfc3dSmrg	    "EV5.7 (21164PC)")
3121debfc3dSmrg		UNAME_MACHINE=alphapca57 ;;
3131debfc3dSmrg	    "EV6 (21264)")
3141debfc3dSmrg		UNAME_MACHINE=alphaev6 ;;
3151debfc3dSmrg	    "EV6.7 (21264A)")
3161debfc3dSmrg		UNAME_MACHINE=alphaev67 ;;
3171debfc3dSmrg	    "EV6.8CB (21264C)")
3181debfc3dSmrg		UNAME_MACHINE=alphaev68 ;;
3191debfc3dSmrg	    "EV6.8AL (21264B)")
3201debfc3dSmrg		UNAME_MACHINE=alphaev68 ;;
3211debfc3dSmrg	    "EV6.8CX (21264D)")
3221debfc3dSmrg		UNAME_MACHINE=alphaev68 ;;
3231debfc3dSmrg	    "EV6.9A (21264/EV69A)")
3241debfc3dSmrg		UNAME_MACHINE=alphaev69 ;;
3251debfc3dSmrg	    "EV7 (21364)")
3261debfc3dSmrg		UNAME_MACHINE=alphaev7 ;;
3271debfc3dSmrg	    "EV7.9 (21364A)")
3281debfc3dSmrg		UNAME_MACHINE=alphaev79 ;;
3291debfc3dSmrg	esac
3301debfc3dSmrg	# A Pn.n version is a patched version.
3311debfc3dSmrg	# A Vn.n version is a released version.
3321debfc3dSmrg	# A Tn.n version is a released field test version.
3331debfc3dSmrg	# A Xn.n version is an unreleased experimental baselevel.
3341debfc3dSmrg	# 1.2 uses "1.2" for uname -r.
335c0a68be4Smrg	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
3361debfc3dSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
3371debfc3dSmrg	exitcode=$?
3381debfc3dSmrg	trap '' 0
3391debfc3dSmrg	exit $exitcode ;;
3401debfc3dSmrg    Amiga*:UNIX_System_V:4.0:*)
3411debfc3dSmrg	echo m68k-unknown-sysv4
3421debfc3dSmrg	exit ;;
3431debfc3dSmrg    *:[Aa]miga[Oo][Ss]:*:*)
344c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-amigaos
3451debfc3dSmrg	exit ;;
3461debfc3dSmrg    *:[Mm]orph[Oo][Ss]:*:*)
347c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-morphos
3481debfc3dSmrg	exit ;;
3491debfc3dSmrg    *:OS/390:*:*)
3501debfc3dSmrg	echo i370-ibm-openedition
3511debfc3dSmrg	exit ;;
3521debfc3dSmrg    *:z/VM:*:*)
3531debfc3dSmrg	echo s390-ibm-zvmoe
3541debfc3dSmrg	exit ;;
3551debfc3dSmrg    *:OS400:*:*)
3561debfc3dSmrg	echo powerpc-ibm-os400
3571debfc3dSmrg	exit ;;
3581debfc3dSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
359c0a68be4Smrg	echo arm-acorn-riscix"$UNAME_RELEASE"
3601debfc3dSmrg	exit ;;
3611debfc3dSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3621debfc3dSmrg	echo arm-unknown-riscos
3631debfc3dSmrg	exit ;;
3641debfc3dSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3651debfc3dSmrg	echo hppa1.1-hitachi-hiuxmpp
3661debfc3dSmrg	exit ;;
3671debfc3dSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3681debfc3dSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3691debfc3dSmrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3701debfc3dSmrg		echo pyramid-pyramid-sysv3
3711debfc3dSmrg	else
3721debfc3dSmrg		echo pyramid-pyramid-bsd
3731debfc3dSmrg	fi
3741debfc3dSmrg	exit ;;
3751debfc3dSmrg    NILE*:*:*:dcosx)
3761debfc3dSmrg	echo pyramid-pyramid-svr4
3771debfc3dSmrg	exit ;;
3781debfc3dSmrg    DRS?6000:unix:4.0:6*)
3791debfc3dSmrg	echo sparc-icl-nx6
3801debfc3dSmrg	exit ;;
3811debfc3dSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3821debfc3dSmrg	case `/usr/bin/uname -p` in
3831debfc3dSmrg	    sparc) echo sparc-icl-nx7; exit ;;
3841debfc3dSmrg	esac ;;
3851debfc3dSmrg    s390x:SunOS:*:*)
386c0a68be4Smrg	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
3871debfc3dSmrg	exit ;;
3881debfc3dSmrg    sun4H:SunOS:5.*:*)
389c0a68be4Smrg	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
3901debfc3dSmrg	exit ;;
3911debfc3dSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
392*8feb0f0bSmrg	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
3931debfc3dSmrg	exit ;;
3941debfc3dSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
395c0a68be4Smrg	echo i386-pc-auroraux"$UNAME_RELEASE"
3961debfc3dSmrg	exit ;;
3971debfc3dSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
398c0a68be4Smrg	set_cc_for_build
3991debfc3dSmrg	SUN_ARCH=i386
4001debfc3dSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
4011debfc3dSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4021debfc3dSmrg	# This test works for both compilers.
4031debfc3dSmrg	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
4041debfc3dSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4051debfc3dSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
4061debfc3dSmrg		grep IS_64BIT_ARCH >/dev/null
4071debfc3dSmrg	    then
4081debfc3dSmrg		SUN_ARCH=x86_64
4091debfc3dSmrg	    fi
4101debfc3dSmrg	fi
411c0a68be4Smrg	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4121debfc3dSmrg	exit ;;
4131debfc3dSmrg    sun4*:SunOS:6*:*)
4141debfc3dSmrg	# According to config.sub, this is the proper way to canonicalize
4151debfc3dSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4161debfc3dSmrg	# it's likely to be more like Solaris than SunOS4.
417c0a68be4Smrg	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4181debfc3dSmrg	exit ;;
4191debfc3dSmrg    sun4*:SunOS:*:*)
4201debfc3dSmrg	case "`/usr/bin/arch -k`" in
4211debfc3dSmrg	    Series*|S4*)
4221debfc3dSmrg		UNAME_RELEASE=`uname -v`
4231debfc3dSmrg		;;
4241debfc3dSmrg	esac
4251debfc3dSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
426c0a68be4Smrg	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
4271debfc3dSmrg	exit ;;
4281debfc3dSmrg    sun3*:SunOS:*:*)
429c0a68be4Smrg	echo m68k-sun-sunos"$UNAME_RELEASE"
4301debfc3dSmrg	exit ;;
4311debfc3dSmrg    sun*:*:4.2BSD:*)
4321debfc3dSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
433c0a68be4Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4341debfc3dSmrg	case "`/bin/arch`" in
4351debfc3dSmrg	    sun3)
436c0a68be4Smrg		echo m68k-sun-sunos"$UNAME_RELEASE"
4371debfc3dSmrg		;;
4381debfc3dSmrg	    sun4)
439c0a68be4Smrg		echo sparc-sun-sunos"$UNAME_RELEASE"
4401debfc3dSmrg		;;
4411debfc3dSmrg	esac
4421debfc3dSmrg	exit ;;
4431debfc3dSmrg    aushp:SunOS:*:*)
444c0a68be4Smrg	echo sparc-auspex-sunos"$UNAME_RELEASE"
4451debfc3dSmrg	exit ;;
4461debfc3dSmrg    # The situation for MiNT is a little confusing.  The machine name
4471debfc3dSmrg    # can be virtually everything (everything which is not
4481debfc3dSmrg    # "atarist" or "atariste" at least should have a processor
4491debfc3dSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4501debfc3dSmrg    # to the lowercase version "mint" (or "freemint").  Finally
4511debfc3dSmrg    # the system name "TOS" denotes a system which is actually not
4521debfc3dSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4531debfc3dSmrg    # be no problem.
4541debfc3dSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
455c0a68be4Smrg	echo m68k-atari-mint"$UNAME_RELEASE"
4561debfc3dSmrg	exit ;;
4571debfc3dSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
458c0a68be4Smrg	echo m68k-atari-mint"$UNAME_RELEASE"
4591debfc3dSmrg	exit ;;
4601debfc3dSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
461c0a68be4Smrg	echo m68k-atari-mint"$UNAME_RELEASE"
4621debfc3dSmrg	exit ;;
4631debfc3dSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
464c0a68be4Smrg	echo m68k-milan-mint"$UNAME_RELEASE"
4651debfc3dSmrg	exit ;;
4661debfc3dSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
467c0a68be4Smrg	echo m68k-hades-mint"$UNAME_RELEASE"
4681debfc3dSmrg	exit ;;
4691debfc3dSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
470c0a68be4Smrg	echo m68k-unknown-mint"$UNAME_RELEASE"
4711debfc3dSmrg	exit ;;
4721debfc3dSmrg    m68k:machten:*:*)
473c0a68be4Smrg	echo m68k-apple-machten"$UNAME_RELEASE"
4741debfc3dSmrg	exit ;;
4751debfc3dSmrg    powerpc:machten:*:*)
476c0a68be4Smrg	echo powerpc-apple-machten"$UNAME_RELEASE"
4771debfc3dSmrg	exit ;;
4781debfc3dSmrg    RISC*:Mach:*:*)
4791debfc3dSmrg	echo mips-dec-mach_bsd4.3
4801debfc3dSmrg	exit ;;
4811debfc3dSmrg    RISC*:ULTRIX:*:*)
482c0a68be4Smrg	echo mips-dec-ultrix"$UNAME_RELEASE"
4831debfc3dSmrg	exit ;;
4841debfc3dSmrg    VAX*:ULTRIX*:*:*)
485c0a68be4Smrg	echo vax-dec-ultrix"$UNAME_RELEASE"
4861debfc3dSmrg	exit ;;
4871debfc3dSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
488c0a68be4Smrg	echo clipper-intergraph-clix"$UNAME_RELEASE"
4891debfc3dSmrg	exit ;;
4901debfc3dSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
491c0a68be4Smrg	set_cc_for_build
492c0a68be4Smrg	sed 's/^	//' << EOF > "$dummy.c"
4931debfc3dSmrg#ifdef __cplusplus
4941debfc3dSmrg#include <stdio.h>  /* for printf() prototype */
4951debfc3dSmrg	int main (int argc, char *argv[]) {
4961debfc3dSmrg#else
4971debfc3dSmrg	int main (argc, argv) int argc; char *argv[]; {
4981debfc3dSmrg#endif
4991debfc3dSmrg	#if defined (host_mips) && defined (MIPSEB)
5001debfc3dSmrg	#if defined (SYSTYPE_SYSV)
501a2dc1f3fSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5021debfc3dSmrg	#endif
5031debfc3dSmrg	#if defined (SYSTYPE_SVR4)
504a2dc1f3fSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5051debfc3dSmrg	#endif
5061debfc3dSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
507a2dc1f3fSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5081debfc3dSmrg	#endif
5091debfc3dSmrg	#endif
5101debfc3dSmrg	  exit (-1);
5111debfc3dSmrg	}
5121debfc3dSmrgEOF
513c0a68be4Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
514c0a68be4Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
515c0a68be4Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5161debfc3dSmrg	    { echo "$SYSTEM_NAME"; exit; }
517c0a68be4Smrg	echo mips-mips-riscos"$UNAME_RELEASE"
5181debfc3dSmrg	exit ;;
5191debfc3dSmrg    Motorola:PowerMAX_OS:*:*)
5201debfc3dSmrg	echo powerpc-motorola-powermax
5211debfc3dSmrg	exit ;;
5221debfc3dSmrg    Motorola:*:4.3:PL8-*)
5231debfc3dSmrg	echo powerpc-harris-powermax
5241debfc3dSmrg	exit ;;
5251debfc3dSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5261debfc3dSmrg	echo powerpc-harris-powermax
5271debfc3dSmrg	exit ;;
5281debfc3dSmrg    Night_Hawk:Power_UNIX:*:*)
5291debfc3dSmrg	echo powerpc-harris-powerunix
5301debfc3dSmrg	exit ;;
5311debfc3dSmrg    m88k:CX/UX:7*:*)
5321debfc3dSmrg	echo m88k-harris-cxux7
5331debfc3dSmrg	exit ;;
5341debfc3dSmrg    m88k:*:4*:R4*)
5351debfc3dSmrg	echo m88k-motorola-sysv4
5361debfc3dSmrg	exit ;;
5371debfc3dSmrg    m88k:*:3*:R3*)
5381debfc3dSmrg	echo m88k-motorola-sysv3
5391debfc3dSmrg	exit ;;
5401debfc3dSmrg    AViiON:dgux:*:*)
5411debfc3dSmrg	# DG/UX returns AViiON for all architectures
5421debfc3dSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
543c0a68be4Smrg	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
5441debfc3dSmrg	then
545c0a68be4Smrg	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
546c0a68be4Smrg	       [ "$TARGET_BINARY_INTERFACE"x = x ]
5471debfc3dSmrg	    then
548c0a68be4Smrg		echo m88k-dg-dgux"$UNAME_RELEASE"
5491debfc3dSmrg	    else
550c0a68be4Smrg		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
5511debfc3dSmrg	    fi
5521debfc3dSmrg	else
553c0a68be4Smrg	    echo i586-dg-dgux"$UNAME_RELEASE"
5541debfc3dSmrg	fi
5551debfc3dSmrg	exit ;;
5561debfc3dSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5571debfc3dSmrg	echo m88k-dolphin-sysv3
5581debfc3dSmrg	exit ;;
5591debfc3dSmrg    M88*:*:R3*:*)
5601debfc3dSmrg	# Delta 88k system running SVR3
5611debfc3dSmrg	echo m88k-motorola-sysv3
5621debfc3dSmrg	exit ;;
5631debfc3dSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5641debfc3dSmrg	echo m88k-tektronix-sysv3
5651debfc3dSmrg	exit ;;
5661debfc3dSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5671debfc3dSmrg	echo m68k-tektronix-bsd
5681debfc3dSmrg	exit ;;
5691debfc3dSmrg    *:IRIX*:*:*)
570c0a68be4Smrg	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
5711debfc3dSmrg	exit ;;
5721debfc3dSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5731debfc3dSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5741debfc3dSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5751debfc3dSmrg    i*86:AIX:*:*)
5761debfc3dSmrg	echo i386-ibm-aix
5771debfc3dSmrg	exit ;;
5781debfc3dSmrg    ia64:AIX:*:*)
5791debfc3dSmrg	if [ -x /usr/bin/oslevel ] ; then
5801debfc3dSmrg		IBM_REV=`/usr/bin/oslevel`
5811debfc3dSmrg	else
582c0a68be4Smrg		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
5831debfc3dSmrg	fi
584c0a68be4Smrg	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
5851debfc3dSmrg	exit ;;
5861debfc3dSmrg    *:AIX:2:3)
5871debfc3dSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
588c0a68be4Smrg		set_cc_for_build
589c0a68be4Smrg		sed 's/^		//' << EOF > "$dummy.c"
5901debfc3dSmrg		#include <sys/systemcfg.h>
5911debfc3dSmrg
5921debfc3dSmrg		main()
5931debfc3dSmrg			{
5941debfc3dSmrg			if (!__power_pc())
5951debfc3dSmrg				exit(1);
5961debfc3dSmrg			puts("powerpc-ibm-aix3.2.5");
5971debfc3dSmrg			exit(0);
5981debfc3dSmrg			}
5991debfc3dSmrgEOF
600c0a68be4Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6011debfc3dSmrg		then
6021debfc3dSmrg			echo "$SYSTEM_NAME"
6031debfc3dSmrg		else
6041debfc3dSmrg			echo rs6000-ibm-aix3.2.5
6051debfc3dSmrg		fi
6061debfc3dSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6071debfc3dSmrg		echo rs6000-ibm-aix3.2.4
6081debfc3dSmrg	else
6091debfc3dSmrg		echo rs6000-ibm-aix3.2
6101debfc3dSmrg	fi
6111debfc3dSmrg	exit ;;
6121debfc3dSmrg    *:AIX:*:[4567])
6131debfc3dSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
614c0a68be4Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6151debfc3dSmrg		IBM_ARCH=rs6000
6161debfc3dSmrg	else
6171debfc3dSmrg		IBM_ARCH=powerpc
6181debfc3dSmrg	fi
6191debfc3dSmrg	if [ -x /usr/bin/lslpp ] ; then
6201debfc3dSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
6211debfc3dSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6221debfc3dSmrg	else
623c0a68be4Smrg		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
6241debfc3dSmrg	fi
625c0a68be4Smrg	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
6261debfc3dSmrg	exit ;;
6271debfc3dSmrg    *:AIX:*:*)
6281debfc3dSmrg	echo rs6000-ibm-aix
6291debfc3dSmrg	exit ;;
630a2dc1f3fSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6311debfc3dSmrg	echo romp-ibm-bsd4.4
6321debfc3dSmrg	exit ;;
6331debfc3dSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
634c0a68be4Smrg	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
6351debfc3dSmrg	exit ;;                             # report: romp-ibm BSD 4.3
6361debfc3dSmrg    *:BOSX:*:*)
6371debfc3dSmrg	echo rs6000-bull-bosx
6381debfc3dSmrg	exit ;;
6391debfc3dSmrg    DPX/2?00:B.O.S.:*:*)
6401debfc3dSmrg	echo m68k-bull-sysv3
6411debfc3dSmrg	exit ;;
6421debfc3dSmrg    9000/[34]??:4.3bsd:1.*:*)
6431debfc3dSmrg	echo m68k-hp-bsd
6441debfc3dSmrg	exit ;;
6451debfc3dSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6461debfc3dSmrg	echo m68k-hp-bsd4.4
6471debfc3dSmrg	exit ;;
6481debfc3dSmrg    9000/[34678]??:HP-UX:*:*)
649c0a68be4Smrg	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
650c0a68be4Smrg	case "$UNAME_MACHINE" in
6511debfc3dSmrg	    9000/31?)            HP_ARCH=m68000 ;;
6521debfc3dSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6531debfc3dSmrg	    9000/[678][0-9][0-9])
6541debfc3dSmrg		if [ -x /usr/bin/getconf ]; then
6551debfc3dSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6561debfc3dSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
657c0a68be4Smrg		    case "$sc_cpu_version" in
6581debfc3dSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6591debfc3dSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6601debfc3dSmrg		      532)                      # CPU_PA_RISC2_0
661c0a68be4Smrg			case "$sc_kernel_bits" in
6621debfc3dSmrg			  32) HP_ARCH=hppa2.0n ;;
6631debfc3dSmrg			  64) HP_ARCH=hppa2.0w ;;
6641debfc3dSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
6651debfc3dSmrg			esac ;;
6661debfc3dSmrg		    esac
6671debfc3dSmrg		fi
668c0a68be4Smrg		if [ "$HP_ARCH" = "" ]; then
669c0a68be4Smrg		    set_cc_for_build
670c0a68be4Smrg		    sed 's/^		//' << EOF > "$dummy.c"
6711debfc3dSmrg
6721debfc3dSmrg		#define _HPUX_SOURCE
6731debfc3dSmrg		#include <stdlib.h>
6741debfc3dSmrg		#include <unistd.h>
6751debfc3dSmrg
6761debfc3dSmrg		int main ()
6771debfc3dSmrg		{
6781debfc3dSmrg		#if defined(_SC_KERNEL_BITS)
6791debfc3dSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
6801debfc3dSmrg		#endif
6811debfc3dSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
6821debfc3dSmrg
6831debfc3dSmrg		    switch (cpu)
6841debfc3dSmrg			{
6851debfc3dSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6861debfc3dSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6871debfc3dSmrg			case CPU_PA_RISC2_0:
6881debfc3dSmrg		#if defined(_SC_KERNEL_BITS)
6891debfc3dSmrg			    switch (bits)
6901debfc3dSmrg				{
6911debfc3dSmrg				case 64: puts ("hppa2.0w"); break;
6921debfc3dSmrg				case 32: puts ("hppa2.0n"); break;
6931debfc3dSmrg				default: puts ("hppa2.0"); break;
6941debfc3dSmrg				} break;
6951debfc3dSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
6961debfc3dSmrg			    puts ("hppa2.0"); break;
6971debfc3dSmrg		#endif
6981debfc3dSmrg			default: puts ("hppa1.0"); break;
6991debfc3dSmrg			}
7001debfc3dSmrg		    exit (0);
7011debfc3dSmrg		}
7021debfc3dSmrgEOF
703c0a68be4Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7041debfc3dSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7051debfc3dSmrg		fi ;;
7061debfc3dSmrg	esac
707c0a68be4Smrg	if [ "$HP_ARCH" = hppa2.0w ]
7081debfc3dSmrg	then
709c0a68be4Smrg	    set_cc_for_build
7101debfc3dSmrg
7111debfc3dSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7121debfc3dSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7131debfc3dSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7141debfc3dSmrg	    #
7151debfc3dSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
7161debfc3dSmrg	    # => hppa2.0w-hp-hpux11.23
7171debfc3dSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7181debfc3dSmrg	    # => hppa64-hp-hpux11.23
7191debfc3dSmrg
7201debfc3dSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7211debfc3dSmrg		grep -q __LP64__
7221debfc3dSmrg	    then
7231debfc3dSmrg		HP_ARCH=hppa2.0w
7241debfc3dSmrg	    else
7251debfc3dSmrg		HP_ARCH=hppa64
7261debfc3dSmrg	    fi
7271debfc3dSmrg	fi
728c0a68be4Smrg	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
7291debfc3dSmrg	exit ;;
7301debfc3dSmrg    ia64:HP-UX:*:*)
731c0a68be4Smrg	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
732c0a68be4Smrg	echo ia64-hp-hpux"$HPUX_REV"
7331debfc3dSmrg	exit ;;
7341debfc3dSmrg    3050*:HI-UX:*:*)
735c0a68be4Smrg	set_cc_for_build
736c0a68be4Smrg	sed 's/^	//' << EOF > "$dummy.c"
7371debfc3dSmrg	#include <unistd.h>
7381debfc3dSmrg	int
7391debfc3dSmrg	main ()
7401debfc3dSmrg	{
7411debfc3dSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
7421debfc3dSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7431debfc3dSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7441debfc3dSmrg	     results, however.  */
7451debfc3dSmrg	  if (CPU_IS_PA_RISC (cpu))
7461debfc3dSmrg	    {
7471debfc3dSmrg	      switch (cpu)
7481debfc3dSmrg		{
7491debfc3dSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7501debfc3dSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7511debfc3dSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7521debfc3dSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7531debfc3dSmrg		}
7541debfc3dSmrg	    }
7551debfc3dSmrg	  else if (CPU_IS_HP_MC68K (cpu))
7561debfc3dSmrg	    puts ("m68k-hitachi-hiuxwe2");
7571debfc3dSmrg	  else puts ("unknown-hitachi-hiuxwe2");
7581debfc3dSmrg	  exit (0);
7591debfc3dSmrg	}
7601debfc3dSmrgEOF
761c0a68be4Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
7621debfc3dSmrg		{ echo "$SYSTEM_NAME"; exit; }
7631debfc3dSmrg	echo unknown-hitachi-hiuxwe2
7641debfc3dSmrg	exit ;;
7651debfc3dSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
7661debfc3dSmrg	echo hppa1.1-hp-bsd
7671debfc3dSmrg	exit ;;
7681debfc3dSmrg    9000/8??:4.3bsd:*:*)
7691debfc3dSmrg	echo hppa1.0-hp-bsd
7701debfc3dSmrg	exit ;;
7711debfc3dSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7721debfc3dSmrg	echo hppa1.0-hp-mpeix
7731debfc3dSmrg	exit ;;
7741debfc3dSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
7751debfc3dSmrg	echo hppa1.1-hp-osf
7761debfc3dSmrg	exit ;;
7771debfc3dSmrg    hp8??:OSF1:*:*)
7781debfc3dSmrg	echo hppa1.0-hp-osf
7791debfc3dSmrg	exit ;;
7801debfc3dSmrg    i*86:OSF1:*:*)
7811debfc3dSmrg	if [ -x /usr/sbin/sysversion ] ; then
782c0a68be4Smrg	    echo "$UNAME_MACHINE"-unknown-osf1mk
7831debfc3dSmrg	else
784c0a68be4Smrg	    echo "$UNAME_MACHINE"-unknown-osf1
7851debfc3dSmrg	fi
7861debfc3dSmrg	exit ;;
7871debfc3dSmrg    parisc*:Lites*:*:*)
7881debfc3dSmrg	echo hppa1.1-hp-lites
7891debfc3dSmrg	exit ;;
7901debfc3dSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7911debfc3dSmrg	echo c1-convex-bsd
7921debfc3dSmrg	exit ;;
7931debfc3dSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7941debfc3dSmrg	if getsysinfo -f scalar_acc
7951debfc3dSmrg	then echo c32-convex-bsd
7961debfc3dSmrg	else echo c2-convex-bsd
7971debfc3dSmrg	fi
7981debfc3dSmrg	exit ;;
7991debfc3dSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8001debfc3dSmrg	echo c34-convex-bsd
8011debfc3dSmrg	exit ;;
8021debfc3dSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8031debfc3dSmrg	echo c38-convex-bsd
8041debfc3dSmrg	exit ;;
8051debfc3dSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8061debfc3dSmrg	echo c4-convex-bsd
8071debfc3dSmrg	exit ;;
8081debfc3dSmrg    CRAY*Y-MP:*:*:*)
809c0a68be4Smrg	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8101debfc3dSmrg	exit ;;
8111debfc3dSmrg    CRAY*[A-Z]90:*:*:*)
812c0a68be4Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8131debfc3dSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8141debfc3dSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8151debfc3dSmrg	      -e 's/\.[^.]*$/.X/'
8161debfc3dSmrg	exit ;;
8171debfc3dSmrg    CRAY*TS:*:*:*)
818c0a68be4Smrg	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8191debfc3dSmrg	exit ;;
8201debfc3dSmrg    CRAY*T3E:*:*:*)
821c0a68be4Smrg	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8221debfc3dSmrg	exit ;;
8231debfc3dSmrg    CRAY*SV1:*:*:*)
824c0a68be4Smrg	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8251debfc3dSmrg	exit ;;
8261debfc3dSmrg    *:UNICOS/mp:*:*)
827c0a68be4Smrg	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8281debfc3dSmrg	exit ;;
8291debfc3dSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8301debfc3dSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8311debfc3dSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
832c0a68be4Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
8331debfc3dSmrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8341debfc3dSmrg	exit ;;
8351debfc3dSmrg    5000:UNIX_System_V:4.*:*)
8361debfc3dSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
837c0a68be4Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
8381debfc3dSmrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8391debfc3dSmrg	exit ;;
8401debfc3dSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
841c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
8421debfc3dSmrg	exit ;;
8431debfc3dSmrg    sparc*:BSD/OS:*:*)
844c0a68be4Smrg	echo sparc-unknown-bsdi"$UNAME_RELEASE"
8451debfc3dSmrg	exit ;;
8461debfc3dSmrg    *:BSD/OS:*:*)
847c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
848c0a68be4Smrg	exit ;;
849c0a68be4Smrg    arm:FreeBSD:*:*)
850c0a68be4Smrg	UNAME_PROCESSOR=`uname -p`
851c0a68be4Smrg	set_cc_for_build
852c0a68be4Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
853c0a68be4Smrg	    | grep -q __ARM_PCS_VFP
854c0a68be4Smrg	then
855c0a68be4Smrg	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
856c0a68be4Smrg	else
857c0a68be4Smrg	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
858c0a68be4Smrg	fi
8591debfc3dSmrg	exit ;;
8601debfc3dSmrg    *:FreeBSD:*:*)
8611debfc3dSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
862c0a68be4Smrg	case "$UNAME_PROCESSOR" in
8631debfc3dSmrg	    amd64)
8641debfc3dSmrg		UNAME_PROCESSOR=x86_64 ;;
8651debfc3dSmrg	    i386)
8661debfc3dSmrg		UNAME_PROCESSOR=i586 ;;
8671debfc3dSmrg	esac
868c0a68be4Smrg	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
8691debfc3dSmrg	exit ;;
8701debfc3dSmrg    i*:CYGWIN*:*)
871c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-cygwin
8721debfc3dSmrg	exit ;;
8731debfc3dSmrg    *:MINGW64*:*)
874c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-mingw64
8751debfc3dSmrg	exit ;;
8761debfc3dSmrg    *:MINGW*:*)
877c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-mingw32
8781debfc3dSmrg	exit ;;
8791debfc3dSmrg    *:MSYS*:*)
880c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-msys
8811debfc3dSmrg	exit ;;
8821debfc3dSmrg    i*:PW*:*)
883c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-pw32
8841debfc3dSmrg	exit ;;
8851debfc3dSmrg    *:Interix*:*)
886c0a68be4Smrg	case "$UNAME_MACHINE" in
8871debfc3dSmrg	    x86)
888c0a68be4Smrg		echo i586-pc-interix"$UNAME_RELEASE"
8891debfc3dSmrg		exit ;;
8901debfc3dSmrg	    authenticamd | genuineintel | EM64T)
891c0a68be4Smrg		echo x86_64-unknown-interix"$UNAME_RELEASE"
8921debfc3dSmrg		exit ;;
8931debfc3dSmrg	    IA64)
894c0a68be4Smrg		echo ia64-unknown-interix"$UNAME_RELEASE"
8951debfc3dSmrg		exit ;;
8961debfc3dSmrg	esac ;;
8971debfc3dSmrg    i*:UWIN*:*)
898c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-uwin
8991debfc3dSmrg	exit ;;
9001debfc3dSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
901c0a68be4Smrg	echo x86_64-pc-cygwin
9021debfc3dSmrg	exit ;;
9031debfc3dSmrg    prep*:SunOS:5.*:*)
904c0a68be4Smrg	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
9051debfc3dSmrg	exit ;;
9061debfc3dSmrg    *:GNU:*:*)
9071debfc3dSmrg	# the GNU system
908c0a68be4Smrg	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
9091debfc3dSmrg	exit ;;
9101debfc3dSmrg    *:GNU/*:*:*)
9111debfc3dSmrg	# other systems with GNU libc and userland
912c0a68be4Smrg	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
9131debfc3dSmrg	exit ;;
914c0a68be4Smrg    *:Minix:*:*)
915c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-minix
9161debfc3dSmrg	exit ;;
9171debfc3dSmrg    aarch64:Linux:*:*)
918c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9191debfc3dSmrg	exit ;;
9201debfc3dSmrg    aarch64_be:Linux:*:*)
9211debfc3dSmrg	UNAME_MACHINE=aarch64_be
922c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9231debfc3dSmrg	exit ;;
9241debfc3dSmrg    alpha:Linux:*:*)
9251debfc3dSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
9261debfc3dSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9271debfc3dSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9281debfc3dSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9291debfc3dSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9301debfc3dSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9311debfc3dSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9321debfc3dSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9331debfc3dSmrg	esac
9341debfc3dSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9351debfc3dSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
936c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9371debfc3dSmrg	exit ;;
9381debfc3dSmrg    arc:Linux:*:* | arceb:Linux:*:*)
939c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9401debfc3dSmrg	exit ;;
9411debfc3dSmrg    arm*:Linux:*:*)
942c0a68be4Smrg	set_cc_for_build
9431debfc3dSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9441debfc3dSmrg	    | grep -q __ARM_EABI__
9451debfc3dSmrg	then
946c0a68be4Smrg	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9471debfc3dSmrg	else
9481debfc3dSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
9491debfc3dSmrg		| grep -q __ARM_PCS_VFP
9501debfc3dSmrg	    then
951c0a68be4Smrg		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
9521debfc3dSmrg	    else
953c0a68be4Smrg		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
9541debfc3dSmrg	    fi
9551debfc3dSmrg	fi
9561debfc3dSmrg	exit ;;
9571debfc3dSmrg    avr32*:Linux:*:*)
958c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9591debfc3dSmrg	exit ;;
9601debfc3dSmrg    cris:Linux:*:*)
961c0a68be4Smrg	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
9621debfc3dSmrg	exit ;;
9631debfc3dSmrg    crisv32:Linux:*:*)
964c0a68be4Smrg	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
9651debfc3dSmrg	exit ;;
9661debfc3dSmrg    e2k:Linux:*:*)
967c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9681debfc3dSmrg	exit ;;
9691debfc3dSmrg    frv:Linux:*:*)
970c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9711debfc3dSmrg	exit ;;
9721debfc3dSmrg    hexagon:Linux:*:*)
973c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9741debfc3dSmrg	exit ;;
9751debfc3dSmrg    i*86:Linux:*:*)
976c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
9771debfc3dSmrg	exit ;;
9781debfc3dSmrg    ia64:Linux:*:*)
979c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9801debfc3dSmrg	exit ;;
9811debfc3dSmrg    k1om:Linux:*:*)
982c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9831debfc3dSmrg	exit ;;
9841debfc3dSmrg    m32r*:Linux:*:*)
985c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9861debfc3dSmrg	exit ;;
9871debfc3dSmrg    m68*:Linux:*:*)
988c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9891debfc3dSmrg	exit ;;
9901debfc3dSmrg    mips:Linux:*:* | mips64:Linux:*:*)
991c0a68be4Smrg	set_cc_for_build
992*8feb0f0bSmrg	IS_GLIBC=0
993*8feb0f0bSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
994c0a68be4Smrg	sed 's/^	//' << EOF > "$dummy.c"
9951debfc3dSmrg	#undef CPU
996*8feb0f0bSmrg	#undef mips
997*8feb0f0bSmrg	#undef mipsel
998*8feb0f0bSmrg	#undef mips64
999*8feb0f0bSmrg	#undef mips64el
1000*8feb0f0bSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1001*8feb0f0bSmrg	LIBCABI=gnuabi64
1002*8feb0f0bSmrg	#else
1003*8feb0f0bSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1004*8feb0f0bSmrg	LIBCABI=gnuabin32
1005*8feb0f0bSmrg	#else
1006*8feb0f0bSmrg	LIBCABI=${LIBC}
1007*8feb0f0bSmrg	#endif
1008*8feb0f0bSmrg	#endif
1009*8feb0f0bSmrg
1010*8feb0f0bSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1011*8feb0f0bSmrg	CPU=mipsisa64r6
1012*8feb0f0bSmrg	#else
1013*8feb0f0bSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1014*8feb0f0bSmrg	CPU=mipsisa32r6
1015*8feb0f0bSmrg	#else
1016*8feb0f0bSmrg	#if defined(__mips64)
1017*8feb0f0bSmrg	CPU=mips64
1018*8feb0f0bSmrg	#else
1019*8feb0f0bSmrg	CPU=mips
1020*8feb0f0bSmrg	#endif
1021*8feb0f0bSmrg	#endif
1022*8feb0f0bSmrg	#endif
1023*8feb0f0bSmrg
10241debfc3dSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1025*8feb0f0bSmrg	MIPS_ENDIAN=el
10261debfc3dSmrg	#else
10271debfc3dSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1028*8feb0f0bSmrg	MIPS_ENDIAN=
10291debfc3dSmrg	#else
1030*8feb0f0bSmrg	MIPS_ENDIAN=
10311debfc3dSmrg	#endif
10321debfc3dSmrg	#endif
10331debfc3dSmrgEOF
1034*8feb0f0bSmrg	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
1035*8feb0f0bSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10361debfc3dSmrg	;;
10371debfc3dSmrg    mips64el:Linux:*:*)
1038c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10391debfc3dSmrg	exit ;;
10401debfc3dSmrg    openrisc*:Linux:*:*)
1041c0a68be4Smrg	echo or1k-unknown-linux-"$LIBC"
10421debfc3dSmrg	exit ;;
10431debfc3dSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1044c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10451debfc3dSmrg	exit ;;
10461debfc3dSmrg    padre:Linux:*:*)
1047c0a68be4Smrg	echo sparc-unknown-linux-"$LIBC"
10481debfc3dSmrg	exit ;;
10491debfc3dSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1050c0a68be4Smrg	echo hppa64-unknown-linux-"$LIBC"
10511debfc3dSmrg	exit ;;
10521debfc3dSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
10531debfc3dSmrg	# Look for CPU level
10541debfc3dSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1055c0a68be4Smrg	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1056c0a68be4Smrg	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1057c0a68be4Smrg	  *)    echo hppa-unknown-linux-"$LIBC" ;;
10581debfc3dSmrg	esac
10591debfc3dSmrg	exit ;;
10601debfc3dSmrg    ppc64:Linux:*:*)
1061c0a68be4Smrg	echo powerpc64-unknown-linux-"$LIBC"
10621debfc3dSmrg	exit ;;
10631debfc3dSmrg    ppc:Linux:*:*)
1064c0a68be4Smrg	echo powerpc-unknown-linux-"$LIBC"
10651debfc3dSmrg	exit ;;
10661debfc3dSmrg    ppc64le:Linux:*:*)
1067c0a68be4Smrg	echo powerpc64le-unknown-linux-"$LIBC"
10681debfc3dSmrg	exit ;;
10691debfc3dSmrg    ppcle:Linux:*:*)
1070c0a68be4Smrg	echo powerpcle-unknown-linux-"$LIBC"
10711debfc3dSmrg	exit ;;
10721debfc3dSmrg    riscv32:Linux:*:* | riscv64:Linux:*:*)
1073c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10741debfc3dSmrg	exit ;;
10751debfc3dSmrg    s390:Linux:*:* | s390x:Linux:*:*)
1076c0a68be4Smrg	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
10771debfc3dSmrg	exit ;;
10781debfc3dSmrg    sh64*:Linux:*:*)
1079c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10801debfc3dSmrg	exit ;;
10811debfc3dSmrg    sh*:Linux:*:*)
1082c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10831debfc3dSmrg	exit ;;
10841debfc3dSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1085c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10861debfc3dSmrg	exit ;;
10871debfc3dSmrg    tile*:Linux:*:*)
1088c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10891debfc3dSmrg	exit ;;
10901debfc3dSmrg    vax:Linux:*:*)
1091c0a68be4Smrg	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
10921debfc3dSmrg	exit ;;
10931debfc3dSmrg    x86_64:Linux:*:*)
1094c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
10951debfc3dSmrg	exit ;;
10961debfc3dSmrg    xtensa*:Linux:*:*)
1097c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10981debfc3dSmrg	exit ;;
10991debfc3dSmrg    i*86:DYNIX/ptx:4*:*)
11001debfc3dSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11011debfc3dSmrg	# earlier versions are messed up and put the nodename in both
11021debfc3dSmrg	# sysname and nodename.
11031debfc3dSmrg	echo i386-sequent-sysv4
11041debfc3dSmrg	exit ;;
11051debfc3dSmrg    i*86:UNIX_SV:4.2MP:2.*)
11061debfc3dSmrg	# Unixware is an offshoot of SVR4, but it has its own version
11071debfc3dSmrg	# number series starting with 2...
11081debfc3dSmrg	# I am not positive that other SVR4 systems won't match this,
11091debfc3dSmrg	# I just have to hope.  -- rms.
11101debfc3dSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1111c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
11121debfc3dSmrg	exit ;;
11131debfc3dSmrg    i*86:OS/2:*:*)
11141debfc3dSmrg	# If we were able to find `uname', then EMX Unix compatibility
11151debfc3dSmrg	# is probably installed.
1116c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-os2-emx
11171debfc3dSmrg	exit ;;
11181debfc3dSmrg    i*86:XTS-300:*:STOP)
1119c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-stop
11201debfc3dSmrg	exit ;;
11211debfc3dSmrg    i*86:atheos:*:*)
1122c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-atheos
11231debfc3dSmrg	exit ;;
11241debfc3dSmrg    i*86:syllable:*:*)
1125c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-syllable
11261debfc3dSmrg	exit ;;
11271debfc3dSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1128c0a68be4Smrg	echo i386-unknown-lynxos"$UNAME_RELEASE"
11291debfc3dSmrg	exit ;;
11301debfc3dSmrg    i*86:*DOS:*:*)
1131c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-msdosdjgpp
11321debfc3dSmrg	exit ;;
1133a2dc1f3fSmrg    i*86:*:4.*:*)
1134c0a68be4Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
11351debfc3dSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1136c0a68be4Smrg		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
11371debfc3dSmrg	else
1138c0a68be4Smrg		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
11391debfc3dSmrg	fi
11401debfc3dSmrg	exit ;;
11411debfc3dSmrg    i*86:*:5:[678]*)
11421debfc3dSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
11431debfc3dSmrg	case `/bin/uname -X | grep "^Machine"` in
11441debfc3dSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
11451debfc3dSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
11461debfc3dSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
11471debfc3dSmrg	esac
1148*8feb0f0bSmrg	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
11491debfc3dSmrg	exit ;;
11501debfc3dSmrg    i*86:*:3.2:*)
11511debfc3dSmrg	if test -f /usr/options/cb.name; then
11521debfc3dSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1153c0a68be4Smrg		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
11541debfc3dSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11551debfc3dSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11561debfc3dSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11571debfc3dSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11581debfc3dSmrg			&& UNAME_MACHINE=i586
11591debfc3dSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11601debfc3dSmrg			&& UNAME_MACHINE=i686
11611debfc3dSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11621debfc3dSmrg			&& UNAME_MACHINE=i686
1163c0a68be4Smrg		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
11641debfc3dSmrg	else
1165c0a68be4Smrg		echo "$UNAME_MACHINE"-pc-sysv32
11661debfc3dSmrg	fi
11671debfc3dSmrg	exit ;;
11681debfc3dSmrg    pc:*:*:*)
11691debfc3dSmrg	# Left here for compatibility:
11701debfc3dSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
11711debfc3dSmrg	# the processor, so we play safe by assuming i586.
11721debfc3dSmrg	# Note: whatever this is, it MUST be the same as what config.sub
11731debfc3dSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
11741debfc3dSmrg	# this is a cross-build.
11751debfc3dSmrg	echo i586-pc-msdosdjgpp
11761debfc3dSmrg	exit ;;
11771debfc3dSmrg    Intel:Mach:3*:*)
11781debfc3dSmrg	echo i386-pc-mach3
11791debfc3dSmrg	exit ;;
11801debfc3dSmrg    paragon:*:*:*)
11811debfc3dSmrg	echo i860-intel-osf1
11821debfc3dSmrg	exit ;;
11831debfc3dSmrg    i860:*:4.*:*) # i860-SVR4
11841debfc3dSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1185c0a68be4Smrg	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
11861debfc3dSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1187c0a68be4Smrg	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
11881debfc3dSmrg	fi
11891debfc3dSmrg	exit ;;
11901debfc3dSmrg    mini*:CTIX:SYS*5:*)
11911debfc3dSmrg	# "miniframe"
11921debfc3dSmrg	echo m68010-convergent-sysv
11931debfc3dSmrg	exit ;;
11941debfc3dSmrg    mc68k:UNIX:SYSTEM5:3.51m)
11951debfc3dSmrg	echo m68k-convergent-sysv
11961debfc3dSmrg	exit ;;
11971debfc3dSmrg    M680?0:D-NIX:5.3:*)
11981debfc3dSmrg	echo m68k-diab-dnix
11991debfc3dSmrg	exit ;;
12001debfc3dSmrg    M68*:*:R3V[5678]*:*)
12011debfc3dSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12021debfc3dSmrg    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)
12031debfc3dSmrg	OS_REL=''
12041debfc3dSmrg	test -r /etc/.relid \
12051debfc3dSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12061debfc3dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1207c0a68be4Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12081debfc3dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1209c0a68be4Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12101debfc3dSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12111debfc3dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12121debfc3dSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
12131debfc3dSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
12141debfc3dSmrg	OS_REL='.3'
12151debfc3dSmrg	test -r /etc/.relid \
12161debfc3dSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12171debfc3dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1218c0a68be4Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12191debfc3dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1220c0a68be4Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
12211debfc3dSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1222c0a68be4Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12231debfc3dSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1224c0a68be4Smrg	echo m68k-unknown-lynxos"$UNAME_RELEASE"
12251debfc3dSmrg	exit ;;
12261debfc3dSmrg    mc68030:UNIX_System_V:4.*:*)
12271debfc3dSmrg	echo m68k-atari-sysv4
12281debfc3dSmrg	exit ;;
12291debfc3dSmrg    TSUNAMI:LynxOS:2.*:*)
1230c0a68be4Smrg	echo sparc-unknown-lynxos"$UNAME_RELEASE"
12311debfc3dSmrg	exit ;;
12321debfc3dSmrg    rs6000:LynxOS:2.*:*)
1233c0a68be4Smrg	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
12341debfc3dSmrg	exit ;;
12351debfc3dSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1236c0a68be4Smrg	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
12371debfc3dSmrg	exit ;;
12381debfc3dSmrg    SM[BE]S:UNIX_SV:*:*)
1239c0a68be4Smrg	echo mips-dde-sysv"$UNAME_RELEASE"
12401debfc3dSmrg	exit ;;
12411debfc3dSmrg    RM*:ReliantUNIX-*:*:*)
12421debfc3dSmrg	echo mips-sni-sysv4
12431debfc3dSmrg	exit ;;
12441debfc3dSmrg    RM*:SINIX-*:*:*)
12451debfc3dSmrg	echo mips-sni-sysv4
12461debfc3dSmrg	exit ;;
12471debfc3dSmrg    *:SINIX-*:*:*)
12481debfc3dSmrg	if uname -p 2>/dev/null >/dev/null ; then
12491debfc3dSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1250c0a68be4Smrg		echo "$UNAME_MACHINE"-sni-sysv4
12511debfc3dSmrg	else
12521debfc3dSmrg		echo ns32k-sni-sysv
12531debfc3dSmrg	fi
12541debfc3dSmrg	exit ;;
12551debfc3dSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
12561debfc3dSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
12571debfc3dSmrg	echo i586-unisys-sysv4
12581debfc3dSmrg	exit ;;
12591debfc3dSmrg    *:UNIX_System_V:4*:FTX*)
12601debfc3dSmrg	# From Gerald Hewes <hewes@openmarket.com>.
12611debfc3dSmrg	# How about differentiating between stratus architectures? -djm
12621debfc3dSmrg	echo hppa1.1-stratus-sysv4
12631debfc3dSmrg	exit ;;
12641debfc3dSmrg    *:*:*:FTX*)
12651debfc3dSmrg	# From seanf@swdc.stratus.com.
12661debfc3dSmrg	echo i860-stratus-sysv4
12671debfc3dSmrg	exit ;;
12681debfc3dSmrg    i*86:VOS:*:*)
12691debfc3dSmrg	# From Paul.Green@stratus.com.
1270c0a68be4Smrg	echo "$UNAME_MACHINE"-stratus-vos
12711debfc3dSmrg	exit ;;
12721debfc3dSmrg    *:VOS:*:*)
12731debfc3dSmrg	# From Paul.Green@stratus.com.
12741debfc3dSmrg	echo hppa1.1-stratus-vos
12751debfc3dSmrg	exit ;;
12761debfc3dSmrg    mc68*:A/UX:*:*)
1277c0a68be4Smrg	echo m68k-apple-aux"$UNAME_RELEASE"
12781debfc3dSmrg	exit ;;
12791debfc3dSmrg    news*:NEWS-OS:6*:*)
12801debfc3dSmrg	echo mips-sony-newsos6
12811debfc3dSmrg	exit ;;
12821debfc3dSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12831debfc3dSmrg	if [ -d /usr/nec ]; then
1284c0a68be4Smrg		echo mips-nec-sysv"$UNAME_RELEASE"
12851debfc3dSmrg	else
1286c0a68be4Smrg		echo mips-unknown-sysv"$UNAME_RELEASE"
12871debfc3dSmrg	fi
12881debfc3dSmrg	exit ;;
12891debfc3dSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
12901debfc3dSmrg	echo powerpc-be-beos
12911debfc3dSmrg	exit ;;
12921debfc3dSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
12931debfc3dSmrg	echo powerpc-apple-beos
12941debfc3dSmrg	exit ;;
12951debfc3dSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
12961debfc3dSmrg	echo i586-pc-beos
12971debfc3dSmrg	exit ;;
12981debfc3dSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
12991debfc3dSmrg	echo i586-pc-haiku
13001debfc3dSmrg	exit ;;
13011debfc3dSmrg    x86_64:Haiku:*:*)
13021debfc3dSmrg	echo x86_64-unknown-haiku
13031debfc3dSmrg	exit ;;
13041debfc3dSmrg    SX-4:SUPER-UX:*:*)
1305c0a68be4Smrg	echo sx4-nec-superux"$UNAME_RELEASE"
13061debfc3dSmrg	exit ;;
13071debfc3dSmrg    SX-5:SUPER-UX:*:*)
1308c0a68be4Smrg	echo sx5-nec-superux"$UNAME_RELEASE"
13091debfc3dSmrg	exit ;;
13101debfc3dSmrg    SX-6:SUPER-UX:*:*)
1311c0a68be4Smrg	echo sx6-nec-superux"$UNAME_RELEASE"
13121debfc3dSmrg	exit ;;
13131debfc3dSmrg    SX-7:SUPER-UX:*:*)
1314c0a68be4Smrg	echo sx7-nec-superux"$UNAME_RELEASE"
13151debfc3dSmrg	exit ;;
13161debfc3dSmrg    SX-8:SUPER-UX:*:*)
1317c0a68be4Smrg	echo sx8-nec-superux"$UNAME_RELEASE"
13181debfc3dSmrg	exit ;;
13191debfc3dSmrg    SX-8R:SUPER-UX:*:*)
1320c0a68be4Smrg	echo sx8r-nec-superux"$UNAME_RELEASE"
13211debfc3dSmrg	exit ;;
13221debfc3dSmrg    SX-ACE:SUPER-UX:*:*)
1323c0a68be4Smrg	echo sxace-nec-superux"$UNAME_RELEASE"
13241debfc3dSmrg	exit ;;
13251debfc3dSmrg    Power*:Rhapsody:*:*)
1326c0a68be4Smrg	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
13271debfc3dSmrg	exit ;;
13281debfc3dSmrg    *:Rhapsody:*:*)
1329c0a68be4Smrg	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
13301debfc3dSmrg	exit ;;
13311debfc3dSmrg    *:Darwin:*:*)
1332*8feb0f0bSmrg	UNAME_PROCESSOR=`uname -p`
1333*8feb0f0bSmrg	case $UNAME_PROCESSOR in
1334*8feb0f0bSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1335*8feb0f0bSmrg	esac
1336*8feb0f0bSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1337*8feb0f0bSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1338*8feb0f0bSmrg	    # Avoid executing cc if there is no toolchain installed as
1339*8feb0f0bSmrg	    # cc will be a stub that puts up a graphical alert
1340*8feb0f0bSmrg	    # prompting the user to install developer tools.
1341*8feb0f0bSmrg	    CC_FOR_BUILD=no_compiler_found
1342*8feb0f0bSmrg	else
1343c0a68be4Smrg	    set_cc_for_build
13441debfc3dSmrg	fi
13451debfc3dSmrg	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
13461debfc3dSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
13471debfc3dSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
13481debfc3dSmrg		   grep IS_64BIT_ARCH >/dev/null
13491debfc3dSmrg	    then
13501debfc3dSmrg		case $UNAME_PROCESSOR in
13511debfc3dSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
13521debfc3dSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
13531debfc3dSmrg		esac
13541debfc3dSmrg	    fi
1355a2dc1f3fSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1356a2dc1f3fSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1357a2dc1f3fSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1358a2dc1f3fSmrg		   grep IS_PPC >/dev/null
1359a2dc1f3fSmrg	    then
1360a2dc1f3fSmrg		UNAME_PROCESSOR=powerpc
1361a2dc1f3fSmrg	    fi
13621debfc3dSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1363*8feb0f0bSmrg	    # uname -m returns i386 or x86_64
1364*8feb0f0bSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
13651debfc3dSmrg	fi
1366c0a68be4Smrg	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
13671debfc3dSmrg	exit ;;
13681debfc3dSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
13691debfc3dSmrg	UNAME_PROCESSOR=`uname -p`
13701debfc3dSmrg	if test "$UNAME_PROCESSOR" = x86; then
13711debfc3dSmrg		UNAME_PROCESSOR=i386
13721debfc3dSmrg		UNAME_MACHINE=pc
13731debfc3dSmrg	fi
1374c0a68be4Smrg	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
13751debfc3dSmrg	exit ;;
13761debfc3dSmrg    *:QNX:*:4*)
13771debfc3dSmrg	echo i386-pc-qnx
13781debfc3dSmrg	exit ;;
1379a2dc1f3fSmrg    NEO-*:NONSTOP_KERNEL:*:*)
1380c0a68be4Smrg	echo neo-tandem-nsk"$UNAME_RELEASE"
13811debfc3dSmrg	exit ;;
13821debfc3dSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1383c0a68be4Smrg	echo nse-tandem-nsk"$UNAME_RELEASE"
13841debfc3dSmrg	exit ;;
1385a2dc1f3fSmrg    NSR-*:NONSTOP_KERNEL:*:*)
1386c0a68be4Smrg	echo nsr-tandem-nsk"$UNAME_RELEASE"
1387c0a68be4Smrg	exit ;;
1388c0a68be4Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1389c0a68be4Smrg	echo nsv-tandem-nsk"$UNAME_RELEASE"
13901debfc3dSmrg	exit ;;
1391a2dc1f3fSmrg    NSX-*:NONSTOP_KERNEL:*:*)
1392c0a68be4Smrg	echo nsx-tandem-nsk"$UNAME_RELEASE"
13931debfc3dSmrg	exit ;;
13941debfc3dSmrg    *:NonStop-UX:*:*)
13951debfc3dSmrg	echo mips-compaq-nonstopux
13961debfc3dSmrg	exit ;;
13971debfc3dSmrg    BS2000:POSIX*:*:*)
13981debfc3dSmrg	echo bs2000-siemens-sysv
13991debfc3dSmrg	exit ;;
14001debfc3dSmrg    DS/*:UNIX_System_V:*:*)
1401c0a68be4Smrg	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
14021debfc3dSmrg	exit ;;
14031debfc3dSmrg    *:Plan9:*:*)
14041debfc3dSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
14051debfc3dSmrg	# is converted to i386 for consistency with other x86
14061debfc3dSmrg	# operating systems.
1407c0a68be4Smrg	# shellcheck disable=SC2154
14081debfc3dSmrg	if test "$cputype" = 386; then
14091debfc3dSmrg	    UNAME_MACHINE=i386
14101debfc3dSmrg	else
14111debfc3dSmrg	    UNAME_MACHINE="$cputype"
14121debfc3dSmrg	fi
1413c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-plan9
14141debfc3dSmrg	exit ;;
14151debfc3dSmrg    *:TOPS-10:*:*)
14161debfc3dSmrg	echo pdp10-unknown-tops10
14171debfc3dSmrg	exit ;;
14181debfc3dSmrg    *:TENEX:*:*)
14191debfc3dSmrg	echo pdp10-unknown-tenex
14201debfc3dSmrg	exit ;;
14211debfc3dSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14221debfc3dSmrg	echo pdp10-dec-tops20
14231debfc3dSmrg	exit ;;
14241debfc3dSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14251debfc3dSmrg	echo pdp10-xkl-tops20
14261debfc3dSmrg	exit ;;
14271debfc3dSmrg    *:TOPS-20:*:*)
14281debfc3dSmrg	echo pdp10-unknown-tops20
14291debfc3dSmrg	exit ;;
14301debfc3dSmrg    *:ITS:*:*)
14311debfc3dSmrg	echo pdp10-unknown-its
14321debfc3dSmrg	exit ;;
14331debfc3dSmrg    SEI:*:*:SEIUX)
1434c0a68be4Smrg	echo mips-sei-seiux"$UNAME_RELEASE"
14351debfc3dSmrg	exit ;;
14361debfc3dSmrg    *:DragonFly:*:*)
1437c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
14381debfc3dSmrg	exit ;;
14391debfc3dSmrg    *:*VMS:*:*)
14401debfc3dSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1441c0a68be4Smrg	case "$UNAME_MACHINE" in
14421debfc3dSmrg	    A*) echo alpha-dec-vms ; exit ;;
14431debfc3dSmrg	    I*) echo ia64-dec-vms ; exit ;;
14441debfc3dSmrg	    V*) echo vax-dec-vms ; exit ;;
14451debfc3dSmrg	esac ;;
14461debfc3dSmrg    *:XENIX:*:SysV)
14471debfc3dSmrg	echo i386-pc-xenix
14481debfc3dSmrg	exit ;;
14491debfc3dSmrg    i*86:skyos:*:*)
1450c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
14511debfc3dSmrg	exit ;;
14521debfc3dSmrg    i*86:rdos:*:*)
1453c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-rdos
14541debfc3dSmrg	exit ;;
14551debfc3dSmrg    i*86:AROS:*:*)
1456c0a68be4Smrg	echo "$UNAME_MACHINE"-pc-aros
14571debfc3dSmrg	exit ;;
14581debfc3dSmrg    x86_64:VMkernel:*:*)
1459c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-esx
14601debfc3dSmrg	exit ;;
14611debfc3dSmrg    amd64:Isilon\ OneFS:*:*)
14621debfc3dSmrg	echo x86_64-unknown-onefs
14631debfc3dSmrg	exit ;;
1464c0a68be4Smrg    *:Unleashed:*:*)
1465c0a68be4Smrg	echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
1466c0a68be4Smrg	exit ;;
14671debfc3dSmrgesac
14681debfc3dSmrg
1469*8feb0f0bSmrg# No uname command or uname output not recognized.
1470*8feb0f0bSmrgset_cc_for_build
1471*8feb0f0bSmrgcat > "$dummy.c" <<EOF
1472*8feb0f0bSmrg#ifdef _SEQUENT_
1473*8feb0f0bSmrg#include <sys/types.h>
1474*8feb0f0bSmrg#include <sys/utsname.h>
1475*8feb0f0bSmrg#endif
1476*8feb0f0bSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1477*8feb0f0bSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1478*8feb0f0bSmrg#include <signal.h>
1479*8feb0f0bSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1480*8feb0f0bSmrg#include <sys/utsname.h>
1481*8feb0f0bSmrg#endif
1482*8feb0f0bSmrg#endif
1483*8feb0f0bSmrg#endif
1484*8feb0f0bSmrgmain ()
1485*8feb0f0bSmrg{
1486*8feb0f0bSmrg#if defined (sony)
1487*8feb0f0bSmrg#if defined (MIPSEB)
1488*8feb0f0bSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1489*8feb0f0bSmrg     I don't know....  */
1490*8feb0f0bSmrg  printf ("mips-sony-bsd\n"); exit (0);
1491*8feb0f0bSmrg#else
1492*8feb0f0bSmrg#include <sys/param.h>
1493*8feb0f0bSmrg  printf ("m68k-sony-newsos%s\n",
1494*8feb0f0bSmrg#ifdef NEWSOS4
1495*8feb0f0bSmrg  "4"
1496*8feb0f0bSmrg#else
1497*8feb0f0bSmrg  ""
1498*8feb0f0bSmrg#endif
1499*8feb0f0bSmrg  ); exit (0);
1500*8feb0f0bSmrg#endif
1501*8feb0f0bSmrg#endif
1502*8feb0f0bSmrg
1503*8feb0f0bSmrg#if defined (NeXT)
1504*8feb0f0bSmrg#if !defined (__ARCHITECTURE__)
1505*8feb0f0bSmrg#define __ARCHITECTURE__ "m68k"
1506*8feb0f0bSmrg#endif
1507*8feb0f0bSmrg  int version;
1508*8feb0f0bSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1509*8feb0f0bSmrg  if (version < 4)
1510*8feb0f0bSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1511*8feb0f0bSmrg  else
1512*8feb0f0bSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1513*8feb0f0bSmrg  exit (0);
1514*8feb0f0bSmrg#endif
1515*8feb0f0bSmrg
1516*8feb0f0bSmrg#if defined (MULTIMAX) || defined (n16)
1517*8feb0f0bSmrg#if defined (UMAXV)
1518*8feb0f0bSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
1519*8feb0f0bSmrg#else
1520*8feb0f0bSmrg#if defined (CMU)
1521*8feb0f0bSmrg  printf ("ns32k-encore-mach\n"); exit (0);
1522*8feb0f0bSmrg#else
1523*8feb0f0bSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
1524*8feb0f0bSmrg#endif
1525*8feb0f0bSmrg#endif
1526*8feb0f0bSmrg#endif
1527*8feb0f0bSmrg
1528*8feb0f0bSmrg#if defined (__386BSD__)
1529*8feb0f0bSmrg  printf ("i386-pc-bsd\n"); exit (0);
1530*8feb0f0bSmrg#endif
1531*8feb0f0bSmrg
1532*8feb0f0bSmrg#if defined (sequent)
1533*8feb0f0bSmrg#if defined (i386)
1534*8feb0f0bSmrg  printf ("i386-sequent-dynix\n"); exit (0);
1535*8feb0f0bSmrg#endif
1536*8feb0f0bSmrg#if defined (ns32000)
1537*8feb0f0bSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1538*8feb0f0bSmrg#endif
1539*8feb0f0bSmrg#endif
1540*8feb0f0bSmrg
1541*8feb0f0bSmrg#if defined (_SEQUENT_)
1542*8feb0f0bSmrg  struct utsname un;
1543*8feb0f0bSmrg
1544*8feb0f0bSmrg  uname(&un);
1545*8feb0f0bSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1546*8feb0f0bSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1547*8feb0f0bSmrg  }
1548*8feb0f0bSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1549*8feb0f0bSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1550*8feb0f0bSmrg  }
1551*8feb0f0bSmrg  printf ("i386-sequent-ptx\n"); exit (0);
1552*8feb0f0bSmrg#endif
1553*8feb0f0bSmrg
1554*8feb0f0bSmrg#if defined (vax)
1555*8feb0f0bSmrg#if !defined (ultrix)
1556*8feb0f0bSmrg#include <sys/param.h>
1557*8feb0f0bSmrg#if defined (BSD)
1558*8feb0f0bSmrg#if BSD == 43
1559*8feb0f0bSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1560*8feb0f0bSmrg#else
1561*8feb0f0bSmrg#if BSD == 199006
1562*8feb0f0bSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1563*8feb0f0bSmrg#else
1564*8feb0f0bSmrg  printf ("vax-dec-bsd\n"); exit (0);
1565*8feb0f0bSmrg#endif
1566*8feb0f0bSmrg#endif
1567*8feb0f0bSmrg#else
1568*8feb0f0bSmrg  printf ("vax-dec-bsd\n"); exit (0);
1569*8feb0f0bSmrg#endif
1570*8feb0f0bSmrg#else
1571*8feb0f0bSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1572*8feb0f0bSmrg  struct utsname un;
1573*8feb0f0bSmrg  uname (&un);
1574*8feb0f0bSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1575*8feb0f0bSmrg#else
1576*8feb0f0bSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1577*8feb0f0bSmrg#endif
1578*8feb0f0bSmrg#endif
1579*8feb0f0bSmrg#endif
1580*8feb0f0bSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1581*8feb0f0bSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1582*8feb0f0bSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1583*8feb0f0bSmrg  struct utsname *un;
1584*8feb0f0bSmrg  uname (&un);
1585*8feb0f0bSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1586*8feb0f0bSmrg#else
1587*8feb0f0bSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1588*8feb0f0bSmrg#endif
1589*8feb0f0bSmrg#endif
1590*8feb0f0bSmrg#endif
1591*8feb0f0bSmrg
1592*8feb0f0bSmrg#if defined (alliant) && defined (i860)
1593*8feb0f0bSmrg  printf ("i860-alliant-bsd\n"); exit (0);
1594*8feb0f0bSmrg#endif
1595*8feb0f0bSmrg
1596*8feb0f0bSmrg  exit (1);
1597*8feb0f0bSmrg}
1598*8feb0f0bSmrgEOF
1599*8feb0f0bSmrg
1600*8feb0f0bSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1601*8feb0f0bSmrg	{ echo "$SYSTEM_NAME"; exit; }
1602*8feb0f0bSmrg
1603*8feb0f0bSmrg# Apollos put the system type in the environment.
1604*8feb0f0bSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1605*8feb0f0bSmrg
1606a2dc1f3fSmrgecho "$0: unable to guess system type" >&2
1607a2dc1f3fSmrg
1608c0a68be4Smrgcase "$UNAME_MACHINE:$UNAME_SYSTEM" in
1609a2dc1f3fSmrg    mips:Linux | mips64:Linux)
1610a2dc1f3fSmrg	# If we got here on MIPS GNU/Linux, output extra information.
16111debfc3dSmrg	cat >&2 <<EOF
1612a2dc1f3fSmrg
1613a2dc1f3fSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1614a2dc1f3fSmrgthe system type. Please install a C compiler and try again.
1615a2dc1f3fSmrgEOF
1616a2dc1f3fSmrg	;;
1617a2dc1f3fSmrgesac
1618a2dc1f3fSmrg
1619a2dc1f3fSmrgcat >&2 <<EOF
16201debfc3dSmrg
16211debfc3dSmrgThis script (version $timestamp), has failed to recognize the
1622a2dc1f3fSmrgoperating system you are using. If your script is old, overwrite *all*
1623a2dc1f3fSmrgcopies of config.guess and config.sub with the latest versions from:
16241debfc3dSmrg
1625a2dc1f3fSmrg  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
16261debfc3dSmrgand
1627a2dc1f3fSmrg  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
16281debfc3dSmrg
16291debfc3dSmrgIf $0 has already been updated, send the following data and any
16301debfc3dSmrginformation you think might be pertinent to config-patches@gnu.org to
16311debfc3dSmrgprovide the necessary information to handle your system.
16321debfc3dSmrg
16331debfc3dSmrgconfig.guess timestamp = $timestamp
16341debfc3dSmrg
16351debfc3dSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
16361debfc3dSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
16371debfc3dSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
16381debfc3dSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
16391debfc3dSmrg
16401debfc3dSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
16411debfc3dSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
16421debfc3dSmrg
16431debfc3dSmrghostinfo               = `(hostinfo) 2>/dev/null`
16441debfc3dSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
16451debfc3dSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
16461debfc3dSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
16471debfc3dSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
16481debfc3dSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
16491debfc3dSmrg
1650c0a68be4SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1651c0a68be4SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1652c0a68be4SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1653c0a68be4SmrgUNAME_VERSION = "$UNAME_VERSION"
16541debfc3dSmrgEOF
16551debfc3dSmrg
16561debfc3dSmrgexit 1
16571debfc3dSmrg
16581debfc3dSmrg# Local variables:
1659c0a68be4Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
16601debfc3dSmrg# time-stamp-start: "timestamp='"
16611debfc3dSmrg# time-stamp-format: "%:y-%02m-%02d"
16621debfc3dSmrg# time-stamp-end: "'"
16631debfc3dSmrg# End:
1664